LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
evgen::larg4SingleGen Class Reference

module to produce single or multiple specified particles in the detector More...

Inheritance diagram for evgen::larg4SingleGen:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Classes

struct  Config
 

Public Types

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

Public Member Functions

 larg4SingleGen (Parameters const &config)
 
void produce (art::Event &evt) override
 
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 SampleOne (unsigned int i, simb::MCTruth &mct)
 
void SampleMany (simb::MCTruth &mct)
 
void Sample (simb::MCTruth &mct)
 
void printVecs (std::vector< std::string > const &list)
 
bool PadVector (std::vector< double > &vec)
 
double SelectFromHist (const TH1 &h)
 
void SelectFromHist (const TH2 &h, double &x, double &y)
 
void beginRun (art::Run &run) override
 Act on begin of run: write "RunData" information (sumdata::RunData). More...
 
void setup ()
 Performs checks and initialization based on the current configuration. More...
 

Static Private Member Functions

static std::map< int, std::string > makeParticleSelectionModeNames ()
 Returns a vector with the name of particle selection mode keywords. More...
 
static std::map< int, std::string > makeDistributionNames ()
 Returns a vector with the name of distribution keywords. More...
 
template<typename OptionList >
static auto selectOption (std::string Option, OptionList const &allowedOptions) -> decltype(auto)
 Parses an option string and returns the corresponding option number. More...
 
template<typename OptionList >
static std::string presentOptions (OptionList const &allowedOptions, bool printKey, std::initializer_list< typename OptionList::value_type::first_type > exclude)
 Returns a string describing all options in the list. More...
 
template<typename OptionList >
static std::string presentOptions (OptionList const &allowedOptions, bool printKey=true)
 
template<typename OptionList >
static std::string optionName (typename OptionList::value_type::first_type optionKey, OptionList const &allowedOptions, std::string defName="<unknown>")
 Returns the name of the specified option key, or defName if not known. More...
 

Private Attributes

int fMode
 
bool fPadOutVectors
 
std::vector< int > fPDG
 PDG code of particles to generate. More...
 
std::vector< double > fP0
 Central momentum (GeV/c) to generate. More...
 
std::vector< double > fSigmaP
 Variation in momenta (GeV/c) More...
 
int fPDist
 How to distribute momenta (gaus or uniform) More...
 
std::vector< double > fX0
 Central x position (cm) in world coordinates. More...
 
std::vector< double > fY0
 Central y position (cm) in world coordinates. More...
 
std::vector< double > fZ0
 Central z position (cm) in world coordinates. More...
 
std::vector< double > fT0
 Central t position (s) in world coordinates. More...
 
std::vector< double > fSigmaX
 Variation in x position (cm) More...
 
std::vector< double > fSigmaY
 Variation in y position (cm) More...
 
std::vector< double > fSigmaZ
 Variation in z position (cm) More...
 
std::vector< double > fSigmaT
 Variation in t position (s) More...
 
int fPosDist
 How to distribute xyz (gaus, or uniform) More...
 
int fTDist
 How to distribute t (gaus, or uniform) More...
 
bool fSingleVertex
 if true - all particles produced at the same location More...
 
std::vector< double > fTheta0XZ
 Angle in XZ plane (degrees) More...
 
std::vector< double > fTheta0YZ
 Angle in YZ plane (degrees) More...
 
std::vector< double > fSigmaThetaXZ
 Variation in angle in XZ plane. More...
 
std::vector< double > fSigmaThetaYZ
 Variation in angle in YZ plane. More...
 
int fAngleDist
 How to distribute angles (gaus, uniform) More...
 
std::string fHistFileName
 Filename containing histogram of momenta. More...
 
std::vector< std::string > fPHist
 name of histogram of momenta More...
 
std::vector< std::string > fThetaXzYzHist
 name of histogram for thetaxz/thetayz distribution More...
 
std::vector< std::unique_ptr< TH1 > > hPHist
 
std::vector< std::unique_ptr< TH2 > > hThetaXzYzHist
 actual TH1 for momentum distributions More...
 
CLHEP::HepRandomEngine & fEngine
 actual TH2 for angle distributions - Xz on x axis . More...
 

Static Private Attributes

static const std::map< int, std::string > ParticleSelectionModeNames
 Names of all particle selection modes. More...
 
static const std::map< int, std::string > DistributionNames
 Names of all distribution modes. More...
 
Constants for particle type extraction mode (`ParticleSelectionMode` parameter).
static constexpr int kSelectAllParts = 0
 One particle per entry is generated. More...
 
static constexpr int kSelectOneRandPart
 
Constants for kinematic distribution options.
static constexpr int kUNIF = 0
 Uniform distribution. More...
 
static constexpr int kGAUS = 1
 Gaussian distribution. More...
 
static constexpr int kHIST = 2
 

Detailed Description

module to produce single or multiple specified particles in the detector

Definition at line 54 of file larg4SingleGen_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

evgen::larg4SingleGen::larg4SingleGen ( Parameters const &  config)
explicit

Definition at line 409 of file larg4SingleGen_module.cc.

References art::detail::EngineCreator::createEngine(), DistributionNames, fAngleDist, fEngine, fHistFileName, fMode, fP0, fPadOutVectors, fPDG, fPDist, fPHist, fPosDist, fSigmaP, fSigmaT, fSigmaThetaXZ, fSigmaThetaYZ, fSigmaX, fSigmaY, fSigmaZ, fSingleVertex, fT0, fTDist, fTheta0XZ, fTheta0YZ, fThetaXzYzHist, fX0, fY0, fZ0, ParticleSelectionModeNames, seed, selectOption(), and setup().

410  : EDProducer{config}
411  , fMode(selectOption(config().ParticleSelectionMode(), ParticleSelectionModeNames))
412  , fPadOutVectors(config().PadOutVectors())
413  , fPDG(config().PDG())
414  , fP0(config().P0())
415  , fSigmaP(config().SigmaP())
416  , fPDist(selectOption(config().PDist(), DistributionNames))
417  , fX0(config().X0())
418  , fY0(config().Y0())
419  , fZ0(config().Z0())
420  , fT0(config().T0())
421  , fSigmaX(config().SigmaX())
422  , fSigmaY(config().SigmaY())
423  , fSigmaZ(config().SigmaZ())
424  , fSigmaT(config().SigmaT())
425  , fPosDist(selectOption(config().PosDist(), DistributionNames))
426  , fTDist(selectOption(config().TDist(), DistributionNames))
427  , fSingleVertex(config().SingleVertex())
428  , fTheta0XZ(config().Theta0XZ())
429  , fTheta0YZ(config().Theta0YZ())
430  , fSigmaThetaXZ(config().SigmaThetaXZ())
431  , fSigmaThetaYZ(config().SigmaThetaYZ())
432  , fAngleDist(selectOption(config().AngleDist(), DistributionNames))
433  , fHistFileName(config().HistogramFile())
434  , fPHist(config().PHist())
435  , fThetaXzYzHist(config().ThetaXzYzHist())
436  , fEngine(createEngine(0))
437  {
438  setup();
440  if (config().Seed(seed)) { fEngine.setSeed(seed, 0 /* dummy? */); }
441 
442  produces<std::vector<simb::MCTruth>>();
443  // produces< sumdata::RunData, art::InRun >();
444  }
int fTDist
How to distribute t (gaus, or uniform)
void setup()
Performs checks and initialization based on the current configuration.
base_engine_t & createEngine(seed_t seed)
std::vector< double > fSigmaZ
Variation in z position (cm)
std::vector< double > fSigmaP
Variation in momenta (GeV/c)
std::vector< double > fSigmaThetaYZ
Variation in angle in YZ plane.
EDProducer(fhicl::ParameterSet const &pset)
Definition: EDProducer.cc:6
CLHEP::HepRandomEngine & fEngine
actual TH2 for angle distributions - Xz on x axis .
std::vector< int > fPDG
PDG code of particles to generate.
std::vector< double > fSigmaT
Variation in t position (s)
static const std::map< int, std::string > DistributionNames
Names of all distribution modes.
long seed
Definition: chem4.cc:67
std::vector< double > fZ0
Central z position (cm) in world coordinates.
std::vector< double > fT0
Central t position (s) in world coordinates.
bool fSingleVertex
if true - all particles produced at the same location
std::vector< double > fTheta0XZ
Angle in XZ plane (degrees)
static auto selectOption(std::string Option, OptionList const &allowedOptions) -> decltype(auto)
Parses an option string and returns the corresponding option number.
std::string fHistFileName
Filename containing histogram of momenta.
int fAngleDist
How to distribute angles (gaus, uniform)
std::vector< double > fX0
Central x position (cm) in world coordinates.
std::vector< double > fSigmaY
Variation in y position (cm)
std::vector< double > fY0
Central y position (cm) in world coordinates.
std::vector< double > fSigmaX
Variation in x position (cm)
std::vector< std::string > fThetaXzYzHist
name of histogram for thetaxz/thetayz distribution
std::vector< std::string > fPHist
name of histogram of momenta
std::vector< double > fTheta0YZ
Angle in YZ plane (degrees)
std::vector< double > fP0
Central momentum (GeV/c) to generate.
std::vector< double > fSigmaThetaXZ
Variation in angle in XZ plane.
int fPDist
How to distribute momenta (gaus or uniform)
art::detail::EngineCreator::seed_t seed_t
int fPosDist
How to distribute xyz (gaus, or uniform)
static const std::map< int, std::string > ParticleSelectionModeNames
Names of all particle selection modes.

Member Function Documentation

void evgen::larg4SingleGen::beginRun ( art::Run run)
overrideprivatevirtual

Act on begin of run: write "RunData" information (sumdata::RunData).

Reimplemented from art::EDProducer.

Definition at line 447 of file larg4SingleGen_module.cc.

447 {}
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::map< int, std::string > evgen::larg4SingleGen::makeDistributionNames ( )
staticprivate

Returns a vector with the name of distribution keywords.

Definition at line 332 of file larg4SingleGen_module.cc.

References DistributionNames, kGAUS, kHIST, kUNIF, makeParticleSelectionModeNames(), and ParticleSelectionModeNames.

333  {
334  std::map<int, std::string> names;
335  names[int(kUNIF)] = "uniform";
336  names[int(kGAUS)] = "Gaussian";
337  names[int(kHIST)] = "histograms";
338  return names;
339  } // larg4SingleGen::makeDistributionNames()
static constexpr int kHIST
static constexpr int kUNIF
Uniform distribution.
static constexpr int kGAUS
Gaussian distribution.
std::map< int, std::string > evgen::larg4SingleGen::makeParticleSelectionModeNames ( )
staticprivate

Returns a vector with the name of particle selection mode keywords.

Definition at line 324 of file larg4SingleGen_module.cc.

References kSelectAllParts, and kSelectOneRandPart.

Referenced by makeDistributionNames().

325  {
326  std::map<int, std::string> names;
327  names[int(kSelectAllParts)] = "all";
328  names[int(kSelectOneRandPart)] = "singleRandom";
329  return names;
330  } // larg4SingleGen::makeParticleSelectionModeNames()
static constexpr int kSelectAllParts
One particle per entry is generated.
static constexpr int kSelectOneRandPart
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
template<typename OptionList >
std::string evgen::larg4SingleGen::optionName ( typename OptionList::value_type::first_type  optionKey,
OptionList const &  allowedOptions,
std::string  defName = "<unknown>" 
)
staticprivate

Returns the name of the specified option key, or defName if not known.

Definition at line 393 of file larg4SingleGen_module.cc.

Referenced by presentOptions(), and setup().

397  {
398  auto iOption = allowedOptions.find(optionKey);
399  return (iOption != allowedOptions.end()) ? iOption->second : defName;
400  } // larg4SingleGen::optionName()
bool evgen::larg4SingleGen::PadVector ( std::vector< double > &  vec)
private

Definition at line 635 of file larg4SingleGen_module.cc.

References fPadOutVectors, and fPDG.

Referenced by setup().

636  {
637  // check if the vec has the same size as fPDG
638  if (vec.size() != fPDG.size()) {
639  // if not padding out the vectors always cause an
640  // exception to be thrown if the vector in question
641  // is not the same size as the fPDG vector
642  // the exception is thrown in the reconfigure method
643  // that calls this one
644  if (!fPadOutVectors)
645  return false;
646  else if (fPadOutVectors) {
647  // if padding of vectors is desired but the vector in
648  // question has more than one entry it isn't clear
649  // what the padded values should be so cause
650  // an exception
651  if (vec.size() != 1) return false;
652 
653  // pad it out
654  vec.resize(fPDG.size(), vec[0]);
655 
656  } // end if padding out vectors
657  } // end if the vector size is not the same as fPDG
658 
659  return true;
660  }
std::vector< int > fPDG
PDG code of particles to generate.
template<typename OptionList >
std::string evgen::larg4SingleGen::presentOptions ( OptionList const &  allowedOptions,
bool  printKey,
std::initializer_list< typename OptionList::value_type::first_type >  exclude 
)
staticprivate

Returns a string describing all options in the list.

Template Parameters
OptionListtype of list of options (e.g. std::map<int, std::string>)
Parameters
allowedOptionsthe list of allowed options
printKeywhether to print the key of the option beside its name
excludeKeyslist of keys to be ignored (none by default)
Returns
a string with all options in a line

The result string is a list of option names, separated by commas, like in `"'apple', 'orange', 'banana'". IfprintKeyistrue`, the key of each option is also written in parentheses, like in `"'apple' (1), 'orange' (7), 'banana' (2)"`.

Definition at line 373 of file larg4SingleGen_module.cc.

References n, and util::to_string().

Referenced by presentOptions().

378  {
379  std::string msg;
380 
381  unsigned int n = 0;
382  for (auto const& option : allowedOptions) {
383  auto const& key = option.first;
384  if (std::find(exclude.begin(), exclude.end(), key) != exclude.end()) continue;
385  if (n++ > 0) msg += ", ";
386  msg += '\"' + std::string(option.second) + '\"';
387  if (printKey) msg += " (" + std::to_string(key) + ")";
388  } // for
389  return msg;
390  } // larg4SingleGen::presentOptions()
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
Char_t n[5]
template<typename OptionList >
static std::string evgen::larg4SingleGen::presentOptions ( OptionList const &  allowedOptions,
bool  printKey = true 
)
inlinestaticprivate

Definition at line 308 of file larg4SingleGen_module.cc.

References optionName(), and presentOptions().

309  {
310  return presentOptions(allowedOptions, printKey, {});
311  }
static std::string presentOptions(OptionList const &allowedOptions, bool printKey, std::initializer_list< typename OptionList::value_type::first_type > exclude)
Returns a string describing all options in the list.
void evgen::larg4SingleGen::printVecs ( std::vector< std::string > const &  list)
private

Definition at line 942 of file larg4SingleGen_module.cc.

References e, fP0, fPDG, fSigmaP, fSigmaT, fSigmaThetaXZ, fSigmaThetaYZ, fSigmaX, fSigmaY, fSigmaZ, fT0, fTheta0XZ, fTheta0YZ, fX0, fY0, fZ0, and util::values().

Referenced by setup().

943  {
944 
945  mf::LogInfo("larg4SingleGen")
946  << " You are using vector values for larg4SingleGen configuration.\n "
947  << " Some of the configuration vectors may have been padded out ,"
948  << " because they (weren't) as long as the pdg vector"
949  << " in your configuration. \n"
950  << " The new input particle configuration is:\n";
951 
952  std::string values;
953  for (size_t i = 0; i <= 1; ++i) { // list.size(); ++i){
954 
955  values.append(list[i]);
956  values.append(": [ ");
957 
958  for (size_t e = 0; e < fPDG.size(); ++e) {
959  std::stringstream buf;
960  buf.width(10);
961  if (i == 0) buf << fPDG[e] << ", ";
962  buf.precision(5);
963  if (i == 1) buf << fP0[e] << ", ";
964  if (i == 2) buf << fSigmaP[e] << ", ";
965  if (i == 3) buf << fX0[e] << ", ";
966  if (i == 4) buf << fY0[e] << ", ";
967  if (i == 5) buf << fZ0[e] << ", ";
968  if (i == 6) buf << fSigmaX[e] << ", ";
969  if (i == 7) buf << fSigmaY[e] << ", ";
970  if (i == 8) buf << fSigmaZ[e] << ", ";
971  if (i == 9) buf << fTheta0XZ[e] << ", ";
972  if (i == 10) buf << fTheta0YZ[e] << ", ";
973  if (i == 11) buf << fSigmaThetaXZ[e] << ", ";
974  if (i == 12) buf << fSigmaThetaYZ[e] << ", ";
975  if (i == 13) buf << fT0[e] << ", ";
976  if (i == 14) buf << fSigmaT[e] << ", ";
977  values.append(buf.str());
978  }
979 
980  values.erase(values.find_last_of(","));
981  values.append(" ] \n");
982 
983  } // end loop over vector names in list
984 
985  mf::LogInfo("larg4SingleGen") << values;
986 
987  return;
988  }
std::vector< double > fSigmaZ
Variation in z position (cm)
std::vector< double > fSigmaP
Variation in momenta (GeV/c)
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
std::vector< double > fSigmaThetaYZ
Variation in angle in YZ plane.
std::vector< int > fPDG
PDG code of particles to generate.
std::vector< double > fSigmaT
Variation in t position (s)
std::vector< double > fZ0
Central z position (cm) in world coordinates.
decltype(auto) values(Coll &&coll)
Range-for loop helper iterating across the values of the specified collection.
std::vector< double > fT0
Central t position (s) in world coordinates.
std::vector< double > fTheta0XZ
Angle in XZ plane (degrees)
std::vector< double > fX0
Central x position (cm) in world coordinates.
std::vector< double > fSigmaY
Variation in y position (cm)
std::vector< double > fY0
Central y position (cm) in world coordinates.
std::vector< double > fSigmaX
Variation in x position (cm)
Float_t e
Definition: plot.C:35
std::vector< double > fTheta0YZ
Angle in YZ plane (degrees)
std::vector< double > fP0
Central momentum (GeV/c) to generate.
std::vector< double > fSigmaThetaXZ
Variation in angle in XZ plane.
void evgen::larg4SingleGen::produce ( art::Event evt)
overridevirtual

unique_ptr allows ownership to be transferred to the art::Event after the put statement

Implements art::EDProducer.

Definition at line 663 of file larg4SingleGen_module.cc.

References simb::kSingleParticle, MF_LOG_DEBUG, art::Event::put(), Sample(), and simb::MCTruth::SetOrigin().

664  {
665 
667  std::unique_ptr<std::vector<simb::MCTruth>> truthcol(new std::vector<simb::MCTruth>);
668 
669  simb::MCTruth truth;
671  Sample(truth);
672 
673  MF_LOG_DEBUG("larg4SingleGen") << truth;
674 
675  truthcol->push_back(truth);
676 
677  evt.put(std::move(truthcol));
678 
679  return;
680  }
void SetOrigin(simb::Origin_t origin)
Definition: MCTruth.h:82
PutHandle< PROD > put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
Definition: Event.h:77
single particles thrown at the detector
Definition: MCTruth.h:26
#define MF_LOG_DEBUG(id)
Event generator information.
Definition: MCTruth.h:32
void Sample(simb::MCTruth &mct)
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 evgen::larg4SingleGen::Sample ( simb::MCTruth mct)
private

Definition at line 911 of file larg4SingleGen_module.cc.

References fEngine, fMode, fPDG, fSingleVertex, SampleMany(), and SampleOne().

Referenced by produce().

912  {
913 
914  switch (fMode) {
915  case 0: // List generation mode: every event will have one of each
916  // particle species in the fPDG array
917  if (fSingleVertex) { SampleMany(mct); }
918  else {
919  for (unsigned int i = 0; i < fPDG.size(); ++i) {
920  SampleOne(i, mct);
921  } //end loop over particles
922  }
923  break;
924  case 1: // Random selection mode: every event will exactly one particle
925  // selected randomly from the fPDG array
926  {
927  CLHEP::RandFlat flat(fEngine);
928 
929  unsigned int i = flat.fireInt(fPDG.size());
930  SampleOne(i, mct);
931  } break;
932  default:
933  mf::LogWarning("UnrecognizeOption")
934  << "larg4SingleGen does not recognize ParticleSelectionMode " << fMode;
935  break;
936  } // switch on fMode
937 
938  return;
939  }
CLHEP::HepRandomEngine & fEngine
actual TH2 for angle distributions - Xz on x axis .
std::vector< int > fPDG
PDG code of particles to generate.
void SampleOne(unsigned int i, simb::MCTruth &mct)
bool fSingleVertex
if true - all particles produced at the same location
void SampleMany(simb::MCTruth &mct)
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
void evgen::larg4SingleGen::SampleMany ( simb::MCTruth mct)
private

Definition at line 799 of file larg4SingleGen_module.cc.

References simb::MCTruth::Add(), simb::MCParticle::AddTrajectoryPoint(), fAngleDist, fEngine, fP0, fPDG, fPDist, fPosDist, fSigmaP, fSigmaT, fSigmaThetaXZ, fSigmaThetaYZ, fSigmaX, fSigmaY, fSigmaZ, fT0, fTDist, fTheta0XZ, fTheta0YZ, fX0, fY0, fZ0, hPHist, hThetaXzYzHist, kGAUS, kHIST, part, SelectFromHist(), and x.

Referenced by Sample().

800  {
801 
802  CLHEP::RandFlat flat(fEngine);
803  CLHEP::RandGaussQ gauss(fEngine);
804 
805  // Choose position
806  TVector3 x;
807  if (fPosDist == kGAUS) {
808  x[0] = gauss.fire(fX0[0], fSigmaX[0]);
809  ;
810  x[1] = gauss.fire(fY0[0], fSigmaY[0]);
811  x[2] = gauss.fire(fZ0[0], fSigmaZ[0]);
812  }
813  else {
814  x[0] = fX0[0] + fSigmaX[0] * (2.0 * flat.fire() - 1.0);
815  x[1] = fY0[0] + fSigmaY[0] * (2.0 * flat.fire() - 1.0);
816  x[2] = fZ0[0] + fSigmaZ[0] * (2.0 * flat.fire() - 1.0);
817  }
818 
819  double t = 0.;
820  if (fTDist == kGAUS) { t = gauss.fire(fT0[0], fSigmaT[0]); }
821  else {
822  t = fT0[0] + fSigmaT[0] * (2.0 * flat.fire() - 1.0);
823  }
824 
825  TLorentzVector pos(x[0], x[1], x[2], t);
826 
827  // loop through particles and select momenta and angles
828  for (unsigned int i(0); i < fPDG.size(); ++i) {
829  // Choose momentum
830  double p = 0.0;
831  double m = 0.0;
832  if (fPDist == kGAUS) { p = gauss.fire(fP0[i], fSigmaP[i]); }
833  else if (fPDist == kHIST) {
834  p = SelectFromHist(*(hPHist[i]));
835  }
836  else {
837  p = fP0[i] + fSigmaP[i] * (2.0 * flat.fire() - 1.0);
838  }
839 
840  static TDatabasePDG pdgt;
841  TParticlePDG* pdgp = pdgt.GetParticle(fPDG[i]);
842  if (pdgp) m = pdgp->Mass();
843 
844  // Choose angles
845  double thxz = 0;
846  double thyz = 0;
847 
848  double thyzrads = 0;
849  double thyzradsplussigma = 0;
850  double thyzradsminussigma = 0;
851 
852  if (fAngleDist == kGAUS) {
853  thxz = gauss.fire(fTheta0XZ[i], fSigmaThetaXZ[i]);
854  thyz = gauss.fire(fTheta0YZ[i], fSigmaThetaYZ[i]);
855  }
856  else if (fAngleDist == kHIST) {
857  double thetaxz = 0;
858  double thetayz = 0;
859  SelectFromHist(*(hThetaXzYzHist[i]), thetaxz, thetayz);
860  thxz = (180. / M_PI) * thetaxz;
861  thyz = (180. / M_PI) * thetayz;
862  }
863  else {
864 
865  // Choose angles flat in phase space, which is flat in theta_xz
866  // and flat in sin(theta_yz).
867 
868  thxz = fTheta0XZ[i] + fSigmaThetaXZ[i] * (2.0 * flat.fire() - 1.0);
869 
870  thyzrads = std::asin(std::sin(
871  (M_PI / 180.) *
872  (fTheta0YZ
873  [i]))); //Taking asin of sin gives value between -Pi/2 and Pi/2 regardless of user input
874  thyzradsplussigma =
875  TMath::Min((thyzrads + ((M_PI / 180.) * fabs(fSigmaThetaYZ[i]))), M_PI / 2.);
876  thyzradsminussigma =
877  TMath::Max((thyzrads - ((M_PI / 180.) * fabs(fSigmaThetaYZ[i]))), -M_PI / 2.);
878 
879  //uncomment line to print angular variation info
880  //std::cout << "Central angle: " << (180./M_PI)*thyzrads << " Max angle: " << (180./M_PI)*thyzradsplussigma << " Min angle: " << (180./M_PI)*thyzradsminussigma << std::endl;
881 
882  double sinthyzmin = std::sin(thyzradsminussigma);
883  double sinthyzmax = std::sin(thyzradsplussigma);
884  double sinthyz = sinthyzmin + flat.fire() * (sinthyzmax - sinthyzmin);
885  thyz = (180. / M_PI) * std::asin(sinthyz);
886  }
887 
888  double thxzrad = thxz * M_PI / 180.0;
889  double thyzrad = thyz * M_PI / 180.0;
890 
891  TLorentzVector pvec(p * std::cos(thyzrad) * std::sin(thxzrad),
892  p * std::sin(thyzrad),
893  p * std::cos(thxzrad) * std::cos(thyzrad),
894  std::sqrt(p * p + m * m));
895 
896  // set track id to -i as these are all primary particles and have id <= 0
897  int trackid = -1 * (i + 1);
898  std::string primary("primary");
899 
900  simb::MCParticle part(trackid, fPDG[i], primary);
901  part.AddTrajectoryPoint(pos, pvec);
902 
903  //std::cout << "Px: " << pvec.Px() << " Py: " << pvec.Py() << " Pz: " << pvec.Pz() << std::endl;
904  //std::cout << "x: " << pos.X() << " y: " << pos.Y() << " z: " << pos.Z() << " time: " << pos.T() << std::endl;
905  //std::cout << "YZ Angle: " << (thyzrad * (180./M_PI)) << " XZ Angle: " << (thxzrad * (180./M_PI)) << std::endl;
906  mct.Add(part);
907  }
908  }
Float_t x
Definition: compare.C:6
static constexpr int kHIST
int fTDist
How to distribute t (gaus, or uniform)
std::vector< double > fSigmaZ
Variation in z position (cm)
std::vector< std::unique_ptr< TH2 > > hThetaXzYzHist
actual TH1 for momentum distributions
std::vector< double > fSigmaP
Variation in momenta (GeV/c)
std::vector< double > fSigmaThetaYZ
Variation in angle in YZ plane.
double SelectFromHist(const TH1 &h)
CLHEP::HepRandomEngine & fEngine
actual TH2 for angle distributions - Xz on x axis .
std::vector< int > fPDG
PDG code of particles to generate.
TString part[npart]
Definition: Style.C:32
std::vector< double > fSigmaT
Variation in t position (s)
std::vector< double > fZ0
Central z position (cm) in world coordinates.
std::vector< double > fT0
Central t position (s) in world coordinates.
std::vector< double > fTheta0XZ
Angle in XZ plane (degrees)
void Add(simb::MCParticle const &part)
Definition: MCTruth.h:80
int fAngleDist
How to distribute angles (gaus, uniform)
std::vector< double > fX0
Central x position (cm) in world coordinates.
std::vector< double > fSigmaY
Variation in y position (cm)
std::vector< double > fY0
Central y position (cm) in world coordinates.
std::vector< double > fSigmaX
Variation in x position (cm)
std::vector< double > fTheta0YZ
Angle in YZ plane (degrees)
static constexpr int kGAUS
Gaussian distribution.
std::vector< std::unique_ptr< TH1 > > hPHist
std::vector< double > fP0
Central momentum (GeV/c) to generate.
std::vector< double > fSigmaThetaXZ
Variation in angle in XZ plane.
int fPDist
How to distribute momenta (gaus or uniform)
int fPosDist
How to distribute xyz (gaus, or uniform)
void evgen::larg4SingleGen::SampleOne ( unsigned int  i,
simb::MCTruth mct 
)
private

Definition at line 685 of file larg4SingleGen_module.cc.

References simb::MCTruth::Add(), simb::MCParticle::AddTrajectoryPoint(), fAngleDist, fEngine, fP0, fPDG, fPDist, fPosDist, fSigmaP, fSigmaT, fSigmaThetaXZ, fSigmaThetaYZ, fSigmaX, fSigmaY, fSigmaZ, fT0, fTDist, fTheta0XZ, fTheta0YZ, fX0, fY0, fZ0, hPHist, hThetaXzYzHist, kGAUS, kHIST, part, SelectFromHist(), and x.

Referenced by Sample().

686  {
687 
688  CLHEP::RandFlat flat(fEngine);
689  CLHEP::RandGaussQ gauss(fEngine);
690 
691  // Choose momentum
692  double p = 0.0;
693  double m = 0.0;
694  if (fPDist == kGAUS) { p = gauss.fire(fP0[i], fSigmaP[i]); }
695  else if (fPDist == kHIST) {
696  p = SelectFromHist(*(hPHist[i]));
697  }
698  else { // if (fPDist == kUNIF) {
699  p = fP0[i] + fSigmaP[i] * (2.0 * flat.fire() - 1.0);
700  }
701  // else {std::cout << "do not understand the value of PDist!";}
702 
703  static TDatabasePDG pdgt;
704  TParticlePDG* pdgp = pdgt.GetParticle(fPDG[i]);
705  if (pdgp) m = pdgp->Mass();
706 
707  // Choose position
708  TVector3 x;
709  if (fPosDist == kGAUS) {
710  x[0] = gauss.fire(fX0[i], fSigmaX[i]);
711  ;
712  x[1] = gauss.fire(fY0[i], fSigmaY[i]);
713  x[2] = gauss.fire(fZ0[i], fSigmaZ[i]);
714  }
715  else {
716  x[0] = fX0[i] + fSigmaX[i] * (2.0 * flat.fire() - 1.0);
717  x[1] = fY0[i] + fSigmaY[i] * (2.0 * flat.fire() - 1.0);
718  x[2] = fZ0[i] + fSigmaZ[i] * (2.0 * flat.fire() - 1.0);
719  }
720 
721  double t = 0.;
722  if (fTDist == kGAUS) { t = gauss.fire(fT0[i], fSigmaT[i]); }
723  else {
724  t = fT0[i] + fSigmaT[i] * (2.0 * flat.fire() - 1.0);
725  }
726 
727  TLorentzVector pos(x[0], x[1], x[2], t);
728 
729  // Choose angles
730  double thxz = 0;
731  double thyz = 0;
732 
733  double thyzrads = 0;
734  double thyzradsplussigma = 0;
735  double thyzradsminussigma = 0;
736 
737  if (fAngleDist == kGAUS) {
738  thxz = gauss.fire(fTheta0XZ[i], fSigmaThetaXZ[i]);
739  thyz = gauss.fire(fTheta0YZ[i], fSigmaThetaYZ[i]);
740  }
741  else if (fAngleDist == kHIST) { // Select thetaxz and thetayz from histogram
742  double thetaxz = 0;
743  double thetayz = 0;
744  SelectFromHist(*(hThetaXzYzHist[i]), thetaxz, thetayz);
745  thxz = (180. / M_PI) * thetaxz;
746  thyz = (180. / M_PI) * thetayz;
747  }
748  else {
749 
750  // Choose angles flat in phase space, which is flat in theta_xz
751  // and flat in sin(theta_yz).
752 
753  thxz = fTheta0XZ[i] + fSigmaThetaXZ[i] * (2.0 * flat.fire() - 1.0);
754 
755  thyzrads = std::asin(std::sin(
756  (M_PI / 180.) *
757  (fTheta0YZ
758  [i]))); //Taking asin of sin gives value between -Pi/2 and Pi/2 regardless of user input
759  thyzradsplussigma =
760  TMath::Min((thyzrads + ((M_PI / 180.) * fabs(fSigmaThetaYZ[i]))), M_PI / 2.);
761  thyzradsminussigma =
762  TMath::Max((thyzrads - ((M_PI / 180.) * fabs(fSigmaThetaYZ[i]))), -M_PI / 2.);
763 
764  //uncomment line to print angular variation info
765  //std::cout << "Central angle: " << (180./M_PI)*thyzrads << " Max angle: " << (180./M_PI)*thyzradsplussigma << " Min angle: " << (180./M_PI)*thyzradsminussigma << std::endl;
766 
767  double sinthyzmin = std::sin(thyzradsminussigma);
768  double sinthyzmax = std::sin(thyzradsplussigma);
769  double sinthyz = sinthyzmin + flat.fire() * (sinthyzmax - sinthyzmin);
770  thyz = (180. / M_PI) * std::asin(sinthyz);
771  }
772 
773  double thxzrad = thxz * M_PI / 180.0;
774  double thyzrad = thyz * M_PI / 180.0;
775 
776  TLorentzVector pvec(p * std::cos(thyzrad) * std::sin(thxzrad),
777  p * std::sin(thyzrad),
778  p * std::cos(thxzrad) * std::cos(thyzrad),
779  std::sqrt(p * p + m * m));
780 
781  // set track id to -i as these are all primary particles and have id <= 0
782  int trackid = -1 * (i + 1);
783  std::string primary("primary");
784 
785  simb::MCParticle part(trackid, fPDG[i], primary);
786  part.AddTrajectoryPoint(pos, pvec);
787 
788  //std::cout << "Px: " << pvec.Px() << " Py: " << pvec.Py() << " Pz: " << pvec.Pz() << std::endl;
789  //std::cout << "x: " << pos.X() << " y: " << pos.Y() << " z: " << pos.Z() << " time: " << pos.T() << std::endl;
790  //std::cout << "YZ Angle: " << (thyzrad * (180./M_PI)) << " XZ Angle: " << (thxzrad * (180./M_PI)) << std::endl;
791 
792  mct.Add(part);
793  }
Float_t x
Definition: compare.C:6
static constexpr int kHIST
int fTDist
How to distribute t (gaus, or uniform)
std::vector< double > fSigmaZ
Variation in z position (cm)
std::vector< std::unique_ptr< TH2 > > hThetaXzYzHist
actual TH1 for momentum distributions
std::vector< double > fSigmaP
Variation in momenta (GeV/c)
std::vector< double > fSigmaThetaYZ
Variation in angle in YZ plane.
double SelectFromHist(const TH1 &h)
CLHEP::HepRandomEngine & fEngine
actual TH2 for angle distributions - Xz on x axis .
std::vector< int > fPDG
PDG code of particles to generate.
TString part[npart]
Definition: Style.C:32
std::vector< double > fSigmaT
Variation in t position (s)
std::vector< double > fZ0
Central z position (cm) in world coordinates.
std::vector< double > fT0
Central t position (s) in world coordinates.
std::vector< double > fTheta0XZ
Angle in XZ plane (degrees)
void Add(simb::MCParticle const &part)
Definition: MCTruth.h:80
int fAngleDist
How to distribute angles (gaus, uniform)
std::vector< double > fX0
Central x position (cm) in world coordinates.
std::vector< double > fSigmaY
Variation in y position (cm)
std::vector< double > fY0
Central y position (cm) in world coordinates.
std::vector< double > fSigmaX
Variation in x position (cm)
std::vector< double > fTheta0YZ
Angle in YZ plane (degrees)
static constexpr int kGAUS
Gaussian distribution.
std::vector< std::unique_ptr< TH1 > > hPHist
std::vector< double > fP0
Central momentum (GeV/c) to generate.
std::vector< double > fSigmaThetaXZ
Variation in angle in XZ plane.
int fPDist
How to distribute momenta (gaus or uniform)
int fPosDist
How to distribute xyz (gaus, or uniform)
double evgen::larg4SingleGen::SelectFromHist ( const TH1 &  h)
private

Definition at line 991 of file larg4SingleGen_module.cc.

References fEngine.

Referenced by SampleMany(), and SampleOne().

992  {
993  CLHEP::RandFlat flat(fEngine);
994 
995  double throw_value = h.Integral() * flat.fire();
996  double cum_value(0);
997  for (int i(0); i < h.GetNbinsX() + 1; ++i) {
998  cum_value += h.GetBinContent(i);
999  if (throw_value < cum_value) { return flat.fire() * h.GetBinWidth(i) + h.GetBinLowEdge(i); }
1000  }
1001  return throw_value; // for some reason we've gone through all bins and failed?
1002  }
CLHEP::HepRandomEngine & fEngine
actual TH2 for angle distributions - Xz on x axis .
void evgen::larg4SingleGen::SelectFromHist ( const TH2 &  h,
double &  x,
double &  y 
)
private

Definition at line 1004 of file larg4SingleGen_module.cc.

References DEFINE_ART_MODULE, and fEngine.

1007  {
1008  CLHEP::RandFlat flat(fEngine);
1009 
1010  double throw_value = h.Integral() * flat.fire();
1011  double cum_value(0);
1012  for (int i(0); i < h.GetNbinsX() + 1; ++i) {
1013  for (int j(0); j < h.GetNbinsY() + 1; ++j) {
1014  cum_value += h.GetBinContent(i, j);
1015  if (throw_value < cum_value) {
1016  x = flat.fire() * h.GetXaxis()->GetBinWidth(i) + h.GetXaxis()->GetBinLowEdge(i);
1017  y = flat.fire() * h.GetYaxis()->GetBinWidth(j) + h.GetYaxis()->GetBinLowEdge(j);
1018  return;
1019  }
1020  }
1021  }
1022  return; // for some reason we've gone through all bins and failed?
1023  }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
CLHEP::HepRandomEngine & fEngine
actual TH2 for angle distributions - Xz on x axis .
template<typename OptionList >
auto evgen::larg4SingleGen::selectOption ( std::string  Option,
OptionList const &  allowedOptions 
) -> decltype(auto)
staticprivate

Parses an option string and returns the corresponding option number.

Template Parameters
OptionListtype of list of options (e.g. std::map<int, std::string>)
Parameters
Optionthe string of the option to be parsed
allowedOptionslist of valid options, as key/name pairs
Returns
the key of the Option string from allowedOptions
Exceptions
std::runtime_errorif Option is not in the option list

The option string Option represent a single one among the supported options as defined in allowedOptions. The option string can be either one of the option names (the matching is not case-sensitive) or the number of the option itself.

OptionList requirements

OptionList must behave like a sequence with forward iterators. Each element must behave as a pair, whose first element is the option key and the second element is the option name, equivalent to a string in that it must be forward-iterable and its elements can be converted by std::tolower(). The key type has no requirements beside being copiable.

Definition at line 347 of file larg4SingleGen_module.cc.

References util::end().

Referenced by evgen::larg4SingleGen::Config::fromHistogram(), and larg4SingleGen().

349  {
350  using key_type = typename OptionList::value_type::first_type;
351  using tolower_type = int (*)(int);
352  auto toLower = [](auto const& S) {
353  std::string s;
354  s.reserve(S.size());
355  std::transform(S.cbegin(), S.cend(), std::back_inserter(s), (tolower_type)&std::tolower);
356  return s;
357  };
358  auto option = toLower(Option);
359  for (auto const& candidate : allowedOptions) {
360  if (toLower(candidate.second) == option) return candidate.first;
361  }
362  try {
363  std::size_t end;
364  key_type num = std::stoi(Option, &end);
365  if (allowedOptions.count(num) && (end == Option.length())) return num;
366  }
367  catch (std::invalid_argument const&) {
368  }
369  throw std::runtime_error("Option '" + Option + "' not supported.");
370  } // larg4SingleGen::selectOption()
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
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 evgen::larg4SingleGen::setup ( )
private

Performs checks and initialization based on the current configuration.

Definition at line 450 of file larg4SingleGen_module.cc.

References art::errors::Configuration, DistributionNames, fAngleDist, fHistFileName, fP0, fPadOutVectors, fPDG, fPDist, fPHist, fPosDist, fSigmaP, fSigmaT, fSigmaThetaXZ, fSigmaThetaYZ, fSigmaX, fSigmaY, fSigmaZ, fT0, fTDist, fTheta0XZ, fTheta0YZ, fThetaXzYzHist, fX0, fY0, fZ0, hPHist, hThetaXzYzHist, kGAUS, kHIST, kUNIF, art::errors::NotFound, optionName(), PadVector(), printVecs(), and util::to_string().

Referenced by larg4SingleGen().

451  {
452  // do not put seed in reconfigure because we don't want to reset
453  // the seed midstream
454  std::vector<std::string> vlist(15);
455  vlist[0] = "PDG";
456  vlist[1] = "P0";
457  vlist[2] = "SigmaP";
458  vlist[3] = "X0";
459  vlist[4] = "Y0";
460  vlist[5] = "Z0";
461  vlist[6] = "SigmaX";
462  vlist[7] = "SigmaY";
463  vlist[8] = "SigmaZ";
464  vlist[9] = "Theta0XZ";
465  vlist[10] = "Theta0YZ";
466  vlist[11] = "SigmaThetaXZ";
467  vlist[12] = "SigmaThetaYZ";
468  vlist[13] = "T0";
469  vlist[14] = "SigmaT";
470 
471  // begin tests for multiple particle error possibilities
472  std::string list;
473  if (fPDist != kHIST) {
474  if (!this->PadVector(fP0)) { list.append(vlist[1].append(", \n")); }
475  if (!this->PadVector(fSigmaP)) { list.append(vlist[2].append(", \n")); }
476  }
477  if (!this->PadVector(fX0)) { list.append(vlist[3].append(", \n")); }
478  if (!this->PadVector(fY0)) { list.append(vlist[4].append(", \n")); }
479  if (!this->PadVector(fZ0)) { list.append(vlist[5].append(", \n")); }
480  if (!this->PadVector(fSigmaX)) { list.append(vlist[6].append(", \n")); }
481  if (!this->PadVector(fSigmaY)) { list.append(vlist[7].append(", \n")); }
482  if (!this->PadVector(fSigmaZ)) { list.append(vlist[8].append(", \n")); }
483  if (!this->PadVector(fTheta0XZ)) { list.append(vlist[9].append(", \n")); }
484  if (!this->PadVector(fTheta0YZ)) { list.append(vlist[10].append(", \n")); }
485  if (!this->PadVector(fSigmaThetaXZ)) { list.append(vlist[11].append(", \n")); }
486  if (!this->PadVector(fSigmaThetaYZ)) { list.append(vlist[12].append(" \n")); }
487  if (!this->PadVector(fT0)) { list.append(vlist[13].append(", \n")); }
488  if (!this->PadVector(fSigmaT)) { list.append(vlist[14].append(", \n")); }
489 
490  if (list.size() > 0)
491  throw cet::exception("larg4SingleGen")
492  << "The " << list << "\n vector(s) defined in the fhicl files has/have "
493  << "a different size than the PDG vector "
494  << "\n and it has (they have) more than one value, "
495  << "\n disallowing sensible padding "
496  << " and/or you have set fPadOutVectors to false. \n";
497 
498  if (fPDG.size() > 1 && fPadOutVectors) this->printVecs(vlist);
499 
500  // If needed, get histograms for momentum and angle distributions
501  TFile* histFile = nullptr;
502  if (!fHistFileName.empty()) {
503  if (fHistFileName[0] == '/') {
504  // We have an absolute path, use given name exactly.
505  if (cet::file_exists(fHistFileName)) {
506  histFile = new TFile(fHistFileName.c_str());
507  if (!histFile || histFile->IsZombie() || !histFile->IsOpen()) {
508  delete histFile;
509  histFile = nullptr;
511  << "Cannot open ROOT file specified in parameter HistogramFile: \"" << fHistFileName
512  << "\"";
513  }
514  }
515  else {
517  << "ROOT file specified in parameter HistogramFile: \"" << fHistFileName
518  << "\" does not exist!";
519  }
520  }
521  else {
522  // We have a relative path, search starting from current directory.
523  std::string relative_filename{"./"};
524  relative_filename += fHistFileName;
525  if (cet::file_exists(relative_filename)) {
526  histFile = new TFile(relative_filename.c_str());
527  if (!histFile || histFile->IsZombie() || !histFile->IsOpen()) {
528  delete histFile;
529  histFile = nullptr;
531  << "Cannot open ROOT file found using relative path and originally specified in "
532  "parameter HistogramFile: \""
533  << relative_filename << '"';
534  }
535  }
536  else {
537  cet::search_path sp{"FW_SEARCH_PATH"};
538  std::string found_filename;
539  auto found = sp.find_file(fHistFileName, found_filename);
540  if (!found) {
542  << "Cannot find ROOT file in current directory nor on FW_SEARCH_PATH specified in "
543  "parameter HistogramFile: \""
544  << fHistFileName << '"';
545  }
546  histFile = new TFile(found_filename.c_str());
547  if (!histFile || histFile->IsZombie() || !histFile->IsOpen()) {
548  delete histFile;
549  histFile = nullptr;
551  << "Cannot open ROOT file found on FW_SEARCH_PATH and originally specified in "
552  "parameter HistogramFile: \""
553  << found_filename << '"';
554  }
555  }
556  }
557  }
558 
559  //
560  // deal with position distribution
561  //
562  switch (fPosDist) {
563  case kGAUS:
564  case kUNIF: break; // supported, no further action needed
565  default:
567  << "Position distribution of type '" << optionName(fPosDist, DistributionNames) << "' ("
568  << std::to_string(fPosDist) << ") is not supported.";
569  } // switch(fPosDist)
570 
571  //
572  // deal with time distribution
573  //
574  switch (fTDist) {
575  case kGAUS:
576  case kUNIF: break; // supported, no further action needed
577  default:
579  << "Time distribution of type '" << optionName(fTDist, DistributionNames) << "' ("
580  << std::to_string(fTDist) << ") is not supported.";
581  } // switch(fTDist)
582 
583  //
584  // deal with momentum distribution
585  //
586  switch (fPDist) {
587  case kHIST:
588  if (fPHist.size() != fPDG.size()) {
590  << fPHist.size() << " momentum histograms to describe " << fPDG.size()
591  << " particle types...";
592  }
593  hPHist.reserve(fPHist.size());
594  for (auto const& histName : fPHist) {
595  TH1* pHist = dynamic_cast<TH1*>(histFile->Get(histName.c_str()));
596  if (!pHist) {
598  << "Failed to read momentum histogram '" << histName << "' from '"
599  << histFile->GetPath() << "\'";
600  }
601  pHist->SetDirectory(nullptr); // make it independent of the input file
602  hPHist.emplace_back(pHist);
603  } // for
604  break;
605  default: // supported, no further action needed
606  break;
607  } // switch(fPDist)
608 
609  switch (fAngleDist) {
610  case kHIST:
611  if (fThetaXzYzHist.size() != fPDG.size()) {
613  << fThetaXzYzHist.size() << " direction histograms to describe " << fPDG.size()
614  << " particle types...";
615  }
616  hThetaXzYzHist.reserve(fThetaXzYzHist.size());
617  for (auto const& histName : fThetaXzYzHist) {
618  TH2* pHist = dynamic_cast<TH2*>(histFile->Get(histName.c_str()));
619  if (!pHist) {
621  << "Failed to read direction histogram '" << histName << "' from '"
622  << histFile->GetPath() << "\'";
623  }
624  pHist->SetDirectory(nullptr); // make it independent of the input file
625  hThetaXzYzHist.emplace_back(pHist);
626  } // for
627  default: // supported, no further action needed
628  break;
629  } // switch(fAngleDist)
630 
631  delete histFile;
632  }
static constexpr int kHIST
int fTDist
How to distribute t (gaus, or uniform)
std::vector< double > fSigmaZ
Variation in z position (cm)
std::vector< std::unique_ptr< TH2 > > hThetaXzYzHist
actual TH1 for momentum distributions
std::vector< double > fSigmaP
Variation in momenta (GeV/c)
std::vector< double > fSigmaThetaYZ
Variation in angle in YZ plane.
std::vector< int > fPDG
PDG code of particles to generate.
std::vector< double > fSigmaT
Variation in t position (s)
static const std::map< int, std::string > DistributionNames
Names of all distribution modes.
decltype(auto) constexpr to_string(T &&obj)
ADL-aware version of std::to_string.
std::vector< double > fZ0
Central z position (cm) in world coordinates.
std::vector< double > fT0
Central t position (s) in world coordinates.
bool PadVector(std::vector< double > &vec)
std::vector< double > fTheta0XZ
Angle in XZ plane (degrees)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::string fHistFileName
Filename containing histogram of momenta.
int fAngleDist
How to distribute angles (gaus, uniform)
std::vector< double > fX0
Central x position (cm) in world coordinates.
std::vector< double > fSigmaY
Variation in y position (cm)
static constexpr int kUNIF
Uniform distribution.
std::vector< double > fY0
Central y position (cm) in world coordinates.
std::vector< double > fSigmaX
Variation in x position (cm)
std::vector< std::string > fThetaXzYzHist
name of histogram for thetaxz/thetayz distribution
std::vector< std::string > fPHist
name of histogram of momenta
std::vector< double > fTheta0YZ
Angle in YZ plane (degrees)
static constexpr int kGAUS
Gaussian distribution.
std::vector< std::unique_ptr< TH1 > > hPHist
static std::string optionName(typename OptionList::value_type::first_type optionKey, OptionList const &allowedOptions, std::string defName="<unknown>")
Returns the name of the specified option key, or defName if not known.
std::vector< double > fP0
Central momentum (GeV/c) to generate.
std::vector< double > fSigmaThetaXZ
Variation in angle in XZ plane.
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
int fPDist
How to distribute momenta (gaus or uniform)
int fPosDist
How to distribute xyz (gaus, or uniform)
void printVecs(std::vector< std::string > const &list)
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

const std::map< int, std::string > evgen::larg4SingleGen::DistributionNames
staticprivate
Initial value:

Names of all distribution modes.

Definition at line 184 of file larg4SingleGen_module.cc.

Referenced by evgen::larg4SingleGen::Config::fromHistogram(), larg4SingleGen(), makeDistributionNames(), and setup().

int evgen::larg4SingleGen::fAngleDist
private

How to distribute angles (gaus, uniform)

Definition at line 236 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), SampleMany(), SampleOne(), and setup().

CLHEP::HepRandomEngine& evgen::larg4SingleGen::fEngine
private

actual TH2 for angle distributions - Xz on x axis .

art-managed random-number engine

Definition at line 248 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), Sample(), SampleMany(), SampleOne(), and SelectFromHist().

std::string evgen::larg4SingleGen::fHistFileName
private

Filename containing histogram of momenta.

Definition at line 237 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), and setup().

int evgen::larg4SingleGen::fMode
private

Particle Selection Mode 0–generate a list of all particles, 1–generate a single particle selected randomly from the list

Definition at line 210 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), and Sample().

std::vector<double> evgen::larg4SingleGen::fP0
private

Central momentum (GeV/c) to generate.

Definition at line 218 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), printVecs(), SampleMany(), SampleOne(), and setup().

bool evgen::larg4SingleGen::fPadOutVectors
private

Select to pad out configuration vectors if they are not of of the same length as PDG false: don't pad out - all values need to specified true: pad out - default values assumed and printed out

Definition at line 213 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), PadVector(), and setup().

std::vector<int> evgen::larg4SingleGen::fPDG
private

PDG code of particles to generate.

Definition at line 217 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), PadVector(), printVecs(), Sample(), SampleMany(), SampleOne(), and setup().

int evgen::larg4SingleGen::fPDist
private

How to distribute momenta (gaus or uniform)

Definition at line 220 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), SampleMany(), SampleOne(), and setup().

std::vector<std::string> evgen::larg4SingleGen::fPHist
private

name of histogram of momenta

Definition at line 238 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), and setup().

int evgen::larg4SingleGen::fPosDist
private

How to distribute xyz (gaus, or uniform)

Definition at line 229 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), SampleMany(), SampleOne(), and setup().

std::vector<double> evgen::larg4SingleGen::fSigmaP
private

Variation in momenta (GeV/c)

Definition at line 219 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), printVecs(), SampleMany(), SampleOne(), and setup().

std::vector<double> evgen::larg4SingleGen::fSigmaT
private

Variation in t position (s)

Definition at line 228 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), printVecs(), SampleMany(), SampleOne(), and setup().

std::vector<double> evgen::larg4SingleGen::fSigmaThetaXZ
private

Variation in angle in XZ plane.

Definition at line 234 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), printVecs(), SampleMany(), SampleOne(), and setup().

std::vector<double> evgen::larg4SingleGen::fSigmaThetaYZ
private

Variation in angle in YZ plane.

Definition at line 235 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), printVecs(), SampleMany(), SampleOne(), and setup().

std::vector<double> evgen::larg4SingleGen::fSigmaX
private

Variation in x position (cm)

Definition at line 225 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), printVecs(), SampleMany(), SampleOne(), and setup().

std::vector<double> evgen::larg4SingleGen::fSigmaY
private

Variation in y position (cm)

Definition at line 226 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), printVecs(), SampleMany(), SampleOne(), and setup().

std::vector<double> evgen::larg4SingleGen::fSigmaZ
private

Variation in z position (cm)

Definition at line 227 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), printVecs(), SampleMany(), SampleOne(), and setup().

bool evgen::larg4SingleGen::fSingleVertex
private

if true - all particles produced at the same location

Definition at line 231 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), and Sample().

std::vector<double> evgen::larg4SingleGen::fT0
private

Central t position (s) in world coordinates.

Definition at line 224 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), printVecs(), SampleMany(), SampleOne(), and setup().

int evgen::larg4SingleGen::fTDist
private

How to distribute t (gaus, or uniform)

Definition at line 230 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), SampleMany(), SampleOne(), and setup().

std::vector<double> evgen::larg4SingleGen::fTheta0XZ
private

Angle in XZ plane (degrees)

Definition at line 232 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), printVecs(), SampleMany(), SampleOne(), and setup().

std::vector<double> evgen::larg4SingleGen::fTheta0YZ
private

Angle in YZ plane (degrees)

Definition at line 233 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), printVecs(), SampleMany(), SampleOne(), and setup().

std::vector<std::string> evgen::larg4SingleGen::fThetaXzYzHist
private

name of histogram for thetaxz/thetayz distribution

Definition at line 239 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), and setup().

std::vector<double> evgen::larg4SingleGen::fX0
private

Central x position (cm) in world coordinates.

Definition at line 221 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), printVecs(), SampleMany(), SampleOne(), and setup().

std::vector<double> evgen::larg4SingleGen::fY0
private

Central y position (cm) in world coordinates.

Definition at line 222 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), printVecs(), SampleMany(), SampleOne(), and setup().

std::vector<double> evgen::larg4SingleGen::fZ0
private

Central z position (cm) in world coordinates.

Definition at line 223 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), printVecs(), SampleMany(), SampleOne(), and setup().

std::vector<std::unique_ptr<TH1> > evgen::larg4SingleGen::hPHist
private

Definition at line 241 of file larg4SingleGen_module.cc.

Referenced by SampleMany(), SampleOne(), and setup().

std::vector<std::unique_ptr<TH2> > evgen::larg4SingleGen::hThetaXzYzHist
private

actual TH1 for momentum distributions

Definition at line 243 of file larg4SingleGen_module.cc.

Referenced by SampleMany(), SampleOne(), and setup().

constexpr int evgen::larg4SingleGen::kGAUS = 1
staticprivate

Gaussian distribution.

Definition at line 206 of file larg4SingleGen_module.cc.

Referenced by makeDistributionNames(), SampleMany(), SampleOne(), and setup().

constexpr int evgen::larg4SingleGen::kHIST = 2
staticprivate

Distribution from histograms.

Definition at line 207 of file larg4SingleGen_module.cc.

Referenced by evgen::larg4SingleGen::Config::fromHistogram(), makeDistributionNames(), SampleMany(), SampleOne(), and setup().

constexpr int evgen::larg4SingleGen::kSelectAllParts = 0
staticprivate

One particle per entry is generated.

Definition at line 197 of file larg4SingleGen_module.cc.

Referenced by makeParticleSelectionModeNames().

constexpr int evgen::larg4SingleGen::kSelectOneRandPart
staticprivate
Initial value:
=
1

One particle is generated, extracted from the provided options.

Definition at line 198 of file larg4SingleGen_module.cc.

Referenced by makeParticleSelectionModeNames().

constexpr int evgen::larg4SingleGen::kUNIF = 0
staticprivate

Uniform distribution.

Definition at line 205 of file larg4SingleGen_module.cc.

Referenced by makeDistributionNames(), and setup().

const std::map< int, std::string > evgen::larg4SingleGen::ParticleSelectionModeNames
staticprivate
Initial value:

Names of all particle selection modes.

Definition at line 182 of file larg4SingleGen_module.cc.

Referenced by larg4SingleGen(), and makeDistributionNames().


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