Public Member Functions | Protected Attributes | List of all members
garana::G4Tree Class Referenceabstract

#include <G4Tree.h>

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

Public Member Functions

virtual ~G4Tree ()
 
virtual const UInt_t NSim () const =0
 number of particles More...
 
virtual const UInt_t NPoints (const UInt_t &iparticle) const =0
 number of G4 steps (i.e. trajectory points) More...
 
virtual const UInt_t NRegions (const UInt_t &iparticle) const =0
 number of regions traversed by particle More...
 
virtual const Int_t Region (const UInt_t &iparticle, const UInt_t &iregion) const =0
 region number More...
 
virtual const vector< const TLorentzVector * > * SimMomEnter (const UInt_t &iparticle) const =0
 particle 4-momentum at entry point, all regions More...
 
virtual const vector< const TLorentzVector * > * SimMomExit (const UInt_t &iparticle) const =0
 particle 4-momentum at exit point, all regions More...
 
virtual const vector< const TLorentzVector * > * SimPosEnter (const UInt_t &iparticle) const =0
 particle 4-position at entry point, all regions More...
 
virtual const vector< const TLorentzVector * > * SimPosExit (const UInt_t &iparticle) const =0
 particle 4-position at exit point, all regions More...
 
virtual const TLorentzVector * SimMomEnter (const UInt_t &iparticle, const UInt_t &iregion) const =0
 particle 4-momentum at entry point in region More...
 
virtual const TLorentzVector * SimMomExit (const UInt_t &iparticle, const UInt_t &iregion) const =0
 particle 4-momentum at exit point in region More...
 
virtual const TLorentzVector * SimPosEnter (const UInt_t &iparticle, const UInt_t &iregion) const =0
 particle 4-position at entry point in region More...
 
virtual const TLorentzVector * SimPosExit (const UInt_t &iparticle, const UInt_t &iregion) const =0
 particle 4-position at exit point in region More...
 
virtual const bool IsPrimary (const UInt_t &iparticle) const =0
 did particle come from generator? More...
 
virtual const Int_t PDG (const UInt_t &iparticle) const =0
 particle PDG code More...
 
virtual const int ParentPDG (const UInt_t &iparticle) const =0
 parent particle's PDG code More...
 
virtual const int ProgenitorPDG (const UInt_t &iparticle) const =0
 PDG of primary that led this one. More...
 
virtual const int TrackID (const UInt_t &iparticle) const =0
 G4 track ID (can be <0 if it fell below trking threshold) More...
 
virtual const int ParentTrackID (const UInt_t &iparticle) const =0
 G4 track ID of parent particle. More...
 
virtual const int ProgenitorTrackID (const UInt_t &iparticle) const =0
 G4 track ID of primary that led this one. More...
 
virtual const Int_t ProcessI (const UInt_t &iparticle) const =0
 code for process that created this one More...
 
virtual const Int_t ProcessF (const UInt_t &iparticle) const =0
 code for process that killed this one More...
 
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
 
virtual bool SetBranchAddresses ()=0
 

Protected Attributes

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 17 of file G4Tree.h.

Constructor & Destructor Documentation

virtual garana::G4Tree::~G4Tree ( )
inlinevirtual

Definition at line 22 of file G4Tree.h.

22 {};

Member Function Documentation

const UInt_t G4Tree::GetTruthIndex ( UInt_t  iparticle) const

index in gen tree subentry to truth match to this

Definition at line 12 of file G4Tree.cxx.

12  {
13  try {
14  if(iparticle < fG4TruthIndex->size())
15  return fG4TruthIndex->at(iparticle);
16 
17  throw(iparticle);
18  }
19  catch(UInt_t index){
20  std::cerr << "G4TruthIndex out of range ("
21  << iparticle << " vs. " << fG4TruthIndex->size()
22  << std::endl;
23  return UINT_MAX;
24  }
25 }
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
vector< UInt_t > * fG4TruthIndex
Definition: G4Tree.h:71
QTextStream & endl(QTextStream &s)
bool G4Tree::HasPassedCalo ( const UInt_t &  iparticle) const

did the G4Particle pass through any active ECal volume(s)?

Definition at line 47 of file G4Tree.cxx.

47  {
48 
49  for(size_t ireg=0; ireg<this->NRegions(iparticle); ireg++) {
50  if(this->Region(iparticle,ireg)==3 || this->Region(iparticle,ireg)==4) {
51  return true;
52  }
53  }
54 
55  return false;
56 }
virtual const UInt_t NRegions(const UInt_t &iparticle) const =0
number of regions traversed by particle
virtual const Int_t Region(const UInt_t &iparticle, const UInt_t &iregion) const =0
region number
bool G4Tree::HasPassedTPC ( const UInt_t &  iparticle) const

did the G4Particle pass through any TPC drift volume(s)?

Definition at line 36 of file G4Tree.cxx.

36  {
37 
38  for(size_t ireg=0; ireg<this->NRegions(iparticle); ireg++) {
39  if(this->Region(iparticle,ireg)==0 || this->Region(iparticle,ireg)==1) {
40  return true;
41  }
42  }
43 
44  return false;
45 }
virtual const UInt_t NRegions(const UInt_t &iparticle) const =0
number of regions traversed by particle
virtual const Int_t Region(const UInt_t &iparticle, const UInt_t &iregion) const =0
region number
bool G4Tree::IsCathodeCrosser ( const UInt_t &  iparticle) const

did the G4Particle cross the TPC central cathode?

Definition at line 107 of file G4Tree.cxx.

107  {
108 
109  if(this->NRegions(iparticle)<2)
110  return false;
111 
112  for(size_t ireg=0; ireg<this->NRegions(iparticle)-1; ireg++) {
113 
114  if( (this->Region(iparticle,ireg)==0 && this->Region(iparticle,ireg+1)==1) ||
115  (this->Region(iparticle,ireg)==1 && this->Region(iparticle,ireg+1)==0) )
116  return true;
117  }
118 
119  return false;
120 }
virtual const UInt_t NRegions(const UInt_t &iparticle) const =0
number of regions traversed by particle
virtual const Int_t Region(const UInt_t &iparticle, const UInt_t &iregion) const =0
region number
bool G4Tree::IsContainedCalo ( const UInt_t &  iparticle) const

if the G4Particle was produced in any active ECal volume, does it remain there?

Definition at line 90 of file G4Tree.cxx.

90  {
91 
92  bool isCalo = false;
93  for(size_t ireg=0; ireg<this->NRegions(iparticle); ireg++) {
94  if(this->Region(iparticle,ireg)!=3 && this->Region(iparticle,ireg)!=4)
95  return false;
96  else
97  isCalo = true;
98  }
99 
100  if(isCalo)
101  return true;
102  else
103  return false;
104 
105 }
virtual const UInt_t NRegions(const UInt_t &iparticle) const =0
number of regions traversed by particle
virtual const Int_t Region(const UInt_t &iparticle, const UInt_t &iregion) const =0
region number
bool G4Tree::IsContainedCaloEvent ( ) const

do all particles produced in any active ECal volume in this event remain there?

Definition at line 145 of file G4Tree.cxx.

145  {
146 
147  for(size_t isim=0; isim<this->NSim(); isim++){
148  if(this->HasPassedCalo(isim))
149  if(!this->IsContainedCalo(isim))
150  return false;
151  }
152 
153  return true;
154 }
virtual const UInt_t NSim() const =0
number of particles
bool HasPassedCalo(const UInt_t &iparticle) const
did the G4Particle pass through any active ECal volume(s)?
Definition: G4Tree.cxx:47
bool IsContainedCalo(const UInt_t &iparticle) const
if the G4Particle was produced in any active ECal volume, does it remain there?
Definition: G4Tree.cxx:90
bool G4Tree::IsContainedCaloPrimaries ( ) const

do all primaries produced in any active ECal volume in this event remain there?

Definition at line 156 of file G4Tree.cxx.

156  {
157 
158  for(size_t isim=0; isim<this->NSim(); isim++){
159  if(this->HasPassedCalo(isim))
160  if(this->IsPrimary(isim))
161  if(!this->IsContainedCalo(isim))
162  return false;
163  }
164 
165  return true;
166 
167 }
virtual const UInt_t NSim() const =0
number of particles
bool HasPassedCalo(const UInt_t &iparticle) const
did the G4Particle pass through any active ECal volume(s)?
Definition: G4Tree.cxx:47
virtual const bool IsPrimary(const UInt_t &iparticle) const =0
did particle come from generator?
bool IsContainedCalo(const UInt_t &iparticle) const
if the G4Particle was produced in any active ECal volume, does it remain there?
Definition: G4Tree.cxx:90
bool G4Tree::IsContainedTPC ( const UInt_t &  iparticle) const

if the G4Particle was produced in any TPC drift volume, does it remain in either drift volume?

Definition at line 74 of file G4Tree.cxx.

74  {
75 
76  bool isAV = false;
77  for(size_t ireg=0; ireg<this->NRegions(iparticle); ireg++) {
78  if(this->Region(iparticle,ireg)!=0 && this->Region(iparticle,ireg)!=1)
79  return false;
80  else
81  isAV = true;
82  }
83 
84  if(isAV)
85  return true;
86  else
87  return false;
88 }
virtual const UInt_t NRegions(const UInt_t &iparticle) const =0
number of regions traversed by particle
virtual const Int_t Region(const UInt_t &iparticle, const UInt_t &iregion) const =0
region number
bool G4Tree::IsContainedTPCEvent ( ) const

do all particles produced in any TPC drift volume in this event remain in either volume?

Definition at line 122 of file G4Tree.cxx.

122  {
123 
124  for(size_t isim=0; isim<this->NSim(); isim++){
125  if(this->HasPassedTPC(isim))
126  if(!this->IsContainedTPC(isim))
127  return false;
128  }
129 
130  return true;
131 }
virtual const UInt_t NSim() const =0
number of particles
bool HasPassedTPC(const UInt_t &iparticle) const
did the G4Particle pass through any TPC drift volume(s)?
Definition: G4Tree.cxx:36
bool IsContainedTPC(const UInt_t &iparticle) const
if the G4Particle was produced in any TPC drift volume, does it remain in either drift volume...
Definition: G4Tree.cxx:74
bool G4Tree::IsContainedTPCPrimaries ( ) const

do all primaries produced in any TPC drift volume in this event remain in either volume?

Definition at line 133 of file G4Tree.cxx.

133  {
134 
135  for(size_t isim=0; isim<this->NSim(); isim++){
136  if(this->HasPassedTPC(isim))
137  if(this->IsPrimary(isim))
138  if(!this->IsContainedTPC(isim))
139  return false;
140  }
141 
142  return true;
143 }
virtual const UInt_t NSim() const =0
number of particles
virtual const bool IsPrimary(const UInt_t &iparticle) const =0
did particle come from generator?
bool HasPassedTPC(const UInt_t &iparticle) const
did the G4Particle pass through any TPC drift volume(s)?
Definition: G4Tree.cxx:36
bool IsContainedTPC(const UInt_t &iparticle) const
if the G4Particle was produced in any TPC drift volume, does it remain in either drift volume...
Definition: G4Tree.cxx:74
virtual const bool garana::G4Tree::IsPrimary ( const UInt_t &  iparticle) const
pure virtual

did particle come from generator?

Implemented in garana::FlatG4Tree, and garana::StructuredG4Tree.

bool G4Tree::IsStoppedCalo ( const UInt_t &  iparticle) const

did the G4Particle stop/decay in any active ECal volume(s)?

Definition at line 66 of file G4Tree.cxx.

66  {
67  UInt_t ireg = this->NRegions(iparticle)-1;
68  if(this->Region(iparticle,ireg)==3 || this->Region(iparticle,ireg)==4)
69  return true;
70  else
71  return false;
72 }
virtual const UInt_t NRegions(const UInt_t &iparticle) const =0
number of regions traversed by particle
virtual const Int_t Region(const UInt_t &iparticle, const UInt_t &iregion) const =0
region number
bool G4Tree::IsStoppedTPC ( const UInt_t &  iparticle) const

did the G4Particle stop/decay in any TPC drift volume(s)?

Definition at line 58 of file G4Tree.cxx.

58  {
59  UInt_t ireg = this->NRegions(iparticle)-1;
60  if(this->Region(iparticle,ireg)==0 || this->Region(iparticle,ireg)==1)
61  return true;
62  else
63  return false;
64 }
virtual const UInt_t NRegions(const UInt_t &iparticle) const =0
number of regions traversed by particle
virtual const Int_t Region(const UInt_t &iparticle, const UInt_t &iregion) const =0
region number
virtual const UInt_t garana::G4Tree::NPoints ( const UInt_t &  iparticle) const
pure virtual

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

Implemented in garana::FlatG4Tree, and garana::StructuredG4Tree.

const UInt_t G4Tree::NPrimary ( ) const

Definition at line 27 of file G4Tree.cxx.

27  {
28 
29  UInt_t nprimary=0;
30  while(nprimary<this->NSim() && this->IsPrimary(nprimary))
31  nprimary++;
32 
33  return nprimary;
34 }
virtual const UInt_t NSim() const =0
number of particles
virtual const bool IsPrimary(const UInt_t &iparticle) const =0
did particle come from generator?
virtual const UInt_t garana::G4Tree::NRegions ( const UInt_t &  iparticle) const
pure virtual

number of regions traversed by particle

Implemented in garana::FlatG4Tree, and garana::StructuredG4Tree.

virtual const UInt_t garana::G4Tree::NSim ( ) const
pure virtual

number of particles

Implemented in garana::FlatG4Tree, and garana::StructuredG4Tree.

virtual const int garana::G4Tree::ParentPDG ( const UInt_t &  iparticle) const
pure virtual

parent particle's PDG code

Implemented in garana::FlatG4Tree, and garana::StructuredG4Tree.

virtual const int garana::G4Tree::ParentTrackID ( const UInt_t &  iparticle) const
pure virtual

G4 track ID of parent particle.

Implemented in garana::FlatG4Tree, and garana::StructuredG4Tree.

virtual const Int_t garana::G4Tree::PDG ( const UInt_t &  iparticle) const
pure virtual

particle PDG code

Implemented in garana::FlatG4Tree, and garana::StructuredG4Tree.

virtual const Int_t garana::G4Tree::ProcessF ( const UInt_t &  iparticle) const
pure virtual

code for process that killed this one

Implemented in garana::FlatG4Tree, and garana::StructuredG4Tree.

virtual const Int_t garana::G4Tree::ProcessI ( const UInt_t &  iparticle) const
pure virtual

code for process that created this one

Implemented in garana::FlatG4Tree, and garana::StructuredG4Tree.

virtual const int garana::G4Tree::ProgenitorPDG ( const UInt_t &  iparticle) const
pure virtual

PDG of primary that led this one.

Implemented in garana::FlatG4Tree, and garana::StructuredG4Tree.

virtual const int garana::G4Tree::ProgenitorTrackID ( const UInt_t &  iparticle) const
pure virtual

G4 track ID of primary that led this one.

Implemented in garana::FlatG4Tree, and garana::StructuredG4Tree.

virtual const Int_t garana::G4Tree::Region ( const UInt_t &  iparticle,
const UInt_t &  iregion 
) const
pure virtual

region number

Implemented in garana::FlatG4Tree, and garana::StructuredG4Tree.

const TLorentzVector * G4Tree::SimMomBegin ( const UInt_t &  iparticle) const

Definition at line 169 of file G4Tree.cxx.

169  {
170  return this->SimMomEnter(iparticle,0);
171 }
virtual const vector< const TLorentzVector * > * SimMomEnter(const UInt_t &iparticle) const =0
particle 4-momentum at entry point, all regions
const TLorentzVector * G4Tree::SimMomEnd ( const UInt_t &  iparticle) const

Definition at line 173 of file G4Tree.cxx.

173  {
174  return this->SimMomExit(iparticle,this->NRegions(iparticle)-1);
175 }
virtual const UInt_t NRegions(const UInt_t &iparticle) const =0
number of regions traversed by particle
virtual const vector< const TLorentzVector * > * SimMomExit(const UInt_t &iparticle) const =0
particle 4-momentum at exit point, all regions
virtual const vector<const TLorentzVector*>* garana::G4Tree::SimMomEnter ( const UInt_t &  iparticle) const
pure virtual

particle 4-momentum at entry point, all regions

Implemented in garana::FlatG4Tree, and garana::StructuredG4Tree.

virtual const TLorentzVector* garana::G4Tree::SimMomEnter ( const UInt_t &  iparticle,
const UInt_t &  iregion 
) const
pure virtual

particle 4-momentum at entry point in region

Implemented in garana::FlatG4Tree, and garana::StructuredG4Tree.

virtual const vector<const TLorentzVector*>* garana::G4Tree::SimMomExit ( const UInt_t &  iparticle) const
pure virtual

particle 4-momentum at exit point, all regions

Implemented in garana::FlatG4Tree, and garana::StructuredG4Tree.

virtual const TLorentzVector* garana::G4Tree::SimMomExit ( const UInt_t &  iparticle,
const UInt_t &  iregion 
) const
pure virtual

particle 4-momentum at exit point in region

Implemented in garana::FlatG4Tree, and garana::StructuredG4Tree.

const TLorentzVector * G4Tree::SimPosBegin ( const UInt_t &  iparticle) const

Definition at line 177 of file G4Tree.cxx.

177  {
178  return this->SimPosEnter(iparticle,0);
179 }
virtual const vector< const TLorentzVector * > * SimPosEnter(const UInt_t &iparticle) const =0
particle 4-position at entry point, all regions
const TLorentzVector * G4Tree::SimPosEnd ( const UInt_t &  iparticle) const

Definition at line 181 of file G4Tree.cxx.

181  {
182  return this->SimPosExit(iparticle,this->NRegions(iparticle)-1);
183 }
virtual const UInt_t NRegions(const UInt_t &iparticle) const =0
number of regions traversed by particle
virtual const vector< const TLorentzVector * > * SimPosExit(const UInt_t &iparticle) const =0
particle 4-position at exit point, all regions
virtual const vector<const TLorentzVector*>* garana::G4Tree::SimPosEnter ( const UInt_t &  iparticle) const
pure virtual

particle 4-position at entry point, all regions

Implemented in garana::FlatG4Tree, and garana::StructuredG4Tree.

virtual const TLorentzVector* garana::G4Tree::SimPosEnter ( const UInt_t &  iparticle,
const UInt_t &  iregion 
) const
pure virtual

particle 4-position at entry point in region

Implemented in garana::FlatG4Tree, and garana::StructuredG4Tree.

virtual const vector<const TLorentzVector*>* garana::G4Tree::SimPosExit ( const UInt_t &  iparticle) const
pure virtual

particle 4-position at exit point, all regions

Implemented in garana::FlatG4Tree, and garana::StructuredG4Tree.

virtual const TLorentzVector* garana::G4Tree::SimPosExit ( const UInt_t &  iparticle,
const UInt_t &  iregion 
) const
pure virtual

particle 4-position at exit point in region

Implemented in garana::FlatG4Tree, and garana::StructuredG4Tree.

virtual const int garana::G4Tree::TrackID ( const UInt_t &  iparticle) const
pure virtual

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

Implemented in garana::FlatG4Tree, and garana::StructuredG4Tree.

Member Data Documentation

TBranch* garana::G4Tree::b_G4FSIndex = nullptr
protected

Definition at line 74 of file G4Tree.h.

TBranch* garana::G4Tree::b_G4TruthIndex = nullptr
protected

Definition at line 73 of file G4Tree.h.

vector<UInt_t>* garana::G4Tree::fG4FSIndex = nullptr
protected

Definition at line 72 of file G4Tree.h.

vector<UInt_t>* garana::G4Tree::fG4TruthIndex = nullptr
protected

Definition at line 71 of file G4Tree.h.


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