All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
icarus::opdet::SimPMTIcarus Class Reference

Simulates the digitization of ICARUS PMT response and trigger. More...

Inheritance diagram for icarus::opdet::SimPMTIcarus:

Classes

struct  Config
 

Public Types

using Parameters = art::EDProducer::Table< Config >
 

Public Member Functions

 SimPMTIcarus (Parameters const &config)
 
 SimPMTIcarus (SimPMTIcarus const &)=delete
 
 SimPMTIcarus (SimPMTIcarus &&)=delete
 
SimPMTIcarusoperator= (SimPMTIcarus const &)=delete
 
SimPMTIcarusoperator= (SimPMTIcarus &&)=delete
 
void produce (art::Event &e) override
 

Private Types

using SinglePhotonResponseFunc_t = icarus::opdet::SinglePhotonResponseFunc_t const
 Type of single photoelectron response function. More...
 

Private Member Functions

bool firstTime ()
 Returns whether no other event has been processed yet. More...
 

Private Attributes

art::InputTag fInputModuleName
 Input tag for simulated scintillation photons (or photoelectrons). More...
 
bool fWritePhotons { false }
 Whether to save contributing photons. More...
 
std::unique_ptr
< SinglePhotonResponseFunc_t >
const 
fSinglePhotonResponseFunc
 Single photoelectron response function. More...
 
icarus::opdet::PMTsimulationAlgMaker makePMTsimulator
 The actual simulation algorithm. More...
 
CLHEP::HepRandomEngine & fEfficiencyEngine
 
CLHEP::HepRandomEngine & fDarkNoiseEngine
 
CLHEP::HepRandomEngine & fElectronicsNoiseEngine
 
std::atomic_flag fNotFirstTime
 True if firstTime() has already been called. More...
 

Detailed Description

Simulates the digitization of ICARUS PMT response and trigger.

The module is a simple interface to the simulation algorithm, icarus::opdet::PMTsimulationAlg.

Configuration

All the configuration parameters are passed directly to the icarus::opdet::PMTsimulationAlg algorithm, with the following exceptions:

See the documentation of icarus::PMTsimulationAlg for the purpose of the three random number engines.

Currently, no configuration interface is provided to directly control their seeds, which is delegated to rndm::NuRandomService service.

Input

The module utilizes as input a collection of sim::SimPhotons, each containing the photons propagated to a single optical detector channel.

Output

A collection of optical detector waveforms (std::vector<raw::OpDetWaveform>) is produced. See icarus::opdet::PMTsimulationAlg algorithm documentation for details.

If WritePhotons configuration parameter is set true, a collection of the scintillation photons (std::vector<sim::SimPhotons>) which contributed to the waveforms is also produced.

Requirements

This module currently requires LArSoft services:

Three random streams are also used.

Single photon response function tool

The single photon response function passed to the underlying algorithm, icarus::opdet::PMTsimulationAlg, is extracted from an art tool. The specifications of the tool are:

These requirements imply that the tool (or the underlying function) must include electronics effects like the the time it takes to form the signal, the signal shape at PMT output, the delay and distortion of the cables and the ones of the digitization electronics, but the baseline is assumed flat at 0.

Definition at line 144 of file SimPMTIcarus_module.cc.

Member Typedef Documentation

using icarus::opdet::SimPMTIcarus::Parameters = art::EDProducer::Table<Config>

Definition at line 203 of file SimPMTIcarus_module.cc.

Type of single photoelectron response function.

Definition at line 221 of file SimPMTIcarus_module.cc.

Constructor & Destructor Documentation

icarus::opdet::SimPMTIcarus::SimPMTIcarus ( Parameters const &  config)
explicit

Definition at line 251 of file SimPMTIcarus_module.cc.

252  : EDProducer{config}
253  , fInputModuleName(config().inputModuleLabel())
254  , fWritePhotons(config().writePhotons())
256  art::make_tool<icarus::opdet::SinglePhotonPulseFunctionTool>
257  (config().SinglePhotonResponse.get<fhicl::ParameterSet>())
258  ->getPulseFunction()
259  }
260  , makePMTsimulator(config().algoConfig())
261  , fEfficiencyEngine(art::ServiceHandle<rndm::NuRandomService>()->createEngine
262  (*this, "HepJamesRandom", "Efficiencies", config().EfficiencySeed)
263  )
264  , fDarkNoiseEngine(art::ServiceHandle<rndm::NuRandomService>()->createEngine(
265  *this,
266  config().darkNoiseRandomEngine(),
267  "DarkNoise",
268  config().DarkNoiseSeed
269  ))
270  , fElectronicsNoiseEngine(art::ServiceHandle<rndm::NuRandomService>()->createEngine(
271  *this,
272  config().electronicsNoiseRandomEngine(),
273  "ElectronicsNoise",
274  config().ElectronicsNoiseSeed
275  ))
276  {
277  // Call appropriate produces<>() functions here.
278  produces<std::vector<raw::OpDetWaveform>>();
279  if (fWritePhotons) produces<std::vector<sim::SimPhotons> >();
280 
281  fNotFirstTime.clear(); // superfluous in C++20
282  } // SimPMTIcarus::SimPMTIcarus()
icarus::opdet::PMTsimulationAlgMaker makePMTsimulator
The actual simulation algorithm.
CLHEP::HepRandomEngine & fDarkNoiseEngine
CLHEP::HepRandomEngine & fElectronicsNoiseEngine
std::atomic_flag fNotFirstTime
True if firstTime() has already been called.
art::InputTag fInputModuleName
Input tag for simulated scintillation photons (or photoelectrons).
std::unique_ptr< SinglePhotonResponseFunc_t > const fSinglePhotonResponseFunc
Single photoelectron response function.
CLHEP::HepRandomEngine & fEfficiencyEngine
bool fWritePhotons
Whether to save contributing photons.
icarus::opdet::SimPMTIcarus::SimPMTIcarus ( SimPMTIcarus const &  )
delete
icarus::opdet::SimPMTIcarus::SimPMTIcarus ( SimPMTIcarus &&  )
delete

Member Function Documentation

bool icarus::opdet::SimPMTIcarus::firstTime ( )
inlineprivate

Returns whether no other event has been processed yet.

Definition at line 243 of file SimPMTIcarus_module.cc.

243 { return !fNotFirstTime.test_and_set(); }
std::atomic_flag fNotFirstTime
True if firstTime() has already been called.
SimPMTIcarus& icarus::opdet::SimPMTIcarus::operator= ( SimPMTIcarus const &  )
delete
SimPMTIcarus& icarus::opdet::SimPMTIcarus::operator= ( SimPMTIcarus &&  )
delete
void icarus::opdet::SimPMTIcarus::produce ( art::Event &  e)
override

Definition at line 286 of file SimPMTIcarus_module.cc.

287  {
288  mf::LogDebug("SimPMTIcarus") << e.id();
289 
290  //
291  // fetch the input
292  //
293  auto pulseVecPtr = std::make_unique< std::vector< raw::OpDetWaveform > > ();
294 
295  std::unique_ptr<std::vector<sim::SimPhotons>> simphVecPtr;
296  if (fWritePhotons)
297  simphVecPtr = std::make_unique< std::vector< sim::SimPhotons > > ();
298 
299  //
300  // prepare the output
301  //
302  art::Handle<std::vector<sim::SimPhotons> > pmtVector;
303  art::Handle<std::vector<sim::SimPhotonsLite> > pmtLiteVector;
304  pmtVector = e.getHandle< std::vector<sim::SimPhotons> >(fInputModuleName);
305  if(!pmtVector.isValid())
306  pmtLiteVector = e.getHandle< std::vector<sim::SimPhotonsLite> >(fInputModuleName);
307 
308  auto const clockData =
309  art::ServiceHandle<detinfo::DetectorClocksService const>()->DataFor(e);
310  //
311  // prepare the algorithm
312  //
313  auto PMTsimulator = makePMTsimulator(
314  *(lar::providerFrom<detinfo::LArPropertiesService>()),
315  clockData,
321  );
322 
323  if (firstTime()) {
324  mf::LogDebug log { "SimPMTIcarus" };
325  log << "PMT simulation configuration (first event):\n";
326  PMTsimulator->printConfiguration(log);
327  } // if first time
328 
329  //
330  // run the algorithm
331  //
332  unsigned int nopch = 0;
333  if(pmtVector.isValid()) {
334  nopch = pmtVector->size();
335  for(auto const& photons : *pmtVector) {
336 
337  // Make an empty SimPhotonsLite with the same channel number.
338 
339  sim::SimPhotonsLite lite_photons(photons.OpChannel());
340 
341  auto const& [ channelWaveforms, photons_used ]
342  = PMTsimulator->simulate(photons, lite_photons);
343  std::move(
344  channelWaveforms.cbegin(), channelWaveforms.cend(),
345  std::back_inserter(*pulseVecPtr)
346  );
347  if (simphVecPtr && photons_used)
348  simphVecPtr->emplace_back(std::move(photons_used.value()));
349 
350  } // for
351  }
352  else if(pmtLiteVector.isValid()) {
353  nopch = pmtLiteVector->size();
354  for(auto const& lite_photons : *pmtLiteVector) {
355 
356  // Make an empty SimPhotons with the same channel number.
357 
358  sim::SimPhotons photons(lite_photons.OpChannel);
359 
360  auto const& [ channelWaveforms, photons_used ]
361  = PMTsimulator->simulate(photons, lite_photons);
362  std::move(
363  channelWaveforms.cbegin(), channelWaveforms.cend(),
364  std::back_inserter(*pulseVecPtr)
365  );
366 
367  } // for
368  }
369 
370  mf::LogInfo("SimPMTIcarus") << "Generated " << pulseVecPtr->size()
371  << " waveforms out of " << nopch << " optical channels.";
372 
373  //
374  // save the result
375  //
376  e.put(std::move(pulseVecPtr));
377  if (simphVecPtr) e.put(std::move(simphVecPtr));
378  } // SimPMTIcarus::produce()
icarus::opdet::PMTsimulationAlgMaker makePMTsimulator
The actual simulation algorithm.
CLHEP::HepRandomEngine & fDarkNoiseEngine
CLHEP::HepRandomEngine & fElectronicsNoiseEngine
art::InputTag fInputModuleName
Input tag for simulated scintillation photons (or photoelectrons).
std::unique_ptr< SinglePhotonResponseFunc_t > const fSinglePhotonResponseFunc
Single photoelectron response function.
Collection of photons which recorded on one channel.
Definition: SimPhotons.h:136
Compact representation of photons on a channel.
Definition: SimPhotons.h:103
do i e
CLHEP::HepRandomEngine & fEfficiencyEngine
bool fWritePhotons
Whether to save contributing photons.
bool firstTime()
Returns whether no other event has been processed yet.

Member Data Documentation

CLHEP::HepRandomEngine& icarus::opdet::SimPMTIcarus::fDarkNoiseEngine
private

Definition at line 235 of file SimPMTIcarus_module.cc.

CLHEP::HepRandomEngine& icarus::opdet::SimPMTIcarus::fEfficiencyEngine
private

Definition at line 234 of file SimPMTIcarus_module.cc.

CLHEP::HepRandomEngine& icarus::opdet::SimPMTIcarus::fElectronicsNoiseEngine
private

Definition at line 236 of file SimPMTIcarus_module.cc.

art::InputTag icarus::opdet::SimPMTIcarus::fInputModuleName
private

Input tag for simulated scintillation photons (or photoelectrons).

Definition at line 224 of file SimPMTIcarus_module.cc.

std::atomic_flag icarus::opdet::SimPMTIcarus::fNotFirstTime
private

True if firstTime() has already been called.

Definition at line 240 of file SimPMTIcarus_module.cc.

std::unique_ptr<SinglePhotonResponseFunc_t> const icarus::opdet::SimPMTIcarus::fSinglePhotonResponseFunc
private

Single photoelectron response function.

Definition at line 229 of file SimPMTIcarus_module.cc.

bool icarus::opdet::SimPMTIcarus::fWritePhotons { false }
private

Whether to save contributing photons.

Definition at line 226 of file SimPMTIcarus_module.cc.

icarus::opdet::PMTsimulationAlgMaker icarus::opdet::SimPMTIcarus::makePMTsimulator
private

The actual simulation algorithm.

Definition at line 232 of file SimPMTIcarus_module.cc.


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