Public Member Functions | Private Attributes | Friends | List of all members
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 const &  part)
inline

Definition at line 80 of file MCTruth.h.

80 { fPartList.push_back(part); }
std::vector< simb::MCParticle > fPartList
list of particles in this event
Definition: MCTruth.h:38
void simb::MCTruth::Add ( simb::MCParticle &&  part)
inline

Definition at line 81 of file MCTruth.h.

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

Definition at line 73 of file MCTruth.h.

73 { return fGenInfo; }
simb::MCGeneratorInfo fGenInfo
information about the generator that produced this event
Definition: MCTruth.h:41
const simb::MCNeutrino & simb::MCTruth::GetNeutrino ( ) const
inline

Definition at line 77 of file MCTruth.h.

77 { return fMCNeutrino; }
simb::MCNeutrino fMCNeutrino
reference to neutrino info - null if not a neutrino
Definition: MCTruth.h:39
const simb::MCParticle & simb::MCTruth::GetParticle ( int  i) const
inline

Definition at line 76 of file MCTruth.h.

76 { return fPartList[i]; }
std::vector< simb::MCParticle > fPartList
list of particles in this event
Definition: MCTruth.h:38
bool simb::MCTruth::NeutrinoSet ( ) const
inline

Definition at line 78 of file MCTruth.h.

78 { return fNeutrinoSet; }
bool fNeutrinoSet
flag for whether the neutrino information has been set
Definition: MCTruth.h:42
int simb::MCTruth::NParticles ( ) const
inline

Definition at line 75 of file MCTruth.h.

75 { return (int)fPartList.size(); }
std::vector< simb::MCParticle > fPartList
list of particles in this event
Definition: MCTruth.h:38
simb::Origin_t simb::MCTruth::Origin ( ) const
inline

Definition at line 74 of file MCTruth.h.

74 { return fOrigin; }
simb::Origin_t fOrigin
origin for this event
Definition: MCTruth.h:40
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.

87 {
88  fGenInfo = simb::MCGeneratorInfo(generator, genVersion, genConfig);
89 }
simb::MCGeneratorInfo fGenInfo
information about the generator that produced this event
Definition: MCTruth.h:41
generator
Definition: train.py:468
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.

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  }
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
T abs(T value)
int PdgCode(Resonance_t res, int Q)
(resonance id, charge) -> PDG code
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
list x
Definition: train.py:276
bool fNeutrinoSet
flag for whether the neutrino information has been set
Definition: MCTruth.h:42
Event generator information.
Definition: MCNeutrino.h:18
void simb::MCTruth::SetOrigin ( simb::Origin_t  origin)
inline

Definition at line 82 of file MCTruth.h.

82 { fOrigin = origin; }
simb::Origin_t fOrigin
origin for this event
Definition: MCTruth.h:40
constexpr Point origin()
Returns a origin position with a point of the specified type.
Definition: geo_vectors.h:227

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  }
const double a
Supernova neutrinos.
Definition: MCTruth.h:25
Cosmic rays.
Definition: MCTruth.h:24
QTextStream & endl(QTextStream &s)
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.

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

reference to neutrino info - null if not a neutrino

Definition at line 39 of file MCTruth.h.

bool simb::MCTruth::fNeutrinoSet
private

flag for whether the neutrino information has been set

Definition at line 42 of file MCTruth.h.

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

origin for this event

Definition at line 40 of file MCTruth.h.

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

list of particles in this event

Definition at line 38 of file MCTruth.h.


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