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

#include <StructuredGenTree.h>

Inheritance diagram for garana::StructuredGenTree:
garana::GenTree garana::TreeReader

Public Member Functions

 StructuredGenTree ()
 
 StructuredGenTree (TTree *tree)
 
bool SetBranchAddresses () override
 < inherited from TreeReader More...
 
const UInt_t NGen () const override
 
const UInt_t NFSParticles (const UInt_t &igen) const override
 
const Bool_t IsGenie (const UInt_t &igen) const override
 
const int NuRegion (const UInt_t &igen) const override
 region code where the vertex is located More...
 
const Int_t NuPDG (const UInt_t &igen) const override
 neutrino PDG code More...
 
const TLorentzVector * NuP (const UInt_t &igen) override
 initial neutrino 4-momentum More...
 
const TLorentzVector * NuVertex (const UInt_t &igen) override
 4-position of neutrino vertex More...
 
const Bool_t IsCC (const UInt_t &igen) const override
 whether interaction is CC or not More...
 
const int ScatterCode (const UInt_t &igen) const override
 GENIE neutrino scattering code. More...
 
const int InteractCode (const UInt_t &igen) const override
 GENIE interaction code. More...
 
const Int_t TgtPDG (const UInt_t &igen) const override
 PDG of Target Nucleus, nucleon only if free. More...
 
const TLorentzVector * TgtP4 (const UInt_t &igen) const override
 target 4-momentum More...
 
const int TgtZ (const UInt_t &igen) const override
 target Z More...
 
const int TgtA (const UInt_t &igen) const override
 target A More...
 
const int HitNucPDG (const UInt_t &igen) const override
 hit nucleon PDG code More...
 
const TLorentzVector * HitNucP4 (const UInt_t &igen) const override
 hit nucleon (initial) 4-momentum More...
 
const double Q2 (const UInt_t &igen) const override
 
const double q2 (const UInt_t &igen) const override
 
const double W (const UInt_t &igen) const override
 
const double T (const UInt_t &igen) const override
 
const double X (const UInt_t &igen) const override
 
const double Y (const UInt_t &igen) const override
 
const TLorentzVector * FSLeptonP4 (const UInt_t &igen) const override
 final state primary lepton 4-momentum (LAB frame) More...
 
const TLorentzVector * FSHadSystP4 (const UInt_t &igen) const override
 final state hadronic system 4-momentum(LAB frame) More...
 
const int NumNuProton (const UInt_t &igen) const override
 number of protons after reaction, before FSI More...
 
const int NumNuNeutron (const UInt_t &igen) const override
 number of neutrons after reaction, before FSI More...
 
const int NumNuPi0 (const UInt_t &igen) const override
 number of pi0 after reaction, before FSI More...
 
const int NumNuPiPlus (const UInt_t &igen) const override
 number of pi pluses after reaction, before FSI More...
 
const int NumNuPiMinus (const UInt_t &igen) const override
 number of pi minuses after reaction, before FSI More...
 
const Float_t FSTotEnergy (const UInt_t &igen) const override
 
const Float_t FSEnergy (const UInt_t &igen, const UInt_t &ifsp) const override
 
const Float_t FSPDG (const UInt_t &igen, const UInt_t &ifsp) const override
 
const Int_t FSTrackId (const UInt_t &igen, const UInt_t &ifsp) const override
 
const GTruthGetGTruth (const UInt_t &igen) const
 
const vector< FSParticle > * GetParticles (const UInt_t &igen) const
 
- Public Member Functions inherited from garana::GenTree
virtual ~GenTree ()
 
const std::vector< Int_t > * GetGIndex () const
 whether or not subentry is GENIE interaction, index of GENIE interaction More...
 
bool NuInAV (const UInt_t &igen) const
 
bool NuInIV (const UInt_t &igen) const
 
bool NuInCalo (const UInt_t &igen) 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

const Bool_t CheckFSRange (const UInt_t &igen) const
 

Private Attributes

vector< vector< FSParticle > > * fFSParticles = nullptr
 
vector< GTruth > * fGTruth = nullptr
 
TBranch * b_GTruth = nullptr
 
TBranch * b_FSParticles = nullptr
 

Additional Inherited Members

- Protected Attributes inherited from garana::GenTree
const std::vector< Int_t > * fGIndex = nullptr
 
TBranch * b_GIndex = 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 13 of file StructuredGenTree.h.

Constructor & Destructor Documentation

garana::StructuredGenTree::StructuredGenTree ( )
inline

Definition at line 17 of file StructuredGenTree.h.

17 {}
StructuredGenTree::StructuredGenTree ( TTree *  tree)

Definition at line 7 of file StructuredGenTree.cxx.

7  {
8 
9  SetupRead(tree); //initialize tree pointer in TreeReader instance and set branch address
10 
11 }//
void SetupRead(TTree *tree)
Definition: TreeReader.cxx:6

Member Function Documentation

const Bool_t StructuredGenTree::CheckFSRange ( const UInt_t &  igen) const
private

Definition at line 231 of file StructuredGenTree.cxx.

231  {
232  if(igen < fFSParticles->size())
233  return kTRUE;
234  else{
235  std::cout << "ERROR: StructuredGenTree -> "
236  << "passed index to FSParticle is out of range ("
237  << igen << " vs. " << fFSParticles->size() << ")."
238  << " Returning first element."
239  << std::endl;
240  return kFALSE;
241  }
242 }//
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
Definition: StdUtils.h:92
vector< vector< FSParticle > > * fFSParticles
QTextStream & endl(QTextStream &s)
const Float_t StructuredGenTree::FSEnergy ( const UInt_t &  igen,
const UInt_t &  ifsp 
) const
overridevirtual

Implements garana::GenTree.

Definition at line 218 of file StructuredGenTree.cxx.

218  {
219  return fFSParticles->at(igen)[ifsp].E();
220 }
vector< vector< FSParticle > > * fFSParticles
const TLorentzVector * StructuredGenTree::FSHadSystP4 ( const UInt_t &  igen) const
overridevirtual

final state hadronic system 4-momentum(LAB frame)

particle multiplicities (before FSI)

Implements garana::GenTree.

Definition at line 184 of file StructuredGenTree.cxx.

184  {
185  return &(GetGTruth(igen)->fFShadSystP4);
186 }
const GTruth * GetGTruth(const UInt_t &igen) const
TLorentzVector fFShadSystP4
generated final state hadronic system (LAB frame)
Definition: GTruth.h:66
const TLorentzVector * StructuredGenTree::FSLeptonP4 ( const UInt_t &  igen) const
overridevirtual

final state primary lepton 4-momentum (LAB frame)

Implements garana::GenTree.

Definition at line 180 of file StructuredGenTree.cxx.

180  {
181  return &(GetGTruth(igen)->fFSleptonP4);
182 }
const GTruth * GetGTruth(const UInt_t &igen) const
TLorentzVector fFSleptonP4
generated final state primary lepton (LAB frame) // added version 13
Definition: GTruth.h:65
const Float_t StructuredGenTree::FSPDG ( const UInt_t &  igen,
const UInt_t &  ifsp 
) const
overridevirtual

Implements garana::GenTree.

Definition at line 222 of file StructuredGenTree.cxx.

222  {
223  return fFSParticles->at(igen)[ifsp].PDG();
224 }
vector< vector< FSParticle > > * fFSParticles
const Float_t StructuredGenTree::FSTotEnergy ( const UInt_t &  igen) const
overridevirtual

Implements garana::GenTree.

Definition at line 209 of file StructuredGenTree.cxx.

209  {
210 
211  Float_t e = 0.;
212  for(auto const& fsp : fFSParticles->at(igen))
213  e += fsp.E();
214 
215  return e;
216 }
const double e
vector< vector< FSParticle > > * fFSParticles
const Int_t StructuredGenTree::FSTrackId ( const UInt_t &  igen,
const UInt_t &  ifsp 
) const
overridevirtual

GENIE specific neutrino info

Implements garana::GenTree.

Definition at line 226 of file StructuredGenTree.cxx.

226  {
227  return fFSParticles->at(igen)[ifsp].TrackId();
228 }
vector< vector< FSParticle > > * fFSParticles
const GTruth * StructuredGenTree::GetGTruth ( const UInt_t &  igen) const

Definition at line 31 of file StructuredGenTree.cxx.

31  {
32 
33  if(!IsGenie(igen)) {
34  const GTruth* ptr = nullptr;
35  return ptr;
36  }
37  else {
38  const GTruth* ptr = &(fGTruth->at(igen));
39  return ptr;
40  }
41 }
const Bool_t IsGenie(const UInt_t &igen) const override
vector< GTruth > * fGTruth
const std::vector< FSParticle > * StructuredGenTree::GetParticles ( const UInt_t &  igen) const

Definition at line 52 of file StructuredGenTree.cxx.

52  {
53 
54  UInt_t index = CheckFSRange(igen) ? igen : 0;
55  return &(fFSParticles->at(index));
56 
57 }//
const Bool_t CheckFSRange(const UInt_t &igen) const
vector< vector< FSParticle > > * fFSParticles
const TLorentzVector * StructuredGenTree::HitNucP4 ( const UInt_t &  igen) const
overridevirtual

hit nucleon (initial) 4-momentum

kinematics

Implements garana::GenTree.

Definition at line 152 of file StructuredGenTree.cxx.

152  {
153  return &(GetGTruth(igen)->fHitNucP4);
154 }
const GTruth * GetGTruth(const UInt_t &igen) const
TLorentzVector fHitNucP4
Definition: GTruth.h:50
const int StructuredGenTree::HitNucPDG ( const UInt_t &  igen) const
overridevirtual

hit nucleon PDG code

Implements garana::GenTree.

Definition at line 148 of file StructuredGenTree.cxx.

148  {
149  return GetGTruth(igen)->fHitNucPDG;
150 }
const GTruth * GetGTruth(const UInt_t &igen) const
int fHitNucPDG
hit nucleon PDG code
Definition: GTruth.h:47
const int StructuredGenTree::InteractCode ( const UInt_t &  igen) const
overridevirtual

GENIE interaction code.

target info

Implements garana::GenTree.

Definition at line 128 of file StructuredGenTree.cxx.

128  {
129  return GetGTruth(igen)->fGint;
130 }
const GTruth * GetGTruth(const UInt_t &igen) const
int fGint
interaction code
Definition: GTruth.h:55
const Bool_t StructuredGenTree::IsCC ( const UInt_t &  igen) const
overridevirtual

whether interaction is CC or not

Implements garana::GenTree.

Definition at line 75 of file StructuredGenTree.cxx.

75  {
76 
77  if(IsGenie(igen))
78  return fGTruth->at(igen).fGint == 2;
79  else
80  return false;
81 
82 }//
const Bool_t IsGenie(const UInt_t &igen) const override
vector< GTruth > * fGTruth
const Bool_t StructuredGenTree::IsGenie ( const UInt_t &  igen) const
overridevirtual

Implements garana::GenTree.

Definition at line 60 of file StructuredGenTree.cxx.

60  {
61 
62  if(fGIndex->size()==fFSParticles->size()){
63  UInt_t index = CheckFSRange(igen) ? igen : 0;
64  return fGIndex->at(index) != -1;
65  }
66  else{
67  std::cout << "ERROR: StructuredGenTree::IsGenie -> "
68  << " sizeof(GIndex) != sizeof(FSParticles)"
69  << std::endl;
70  return false;
71  }
72 }//
const Bool_t CheckFSRange(const UInt_t &igen) const
vector< vector< FSParticle > > * fFSParticles
const std::vector< Int_t > * fGIndex
Definition: GenTree.h:66
QTextStream & endl(QTextStream &s)
const UInt_t StructuredGenTree::NFSParticles ( const UInt_t &  igen) const
overridevirtual

Implements garana::GenTree.

Definition at line 44 of file StructuredGenTree.cxx.

44  {
45 
46  UInt_t index = CheckFSRange(igen) ? igen : 0;
47  return fFSParticles->at(index).size();
48 
49 }//
const Bool_t CheckFSRange(const UInt_t &igen) const
vector< vector< FSParticle > > * fFSParticles
const UInt_t StructuredGenTree::NGen ( ) const
overridevirtual

Implements garana::GenTree.

Definition at line 26 of file StructuredGenTree.cxx.

26  {
27  return fFSParticles->size();
28 }//
vector< vector< FSParticle > > * fFSParticles
const int StructuredGenTree::NumNuNeutron ( const UInt_t &  igen) const
overridevirtual

number of neutrons after reaction, before FSI

Implements garana::GenTree.

Definition at line 192 of file StructuredGenTree.cxx.

192  {
193  return GetGTruth(igen)->fNumNeutron;
194 }
const GTruth * GetGTruth(const UInt_t &igen) const
int fNumNeutron
number of neutrons after reaction, before FSI
Definition: GTruth.h:74
const int StructuredGenTree::NumNuPi0 ( const UInt_t &  igen) const
overridevirtual

number of pi0 after reaction, before FSI

Implements garana::GenTree.

Definition at line 196 of file StructuredGenTree.cxx.

196  {
197  return GetGTruth(igen)->fNumPi0;
198 }
const GTruth * GetGTruth(const UInt_t &igen) const
int fNumPi0
number of pi0 after reaction, before FSI
Definition: GTruth.h:75
const int StructuredGenTree::NumNuPiMinus ( const UInt_t &  igen) const
overridevirtual

number of pi minuses after reaction, before FSI

Implements garana::GenTree.

Definition at line 204 of file StructuredGenTree.cxx.

204  {
205  return GetGTruth(igen)->fNumPiMinus;
206 }
const GTruth * GetGTruth(const UInt_t &igen) const
int fNumPiMinus
number of pi minuses after reaction, before FSI
Definition: GTruth.h:77
const int StructuredGenTree::NumNuPiPlus ( const UInt_t &  igen) const
overridevirtual

number of pi pluses after reaction, before FSI

Implements garana::GenTree.

Definition at line 200 of file StructuredGenTree.cxx.

200  {
201  return GetGTruth(igen)->fNumPiPlus;
202 }
const GTruth * GetGTruth(const UInt_t &igen) const
int fNumPiPlus
number of pi pluses after reaction, before FSI
Definition: GTruth.h:76
const int StructuredGenTree::NumNuProton ( const UInt_t &  igen) const
overridevirtual

number of protons after reaction, before FSI

Implements garana::GenTree.

Definition at line 188 of file StructuredGenTree.cxx.

188  {
189  return GetGTruth(igen)->fNumProton;
190 }
const GTruth * GetGTruth(const UInt_t &igen) const
int fNumProton
number of protons after reaction, before FSI
Definition: GTruth.h:73
const TLorentzVector * StructuredGenTree::NuP ( const UInt_t &  igen)
overridevirtual

initial neutrino 4-momentum

Implements garana::GenTree.

Definition at line 105 of file StructuredGenTree.cxx.

105  {
106 
107  if(IsGenie(igen))
108  return &(fGTruth->at(igen).fProbeP4);
109 
110  else
111  return nullptr;
112 }
const Bool_t IsGenie(const UInt_t &igen) const override
vector< GTruth > * fGTruth
const Int_t StructuredGenTree::NuPDG ( const UInt_t &  igen) const
overridevirtual

neutrino PDG code

Implements garana::GenTree.

Definition at line 95 of file StructuredGenTree.cxx.

95  {
96 
97  if(IsGenie(igen))
98  return fGTruth->at(igen).fProbePDG;
99  else
100  return INT_MAX;
101 
102 }
const Bool_t IsGenie(const UInt_t &igen) const override
vector< GTruth > * fGTruth
const int StructuredGenTree::NuRegion ( const UInt_t &  igen) const
overridevirtual

region code where the vertex is located

Implements garana::GenTree.

Definition at line 85 of file StructuredGenTree.cxx.

85  {
86 
87  if(IsGenie(igen))
88  return fGTruth->at(igen).fVertexRegion;
89  else
90  return INT_MAX;
91 
92 }//
const Bool_t IsGenie(const UInt_t &igen) const override
vector< GTruth > * fGTruth
const TLorentzVector * StructuredGenTree::NuVertex ( const UInt_t &  igen)
overridevirtual

4-position of neutrino vertex

Implements garana::GenTree.

Definition at line 115 of file StructuredGenTree.cxx.

115  {
116 
117  if(IsGenie(igen))
118  return &(fGTruth->at(igen).fVertex);
119 
120  else
121  return nullptr;
122 }
const Bool_t IsGenie(const UInt_t &igen) const override
vector< GTruth > * fGTruth
const double StructuredGenTree::Q2 ( const UInt_t &  igen) const
overridevirtual

Implements garana::GenTree.

Definition at line 156 of file StructuredGenTree.cxx.

156  {
157  return GetGTruth(igen)->fgQ2;
158 }
const GTruth * GetGTruth(const UInt_t &igen) const
double fgQ2
< these are for the internal (on shell) genie kinematics
Definition: GTruth.h:59
const double StructuredGenTree::q2 ( const UInt_t &  igen) const
overridevirtual

Implements garana::GenTree.

Definition at line 160 of file StructuredGenTree.cxx.

160  {
161  return GetGTruth(igen)->fgq2;
162 }
double fgq2
Definition: GTruth.h:60
const GTruth * GetGTruth(const UInt_t &igen) const
const int StructuredGenTree::ScatterCode ( const UInt_t &  igen) const
overridevirtual

GENIE neutrino scattering code.

Implements garana::GenTree.

Definition at line 124 of file StructuredGenTree.cxx.

124  {
125  return GetGTruth(igen)->fGscatter;
126 }
const GTruth * GetGTruth(const UInt_t &igen) const
int fGscatter
neutrino scattering code
Definition: GTruth.h:54
bool StructuredGenTree::SetBranchAddresses ( )
overridevirtual

< inherited from TreeReader

accessors inherited from GenTree (see garana/Base/GenTree.h for method descriptions)

Implements garana::TreeReader.

Definition at line 13 of file StructuredGenTree.cxx.

14 {
15  // Set branch addresses and branch pointers
16  fTreeIn->SetBranchAddress("Event", &fEvent, &b_Event);
17  fTreeIn->SetBranchAddress("GIndex", &fGIndex, &b_GIndex);
18  //fTreeIn->SetBranchAddress("FSIndex", &fFSIndex, &b_FSIndex);
19  fTreeIn->SetBranchAddress("GTruth", &fGTruth, &b_GTruth);
20  fTreeIn->SetBranchAddress("FSParticles", &fFSParticles, &b_FSParticles);
21 
22  return true;
23 }//
TTree * fTreeIn
pointer to the analyzed TTree or TChain
Definition: TreeReader.h:51
vector< vector< FSParticle > > * fFSParticles
TBranch * b_Event
Definition: TreeReader.h:54
const std::vector< Int_t > * fGIndex
Definition: GenTree.h:66
Int_t fEvent
event number for tree entry
Definition: TreeReader.h:55
TBranch * b_GIndex
Definition: GenTree.h:67
vector< GTruth > * fGTruth
const double StructuredGenTree::T ( const UInt_t &  igen) const
overridevirtual

Implements garana::GenTree.

Definition at line 168 of file StructuredGenTree.cxx.

168  {
169  return GetGTruth(igen)->fgT;
170 }
const GTruth * GetGTruth(const UInt_t &igen) const
double fgT
Definition: GTruth.h:62
const int StructuredGenTree::TgtA ( const UInt_t &  igen) const
overridevirtual

target A

Implements garana::GenTree.

Definition at line 140 of file StructuredGenTree.cxx.

140  {
141  return GetGTruth(igen)->ftgtA;
142 }
const GTruth * GetGTruth(const UInt_t &igen) const
const TLorentzVector * StructuredGenTree::TgtP4 ( const UInt_t &  igen) const
overridevirtual

target 4-momentum

Implements garana::GenTree.

Definition at line 132 of file StructuredGenTree.cxx.

132  {
133  return &(GetGTruth(igen)->fTgtP4);
134 }
const GTruth * GetGTruth(const UInt_t &igen) const
TLorentzVector fTgtP4
Definition: GTruth.h:41
const int StructuredGenTree::TgtPDG ( const UInt_t &  igen) const
overridevirtual

PDG of Target Nucleus, nucleon only if free.

Implements garana::GenTree.

Definition at line 144 of file StructuredGenTree.cxx.

144  {
145  return GetGTruth(igen)->ftgtPDG;
146 }
const GTruth * GetGTruth(const UInt_t &igen) const
int ftgtPDG
PDG of Target Nucleus, nucleon only if free.
Definition: GTruth.h:46
const int StructuredGenTree::TgtZ ( const UInt_t &  igen) const
overridevirtual

target Z

Implements garana::GenTree.

Definition at line 136 of file StructuredGenTree.cxx.

136  {
137  return GetGTruth(igen)->ftgtZ;
138 }
const GTruth * GetGTruth(const UInt_t &igen) const
const double StructuredGenTree::W ( const UInt_t &  igen) const
overridevirtual

Implements garana::GenTree.

Definition at line 164 of file StructuredGenTree.cxx.

164  {
165  return GetGTruth(igen)->fgW;
166 }
const GTruth * GetGTruth(const UInt_t &igen) const
double fgW
Definition: GTruth.h:61
const double StructuredGenTree::X ( const UInt_t &  igen) const
overridevirtual

Implements garana::GenTree.

Definition at line 172 of file StructuredGenTree.cxx.

172  {
173  return GetGTruth(igen)->fgX;
174 }
const GTruth * GetGTruth(const UInt_t &igen) const
double fgX
Definition: GTruth.h:63
const double StructuredGenTree::Y ( const UInt_t &  igen) const
overridevirtual

Implements garana::GenTree.

Definition at line 176 of file StructuredGenTree.cxx.

176  {
177  return GetGTruth(igen)->fgY;
178 }
const GTruth * GetGTruth(const UInt_t &igen) const
double fgY
Definition: GTruth.h:64

Member Data Documentation

TBranch* garana::StructuredGenTree::b_FSParticles = nullptr
private

Definition at line 77 of file StructuredGenTree.h.

TBranch* garana::StructuredGenTree::b_GTruth = nullptr
private

Definition at line 76 of file StructuredGenTree.h.

vector<vector<FSParticle> >* garana::StructuredGenTree::fFSParticles = nullptr
private

Definition at line 72 of file StructuredGenTree.h.

vector<GTruth>* garana::StructuredGenTree::fGTruth = nullptr
private

Definition at line 73 of file StructuredGenTree.h.


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