Public Member Functions | Private Member Functions | Private Attributes | List of all members
garana::StructuredG4Tree Class Reference

#include <StructuredG4Tree.h>

Inheritance diagram for garana::StructuredG4Tree:
garana::G4Tree garana::TreeReader

Public Member Functions

 StructuredG4Tree (TTree *tree=0)
 
const UInt_t NSim () const override
 number of particles More...
 
const UInt_t NPoints (const UInt_t &iparticle) const override
 number of G4 steps (i.e. trajectory points) More...
 
const UInt_t NRegions (const UInt_t &iparticle) const override
 number of regions traversed by particle More...
 
const Int_t Region (const UInt_t &iparticle, const UInt_t &iregion) const override
 region number More...
 
const vector< const TLorentzVector * > * SimMomEnter (const UInt_t &iparticle) const override
 particle 4-momentum at entry point, all regions More...
 
const vector< const TLorentzVector * > * SimMomExit (const UInt_t &iparticle) const override
 particle 4-momentum at exit point, all regions More...
 
const vector< const TLorentzVector * > * SimPosEnter (const UInt_t &iparticle) const override
 particle 4-position at entry point, all regions More...
 
const vector< const TLorentzVector * > * SimPosExit (const UInt_t &iparticle) const override
 particle 4-position at exit point, all regions More...
 
const TLorentzVector * SimMomEnter (const UInt_t &iparticle, const UInt_t &iregion) const override
 particle 4-momentum at entry point in region More...
 
const TLorentzVector * SimMomExit (const UInt_t &iparticle, const UInt_t &iregion) const override
 particle 4-momentum at exit point in region More...
 
const TLorentzVector * SimPosEnter (const UInt_t &iparticle, const UInt_t &iregion) const override
 particle 4-position at entry point in region More...
 
const TLorentzVector * SimPosExit (const UInt_t &iparticle, const UInt_t &iregion) const override
 particle 4-position at exit point in region More...
 
const bool IsPrimary (const UInt_t &iparticle) const override
 did particle come from generator? More...
 
const Int_t PDG (const UInt_t &iparticle) const override
 particle PDG code More...
 
const int ParentPDG (const UInt_t &iparticle) const override
 parent particle's PDG code More...
 
const int ProgenitorPDG (const UInt_t &iparticle) const override
 PDG of primary that led this one. More...
 
const int TrackID (const UInt_t &iparticle) const override
 G4 track ID (can be <0 if it fell below trking threshold) More...
 
const int ParentTrackID (const UInt_t &iparticle) const override
 G4 track ID of parent particle. More...
 
const int ProgenitorTrackID (const UInt_t &iparticle) const override
 G4 track ID of primary that led this one. More...
 
const Int_t ProcessI (const UInt_t &iparticle) const override
 code for process that created this one More...
 
const Int_t ProcessF (const UInt_t &iparticle) const override
 code for process that killed this one More...
 
const G4ParticleGetParticle (const UInt_t &iparticle) const
 
- Public Member Functions inherited from garana::G4Tree
virtual ~G4Tree ()
 
UInt_t const GetTruthIndex (UInt_t iparticle) const
 index in gen tree subentry to truth match to this More...
 
const UInt_t NPrimary () const
 
bool HasPassedTPC (const UInt_t &iparticle) const
 did the G4Particle pass through any TPC drift volume(s)? More...
 
bool HasPassedCalo (const UInt_t &iparticle) const
 did the G4Particle pass through any active ECal volume(s)? More...
 
bool IsStoppedTPC (const UInt_t &iparticle) const
 did the G4Particle stop/decay in any TPC drift volume(s)? More...
 
bool IsStoppedCalo (const UInt_t &iparticle) const
 did the G4Particle stop/decay in any active ECal volume(s)? More...
 
bool IsContainedTPC (const UInt_t &iparticle) const
 if the G4Particle was produced in any TPC drift volume, does it remain in either drift volume? More...
 
bool IsContainedCalo (const UInt_t &iparticle) const
 if the G4Particle was produced in any active ECal volume, does it remain there? More...
 
bool IsCathodeCrosser (const UInt_t &iparticle) const
 did the G4Particle cross the TPC central cathode? More...
 
bool IsContainedTPCEvent () const
 do all particles produced in any TPC drift volume in this event remain in either volume? More...
 
bool IsContainedTPCPrimaries () const
 do all primaries produced in any TPC drift volume in this event remain in either volume? More...
 
bool IsContainedCaloEvent () const
 do all particles produced in any active ECal volume in this event remain there? More...
 
bool IsContainedCaloPrimaries () const
 do all primaries produced in any active ECal volume in this event remain there? More...
 
const TLorentzVector * SimMomBegin (const UInt_t &iparticle) const
 
const TLorentzVector * SimMomEnd (const UInt_t &iparticle) const
 
const TLorentzVector * SimPosBegin (const UInt_t &iparticle) const
 
const TLorentzVector * SimPosEnd (const UInt_t &iparticle) const
 
- Public Member Functions inherited from garana::TreeReader
virtual ~TreeReader ()
 
void SetupRead (TTree *tree)
 
TTree * GetInputTree ()
 
size_t NEntries () const
 
virtual void GetEntry (const UInt_t &ientry)
 
Int_t Event () const
 
const TObjArray * GetBranchList () const
 
void Fill ()
 
void Write ()
 
void CheckOpt (char opt)
 
bool BlockWrite () const
 

Private Member Functions

bool SetBranchAddresses () override
 

Private Attributes

vector< G4Particle > * fG4Particles = nullptr
 'condensed' nusimdata::MCParticles from G4 More...
 
TBranch * b_G4Particles = nullptr
 

Additional Inherited Members

- Protected Attributes inherited from garana::G4Tree
vector< UInt_t > * fG4TruthIndex = nullptr
 
vector< UInt_t > * fG4FSIndex = nullptr
 
TBranch * b_G4TruthIndex = nullptr
 
TBranch * b_G4FSIndex = nullptr
 
- Protected Attributes inherited from garana::TreeReader
const std::string treename
 
char fOpt = 'r'
 
TTree * fTreeIn = nullptr
 pointer to the analyzed TTree or TChain More...
 
UInt_t fCurrentEntry = UINT_MAX
 
TBranch * b_Event = nullptr
 
Int_t fEvent = -1
 event number for tree entry More...
 

Detailed Description

Definition at line 18 of file StructuredG4Tree.h.

Constructor & Destructor Documentation

StructuredG4Tree::StructuredG4Tree ( TTree *  tree = 0)

Definition at line 13 of file StructuredG4Tree.cxx.

13  {
14 
15  SetupRead(tree); //initialize tree pointer in TreeReader instance and set branch address
16 }//
void SetupRead(TTree *tree)
Definition: TreeReader.cxx:6

Member Function Documentation

const G4Particle * StructuredG4Tree::GetParticle ( const UInt_t &  iparticle) const

Definition at line 37 of file StructuredG4Tree.cxx.

37  {
38 
39  try {
40  if(iparticle<NSim())
41  return &(this->fG4Particles->at(iparticle));
42  else
43  throw iparticle;
44  }
45  catch(UInt_t iparticle){
46  std::cerr << "ERROR(StructuredG4Tree::GetParticle): index out of bounds (NSim ="
47  << NSim() << " vs. requested index = " << iparticle << ")" << std::endl;
48  }
49  return nullptr;
50 
51 }//
const UInt_t NSim() const override
number of particles
vector< G4Particle > * fG4Particles
&#39;condensed&#39; nusimdata::MCParticles from G4
QTextStream & endl(QTextStream &s)
const bool StructuredG4Tree::IsPrimary ( const UInt_t &  iparticle) const
overridevirtual

did particle come from generator?

Implements garana::G4Tree.

Definition at line 28 of file StructuredG4Tree.cxx.

28  {
29  if(GetParticle(iparticle)->ParentPDG()==INT_MAX) return true;
30  else return false;
31 }
const int ParentPDG(const UInt_t &iparticle) const override
parent particle&#39;s PDG code
const G4Particle * GetParticle(const UInt_t &iparticle) const
const UInt_t StructuredG4Tree::NPoints ( const UInt_t &  iparticle) const
overridevirtual

number of G4 steps (i.e. trajectory points)

Implements garana::G4Tree.

Definition at line 67 of file StructuredG4Tree.cxx.

67  {
68  return GetParticle(iparticle)->NPoints();
69 }//
int const & NPoints() const
Definition: G4Particle.h:50
const G4Particle * GetParticle(const UInt_t &iparticle) const
const UInt_t StructuredG4Tree::NRegions ( const UInt_t &  iparticle) const
overridevirtual

number of regions traversed by particle

Implements garana::G4Tree.

Definition at line 71 of file StructuredG4Tree.cxx.

71  {
72  return GetParticle(iparticle)->NRegions();
73 }
size_t NRegions() const
Definition: G4Particle.h:65
const G4Particle * GetParticle(const UInt_t &iparticle) const
const UInt_t StructuredG4Tree::NSim ( ) const
overridevirtual

number of particles

Implements garana::G4Tree.

Definition at line 63 of file StructuredG4Tree.cxx.

63  {
64  return fG4Particles->size();
65 }//
vector< G4Particle > * fG4Particles
&#39;condensed&#39; nusimdata::MCParticles from G4
const int StructuredG4Tree::ParentPDG ( const UInt_t &  iparticle) const
overridevirtual

parent particle's PDG code

Implements garana::G4Tree.

Definition at line 125 of file StructuredG4Tree.cxx.

125  {
126  return GetParticle(iparticle)->ParentPDG();
127 }//
int const & ParentPDG() const
Definition: G4Particle.h:52
const G4Particle * GetParticle(const UInt_t &iparticle) const
const int StructuredG4Tree::ParentTrackID ( const UInt_t &  iparticle) const
overridevirtual

G4 track ID of parent particle.

Implements garana::G4Tree.

Definition at line 137 of file StructuredG4Tree.cxx.

137  {
138  return GetParticle(iparticle)->ParentTrackID();
139 }//
int const & ParentTrackID() const
Definition: G4Particle.h:55
const G4Particle * GetParticle(const UInt_t &iparticle) const
const Int_t StructuredG4Tree::PDG ( const UInt_t &  iparticle) const
overridevirtual

particle PDG code

Implements garana::G4Tree.

Definition at line 33 of file StructuredG4Tree.cxx.

33  {
34  return GetParticle(iparticle)->PDG();
35 }
int const & PDG() const
Definition: G4Particle.h:51
const G4Particle * GetParticle(const UInt_t &iparticle) const
const Int_t StructuredG4Tree::ProcessF ( const UInt_t &  iparticle) const
overridevirtual

code for process that killed this one

Implements garana::G4Tree.

Definition at line 149 of file StructuredG4Tree.cxx.

149  {
150  return GetParticle(iparticle)->ProcessF();
151 }//
int const & ProcessF() const
Definition: G4Particle.h:58
const G4Particle * GetParticle(const UInt_t &iparticle) const
const Int_t StructuredG4Tree::ProcessI ( const UInt_t &  iparticle) const
overridevirtual

code for process that created this one

Implements garana::G4Tree.

Definition at line 145 of file StructuredG4Tree.cxx.

145  {
146  return GetParticle(iparticle)->ProcessI();
147 }//
int const & ProcessI() const
Definition: G4Particle.h:57
const G4Particle * GetParticle(const UInt_t &iparticle) const
const int StructuredG4Tree::ProgenitorPDG ( const UInt_t &  iparticle) const
overridevirtual

PDG of primary that led this one.

Implements garana::G4Tree.

Definition at line 129 of file StructuredG4Tree.cxx.

129  {
130  return GetParticle(iparticle)->ProgenitorPDG();
131 }//
const G4Particle * GetParticle(const UInt_t &iparticle) const
int const & ProgenitorPDG() const
Definition: G4Particle.h:53
const int StructuredG4Tree::ProgenitorTrackID ( const UInt_t &  iparticle) const
overridevirtual

G4 track ID of primary that led this one.

Implements garana::G4Tree.

Definition at line 141 of file StructuredG4Tree.cxx.

141  {
142  return GetParticle(iparticle)->ProgenitorTrackID();
143 }//
const G4Particle * GetParticle(const UInt_t &iparticle) const
int const & ProgenitorTrackID() const
Definition: G4Particle.h:56
const Int_t StructuredG4Tree::Region ( const UInt_t &  iparticle,
const UInt_t &  iregion 
) const
overridevirtual

region number

Implements garana::G4Tree.

Definition at line 74 of file StructuredG4Tree.cxx.

74  {
75  return GetParticle(iparticle)->Region(iregion);
76 }
int Region(const size_t &iregion) const
Definition: G4Particle.h:63
const G4Particle * GetParticle(const UInt_t &iparticle) const
bool StructuredG4Tree::SetBranchAddresses ( )
overrideprivatevirtual

Implements garana::TreeReader.

Definition at line 18 of file StructuredG4Tree.cxx.

18  {
19 
20  fTreeIn->SetBranchAddress("Event", &fEvent, &b_Event );
21  fTreeIn->SetBranchAddress("TruthIndex", &fG4TruthIndex, &b_G4TruthIndex);
22  //fTreeIn->SetBranchAddress("FSIndex", &fG4FSIndex, &b_G4FSIndex);
23  fTreeIn->SetBranchAddress("G4Particles", &fG4Particles, &b_G4Particles );
24 
25  return true;
26 }//
TTree * fTreeIn
pointer to the analyzed TTree or TChain
Definition: TreeReader.h:51
vector< UInt_t > * fG4TruthIndex
Definition: G4Tree.h:71
vector< G4Particle > * fG4Particles
&#39;condensed&#39; nusimdata::MCParticles from G4
TBranch * b_G4TruthIndex
Definition: G4Tree.h:73
TBranch * b_Event
Definition: TreeReader.h:54
Int_t fEvent
event number for tree entry
Definition: TreeReader.h:55
const vector< const TLorentzVector * > * StructuredG4Tree::SimMomEnter ( const UInt_t &  iparticle) const
overridevirtual

particle 4-momentum at entry point, all regions

Implements garana::G4Tree.

Definition at line 77 of file StructuredG4Tree.cxx.

77  {
78  auto v = new vector<const TLorentzVector*>();
79  for(size_t ireg=0; ireg<NRegions(iparticle); ireg++){
80  v->push_back(GetParticle(iparticle)->MomentumEnter(ireg));
81  }
82 
83  return v;
84 }
const UInt_t NRegions(const UInt_t &iparticle) const override
number of regions traversed by particle
const G4Particle * GetParticle(const UInt_t &iparticle) const
const TLorentzVector * StructuredG4Tree::SimMomEnter ( const UInt_t &  iparticle,
const UInt_t &  iregion 
) const
overridevirtual

particle 4-momentum at entry point in region

Implements garana::G4Tree.

Definition at line 110 of file StructuredG4Tree.cxx.

110  {
111  return GetParticle(iparticle)->MomentumEnter(iregion);
112 }
const TLorentzVector * MomentumEnter(const size_t &iregion) const
Definition: G4Particle.h:61
const G4Particle * GetParticle(const UInt_t &iparticle) const
const vector< const TLorentzVector * > * StructuredG4Tree::SimMomExit ( const UInt_t &  iparticle) const
overridevirtual

particle 4-momentum at exit point, all regions

Implements garana::G4Tree.

Definition at line 85 of file StructuredG4Tree.cxx.

85  {
86  auto v = new vector<const TLorentzVector*>();
87  for(size_t ireg=0; ireg<NRegions(iparticle); ireg++){
88  v->push_back(GetParticle(iparticle)->MomentumExit(ireg));
89  }
90 
91  return v;
92 }
const UInt_t NRegions(const UInt_t &iparticle) const override
number of regions traversed by particle
const G4Particle * GetParticle(const UInt_t &iparticle) const
const TLorentzVector * StructuredG4Tree::SimMomExit ( const UInt_t &  iparticle,
const UInt_t &  iregion 
) const
overridevirtual

particle 4-momentum at exit point in region

Implements garana::G4Tree.

Definition at line 114 of file StructuredG4Tree.cxx.

114  {
115  return GetParticle(iparticle)->MomentumExit(iregion);
116 }
const TLorentzVector * MomentumExit(const size_t &iregion) const
Definition: G4Particle.h:62
const G4Particle * GetParticle(const UInt_t &iparticle) const
const vector< const TLorentzVector * > * StructuredG4Tree::SimPosEnter ( const UInt_t &  iparticle) const
overridevirtual

particle 4-position at entry point, all regions

Implements garana::G4Tree.

Definition at line 93 of file StructuredG4Tree.cxx.

93  {
94  auto v = new vector<const TLorentzVector*>();
95  for(size_t ireg=0; ireg<NRegions(iparticle); ireg++){
96  v->push_back(GetParticle(iparticle)->PositionEnter(ireg));
97  }
98 
99  return v;
100 }
const UInt_t NRegions(const UInt_t &iparticle) const override
number of regions traversed by particle
const G4Particle * GetParticle(const UInt_t &iparticle) const
const TLorentzVector * StructuredG4Tree::SimPosEnter ( const UInt_t &  iparticle,
const UInt_t &  iregion 
) const
overridevirtual

particle 4-position at entry point in region

Implements garana::G4Tree.

Definition at line 118 of file StructuredG4Tree.cxx.

118  {
119  return GetParticle(iparticle)->PositionEnter(iregion);
120 }
const TLorentzVector * PositionEnter(const size_t &iregion) const
Definition: G4Particle.h:59
const G4Particle * GetParticle(const UInt_t &iparticle) const
const vector< const TLorentzVector * > * StructuredG4Tree::SimPosExit ( const UInt_t &  iparticle) const
overridevirtual

particle 4-position at exit point, all regions

Implements garana::G4Tree.

Definition at line 101 of file StructuredG4Tree.cxx.

101  {
102  auto v = new vector<const TLorentzVector*>();
103  for(size_t ireg=0; ireg<NRegions(iparticle); ireg++){
104  v->push_back(GetParticle(iparticle)->PositionExit(ireg));
105  }
106 
107  return v;
108 }
const UInt_t NRegions(const UInt_t &iparticle) const override
number of regions traversed by particle
const G4Particle * GetParticle(const UInt_t &iparticle) const
const TLorentzVector * StructuredG4Tree::SimPosExit ( const UInt_t &  iparticle,
const UInt_t &  iregion 
) const
overridevirtual

particle 4-position at exit point in region

Implements garana::G4Tree.

Definition at line 121 of file StructuredG4Tree.cxx.

121  {
122  return GetParticle(iparticle)->PositionExit(iregion);
123 }
const TLorentzVector * PositionExit(const size_t &iregion) const
Definition: G4Particle.h:60
const G4Particle * GetParticle(const UInt_t &iparticle) const
const int StructuredG4Tree::TrackID ( const UInt_t &  iparticle) const
overridevirtual

G4 track ID (can be <0 if it fell below trking threshold)

Implements garana::G4Tree.

Definition at line 133 of file StructuredG4Tree.cxx.

133  {
134  return GetParticle(iparticle)->TrackID();
135 }//
int const & TrackID() const
Definition: G4Particle.h:54
const G4Particle * GetParticle(const UInt_t &iparticle) const

Member Data Documentation

TBranch* garana::StructuredG4Tree::b_G4Particles = nullptr
private

Definition at line 59 of file StructuredG4Tree.h.

vector<G4Particle>* garana::StructuredG4Tree::fG4Particles = nullptr
private

'condensed' nusimdata::MCParticles from G4

Definition at line 58 of file StructuredG4Tree.h.


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