module to produce single or multiple specified particles in the detector More...
Classes | |
struct | Config |
Public Types | |
using | Parameters = art::EDProducer::Table< Config > |
Public Member Functions | |
SingleGen (Parameters const &config) | |
void | produce (art::Event &evt) override |
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 |
module to produce single or multiple specified particles in the detector
Definition at line 63 of file SingleGen_module.cc.
using evgen::SingleGen::Parameters = art::EDProducer::Table<Config> |
Definition at line 225 of file SingleGen_module.cc.
|
explicit |
Definition at line 469 of file SingleGen_module.cc.
|
overrideprivate |
Act on begin of run: write "RunData" information (sumdata::RunData
).
Definition at line 511 of file SingleGen_module.cc.
|
staticprivate |
Returns a vector with the name of distribution keywords.
Definition at line 389 of file SingleGen_module.cc.
|
staticprivate |
Returns a vector with the name of particle selection mode keywords.
Definition at line 382 of file SingleGen_module.cc.
|
staticprivate |
Returns the name of the specified option key, or defName
if not known.
Definition at line 453 of file SingleGen_module.cc.
|
private |
Definition at line 695 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 432 of file SingleGen_module.cc.
|
inlinestaticprivate |
Definition at line 365 of file SingleGen_module.cc.
|
private |
Definition at line 1000 of file SingleGen_module.cc.
|
override |
unique_ptr allows ownership to be transferred to the art::Event after the put statement
Definition at line 722 of file SingleGen_module.cc.
|
private |
Definition at line 966 of file SingleGen_module.cc.
|
private |
Definition at line 855 of file SingleGen_module.cc.
|
private |
Definition at line 744 of file SingleGen_module.cc.
|
private |
Definition at line 1049 of file SingleGen_module.cc.
|
private |
Definition at line 1064 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 405 of file SingleGen_module.cc.
|
private |
Performs checks and initialization based on the current configuration.
Definition at line 520 of file SingleGen_module.cc.
|
staticprivate |
Names of all distribution modes.
Definition at line 238 of file SingleGen_module.cc.
|
private |
How to distribute angles (gaus, uniform)
Definition at line 290 of file SingleGen_module.cc.
|
private |
actual TH2 for angle distributions - Xz on x axis .
art-managed random-number engine
Definition at line 301 of file SingleGen_module.cc.
|
private |
Filename containing histogram of momenta.
Definition at line 291 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 264 of file SingleGen_module.cc.
|
private |
Central momentum (GeV/c) to generate.
Definition at line 272 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 267 of file SingleGen_module.cc.
|
private |
PDG code of particles to generate.
Definition at line 271 of file SingleGen_module.cc.
|
private |
How to distribute momenta (gaus or uniform)
Definition at line 274 of file SingleGen_module.cc.
|
private |
name of histogram of momenta
Definition at line 292 of file SingleGen_module.cc.
|
private |
How to distribute xyz (gaus, or uniform)
Definition at line 283 of file SingleGen_module.cc.
|
private |
Variation in momenta (GeV/c)
Definition at line 273 of file SingleGen_module.cc.
|
private |
Variation in t position (s)
Definition at line 282 of file SingleGen_module.cc.
|
private |
Variation in angle in XZ plane.
Definition at line 288 of file SingleGen_module.cc.
|
private |
Variation in angle in YZ plane.
Definition at line 289 of file SingleGen_module.cc.
|
private |
Variation in x position (cm)
Definition at line 279 of file SingleGen_module.cc.
|
private |
Variation in y position (cm)
Definition at line 280 of file SingleGen_module.cc.
|
private |
Variation in z position (cm)
Definition at line 281 of file SingleGen_module.cc.
|
private |
if true - all particles produced at the same location
Definition at line 285 of file SingleGen_module.cc.
|
private |
Central t position (s) in world coordinates.
Definition at line 278 of file SingleGen_module.cc.
|
private |
How to distribute t (gaus, or uniform)
Definition at line 284 of file SingleGen_module.cc.
|
private |
Angle in XZ plane (degrees)
Definition at line 286 of file SingleGen_module.cc.
|
private |
Angle in YZ plane (degrees)
Definition at line 287 of file SingleGen_module.cc.
|
private |
name of histogram for thetaxz/thetayz distribution
Definition at line 293 of file SingleGen_module.cc.
|
private |
Central x position (cm) in world coordinates.
Definition at line 275 of file SingleGen_module.cc.
|
private |
Central y position (cm) in world coordinates.
Definition at line 276 of file SingleGen_module.cc.
|
private |
Central z position (cm) in world coordinates.
Definition at line 277 of file SingleGen_module.cc.
|
private |
Definition at line 295 of file SingleGen_module.cc.
|
private |
actual TH1 for momentum distributions
Definition at line 296 of file SingleGen_module.cc.
|
staticprivate |
Gaussian distribution.
Definition at line 260 of file SingleGen_module.cc.
|
staticprivate |
Distribution from histograms.
Definition at line 261 of file SingleGen_module.cc.
|
staticprivate |
One particle per entry is generated.
Definition at line 252 of file SingleGen_module.cc.
|
staticprivate |
One particle is generated, extracted from the provided options.
Definition at line 253 of file SingleGen_module.cc.
|
staticprivate |
Uniform distribution.
Definition at line 259 of file SingleGen_module.cc.
|
staticprivate |
Names of all particle selection modes.
Definition at line 236 of file SingleGen_module.cc.