LArSoft
v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
|
module to produce single or multiple specified particles in the detector More...
Classes | |
struct | Config |
Public Types | |
using | Parameters = art::EDProducer::Table< Config > |
using | ModuleType = EDProducer |
using | WorkerType = WorkerT< EDProducer > |
template<typename UserConfig , typename KeysToIgnore = void> | |
using | Table = ProducerBase::Table< UserConfig, KeysToIgnore > |
Public Member Functions | |
SingleGen (Parameters const &config) | |
void | produce (art::Event &evt) |
void | beginRun (art::Run &run) |
template<typename PROD , BranchType B = InEvent> | |
ProductID | getProductID (std::string const &instanceName={}) const |
template<typename PROD , BranchType B> | |
ProductID | getProductID (ModuleDescription const &moduleDescription, std::string const &instanceName) const |
bool | modifiesEvent () const |
template<typename T , BranchType = InEvent> | |
ProductToken< T > | consumes (InputTag const &) |
template<typename T , art::BranchType BT> | |
art::ProductToken< T > | consumes (InputTag const &it) |
template<typename T , BranchType = InEvent> | |
void | consumesMany () |
template<typename Element , BranchType = InEvent> | |
ViewToken< Element > | consumesView (InputTag const &) |
template<typename T , art::BranchType BT> | |
art::ViewToken< T > | consumesView (InputTag const &it) |
template<typename T , BranchType = InEvent> | |
ProductToken< T > | mayConsume (InputTag const &) |
template<typename T , art::BranchType BT> | |
art::ProductToken< T > | mayConsume (InputTag const &it) |
template<typename T , BranchType = InEvent> | |
void | mayConsumeMany () |
template<typename Element , BranchType = InEvent> | |
ViewToken< Element > | mayConsumeView (InputTag const &) |
template<typename T , art::BranchType BT> | |
art::ViewToken< T > | mayConsumeView (InputTag const &it) |
base_engine_t & | createEngine (seed_t seed) |
base_engine_t & | createEngine (seed_t seed, std::string const &kind_of_engine_to_make) |
base_engine_t & | createEngine (seed_t seed, std::string const &kind_of_engine_to_make, label_t const &engine_label) |
seed_t | get_seed_value (fhicl::ParameterSet const &pset, char const key[]="seed", seed_t const implicit_seed=-1) |
Static Public Member Functions | |
static cet::exempt_ptr< Consumer > | non_module_context () |
Protected Member Functions | |
CurrentProcessingContext const * | currentContext () const |
void | validateConsumedProduct (BranchType const bt, ProductInfo const &pi) |
void | prepareForJob (fhicl::ParameterSet const &pset) |
void | showMissingConsumes () const |
Private Member Functions | |
void | 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 | setup () |
Performs checks and initialization based on the current configuration. More... | |
Static Private Member Functions | |
static std::map< int, std::string > | makeParticleSelectionModeNames () |
actual TH2 for angle distributions - Xz on x axis . 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... | |
Static Private Attributes | |
static const std::map< int, std::string > | ParticleSelectionModeNames = SingleGen::makeParticleSelectionModeNames() |
Names of all particle selection modes. More... | |
static const std::map< int, std::string > | DistributionNames = SingleGen::makeDistributionNames() |
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 = 1 |
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 |
module to produce single or multiple specified particles in the detector
Definition at line 72 of file SingleGen_module.cc.
|
inherited |
Definition at line 34 of file EDProducer.h.
Definition at line 234 of file SingleGen_module.cc.
|
inherited |
Definition at line 43 of file EDProducer.h.
|
inherited |
Definition at line 35 of file EDProducer.h.
|
explicit |
Definition at line 475 of file SingleGen_module.cc.
References art::EngineCreator::createEngine(), seed, and setup().
|
virtual |
Reimplemented from art::EDProducer.
Definition at line 722 of file SingleGen_module.cc.
References geo::GeometryCore::DetectorName(), and art::Run::put().
|
inherited |
|
inherited |
Definition at line 147 of file Consumer.h.
References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().
|
inherited |
Definition at line 162 of file Consumer.h.
|
inherited |
|
inherited |
Definition at line 172 of file Consumer.h.
References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().
|
inherited |
Definition at line 26 of file EngineCreator.cc.
References art::EngineCreator::rng().
Referenced by evgen::CosmicsGen::CosmicsGen(), rndm::NuRandomService::createEngine(), cluster::fuzzyCluster::fuzzyCluster(), cluster::HoughLineFinder::HoughLineFinder(), art::MixFilter< T >::initEngine_(), larg4::LArG4::LArG4(), evgen::LightSource::LightSource(), evgen::NeutronOsc::NeutronOsc(), evgen::NucleonDecay::NucleonDecay(), opdet::OpMCDigi::OpMCDigi(), opdet::OptDetDigitizer::OptDetDigitizer(), phot::PhotonLibraryPropagation::PhotonLibraryPropagation(), detsim::SimDriftElectrons::SimDriftElectrons(), SingleGen(), evgen::SNNueAr40CCGen::SNNueAr40CCGen(), ToyOneShowerGen::ToyOneShowerGen(), and trkf::Track3DKalman::Track3DKalman().
|
inherited |
Definition at line 32 of file EngineCreator.cc.
References art::EngineCreator::rng().
|
inherited |
Definition at line 40 of file EngineCreator.cc.
References art::EngineCreator::rng().
|
protectedinherited |
|
inherited |
Definition at line 49 of file EngineCreator.cc.
References fhicl::ParameterSet::get().
Referenced by art::MixFilter< T >::initEngine_().
|
inlineinherited |
|
inherited |
Definition at line 56 of file ProducerBase.h.
References B, and art::ModuleDescription::moduleLabel().
Referenced by art::ProducerBase::modifiesEvent().
|
staticprivate |
Returns a vector with the name of distribution keywords.
Definition at line 395 of file SingleGen_module.cc.
|
staticprivate |
actual TH2 for angle distributions - Xz on x axis .
Returns a vector with the name of particle selection mode keywords.
Definition at line 388 of file SingleGen_module.cc.
|
inherited |
|
inherited |
Definition at line 190 of file Consumer.h.
References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().
|
inherited |
Definition at line 205 of file Consumer.h.
|
inherited |
|
inherited |
Definition at line 215 of file Consumer.h.
References art::InputTag::instance(), art::InputTag::label(), and art::InputTag::process().
|
inlineinherited |
Definition at line 40 of file ProducerBase.h.
References art::ProducerBase::getProductID().
|
staticinherited |
Definition at line 76 of file Consumer.cc.
Referenced by art::RootOutput::beginSubRun(), art::OutputModule::doBeginRun(), art::OutputModule::doBeginSubRun(), art::OutputModule::doEndRun(), art::OutputModule::doEndSubRun(), art::ProducingService::doPostReadEvent(), art::ProducingService::doPostReadRun(), art::ProducingService::doPostReadSubRun(), art::OutputModule::doWriteEvent(), art::ProcessPackage< L >::postScheduleSignal(), art::BeginEndPackage< Level::Run >::Begin::postScheduleSignal(), art::BeginEndPackage< Level::Run >::End::postScheduleSignal(), art::BeginEndPackage< Level::SubRun >::Begin::postScheduleSignal(), art::BeginEndPackage< Level::SubRun >::End::postScheduleSignal(), art::ProcessPackage< L >::preScheduleSignal(), art::BeginEndPackage< Level::Run >::Begin::preScheduleSignal(), art::BeginEndPackage< Level::SubRun >::Begin::preScheduleSignal(), art::EventProcessor::readEvent(), art::EventProcessor::readRun(), art::EmptyEvent::readRun_(), art::EventProcessor::readSubRun(), and art::EmptyEvent::readSubRun_().
|
staticprivate |
Returns the name of the specified option key, or defName
if not known.
Definition at line 459 of file SingleGen_module.cc.
Referenced by setup().
|
private |
Definition at line 695 of file SingleGen_module.cc.
References fPadOutVectors, and fPDG.
Referenced by setup().
|
protectedinherited |
Definition at line 89 of file Consumer.cc.
References fhicl::ParameterSet::get_if_present().
Referenced by art::EDProducer::doBeginJob(), art::EDFilter::doBeginJob(), and art::EDAnalyzer::doBeginJob().
|
staticprivate |
Returns a string describing all options in the list.
OptionList | type of list of options (e.g. std::map<int, std::string> ) |
allowedOptions | the list of allowed options |
printKey | whether to print the key of the option beside its name |
excludeKeys | list of keys to be ignored (none by default) |
The result string is a list of option names, separated by commas, like in `"'apple', 'orange', 'banana'". If
printKeyis
true`, the key of each option is also written in parentheses, like in `"'apple' (1), 'orange' (7), 'banana' (2)"`.
Definition at line 438 of file SingleGen_module.cc.
References n, and util::flags::to_string().
|
inlinestaticprivate |
Definition at line 371 of file SingleGen_module.cc.
|
private |
Definition at line 1021 of file SingleGen_module.cc.
References e, fP0, fPDG, fSigmaP, fSigmaT, fSigmaThetaXZ, fSigmaThetaYZ, fSigmaX, fSigmaY, fSigmaZ, fT0, fTheta0XZ, fTheta0YZ, fX0, fY0, and fZ0.
Referenced by setup().
|
virtual |
unique_ptr allows ownership to be transferred to the art::Event after the put statement
Implements art::EDProducer.
Definition at line 735 of file SingleGen_module.cc.
References simb::kSingleParticle, LOG_DEBUG, art::Event::put(), Sample(), and simb::MCTruth::SetOrigin().
|
private |
Definition at line 985 of file SingleGen_module.cc.
References fMode, fPDG, fSingleVertex, art::RandomNumberGenerator::getEngine(), art::EngineCreator::rng(), SampleMany(), and SampleOne().
Referenced by produce().
|
private |
Definition at line 871 of file SingleGen_module.cc.
References simb::MCTruth::Add(), simb::MCParticle::AddTrajectoryPoint(), fAngleDist, fP0, fPDG, fPDist, fPosDist, fSigmaP, fSigmaT, fSigmaThetaXZ, fSigmaThetaYZ, fSigmaX, fSigmaY, fSigmaZ, fT0, fTDist, fTheta0XZ, fTheta0YZ, fX0, fY0, fZ0, art::RandomNumberGenerator::getEngine(), hPHist, hThetaXzYzHist, kGAUS, kHIST, part, art::EngineCreator::rng(), SelectFromHist(), and x.
Referenced by Sample().
|
private |
Definition at line 757 of file SingleGen_module.cc.
References simb::MCTruth::Add(), simb::MCParticle::AddTrajectoryPoint(), fAngleDist, fP0, fPDG, fPDist, fPosDist, fSigmaP, fSigmaT, fSigmaThetaXZ, fSigmaThetaYZ, fSigmaX, fSigmaY, fSigmaZ, fT0, fTDist, fTheta0XZ, fTheta0YZ, fX0, fY0, fZ0, art::RandomNumberGenerator::getEngine(), hPHist, hThetaXzYzHist, kGAUS, kHIST, part, art::EngineCreator::rng(), SelectFromHist(), and x.
Referenced by Sample().
|
private |
Definition at line 1070 of file SingleGen_module.cc.
References art::RandomNumberGenerator::getEngine(), and art::EngineCreator::rng().
Referenced by SampleMany(), and SampleOne().
|
private |
Definition at line 1087 of file SingleGen_module.cc.
References DEFINE_ART_MODULE, art::RandomNumberGenerator::getEngine(), and art::EngineCreator::rng().
|
staticprivate |
Parses an option string and returns the corresponding option number.
OptionList | type of list of options (e.g. std::map<int, std::string> ) |
Option | the string of the option to be parsed |
allowedOptions | list of valid options, as key/name pairs |
Option
string from allowedOptions
std::runtime_error | if 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 411 of file SingleGen_module.cc.
References evd::details::end(), and s.
|
private |
Performs checks and initialization based on the current configuration.
Definition at line 520 of file SingleGen_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::flags::to_string().
Referenced by SingleGen().
|
protectedinherited |
Definition at line 125 of file Consumer.cc.
Referenced by art::EDProducer::doEndJob(), art::EDFilter::doEndJob(), art::EDAnalyzer::doEndJob(), and art::RootOutput::endJob().
|
protectedinherited |
Definition at line 101 of file Consumer.cc.
References art::errors::ProductRegistrationFailure.
|
staticprivate |
Names of all distribution modes.
Definition at line 248 of file SingleGen_module.cc.
Referenced by setup().
|
private |
How to distribute angles (gaus, uniform)
Definition at line 300 of file SingleGen_module.cc.
Referenced by SampleMany(), SampleOne(), and setup().
|
private |
Filename containing histogram of momenta.
Definition at line 301 of file SingleGen_module.cc.
Referenced by setup().
|
private |
Particle Selection Mode 0–generate a list of all particles, 1–generate a single particle selected randomly from the list
Definition at line 274 of file SingleGen_module.cc.
Referenced by Sample().
|
private |
Central momentum (GeV/c) to generate.
Definition at line 282 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), and setup().
|
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 277 of file SingleGen_module.cc.
Referenced by PadVector(), and setup().
|
private |
PDG code of particles to generate.
Definition at line 281 of file SingleGen_module.cc.
Referenced by PadVector(), printVecs(), Sample(), SampleMany(), SampleOne(), and setup().
|
private |
How to distribute momenta (gaus or uniform)
Definition at line 284 of file SingleGen_module.cc.
Referenced by SampleMany(), SampleOne(), and setup().
|
private |
name of histogram of momenta
Definition at line 302 of file SingleGen_module.cc.
Referenced by setup().
|
private |
How to distribute xyz (gaus, or uniform)
Definition at line 293 of file SingleGen_module.cc.
Referenced by SampleMany(), SampleOne(), and setup().
|
private |
Variation in momenta (GeV/c)
Definition at line 283 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), and setup().
|
private |
Variation in t position (s)
Definition at line 292 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), and setup().
|
private |
Variation in angle in XZ plane.
Definition at line 298 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), and setup().
|
private |
Variation in angle in YZ plane.
Definition at line 299 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), and setup().
|
private |
Variation in x position (cm)
Definition at line 289 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), and setup().
|
private |
Variation in y position (cm)
Definition at line 290 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), and setup().
|
private |
Variation in z position (cm)
Definition at line 291 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), and setup().
|
private |
if true - all particles produced at the same location
Definition at line 295 of file SingleGen_module.cc.
Referenced by Sample().
|
private |
Central t position (s) in world coordinates.
Definition at line 288 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), and setup().
|
private |
How to distribute t (gaus, or uniform)
Definition at line 294 of file SingleGen_module.cc.
Referenced by SampleMany(), SampleOne(), and setup().
|
private |
Angle in XZ plane (degrees)
Definition at line 296 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), and setup().
|
private |
Angle in YZ plane (degrees)
Definition at line 297 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), and setup().
|
private |
name of histogram for thetaxz/thetayz distribution
Definition at line 304 of file SingleGen_module.cc.
Referenced by setup().
|
private |
Central x position (cm) in world coordinates.
Definition at line 285 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), and setup().
|
private |
Central y position (cm) in world coordinates.
Definition at line 286 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), and setup().
|
private |
Central z position (cm) in world coordinates.
Definition at line 287 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), and setup().
|
private |
Definition at line 306 of file SingleGen_module.cc.
Referenced by SampleMany(), SampleOne(), and setup().
|
private |
actual TH1 for momentum distributions
Definition at line 308 of file SingleGen_module.cc.
Referenced by SampleMany(), SampleOne(), and setup().
|
staticprivate |
Gaussian distribution.
Definition at line 270 of file SingleGen_module.cc.
Referenced by SampleMany(), SampleOne(), and setup().
|
staticprivate |
Distribution from histograms.
Definition at line 271 of file SingleGen_module.cc.
Referenced by SampleMany(), SampleOne(), and setup().
|
staticprivate |
One particle per entry is generated.
Definition at line 262 of file SingleGen_module.cc.
|
staticprivate |
One particle is generated, extracted from the provided options.
Definition at line 263 of file SingleGen_module.cc.
|
staticprivate |
|
staticprivate |
Names of all particle selection modes.
Definition at line 246 of file SingleGen_module.cc.