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::larg4SingleGen Class Reference

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

Inheritance diagram for evgen::larg4SingleGen:

Classes

struct  Config
 

Public Types

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

Public Member Functions

 larg4SingleGen (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 = larg4SingleGen::makeParticleSelectionModeNames()
 Names of all particle selection modes. More...
 
static const std::map< int,
std::string > 
DistributionNames = larg4SingleGen::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 55 of file larg4SingleGen_module.cc.

Member Typedef Documentation

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

Definition at line 210 of file larg4SingleGen_module.cc.

Constructor & Destructor Documentation

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

Definition at line 454 of file larg4SingleGen_module.cc.

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

Member Function Documentation

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

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

Definition at line 496 of file larg4SingleGen_module.cc.

497  {
498 
499  }
std::map< int, std::string > evgen::larg4SingleGen::makeDistributionNames ( )
staticprivate

Returns a vector with the name of distribution keywords.

Definition at line 374 of file larg4SingleGen_module.cc.

374  {
375  std::map<int, std::string> names;
376  names[int(kUNIF)] = "uniform";
377  names[int(kGAUS)] = "Gaussian";
378  names[int(kHIST)] = "histograms";
379  return names;
380  } // larg4SingleGen::makeDistributionNames()
static constexpr int kHIST
static const std::vector< std::string > names
static constexpr int kUNIF
Uniform distribution.
static constexpr int kGAUS
Gaussian distribution.
std::map< int, std::string > evgen::larg4SingleGen::makeParticleSelectionModeNames ( )
staticprivate

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

Definition at line 367 of file larg4SingleGen_module.cc.

367  {
368  std::map<int, std::string> names;
369  names[int(kSelectAllParts )] = "all";
370  names[int(kSelectOneRandPart)] = "singleRandom";
371  return names;
372  } // larg4SingleGen::makeParticleSelectionModeNames()
static constexpr int kSelectAllParts
One particle per entry is generated.
static constexpr int kSelectOneRandPart
static const std::vector< std::string > names
template<typename OptionList >
std::string evgen::larg4SingleGen::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 438 of file larg4SingleGen_module.cc.

442  {
443  auto iOption = allowedOptions.find(optionKey);
444  return (iOption != allowedOptions.end())? iOption->second: defName;
445  } // larg4SingleGen::optionName()
bool evgen::larg4SingleGen::PadVector ( std::vector< double > &  vec)
private

Definition at line 674 of file larg4SingleGen_module.cc.

675  {
676  // check if the vec has the same size as fPDG
677  if( vec.size() != fPDG.size() ){
678  // if not padding out the vectors always cause an
679  // exception to be thrown if the vector in question
680  // is not the same size as the fPDG vector
681  // the exception is thrown in the reconfigure method
682  // that calls this one
683  if (!fPadOutVectors) return false;
684  else if( fPadOutVectors){
685  // if padding of vectors is desired but the vector in
686  // question has more than one entry it isn't clear
687  // what the padded values should be so cause
688  // an exception
689  if(vec.size() != 1) return false;
690 
691  // pad it out
692  vec.resize(fPDG.size(), vec[0]);
693 
694  }// end if padding out vectors
695  }// end if the vector size is not the same as fPDG
696 
697  return true;
698  }
std::vector< int > fPDG
PDG code of particles to generate.
template<typename OptionList >
std::string evgen::larg4SingleGen::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 417 of file larg4SingleGen_module.cc.

420  {
421  std::string msg;
422 
423  unsigned int n = 0;
424  for (auto const& option: allowedOptions) {
425  auto const& key = option.first;
426  if (std::find(exclude.begin(), exclude.end(), key) != exclude.end())
427  continue;
428  if (n++ > 0) msg += ", ";
429  msg += '\"' + std::string(option.second) + '\"';
430  if (printKey)
431  msg += " (" + std::to_string(key) + ")";
432  } // for
433  return msg;
434  } // larg4SingleGen::presentOptions()
std::string to_string(WindowPattern const &pattern)
echo Invalid option
Definition: TrainMVA.sh:17
template<typename OptionList >
static std::string evgen::larg4SingleGen::presentOptions ( OptionList const &  allowedOptions,
bool  printKey = true 
)
inlinestaticprivate

Definition at line 350 of file larg4SingleGen_module.cc.

351  { 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::larg4SingleGen::printVecs ( std::vector< std::string > const &  list)
private

Definition at line 979 of file larg4SingleGen_module.cc.

980  {
981 
982  mf::LogInfo("larg4SingleGen") << " You are using vector values for larg4SingleGen configuration.\n "
983  << " Some of the configuration vectors may have been padded out ,"
984  << " because they (weren't) as long as the pdg vector"
985  << " in your configuration. \n"
986  << " The new input particle configuration is:\n" ;
987 
988  std::string values;
989  for(size_t i = 0; i <=1; ++i){// list.size(); ++i){
990 
991  values.append(list[i]);
992  values.append(": [ ");
993 
994  for(size_t e = 0; e < fPDG.size(); ++e){
995  std::stringstream buf;
996  buf.width(10);
997  if(i == 0 ) buf << fPDG[e] << ", ";
998  buf.precision(5);
999  if(i == 1 ) buf << fP0[e] << ", ";
1000  if(i == 2 ) buf << fSigmaP[e] << ", ";
1001  if(i == 3 ) buf << fX0[e] << ", ";
1002  if(i == 4 ) buf << fY0[e] << ", ";
1003  if(i == 5 ) buf << fZ0[e] << ", ";
1004  if(i == 6 ) buf << fSigmaX[e] << ", ";
1005  if(i == 7 ) buf << fSigmaY[e] << ", ";
1006  if(i == 8 ) buf << fSigmaZ[e] << ", ";
1007  if(i == 9 ) buf << fTheta0XZ[e] << ", ";
1008  if(i == 10) buf << fTheta0YZ[e] << ", ";
1009  if(i == 11) buf << fSigmaThetaXZ[e] << ", ";
1010  if(i == 12) buf << fSigmaThetaYZ[e] << ", ";
1011  if(i == 13) buf << fT0[e] << ", ";
1012  if(i == 14) buf << fSigmaT[e] << ", ";
1013  values.append(buf.str());
1014  }
1015 
1016  values.erase(values.find_last_of(","));
1017  values.append(" ] \n");
1018 
1019  }// end loop over vector names in list
1020 
1021  mf::LogInfo("larg4SingleGen") << values;
1022 
1023  return;
1024  }
std::vector< double > fSigmaZ
Variation in z position (cm)
std::vector< double > fSigmaP
Variation in momenta (GeV/c)
std::vector< double > fSigmaThetaYZ
Variation in angle in YZ plane.
std::vector< int > fPDG
PDG code of particles to generate.
std::vector< double > fSigmaT
Variation in t position (s)
std::vector< double > fZ0
Central z position (cm) in world coordinates.
std::vector< double > fT0
Central t position (s) in world coordinates.
std::vector< double > fTheta0XZ
Angle in XZ plane (degrees)
std::vector< double > fX0
Central x position (cm) in world coordinates.
std::vector< double > fSigmaY
Variation in y position (cm)
do i e
std::vector< double > fY0
Central y position (cm) in world coordinates.
std::vector< double > fSigmaX
Variation in x position (cm)
std::vector< double > fTheta0YZ
Angle in YZ plane (degrees)
std::vector< double > fP0
Central momentum (GeV/c) to generate.
std::vector< double > fSigmaThetaXZ
Variation in angle in XZ plane.
void evgen::larg4SingleGen::produce ( art::Event &  evt)
override

unique_ptr allows ownership to be transferred to the art::Event after the put statement

Definition at line 701 of file larg4SingleGen_module.cc.

702  {
703 
704  ///unique_ptr allows ownership to be transferred to the art::Event after the put statement
705  std::unique_ptr< std::vector<simb::MCTruth> > truthcol(new std::vector<simb::MCTruth>);
706 
707  simb::MCTruth truth;
708  truth.SetOrigin(simb::kSingleParticle);
709  Sample(truth);
710 
711  MF_LOG_DEBUG("larg4SingleGen") << truth;
712 
713  truthcol->push_back(truth);
714 
715  evt.put(std::move(truthcol));
716 
717  return;
718  }
TCEvent evt
Definition: DataStructs.cxx:8
void Sample(simb::MCTruth &mct)
void evgen::larg4SingleGen::Sample ( simb::MCTruth &  mct)
private

Definition at line 945 of file larg4SingleGen_module.cc.

946  {
947 
948  switch (fMode) {
949  case 0: // List generation mode: every event will have one of each
950  // particle species in the fPDG array
951  if (fSingleVertex){
952  SampleMany(mct);
953  }
954  else{
955  for (unsigned int i=0; i<fPDG.size(); ++i) {
956  SampleOne(i,mct);
957  }//end loop over particles
958  }
959  break;
960  case 1: // Random selection mode: every event will exactly one particle
961  // selected randomly from the fPDG array
962  {
963  CLHEP::RandFlat flat(fEngine);
964 
965  unsigned int i=flat.fireInt(fPDG.size());
966  SampleOne(i,mct);
967  }
968  break;
969  default:
970  mf::LogWarning("UnrecognizeOption") << "larg4SingleGen does not recognize ParticleSelectionMode "
971  << fMode;
972  break;
973  } // switch on fMode
974 
975  return;
976  }
CLHEP::HepRandomEngine & fEngine
actual TH2 for angle distributions - Xz on x axis .
std::vector< int > fPDG
PDG code of particles to generate.
void SampleOne(unsigned int i, simb::MCTruth &mct)
bool fSingleVertex
if true - all particles produced at the same location
void SampleMany(simb::MCTruth &mct)
void evgen::larg4SingleGen::SampleMany ( simb::MCTruth &  mct)
private

Definition at line 834 of file larg4SingleGen_module.cc.

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

Definition at line 723 of file larg4SingleGen_module.cc.

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

Definition at line 1028 of file larg4SingleGen_module.cc.

1029  {
1030  CLHEP::RandFlat flat(fEngine);
1031 
1032  double throw_value = h.Integral() * flat.fire();
1033  double cum_value(0);
1034  for (int i(0); i < h.GetNbinsX()+1; ++i){
1035  cum_value += h.GetBinContent(i);
1036  if (throw_value < cum_value){
1037  return flat.fire()*h.GetBinWidth(i) + h.GetBinLowEdge(i);
1038  }
1039  }
1040  return throw_value; // for some reason we've gone through all bins and failed?
1041  }
while getopts h
CLHEP::HepRandomEngine & fEngine
actual TH2 for angle distributions - Xz on x axis .
void evgen::larg4SingleGen::SelectFromHist ( const TH2 &  h,
double &  x,
double &  y 
)
private

Definition at line 1043 of file larg4SingleGen_module.cc.

1044  {
1045  CLHEP::RandFlat flat(fEngine);
1046 
1047  double throw_value = h.Integral() * flat.fire();
1048  double cum_value(0);
1049  for (int i(0); i < h.GetNbinsX()+1; ++i){
1050  for (int j(0); j < h.GetNbinsY()+1; ++j){
1051  cum_value += h.GetBinContent(i, j);
1052  if (throw_value < cum_value){
1053  x = flat.fire()*h.GetXaxis()->GetBinWidth(i) + h.GetXaxis()->GetBinLowEdge(i);
1054  y = flat.fire()*h.GetYaxis()->GetBinWidth(j) + h.GetYaxis()->GetBinLowEdge(j);
1055  return;
1056  }
1057  }
1058  }
1059  return; // for some reason we've gone through all bins and failed?
1060  }
process_name opflash particleana ie x
while getopts h
CLHEP::HepRandomEngine & fEngine
actual TH2 for angle distributions - Xz on x axis .
process_name opflash particleana ie ie y
template<typename OptionList >
auto evgen::larg4SingleGen::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 390 of file larg4SingleGen_module.cc.

391  {
392  using key_type = typename OptionList::value_type::first_type;
393  using tolower_type = int(*)(int);
394  auto toLower = [](auto const& S)
395  {
396  std::string s;
397  s.reserve(S.size());
398  std::transform(S.cbegin(), S.cend(), std::back_inserter(s),
399  (tolower_type) &std::tolower);
400  return s;
401  };
402  auto option = toLower(Option);
403  for (auto const& candidate: allowedOptions) {
404  if (toLower(candidate.second) == option) return candidate.first;
405  }
406  try {
407  std::size_t end;
408  key_type num = std::stoi(Option, &end);
409  if (allowedOptions.count(num) && (end == Option.length())) return num;
410  }
411  catch (std::invalid_argument const&) {}
412  throw std::runtime_error("Option '" + Option + "' not supported.");
413  } // larg4SingleGen::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::larg4SingleGen::setup ( )
private

Performs checks and initialization based on the current configuration.

Definition at line 503 of file larg4SingleGen_module.cc.

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

Member Data Documentation

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

Names of all distribution modes.

Definition at line 223 of file larg4SingleGen_module.cc.

int evgen::larg4SingleGen::fAngleDist
private

How to distribute angles (gaus, uniform)

Definition at line 275 of file larg4SingleGen_module.cc.

CLHEP::HepRandomEngine& evgen::larg4SingleGen::fEngine
private

actual TH2 for angle distributions - Xz on x axis .

art-managed random-number engine

Definition at line 286 of file larg4SingleGen_module.cc.

std::string evgen::larg4SingleGen::fHistFileName
private

Filename containing histogram of momenta.

Definition at line 276 of file larg4SingleGen_module.cc.

int evgen::larg4SingleGen::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 249 of file larg4SingleGen_module.cc.

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

Central momentum (GeV/c) to generate.

Definition at line 257 of file larg4SingleGen_module.cc.

bool evgen::larg4SingleGen::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 252 of file larg4SingleGen_module.cc.

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

PDG code of particles to generate.

Definition at line 256 of file larg4SingleGen_module.cc.

int evgen::larg4SingleGen::fPDist
private

How to distribute momenta (gaus or uniform)

Definition at line 259 of file larg4SingleGen_module.cc.

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

name of histogram of momenta

Definition at line 277 of file larg4SingleGen_module.cc.

int evgen::larg4SingleGen::fPosDist
private

How to distribute xyz (gaus, or uniform)

Definition at line 268 of file larg4SingleGen_module.cc.

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

Variation in momenta (GeV/c)

Definition at line 258 of file larg4SingleGen_module.cc.

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

Variation in t position (s)

Definition at line 267 of file larg4SingleGen_module.cc.

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

Variation in angle in XZ plane.

Definition at line 273 of file larg4SingleGen_module.cc.

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

Variation in angle in YZ plane.

Definition at line 274 of file larg4SingleGen_module.cc.

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

Variation in x position (cm)

Definition at line 264 of file larg4SingleGen_module.cc.

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

Variation in y position (cm)

Definition at line 265 of file larg4SingleGen_module.cc.

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

Variation in z position (cm)

Definition at line 266 of file larg4SingleGen_module.cc.

bool evgen::larg4SingleGen::fSingleVertex
private

if true - all particles produced at the same location

Definition at line 270 of file larg4SingleGen_module.cc.

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

Central t position (s) in world coordinates.

Definition at line 263 of file larg4SingleGen_module.cc.

int evgen::larg4SingleGen::fTDist
private

How to distribute t (gaus, or uniform)

Definition at line 269 of file larg4SingleGen_module.cc.

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

Angle in XZ plane (degrees)

Definition at line 271 of file larg4SingleGen_module.cc.

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

Angle in YZ plane (degrees)

Definition at line 272 of file larg4SingleGen_module.cc.

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

name of histogram for thetaxz/thetayz distribution

Definition at line 278 of file larg4SingleGen_module.cc.

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

Central x position (cm) in world coordinates.

Definition at line 260 of file larg4SingleGen_module.cc.

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

Central y position (cm) in world coordinates.

Definition at line 261 of file larg4SingleGen_module.cc.

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

Central z position (cm) in world coordinates.

Definition at line 262 of file larg4SingleGen_module.cc.

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

Definition at line 280 of file larg4SingleGen_module.cc.

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

actual TH1 for momentum distributions

Definition at line 281 of file larg4SingleGen_module.cc.

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

Gaussian distribution.

Definition at line 245 of file larg4SingleGen_module.cc.

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

Distribution from histograms.

Definition at line 246 of file larg4SingleGen_module.cc.

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

One particle per entry is generated.

Definition at line 237 of file larg4SingleGen_module.cc.

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

One particle is generated, extracted from the provided options.

Definition at line 238 of file larg4SingleGen_module.cc.

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

Uniform distribution.

Definition at line 244 of file larg4SingleGen_module.cc.

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

Names of all particle selection modes.

Definition at line 221 of file larg4SingleGen_module.cc.


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