LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
simb::MCTruth Class Reference

Event generator information. More...

#include "MCTruth.h"

Public Member Functions

 MCTruth ()
 
const simb::MCGeneratorInfoGeneratorInfo () const
 
simb::Origin_t Origin () const
 
int NParticles () const
 
const simb::MCParticleGetParticle (int i) const
 
const simb::MCNeutrinoGetNeutrino () const
 
bool NeutrinoSet () const
 
void Add (simb::MCParticle const &part)
 
void Add (simb::MCParticle &&part)
 
void SetGeneratorInfo (simb::Generator_t generator, const std::string &genVersion, const std::unordered_map< std::string, std::string > &genConfig)
 
void SetOrigin (simb::Origin_t origin)
 
void SetNeutrino (int CCNC, int mode, int interactionType, int target, int nucleon, int quark, double w, double x, double y, double qsqr)
 

Private Attributes

std::vector< simb::MCParticlefPartList
 list of particles in this event More...
 
simb::MCNeutrino fMCNeutrino
 reference to neutrino info - null if not a neutrino More...
 
simb::Origin_t fOrigin
 origin for this event More...
 
simb::MCGeneratorInfo fGenInfo
 information about the generator that produced this event More...
 
bool fNeutrinoSet
 flag for whether the neutrino information has been set More...
 

Friends

std::ostream & operator<< (std::ostream &o, simb::MCTruth const &a)
 

Detailed Description

Event generator information.

Definition at line 32 of file MCTruth.h.

Constructor & Destructor Documentation

simb::MCTruth::MCTruth ( )

Definition at line 21 of file MCTruth.cxx.

22  : fPartList()
23  , fMCNeutrino()
25  , fNeutrinoSet(false)
26  {
27  }
std::vector< simb::MCParticle > fPartList
list of particles in this event
Definition: MCTruth.h:38
simb::MCNeutrino fMCNeutrino
reference to neutrino info - null if not a neutrino
Definition: MCTruth.h:39
simb::Origin_t fOrigin
origin for this event
Definition: MCTruth.h:40
bool fNeutrinoSet
flag for whether the neutrino information has been set
Definition: MCTruth.h:42

Member Function Documentation

void simb::MCTruth::Add ( simb::MCParticle &&  part)
inline

Definition at line 81 of file MCTruth.h.

References fPartList, and part.

81 { fPartList.push_back(std::move(part)); }
std::vector< simb::MCParticle > fPartList
list of particles in this event
Definition: MCTruth.h:38
const simb::MCGeneratorInfo & simb::MCTruth::GeneratorInfo ( ) const
inline

Definition at line 73 of file MCTruth.h.

References fGenInfo.

Referenced by sim::dump::DumpMCTruth().

73 { return fGenInfo; }
simb::MCGeneratorInfo fGenInfo
information about the generator that produced this event
Definition: MCTruth.h:41
void simb::MCTruth::SetGeneratorInfo ( simb::Generator_t  generator,
const std::string &  genVersion,
const std::unordered_map< std::string, std::string > &  genConfig 
)
inline

Definition at line 84 of file MCTruth.h.

References fGenInfo.

Referenced by evgb::FillMCTruth().

87 {
88  fGenInfo = simb::MCGeneratorInfo(generator, genVersion, genConfig);
89 }
simb::MCGeneratorInfo fGenInfo
information about the generator that produced this event
Definition: MCTruth.h:41
void simb::MCTruth::SetNeutrino ( int  CCNC,
int  mode,
int  interactionType,
int  target,
int  nucleon,
int  quark,
double  w,
double  x,
double  y,
double  qsqr 
)

Definition at line 30 of file MCTruth.cxx.

References util::abs(), fMCNeutrino, fNeutrinoSet, fPartList, art::errors::LogicError, simb::MCParticle::PdgCode(), and simb::MCParticle::TrackId().

Referenced by evgen::MARLEYHelper::create_MCTruth(), evgb::FillMCTruth(), evgen::NueAr40CCGenerator::ProcessOneNeutrino(), and fluxr::PPFXFluxReader::readNext().

40  {
41  if( !fNeutrinoSet ){
42  fNeutrinoSet = true;
43  // loop over the MCParticle list and get the outgoing lepton
44  // assume this is a neutral current interaction to begin with
45  // which means the outgoing lepton is the incoming neutrino
46  MCParticle nu = fPartList[0];
47  MCParticle lep = fPartList[0];
48 
49  // start at i = 1 because i = 0 is the incoming neutrino
50  for(unsigned int i = 1; i < fPartList.size(); ++i){
51  if(fPartList[i].Mother() == nu.TrackId() &&
52  (fPartList[i].PdgCode() == nu.PdgCode() ||
53  abs(fPartList[i].PdgCode()) == abs(nu.PdgCode())-1) ){
54  lep = fPartList[i];
55  break;
56  }
57  }//done looping over particles
58 
59  fMCNeutrino = simb::MCNeutrino(nu, lep,
60  CCNC, mode, interactionType,
61  target, nucleon, quark,
62  w, x, y, qsqr);
63  } // end if MCNeutrino is not already set
64  else
65  throw art::Exception(art::errors::LogicError) << "MCTruth - attempt to set neutrino when already set";
66  return;
67  }
Float_t x
Definition: compare.C:6
std::vector< simb::MCParticle > fPartList
list of particles in this event
Definition: MCTruth.h:38
Float_t y
Definition: compare.C:6
constexpr auto abs(T v)
Returns the absolute value of the argument.
simb::MCNeutrino fMCNeutrino
reference to neutrino info - null if not a neutrino
Definition: MCTruth.h:39
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
cout<< "-> Edep in the target
Definition: analysis.C:53
bool fNeutrinoSet
flag for whether the neutrino information has been set
Definition: MCTruth.h:42
Event generator information.
Definition: MCNeutrino.h:18
Float_t w
Definition: plot.C:20

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  o,
simb::MCTruth const &  a 
)
friend

Definition at line 70 of file MCTruth.cxx.

71  {
72  if(a.Origin() == kCosmicRay)
73  o << "This is a cosmic ray event" << std::endl;
74  else if(a.Origin() == kBeamNeutrino){
75  o << "This is a beam neutrino event" << std::endl;
76  o << a.GetNeutrino();
77  }
78  else if(a.Origin() == kSuperNovaNeutrino){
79  o << "This is a supernova neutrino event" << std::endl;
80  o << a.GetNeutrino();
81  }
82 
83  for (int i = 0; i < a.NParticles(); ++i)
84  o << i << " " << a.GetParticle(i) << std::endl;
85 
86  return o;
87  }
Supernova neutrinos.
Definition: MCTruth.h:25
Cosmic rays.
Definition: MCTruth.h:24
Beam neutrinos.
Definition: MCTruth.h:23

Member Data Documentation

simb::MCGeneratorInfo simb::MCTruth::fGenInfo
private

information about the generator that produced this event

Definition at line 41 of file MCTruth.h.

Referenced by GeneratorInfo(), and SetGeneratorInfo().

simb::MCNeutrino simb::MCTruth::fMCNeutrino
private

reference to neutrino info - null if not a neutrino

Definition at line 39 of file MCTruth.h.

Referenced by GetNeutrino(), and SetNeutrino().

bool simb::MCTruth::fNeutrinoSet
private

flag for whether the neutrino information has been set

Definition at line 42 of file MCTruth.h.

Referenced by NeutrinoSet(), and SetNeutrino().

simb::Origin_t simb::MCTruth::fOrigin
private

origin for this event

Definition at line 40 of file MCTruth.h.

Referenced by Origin(), and SetOrigin().

std::vector<simb::MCParticle> simb::MCTruth::fPartList
private

list of particles in this event

Definition at line 38 of file MCTruth.h.

Referenced by Add(), GetParticle(), NParticles(), and SetNeutrino().


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