LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
art::detail::EngineCreator Class Reference

#include "EngineCreator.h"

Inheritance diagram for art::detail::EngineCreator:
art::detail::LegacyModule art::MixHelper art::ReplicatedAnalyzer art::ReplicatedFilter art::ReplicatedProducer art::EDAnalyzer art::EDFilter art::EDProducer art::TriggerResultInserter artg4tk::CheckCalorimeterHits artg4tk::CheckDRCalorimeterHits artg4tk::CheckGenParticle artg4tk::CheckHits artg4tk::CheckInteractions artg4tk::CheckPhotonHits artg4tk::CheckProtonProduction artg4tk::CheckTrackerHits caldata::CalWireAna caldata::DumpWires calo::CaloChecker calo::PrintCalorimetry cheat::CheckBackTracking cheat::RecoCheckAna cluster::ClusterAna cluster::ClusterPCA cluster::ClusterTrackAna cluster::DBclusterAna cluster::HoughLineFinderAna ClusteringValidation::ClusteringValidation detsim::DumpOpDetWaveforms detsim::DumpRawDigits detsim::SimDriftedElectronClusterAna detsim::SimWireAna detsim::WienerFilterAna dnn::SaveImageH5 DUNE::MuonTrackingEff DUNE::NeutrinoShowerEff DUNE::NeutrinoTrackingEff ems::MultiEMShowers evd::EVD evg::GenieOutput geo::DumpChannelMap geo::DumpGeometry hit::DumpHits hit::GausHitFinderAna hit::HitAnaModule hit::HitFinderAna hit::MagDriftAna hit::MCHitAnaExample lar::ComputePi lar::example::AnalysisExample lar::example::Exploder lar_pandora::ConsolidatedPFParticleAnalysisTemplate lar_pandora::LArPandoraEventDump lar_pandora::PFParticleAnalysis lar_pandora::PFParticleCosmicAna lar_pandora::PFParticleHitDumper lar_pandora::PFParticleMonitoring lar_pandora::PFParticleTrackAna lar_pandora::PFParticleValidation larg4::CheckAuxDetHit larg4::CheckMCParticle larg4::CheckSimEnergyDeposit larg4::ISCalcAna larg4::LArG4Ana larg::LArSimChannelAna lcvn::ICVNZlibMaker MCBTDemo microboone::CosmicRemovalAna nnet::EvaluateROIEff nnet::NoiseWaveformDump nnet::PointIdEffTest nnet::PointIdTrainingData nnet::RawWaveformClnSigDump nnet::RawWaveformDump nnet::WaveformDenoiseTest NuGraphAnalyzer NuShowerEff opdet::FIFOHistogramAna opdet::FlashHypothesisAna opdet::LEDCalibrationAna opdet::OpDigiAna opdet::OpFlashAna opdet::OpFlashMCTruthAna opdet::OpFlashSimpleAna opdet::OpHitAna opdet::PhotonInf opdet::SimPhotonCounter ophit::DumpOpFlashes ophit::DumpOpHits opreco::OpticalRecoAna pdsp::CheckCNNScore pfpf::PFPAna phot::CreateHybridLibrary phot::PhotonLibraryAnalyzer pid::DumpParticleIDs pid::PIDAAnalyzer pmtana::PMTAna quad::EvalVtx reco3d::PlotSpacePoints recob::DumpChargedSpacePoints recob::DumpClusters recob::DumpPCAxes recob::DumpPFParticles recob::DumpSeeds recob::DumpSpacePoints recob::DumpTracks recob::DumpVertices RecoProxyUsageExample rwgt::ReweightAna shower::TCShowerAnalysis shower::TCShowerElectronLikelihood shower::TCShowerTemplateMaker ShowerQuality sim::DumpGTruth sim::DumpMCParticles sim::DumpMCShowers sim::DumpMCTracks sim::DumpMCTruth sim::DumpOpDetBacktrackerRecords sim::DumpSimChannels sim::DumpSimEnergyDeposits sim::DumpSimPhotons sim::DumpSimPhotonsLite sim::POTaccumulator trk::TrackContainmentAnalyzer trkf::SeedAna trkf::SpacePointAna trkf::TrackAna vertex::AggregateVertexAna vertex::FeatureVertexFinderAna wc::CellTree art::MixFilter< T, IOPolicy > cluster::SmallClusterFilter filt::FinalStateParticleFilter filt::LArG4ParticleFilter filter::ADCFilter filter::EventFilter filter::EventTimeFilter filter::MuonFilter simfilter::FilterCryostatNus simfilter::FilterGenInTime simfilter::FilterNoDirtNeutrinos simfilter::FilterPrimaryPDG apa::APAHitFinder artg4tk::artg4tkMain artg4tk::EventGenerator bogoblip::BlipMaker butcher::EventButcher caldata::CalWire caldata::CalWireT962 calo::Calorimetry calo::GnocchiCalorimetry calo::ShowerCalorimetry calo::TrackCalorimetry cheat::BackTrackerLoader cheat::PhotonBackTrackerLoader cluster::BlurredClustering cluster::ClusterCheater cluster::ClusterCrawler cluster::DBcluster cluster::DBCluster3D cluster::EndPointModule cluster::HoughLineFinder cluster::LineCluster cluster::LineMerger cluster::SmallClusterFinder cluster::TrajCluster cosmic::BeamFlashTrackMatchTagger cosmic::CosmicClusterTagger cosmic::CosmicPCAxisTagger cosmic::CosmicPFParticleTagger cosmic::CosmicTrackTagger cosmic::TrackPFParticleMatch CRHitRemoval CRHitRemovalByPCA detsim::DriftElectronstoPlane detsim::SimDriftElectrons detsim::SimWire ems::EMShower3D evd::GraphCluster event::EventCheater evg::AddGenieEventsToArt evgen::BaseRadioGen evgen::CORSIKAGen evgen::CosmicsGen evgen::FileMuons evgen::GaisserParam evgen::GENIEGen evgen::larg4SingleGen evgen::LightSource evgen::MarleyGen evgen::MarleyTimeGen evgen::MUSUN evgen::NDKGen evgen::NeutronOsc evgen::NucleonDecay evgen::PhotonGen evgen::RadioGen evgen::SingleGen evgen::SNNueAr40CCGen evgen::TestGENIEHelper evgen::TextFileGen evwgh::EventWeight hit::DisambigCheater hit::DPRawHitFinder hit::FFTHitFinder hit::HitCheater hit::HitFinder hit::MCHitFinder hit::RawHitFinder hit::RFFHitFinder hit::TTHitFinder lar::example::Disturbance lar_cluster3d::Cluster3D lar_pandora::CollectionSplitting lar_pandora::ILArPandora lar_pandora::LArPandoraExternalEventBuilding lar_pandora::LArPandoraShowerCreation lar_pandora::LArPandoraTrackCreation larg4::IonAndScint larg4::LArG4 larg4::larg4Main lbne::PhotonCounterT0Matching lcvn::ICVNMapper< T, U > lcvn::LArCVNEvaluator MCReco mvapid::MVAPID nnet::EmTrackClusterId nnet::EmTrackClusterId2out nnet::EmTrackClusterId2outTl nnet::EmTrackClusterId3outTl nnet::EmTrackMichelId nnet::EmTrackMichelIdTl nnet::ParticleDecayId nnet::WaveformRoiFinder noisefilteralg::WireCellNoiseFilter NuGraphInference NuSliceHitsProducer opdet::OpFlashFinder opdet::OpHitFinder opdet::OpMCDigi opdet::OptDetDigitizer opdet::OpticalRawDigitReformatter phot::PDFastSimANN phot::PDFastSimPAR phot::PDFastSimPVS phot::PhotonLibraryPropagation pid::Chi2ParticleID quad::QuadVtx reco3d::SpacePointSolver reco::shower::LArPandoraModularShowerCreation sce::SCECorrection shower::EMShower shower::TCShower ShowerReco3D shwf::ShowerCheater shwf::ShowerFinder shwf::ShowerReco sim::GenericCRT sim::MergeSimSources sim::PhotonHitConverter spacecharge::ShiftEdepSCE sppt::TTSpacePointFinder t0::MCParticleHitMatching t0::MCParticleShowerMatching t0::MCParticleTrackMatching t0::MCTruthT0Matching TrackProducerFromPFParticle TrackProducerFromTrack TrackProducerFromTrackTrajectory trk::TrackContainmentTagger trkf::CCTrackMaker trkf::CosmicTracker trkf::FeatureTracker trkf::KalmanFilterFinalTrackFitter trkf::KalmanFilterTrajectoryFitter trkf::MCSFitProducer trkf::PMAlgTrackMaker trkf::PMAlgTrajFitter trkf::SeedFinderModule trkf::SpacePointCheater trkf::SpacePointFinder trkf::SpacePts trkf::TCTrack trkf::Track3DKalman trkf::Track3DKalmanHit trkf::Track3DKalmanSPS trkf::Track3Dreco trkf::TrackCheater trkf::TrackKalmanCheater trkf::TrackStitcher trkf::VertexFitter tss::TrackShowerHits vertex::FeatureVertexFinder vertex::PrimaryVertexFinder vertex::VertexCheater vertex::VertexFinder2D

Public Types

using base_engine_t = CLHEP::HepRandomEngine
 
using label_t = RNGsnapshot::label_t
 
using seed_t = long
 
using engine_state_t = RNGsnapshot::engine_state_t
 

Public Member Functions

 EngineCreator (std::string const &label, ScheduleID sid)
 
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)
 

Private Types

using RNGservice = RandomNumberGenerator
 

Private Member Functions

void requireValid ()
 

Static Private Member Functions

static ServiceHandle< RandomNumberGenerator > & rng ()
 

Private Attributes

std::string const moduleLabel_ {}
 
ScheduleID const sid_ {}
 

Detailed Description

Definition at line 31 of file EngineCreator.h.

Member Typedef Documentation

using art::detail::EngineCreator::base_engine_t = CLHEP::HepRandomEngine

Definition at line 36 of file EngineCreator.h.

Definition at line 38 of file EngineCreator.h.

Constructor & Destructor Documentation

EngineCreator::EngineCreator ( std::string const &  label,
ScheduleID  sid 
)
explicit

Definition at line 14 of file EngineCreator.cc.

References sid_.

16  : moduleLabel_{moduleLabel}, sid_{sid}
17 {}
std::string const moduleLabel_
Definition: EngineCreator.h:53

Member Function Documentation

EngineCreator::base_engine_t & EngineCreator::createEngine ( seed_t  seed)

Definition at line 20 of file EngineCreator.cc.

References rng().

Referenced by evg::AddGenieEventsToArt::AddGenieEventsToArt(), artg4tk::artg4tkMain::artg4tkMain(), evgen::BaseRadioGen::BaseRadioGen(), evgen::CORSIKAGen::CORSIKAGen(), evgen::CosmicsGen::CosmicsGen(), art::MixHelper::createEngine(), detsim::DriftElectronstoPlane::DriftElectronstoPlane(), art::EDAnalyzer::EDAnalyzer(), art::EDFilter::EDFilter(), art::EDProducer::EDProducer(), artg4tk::EventGenerator::EventGenerator(), evwgh::EventWeight::EventWeight(), evgen::GaisserParam::GaisserParam(), cluster::HoughLineFinder::HoughLineFinder(), art::MixHelper::initEngine_(), larg4::IonAndScint::IonAndScint(), larg4::ISCalcAna::ISCalcAna(), larg4::LArG4::LArG4(), larg4::larg4Main::larg4Main(), evgen::larg4SingleGen::larg4SingleGen(), evgen::LightSource::LightSource(), evgen::MUSUN::MUSUN(), evgen::NDKGen::NDKGen(), evgen::NeutronOsc::NeutronOsc(), nnet::NoiseWaveformDump::NoiseWaveformDump(), evgen::NucleonDecay::NucleonDecay(), opdet::OpMCDigi::OpMCDigi(), opdet::OptDetDigitizer::OptDetDigitizer(), phot::PDFastSimANN::PDFastSimANN(), phot::PDFastSimPAR::PDFastSimPAR(), phot::PDFastSimPVS::PDFastSimPVS(), evgen::PhotonGen::PhotonGen(), phot::PhotonLibraryPropagation::PhotonLibraryPropagation(), evgen::RadioGen::RadioGen(), nnet::RawWaveformClnSigDump::RawWaveformClnSigDump(), nnet::RawWaveformDump::RawWaveformDump(), art::ReplicatedAnalyzer::ReplicatedAnalyzer(), art::ReplicatedFilter::ReplicatedFilter(), art::ReplicatedProducer::ReplicatedProducer(), detsim::SimDriftElectrons::SimDriftElectrons(), detsim::SimWire::SimWire(), evgen::SingleGen::SingleGen(), evgen::SNNueAr40CCGen::SNNueAr40CCGen(), and trkf::Track3DKalman::Track3DKalman().

21 {
22  return createEngine(seed, rng()->defaultEngineKind());
23 }
base_engine_t & createEngine(seed_t seed)
long seed
Definition: chem4.cc:67
static ServiceHandle< RandomNumberGenerator > & rng()
EngineCreator::base_engine_t & EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make 
)

Definition at line 26 of file EngineCreator.cc.

References moduleLabel_, requireValid(), rng(), and sid_.

28 {
29  requireValid();
30  return rng()->createEngine(sid_, moduleLabel_, seed, kind_of_engine_to_make);
31 }
long seed
Definition: chem4.cc:67
std::string const moduleLabel_
Definition: EngineCreator.h:53
static ServiceHandle< RandomNumberGenerator > & rng()
EngineCreator::base_engine_t & EngineCreator::createEngine ( seed_t  seed,
std::string const &  kind_of_engine_to_make,
label_t const &  engine_label 
)

Definition at line 34 of file EngineCreator.cc.

References moduleLabel_, requireValid(), rng(), and sid_.

37 {
38  requireValid();
39  return rng()->createEngine(
40  sid_, moduleLabel_, seed, kind_of_engine_to_make, engine_label);
41 }
long seed
Definition: chem4.cc:67
std::string const moduleLabel_
Definition: EngineCreator.h:53
static ServiceHandle< RandomNumberGenerator > & rng()
void EngineCreator::requireValid ( )
private

Definition at line 51 of file EngineCreator.cc.

References art::ScheduleID::isValid(), art::errors::LogicError, moduleLabel_, and sid_.

Referenced by createEngine().

52 {
53  if (sid_.isValid() && !moduleLabel_.empty()) {
54  return;
55  }
56  throw Exception{
58  "An error occurred while creating a random-number engine.\n\n"}
59  << "No module label or schedule ID available to create engine.\n"
60  << "Please ensure that your module calls the correct base-class\n"
61  "constructor. The module class and module label can be determined\n"
62  "by looking for the '<module class>:<module label>@Construction' "
63  "string\n"
64  "in the message context a few lines above. For example, if your\n"
65  "module is a filter with class name 'MyFilter' please make the\n"
66  "following change to your constructor:\n\n"
67  << " Wrong: MyFilter(ParameterSet const& ps) :\n"
68  << " dataMembers_, ...\n"
69  << " {}\n\n"
70  << " Right: MyFilter(ParameterSet const& ps) :\n"
71  << " " << cet::bold_fontify("art::EDFilter{ps},")
72  << " dataMembers_, ...\n"
73  << " {}\n\n"
74  << "If your module is a producer, 'art::EDFilter{ps}' above should be\n"
75  "replaced with 'art::EDProducer{ps}.\n";
76 }
constexpr bool isValid() const noexcept
Definition: ScheduleID.h:71
std::string const moduleLabel_
Definition: EngineCreator.h:53
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
art::ServiceHandle< art::RandomNumberGenerator > & EngineCreator::rng ( void  )
staticprivate

Definition at line 44 of file EngineCreator.cc.

Referenced by createEngine(), and evgen::PhotonGen::produce().

45 {
47  return rng;
48 }
static ServiceHandle< RandomNumberGenerator > & rng()

Member Data Documentation

std::string const art::detail::EngineCreator::moduleLabel_ {}
private

Definition at line 53 of file EngineCreator.h.

Referenced by createEngine(), and requireValid().

ScheduleID const art::detail::EngineCreator::sid_ {}
private

Definition at line 54 of file EngineCreator.h.

Referenced by createEngine(), EngineCreator(), and requireValid().


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