LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
simb::MCTruth Class Reference

Event generator information. More...

#include "MCTruth.h"

Public Member Functions

 MCTruth ()
 
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 &part)
 
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...
 
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 30 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:36
simb::MCNeutrino fMCNeutrino
reference to neutrino info - null if not a neutrino
Definition: MCTruth.h:37
simb::Origin_t fOrigin
origin for this event
Definition: MCTruth.h:38
bool fNeutrinoSet
flag for whether the neutrino information has been set
Definition: MCTruth.h:39

Member Function Documentation

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 fMCNeutrino, fNeutrinoSet, fPartList, art::errors::LogicError, simb::MCParticle::PdgCode(), and simb::MCParticle::TrackId().

Referenced by evgen::MARLEYHelper::create_MCTruth(), evgb::FillMCTruth(), evgb::GENIEHelper::PackMCTruth(), evgen::NueAr40CCGenerator::ProcessOneNeutrino(), and evgen::NUANCEGen::produce().

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:36
cout<< "-> Edep in the target
Definition: analysis.C:54
Float_t y
Definition: compare.C:6
simb::MCNeutrino fMCNeutrino
reference to neutrino info - null if not a neutrino
Definition: MCTruth.h:37
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
bool fNeutrinoSet
flag for whether the neutrino information has been set
Definition: MCTruth.h:39
Event generator information.
Definition: MCNeutrino.h:18
Float_t w
Definition: plot.C:23

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:23
Cosmic rays.
Definition: MCTruth.h:22
Beam neutrinos.
Definition: MCTruth.h:21

Member Data Documentation

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

reference to neutrino info - null if not a neutrino

Definition at line 37 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 39 of file MCTruth.h.

Referenced by NeutrinoSet(), and SetNeutrino().

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

origin for this event

Definition at line 38 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 36 of file MCTruth.h.

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


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