LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
opdet::OptDetDigitizer Class Reference
Inheritance diagram for opdet::OptDetDigitizer:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Public Types

using ModuleType = EDProducer
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 OptDetDigitizer (const fhicl::ParameterSet &)
 
void doBeginJob (SharedResources const &resources)
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
void fillProductDescriptions ()
 
void registerProducts (ProductDescriptions &productsToRegister)
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
std::unique_ptr< Worker > makeWorker (WorkerParams const &wp)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Protected Member Functions

ConsumesCollector & consumesCollector ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 

Private Member Functions

void produce (art::Event &) override
 
void AddDarkNoise (std::vector< double > &RawWF, double gain)
 
void AddWaveform (optdata::TimeSlice_t time, std::vector< double > &OldPulse, std::vector< double > &NewPulse, double factor, bool extend=false)
 
optdata::ChannelData ApplyDigitization (std::vector< double > const RawWF, optdata::Channel_t const ch) const
 

Private Attributes

std::string fInputModule
 
float fSampleFreq
 
float fTimeBegin
 
float fTimeEnd
 
float fQE
 
optdata::ADC_Count_t fSaturationScale
 
std::vector< optdata::ADC_Count_tfPedMeanArray
 
float fDarkRate
 
optdata::ADC_Count_t fPedFlucAmp
 
float fPedFlucRate
 
std::vector< double > fSinglePEWaveform
 
bool fSimGainSpread
 
CLHEP::HepRandomEngine & fEngine
 
CLHEP::RandFlat fFlatRandom
 
CLHEP::RandPoisson fPoissonRandom
 
art::ServiceHandle< OpDigiPropertiesfOpDigiProperties
 
geo::WireReadoutGeom const * fWireReadoutGeom
 

Detailed Description

Definition at line 37 of file OptDetDigitizer_module.cc.

Member Typedef Documentation

Definition at line 17 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::detail::Producer::Table = Modifier::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 26 of file Producer.h.

Constructor & Destructor Documentation

opdet::OptDetDigitizer::OptDetDigitizer ( const fhicl::ParameterSet )
explicit

Definition at line 81 of file OptDetDigitizer_module.cc.

References art::detail::EngineCreator::createEngine(), fDarkRate, fEngine, fFlatRandom, fInputModule, fOpDigiProperties, fPedFlucAmp, fPedFlucRate, fPedMeanArray, fPoissonRandom, fQE, fSampleFreq, fSaturationScale, fSimGainSpread, fSinglePEWaveform, fTimeBegin, fTimeEnd, fWireReadoutGeom, and Get.

82  : EDProducer{pset}
84  pset,
85  "Seed"))
89  {
90  // Infrastructure piece
91  produces<std::vector<optdata::ChannelDataGroup>>();
92 
94  // Input Module and histogram parameters come from .fcl
95  fInputModule = pset.get<std::string>("InputModule");
96  fSimGainSpread = pset.get<bool>("SimGainSpread");
97  fTimeBegin = fOpDigiProperties->TimeBegin();
98  fTimeEnd = fOpDigiProperties->TimeEnd();
99  fSampleFreq = fOpDigiProperties->SampleFreq();
100  fQE = fOpDigiProperties->QE();
101  fDarkRate = fOpDigiProperties->DarkRate();
102  fPedFlucAmp = fOpDigiProperties->PedFlucAmp();
103  fPedFlucRate = fOpDigiProperties->PedFlucRate();
104  fSaturationScale = fOpDigiProperties->SaturationScale();
105  fPedMeanArray = fOpDigiProperties->PedMeanArray();
106 
107  fSinglePEWaveform = fOpDigiProperties->SinglePEWaveform();
108  }
base_engine_t & createEngine(seed_t seed)
optdata::ADC_Count_t fSaturationScale
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.cc:6
cout<< "Opened file "<< fin<< " ixs= "<< ixs<< endl;if(ixs==0) hhh=(TH1F *) fff-> Get("h1")
Definition: AddMC.C:8
optdata::ADC_Count_t fPedFlucAmp
geo::WireReadoutGeom const * fWireReadoutGeom
CLHEP::RandPoisson fPoissonRandom
art::ServiceHandle< OpDigiProperties > fOpDigiProperties
std::vector< double > fSinglePEWaveform
std::vector< optdata::ADC_Count_t > fPedMeanArray
CLHEP::HepRandomEngine & fEngine

Member Function Documentation

void opdet::OptDetDigitizer::AddDarkNoise ( std::vector< double > &  RawWF,
double  gain 
)
private

Definition at line 126 of file OptDetDigitizer_module.cc.

References AddWaveform(), fDarkRate, fFlatRandom, fOpDigiProperties, fPoissonRandom, fSinglePEWaveform, fTimeBegin, and fTimeEnd.

Referenced by produce().

127  {
128  // Add dark noise
129  double MeanDarkPulses = fDarkRate * (fTimeEnd - fTimeBegin) / 1000000;
130 
131  unsigned int NumberOfPulses = fPoissonRandom.fire(MeanDarkPulses);
132  for (size_t i = 0; i != NumberOfPulses; ++i) {
133  double PulseTime_ns = fTimeBegin * 1000 + (fTimeEnd - fTimeBegin) * 1000 *
134  (fFlatRandom.fire(1.0)); // Should be in ns
135  optdata::TimeSlice_t PulseTime_ts = fOpDigiProperties->GetTimeSlice(PulseTime_ns);
136  AddWaveform(PulseTime_ts, RawWF, fSinglePEWaveform, gain);
137  }
138  }
void AddWaveform(optdata::TimeSlice_t time, std::vector< double > &OldPulse, std::vector< double > &NewPulse, double factor, bool extend=false)
CLHEP::RandPoisson fPoissonRandom
art::ServiceHandle< OpDigiProperties > fOpDigiProperties
unsigned int TimeSlice_t
Definition: OpticalTypes.h:20
std::vector< double > fSinglePEWaveform
void opdet::OptDetDigitizer::AddWaveform ( optdata::TimeSlice_t  time,
std::vector< double > &  OldPulse,
std::vector< double > &  NewPulse,
double  factor,
bool  extend = false 
)
private

Definition at line 112 of file OptDetDigitizer_module.cc.

Referenced by AddDarkNoise(), and produce().

117  {
118  if ((time + NewPulse.size()) > OldPulse.size() && extend)
119  OldPulse.resize(time + NewPulse.size());
120  for (size_t i = 0; i < NewPulse.size() && (time + i) < OldPulse.size(); ++i)
121  OldPulse[time + i] += NewPulse[i] * factor;
122  }
optdata::ChannelData opdet::OptDetDigitizer::ApplyDigitization ( std::vector< double > const  RawWF,
optdata::Channel_t const  ch 
) const
private

Definition at line 140 of file OptDetDigitizer_module.cc.

References fOpDigiProperties, fPedFlucAmp, fPedFlucRate, fPedMeanArray, and fSaturationScale.

Referenced by produce().

142  {
143  //
144  // Digitization includes...
145  // (a) amplitude digitization
146  // (b) saturation
147  // (c) pedestal fluctuation
148  //
149 
150  // prepare return data container
151  optdata::ChannelData chData(ch);
152  chData.reserve(rawWF.size());
153  optdata::ADC_Count_t baseMean(fPedMeanArray.at(ch));
154  for (optdata::TimeSlice_t time = 0; time < rawWF.size(); ++time) {
155  double thisSample = rawWF[time];
156 
157  optdata::ADC_Count_t thisCount = (optdata::ADC_Count_t)(thisSample) + baseMean;
158 
159  // (a) amplitude digitization
160  if (CLHEP::RandFlat::shoot(1.0) < (thisSample - int(thisSample))) thisCount += 1;
161 
162  // (b) saturation
163  if (thisCount > fSaturationScale) thisCount = fSaturationScale;
164 
165  chData.push_back(thisCount);
166  }
167 
168  // (c) pedestal fluctuation
169  double timeSpan = chData.size() * 1.e-6 / (fOpDigiProperties->SampleFreq());
170  unsigned int nFluc = CLHEP::RandPoisson::shoot(fPedFlucRate * timeSpan);
171  for (size_t i = 0; i < nFluc; ++i) {
172  optdata::TimeSlice_t pulseTime(CLHEP::RandFlat::shoot(0.0, (double)(chData.size())));
173  optdata::ADC_Count_t amp = chData[pulseTime];
174  if (CLHEP::RandFlat::shoot(0., 1.) > 0.5) {
175  amp += fPedFlucAmp;
176  if (amp > fSaturationScale) amp = fSaturationScale;
177  }
178  else
179  amp -= fPedFlucAmp;
180  chData[pulseTime] = amp;
181  }
182 
183  return chData;
184  }
optdata::ADC_Count_t fSaturationScale
uint16_t ADC_Count_t
Definition: OpticalTypes.h:16
optdata::ADC_Count_t fPedFlucAmp
art::ServiceHandle< OpDigiProperties > fOpDigiProperties
unsigned int TimeSlice_t
Definition: OpticalTypes.h:20
std::vector< optdata::ADC_Count_t > fPedMeanArray
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::consumes ( InputTag const &  tag)
protectedinherited

Definition at line 61 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumes().

62  {
63  return collector_.consumes<T, BT>(tag);
64  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ProductToken< T > consumes(InputTag const &)
ConsumesCollector & art::ModuleBase::consumesCollector ( )
protectedinherited

Definition at line 57 of file ModuleBase.cc.

References art::ModuleBase::collector_.

58  {
59  return collector_;
60  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::consumesMany ( )
protectedinherited

Definition at line 75 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesMany().

76  {
77  collector_.consumesMany<T, BT>();
78  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::consumesView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::consumesView ( InputTag const &  tag)
inherited

Definition at line 68 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::consumesView().

69  {
70  return collector_.consumesView<T, BT>(tag);
71  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > consumesView(InputTag const &)
void art::detail::Producer::doBeginJob ( SharedResources const &  resources)
inherited

Definition at line 22 of file Producer.cc.

References art::detail::Producer::beginJobWithFrame(), and art::detail::Producer::setupQueues().

23  {
24  setupQueues(resources);
25  ProcessingFrame const frame{ScheduleID{}};
26  beginJobWithFrame(frame);
27  }
virtual void setupQueues(SharedResources const &)=0
virtual void beginJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Producer::doBeginRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 65 of file Producer.cc.

References art::detail::Producer::beginRunWithFrame(), art::RangeSet::forRun(), art::RunPrincipal::makeRun(), r, art::RunPrincipal::runID(), and art::ModuleContext::scheduleID().

66  {
67  auto r = rp.makeRun(mc, RangeSet::forRun(rp.runID()));
68  ProcessingFrame const frame{mc.scheduleID()};
69  beginRunWithFrame(r, frame);
70  r.commitProducts();
71  return true;
72  }
TRandom r
Definition: spectrum.C:23
virtual void beginRunWithFrame(Run &, ProcessingFrame const &)=0
static RangeSet forRun(RunID)
Definition: RangeSet.cc:51
bool art::detail::Producer::doBeginSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 85 of file Producer.cc.

References art::detail::Producer::beginSubRunWithFrame(), art::RangeSet::forSubRun(), art::SubRunPrincipal::makeSubRun(), art::ModuleContext::scheduleID(), and art::SubRunPrincipal::subRunID().

86  {
87  auto sr = srp.makeSubRun(mc, RangeSet::forSubRun(srp.subRunID()));
88  ProcessingFrame const frame{mc.scheduleID()};
89  beginSubRunWithFrame(sr, frame);
90  sr.commitProducts();
91  return true;
92  }
virtual void beginSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
static RangeSet forSubRun(SubRunID)
Definition: RangeSet.cc:57
void art::detail::Producer::doEndJob ( )
inherited

Definition at line 30 of file Producer.cc.

References art::detail::Producer::endJobWithFrame().

31  {
32  ProcessingFrame const frame{ScheduleID{}};
33  endJobWithFrame(frame);
34  }
virtual void endJobWithFrame(ProcessingFrame const &)=0
bool art::detail::Producer::doEndRun ( RunPrincipal rp,
ModuleContext const &  mc 
)
inherited

Definition at line 75 of file Producer.cc.

References art::detail::Producer::endRunWithFrame(), art::RunPrincipal::makeRun(), r, art::ModuleContext::scheduleID(), and art::Principal::seenRanges().

76  {
77  auto r = rp.makeRun(mc, rp.seenRanges());
78  ProcessingFrame const frame{mc.scheduleID()};
79  endRunWithFrame(r, frame);
80  r.commitProducts();
81  return true;
82  }
TRandom r
Definition: spectrum.C:23
virtual void endRunWithFrame(Run &, ProcessingFrame const &)=0
bool art::detail::Producer::doEndSubRun ( SubRunPrincipal srp,
ModuleContext const &  mc 
)
inherited

Definition at line 95 of file Producer.cc.

References art::detail::Producer::endSubRunWithFrame(), art::SubRunPrincipal::makeSubRun(), art::ModuleContext::scheduleID(), and art::Principal::seenRanges().

96  {
97  auto sr = srp.makeSubRun(mc, srp.seenRanges());
98  ProcessingFrame const frame{mc.scheduleID()};
99  endSubRunWithFrame(sr, frame);
100  sr.commitProducts();
101  return true;
102  }
virtual void endSubRunWithFrame(SubRun &, ProcessingFrame const &)=0
bool art::detail::Producer::doEvent ( EventPrincipal ep,
ModuleContext const &  mc,
std::atomic< std::size_t > &  counts_run,
std::atomic< std::size_t > &  counts_passed,
std::atomic< std::size_t > &  counts_failed 
)
inherited

Definition at line 105 of file Producer.cc.

References art::detail::Producer::checkPutProducts_, e, art::EventPrincipal::makeEvent(), art::detail::Producer::produceWithFrame(), and art::ModuleContext::scheduleID().

110  {
111  auto e = ep.makeEvent(mc);
112  ++counts_run;
113  ProcessingFrame const frame{mc.scheduleID()};
114  produceWithFrame(e, frame);
115  e.commitProducts(checkPutProducts_, &expectedProducts<InEvent>());
116  ++counts_passed;
117  return true;
118  }
bool const checkPutProducts_
Definition: Producer.h:70
Float_t e
Definition: plot.C:35
virtual void produceWithFrame(Event &, ProcessingFrame const &)=0
void art::detail::Producer::doRespondToCloseInputFile ( FileBlock const &  fb)
inherited

Definition at line 44 of file Producer.cc.

References art::detail::Producer::respondToCloseInputFileWithFrame().

45  {
46  ProcessingFrame const frame{ScheduleID{}};
48  }
virtual void respondToCloseInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToCloseOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 58 of file Producer.cc.

References art::detail::Producer::respondToCloseOutputFilesWithFrame().

59  {
60  ProcessingFrame const frame{ScheduleID{}};
62  }
virtual void respondToCloseOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToOpenInputFile ( FileBlock const &  fb)
inherited

Definition at line 37 of file Producer.cc.

References art::detail::Producer::respondToOpenInputFileWithFrame().

38  {
39  ProcessingFrame const frame{ScheduleID{}};
41  }
virtual void respondToOpenInputFileWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::detail::Producer::doRespondToOpenOutputFiles ( FileBlock const &  fb)
inherited

Definition at line 51 of file Producer.cc.

References art::detail::Producer::respondToOpenOutputFilesWithFrame().

52  {
53  ProcessingFrame const frame{ScheduleID{}};
55  }
virtual void respondToOpenOutputFilesWithFrame(FileBlock const &, ProcessingFrame const &)=0
TFile fb("Li6.root")
void art::Modifier::fillProductDescriptions ( )
inherited

Definition at line 10 of file Modifier.cc.

References art::ProductRegistryHelper::fillDescriptions(), and art::ModuleBase::moduleDescription().

11  {
13  }
void fillDescriptions(ModuleDescription const &md)
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:13
std::array< std::vector< ProductInfo >, NumBranchTypes > const & art::ModuleBase::getConsumables ( ) const
inherited

Definition at line 43 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::getConsumables().

44  {
45  return collector_.getConsumables();
46  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables() const
std::unique_ptr< Worker > art::ModuleBase::makeWorker ( WorkerParams const &  wp)
inherited

Definition at line 37 of file ModuleBase.cc.

References art::ModuleBase::doMakeWorker(), and art::NumBranchTypes.

38  {
39  return doMakeWorker(wp);
40  }
virtual std::unique_ptr< Worker > doMakeWorker(WorkerParams const &wp)=0
template<typename T , BranchType BT>
ProductToken< T > art::ModuleBase::mayConsume ( InputTag const &  tag)
protectedinherited

Definition at line 82 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsume().

83  {
84  return collector_.mayConsume<T, BT>(tag);
85  }
ProductToken< T > mayConsume(InputTag const &)
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename T , BranchType BT>
void art::ModuleBase::mayConsumeMany ( )
protectedinherited

Definition at line 96 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeMany().

97  {
98  collector_.mayConsumeMany<T, BT>();
99  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::ModuleBase::mayConsumeView ( InputTag const &  )
protectedinherited
template<typename T , BranchType BT>
ViewToken<T> art::ModuleBase::mayConsumeView ( InputTag const &  tag)
inherited

Definition at line 89 of file ModuleBase.h.

References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeView().

90  {
91  return collector_.mayConsumeView<T, BT>(tag);
92  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
ViewToken< Element > mayConsumeView(InputTag const &)
ModuleDescription const & art::ModuleBase::moduleDescription ( ) const
inherited

Definition at line 13 of file ModuleBase.cc.

References art::errors::LogicError.

Referenced by art::OutputModule::doRespondToOpenInputFile(), art::OutputModule::doWriteEvent(), art::Modifier::fillProductDescriptions(), art::OutputModule::makePlugins_(), art::OutputWorker::OutputWorker(), reco::shower::LArPandoraModularShowerCreation::produce(), art::Modifier::registerProducts(), and art::OutputModule::registerProducts().

14  {
15  if (md_.has_value()) {
16  return *md_;
17  }
18 
20  "There was an error while calling moduleDescription().\n"}
21  << "The moduleDescription() base-class member function cannot be called\n"
22  "during module construction. To determine which module is "
23  "responsible\n"
24  "for calling it, find the '<module type>:<module "
25  "label>@Construction'\n"
26  "tag in the message prefix above. Please contact artists@fnal.gov\n"
27  "for guidance.\n";
28  }
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
void opdet::OptDetDigitizer::produce ( art::Event evt)
overrideprivatevirtual

Implements art::EDProducer.

Definition at line 188 of file OptDetDigitizer_module.cc.

References AddDarkNoise(), AddWaveform(), ApplyDigitization(), fFlatRandom, fInputModule, fOpDigiProperties, fQE, fSampleFreq, fSimGainSpread, fSinglePEWaveform, fTimeBegin, fTimeEnd, fWireReadoutGeom, sim::SimListUtils::GetSimPhotonsCollection(), optdata::kHighGain, optdata::kLowGain, geo::WireReadoutGeom::NOpChannels(), sim::SimPhotons::OpChannel(), and art::Event::put().

189  {
190  //
191  // Event-wise initialization
192  //
193 
194  // Infrastructure piece
195  std::unique_ptr<std::vector<optdata::ChannelDataGroup>> StoragePtr(
196  new std::vector<optdata::ChannelDataGroup>);
197 
198  // Read in the Sim Photons
199  sim::SimPhotonsCollection ThePhotCollection =
201 
202  // Convert units into ns from us/MHz
203  double timeBegin_ns = fTimeBegin * 1000;
204  double timeEnd_ns = fTimeEnd * 1000;
205  double sampleFreq_ns = fSampleFreq / 1000;
206 
207  // Compute # of timeslices to be stored in the output. This is defined by a user input (fcl file)
208  optdata::TimeSlice_t timeSliceWindow(fOpDigiProperties->GetTimeSlice(timeEnd_ns));
209 
210  /*
211  Create output data product, optdata::ChannelDataGroup for each gain channel.
212  Note : Although the frame + sample number in DATA should have a reference of T=0 @ DAQ start time, this is
213  not handled in MC. Hence we do not set them here (use constructor default)
214  */
215  optdata::ChannelDataGroup rawWFGroup_HighGain(optdata::kHighGain);
216  optdata::ChannelDataGroup rawWFGroup_LowGain(optdata::kLowGain);
217  // Reserve entries equal to # of channels
218  auto const nOpChannels = fWireReadoutGeom->NOpChannels();
219  rawWFGroup_HighGain.reserve(nOpChannels);
220  rawWFGroup_LowGain.reserve(nOpChannels);
221 
222  /*
223  Define "raw" waveform container which will be filled based on G4 photon timing + SPE waveform information.
224  Note this is not completely an analog waveform because it is digitized in terms of time (as it is using std::vector).
225  */
226  std::vector<std::vector<double>> rawWF_HighGain(nOpChannels,
227  std::vector<double>(timeSliceWindow, 0.0));
228  std::vector<std::vector<double>> rawWF_LowGain(nOpChannels,
229  std::vector<double>(timeSliceWindow, 0.0));
230 
231  /*
232  Start data processing ... see following steps
233  (1) Loop over input array of optical photons & fill "raw" waveform container w/ corresponding SPE waveform
234  (2) Loop over filled "raw" waveform and process (digitization, adding noise, baseline spread, etc)
235  */
236 
237  //
238  // Step (1) ... loop over G4 optical photons
239  //
240 
241  // For every OpDet, convert PE into waveform and combine all together
242  for (sim::SimPhotonsCollection::const_iterator itOpDet = ThePhotCollection.begin();
243  itOpDet != ThePhotCollection.end();
244  itOpDet++) {
245  const sim::SimPhotons& ThePhot = itOpDet->second;
246 
247  int ch = ThePhot.OpChannel();
248  // For every photon in the hit:
249  for (const sim::OnePhoton& Phot : ThePhot) {
250  // Sample a random subset according to QE
251  if (fFlatRandom.fire(1.0) <= fQE) {
252  optdata::TimeSlice_t PhotonTime(fOpDigiProperties->GetTimeSlice(Phot.Time));
253  if (Phot.Time > timeBegin_ns && Phot.Time < timeEnd_ns) {
254  if (fSimGainSpread) {
255  AddWaveform(
256  PhotonTime, rawWF_HighGain[ch], fSinglePEWaveform, fOpDigiProperties->HighGain(ch));
257  AddWaveform(
258  PhotonTime, rawWF_LowGain[ch], fSinglePEWaveform, fOpDigiProperties->LowGain(ch));
259  }
260  else {
261  AddWaveform(PhotonTime,
262  rawWF_HighGain[ch],
264  fOpDigiProperties->HighGainMean(ch));
265  AddWaveform(PhotonTime,
266  rawWF_LowGain[ch],
268  fOpDigiProperties->LowGainMean(ch));
269  }
270  }
271  } // random QE cut
272  } // for each Photon in SimPhotons
273  }
274 
275  //
276  // Loop over "raw" waveform (channel-wise)
277  //
278  for (unsigned short iCh = 0; iCh < rawWF_LowGain.size(); ++iCh) {
279  rawWF_LowGain[iCh].resize((timeEnd_ns - timeBegin_ns) * sampleFreq_ns);
280  rawWF_HighGain[iCh].resize((timeEnd_ns - timeBegin_ns) * sampleFreq_ns);
281 
282  // Add dark noise
283  if (fSimGainSpread) {
284  AddDarkNoise(rawWF_LowGain[iCh], fOpDigiProperties->LowGain(iCh));
285  AddDarkNoise(rawWF_HighGain[iCh], fOpDigiProperties->HighGain(iCh));
286  }
287  else {
288  AddDarkNoise(rawWF_LowGain[iCh], fOpDigiProperties->LowGainMean(iCh));
289  AddDarkNoise(rawWF_HighGain[iCh], fOpDigiProperties->HighGainMean(iCh));
290  }
291 
292  // Apply digitization and make channel data
293  optdata::ChannelData chData_HighGain(ApplyDigitization(rawWF_HighGain[iCh], iCh));
294  optdata::ChannelData chData_LowGain(ApplyDigitization(rawWF_LowGain[iCh], iCh));
295 
296  rawWFGroup_HighGain.push_back(chData_HighGain);
297  rawWFGroup_LowGain.push_back(chData_LowGain);
298  } // for each OpDet in SimPhotonsCollection
299 
300  StoragePtr->push_back(rawWFGroup_HighGain);
301  StoragePtr->push_back(rawWFGroup_LowGain);
302 
303  evt.put(std::move(StoragePtr));
304  }
optdata::ChannelData ApplyDigitization(std::vector< double > const RawWF, optdata::Channel_t const ch) const
int OpChannel() const
Returns the optical channel number this object is associated to.
Definition: SimPhotons.h:239
All information of a photon entering the sensitive optical detector volume.
Definition: SimPhotons.h:60
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: Event.h:77
void AddWaveform(optdata::TimeSlice_t time, std::vector< double > &OldPulse, std::vector< double > &NewPulse, double factor, bool extend=false)
geo::WireReadoutGeom const * fWireReadoutGeom
art::ServiceHandle< OpDigiProperties > fOpDigiProperties
Collection of photons which recorded on one channel.
Definition: SimPhotons.h:127
virtual unsigned int NOpChannels(unsigned int NOpDets) const
Returns the number of optical channels contained in some detectors.
list_type::const_iterator const_iterator
Definition: SimPhotons.h:191
unsigned int TimeSlice_t
Definition: OpticalTypes.h:20
std::vector< double > fSinglePEWaveform
Collection of sim::SimPhotons, indexed by channel number.
Definition: SimPhotons.h:178
void AddDarkNoise(std::vector< double > &RawWF, double gain)
static sim::SimPhotonsCollection GetSimPhotonsCollection(const art::Event &evt, std::string moduleLabel)
void art::Modifier::registerProducts ( ProductDescriptions productsToRegister)
inherited

Definition at line 16 of file Modifier.cc.

References art::ModuleBase::moduleDescription(), and art::ProductRegistryHelper::registerProducts().

17  {
18  ProductRegistryHelper::registerProducts(productsToRegister,
20  }
void registerProducts(ProductDescriptions &productsToRegister, ModuleDescription const &md)
ModuleDescription const & moduleDescription() const
Definition: ModuleBase.cc:13
void art::ModuleBase::setModuleDescription ( ModuleDescription const &  md)
inherited

Definition at line 31 of file ModuleBase.cc.

References art::ModuleBase::md_.

32  {
33  md_ = md;
34  }
std::optional< ModuleDescription > md_
Definition: ModuleBase.h:55
void art::ModuleBase::sortConsumables ( std::string const &  current_process_name)
inherited

Definition at line 49 of file ModuleBase.cc.

References art::ModuleBase::collector_, and art::ConsumesCollector::sortConsumables().

50  {
51  // Now that we know we have seen all the consumes declarations,
52  // sort the results for fast lookup later.
53  collector_.sortConsumables(current_process_name);
54  }
ConsumesCollector collector_
Definition: ModuleBase.h:56
void sortConsumables(std::string const &current_process_name)

Member Data Documentation

float opdet::OptDetDigitizer::fDarkRate
private

Definition at line 52 of file OptDetDigitizer_module.cc.

Referenced by AddDarkNoise(), and OptDetDigitizer().

CLHEP::HepRandomEngine& opdet::OptDetDigitizer::fEngine
private

Definition at line 61 of file OptDetDigitizer_module.cc.

Referenced by OptDetDigitizer().

CLHEP::RandFlat opdet::OptDetDigitizer::fFlatRandom
private

Definition at line 62 of file OptDetDigitizer_module.cc.

Referenced by AddDarkNoise(), OptDetDigitizer(), and produce().

std::string opdet::OptDetDigitizer::fInputModule
private

Definition at line 45 of file OptDetDigitizer_module.cc.

Referenced by OptDetDigitizer(), and produce().

art::ServiceHandle<OpDigiProperties> opdet::OptDetDigitizer::fOpDigiProperties
private
optdata::ADC_Count_t opdet::OptDetDigitizer::fPedFlucAmp
private

Definition at line 53 of file OptDetDigitizer_module.cc.

Referenced by ApplyDigitization(), and OptDetDigitizer().

float opdet::OptDetDigitizer::fPedFlucRate
private

Definition at line 54 of file OptDetDigitizer_module.cc.

Referenced by ApplyDigitization(), and OptDetDigitizer().

std::vector<optdata::ADC_Count_t> opdet::OptDetDigitizer::fPedMeanArray
private

Definition at line 51 of file OptDetDigitizer_module.cc.

Referenced by ApplyDigitization(), and OptDetDigitizer().

CLHEP::RandPoisson opdet::OptDetDigitizer::fPoissonRandom
private

Definition at line 63 of file OptDetDigitizer_module.cc.

Referenced by AddDarkNoise(), and OptDetDigitizer().

float opdet::OptDetDigitizer::fQE
private

Definition at line 49 of file OptDetDigitizer_module.cc.

Referenced by OptDetDigitizer(), and produce().

float opdet::OptDetDigitizer::fSampleFreq
private

Definition at line 46 of file OptDetDigitizer_module.cc.

Referenced by OptDetDigitizer(), and produce().

optdata::ADC_Count_t opdet::OptDetDigitizer::fSaturationScale
private

Definition at line 50 of file OptDetDigitizer_module.cc.

Referenced by ApplyDigitization(), and OptDetDigitizer().

bool opdet::OptDetDigitizer::fSimGainSpread
private

Definition at line 59 of file OptDetDigitizer_module.cc.

Referenced by OptDetDigitizer(), and produce().

std::vector<double> opdet::OptDetDigitizer::fSinglePEWaveform
private

Definition at line 57 of file OptDetDigitizer_module.cc.

Referenced by AddDarkNoise(), OptDetDigitizer(), and produce().

float opdet::OptDetDigitizer::fTimeBegin
private

Definition at line 47 of file OptDetDigitizer_module.cc.

Referenced by AddDarkNoise(), OptDetDigitizer(), and produce().

float opdet::OptDetDigitizer::fTimeEnd
private

Definition at line 48 of file OptDetDigitizer_module.cc.

Referenced by AddDarkNoise(), OptDetDigitizer(), and produce().

geo::WireReadoutGeom const* opdet::OptDetDigitizer::fWireReadoutGeom
private

Definition at line 73 of file OptDetDigitizer_module.cc.

Referenced by OptDetDigitizer(), and produce().


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