LArSoft
v09_90_00
Liquid Argon Software toolkit - https://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 |
template<typename UserConfig , typename KeysToIgnore = void> | |
using | Table = Modifier::Table< UserConfig, KeysToIgnore > |
Public Member Functions | |
SingleGen (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 ¤t_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 |
module to produce single or multiple specified particles in the detector
Definition at line 61 of file SingleGen_module.cc.
|
inherited |
Definition at line 17 of file EDProducer.h.
Definition at line 187 of file SingleGen_module.cc.
|
inherited |
Definition at line 26 of file Producer.h.
|
explicit |
Definition at line 423 of file SingleGen_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().
|
overrideprivatevirtual |
Act on begin of run: write "RunData" information (sumdata::RunData
).
Reimplemented from art::EDProducer.
Definition at line 461 of file SingleGen_module.cc.
References geo::GeometryCore::DetectorName(), art::fullRun(), and art::Run::put().
|
protectedinherited |
Definition at line 61 of file ModuleBase.h.
References art::ModuleBase::collector_, and art::ConsumesCollector::consumes().
|
protectedinherited |
|
protectedinherited |
Definition at line 75 of file ModuleBase.h.
References art::ModuleBase::collector_, and art::ConsumesCollector::consumesMany().
|
protectedinherited |
|
inherited |
Definition at line 68 of file ModuleBase.h.
References art::ModuleBase::collector_, and art::ConsumesCollector::consumesView().
|
inherited |
Definition at line 22 of file Producer.cc.
References art::detail::Producer::beginJobWithFrame(), and art::detail::Producer::setupQueues().
|
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().
|
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().
|
inherited |
Definition at line 30 of file Producer.cc.
References art::detail::Producer::endJobWithFrame().
|
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().
|
inherited |
Definition at line 95 of file Producer.cc.
References art::detail::Producer::endSubRunWithFrame(), art::SubRunPrincipal::makeSubRun(), art::ModuleContext::scheduleID(), and art::Principal::seenRanges().
|
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().
|
inherited |
Definition at line 44 of file Producer.cc.
References art::detail::Producer::respondToCloseInputFileWithFrame().
|
inherited |
Definition at line 58 of file Producer.cc.
References art::detail::Producer::respondToCloseOutputFilesWithFrame().
|
inherited |
Definition at line 37 of file Producer.cc.
References art::detail::Producer::respondToOpenInputFileWithFrame().
|
inherited |
Definition at line 51 of file Producer.cc.
References art::detail::Producer::respondToOpenOutputFilesWithFrame().
|
inherited |
Definition at line 10 of file Modifier.cc.
References art::ProductRegistryHelper::fillDescriptions(), and art::ModuleBase::moduleDescription().
|
inherited |
Definition at line 43 of file ModuleBase.cc.
References art::ModuleBase::collector_, and art::ConsumesCollector::getConsumables().
|
staticprivate |
Returns a vector with the name of distribution keywords.
Definition at line 346 of file SingleGen_module.cc.
References DistributionNames, kGAUS, kHIST, kUNIF, makeParticleSelectionModeNames(), and ParticleSelectionModeNames.
|
staticprivate |
Returns a vector with the name of particle selection mode keywords.
Definition at line 338 of file SingleGen_module.cc.
References kSelectAllParts, and kSelectOneRandPart.
Referenced by makeDistributionNames().
|
inherited |
Definition at line 37 of file ModuleBase.cc.
References art::ModuleBase::doMakeWorker(), and art::NumBranchTypes.
|
protectedinherited |
Definition at line 82 of file ModuleBase.h.
References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsume().
|
protectedinherited |
Definition at line 96 of file ModuleBase.h.
References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeMany().
|
protectedinherited |
|
inherited |
Definition at line 89 of file ModuleBase.h.
References art::ModuleBase::collector_, and art::ConsumesCollector::mayConsumeView().
|
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().
|
staticprivate |
Returns the name of the specified option key, or defName
if not known.
Definition at line 407 of file SingleGen_module.cc.
Referenced by presentOptions(), and setup().
|
private |
Definition at line 657 of file SingleGen_module.cc.
References fPadOutVectors, and fPDG.
Referenced by setup().
|
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 387 of file SingleGen_module.cc.
References n, and util::to_string().
Referenced by presentOptions().
|
inlinestaticprivate |
Definition at line 322 of file SingleGen_module.cc.
References optionName(), and presentOptions().
|
private |
Definition at line 964 of file SingleGen_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().
|
overridevirtual |
unique_ptr allows ownership to be transferred to the art::Event after the put statement
Implements art::EDProducer.
Definition at line 685 of file SingleGen_module.cc.
References simb::kSingleParticle, MF_LOG_DEBUG, art::Event::put(), Sample(), and simb::MCTruth::SetOrigin().
|
inherited |
Definition at line 16 of file Modifier.cc.
References art::ModuleBase::moduleDescription(), and art::ProductRegistryHelper::registerProducts().
|
private |
Definition at line 933 of file SingleGen_module.cc.
References fEngine, fMode, fPDG, fSingleVertex, SampleMany(), and SampleOne().
Referenced by produce().
|
private |
Definition at line 821 of file SingleGen_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().
|
private |
Definition at line 707 of file SingleGen_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().
|
private |
Definition at line 1012 of file SingleGen_module.cc.
References fEngine.
Referenced by SampleMany(), and SampleOne().
|
private |
Definition at line 1025 of file SingleGen_module.cc.
References DEFINE_ART_MODULE, and fEngine.
|
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 361 of file SingleGen_module.cc.
References util::end().
Referenced by evgen::SingleGen::Config::fromHistogram(), and SingleGen().
|
inherited |
|
private |
Performs checks and initialization based on the current configuration.
Definition at line 468 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::to_string().
Referenced by SingleGen().
|
inherited |
Definition at line 49 of file ModuleBase.cc.
References art::ModuleBase::collector_, and art::ConsumesCollector::sortConsumables().
|
staticprivate |
Names of all distribution modes.
Definition at line 198 of file SingleGen_module.cc.
Referenced by evgen::SingleGen::Config::fromHistogram(), makeDistributionNames(), setup(), and SingleGen().
|
private |
How to distribute angles (gaus, uniform)
Definition at line 250 of file SingleGen_module.cc.
Referenced by SampleMany(), SampleOne(), setup(), and SingleGen().
|
private |
actual TH2 for angle distributions - Xz on x axis .
art-managed random-number engine
Definition at line 262 of file SingleGen_module.cc.
Referenced by Sample(), SampleMany(), SampleOne(), SelectFromHist(), and SingleGen().
|
private |
Filename containing histogram of momenta.
Definition at line 251 of file SingleGen_module.cc.
Referenced by setup(), and SingleGen().
|
private |
Particle Selection Mode 0–generate a list of all particles, 1–generate a single particle selected randomly from the list
Definition at line 224 of file SingleGen_module.cc.
Referenced by Sample(), and SingleGen().
|
private |
Central momentum (GeV/c) to generate.
Definition at line 232 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), setup(), and SingleGen().
|
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 227 of file SingleGen_module.cc.
Referenced by PadVector(), setup(), and SingleGen().
|
private |
PDG code of particles to generate.
Definition at line 231 of file SingleGen_module.cc.
Referenced by PadVector(), printVecs(), Sample(), SampleMany(), SampleOne(), setup(), and SingleGen().
|
private |
How to distribute momenta (gaus or uniform)
Definition at line 234 of file SingleGen_module.cc.
Referenced by SampleMany(), SampleOne(), setup(), and SingleGen().
|
private |
name of histogram of momenta
Definition at line 252 of file SingleGen_module.cc.
Referenced by setup(), and SingleGen().
|
private |
How to distribute xyz (gaus, or uniform)
Definition at line 243 of file SingleGen_module.cc.
Referenced by SampleMany(), SampleOne(), setup(), and SingleGen().
|
private |
Variation in momenta (GeV/c)
Definition at line 233 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), setup(), and SingleGen().
|
private |
Variation in t position (s)
Definition at line 242 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), setup(), and SingleGen().
|
private |
Variation in angle in XZ plane.
Definition at line 248 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), setup(), and SingleGen().
|
private |
Variation in angle in YZ plane.
Definition at line 249 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), setup(), and SingleGen().
|
private |
Variation in x position (cm)
Definition at line 239 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), setup(), and SingleGen().
|
private |
Variation in y position (cm)
Definition at line 240 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), setup(), and SingleGen().
|
private |
Variation in z position (cm)
Definition at line 241 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), setup(), and SingleGen().
|
private |
if true - all particles produced at the same location
Definition at line 245 of file SingleGen_module.cc.
Referenced by Sample(), and SingleGen().
|
private |
Central t position (s) in world coordinates.
Definition at line 238 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), setup(), and SingleGen().
|
private |
How to distribute t (gaus, or uniform)
Definition at line 244 of file SingleGen_module.cc.
Referenced by SampleMany(), SampleOne(), setup(), and SingleGen().
|
private |
Angle in XZ plane (degrees)
Definition at line 246 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), setup(), and SingleGen().
|
private |
Angle in YZ plane (degrees)
Definition at line 247 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), setup(), and SingleGen().
|
private |
name of histogram for thetaxz/thetayz distribution
Definition at line 253 of file SingleGen_module.cc.
Referenced by setup(), and SingleGen().
|
private |
Central x position (cm) in world coordinates.
Definition at line 235 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), setup(), and SingleGen().
|
private |
Central y position (cm) in world coordinates.
Definition at line 236 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), setup(), and SingleGen().
|
private |
Central z position (cm) in world coordinates.
Definition at line 237 of file SingleGen_module.cc.
Referenced by printVecs(), SampleMany(), SampleOne(), setup(), and SingleGen().
|
private |
Definition at line 255 of file SingleGen_module.cc.
Referenced by SampleMany(), SampleOne(), and setup().
|
private |
actual TH1 for momentum distributions
Definition at line 257 of file SingleGen_module.cc.
Referenced by SampleMany(), SampleOne(), and setup().
|
staticprivate |
Gaussian distribution.
Definition at line 220 of file SingleGen_module.cc.
Referenced by makeDistributionNames(), SampleMany(), SampleOne(), and setup().
|
staticprivate |
Distribution from histograms.
Definition at line 221 of file SingleGen_module.cc.
Referenced by evgen::SingleGen::Config::fromHistogram(), makeDistributionNames(), SampleMany(), SampleOne(), and setup().
|
staticprivate |
One particle per entry is generated.
Definition at line 211 of file SingleGen_module.cc.
Referenced by makeParticleSelectionModeNames().
|
staticprivate |
One particle is generated, extracted from the provided options.
Definition at line 212 of file SingleGen_module.cc.
Referenced by makeParticleSelectionModeNames().
|
staticprivate |
Uniform distribution.
Definition at line 219 of file SingleGen_module.cc.
Referenced by makeDistributionNames(), and setup().
|
staticprivate |
Names of all particle selection modes.
Definition at line 196 of file SingleGen_module.cc.
Referenced by makeDistributionNames(), and SingleGen().