All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
FakePhotoS Class Reference
Inheritance diagram for FakePhotoS:

Public Member Functions

 FakePhotoS (fhicl::ParameterSet const &p)
 
 FakePhotoS (FakePhotoS const &)=delete
 
 FakePhotoS (FakePhotoS &&)=delete
 
FakePhotoSoperator= (FakePhotoS const &)=delete
 
FakePhotoSoperator= (FakePhotoS &&)=delete
 
void produce (art::Event &e) override
 
void beginRun (art::Run &run) override
 

Private Member Functions

std::vector< double > GenerateTime (size_t numphotons)
 

Private Attributes

bool _verbose
 
double _frequency
 [MHz] More...
 
double _duration
 [us] More...
 
double _tstart
 [ns] More...
 
size_t _min_pe
 [p.e.] More...
 
size_t _max_pe
 [p.e.] More...
 
bool _simulate_time
 whether or not to simulate scintillation fall time More...
 
double _fast_frac
 fraction of prompt light More...
 
double _fast_tau
 scintillation emission time constant for fast component More...
 
double _slow_tau
 scintillation emission time constant for slow component More...
 
std::vector< unsigned int > _ch_v
 
CLHEP::HepRandomEngine & fFlatEngine
 
CLHEP::RandFlat * fFlatRandom
 
CLHEP::RandExponential * fExpoRandom
 

Detailed Description

Definition at line 35 of file FakePhotoS_module.cc.

Constructor & Destructor Documentation

FakePhotoS::FakePhotoS ( fhicl::ParameterSet const &  p)
explicit

Definition at line 72 of file FakePhotoS_module.cc.

73  : EDProducer{p}
74  , fFlatEngine(art::ServiceHandle<rndm::NuRandomService>()->createEngine(*this, "HepJamesRandom", "Gen", p, "Seed"))
75  // More initializers here.
76 {
77  _verbose = p.get<bool>("Verbose",false); // If you want someone to talk to you
78  auto min_pe = p.get<int>("MinPE",1); // Min of the range of PE count to be injected in one shot
79  auto max_pe = p.get<int>("MaxPE",1); // Max of the range of PE count to be injected in one shot
80  assert(min_pe <= max_pe && min_pe>0 && max_pe>0);
81  _min_pe = min_pe;
82  _max_pe = max_pe;
83  _ch_v.clear();
84  _ch_v = p.get<std::vector<unsigned int> >("Channels",_ch_v); // Specify if you want to use only select channels
85  _frequency = p.get<double>("Frequency"); // The frequency of photon(s) injection
86  _duration = p.get<double>("Duration"); // The duration of photon(s) injection period
87  _tstart = p.get<double>("G4TStart"); // The start time of photon injection period
88  produces<std::vector<sim::SimPhotons> >();
90  // scintillation params (yeah fine you can replace these w/ service)
91  _simulate_time = p.get<bool>("SimulateTime",false); // scintillation fall timing simulation
92  _fast_frac = p.get<double>("PromptLightFraction",0.23);
93  _fast_tau = p.get<double>("FastTimeConstant",0.006);
94  _slow_tau = p.get<double>("SlowTimeConstant",1.5);
95 
96  fFlatRandom = new CLHEP::RandFlat(fFlatEngine,_min_pe,_max_pe);
97  fExpoRandom = new CLHEP::RandExponential(fFlatEngine);
98 }
CLHEP::RandFlat * fFlatRandom
double _fast_tau
scintillation emission time constant for fast component
double _frequency
[MHz]
size_t _min_pe
[p.e.]
double _slow_tau
scintillation emission time constant for slow component
pdgs p
Definition: selectors.fcl:22
produces< sumdata::RunData, art::InRun >()
double _tstart
[ns]
std::vector< unsigned int > _ch_v
double _duration
[us]
bool _simulate_time
whether or not to simulate scintillation fall time
size_t _max_pe
[p.e.]
CLHEP::HepRandomEngine & fFlatEngine
CLHEP::RandExponential * fExpoRandom
double _fast_frac
fraction of prompt light
FakePhotoS::FakePhotoS ( FakePhotoS const &  )
delete
FakePhotoS::FakePhotoS ( FakePhotoS &&  )
delete

Member Function Documentation

void FakePhotoS::beginRun ( art::Run &  run)
override

Definition at line 100 of file FakePhotoS_module.cc.

101 {
102  // grab the geometry object to see what geometry we are using
103  art::ServiceHandle<geo::Geometry> geo;
104 
105  std::unique_ptr<sumdata::RunData> runData(new sumdata::RunData(geo->DetectorName()));
106 
107  run.put(std::move(runData));
108 
109  return;
110 }
std::vector< double > FakePhotoS::GenerateTime ( size_t  numphotons)
private

Definition at line 113 of file FakePhotoS_module.cc.

113  {
114 
115  std::vector<double> res(numphotons);
116  for(int i=0; i<((int)numphotons); ++i) {
117  if(fFlatRandom->fire(0.,1.) < _fast_frac)
118  res[i] = fExpoRandom->fire(_fast_tau);
119  else res[i] = fExpoRandom->fire(_slow_tau);
120  }
121  return res;
122 }
CLHEP::RandFlat * fFlatRandom
double _fast_tau
scintillation emission time constant for fast component
double _slow_tau
scintillation emission time constant for slow component
CLHEP::RandExponential * fExpoRandom
double _fast_frac
fraction of prompt light
FakePhotoS& FakePhotoS::operator= ( FakePhotoS const &  )
delete
FakePhotoS& FakePhotoS::operator= ( FakePhotoS &&  )
delete
void FakePhotoS::produce ( art::Event &  e)
override

Definition at line 124 of file FakePhotoS_module.cc.

125 {
126  // Implementation of required member function here.
127  auto simph_v = std::unique_ptr<std::vector<sim::SimPhotons> >(new std::vector<sim::SimPhotons>());
128 
129  if(_ch_v.empty()) {
130  auto const geop = lar::providerFrom<geo::Geometry>();
131  _ch_v.reserve(geop->NOpChannels());
132  for(size_t opch=0; opch<geop->NOpChannels(); ++opch)
133  _ch_v.push_back(opch);
134  }
135  simph_v->reserve(_ch_v.size());
136  for(auto const& opch : _ch_v) {
137  if(_verbose) std::cout << "OpChannel " << opch << std::endl;
138  sim::SimPhotons sphot(opch);
139  sphot.reserve(int(_duration * _frequency));
140  double clock = 0.;
141  while(clock <= _duration) {
142 
143  size_t npe = fFlatRandom->fire(_min_pe,_max_pe+0.999999);
144  if(_verbose) std::cout << npe << "@" << (int)(_tstart + clock * 1.e3) << "[ns] " << std::flush;
145  std::vector<double> time_array(npe,0.);
146  if(_simulate_time) time_array = this->GenerateTime(npe);
147  for(size_t ctr=0;ctr<npe;++ctr) {
148  sim::OnePhoton phot;
149  phot.Time = _tstart + clock * 1.e3 + time_array[ctr];
150  sphot.emplace_back(std::move(phot));
151  }
152  clock += (1./_frequency);
153  }
154  if(_verbose) std::cout << std::endl;
155  simph_v->emplace_back(std::move(sphot));
156  }
157 
158  e.put(std::move(simph_v));
159 }
CLHEP::RandFlat * fFlatRandom
double _frequency
[MHz]
size_t _min_pe
[p.e.]
All information of a photon entering the sensitive optical detector volume.
Definition: SimPhotons.h:64
std::vector< double > GenerateTime(size_t numphotons)
double _tstart
[ns]
std::vector< unsigned int > _ch_v
double _duration
[us]
Collection of photons which recorded on one channel.
Definition: SimPhotons.h:136
bool _simulate_time
whether or not to simulate scintillation fall time
do i e
size_t _max_pe
[p.e.]
BEGIN_PROLOG could also be cout

Member Data Documentation

std::vector<unsigned int> FakePhotoS::_ch_v
private

Definition at line 64 of file FakePhotoS_module.cc.

double FakePhotoS::_duration
private

[us]

Definition at line 56 of file FakePhotoS_module.cc.

double FakePhotoS::_fast_frac
private

fraction of prompt light

Definition at line 61 of file FakePhotoS_module.cc.

double FakePhotoS::_fast_tau
private

scintillation emission time constant for fast component

Definition at line 62 of file FakePhotoS_module.cc.

double FakePhotoS::_frequency
private

[MHz]

Definition at line 55 of file FakePhotoS_module.cc.

size_t FakePhotoS::_max_pe
private

[p.e.]

Definition at line 59 of file FakePhotoS_module.cc.

size_t FakePhotoS::_min_pe
private

[p.e.]

Definition at line 58 of file FakePhotoS_module.cc.

bool FakePhotoS::_simulate_time
private

whether or not to simulate scintillation fall time

Definition at line 60 of file FakePhotoS_module.cc.

double FakePhotoS::_slow_tau
private

scintillation emission time constant for slow component

Definition at line 63 of file FakePhotoS_module.cc.

double FakePhotoS::_tstart
private

[ns]

Definition at line 57 of file FakePhotoS_module.cc.

bool FakePhotoS::_verbose
private

Definition at line 54 of file FakePhotoS_module.cc.

CLHEP::RandExponential* FakePhotoS::fExpoRandom
private

Definition at line 68 of file FakePhotoS_module.cc.

CLHEP::HepRandomEngine& FakePhotoS::fFlatEngine
private

Definition at line 66 of file FakePhotoS_module.cc.

CLHEP::RandFlat* FakePhotoS::fFlatRandom
private

Definition at line 67 of file FakePhotoS_module.cc.


The documentation for this class was generated from the following file: