module to produce single or multiple specified particles in the detector More...
Classes | |
struct | Config |
Public Types | |
using | Parameters = art::EDProducer::Table< Config > |
Public Types inherited from art::EDProducer | |
using | ModuleType = EDProducer |
using | WorkerType = WorkerT< EDProducer > |
Public Types inherited from art::detail::Producer | |
template<typename UserConfig , typename KeysToIgnore = void> | |
using | Table = Modifier::Table< UserConfig, KeysToIgnore > |
Public Types inherited from art::Modifier | |
template<typename UserConfig , typename UserKeysToIgnore = void> | |
using | Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore > |
Public Member Functions | |
SingleGen (Parameters const &config) | |
void | produce (art::Event &evt) override |
Public Member Functions inherited from art::EDProducer | |
EDProducer (fhicl::ParameterSet const &pset) | |
template<typename Config > | |
EDProducer (Table< Config > const &config) | |
std::string | workerType () const |
Public Member Functions inherited from art::detail::Producer | |
virtual | ~Producer () noexcept |
Producer (fhicl::ParameterSet const &) | |
Producer (Producer const &)=delete | |
Producer (Producer &&)=delete | |
Producer & | operator= (Producer const &)=delete |
Producer & | operator= (Producer &&)=delete |
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) |
Public Member Functions inherited from art::Modifier | |
~Modifier () noexcept | |
Modifier () | |
Modifier (Modifier const &)=delete | |
Modifier (Modifier &&)=delete | |
Modifier & | operator= (Modifier const &)=delete |
Modifier & | operator= (Modifier &&)=delete |
Public Member Functions inherited from art::ModuleBase | |
virtual | ~ModuleBase () noexcept |
ModuleBase () | |
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) |
template<typename T , BranchType BT> | |
ViewToken< T > | consumesView (InputTag const &tag) |
template<typename T , BranchType BT> | |
ViewToken< T > | mayConsumeView (InputTag const &tag) |
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 = 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 |
Additional Inherited Members | |
Static Public Member Functions inherited from art::EDProducer | |
static void | commitEvent (EventPrincipal &ep, Event &e) |
Protected Member Functions inherited from art::ModuleBase | |
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 () |
module to produce single or multiple specified particles in the detector
Definition at line 61 of file SingleGen_module.cc.
Definition at line 223 of file SingleGen_module.cc.
|
explicit |
Definition at line 467 of file SingleGen_module.cc.
|
overrideprivatevirtual |
Act on begin of run: write "RunData" information (sumdata::RunData
).
Reimplemented from art::EDProducer.
Definition at line 509 of file SingleGen_module.cc.
|
staticprivate |
Returns a vector with the name of distribution keywords.
Definition at line 387 of file SingleGen_module.cc.
|
staticprivate |
Returns a vector with the name of particle selection mode keywords.
Definition at line 380 of file SingleGen_module.cc.
|
staticprivate |
Returns the name of the specified option key, or defName
if not known.
Definition at line 451 of file SingleGen_module.cc.
|
private |
Definition at line 693 of file SingleGen_module.cc.
|
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 430 of file SingleGen_module.cc.
|
inlinestaticprivate |
Definition at line 363 of file SingleGen_module.cc.
|
private |
Definition at line 998 of file SingleGen_module.cc.
|
overridevirtual |
unique_ptr allows ownership to be transferred to the art::Event after the put statement
Implements art::EDProducer.
Definition at line 720 of file SingleGen_module.cc.
|
private |
Definition at line 964 of file SingleGen_module.cc.
|
private |
Definition at line 853 of file SingleGen_module.cc.
|
private |
Definition at line 742 of file SingleGen_module.cc.
|
private |
Definition at line 1047 of file SingleGen_module.cc.
|
private |
Definition at line 1062 of file SingleGen_module.cc.
|
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 403 of file SingleGen_module.cc.
|
private |
Performs checks and initialization based on the current configuration.
Definition at line 518 of file SingleGen_module.cc.
|
staticprivate |
Names of all distribution modes.
Definition at line 236 of file SingleGen_module.cc.
|
private |
How to distribute angles (gaus, uniform)
Definition at line 288 of file SingleGen_module.cc.
|
private |
actual TH2 for angle distributions - Xz on x axis .
art-managed random-number engine
Definition at line 299 of file SingleGen_module.cc.
|
private |
Filename containing histogram of momenta.
Definition at line 289 of file SingleGen_module.cc.
|
private |
Particle Selection Mode 0–generate a list of all particles, 1–generate a single particle selected randomly from the list
Definition at line 262 of file SingleGen_module.cc.
|
private |
Central momentum (GeV/c) to generate.
Definition at line 270 of file SingleGen_module.cc.
|
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 265 of file SingleGen_module.cc.
|
private |
PDG code of particles to generate.
Definition at line 269 of file SingleGen_module.cc.
|
private |
How to distribute momenta (gaus or uniform)
Definition at line 272 of file SingleGen_module.cc.
|
private |
name of histogram of momenta
Definition at line 290 of file SingleGen_module.cc.
|
private |
How to distribute xyz (gaus, or uniform)
Definition at line 281 of file SingleGen_module.cc.
|
private |
Variation in momenta (GeV/c)
Definition at line 271 of file SingleGen_module.cc.
|
private |
Variation in t position (s)
Definition at line 280 of file SingleGen_module.cc.
|
private |
Variation in angle in XZ plane.
Definition at line 286 of file SingleGen_module.cc.
|
private |
Variation in angle in YZ plane.
Definition at line 287 of file SingleGen_module.cc.
|
private |
Variation in x position (cm)
Definition at line 277 of file SingleGen_module.cc.
|
private |
Variation in y position (cm)
Definition at line 278 of file SingleGen_module.cc.
|
private |
Variation in z position (cm)
Definition at line 279 of file SingleGen_module.cc.
|
private |
if true - all particles produced at the same location
Definition at line 283 of file SingleGen_module.cc.
|
private |
Central t position (s) in world coordinates.
Definition at line 276 of file SingleGen_module.cc.
|
private |
How to distribute t (gaus, or uniform)
Definition at line 282 of file SingleGen_module.cc.
|
private |
Angle in XZ plane (degrees)
Definition at line 284 of file SingleGen_module.cc.
|
private |
Angle in YZ plane (degrees)
Definition at line 285 of file SingleGen_module.cc.
|
private |
name of histogram for thetaxz/thetayz distribution
Definition at line 291 of file SingleGen_module.cc.
|
private |
Central x position (cm) in world coordinates.
Definition at line 273 of file SingleGen_module.cc.
|
private |
Central y position (cm) in world coordinates.
Definition at line 274 of file SingleGen_module.cc.
|
private |
Central z position (cm) in world coordinates.
Definition at line 275 of file SingleGen_module.cc.
|
private |
Definition at line 293 of file SingleGen_module.cc.
|
private |
actual TH1 for momentum distributions
Definition at line 294 of file SingleGen_module.cc.
|
staticprivate |
Gaussian distribution.
Definition at line 258 of file SingleGen_module.cc.
|
staticprivate |
Distribution from histograms.
Definition at line 259 of file SingleGen_module.cc.
|
staticprivate |
One particle per entry is generated.
Definition at line 250 of file SingleGen_module.cc.
|
staticprivate |
One particle is generated, extracted from the provided options.
Definition at line 251 of file SingleGen_module.cc.
|
staticprivate |
Uniform distribution.
Definition at line 257 of file SingleGen_module.cc.
|
staticprivate |
Names of all particle selection modes.
Definition at line 234 of file SingleGen_module.cc.