All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DigiPMTSBNDAlg.cc
Go to the documentation of this file.
2 
3 //------------------------------------------------------------------------------
4 //--- opdet::simpmtsbndAlg implementation
5 //------------------------------------------------------------------------------
6 
7 namespace opdet {
8 
9 
11  : fParams(config)
12  , fSampling(fParams.frequency)
13  , fQEDirect(fParams.QEDirect / fParams.larProp->ScintPreScale())
14  , fQERefl(fParams.QERefl / fParams.larProp->ScintPreScale())
15  // , fSinglePEmodel(fParams.SinglePEmodel)
16  , fEngine(fParams.engine)
17  , fFlatGen(*fEngine)
18  , fPoissonQGen(*fEngine)
19  , fGaussQGen(*fEngine)
20  , fExponentialGen(*fEngine)
21  {
22 
23  mf::LogInfo("DigiPMTSBNDAlg") << "PMT corrected efficiencies = "
24  << fQEDirect << " " << fQERefl;
25 
26  if(fQERefl > 1.0001 || fQEDirect > 1.0001)
27  mf::LogWarning("DigiPMTSBNDAlg")
28  << "Quantum efficiency set in fhicl file " << fParams.QERefl
29  << " or " << fParams.QEDirect << " seems to be too large!\n"
30  << "Final QE must be equal or smaller than the scintillation "
31  << "pre scale applied at simulation time.\n"
32  << "Please check this number (ScintPreScale): "
34 
35  fSampling = fSampling / 1000.0; //in GHz, to cancel with ns
36 
37  std::string fname;
38  cet::search_path sp("FW_SEARCH_PATH");
39  sp.find_file(fParams.PMTDataFile, fname);
40  TFile* file = TFile::Open(fname.c_str(), "READ");
41 
42  // TPB emission time histogram for pmt_coated histogram
43  std::vector<double>* timeTPB_p;
44  file->GetObject("timeTPB", timeTPB_p);
45  fTimeTPB = std::make_unique<CLHEP::RandGeneral>
46  (*fEngine, timeTPB_p->data(), timeTPB_p->size());
47 
48  //shape of single pulse
50  mf::LogDebug("DigiPMTSBNDAlg") << " using testbench pe response";
51  std::vector<double>* SinglePEVec_p;
52  file->GetObject("SinglePEVec", SinglePEVec_p);
53  fSinglePEWave = *SinglePEVec_p;
54  pulsesize = fSinglePEWave.size();
55  }
56  else {
57  mf::LogDebug("DigiPMTSBNDAlg") << " using ideal pe response";
58  //shape of single pulse
59  sigma1 = fParams.PMTRiseTime / (std::sqrt(2.0) * (std::sqrt(-std::log(0.1)) - std::sqrt(-std::log(0.9))));
60  sigma2 = fParams.PMTFallTime / (std::sqrt(2.0) * (std::sqrt(-std::log(0.1)) - std::sqrt(-std::log(0.9))));
61 
62  pulsesize = (int)((6 * sigma2 + fParams.TransitTime) * fSampling);
63  fSinglePEWave.resize(pulsesize);
65  }
66 
68  fPMTGainFluctuationsPtr = art::make_tool<opdet::PMTGainFluctuations>(fParams.GainFluctuationsParams);
69  }
70 
72  file->Close();
73  } // end constructor
74 
75 
77 
78 
80  int ch,
81  sim::SimPhotons const& simphotons,
82  std::vector<short unsigned int>& waveform,
83  std::string pdtype,
84  double start_time,
85  unsigned n_sample)
86  {
87  std::vector<double> waves(n_sample, fParams.PMTBaseline);
88  CreatePDWaveform(simphotons, start_time, waves, ch, pdtype);
89  waveform = std::vector<short unsigned int> (waves.begin(), waves.end());
90  }
91 
93  int ch,
94  std::vector<short unsigned int>& waveform,
95  std::unordered_map<int, sim::SimPhotons>& DirectPhotonsMap,
96  std::unordered_map<int, sim::SimPhotons>& ReflectedPhotonsMap,
97  double start_time,
98  unsigned n_sample)
99  {
100  std::vector<double> waves(n_sample, fParams.PMTBaseline);
101  CreatePDWaveformCoatedPMT(ch, start_time, waves, DirectPhotonsMap, ReflectedPhotonsMap);
102  waveform = std::vector<short unsigned int> (waves.begin(), waves.end());
103  }
104 
105 
107  int ch,
108  sim::SimPhotonsLite const& litesimphotons,
109  std::vector<short unsigned int>& waveform,
110  std::string pdtype,
111  double start_time,
112  unsigned n_sample)
113  {
114  std::vector<double> waves(n_sample, fParams.PMTBaseline);
115  CreatePDWaveformLite(litesimphotons, start_time, waves, ch, pdtype);
116  waveform = std::vector<short unsigned int> (waves.begin(), waves.end());
117  }
118 
119 
121  int ch,
122  std::vector<short unsigned int>& waveform,
123  std::unordered_map<int, sim::SimPhotonsLite>& DirectPhotonsMap,
124  std::unordered_map<int, sim::SimPhotonsLite>& ReflectedPhotonsMap,
125  double start_time,
126  unsigned n_sample)
127  {
128  std::vector<double> waves(n_sample, fParams.PMTBaseline);
129  CreatePDWaveformLiteCoatedPMT(ch, start_time, waves, DirectPhotonsMap, ReflectedPhotonsMap);
130  waveform = std::vector<short unsigned int> (waves.begin(), waves.end());
131  }
132 
133 
135  sim::SimPhotons const& simphotons,
136  double t_min,
137  std::vector<double>& wave,
138  int ch,
139  std::string pdtype)
140  {
141  double ttsTime = 0;
142  double tphoton;
143  size_t timeBin;
144  double ttpb=0;
145  for(size_t i = 0; i < simphotons.size(); i++) { //simphotons is here reflected light. To be added for all PMTs
146  if(fFlatGen.fire(1.0) < fQERefl) {
147  if(fParams.TTS > 0.0) ttsTime = Transittimespread(fParams.TTS);
148  ttpb = fTimeTPB->fire(); //for including TPB emission time
149  tphoton = ttsTime + simphotons[i].Time - t_min + ttpb + fParams.CableTime;
150  if(tphoton < 0.) continue; // discard if it didn't made it to the acquisition
151  timeBin = std::floor(tphoton*fSampling);
152  if(timeBin < wave.size()) {AddSPE(timeBin, wave);}
153  }
154  }
155 
156  if(fParams.PMTBaselineRMS > 0.0) AddLineNoise(wave);
157  if(fParams.PMTDarkNoiseRate > 0.0) AddDarkNoise(wave);
158  CreateSaturation(wave);
159  }
160 
161 
163  int ch,
164  double t_min,
165  std::vector<double>& wave,
166  std::unordered_map<int, sim::SimPhotons>& DirectPhotonsMap,
167  std::unordered_map<int, sim::SimPhotons>& ReflectedPhotonsMap)
168  {
169 
170  double ttsTime = 0;
171  double tphoton;
172  size_t timeBin;
173  double ttpb=0;
174  sim::SimPhotons auxphotons;
175 
176  //direct light
177  if(auto it{ DirectPhotonsMap.find(ch) }; it != std::end(DirectPhotonsMap) )
178  {auxphotons = it->second;}
179  for(size_t j = 0; j < auxphotons.size(); j++) { //auxphotons is direct light
180  if(fFlatGen.fire(1.0) < fQEDirect) {
181  if(fParams.TTS > 0.0) ttsTime = Transittimespread(fParams.TTS); //implementing transit time spread
182  ttpb = fTimeTPB->fire(); //for including TPB emission time
183  tphoton = ttsTime + auxphotons[j].Time - t_min + ttpb + fParams.CableTime;
184  if(tphoton < 0.) continue; // discard if it didn't made it to the acquisition
185  timeBin = std::floor(tphoton*fSampling);
186  if(timeBin < wave.size()) {AddSPE(timeBin, wave);}
187  }
188  }
189  // reflected light
190  if(auto it{ ReflectedPhotonsMap.find(ch) }; it != std::end(ReflectedPhotonsMap) )
191  {auxphotons = it->second;}
192  for(size_t j = 0; j < auxphotons.size(); j++) { //auxphotons is now reflected light
193  if(fFlatGen.fire(1.0) < fQERefl) {
194  if(fParams.TTS > 0.0) ttsTime = Transittimespread(fParams.TTS); //implementing transit time spread
195  ttpb = fTimeTPB->fire(); //for including TPB emission time
196  tphoton = ttsTime + auxphotons[j].Time - t_min + ttpb + fParams.CableTime;
197  if(tphoton < 0.) continue; // discard if it didn't made it to the acquisition
198  timeBin = std::floor(tphoton*fSampling);
199  if(timeBin < wave.size()) {AddSPE(timeBin, wave);}
200  }
201  }
202 
203  //Adding noise and saturation
204  if(fParams.PMTBaselineRMS > 0.0) AddLineNoise(wave);
205  if(fParams.PMTDarkNoiseRate > 0.0) AddDarkNoise(wave);
206  CreateSaturation(wave);
207  }
208 
209 
211  sim::SimPhotonsLite const& litesimphotons,
212  double t_min,
213  std::vector<double>& wave,
214  int ch,
215  std::string pdtype)
216  {
217  double mean_photons;
218  size_t accepted_photons;
219  double ttsTime = 0;
220  double tphoton;
221  size_t timeBin;
222  double ttpb=0;
223  // reflected light to be added to all PMTs
224  std::map<int, int> const& photonMap = litesimphotons.DetectedPhotons;
225  for (auto const& reflectedPhotons : photonMap) {
226  // TODO: check that this new approach of not using the last
227  // (1-accepted_photons) doesn't introduce some bias. ~icaza
228  mean_photons = reflectedPhotons.second*fQERefl;
229  accepted_photons = fPoissonQGen.fire(mean_photons);
230  for(size_t i = 0; i < accepted_photons; i++) {
231  if(fParams.TTS > 0.0) ttsTime = Transittimespread(fParams.TTS);
232  ttpb = fTimeTPB->fire(); //for including TPB emission time
233  tphoton = ttsTime + reflectedPhotons.first - t_min + ttpb + fParams.CableTime;
234  if(tphoton < 0.) continue; // discard if it didn't made it to the acquisition
235  timeBin = std::floor(tphoton*fSampling);
236  if(timeBin < wave.size()) {AddSPE(timeBin, wave);}
237  }
238  }
239 
240  if(fParams.PMTBaselineRMS > 0.0) AddLineNoise(wave);
241  if(fParams.PMTDarkNoiseRate > 0.0) AddDarkNoise(wave);
242  CreateSaturation(wave);
243  }
244 
245 
247  int ch,
248  double t_min,
249  std::vector<double>& wave,
250  std::unordered_map<int, sim::SimPhotonsLite>& DirectPhotonsMap,
251  std::unordered_map<int, sim::SimPhotonsLite>& ReflectedPhotonsMap)
252  {
253  double mean_photons;
254  size_t accepted_photons;
255  double ttsTime = 0;
256  double tphoton;
257  size_t timeBin;
258  double ttpb;
259  // direct light
260  if ( auto it{ DirectPhotonsMap.find(ch) }; it != std::end(DirectPhotonsMap) ){
261  for (auto& directPhotons : (it->second).DetectedPhotons) {
262  // TODO: check that this new approach of not using the last
263  // (1-accepted_photons) doesn't introduce some bias. ~icaza
264  mean_photons = directPhotons.second*fQEDirect;
265  accepted_photons = fPoissonQGen.fire(mean_photons);
266  for(size_t i = 0; i < accepted_photons; i++) {
267  if(fParams.TTS > 0.0) ttsTime = Transittimespread(fParams.TTS); //implementing transit time spread
268  ttpb = fTimeTPB->fire(); //for including TPB emission time
269  tphoton = ttsTime + directPhotons.first - t_min + ttpb + fParams.CableTime;
270  if(tphoton < 0.) continue; // discard if it didn't made it to the acquisition
271  timeBin = std::floor(tphoton*fSampling);
272  if(timeBin < wave.size()) {AddSPE(timeBin, wave);}
273  }
274  }
275  }
276 
277  // reflected light
278  if ( auto it{ ReflectedPhotonsMap.find(ch) }; it != std::end(ReflectedPhotonsMap) ){
279  for (auto& reflectedPhotons : (it->second).DetectedPhotons) {
280  // TODO: check that this new approach of not using the last
281  // (1-accepted_photons) doesn't introduce some bias. ~icaza
282  mean_photons = reflectedPhotons.second*fQERefl;
283  accepted_photons = fPoissonQGen.fire(mean_photons);
284  for(size_t i = 0; i < accepted_photons; i++) {
285  if(fParams.TTS > 0.0) ttsTime = Transittimespread(fParams.TTS); //implementing transit time spread
286  ttpb = fTimeTPB->fire(); //for including TPB emission time
287  tphoton = ttsTime + reflectedPhotons.first - t_min + ttpb + fParams.CableTime;
288  if(tphoton < 0.) continue; // discard if it didn't made it to the acquisition
289  timeBin = std::floor(tphoton*fSampling);
290  if(timeBin < wave.size()) {AddSPE(timeBin, wave);}
291  }
292  }
293  }
294 
295  //Adding noise and saturation
296  if(fParams.PMTBaselineRMS > 0.0) AddLineNoise(wave);
297  if(fParams.PMTDarkNoiseRate > 0.0) AddDarkNoise(wave);
298  CreateSaturation(wave);
299  }
300 
301 
302  void DigiPMTSBNDAlg::Pulse1PE(std::vector<double>& fSinglePEWave)//single pulse waveform
303  {
304  double time;
305  double constT1 = fParams.PMTChargeToADC * fParams.PMTMeanAmplitude;
306  double constT21 = 2.0 * sigma1 * sigma1;
307  double constT22 = 2.0 * sigma2 * sigma2;
308  for(size_t i = 0; i<fSinglePEWave.size(); i++) {
309  time = static_cast<double>(i) / fSampling;
310  if (time < fParams.TransitTime)
311  fSinglePEWave[i] = constT1 * std::exp(-1.0 * std::pow(time - fParams.TransitTime, 2) / constT21);
312  else
313  fSinglePEWave[i] = constT1 * std::exp(-1.0 * std::pow(time - fParams.TransitTime, 2) / constT22);
314  }
315  }
316 
317 
319  {
320  double tts, sigma;
321  sigma = fwhm / transitTimeSpread_frac;
322  tts = fGaussQGen.fire(0., sigma);
323  return tts;
324  }
325 
326 
327  void DigiPMTSBNDAlg::AddSPE(size_t time_bin, std::vector<double>& wave)
328  {
329  size_t max = time_bin + pulsesize < wave.size() ? time_bin + pulsesize : wave.size();
330  auto min_it = std::next(wave.begin(), time_bin);
331  auto max_it = std::next(wave.begin(), max);
333  double npe=fPMTGainFluctuationsPtr->GainFluctuation(1,fEngine);
334  std::transform(min_it, max_it,
335  fSinglePEWave.begin(), min_it,
336  [npe](auto a, auto b) { return a+npe*b; });
337  }
338  else{
339  std::transform(min_it, max_it,
340  fSinglePEWave.begin(), min_it,
341  std::plus<double>( ));
342  }
343  }
344 
345 
346  void DigiPMTSBNDAlg::CreateSaturation(std::vector<double>& wave)
347  {
348  std::replace_if(wave.begin(), wave.end(),
349  [&](auto w){return w < saturation;}, saturation);
350  }
351 
352 
353  void DigiPMTSBNDAlg::AddLineNoise(std::vector<double>& wave)
354  {
355  // TODO: after running the profiler I can see that this is where
356  // most cycles are being used. Potentially some improvement could
357  // be achieved with the below code but the array dynamic allocation
358  // is not helping. The function would need to have it passed.
359  // ~icaza
360  //
361  // double *array = new double[wave.size()]();
362  // CLHEP::RandGaussQ::shootArray(fEngine, wave.size(), array, 0, fParams.PMTBaselineRMS);
363  // for(size_t i = 0; i<wave.size(); i++) {
364  // wave[i] += array[i];
365  // }
366  // delete array;
367  //
368  std::transform(wave.begin(), wave.end(), wave.begin(),
369  [this](double w) -> double {
370  return w + fGaussQGen.fire(0., fParams.PMTBaselineRMS) ; });
371  }
372 
373 
374  void DigiPMTSBNDAlg::AddDarkNoise(std::vector<double>& wave)
375  {
376  size_t timeBin;
377  // Multiply by 10^9 since fParams.DarkNoiseRate is in Hz (conversion from s to ns)
378  double mean = 1000000000.0 / fParams.PMTDarkNoiseRate;
379  double darkNoiseTime = fExponentialGen.fire(mean);
380  while(darkNoiseTime < wave.size()) {
381  timeBin = std::round(darkNoiseTime);
382  if(timeBin < wave.size()) {AddSPE(timeBin, wave);}
383  // Find next time to add dark noise
384  darkNoiseTime += fExponentialGen.fire(mean);
385  }
386  }
387 
388 
389  // TODO: this function is not being used anywhere! ~icaza
391  sim::SimPhotons const& simphotons,
392  int ch,
393  std::string pdtype,
394  std::unordered_map<int, sim::SimPhotons>& directPhotonsOnPMTS)
395  {
396  double t_min = 1e15;
397 
398  if(pdtype == "pmt_uncoated") {
399  // TODO: use std::algorithm. ~icaza
400  for(size_t i = 0; i < simphotons.size(); i++) {
401  if(simphotons[i].Time < t_min) t_min = simphotons[i].Time;
402  }
403  }
404  else if(pdtype == "pmt_coated") {
405  sim::SimPhotons auxphotons;
406  if ( auto it{ directPhotonsOnPMTS.find(ch) }; it != std::end(directPhotonsOnPMTS) )
407  {auxphotons = it->second;}
408  auxphotons += (simphotons);
409  // TODO: use std::algorithm. ~icaza
410  for(size_t i = 0; i < auxphotons.size(); i++) {
411  if(auxphotons[i].Time < t_min) t_min = auxphotons[i].Time;
412  }
413  }
414  else {
415  throw cet::exception("DigiPMTSBNDAlg") << "Wrong pdtype: " << pdtype << std::endl;
416  }
417  return t_min;
418  }
419 
420 
421  // TODO: this function is not being used anywhere! ~icaza
423  sim::SimPhotonsLite const& litesimphotons,
424  int ch,
425  std::string pdtype,
426  std::unordered_map<int, sim::SimPhotonsLite>& directPhotonsOnPMTS)
427  {
428 
429  if(pdtype == "pmt_uncoated") {
430  std::map<int, int> const& photonMap = litesimphotons.DetectedPhotons;
431  auto min = std::find_if(
432  photonMap.begin(),
433  photonMap.end(),
434  [](const auto& pm) {return pm.second != 0; });
435  if(min != photonMap.end()) return double(min->first);
436  }
437  else if(pdtype == "pmt_coated") {
438  sim::SimPhotonsLite auxphotons;
439  if ( auto it{ directPhotonsOnPMTS.find(ch) }; it != std::end(directPhotonsOnPMTS) )
440  {auxphotons = it->second;}
441  // TODO: this might be buggy:
442  // potentially adding to a uninitialized object. ~icaza
443  auxphotons += (litesimphotons);
444  std::map<int, int> const& auxphotonMap = auxphotons.DetectedPhotons;
445  auto min = std::find_if(
446  auxphotonMap.begin(),
447  auxphotonMap.end(),
448  [](const auto& pm) {return pm.second != 0; });
449  if(min != auxphotonMap.end()) return double(min->first);
450  }
451  else {
452  throw cet::exception("DigiPMTSBNDAlg") << "Wrong pdtype: " << pdtype << std::endl;
453  }
454  return 1e5;
455  }
456 
457  // -----------------------------------------------------------------------------
458  // --- opdet::DigiPMTSBNDAlgMaker
459  // -----------------------------------------------------------------------------
460 
462  (Config const& config)
463  {
464  // settings
465  fBaseConfig.PMTChargeToADC = config.pmtchargeToADC();
466  fBaseConfig.PMTBaseline = config.pmtbaseline();
467  fBaseConfig.PMTSaturation = config.pmtsaturation();
468  fBaseConfig.QEDirect = config.qEDirect();
469  fBaseConfig.QERefl = config.qERefl();
470  fBaseConfig.PMTSinglePEmodel = config.PMTsinglePEmodel();
471  fBaseConfig.PMTRiseTime = config.pmtriseTime();
472  fBaseConfig.PMTFallTime = config.pmtfallTime();
473  fBaseConfig.PMTMeanAmplitude = config.pmtmeanAmplitude();
474  fBaseConfig.PMTDarkNoiseRate = config.pmtdarkNoiseRate();
475  fBaseConfig.PMTBaselineRMS = config.pmtbaselineRMS();
476  fBaseConfig.TransitTime = config.transitTime();
477  fBaseConfig.TTS = config.tts();
478  fBaseConfig.CableTime = config.cableTime();
479  fBaseConfig.PMTDataFile = config.pmtDataFile();
480  fBaseConfig.MakeGainFluctuations = config.makeGainFluctuations();
481  config.gainFluctuationsParams.get_if_present(fBaseConfig.GainFluctuationsParams);
482  }
483 
484  std::unique_ptr<DigiPMTSBNDAlg>
486  detinfo::LArProperties const& larProp,
487  detinfo::DetectorClocksData const& clockData,
488  CLHEP::HepRandomEngine* engine
489  ) const
490  {
491  // set the configuration
492  auto params = fBaseConfig;
493 
494  // set up parameters
495  params.larProp = &larProp;
496  params.frequency = clockData.OpticalClock().Frequency();
497  params.engine = engine;
498 
499  return std::make_unique<DigiPMTSBNDAlg>(params);
500  } // DigiPMTSBNDAlgMaker::create()
501 
502 }
std::unique_ptr< CLHEP::RandGeneral > fTimeTPB
void CreatePDWaveformLiteCoatedPMT(int ch, double t_min, std::vector< double > &wave, std::unordered_map< int, sim::SimPhotonsLite > &DirectPhotonsMap, std::unordered_map< int, sim::SimPhotonsLite > &ReflectedPhotonsMap)
void CreatePDWaveformLite(sim::SimPhotonsLite const &litesimphotons, double t_min, std::vector< double > &wave, int ch, std::string pdtype)
ConfigurationParameters_t fParams
void ConstructWaveform(int ch, sim::SimPhotons const &simphotons, std::vector< short unsigned int > &waveform, std::string pdtype, double start_time, unsigned n_sample)
CLHEP::RandExponential fExponentialGen
string fname
Definition: demo.py:5
static constexpr Sample_t transform(Sample_t sample)
stream1 stream1 can override from command line with o or output services LArPropertiesService ScintPreScale
CLHEP::RandFlat fFlatGen
* file
Definition: file_to_url.sh:69
DigiPMTSBNDAlg::ConfigurationParameters_t fBaseConfig
void ConstructWaveformLiteCoatedPMT(int ch, std::vector< short unsigned int > &waveform, std::unordered_map< int, sim::SimPhotonsLite > &DirectPhotonsMap, std::unordered_map< int, sim::SimPhotonsLite > &ReflectedPhotonsMap, double start_time, unsigned n_sample)
void CreateSaturation(std::vector< double > &wave)
fhicl::Atom< double > pmtdarkNoiseRate
std::vector< double > fSinglePEWave
void ConstructWaveformLite(int ch, sim::SimPhotonsLite const &litesimphotons, std::vector< short unsigned int > &waveform, std::string pdtype, double start_time, unsigned n_sample)
std::map< int, int > DetectedPhotons
Number of photons detected at each given time: time tick -&gt; photons.
Definition: SimPhotons.h:117
process_name gaushit a
const double transitTimeSpread_frac
void AddDarkNoise(std::vector< double > &wave)
double Transittimespread(double fwhm)
void AddLineNoise(std::vector< double > &wave)
std::unique_ptr< DigiPMTSBNDAlg > operator()(detinfo::LArProperties const &larProp, detinfo::DetectorClocksData const &clockData, CLHEP::HepRandomEngine *engine) const
fhicl::Atom< std::string > pmtDataFile
void CreatePDWaveformCoatedPMT(int ch, double t_min, std::vector< double > &wave, std::unordered_map< int, sim::SimPhotons > &DirectPhotonsMap, std::unordered_map< int, sim::SimPhotons > &ReflectedPhotonsMap)
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
fEngine(art::ServiceHandle< rndm::NuRandomService >() ->createEngine(*this, pset,"Seed"))
CLHEP::RandPoissonQ fPoissonQGen
CLHEP::HepRandomEngine * fEngine
Reference to art-managed random-number engine.
void ConstructWaveformCoatedPMT(int ch, std::vector< short unsigned int > &waveform, std::unordered_map< int, sim::SimPhotons > &DirectPhotonsMap, std::unordered_map< int, sim::SimPhotons > &ReflectedPhotonsMap, double start_time, unsigned n_sample)
fhicl::Atom< bool > makeGainFluctuations
fhicl::Atom< double > pmtsaturation
std::unique_ptr< opdet::PMTGainFluctuations > fPMTGainFluctuationsPtr
ElecClock const & OpticalClock() const noexcept
Borrow a const Optical clock with time set to Trigger time [us].
DigiPMTSBNDAlg(ConfigurationParameters_t const &config)
virtual double ScintPreScale(bool prescale=true) const =0
fhicl::Atom< double > pmtmeanAmplitude
fhicl::Atom< double > pmtchargeToADC
fhicl::Atom< double > pmtbaselineRMS
double mean(const std::vector< short > &wf, size_t start, size_t nsample)
Definition: UtilFunc.cxx:13
void CreatePDWaveform(sim::SimPhotons const &SimPhotons, double t_min, std::vector< double > &wave, int ch, std::string pdtype)
Collection of photons which recorded on one channel.
Definition: SimPhotons.h:136
Compact representation of photons on a channel.
Definition: SimPhotons.h:103
then echo fcl sbnd_project sbnd_project sbnd_project sbnd_project production production start_time
Contains all timing reference information for the detector.
constexpr double Frequency() const
Frequency in MHz.
Definition: ElecClock.h:191
void Pulse1PE(std::vector< double > &wave)
DigiPMTSBNDAlgMaker(Config const &config)
double FindMinimumTimeLite(sim::SimPhotonsLite const &litesimphotons, int ch, std::string pdtype, std::unordered_map< int, sim::SimPhotonsLite > &directPhotonsOnPMTS)
void AddSPE(size_t time_bin, std::vector< double > &wave)
fhicl::OptionalDelegatedParameter gainFluctuationsParams
CLHEP::RandGaussQ fGaussQGen
double FindMinimumTime(sim::SimPhotons const &, int ch, std::string pdtype, std::unordered_map< int, sim::SimPhotons > &directPhotonsOnPMTS)