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

Returns a new PMTsimulationAlg with an updated configuration. More...

#include <PMTsimulationAlg.h>

Classes

struct  Config
 Main algorithm FHiCL configuration. More...
 
struct  PMTspecConfig
 

Public Types

using microseconds = util::quantities::microsecond
 
using nanoseconds = util::quantities::nanosecond
 
using hertz = util::quantities::hertz
 
using picocoulomb = util::quantities::picocoulomb
 

Public Member Functions

 PMTsimulationAlgMaker (Config const &config)
 Constructor. More...
 
std::unique_ptr< PMTsimulationAlgoperator() (detinfo::LArProperties const &larProp, detinfo::DetectorClocksData const &detClocks, SinglePhotonResponseFunc_t const &SPRfunction, CLHEP::HepRandomEngine &mainRandomEngine, CLHEP::HepRandomEngine &darkNoiseRandomEngine, CLHEP::HepRandomEngine &elecNoiseRandomEngine, bool trackSelectedPhotons=false) const
 Creates and returns a new algorithm instance. More...
 
PMTsimulationAlg::ConfigurationParameters_t makeParams (detinfo::LArProperties const &larProp, detinfo::DetectorClocksData const &clockData, SinglePhotonResponseFunc_t const &SPRfunction, CLHEP::HepRandomEngine &mainRandomEngine, CLHEP::HepRandomEngine &darkNoiseRandomEngine, CLHEP::HepRandomEngine &elecNoiseRandomEngine, bool trackSelectedPhotons=false) const
 Returns a data structure to construct the algorithm. More...
 

Private Attributes

PMTsimulationAlg::ConfigurationParameters_t fBaseConfig
 Part of the configuration learned from configuration files. More...
 

Detailed Description

Returns a new PMTsimulationAlg with an updated configuration.

Definition at line 791 of file PMTsimulationAlg.h.

Member Typedef Documentation

Definition at line 796 of file PMTsimulationAlg.h.

Definition at line 794 of file PMTsimulationAlg.h.

Definition at line 795 of file PMTsimulationAlg.h.

Definition at line 797 of file PMTsimulationAlg.h.

Constructor & Destructor Documentation

icarus::opdet::PMTsimulationAlgMaker::PMTsimulationAlgMaker ( Config const &  config)

Constructor.

Definition at line 747 of file PMTsimulationAlg.cxx.

748 {
755 
756  //
757  // readout settings
758  //
759  fBaseConfig.readoutEnablePeriod = config.ReadoutEnablePeriod();
760  fBaseConfig.readoutWindowSize = config.ReadoutWindowSize();
761  fBaseConfig.baseline = ADCcount(config.Baseline());
762  fBaseConfig.ADCbits = config.ADCBits();
763  fBaseConfig.pulsePolarity = config.PulsePolarity();
764  fBaseConfig.pretrigFraction = config.PreTrigFraction();
765  fBaseConfig.triggerOffsetPMT = config.TriggerOffsetPMT();
766 
767  //
768  // PMT settings
769  //
770  auto const& PMTspecs = config.PMTspecs();
771  fBaseConfig.saturation = config.Saturation().value_or(0);
772  fBaseConfig.QEbase = config.QE();
773  fBaseConfig.PMTspecs.dynodeK = PMTspecs.DynodeK();
775  (PMTspecs.VoltageDistribution());
776  fBaseConfig.PMTspecs.gain = PMTspecs.Gain();
777  fBaseConfig.doGainFluctuations = config.FluctuateGain();
778 
779  //
780  // single photoelectron response
781  //
782  fBaseConfig.pulseSubsamples = config.PulseSubsamples();
783 
784  //
785  // dark noise
786  //
787  fBaseConfig.darkNoiseRate = hertz(config.DarkNoiseRate());
788 
789  //
790  // electronics noise
791  //
792  fBaseConfig.ampNoise = ADCcount(config.AmpNoise());
793  fBaseConfig.useFastElectronicsNoise = config.FastElectronicsNoise();
794 
795  //
796  // trigger
797  //
798  fBaseConfig.thresholdADC = ADCcount(config.ThresholdADC());
799  fBaseConfig.createBeamGateTriggers = config.CreateBeamGateTriggers();
800  fBaseConfig.beamGateTriggerRepPeriod = microsecond(config.BeamGateTriggerRepPeriod());
801  fBaseConfig.beamGateTriggerNReps = config.BeamGateTriggerNReps();
802 
803  //
804  // parameter checks
805  //
806  if (std::abs(fBaseConfig.pulsePolarity) != 1.0) {
807  throw cet::exception("PMTsimulationAlg")
808  << "Pulse polarity settings can be only +1.0 or -1.0 (got: "
809  << fBaseConfig.pulsePolarity << ")\n"
810  ;
811  } // check pulse polarity
812 
814  double const mu0 = fBaseConfig.PMTspecs.firstStageGain();
815  if (!std::isnormal(mu0) || (mu0 < 0.0)) {
816  cet::exception e("PMTsimulationAlg");
817  e << "PMT gain " << fBaseConfig.PMTspecs.gain
818  << ", dynode resistance values {";
819  for (double rho: fBaseConfig.PMTspecs.voltageDistribution)
820  e << " " << rho;
821  e << " } and dynode k constant " << fBaseConfig.PMTspecs.dynodeK
822  << " resulted in an invalid gain " << mu0
823  << " for the first multiplication stage!\n";
824  throw e;
825  }
826  } // if invalid gain fluctuation
827 
828 } // icarus::opdet::PMTsimulationAlgMaker::PMTsimulationAlgMaker()
unsigned int pulseSubsamples
Number of tick subsamples.
size_t beamGateTriggerNReps
Number of beamgate trigger reps to produce.
float pretrigFraction
Fraction of window size to be before &quot;trigger&quot;.
double QEbase
Uncorrected PMT quantum efficiency.
double dynodeK
Gain from stage with voltage dV is proportional to dV^K.
microsecond_as<> microsecond
Type of time stored in microseconds, in double precision.
Definition: spacetime.h:119
DiscretePhotoelectronPulse::ADCcount ADCcount
bool useFastElectronicsNoise
Whether to use fast generator for electronics noise.
bool createBeamGateTriggers
Option to create unbiased readout around beam spill.
picocoulomb_as<> picocoulomb
Type of charge stored in picocoulomb, in double precision.
ADCcount thresholdADC
ADC Threshold for self-triggered readout.
void setVoltageDistribution(std::vector< double > &&Rs)
Sets voltageDistribution by stealing and normalizing Rs.
PMTsimulationAlg::ConfigurationParameters_t fBaseConfig
Part of the configuration learned from configuration files.
T abs(T value)
size_t readoutWindowSize
ReadoutWindowSize in samples.
unsigned int ADCbits
Number of bits of the digitizer.
microseconds readoutEnablePeriod
Time (us) for which pmt readout is enabled.
megahertz_as<> megahertz
Type of frequency stored in megahertz, in double precision.
Definition: frequency.h:101
microseconds triggerOffsetPMT
Time relative to trigger when PMT readout starts TODO make it a trigger_time point.
int pulsePolarity
Pulse polarity (=1 for positive, =-1 for negative)
nanosecond_as<> nanosecond
Type of time stored in nanoseconds, in double precision.
Definition: spacetime.h:136
do i e
microseconds beamGateTriggerRepPeriod
Repetition Period (us) for BeamGateTriggers TODO make this a time_interval.
double firstStageGain() const
Returns the gain from the first stage of PMT multiplication.
hertz_as<> hertz
Type of frequency stored in hertz, in double precision.
Definition: frequency.h:81

Member Function Documentation

auto icarus::opdet::PMTsimulationAlgMaker::makeParams ( detinfo::LArProperties const &  larProp,
detinfo::DetectorClocksData const &  clockData,
SinglePhotonResponseFunc_t const &  SPRfunction,
CLHEP::HepRandomEngine &  mainRandomEngine,
CLHEP::HepRandomEngine &  darkNoiseRandomEngine,
CLHEP::HepRandomEngine &  elecNoiseRandomEngine,
bool  trackSelectedPhotons = false 
) const

Returns a data structure to construct the algorithm.

Parameters
larPropinstance of detinfo::LArProperties to be used
detClocksinstance of detinfo::DetectorClocks to be used
SPRfunctionfunction to use for the single photon response
mainRandomEnginemain random engine (quantum efficiency, etc.)
darkNoiseRandomEnginerandom engine for dark noise simulation
elecNoiseRandomEnginerandom engine for electronics noise simulation

Returns a data structure ready to be used to construct a PMTsimulationAlg algorithm object, based on the configuration passed at construction time and the arguments specified in this function call.

All random engines are required in this interface, even if the configuration disabled noise simulation.

Definition at line 854 of file PMTsimulationAlg.cxx.

863 {
864  using namespace util::quantities::electronics_literals;
865 
866  //
867  // set the configuration
868  //
869  auto params = fBaseConfig;
870 
871  //
872  // set up parameters
873  //
874  params.larProp = &larProp;
875  params.clockData = &clockData;
876 
877  params.pulseFunction = &SPRfunction;
878 
879  params.randomEngine = &mainRandomEngine;
880  params.gainRandomEngine = params.randomEngine;
881  params.darkNoiseRandomEngine = &darkNoiseRandomEngine;
882  params.elecNoiseRandomEngine = &elecNoiseRandomEngine;
883 
884  params.trackSelectedPhotons = trackSelectedPhotons;
885 
886  //
887  // setup checks
888  //
889  bool const expectedNegativePolarity
890  = (SPRfunction.peakAmplitude() < 0.0_ADCf);
891 
892  if (std::signbit(params.pulsePolarity) != expectedNegativePolarity) {
893  throw cet::exception("PMTsimulationAlg")
894  << "Inconsistent settings: pulse polarity declared "
895  << params.pulsePolarity << ", but photoelectron waveform amplitude is "
896  << SPRfunction.peakAmplitude()
897  << "\n"
898  ;
899  } // check polarity consistency
900 
901  return params;
902 
903 } // icarus::opdet::PMTsimulationAlgMaker::create()
PMTsimulationAlg::ConfigurationParameters_t fBaseConfig
Part of the configuration learned from configuration files.
detinfo::LArProperties const * larProp
LarProperties service provider.
std::unique_ptr< icarus::opdet::PMTsimulationAlg > icarus::opdet::PMTsimulationAlgMaker::operator() ( detinfo::LArProperties const &  larProp,
detinfo::DetectorClocksData const &  detClocks,
SinglePhotonResponseFunc_t const &  SPRfunction,
CLHEP::HepRandomEngine &  mainRandomEngine,
CLHEP::HepRandomEngine &  darkNoiseRandomEngine,
CLHEP::HepRandomEngine &  elecNoiseRandomEngine,
bool  trackSelectedPhotons = false 
) const

Creates and returns a new algorithm instance.

Parameters
larPropinstance of detinfo::LArProperties to be used
detClocksinstance of detinfo::DetectorClocks to be used
SPRfunctionfunction to use for the single photon response
mainRandomEnginemain random engine (quantum efficiency, etc.)
darkNoiseRandomEnginerandom engine for dark noise simulation
elecNoiseRandomEnginerandom engine for electronics noise simulation
trackSelectedPhotons(default: false) keep track and return a copy of the scintillation photons used

All random engines are required in this interface, even if the configuration disabled noise simulation.

Definition at line 833 of file PMTsimulationAlg.cxx.

842 {
843  return std::make_unique<PMTsimulationAlg>(makeParams(
844  larProp, clockData,
845  SPRfunction,
846  mainRandomEngine, darkNoiseRandomEngine, elecNoiseRandomEngine,
847  trackSelectedPhotons
848  ));
849 
850 } // icarus::opdet::PMTsimulationAlgMaker::operator()
PMTsimulationAlg::ConfigurationParameters_t makeParams(detinfo::LArProperties const &larProp, detinfo::DetectorClocksData const &clockData, SinglePhotonResponseFunc_t const &SPRfunction, CLHEP::HepRandomEngine &mainRandomEngine, CLHEP::HepRandomEngine &darkNoiseRandomEngine, CLHEP::HepRandomEngine &elecNoiseRandomEngine, bool trackSelectedPhotons=false) const
Returns a data structure to construct the algorithm.

Member Data Documentation

PMTsimulationAlg::ConfigurationParameters_t icarus::opdet::PMTsimulationAlgMaker::fBaseConfig
private

Part of the configuration learned from configuration files.

Definition at line 1007 of file PMTsimulationAlg.h.


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