LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
opdet::OptDetDigitizer Class Reference
Inheritance diagram for opdet::OptDetDigitizer:
art::EDProducer art::ProducerBase art::Consumer art::EngineCreator art::ProductRegistryHelper

Public Types

using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
template<typename UserConfig , typename KeysToIgnore = void>
using Table = ProducerBase::Table< UserConfig, KeysToIgnore >
 

Public Member Functions

 OptDetDigitizer (const fhicl::ParameterSet &)
 
virtual ~OptDetDigitizer ()
 
void produce (art::Event &)
 
void beginJob ()
 
template<typename PROD , BranchType B = InEvent>
ProductID getProductID (std::string const &instanceName={}) const
 
template<typename PROD , BranchType B>
ProductID getProductID (ModuleDescription const &moduleDescription, std::string const &instanceName) const
 
bool modifiesEvent () const
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< T > consumes (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< T > consumesView (InputTag const &it)
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ProductToken< T > mayConsume (InputTag const &it)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , art::BranchType BT>
art::ViewToken< T > mayConsumeView (InputTag const &it)
 
base_engine_tcreateEngine (seed_t seed)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make)
 
base_engine_tcreateEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label)
 
seed_t get_seed_value (fhicl::ParameterSet const &pset, char const key[]="seed", seed_t const implicit_seed=-1)
 

Static Public Member Functions

static cet::exempt_ptr< Consumernon_module_context ()
 

Protected Member Functions

CurrentProcessingContext const * currentContext () const
 
void validateConsumedProduct (BranchType const bt, ProductInfo const &pi)
 
void prepareForJob (fhicl::ParameterSet const &pset)
 
void showMissingConsumes () const
 

Private Member Functions

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::RandFlat * fFlatRandom
 
CLHEP::RandPoisson * fPoissonRandom
 
art::ServiceHandle< OpDigiPropertiesfOpDigiProperties
 
art::ServiceHandle< geo::GeometryfGeom
 

Detailed Description

Definition at line 46 of file OptDetDigitizer_module.cc.

Member Typedef Documentation

using art::EDProducer::ModuleType = EDProducer
inherited

Definition at line 34 of file EDProducer.h.

template<typename UserConfig , typename KeysToIgnore = void>
using art::EDProducer::Table = ProducerBase::Table<UserConfig, KeysToIgnore>
inherited

Definition at line 43 of file EDProducer.h.

using art::EDProducer::WorkerType = WorkerT<EDProducer>
inherited

Definition at line 35 of file EDProducer.h.

Constructor & Destructor Documentation

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

Definition at line 99 of file OptDetDigitizer_module.cc.

References art::EngineCreator::createEngine(), fDarkRate, fFlatRandom, fInputModule, fOpDigiProperties, fPedFlucAmp, fPedFlucRate, fPedMeanArray, fPoissonRandom, fQE, fSampleFreq, fSaturationScale, fSimGainSpread, fSinglePEWaveform, fTimeBegin, fTimeEnd, fhicl::ParameterSet::get(), art::RandomNumberGenerator::getEngine(), and art::EngineCreator::rng().

100  {
101  // Infrastructure piece
102  produces<std::vector< optdata::ChannelDataGroup> >();
103 
105  // Input Module and histogram parameters come from .fcl
106  fInputModule = pset.get<std::string>("InputModule");
107  fSimGainSpread = pset.get<bool >("SimGainSpread");
108  fTimeBegin = fOpDigiProperties->TimeBegin();
109  fTimeEnd = fOpDigiProperties->TimeEnd();
110  fSampleFreq = fOpDigiProperties->SampleFreq();
111  fQE = fOpDigiProperties->QE();
112  fDarkRate = fOpDigiProperties->DarkRate();
113  fPedFlucAmp = fOpDigiProperties->PedFlucAmp();
114  fPedFlucRate= fOpDigiProperties->PedFlucRate();
115  fSaturationScale = fOpDigiProperties->SaturationScale();
116  fPedMeanArray = fOpDigiProperties->PedMeanArray();
117 
118  // Initialize toy waveform vector fSinglePEWaveform
119  fSinglePEWaveform = fOpDigiProperties->SinglePEWaveform();
120 
121  // create a default random engine; obtain the random seed from NuRandomService,
122  // unless overridden in configuration with key "Seed"
124  ->createEngine(*this, pset, "Seed");
125 
126  // Sample a random fraction of detected photons
128  CLHEP::HepRandomEngine &engine = rng->getEngine();
129  fFlatRandom = new CLHEP::RandFlat(engine);
130  fPoissonRandom = new CLHEP::RandPoisson(rng->getEngine());
131 
132  }
optdata::ADC_Count_t fSaturationScale
base_engine_t & getEngine() const
base_engine_t & createEngine(seed_t seed)
optdata::ADC_Count_t fPedFlucAmp
art::ServiceHandle< OpDigiProperties > fOpDigiProperties
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
CLHEP::RandPoisson * fPoissonRandom
std::vector< double > fSinglePEWaveform
std::vector< optdata::ADC_Count_t > fPedMeanArray
opdet::OptDetDigitizer::~OptDetDigitizer ( )
virtual

Definition at line 144 of file OptDetDigitizer_module.cc.

145  {
146  }

Member Function Documentation

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

Definition at line 166 of file OptDetDigitizer_module.cc.

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

Referenced by produce().

166  {
167  // Add dark noise
168  double MeanDarkPulses = fDarkRate * (fTimeEnd-fTimeBegin) / 1000000;
169 
170  unsigned int NumberOfPulses = fPoissonRandom->fire(MeanDarkPulses);
171  for(size_t i=0; i!=NumberOfPulses; ++i)
172  {
173  double PulseTime_ns = fTimeBegin*1000 + (fTimeEnd-fTimeBegin)*1000*(fFlatRandom->fire(1.0)); // Should be in ns
174  optdata::TimeSlice_t PulseTime_ts = fOpDigiProperties->GetTimeSlice(PulseTime_ns);
175  AddWaveform( PulseTime_ts,
176  RawWF,
178  gain);
179  }
180 
181  }
void AddWaveform(optdata::TimeSlice_t time, std::vector< double > &OldPulse, std::vector< double > &NewPulse, double factor, bool extend=false)
art::ServiceHandle< OpDigiProperties > fOpDigiProperties
unsigned int TimeSlice_t
Definition: OpticalTypes.h:20
CLHEP::RandPoisson * fPoissonRandom
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 152 of file OptDetDigitizer_module.cc.

Referenced by AddDarkNoise(), and produce().

157  {
158  if( (time+NewPulse.size()) > OldPulse.size() && extend )
159  OldPulse.resize(time + NewPulse.size());
160  for(size_t i = 0; i<NewPulse.size() && (time+i)<OldPulse.size(); ++i)
161  OldPulse[time+i] += NewPulse[i] * factor;
162  }
optdata::ChannelData opdet::OptDetDigitizer::ApplyDigitization ( std::vector< double > const  RawWF,
optdata::Channel_t const  ch 
) const
private

Definition at line 183 of file OptDetDigitizer_module.cc.

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

Referenced by produce().

185  {
186  //
187  // Digitization includes...
188  // (a) amplitude digitization
189  // (b) saturation
190  // (c) pedestal fluctuation
191  //
192 
193  // prepare return data container
194  optdata::ChannelData chData(ch);
195  chData.reserve(rawWF.size());
196  optdata::ADC_Count_t baseMean(fPedMeanArray.at(ch));
197  for(optdata::TimeSlice_t time=0; time<rawWF.size(); ++time)
198  {
199  double thisSample = rawWF[time];
200 
201  optdata::ADC_Count_t thisCount = (optdata::ADC_Count_t)(thisSample)+baseMean;
202 
203  // (a) amplitude digitization
204  if(CLHEP::RandFlat::shoot(1.0) < (thisSample - int(thisSample)))
205  thisCount+=1;
206 
207  // (b) saturation
208  if(thisCount > fSaturationScale) thisCount = fSaturationScale;
209 
210  chData.push_back(thisCount);
211  }
212 
213  // (c) pedestal fluctuation
214  double timeSpan = chData.size() * 1.e-6/(fOpDigiProperties->SampleFreq());
215  unsigned int nFluc = CLHEP::RandPoisson::shoot(fPedFlucRate * timeSpan);
216  for(size_t i=0; i<nFluc; ++i)
217  {
218  optdata::TimeSlice_t pulseTime(CLHEP::RandFlat::shoot(0.0,(double)(chData.size())));
219  optdata::ADC_Count_t amp = chData[pulseTime];
220  if( CLHEP::RandFlat::shoot(0.,1.) > 0.5)
221  {
222  amp += fPedFlucAmp;
223  if(amp > fSaturationScale) amp=fSaturationScale;
224  }
225  else
226  amp -= fPedFlucAmp;
227  chData[pulseTime] = amp;
228  }
229 
230  return chData;
231  }
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
void opdet::OptDetDigitizer::beginJob ( )
virtual

Reimplemented from art::EDProducer.

Definition at line 137 of file OptDetDigitizer_module.cc.

138  {
139  }
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::consumes ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::consumes ( InputTag const &  it)
inherited

Definition at line 147 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

148 {
149  if (!moduleContext_)
150  return ProductToken<T>::invalid();
151 
152  consumables_[BT].emplace_back(ConsumableType::Product,
153  TypeID{typeid(T)},
154  it.label(),
155  it.instance(),
156  it.process());
157  return ProductToken<T>{it};
158 }
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename T , art::BranchType BT>
void art::Consumer::consumesMany ( )
inherited

Definition at line 162 of file Consumer.h.

163 {
164  if (!moduleContext_)
165  return;
166 
167  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
168 }
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::consumesView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::consumesView ( InputTag const &  it)
inherited

Definition at line 172 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

173 {
174  if (!moduleContext_)
175  return ViewToken<T>::invalid();
176 
177  consumables_[BT].emplace_back(ConsumableType::ViewElement,
178  TypeID{typeid(T)},
179  it.label(),
180  it.instance(),
181  it.process());
182  return ViewToken<T>{it};
183 }
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
EngineCreator::base_engine_t & EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)
inherited

Definition at line 32 of file EngineCreator.cc.

References art::EngineCreator::rng().

34 {
35  return rng()->createEngine(
36  placeholder_schedule_id(), seed, kind_of_engine_to_make);
37 }
long seed
Definition: chem4.cc:68
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
EngineCreator::base_engine_t & EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)
inherited

Definition at line 40 of file EngineCreator.cc.

References art::EngineCreator::rng().

43 {
44  return rng()->createEngine(
45  placeholder_schedule_id(), seed, kind_of_engine_to_make, engine_label);
46 }
long seed
Definition: chem4.cc:68
static art::ServiceHandle< art::RandomNumberGenerator > & rng()
CurrentProcessingContext const * art::EDProducer::currentContext ( ) const
protectedinherited

Definition at line 120 of file EDProducer.cc.

References art::EDProducer::current_context_.

121  {
122  return current_context_.get();
123  }
CPC_exempt_ptr current_context_
Definition: EDProducer.h:116
EngineCreator::seed_t EngineCreator::get_seed_value ( fhicl::ParameterSet const &  pset,
char const  key[] = "seed",
seed_t const  implicit_seed = -1 
)
inherited

Definition at line 49 of file EngineCreator.cc.

References fhicl::ParameterSet::get().

Referenced by art::MixFilter< T >::initEngine_().

52 {
53  auto const& explicit_seeds = pset.get<std::vector<int>>(key, {});
54  return explicit_seeds.empty() ? implicit_seed : explicit_seeds.front();
55 }
template<typename PROD , BranchType B>
ProductID art::EDProducer::getProductID ( std::string const &  instanceName = {}) const
inlineinherited

Definition at line 123 of file EDProducer.h.

References art::EDProducer::moduleDescription_.

124  {
125  return ProducerBase::getProductID<PROD, B>(moduleDescription_,
126  instanceName);
127  }
ModuleDescription moduleDescription_
Definition: EDProducer.h:115
template<typename PROD , BranchType B>
ProductID art::ProducerBase::getProductID ( ModuleDescription const &  moduleDescription,
std::string const &  instanceName 
) const
inherited

Definition at line 56 of file ProducerBase.h.

References B, and art::ModuleDescription::moduleLabel().

Referenced by art::ProducerBase::modifiesEvent().

58  {
59  auto const& pd =
60  get_ProductDescription<PROD>(B, md.moduleLabel(), instanceName);
61  return pd.productID();
62  }
Int_t B
Definition: plot.C:25
template<typename T , BranchType = InEvent>
ProductToken<T> art::Consumer::mayConsume ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ProductToken<T> art::Consumer::mayConsume ( InputTag const &  it)
inherited

Definition at line 190 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

191 {
192  if (!moduleContext_)
193  return ProductToken<T>::invalid();
194 
195  consumables_[BT].emplace_back(ConsumableType::Product,
196  TypeID{typeid(T)},
197  it.label(),
198  it.instance(),
199  it.process());
200  return ProductToken<T>{it};
201 }
static ProductToken< T > invalid()
Definition: ProductToken.h:47
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename T , art::BranchType BT>
void art::Consumer::mayConsumeMany ( )
inherited

Definition at line 205 of file Consumer.h.

206 {
207  if (!moduleContext_)
208  return;
209 
210  consumables_[BT].emplace_back(ConsumableType::Many, TypeID{typeid(T)});
211 }
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
template<typename Element , BranchType = InEvent>
ViewToken<Element> art::Consumer::mayConsumeView ( InputTag const &  )
inherited
template<typename T , art::BranchType BT>
art::ViewToken<T> art::Consumer::mayConsumeView ( InputTag const &  it)
inherited

Definition at line 215 of file Consumer.h.

References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().

216 {
217  if (!moduleContext_)
218  return ViewToken<T>::invalid();
219 
220  consumables_[BT].emplace_back(ConsumableType::ViewElement,
221  TypeID{typeid(T)},
222  it.label(),
223  it.instance(),
224  it.process());
225  return ViewToken<T>{it};
226 }
static ViewToken< Element > invalid()
Definition: ProductToken.h:75
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
bool art::ProducerBase::modifiesEvent ( ) const
inlineinherited

Definition at line 40 of file ProducerBase.h.

References art::ProducerBase::getProductID().

41  {
42  return true;
43  }
void art::Consumer::prepareForJob ( fhicl::ParameterSet const &  pset)
protectedinherited

Definition at line 89 of file Consumer.cc.

References fhicl::ParameterSet::get_if_present().

Referenced by art::EDProducer::doBeginJob(), art::EDFilter::doBeginJob(), and art::EDAnalyzer::doBeginJob().

90 {
91  if (!moduleContext_)
92  return;
93 
94  pset.get_if_present("errorOnMissingConsumes", requireConsumes_);
95  for (auto& consumablesPerBranch : consumables_) {
96  cet::sort_all(consumablesPerBranch);
97  }
98 }
bool requireConsumes_
Definition: Consumer.h:137
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
void opdet::OptDetDigitizer::produce ( art::Event evt)
virtual

Implements art::EDProducer.

Definition at line 235 of file OptDetDigitizer_module.cc.

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

236  {
237 
238  //
239  // Event-wise initialization
240  //
241 
242  // Infrastructure piece
243  std::unique_ptr< std::vector<optdata::ChannelDataGroup > > StoragePtr (new std::vector<optdata::ChannelDataGroup>);
244 
245  // Read in the Sim Photons
247 
248  // Convert units into ns from us/MHz
249  double timeBegin_ns = fTimeBegin * 1000;
250  double timeEnd_ns = fTimeEnd * 1000;
251  double sampleFreq_ns = fSampleFreq / 1000;
252 
253  // Compute # of timeslices to be stored in the output. This is defined by a user input (fcl file)
254  optdata::TimeSlice_t timeSliceWindow(fOpDigiProperties->GetTimeSlice(timeEnd_ns));
255 
256  /*
257  Create output data product, optdata::ChannelDataGroup for each gain channel.
258  Note : Although the frame + sample number in DATA should have a reference of T=0 @ DAQ start time, this is
259  not handled in MC. Hence we do not set them here (use constructor default)
260  */
261  optdata::ChannelDataGroup rawWFGroup_HighGain(optdata::kHighGain);
262  optdata::ChannelDataGroup rawWFGroup_LowGain(optdata::kLowGain);
263  // Reserve entries equal to # of channels
264  rawWFGroup_HighGain.reserve(fGeom->NOpChannels());
265  rawWFGroup_LowGain.reserve(fGeom->NOpChannels());
266 
267  /*
268  Define "raw" waveform container which will be filled based on G4 photon timing + SPE waveform information.
269  Note this is not completely an analog waveform because it is digitized in terms of time (as it is using std::vector).
270  */
271  std::vector<std::vector<double> > rawWF_HighGain(fGeom->NOpChannels(),std::vector<double>(timeSliceWindow,0.0));
272  std::vector<std::vector<double> > rawWF_LowGain(fGeom->NOpChannels(),std::vector<double>(timeSliceWindow,0.0));
273 
274  /*
275  Start data processing ... see following steps
276  (1) Loop over input array of optical photons & fill "raw" waveform container w/ corresponding SPE waveform
277  (2) Loop over filled "raw" waveform and process (digitization, adding noise, baseline spread, etc)
278  */
279 
280  //
281  // Step (1) ... loop over G4 optical photons
282  //
283 
284  // For every OpDet, convert PE into waveform and combine all together
285  for(sim::SimPhotonsCollection::const_iterator itOpDet=ThePhotCollection.begin(); itOpDet!=ThePhotCollection.end(); itOpDet++)
286  {
287  const sim::SimPhotons& ThePhot=itOpDet->second;
288 
289  int ch = ThePhot.OpChannel();
290  // For every photon in the hit:
291  for(const sim::OnePhoton& Phot: ThePhot)
292  {
293  // Sample a random subset according to QE
294  if(fFlatRandom->fire(1.0)<=fQE)
295  {
296  optdata::TimeSlice_t PhotonTime(fOpDigiProperties->GetTimeSlice(Phot.Time));
297  if( Phot.Time > timeBegin_ns && Phot.Time < timeEnd_ns )
298  {
299  if(fSimGainSpread)
300  {
301  AddWaveform( PhotonTime, rawWF_HighGain[ch], fSinglePEWaveform, fOpDigiProperties->HighGain(ch));
302  AddWaveform( PhotonTime, rawWF_LowGain[ch], fSinglePEWaveform, fOpDigiProperties->LowGain(ch));
303  }
304  else
305  {
306  AddWaveform( PhotonTime, rawWF_HighGain[ch], fSinglePEWaveform, fOpDigiProperties->HighGainMean(ch));
307  AddWaveform( PhotonTime, rawWF_LowGain[ch], fSinglePEWaveform, fOpDigiProperties->LowGainMean(ch));
308  }
309  }
310  } // random QE cut
311  } // for each Photon in SimPhotons
312  }
313 
314  //
315  // Loop over "raw" waveform (channel-wise)
316  //
317  for(unsigned short iCh = 0; iCh < rawWF_LowGain.size(); ++iCh){
318  rawWF_LowGain[iCh].resize((timeEnd_ns - timeBegin_ns) * sampleFreq_ns);
319  rawWF_HighGain[iCh].resize((timeEnd_ns - timeBegin_ns) * sampleFreq_ns);
320 
321  // Add dark noise
322  if(fSimGainSpread){
323  AddDarkNoise(rawWF_LowGain[iCh],fOpDigiProperties->LowGain(iCh));
324  AddDarkNoise(rawWF_HighGain[iCh],fOpDigiProperties->HighGain(iCh));
325  }else{
326  AddDarkNoise(rawWF_LowGain[iCh],fOpDigiProperties->LowGainMean(iCh));
327  AddDarkNoise(rawWF_HighGain[iCh],fOpDigiProperties->HighGainMean(iCh));
328  }
329 
330  // Apply digitization and make channel data
331  optdata::ChannelData chData_HighGain(ApplyDigitization(rawWF_HighGain[iCh],iCh));
332  optdata::ChannelData chData_LowGain(ApplyDigitization(rawWF_LowGain[iCh],iCh));
333 
334  rawWFGroup_HighGain.push_back(chData_HighGain);
335  rawWFGroup_LowGain.push_back(chData_LowGain);
336  } // for each OpDet in SimPhotonsCollection
337 
338  StoragePtr->push_back(rawWFGroup_HighGain);
339  StoragePtr->push_back(rawWFGroup_LowGain);
340 
341  evt.put(std::move(StoragePtr));
342  }
optdata::ChannelData ApplyDigitization(std::vector< double > const RawWF, optdata::Channel_t const ch) const
int OpChannel() const
Definition: SimPhotons.h:161
art::ServiceHandle< geo::Geometry > fGeom
unsigned int NOpChannels() const
Number of electronics channels for all the optical detectors.
ProductID put(std::unique_ptr< PROD > &&product)
Definition: Event.h:102
void AddWaveform(optdata::TimeSlice_t time, std::vector< double > &OldPulse, std::vector< double > &NewPulse, double factor, bool extend=false)
art::ServiceHandle< OpDigiProperties > fOpDigiProperties
list_type::const_iterator const_iterator
Definition: SimPhotons.h:134
unsigned int TimeSlice_t
Definition: OpticalTypes.h:20
std::vector< double > fSinglePEWaveform
void AddDarkNoise(std::vector< double > &RawWF, double gain)
static sim::SimPhotonsCollection GetSimPhotonsCollection(const art::Event &evt, std::string moduleLabel)
void art::Consumer::showMissingConsumes ( ) const
protectedinherited

Definition at line 125 of file Consumer.cc.

Referenced by art::EDProducer::doEndJob(), art::EDFilter::doEndJob(), art::EDAnalyzer::doEndJob(), and art::RootOutput::endJob().

126 {
127  if (!moduleContext_)
128  return;
129 
130  // If none of the branches have missing consumes statements, exit early.
131  if (std::all_of(cbegin(missingConsumes_),
132  cend(missingConsumes_),
133  [](auto const& perBranch) { return perBranch.empty(); }))
134  return;
135 
136  constexpr cet::HorizontalRule rule{60};
137  mf::LogPrint log{"MTdiagnostics"};
138  log << '\n'
139  << rule('=') << '\n'
140  << "The following consumes (or mayConsume) statements are missing from\n"
141  << module_context(moduleDescription_) << '\n'
142  << rule('-') << '\n';
143 
144  cet::for_all_with_index(
145  missingConsumes_, [&log](std::size_t const i, auto const& perBranch) {
146  for (auto const& pi : perBranch) {
147  log << " "
148  << assemble_consumes_statement(static_cast<BranchType>(i), pi)
149  << '\n';
150  }
151  });
152  log << rule('=');
153 }
cet::exempt_ptr< ModuleDescription const > moduleDescription_
Definition: Consumer.h:140
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
bool moduleContext_
Definition: Consumer.h:136
ConsumableProductSets missingConsumes_
Definition: Consumer.h:139
void art::Consumer::validateConsumedProduct ( BranchType const  bt,
ProductInfo const &  pi 
)
protectedinherited

Definition at line 101 of file Consumer.cc.

References art::errors::ProductRegistrationFailure.

103 {
104  // Early exits if consumes tracking has been disabled or if the
105  // consumed product is an allowed consumable.
106  if (!moduleContext_)
107  return;
108 
109  if (cet::binary_search_all(consumables_[bt], pi))
110  return;
111 
112  if (requireConsumes_) {
114  "Consumer: an error occurred during validation of a "
115  "retrieved product\n\n")
116  << "The following consumes (or mayConsume) statement is missing from\n"
117  << module_context(moduleDescription_) << ":\n\n"
118  << " " << assemble_consumes_statement(bt, pi) << "\n\n";
119  }
120 
121  missingConsumes_[bt].insert(pi);
122 }
cet::exempt_ptr< ModuleDescription const > moduleDescription_
Definition: Consumer.h:140
bool requireConsumes_
Definition: Consumer.h:137
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
constexpr T pi()
Returns the constant pi (up to 35 decimal digits of precision)
ConsumableProducts consumables_
Definition: Consumer.h:138
bool moduleContext_
Definition: Consumer.h:136
ConsumableProductSets missingConsumes_
Definition: Consumer.h:139

Member Data Documentation

float opdet::OptDetDigitizer::fDarkRate
private

Definition at line 66 of file OptDetDigitizer_module.cc.

Referenced by AddDarkNoise(), and OptDetDigitizer().

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

Definition at line 75 of file OptDetDigitizer_module.cc.

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

art::ServiceHandle<geo::Geometry> opdet::OptDetDigitizer::fGeom
private

Definition at line 86 of file OptDetDigitizer_module.cc.

Referenced by produce().

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

Definition at line 59 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 67 of file OptDetDigitizer_module.cc.

Referenced by ApplyDigitization(), and OptDetDigitizer().

float opdet::OptDetDigitizer::fPedFlucRate
private

Definition at line 68 of file OptDetDigitizer_module.cc.

Referenced by ApplyDigitization(), and OptDetDigitizer().

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

Definition at line 65 of file OptDetDigitizer_module.cc.

Referenced by ApplyDigitization(), and OptDetDigitizer().

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

Definition at line 76 of file OptDetDigitizer_module.cc.

Referenced by AddDarkNoise(), and OptDetDigitizer().

float opdet::OptDetDigitizer::fQE
private

Definition at line 63 of file OptDetDigitizer_module.cc.

Referenced by OptDetDigitizer(), and produce().

float opdet::OptDetDigitizer::fSampleFreq
private

Definition at line 60 of file OptDetDigitizer_module.cc.

Referenced by OptDetDigitizer(), and produce().

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

Definition at line 64 of file OptDetDigitizer_module.cc.

Referenced by ApplyDigitization(), and OptDetDigitizer().

bool opdet::OptDetDigitizer::fSimGainSpread
private

Definition at line 73 of file OptDetDigitizer_module.cc.

Referenced by OptDetDigitizer(), and produce().

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

Definition at line 71 of file OptDetDigitizer_module.cc.

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

float opdet::OptDetDigitizer::fTimeBegin
private

Definition at line 61 of file OptDetDigitizer_module.cc.

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

float opdet::OptDetDigitizer::fTimeEnd
private

Definition at line 62 of file OptDetDigitizer_module.cc.

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


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