All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
evgen::SingleGen Class Reference

module to produce single or multiple specified particles in the detector More...

Inheritance diagram for evgen::SingleGen:

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
 

Detailed Description

module to produce single or multiple specified particles in the detector

Definition at line 63 of file SingleGen_module.cc.

Member Typedef Documentation

using evgen::SingleGen::Parameters = art::EDProducer::Table<Config>

Definition at line 225 of file SingleGen_module.cc.

Constructor & Destructor Documentation

evgen::SingleGen::SingleGen ( Parameters const &  config)
explicit

Definition at line 469 of file SingleGen_module.cc.

470  : EDProducer{config}
471  , fMode (selectOption(config().ParticleSelectionMode(), ParticleSelectionModeNames))
472  , fPadOutVectors(config().PadOutVectors())
473  , fPDG (config().PDG())
474  , fP0 (config().P0())
475  , fSigmaP (config().SigmaP())
476  , fPDist (selectOption(config().PDist(), DistributionNames))
477  , fX0 (config().X0())
478  , fY0 (config().Y0())
479  , fZ0 (config().Z0())
480  , fT0 (config().T0())
481  , fSigmaX (config().SigmaX())
482  , fSigmaY (config().SigmaY())
483  , fSigmaZ (config().SigmaZ())
484  , fSigmaT (config().SigmaT())
486  , fTDist (selectOption(config().TDist(), DistributionNames))
487  , fSingleVertex (config().SingleVertex())
488  , fTheta0XZ (config().Theta0XZ())
489  , fTheta0YZ (config().Theta0YZ())
490  , fSigmaThetaXZ (config().SigmaThetaXZ())
491  , fSigmaThetaYZ (config().SigmaThetaYZ())
493  , fHistFileName (config().HistogramFile())
494  , fPHist (config().PHist())
495  , fThetaXzYzHist(config().ThetaXzYzHist())
496  , fEngine(art::ServiceHandle<rndm::NuRandomService>()->createEngine(*this))
497  {
498  setup();
499  rndm::NuRandomService::seed_t seed;
500  if (config().Seed(seed)) {
501  fEngine.setSeed(seed, 0 /* dummy? */);
502  }
503 
504  produces< std::vector<simb::MCTruth> >();
506 
507  }
int fPDist
How to distribute momenta (gaus or uniform)
static const std::map< int, std::string > DistributionNames
Names of all distribution modes.
process_name physics producers generator physics producers generator SigmaZ
process_name opdaq physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator Theta0XZ
Definition: gen_protons.fcl:45
process_name physics producers generator PDist
int fTDist
How to distribute t (gaus, or uniform)
process_name stream1 can override from command line with o or output services DetectorPropertiesService services DetectorPropertiesService services DetectorPropertiesService services DetectorPropertiesService physics analyzers pmtresponse NeutronTrackingCut services LArG4Parameters gaussian physics producers generator PDG
process_name physics producers generator hPHist_pi physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator Theta0YZ
process_name opdaq physics producers generator PosDist
Definition: gen_protons.fcl:45
std::vector< double > fSigmaT
Variation in t position (s)
process_name opdaq physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator SigmaP
Definition: gen_protons.fcl:45
process_name opdaq physics producers generator physics producers generator physics producers generator Z0
Definition: gen_protons.fcl:45
produces< sumdata::RunData, art::InRun >()
process_name physics producers generator hPHist_pi physics producers generator physics producers generator SigmaX
process_name opdaq physics producers generator physics producers generator Y0
Definition: gen_protons.fcl:45
std::vector< std::string > fThetaXzYzHist
name of histogram for thetaxz/thetayz distribution
bool fSingleVertex
if true - all particles produced at the same location
int fPosDist
How to distribute xyz (gaus, or uniform)
process_name physics producers generator hPHist_pi physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator AngleDist
std::vector< double > fSigmaZ
Variation in z position (cm)
standard_singlep gaussian distribution ie ie ie gaussian TDist
Definition: multigen.fcl:18
std::vector< double > fT0
Central t position (s) in world coordinates.
standard_singlep gaussian distribution X0
Definition: multigen.fcl:8
std::vector< double > fP0
Central momentum (GeV/c) to generate.
std::vector< double > fTheta0YZ
Angle in YZ plane (degrees)
unsigned int seed
static auto selectOption(std::string Option, OptionList const &allowedOptions) -> decltype(auto)
Parses an option string and returns the corresponding option number.
process_name physics producers generator physics producers generator physics producers generator SigmaT
std::vector< double > fY0
Central y position (cm) in world coordinates.
std::vector< int > fPDG
PDG code of particles to generate.
std::vector< double > fSigmaThetaYZ
Variation in angle in YZ plane.
std::vector< double > fSigmaP
Variation in momenta (GeV/c)
std::vector< double > fZ0
Central z position (cm) in world coordinates.
std::vector< std::string > fPHist
name of histogram of momenta
std::vector< double > fSigmaX
Variation in x position (cm)
std::vector< double > fX0
Central x position (cm) in world coordinates.
static const std::map< int, std::string > ParticleSelectionModeNames
Names of all particle selection modes.
std::string fHistFileName
Filename containing histogram of momenta.
int fAngleDist
How to distribute angles (gaus, uniform)
std::vector< double > fTheta0XZ
Angle in XZ plane (degrees)
physics producers generator PadOutVectors
process_name physics producers generator hPHist_pi physics producers generator P0
process_name opdaq physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator SigmaThetaYZ
Definition: gen_protons.fcl:45
void setup()
Performs checks and initialization based on the current configuration.
process_name physics producers generator SigmaY
std::vector< double > fSigmaThetaXZ
Variation in angle in XZ plane.
process_name opdaq physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator SigmaThetaXZ
Definition: gen_protons.fcl:45
CLHEP::HepRandomEngine & fEngine
actual TH2 for angle distributions - Xz on x axis .
process_name opdaq physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator physics producers generator T0
Definition: gen_protons.fcl:45
std::vector< double > fSigmaY
Variation in y position (cm)

Member Function Documentation

void evgen::SingleGen::beginRun ( art::Run &  run)
overrideprivate

Act on begin of run: write "RunData" information (sumdata::RunData).

Definition at line 511 of file SingleGen_module.cc.

512  {
513  geo::GeometryCore const& geom = *(lar::providerFrom<geo::Geometry>());
514  run.put
515  (std::make_unique<sumdata::RunData>(geom.DetectorName()), art::fullRun());
516  }
std::string DetectorName() const
Returns a string with the name of the detector, as configured.
Description of geometry of one entire detector.
std::map< int, std::string > evgen::SingleGen::makeDistributionNames ( )
staticprivate

Returns a vector with the name of distribution keywords.

Definition at line 389 of file SingleGen_module.cc.

389  {
390  std::map<int, std::string> names;
391  names[int(kUNIF)] = "uniform";
392  names[int(kGAUS)] = "Gaussian";
393  names[int(kHIST)] = "histograms";
394  return names;
395  } // SingleGen::makeDistributionNames()
static const std::vector< std::string > names
static constexpr int kGAUS
Gaussian distribution.
static constexpr int kUNIF
Uniform distribution.
static constexpr int kHIST
std::map< int, std::string > evgen::SingleGen::makeParticleSelectionModeNames ( )
staticprivate

Returns a vector with the name of particle selection mode keywords.

Definition at line 382 of file SingleGen_module.cc.

382  {
383  std::map<int, std::string> names;
384  names[int(kSelectAllParts )] = "all";
385  names[int(kSelectOneRandPart)] = "singleRandom";
386  return names;
387  } // SingleGen::makeParticleSelectionModeNames()
static constexpr int kSelectOneRandPart
static constexpr int kSelectAllParts
One particle per entry is generated.
static const std::vector< std::string > names
template<typename OptionList >
std::string evgen::SingleGen::optionName ( typename OptionList::value_type::first_type  optionKey,
OptionList const &  allowedOptions,
std::string  defName = "<unknown>" 
)
staticprivate

Returns the name of the specified option key, or defName if not known.

Definition at line 453 of file SingleGen_module.cc.

457  {
458  auto iOption = allowedOptions.find(optionKey);
459  return (iOption != allowedOptions.end())? iOption->second: defName;
460  } // SingleGen::optionName()
bool evgen::SingleGen::PadVector ( std::vector< double > &  vec)
private

Definition at line 695 of file SingleGen_module.cc.

696  {
697  // check if the vec has the same size as fPDG
698  if( vec.size() != fPDG.size() ){
699  // if not padding out the vectors always cause an
700  // exception to be thrown if the vector in question
701  // is not the same size as the fPDG vector
702  // the exception is thrown in the reconfigure method
703  // that calls this one
704  if (!fPadOutVectors) return false;
705  else if( fPadOutVectors){
706  // if padding of vectors is desired but the vector in
707  // question has more than one entry it isn't clear
708  // what the padded values should be so cause
709  // an exception
710  if(vec.size() != 1) return false;
711 
712  // pad it out
713  vec.resize(fPDG.size(), vec[0]);
714 
715  }// end if padding out vectors
716  }// end if the vector size is not the same as fPDG
717 
718  return true;
719  }
std::vector< int > fPDG
PDG code of particles to generate.
template<typename OptionList >
std::string evgen::SingleGen::presentOptions ( OptionList const &  allowedOptions,
bool  printKey,
std::initializer_list< typename OptionList::value_type::first_type >  exclude 
)
staticprivate

Returns a string describing all options in the list.

Template Parameters
OptionListtype of list of options (e.g. std::map<int, std::string>)
Parameters
allowedOptionsthe list of allowed options
printKeywhether to print the key of the option beside its name
excludeKeyslist of keys to be ignored (none by default)
Returns
a string with all options in a line

The result string is a list of option names, separated by commas, like in `"'apple', 'orange', 'banana'". IfprintKeyistrue`, 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.

435  {
436  std::string msg;
437 
438  unsigned int n = 0;
439  for (auto const& option: allowedOptions) {
440  auto const& key = option.first;
441  if (std::find(exclude.begin(), exclude.end(), key) != exclude.end())
442  continue;
443  if (n++ > 0) msg += ", ";
444  msg += '\"' + std::string(option.second) + '\"';
445  if (printKey)
446  msg += " (" + std::to_string(key) + ")";
447  } // for
448  return msg;
449  } // SingleGen::presentOptions()
std::string to_string(WindowPattern const &pattern)
echo Invalid option
Definition: TrainMVA.sh:17
template<typename OptionList >
static std::string evgen::SingleGen::presentOptions ( OptionList const &  allowedOptions,
bool  printKey = true 
)
inlinestaticprivate

Definition at line 365 of file SingleGen_module.cc.

366  { return presentOptions(allowedOptions, printKey, {}); }
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.
void evgen::SingleGen::printVecs ( std::vector< std::string > const &  list)
private

Definition at line 1000 of file SingleGen_module.cc.

1001  {
1002 
1003  mf::LogInfo("SingleGen") << " You are using vector values for SingleGen configuration.\n "
1004  << " Some of the configuration vectors may have been padded out ,"
1005  << " because they (weren't) as long as the pdg vector"
1006  << " in your configuration. \n"
1007  << " The new input particle configuration is:\n" ;
1008 
1009  std::string values;
1010  for(size_t i = 0; i <=1; ++i){// list.size(); ++i){
1011 
1012  values.append(list[i]);
1013  values.append(": [ ");
1014 
1015  for(size_t e = 0; e < fPDG.size(); ++e){
1016  std::stringstream buf;
1017  buf.width(10);
1018  if(i == 0 ) buf << fPDG[e] << ", ";
1019  buf.precision(5);
1020  if(i == 1 ) buf << fP0[e] << ", ";
1021  if(i == 2 ) buf << fSigmaP[e] << ", ";
1022  if(i == 3 ) buf << fX0[e] << ", ";
1023  if(i == 4 ) buf << fY0[e] << ", ";
1024  if(i == 5 ) buf << fZ0[e] << ", ";
1025  if(i == 6 ) buf << fSigmaX[e] << ", ";
1026  if(i == 7 ) buf << fSigmaY[e] << ", ";
1027  if(i == 8 ) buf << fSigmaZ[e] << ", ";
1028  if(i == 9 ) buf << fTheta0XZ[e] << ", ";
1029  if(i == 10) buf << fTheta0YZ[e] << ", ";
1030  if(i == 11) buf << fSigmaThetaXZ[e] << ", ";
1031  if(i == 12) buf << fSigmaThetaYZ[e] << ", ";
1032  if(i == 13) buf << fT0[e] << ", ";
1033  if(i == 14) buf << fSigmaT[e] << ", ";
1034  values.append(buf.str());
1035  }
1036 
1037  values.erase(values.find_last_of(","));
1038  values.append(" ] \n");
1039 
1040  }// end loop over vector names in list
1041 
1042  mf::LogInfo("SingleGen") << values;
1043 
1044  return;
1045  }
std::vector< double > fSigmaT
Variation in t position (s)
std::vector< double > fSigmaZ
Variation in z position (cm)
std::vector< double > fT0
Central t position (s) in world coordinates.
std::vector< double > fP0
Central momentum (GeV/c) to generate.
std::vector< double > fTheta0YZ
Angle in YZ plane (degrees)
std::vector< double > fY0
Central y position (cm) in world coordinates.
std::vector< int > fPDG
PDG code of particles to generate.
std::vector< double > fSigmaThetaYZ
Variation in angle in YZ plane.
std::vector< double > fSigmaP
Variation in momenta (GeV/c)
std::vector< double > fZ0
Central z position (cm) in world coordinates.
std::vector< double > fSigmaX
Variation in x position (cm)
std::vector< double > fX0
Central x position (cm) in world coordinates.
do i e
std::vector< double > fTheta0XZ
Angle in XZ plane (degrees)
std::vector< double > fSigmaThetaXZ
Variation in angle in XZ plane.
std::vector< double > fSigmaY
Variation in y position (cm)
void evgen::SingleGen::produce ( art::Event &  evt)
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.

723  {
724 
725  ///unique_ptr allows ownership to be transferred to the art::Event after the put statement
726  std::unique_ptr< std::vector<simb::MCTruth> > truthcol(new std::vector<simb::MCTruth>);
727 
728  simb::MCTruth truth;
729  truth.SetOrigin(simb::kSingleParticle);
730  Sample(truth);
731 
732  MF_LOG_DEBUG("SingleGen") << truth;
733 
734  truthcol->push_back(truth);
735 
736  evt.put(std::move(truthcol));
737 
738  return;
739  }
void Sample(simb::MCTruth &mct)
TCEvent evt
Definition: DataStructs.cxx:8
void evgen::SingleGen::Sample ( simb::MCTruth &  mct)
private

Definition at line 966 of file SingleGen_module.cc.

967  {
968 
969  switch (fMode) {
970  case 0: // List generation mode: every event will have one of each
971  // particle species in the fPDG array
972  if (fSingleVertex){
973  SampleMany(mct);
974  }
975  else{
976  for (unsigned int i=0; i<fPDG.size(); ++i) {
977  SampleOne(i,mct);
978  }//end loop over particles
979  }
980  break;
981  case 1: // Random selection mode: every event will exactly one particle
982  // selected randomly from the fPDG array
983  {
984  CLHEP::RandFlat flat(fEngine);
985 
986  unsigned int i=flat.fireInt(fPDG.size());
987  SampleOne(i,mct);
988  }
989  break;
990  default:
991  mf::LogWarning("UnrecognizeOption") << "SingleGen does not recognize ParticleSelectionMode "
992  << fMode;
993  break;
994  } // switch on fMode
995 
996  return;
997  }
void SampleOne(unsigned int i, simb::MCTruth &mct)
bool fSingleVertex
if true - all particles produced at the same location
std::vector< int > fPDG
PDG code of particles to generate.
void SampleMany(simb::MCTruth &mct)
CLHEP::HepRandomEngine & fEngine
actual TH2 for angle distributions - Xz on x axis .
void evgen::SingleGen::SampleMany ( simb::MCTruth &  mct)
private

Definition at line 855 of file SingleGen_module.cc.

855  {
856 
857  CLHEP::RandFlat flat(fEngine);
858  CLHEP::RandGaussQ gauss(fEngine);
859 
860  // Choose position
861  TVector3 x;
862  if (fPosDist == kGAUS) {
863  x[0] = gauss.fire(fX0[0], fSigmaX[0]);;
864  x[1] = gauss.fire(fY0[0], fSigmaY[0]);
865  x[2] = gauss.fire(fZ0[0], fSigmaZ[0]);
866  }
867  else {
868  x[0] = fX0[0] + fSigmaX[0]*(2.0*flat.fire()-1.0);
869  x[1] = fY0[0] + fSigmaY[0]*(2.0*flat.fire()-1.0);
870  x[2] = fZ0[0] + fSigmaZ[0]*(2.0*flat.fire()-1.0);
871  }
872 
873  double t = 0.;
874  if(fTDist==kGAUS){
875  t = gauss.fire(fT0[0], fSigmaT[0]);
876  }
877  else{
878  t = fT0[0] + fSigmaT[0]*(2.0*flat.fire()-1.0);
879  }
880 
881  TLorentzVector pos(x[0], x[1], x[2], t);
882 
883  // loop through particles and select momenta and angles
884  for (unsigned int i(0); i<fPDG.size(); ++i){
885  // Choose momentum
886  double p = 0.0;
887  double m = 0.0;
888  if (fPDist == kGAUS) {
889  p = gauss.fire(fP0[i], fSigmaP[i]);
890  }
891  else if (fPDist == kHIST){
892  p = SelectFromHist(*(hPHist[i]));
893  }
894  else {
895  p = fP0[i] + fSigmaP[i]*(2.0*flat.fire()-1.0);
896  }
897 
898  static TDatabasePDG pdgt;
899  TParticlePDG* pdgp = pdgt.GetParticle(fPDG[i]);
900  if (pdgp) m = pdgp->Mass();
901 
902 
903  // Choose angles
904  double thxz = 0;
905  double thyz = 0;
906 
907  double thyzrads = 0;
908  double thyzradsplussigma = 0;
909  double thyzradsminussigma = 0;
910 
911  if (fAngleDist == kGAUS) {
912  thxz = gauss.fire(fTheta0XZ[i], fSigmaThetaXZ[i]);
913  thyz = gauss.fire(fTheta0YZ[i], fSigmaThetaYZ[i]);
914  }
915  else if (fAngleDist == kHIST){
916  double thetaxz = 0;
917  double thetayz = 0;
918  SelectFromHist(*(hThetaXzYzHist[i]), thetaxz, thetayz);
919  thxz = (180./M_PI)*thetaxz;
920  thyz = (180./M_PI)*thetayz;
921  }
922  else {
923 
924  // Choose angles flat in phase space, which is flat in theta_xz
925  // and flat in sin(theta_yz).
926 
927  thxz = fTheta0XZ[i] + fSigmaThetaXZ[i]*(2.0*flat.fire()-1.0);
928 
929  thyzrads = std::asin(std::sin((M_PI/180.)*(fTheta0YZ[i]))); //Taking asin of sin gives value between -Pi/2 and Pi/2 regardless of user input
930  thyzradsplussigma = TMath::Min((thyzrads + ((M_PI/180.)*fabs(fSigmaThetaYZ[i]))), M_PI/2.);
931  thyzradsminussigma = TMath::Max((thyzrads - ((M_PI/180.)*fabs(fSigmaThetaYZ[i]))), -M_PI/2.);
932 
933  //uncomment line to print angular variation info
934  //std::cout << "Central angle: " << (180./M_PI)*thyzrads << " Max angle: " << (180./M_PI)*thyzradsplussigma << " Min angle: " << (180./M_PI)*thyzradsminussigma << std::endl;
935 
936  double sinthyzmin = std::sin(thyzradsminussigma);
937  double sinthyzmax = std::sin(thyzradsplussigma);
938  double sinthyz = sinthyzmin + flat.fire() * (sinthyzmax - sinthyzmin);
939  thyz = (180. / M_PI) * std::asin(sinthyz);
940  }
941 
942  double thxzrad=thxz*M_PI/180.0;
943  double thyzrad=thyz*M_PI/180.0;
944 
945  TLorentzVector pvec(p*std::cos(thyzrad)*std::sin(thxzrad),
946  p*std::sin(thyzrad),
947  p*std::cos(thxzrad)*std::cos(thyzrad),
948  std::sqrt(p*p+m*m));
949 
950  // set track id to -i as these are all primary particles and have id <= 0
951  int trackid = -1*(i+1);
952  std::string primary("primary");
953 
954  simb::MCParticle part(trackid, fPDG[i], primary);
955  part.AddTrajectoryPoint(pos, pvec);
956 
957  //std::cout << "Px: " << pvec.Px() << " Py: " << pvec.Py() << " Pz: " << pvec.Pz() << std::endl;
958  //std::cout << "x: " << pos.X() << " y: " << pos.Y() << " z: " << pos.Z() << " time: " << pos.T() << std::endl;
959  //std::cout << "YZ Angle: " << (thyzrad * (180./M_PI)) << " XZ Angle: " << (thxzrad * (180./M_PI)) << std::endl;
960  mct.Add(part);
961  }
962  }
int fPDist
How to distribute momenta (gaus or uniform)
int fTDist
How to distribute t (gaus, or uniform)
process_name opflash particleana ie x
std::vector< std::unique_ptr< TH2 > > hThetaXzYzHist
actual TH1 for momentum distributions
std::vector< double > fSigmaT
Variation in t position (s)
pdgs p
Definition: selectors.fcl:22
std::vector< std::unique_ptr< TH1 > > hPHist
tuple m
now if test mode generate materials, CRT shell, world, gdml header else just generate CRT shell for u...
int fPosDist
How to distribute xyz (gaus, or uniform)
std::vector< double > fSigmaZ
Variation in z position (cm)
std::vector< double > fT0
Central t position (s) in world coordinates.
std::vector< double > fP0
Central momentum (GeV/c) to generate.
std::vector< double > fTheta0YZ
Angle in YZ plane (degrees)
double SelectFromHist(const TH1 &h)
std::vector< double > fY0
Central y position (cm) in world coordinates.
std::vector< int > fPDG
PDG code of particles to generate.
std::vector< double > fSigmaThetaYZ
Variation in angle in YZ plane.
std::vector< double > fSigmaP
Variation in momenta (GeV/c)
std::vector< double > fZ0
Central z position (cm) in world coordinates.
std::vector< double > fSigmaX
Variation in x position (cm)
static constexpr int kGAUS
Gaussian distribution.
std::vector< double > fX0
Central x position (cm) in world coordinates.
int fAngleDist
How to distribute angles (gaus, uniform)
std::vector< double > fTheta0XZ
Angle in XZ plane (degrees)
static constexpr int kHIST
std::vector< double > fSigmaThetaXZ
Variation in angle in XZ plane.
CLHEP::HepRandomEngine & fEngine
actual TH2 for angle distributions - Xz on x axis .
std::vector< double > fSigmaY
Variation in y position (cm)
void evgen::SingleGen::SampleOne ( unsigned int  i,
simb::MCTruth &  mct 
)
private

Definition at line 744 of file SingleGen_module.cc.

744  {
745 
746  CLHEP::RandFlat flat(fEngine);
747  CLHEP::RandGaussQ gauss(fEngine);
748 
749  // Choose momentum
750  double p = 0.0;
751  double m = 0.0;
752  if (fPDist == kGAUS) {
753  p = gauss.fire(fP0[i], fSigmaP[i]);
754  }
755  else if (fPDist == kHIST){
756  p = SelectFromHist(*(hPHist[i]));
757  }
758  else{// if (fPDist == kUNIF) {
759  p = fP0[i] + fSigmaP[i]*(2.0*flat.fire()-1.0);
760  }
761 // else {std::cout << "do not understand the value of PDist!";}
762 
763  static TDatabasePDG pdgt;
764  TParticlePDG* pdgp = pdgt.GetParticle(fPDG[i]);
765  if (pdgp) m = pdgp->Mass();
766 
767  // Choose position
768  TVector3 x;
769  if (fPosDist == kGAUS) {
770  x[0] = gauss.fire(fX0[i], fSigmaX[i]);;
771  x[1] = gauss.fire(fY0[i], fSigmaY[i]);
772  x[2] = gauss.fire(fZ0[i], fSigmaZ[i]);
773  }
774  else {
775  x[0] = fX0[i] + fSigmaX[i]*(2.0*flat.fire()-1.0);
776  x[1] = fY0[i] + fSigmaY[i]*(2.0*flat.fire()-1.0);
777  x[2] = fZ0[i] + fSigmaZ[i]*(2.0*flat.fire()-1.0);
778  }
779 
780  double t = 0.;
781  if(fTDist==kGAUS){
782  t = gauss.fire(fT0[i], fSigmaT[i]);
783  }
784  else{
785  t = fT0[i] + fSigmaT[i]*(2.0*flat.fire()-1.0);
786  }
787 
788  TLorentzVector pos(x[0], x[1], x[2], t);
789 
790  // Choose angles
791  double thxz = 0;
792  double thyz = 0;
793 
794  double thyzrads = 0;
795  double thyzradsplussigma = 0;
796  double thyzradsminussigma = 0;
797 
798  if (fAngleDist == kGAUS) {
799  thxz = gauss.fire(fTheta0XZ[i], fSigmaThetaXZ[i]);
800  thyz = gauss.fire(fTheta0YZ[i], fSigmaThetaYZ[i]);
801  }
802  else if (fAngleDist == kHIST){ // Select thetaxz and thetayz from histogram
803  double thetaxz = 0;
804  double thetayz = 0;
805  SelectFromHist(*(hThetaXzYzHist[i]), thetaxz, thetayz);
806  thxz = (180./M_PI)*thetaxz;
807  thyz = (180./M_PI)*thetayz;
808  }
809  else {
810 
811  // Choose angles flat in phase space, which is flat in theta_xz
812  // and flat in sin(theta_yz).
813 
814  thxz = fTheta0XZ[i] + fSigmaThetaXZ[i]*(2.0*flat.fire()-1.0);
815 
816  thyzrads = std::asin(std::sin((M_PI/180.)*(fTheta0YZ[i]))); //Taking asin of sin gives value between -Pi/2 and Pi/2 regardless of user input
817  thyzradsplussigma = TMath::Min((thyzrads + ((M_PI/180.)*fabs(fSigmaThetaYZ[i]))), M_PI/2.);
818  thyzradsminussigma = TMath::Max((thyzrads - ((M_PI/180.)*fabs(fSigmaThetaYZ[i]))), -M_PI/2.);
819 
820  //uncomment line to print angular variation info
821  //std::cout << "Central angle: " << (180./M_PI)*thyzrads << " Max angle: " << (180./M_PI)*thyzradsplussigma << " Min angle: " << (180./M_PI)*thyzradsminussigma << std::endl;
822 
823  double sinthyzmin = std::sin(thyzradsminussigma);
824  double sinthyzmax = std::sin(thyzradsplussigma);
825  double sinthyz = sinthyzmin + flat.fire() * (sinthyzmax - sinthyzmin);
826  thyz = (180. / M_PI) * std::asin(sinthyz);
827  }
828 
829  double thxzrad=thxz*M_PI/180.0;
830  double thyzrad=thyz*M_PI/180.0;
831 
832  TLorentzVector pvec(p*std::cos(thyzrad)*std::sin(thxzrad),
833  p*std::sin(thyzrad),
834  p*std::cos(thxzrad)*std::cos(thyzrad),
835  std::sqrt(p*p+m*m));
836 
837  // set track id to -i as these are all primary particles and have id <= 0
838  int trackid = -1*(i+1);
839  std::string primary("primary");
840 
841  simb::MCParticle part(trackid, fPDG[i], primary);
842  part.AddTrajectoryPoint(pos, pvec);
843 
844  //std::cout << "Px: " << pvec.Px() << " Py: " << pvec.Py() << " Pz: " << pvec.Pz() << std::endl;
845  //std::cout << "x: " << pos.X() << " y: " << pos.Y() << " z: " << pos.Z() << " time: " << pos.T() << std::endl;
846  //std::cout << "YZ Angle: " << (thyzrad * (180./M_PI)) << " XZ Angle: " << (thxzrad * (180./M_PI)) << std::endl;
847 
848  mct.Add(part);
849  }
int fPDist
How to distribute momenta (gaus or uniform)
int fTDist
How to distribute t (gaus, or uniform)
process_name opflash particleana ie x
std::vector< std::unique_ptr< TH2 > > hThetaXzYzHist
actual TH1 for momentum distributions
std::vector< double > fSigmaT
Variation in t position (s)
pdgs p
Definition: selectors.fcl:22
std::vector< std::unique_ptr< TH1 > > hPHist
tuple m
now if test mode generate materials, CRT shell, world, gdml header else just generate CRT shell for u...
int fPosDist
How to distribute xyz (gaus, or uniform)
std::vector< double > fSigmaZ
Variation in z position (cm)
std::vector< double > fT0
Central t position (s) in world coordinates.
std::vector< double > fP0
Central momentum (GeV/c) to generate.
std::vector< double > fTheta0YZ
Angle in YZ plane (degrees)
double SelectFromHist(const TH1 &h)
std::vector< double > fY0
Central y position (cm) in world coordinates.
std::vector< int > fPDG
PDG code of particles to generate.
std::vector< double > fSigmaThetaYZ
Variation in angle in YZ plane.
std::vector< double > fSigmaP
Variation in momenta (GeV/c)
std::vector< double > fZ0
Central z position (cm) in world coordinates.
std::vector< double > fSigmaX
Variation in x position (cm)
static constexpr int kGAUS
Gaussian distribution.
std::vector< double > fX0
Central x position (cm) in world coordinates.
int fAngleDist
How to distribute angles (gaus, uniform)
std::vector< double > fTheta0XZ
Angle in XZ plane (degrees)
static constexpr int kHIST
std::vector< double > fSigmaThetaXZ
Variation in angle in XZ plane.
CLHEP::HepRandomEngine & fEngine
actual TH2 for angle distributions - Xz on x axis .
std::vector< double > fSigmaY
Variation in y position (cm)
double evgen::SingleGen::SelectFromHist ( const TH1 &  h)
private

Definition at line 1049 of file SingleGen_module.cc.

1050  {
1051  CLHEP::RandFlat flat(fEngine);
1052 
1053  double throw_value = h.Integral() * flat.fire();
1054  double cum_value(0);
1055  for (int i(0); i < h.GetNbinsX()+1; ++i){
1056  cum_value += h.GetBinContent(i);
1057  if (throw_value < cum_value){
1058  return flat.fire()*h.GetBinWidth(i) + h.GetBinLowEdge(i);
1059  }
1060  }
1061  return throw_value; // for some reason we've gone through all bins and failed?
1062  }
while getopts h
CLHEP::HepRandomEngine & fEngine
actual TH2 for angle distributions - Xz on x axis .
void evgen::SingleGen::SelectFromHist ( const TH2 &  h,
double &  x,
double &  y 
)
private

Definition at line 1064 of file SingleGen_module.cc.

1065  {
1066  CLHEP::RandFlat flat(fEngine);
1067 
1068  double throw_value = h.Integral() * flat.fire();
1069  double cum_value(0);
1070  for (int i(0); i < h.GetNbinsX()+1; ++i){
1071  for (int j(0); j < h.GetNbinsY()+1; ++j){
1072  cum_value += h.GetBinContent(i, j);
1073  if (throw_value < cum_value){
1074  x = flat.fire()*h.GetXaxis()->GetBinWidth(i) + h.GetXaxis()->GetBinLowEdge(i);
1075  y = flat.fire()*h.GetYaxis()->GetBinWidth(j) + h.GetYaxis()->GetBinLowEdge(j);
1076  return;
1077  }
1078  }
1079  }
1080  return; // for some reason we've gone through all bins and failed?
1081  }
process_name opflash particleana ie x
while getopts h
process_name opflash particleana ie ie y
CLHEP::HepRandomEngine & fEngine
actual TH2 for angle distributions - Xz on x axis .
template<typename OptionList >
auto evgen::SingleGen::selectOption ( std::string  Option,
OptionList const &  allowedOptions 
) -> decltype(auto)
staticprivate

Parses an option string and returns the corresponding option number.

Template Parameters
OptionListtype of list of options (e.g. std::map<int, std::string>)
Parameters
Optionthe string of the option to be parsed
allowedOptionslist of valid options, as key/name pairs
Returns
the key of the Option string from allowedOptions
Exceptions
std::runtime_errorif 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.

406  {
407  using key_type = typename OptionList::value_type::first_type;
408  using tolower_type = int(*)(int);
409  auto toLower = [](auto const& S)
410  {
411  std::string s;
412  s.reserve(S.size());
413  std::transform(S.cbegin(), S.cend(), std::back_inserter(s),
414  (tolower_type) &std::tolower);
415  return s;
416  };
417  auto option = toLower(Option);
418  for (auto const& candidate: allowedOptions) {
419  if (toLower(candidate.second) == option) return candidate.first;
420  }
421  try {
422  std::size_t end;
423  key_type num = std::stoi(Option, &end);
424  if (allowedOptions.count(num) && (end == Option.length())) return num;
425  }
426  catch (std::invalid_argument const&) {}
427  throw std::runtime_error("Option '" + Option + "' not supported.");
428  } // SingleGen::selectOption()
see a below echo S(symbol in a section other than those above)
static constexpr Sample_t transform(Sample_t sample)
auto end(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:585
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
echo Invalid option
Definition: TrainMVA.sh:17
void evgen::SingleGen::setup ( )
private

Performs checks and initialization based on the current configuration.

Definition at line 520 of file SingleGen_module.cc.

521  {
522  // do not put seed in reconfigure because we don't want to reset
523  // the seed midstream
524  std::vector<std::string> vlist(15);
525  vlist[0] = "PDG";
526  vlist[1] = "P0";
527  vlist[2] = "SigmaP";
528  vlist[3] = "X0";
529  vlist[4] = "Y0";
530  vlist[5] = "Z0";
531  vlist[6] = "SigmaX";
532  vlist[7] = "SigmaY";
533  vlist[8] = "SigmaZ";
534  vlist[9] = "Theta0XZ";
535  vlist[10] = "Theta0YZ";
536  vlist[11] = "SigmaThetaXZ";
537  vlist[12] = "SigmaThetaYZ";
538  vlist[13] = "T0";
539  vlist[14] = "SigmaT";
540 
541 // vlist[15] = "PHist";
542 // vlist[16] = "ThetaHist";
543 // vlist[17] = "PhiHist";
544 
545  // begin tests for multiple particle error possibilities
546  std::string list;
547  if (fPDist != kHIST) {
548  if( !this->PadVector(fP0 ) ){ list.append(vlist[1].append(", \n")); }
549  if( !this->PadVector(fSigmaP ) ){ list.append(vlist[2].append(", \n")); }
550  }
551  if( !this->PadVector(fX0 ) ){ list.append(vlist[3].append(", \n")); }
552  if( !this->PadVector(fY0 ) ){ list.append(vlist[4].append(", \n")); }
553  if( !this->PadVector(fZ0 ) ){ list.append(vlist[5].append(", \n")); }
554  if( !this->PadVector(fSigmaX ) ){ list.append(vlist[6].append(", \n")); }
555  if( !this->PadVector(fSigmaY ) ){ list.append(vlist[7].append(", \n")); }
556  if( !this->PadVector(fSigmaZ ) ){ list.append(vlist[8].append(", \n")); }
557  if( !this->PadVector(fTheta0XZ ) ){ list.append(vlist[9].append(", \n")); }
558  if( !this->PadVector(fTheta0YZ ) ){ list.append(vlist[10].append(", \n")); }
559  if( !this->PadVector(fSigmaThetaXZ) ){ list.append(vlist[11].append(", \n")); }
560  if( !this->PadVector(fSigmaThetaYZ) ){ list.append(vlist[12].append(" \n")); }
561  if( !this->PadVector(fT0 ) ){ list.append(vlist[13].append(", \n")); }
562  if( !this->PadVector(fSigmaT ) ){ list.append(vlist[14].append(", \n")); }
563 
564 
565 
566  if(list.size() > 0)
567  throw cet::exception("SingleGen") << "The "<< list
568  << "\n vector(s) defined in the fhicl files has/have "
569  << "a different size than the PDG vector "
570  << "\n and it has (they have) more than one value, "
571  << "\n disallowing sensible padding "
572  << " and/or you have set fPadOutVectors to false. \n";
573 
574  if(fPDG.size() > 1 && fPadOutVectors) this->printVecs(vlist);
575 
576  // If needed, get histograms for momentum and angle distributions
577  TFile* histFile = nullptr;
578  if (!fHistFileName.empty()) {
579  if (fHistFileName[0] == '/') {
580  // We have an absolute path, use given name exactly.
581  if (cet::file_exists(fHistFileName)) {
582  histFile = new TFile(fHistFileName.c_str());
583  if (!histFile || histFile->IsZombie() || !histFile->IsOpen()) {
584  delete histFile;
585  histFile = nullptr;
586  throw art::Exception(art::errors::NotFound) << "Cannot open ROOT file specified in parameter HistogramFile: \"" << fHistFileName << "\"";
587  }
588  }
589  else {
590  throw art::Exception(art::errors::NotFound) << "ROOT file specified in parameter HistogramFile: \"" << fHistFileName << "\" does not exist!";
591  }
592  }
593  else {
594  // We have a relative path, search starting from current directory.
595  std::string relative_filename{"./"};
596  relative_filename += fHistFileName;
597  if (cet::file_exists(relative_filename)) {
598  histFile = new TFile(relative_filename.c_str());
599  if (!histFile || histFile->IsZombie() || !histFile->IsOpen()) {
600  delete histFile;
601  histFile = nullptr;
602  throw art::Exception(art::errors::NotFound) << "Cannot open ROOT file found using relative path and originally specified in parameter HistogramFile: \"" << relative_filename << '"';
603  }
604  }
605  else {
606  cet::search_path sp{"FW_SEARCH_PATH"};
607  std::string found_filename;
608  auto found = sp.find_file(fHistFileName, found_filename);
609  if (!found) {
610  throw art::Exception(art::errors::NotFound) << "Cannot find ROOT file in current directory nor on FW_SEARCH_PATH specified in parameter HistogramFile: \"" << fHistFileName << '"';
611  }
612  histFile = new TFile(found_filename.c_str());
613  if (!histFile || histFile->IsZombie() || !histFile->IsOpen()) {
614  delete histFile;
615  histFile = nullptr;
616  throw art::Exception(art::errors::NotFound) << "Cannot open ROOT file found on FW_SEARCH_PATH and originally specified in parameter HistogramFile: \"" << found_filename << '"';
617  }
618  }
619  }
620  }
621 
622  //
623  // deal with position distribution
624  //
625  switch (fPosDist) {
626  case kGAUS: case kUNIF: break; // supported, no further action needed
627  default:
628  throw art::Exception(art::errors::Configuration)
629  << "Position distribution of type '"
631  << "' (" << std::to_string(fPosDist) << ") is not supported.";
632  } // switch(fPosDist)
633 
634  //
635  // deal with time distribution
636  //
637  switch (fTDist) {
638  case kGAUS: case kUNIF: break; // supported, no further action needed
639  default:
640  throw art::Exception(art::errors::Configuration)
641  << "Time distribution of type '"
643  << "' (" << std::to_string(fTDist) << ") is not supported.";
644  } // switch(fTDist)
645 
646  //
647  // deal with momentum distribution
648  //
649  switch (fPDist) {
650  case kHIST:
651  if (fPHist.size() != fPDG.size()) {
652  throw art::Exception(art::errors::Configuration)
653  << fPHist.size() << " momentum histograms to describe " << fPDG.size() << " particle types...";
654  }
655  hPHist.reserve(fPHist.size());
656  for (auto const& histName: fPHist) {
657  TH1* pHist = dynamic_cast<TH1*>(histFile->Get(histName.c_str()));
658  if (!pHist) {
659  throw art::Exception(art::errors::NotFound)
660  << "Failed to read momentum histogram '" << histName << "' from '" << histFile->GetPath() << "\'";
661  }
662  pHist->SetDirectory(nullptr); // make it independent of the input file
663  hPHist.emplace_back(pHist);
664  } // for
665  break;
666  default: // supported, no further action needed
667  break;
668  } // switch(fPDist)
669 
670  switch (fAngleDist) {
671  case kHIST:
672  if (fThetaXzYzHist.size() != fPDG.size()) {
673  throw art::Exception(art::errors::Configuration)
674  << fThetaXzYzHist.size() << " direction histograms to describe " << fPDG.size() << " particle types...";
675  }
676  hThetaXzYzHist.reserve(fThetaXzYzHist.size());
677  for (auto const& histName: fThetaXzYzHist) {
678  TH2* pHist = dynamic_cast<TH2*>(histFile->Get(histName.c_str()));
679  if (!pHist) {
680  throw art::Exception(art::errors::NotFound)
681  << "Failed to read direction histogram '" << histName << "' from '" << histFile->GetPath() << "\'";
682  }
683  pHist->SetDirectory(nullptr); // make it independent of the input file
684  hThetaXzYzHist.emplace_back(pHist);
685  } // for
686  default: // supported, no further action needed
687  break;
688  } // switch(fAngleDist)
689 
690  delete histFile;
691 
692  }
int fPDist
How to distribute momenta (gaus or uniform)
static const std::map< int, std::string > DistributionNames
Names of all distribution modes.
int fTDist
How to distribute t (gaus, or uniform)
bool PadVector(std::vector< double > &vec)
std::vector< std::unique_ptr< TH2 > > hThetaXzYzHist
actual TH1 for momentum distributions
std::vector< double > fSigmaT
Variation in t position (s)
std::vector< std::unique_ptr< TH1 > > hPHist
std::vector< std::string > fThetaXzYzHist
name of histogram for thetaxz/thetayz distribution
int fPosDist
How to distribute xyz (gaus, or uniform)
void printVecs(std::vector< std::string > const &list)
std::vector< double > fSigmaZ
Variation in z position (cm)
std::vector< double > fT0
Central t position (s) in world coordinates.
std::vector< double > fP0
Central momentum (GeV/c) to generate.
std::vector< double > fTheta0YZ
Angle in YZ plane (degrees)
std::vector< double > fY0
Central y position (cm) in world coordinates.
std::vector< int > fPDG
PDG code of particles to generate.
std::vector< double > fSigmaThetaYZ
Variation in angle in YZ plane.
std::vector< double > fSigmaP
Variation in momenta (GeV/c)
std::vector< double > fZ0
Central z position (cm) in world coordinates.
std::vector< std::string > fPHist
name of histogram of momenta
std::vector< double > fSigmaX
Variation in x position (cm)
std::string to_string(WindowPattern const &pattern)
static constexpr int kGAUS
Gaussian distribution.
std::vector< double > fX0
Central x position (cm) in world coordinates.
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.
std::string fHistFileName
Filename containing histogram of momenta.
int fAngleDist
How to distribute angles (gaus, uniform)
static constexpr int kUNIF
Uniform distribution.
std::vector< double > fTheta0XZ
Angle in XZ plane (degrees)
static constexpr int kHIST
list
Definition: file_to_url.sh:28
std::vector< double > fSigmaThetaXZ
Variation in angle in XZ plane.
std::vector< double > fSigmaY
Variation in y position (cm)

Member Data Documentation

const std::map< int, std::string > evgen::SingleGen::DistributionNames = SingleGen::makeDistributionNames()
staticprivate

Names of all distribution modes.

Definition at line 238 of file SingleGen_module.cc.

int evgen::SingleGen::fAngleDist
private

How to distribute angles (gaus, uniform)

Definition at line 290 of file SingleGen_module.cc.

CLHEP::HepRandomEngine& evgen::SingleGen::fEngine
private

actual TH2 for angle distributions - Xz on x axis .

art-managed random-number engine

Definition at line 301 of file SingleGen_module.cc.

std::string evgen::SingleGen::fHistFileName
private

Filename containing histogram of momenta.

Definition at line 291 of file SingleGen_module.cc.

int evgen::SingleGen::fMode
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.

std::vector<double> evgen::SingleGen::fP0
private

Central momentum (GeV/c) to generate.

Definition at line 272 of file SingleGen_module.cc.

bool evgen::SingleGen::fPadOutVectors
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.

std::vector<int> evgen::SingleGen::fPDG
private

PDG code of particles to generate.

Definition at line 271 of file SingleGen_module.cc.

int evgen::SingleGen::fPDist
private

How to distribute momenta (gaus or uniform)

Definition at line 274 of file SingleGen_module.cc.

std::vector<std::string> evgen::SingleGen::fPHist
private

name of histogram of momenta

Definition at line 292 of file SingleGen_module.cc.

int evgen::SingleGen::fPosDist
private

How to distribute xyz (gaus, or uniform)

Definition at line 283 of file SingleGen_module.cc.

std::vector<double> evgen::SingleGen::fSigmaP
private

Variation in momenta (GeV/c)

Definition at line 273 of file SingleGen_module.cc.

std::vector<double> evgen::SingleGen::fSigmaT
private

Variation in t position (s)

Definition at line 282 of file SingleGen_module.cc.

std::vector<double> evgen::SingleGen::fSigmaThetaXZ
private

Variation in angle in XZ plane.

Definition at line 288 of file SingleGen_module.cc.

std::vector<double> evgen::SingleGen::fSigmaThetaYZ
private

Variation in angle in YZ plane.

Definition at line 289 of file SingleGen_module.cc.

std::vector<double> evgen::SingleGen::fSigmaX
private

Variation in x position (cm)

Definition at line 279 of file SingleGen_module.cc.

std::vector<double> evgen::SingleGen::fSigmaY
private

Variation in y position (cm)

Definition at line 280 of file SingleGen_module.cc.

std::vector<double> evgen::SingleGen::fSigmaZ
private

Variation in z position (cm)

Definition at line 281 of file SingleGen_module.cc.

bool evgen::SingleGen::fSingleVertex
private

if true - all particles produced at the same location

Definition at line 285 of file SingleGen_module.cc.

std::vector<double> evgen::SingleGen::fT0
private

Central t position (s) in world coordinates.

Definition at line 278 of file SingleGen_module.cc.

int evgen::SingleGen::fTDist
private

How to distribute t (gaus, or uniform)

Definition at line 284 of file SingleGen_module.cc.

std::vector<double> evgen::SingleGen::fTheta0XZ
private

Angle in XZ plane (degrees)

Definition at line 286 of file SingleGen_module.cc.

std::vector<double> evgen::SingleGen::fTheta0YZ
private

Angle in YZ plane (degrees)

Definition at line 287 of file SingleGen_module.cc.

std::vector<std::string> evgen::SingleGen::fThetaXzYzHist
private

name of histogram for thetaxz/thetayz distribution

Definition at line 293 of file SingleGen_module.cc.

std::vector<double> evgen::SingleGen::fX0
private

Central x position (cm) in world coordinates.

Definition at line 275 of file SingleGen_module.cc.

std::vector<double> evgen::SingleGen::fY0
private

Central y position (cm) in world coordinates.

Definition at line 276 of file SingleGen_module.cc.

std::vector<double> evgen::SingleGen::fZ0
private

Central z position (cm) in world coordinates.

Definition at line 277 of file SingleGen_module.cc.

std::vector<std::unique_ptr<TH1> > evgen::SingleGen::hPHist
private

Definition at line 295 of file SingleGen_module.cc.

std::vector<std::unique_ptr<TH2> > evgen::SingleGen::hThetaXzYzHist
private

actual TH1 for momentum distributions

Definition at line 296 of file SingleGen_module.cc.

constexpr int evgen::SingleGen::kGAUS = 1
staticprivate

Gaussian distribution.

Definition at line 260 of file SingleGen_module.cc.

constexpr int evgen::SingleGen::kHIST = 2
staticprivate

Distribution from histograms.

Definition at line 261 of file SingleGen_module.cc.

constexpr int evgen::SingleGen::kSelectAllParts = 0
staticprivate

One particle per entry is generated.

Definition at line 252 of file SingleGen_module.cc.

constexpr int evgen::SingleGen::kSelectOneRandPart = 1
staticprivate

One particle is generated, extracted from the provided options.

Definition at line 253 of file SingleGen_module.cc.

constexpr int evgen::SingleGen::kUNIF = 0
staticprivate

Uniform distribution.

Definition at line 259 of file SingleGen_module.cc.

const std::map< int, std::string > evgen::SingleGen::ParticleSelectionModeNames = SingleGen::makeParticleSelectionModeNames()
staticprivate

Names of all particle selection modes.

Definition at line 236 of file SingleGen_module.cc.


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