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

#include <MillGenTree.h>

Inheritance diagram for garana::MillGenTree:
garana::Mill garana::FlatGenTree garana::GenTree garana::TreeReader

Public Member Functions

 MillGenTree ()
 
 MillGenTree (TTree *treeIn, TTree *treeOut)
 
void MillTrees () override
 
- Public Member Functions inherited from garana::Mill
virtual ~Mill ()
 
bool IsVerified () const
 
std::string CharStarToString (const char *cstr)
 
- Public Member Functions inherited from garana::FlatGenTree
 FlatGenTree ()
 
 FlatGenTree (TTree *tree)
 
 FlatGenTree (TTree *tree, char opt)
 
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 Bool_t IsCC (const UInt_t &igen) const override
 whether interaction is CC or not 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 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
 
void GetEntry (const UInt_t &ientry) override
 
- 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
 
Int_t Event () const
 
const TObjArray * GetBranchList () const
 
void Fill ()
 
void Write ()
 
void CheckOpt (char opt)
 
bool BlockWrite () const
 

Private Types

enum  GenBranch { kEvent, kGIndex, kGTruth, kFSParticle }
 

Private Member Functions

bool VerifyBranches () override
 
void FillGTruth (const GTruth *truth)
 
void FillEmptyGTruth ()
 
void FillFSParticle (const vector< FSParticle > *fsp)
 

Private Attributes

StructuredGenTreefGenIn = nullptr
 
std::map< std::string, GenBranchnameToGenBranch
 
std::map< GenBranch, boolbranchToDrawOpt
 

Additional Inherited Members

- Protected Types inherited from garana::FlatGenTree
typedef UInt_t fsLimit
 
typedef fsLimit fsBegin
 
typedef fsLimit fsEnd
 
- Protected Member Functions inherited from garana::FlatGenTree
bool SetBranchAddresses () override
 
void FindFSLimits ()
 
std::pair< UInt_t, UInt_t > FSParticlesFromGTruth (size_t igen) const
 
void SetVecs ()
 
void ClearVecs ()
 
- Protected Attributes inherited from garana::Mill
bool fIsVerified = false
 
TTree * fTreeOut = nullptr
 
TFile * fOutfile = nullptr
 
- Protected Attributes inherited from garana::FlatGenTree
vector< std::pair< fsBegin, fsEnd > > fGenToFSLimits
 
TLorentzVector fNuP
 
TLorentzVector fNuVertex
 
Int_t fNGen = -1
 
const vector< Int_t > * fGIndex = nullptr
 
vector< UInt_t > fNFSObj
 number of FSParticles for igen^th GTruth len=NGen More...
 
vector< UInt_t > fFSIndexObj
 
vector< UInt_t > fFSPdgObj
 particle PDG code More...
 
vector< Float_t > fFSPosXObj
 x-coordinate [cm] More...
 
vector< Float_t > fFSPosYObj
 y-coordinate [cm] More...
 
vector< Float_t > fFSPosZObj
 z-coordinate [cm] More...
 
vector< Float_t > fFSTObj
 time [ns] More...
 
vector< Float_t > fFSMomXObj
 momentum, x-component [GeV/c] More...
 
vector< Float_t > fFSMomYObj
 momentum, y-component [GeV/c] More...
 
vector< Float_t > fFSMomZObj
 momentum, z-component [GeV/c] More...
 
vector< Float_t > fFSEObj
 total energy [GeV] More...
 
vector< double > fNuXObj
 GTruth (one or more per genTree entry) //. More...
 
vector< double > fNuYObj
 
vector< double > fNuZObj
 
vector< double > fNuTObj
 
vector< double > fWeightObj
 
vector< double > fProbabilityObj
 
vector< double > fXsecObj
 
vector< double > fDiffXsecObj
 
vector< int > fGPhaseSpaceObj
 
vector< int > fProbePDGObj
 
vector< double > fProbePxObj
 
vector< double > fProbePyObj
 
vector< double > fProbePzObj
 
vector< double > fProbeEObj
 
vector< double > fTgtPxObj
 
vector< double > fTgtPyObj
 
vector< double > fTgtPzObj
 
vector< double > fTgtEObj
 
vector< int > fTgtZObj
 
vector< int > fTgtAObj
 
vector< int > fTgtPDGObj
 
vector< int > fHitNucPDGObj
 
vector< int > fHitQrkPDGObj
 
vector< boolfIsSeaQuarkObj
 
vector< double > fHitNucPxObj
 
vector< double > fHitNucPyObj
 
vector< double > fHitNucPzObj
 
vector< double > fHitNucEObj
 
vector< double > fHitNucPosObj
 
vector< int > fGscatterObj
 
vector< int > fGintObj
 
vector< double > fGQ2Obj
 
vector< double > fGq2Obj
 
vector< double > fGWObj
 
vector< double > fGTObj
 
vector< double > fGXObj
 
vector< double > fGYObj
 
vector< double > fFSleptonPxObj
 
vector< double > fFSleptonPyObj
 
vector< double > fFSleptonPzObj
 
vector< double > fFSleptonEObj
 
vector< double > fFShadSystPxObj
 
vector< double > fFShadSystPyObj
 
vector< double > fFShadSystPzObj
 
vector< double > fFShadSystEObj
 
vector< boolfIsCharmObj
 
vector< int > fCharmHadronPDGObj
 
vector< boolfIsStrangeObj
 
vector< int > fStrangeHadronPDGObj
 
vector< int > fNumProtonObj
 
vector< int > fNumNeutronObj
 
vector< int > fNumPi0Obj
 
vector< int > fNumPiPlusObj
 
vector< int > fNumPiMinusObj
 
vector< int > fResNumObj
 
vector< int > fDecayModeObj
 
vector< UInt_t > * fNFS = nullptr
 number of FSParticles for igen^th GTruth len=NGen More...
 
vector< UInt_t > * fFSIndex = nullptr
 
vector< UInt_t > * fFSTrackId = nullptr
 particle generator track ID More...
 
vector< UInt_t > * fFSPdg = nullptr
 particle PDG code More...
 
vector< Float_t > * fFSPosX = nullptr
 x-coordinate [cm] More...
 
vector< Float_t > * fFSPosY = nullptr
 y-coordinate [cm] More...
 
vector< Float_t > * fFSPosZ = nullptr
 z-coordinate [cm] More...
 
vector< Float_t > * fFST = nullptr
 time [ns] More...
 
vector< Float_t > * fFSMomX = nullptr
 momentum, x-component [GeV/c] More...
 
vector< Float_t > * fFSMomY = nullptr
 momentum, y-component [GeV/c] More...
 
vector< Float_t > * fFSMomZ = nullptr
 momentum, z-component [GeV/c] More...
 
vector< Float_t > * fFSE = nullptr
 total energy [GeV] More...
 
vector< double > * fNuX = nullptr
 GTruth (one or more per genTree entry) //. More...
 
vector< double > * fNuY = nullptr
 
vector< double > * fNuZ = nullptr
 
vector< double > * fNuT = nullptr
 
vector< int > * fNuRegion = nullptr
 
vector< double > * fWeight = nullptr
 
vector< double > * fProbability = nullptr
 
vector< double > * fXsec = nullptr
 
vector< double > * fDiffXsec = nullptr
 
vector< int > * fGPhaseSpace = nullptr
 
vector< int > * fProbePDG = nullptr
 
vector< double > * fProbePx = nullptr
 
vector< double > * fProbePy = nullptr
 
vector< double > * fProbePz = nullptr
 
vector< double > * fProbeE = nullptr
 
vector< double > * fTgtPx = nullptr
 
vector< double > * fTgtPy = nullptr
 
vector< double > * fTgtPz = nullptr
 
vector< double > * fTgtE = nullptr
 
vector< int > * fTgtZ = nullptr
 
vector< int > * fTgtA = nullptr
 
vector< int > * fTgtPDG = nullptr
 
vector< int > * fHitNucPDG = nullptr
 
vector< int > * fHitQrkPDG = nullptr
 
vector< bool > * fIsSeaQuark = nullptr
 
vector< double > * fHitNucPx = nullptr
 
vector< double > * fHitNucPy = nullptr
 
vector< double > * fHitNucPz = nullptr
 
vector< double > * fHitNucE = nullptr
 
vector< double > * fHitNucPos = nullptr
 
vector< int > * fGscatter = nullptr
 
vector< int > * fGint = nullptr
 
vector< double > * fGQ2 = nullptr
 
vector< double > * fGq2 = nullptr
 
vector< double > * fGW = nullptr
 
vector< double > * fGT = nullptr
 
vector< double > * fGX = nullptr
 
vector< double > * fGY = nullptr
 
vector< double > * fFSleptonPx = nullptr
 
vector< double > * fFSleptonPy = nullptr
 
vector< double > * fFSleptonPz = nullptr
 
vector< double > * fFSleptonE = nullptr
 
vector< double > * fFShadSystPx = nullptr
 
vector< double > * fFShadSystPy = nullptr
 
vector< double > * fFShadSystPz = nullptr
 
vector< double > * fFShadSystE = nullptr
 
vector< bool > * fIsCharm = nullptr
 
vector< int > * fCharmHadronPDG = nullptr
 
vector< bool > * fIsStrange = nullptr
 
vector< int > * fStrangeHadronPDG = nullptr
 
vector< int > * fNumProton = nullptr
 
vector< int > * fNumNeutron = nullptr
 
vector< int > * fNumPi0 = nullptr
 
vector< int > * fNumPiPlus = nullptr
 
vector< int > * fNumPiMinus = nullptr
 
vector< int > * fResNum = nullptr
 
vector< int > * fDecayMode = nullptr
 
TBranch * b_NGen = nullptr
 
TBranch * b_GIndex = nullptr
 
TBranch * b_NFS = nullptr
 
TBranch * b_FSIndex = nullptr
 
TBranch * b_FSPdg = nullptr
 
TBranch * b_FSPosX = nullptr
 
TBranch * b_FSPosY = nullptr
 
TBranch * b_FSPosZ = nullptr
 
TBranch * b_FST = nullptr
 
TBranch * b_FSMomX = nullptr
 
TBranch * b_FSMomY = nullptr
 
TBranch * b_FSMomZ = nullptr
 
TBranch * b_FSE = nullptr
 
TBranch * b_NuX = nullptr
 
TBranch * b_NuY = nullptr
 
TBranch * b_NuZ = nullptr
 
TBranch * b_NuT = nullptr
 
TBranch * b_NuRegion = nullptr
 
TBranch * b_Weight = nullptr
 
TBranch * b_Probability = nullptr
 
TBranch * b_Xsec = nullptr
 
TBranch * b_DiffXsec = nullptr
 
TBranch * b_GPhaseSpace = nullptr
 
TBranch * b_ProbePDG = nullptr
 
TBranch * b_ProbePx = nullptr
 
TBranch * b_ProbePy = nullptr
 
TBranch * b_ProbePz = nullptr
 
TBranch * b_ProbeE = nullptr
 
TBranch * b_TgtPx = nullptr
 
TBranch * b_TgtPy = nullptr
 
TBranch * b_TgtPz = nullptr
 
TBranch * b_TgtE = nullptr
 
TBranch * b_TgtZ = nullptr
 
TBranch * b_TgtA = nullptr
 
TBranch * b_TgtPDG = nullptr
 
TBranch * b_HitNucPDG = nullptr
 
TBranch * b_HitQrkPDG = nullptr
 
TBranch * b_IsSeaQuark = nullptr
 
TBranch * b_HitNucPx = nullptr
 
TBranch * b_HitNucPy = nullptr
 
TBranch * b_HitNucPz = nullptr
 
TBranch * b_HitNucE = nullptr
 
TBranch * b_HitNucPos = nullptr
 
TBranch * b_Gscatter = nullptr
 
TBranch * b_Gint = nullptr
 
TBranch * b_GQ2 = nullptr
 
TBranch * b_Gq2 = nullptr
 
TBranch * b_GW = nullptr
 
TBranch * b_GT = nullptr
 
TBranch * b_GX = nullptr
 
TBranch * b_GY = nullptr
 
TBranch * b_FSleptonPx = nullptr
 
TBranch * b_FSleptonPy = nullptr
 
TBranch * b_FSleptonPz = nullptr
 
TBranch * b_FSleptonE = nullptr
 
TBranch * b_FShadSystPx = nullptr
 
TBranch * b_FShadSystPy = nullptr
 
TBranch * b_FShadSystPz = nullptr
 
TBranch * b_FShadSystE = nullptr
 
TBranch * b_IsCharm = nullptr
 
TBranch * b_CharmHadronPDG = nullptr
 
TBranch * b_IsStrange = nullptr
 
TBranch * b_StrangeHadronPDG = nullptr
 
TBranch * b_NumProton = nullptr
 
TBranch * b_NumNeutron = nullptr
 
TBranch * b_NumPi0 = nullptr
 
TBranch * b_NumPiPlus = nullptr
 
TBranch * b_NumPiMinus = nullptr
 
TBranch * b_ResNum = nullptr
 
TBranch * b_DecayMode = nullptr
 
- 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 16 of file MillGenTree.h.

Member Enumeration Documentation

enum garana::MillGenTree::GenBranch
private
Enumerator
kEvent 
kGIndex 
kGTruth 
kFSParticle 

Definition at line 37 of file MillGenTree.h.

Constructor & Destructor Documentation

garana::MillGenTree::MillGenTree ( )
inline

Definition at line 20 of file MillGenTree.h.

20 {};
MillGenTree::MillGenTree ( TTree *  treeIn,
TTree *  treeOut 
)

Definition at line 26 of file MillGenTree.cxx.

27 {
28  fGenIn = new StructuredGenTree(treeIn);
29 
30  fTreeIn = treeOut;
31  //fTreeOut = new TTree("genTree", "generator level information");
32  //fGenOut= new FlatGenTree(treeOut,'w');
33 
34  fOpt='w';
35  this->VerifyBranches();
36  this->SetVecs();
37  this->SetBranchAddresses();
38  this->MillTrees();
39 
40 }//constructor()
StructuredGenTree * fGenIn
Definition: MillGenTree.h:32
void MillTrees() override
Definition: MillGenTree.cxx:43
bool VerifyBranches() override
TTree * fTreeIn
pointer to the analyzed TTree or TChain
Definition: TreeReader.h:51
bool SetBranchAddresses() override
Definition: FlatGenTree.cxx:45

Member Function Documentation

void MillGenTree::FillEmptyGTruth ( )
private

Definition at line 228 of file MillGenTree.cxx.

228  {
229 
230  FillEmpty(fNuX);
231  FillEmpty(fNuY);
232  FillEmpty(fNuZ);
233  FillEmpty(fNuT);
234  FillEmpty(fWeight);
235  FillEmpty(fProbability);
236  FillEmpty(fXsec);
237  FillEmpty(fDiffXsec);
238  FillEmpty(fGPhaseSpace);
239  FillEmpty(fProbePDG);
240  FillEmpty(fProbePx);
241  FillEmpty(fProbePy);
242  FillEmpty(fProbePz);
243  FillEmpty(fProbeE);
244  FillEmpty(fTgtPx);
245  FillEmpty(fTgtPy);
246  FillEmpty(fTgtPz);
247  FillEmpty(fTgtE);
248 
249  FillEmpty(fTgtZ);
250  FillEmpty(fTgtA);
251  FillEmpty(fTgtPDG);
252  FillEmpty(fHitNucPDG);
253  FillEmpty(fHitQrkPDG);
254  FillEmpty(fIsSeaQuark);
255  FillEmpty(fHitNucPx);
256  FillEmpty(fHitNucPy);
257  FillEmpty(fHitNucPz);
258  FillEmpty(fHitNucE);
259  FillEmpty(fHitNucPos);
260 
261  FillEmpty(fGscatter);
262  FillEmpty(fGint);
263  FillEmpty(fGQ2);
264  FillEmpty(fGq2);
265  FillEmpty(fGW);
266  FillEmpty(fGT);
267  FillEmpty(fGX);
268  FillEmpty(fGY);
269  FillEmpty(fFSleptonPx);
270  FillEmpty(fFSleptonPy);
271  FillEmpty(fFSleptonPz);
272  FillEmpty(fFSleptonE);
273  FillEmpty(fFShadSystPx);
274  FillEmpty(fFShadSystPy);
275  FillEmpty(fFShadSystPz);
276  FillEmpty(fFShadSystE);
277 
278  FillEmpty(fIsCharm);
279  FillEmpty(fCharmHadronPDG);
280  FillEmpty(fIsStrange);
281  FillEmpty(fStrangeHadronPDG);
282  FillEmpty(fNumProton);
283  FillEmpty(fNumNeutron);
284  FillEmpty(fNumPi0);
285  FillEmpty(fNumPiPlus);
286  FillEmpty(fNumPiMinus);
287  FillEmpty(fResNum);
288  FillEmpty(fDecayMode);
289 }//FillEmptyGTruth
vector< double > * fFShadSystPz
Definition: FlatGenTree.h:240
vector< double > * fHitNucPy
Definition: FlatGenTree.h:219
vector< double > * fTgtE
Definition: FlatGenTree.h:209
vector< int > * fNumPiPlus
Definition: FlatGenTree.h:250
vector< double > * fGq2
Definition: FlatGenTree.h:227
vector< double > * fFSleptonPz
Definition: FlatGenTree.h:235
vector< double > * fGY
Definition: FlatGenTree.h:231
vector< double > * fFSleptonPx
Definition: FlatGenTree.h:233
vector< double > * fTgtPx
Definition: FlatGenTree.h:206
vector< double > * fGQ2
Definition: FlatGenTree.h:226
vector< int > * fTgtZ
Definition: FlatGenTree.h:211
vector< double > * fProbability
Definition: FlatGenTree.h:195
vector< double > * fHitNucPx
Definition: FlatGenTree.h:218
vector< bool > * fIsStrange
Definition: FlatGenTree.h:245
vector< double > * fFSleptonE
Definition: FlatGenTree.h:236
vector< double > * fFShadSystE
Definition: FlatGenTree.h:241
vector< double > * fGT
Definition: FlatGenTree.h:229
vector< double > * fProbePz
Definition: FlatGenTree.h:203
vector< double > * fTgtPy
Definition: FlatGenTree.h:207
vector< double > * fDiffXsec
Definition: FlatGenTree.h:197
vector< double > * fGW
Definition: FlatGenTree.h:228
vector< int > * fResNum
Definition: FlatGenTree.h:252
vector< int > * fDecayMode
Definition: FlatGenTree.h:253
vector< int > * fGscatter
Definition: FlatGenTree.h:224
vector< int > * fGint
Definition: FlatGenTree.h:225
vector< int > * fGPhaseSpace
Definition: FlatGenTree.h:198
vector< int > * fNumPi0
Definition: FlatGenTree.h:249
vector< bool > * fIsCharm
Definition: FlatGenTree.h:243
vector< double > * fFSleptonPy
Definition: FlatGenTree.h:234
vector< double > * fNuZ
Definition: FlatGenTree.h:190
vector< double > * fNuX
GTruth (one or more per genTree entry) //.
Definition: FlatGenTree.h:188
vector< int > * fHitQrkPDG
Definition: FlatGenTree.h:215
vector< int > * fTgtPDG
Definition: FlatGenTree.h:213
vector< int > * fHitNucPDG
Definition: FlatGenTree.h:214
vector< double > * fTgtPz
Definition: FlatGenTree.h:208
vector< int > * fStrangeHadronPDG
Definition: FlatGenTree.h:246
vector< double > * fFShadSystPx
Definition: FlatGenTree.h:238
vector< int > * fNumProton
Definition: FlatGenTree.h:247
vector< int > * fNumPiMinus
Definition: FlatGenTree.h:251
vector< bool > * fIsSeaQuark
Definition: FlatGenTree.h:216
vector< double > * fProbePx
Definition: FlatGenTree.h:201
vector< double > * fNuY
Definition: FlatGenTree.h:189
vector< int > * fProbePDG
Definition: FlatGenTree.h:199
vector< double > * fXsec
Definition: FlatGenTree.h:196
vector< int > * fNumNeutron
Definition: FlatGenTree.h:248
vector< double > * fGX
Definition: FlatGenTree.h:230
vector< double > * fProbePy
Definition: FlatGenTree.h:202
vector< double > * fNuT
Definition: FlatGenTree.h:191
vector< double > * fHitNucPos
Definition: FlatGenTree.h:222
vector< double > * fFShadSystPy
Definition: FlatGenTree.h:239
vector< double > * fWeight
Definition: FlatGenTree.h:194
vector< int > * fTgtA
Definition: FlatGenTree.h:212
vector< double > * fHitNucE
Definition: FlatGenTree.h:221
vector< double > * fHitNucPz
Definition: FlatGenTree.h:220
vector< double > * fProbeE
Definition: FlatGenTree.h:204
vector< int > * fCharmHadronPDG
Definition: FlatGenTree.h:244
void MillGenTree::FillFSParticle ( const vector< FSParticle > *  fsp)
private

Definition at line 291 of file MillGenTree.cxx.

291  {
292 
293  for( auto const& fsp : *fsps ) {
294 
295  fFSPdg->push_back(fsp.PDG());
296  fFSPosX->push_back(fsp.X());
297  fFSPosY->push_back(fsp.Y());
298  fFSPosZ->push_back(fsp.Z());
299  fFST->push_back(fsp.T());
300  fFSMomX->push_back(fsp.Px());
301  fFSMomY->push_back(fsp.Py());
302  fFSMomZ->push_back(fsp.Pz());
303  fFSE->push_back(fsp.E());
304 
305  }//for FSParticles
306 }//FillFSParticle
vector< Float_t > * fFSPosY
y-coordinate [cm]
Definition: FlatGenTree.h:179
vector< Float_t > * fFST
time [ns]
Definition: FlatGenTree.h:181
vector< Float_t > * fFSMomZ
momentum, z-component [GeV/c]
Definition: FlatGenTree.h:184
vector< Float_t > * fFSMomY
momentum, y-component [GeV/c]
Definition: FlatGenTree.h:183
vector< Float_t > * fFSMomX
momentum, x-component [GeV/c]
Definition: FlatGenTree.h:182
vector< Float_t > * fFSPosX
x-coordinate [cm]
Definition: FlatGenTree.h:178
vector< UInt_t > * fFSPdg
particle PDG code
Definition: FlatGenTree.h:177
vector< Float_t > * fFSPosZ
z-coordinate [cm]
Definition: FlatGenTree.h:180
vector< Float_t > * fFSE
total energy [GeV]
Definition: FlatGenTree.h:185
void MillGenTree::FillGTruth ( const GTruth truth)
private

Definition at line 161 of file MillGenTree.cxx.

161  {
162 
163  fNuX->push_back(truth->fVertex.X());
164  fNuY->push_back(truth->fVertex.Y());
165  fNuZ->push_back(truth->fVertex.Z());
166  fNuT->push_back(truth->fVertex.T());
167 
168  fWeight->push_back(truth->fweight);
169  fProbability->push_back(truth->fprobability);
170  fXsec->push_back(truth->fXsec);
171  fDiffXsec->push_back(truth->fDiffXsec);
172  fGPhaseSpace->push_back(truth->fGPhaseSpace);
173 
174  fProbePDG->push_back(truth->fProbePDG);
175  fProbePx->push_back(truth->fProbeP4.Px());
176  fProbePy->push_back(truth->fProbeP4.Py());
177  fProbePz->push_back(truth->fProbeP4.Pz());
178  fProbeE->push_back(truth->fProbeP4.E());
179 
180  fTgtPx->push_back(truth->fProbeP4.Px());
181  fTgtPy->push_back(truth->fProbeP4.Py());
182  fTgtPz->push_back(truth->fProbeP4.Pz());
183  fTgtE->push_back(truth->fProbeP4.E());
184  fTgtZ->push_back(truth->ftgtZ);
185  fTgtA->push_back(truth->ftgtA);
186  fTgtPDG->push_back(truth->ftgtPDG);
187  fHitNucPDG->push_back(truth->fHitNucPDG);
188  fHitQrkPDG->push_back(truth->fHitQrkPDG);
189  fIsSeaQuark->push_back(truth->fIsSeaQuark);
190 
191  fHitNucPx->push_back(truth->fHitNucP4.Px());
192  fHitNucPy->push_back(truth->fHitNucP4.Py());
193  fHitNucPz->push_back(truth->fHitNucP4.Pz());
194  fHitNucE->push_back(truth->fHitNucP4.E());
195  fHitNucPos->push_back(truth->fHitNucPos);
196  fGscatter->push_back(truth->fGscatter);
197  fGint->push_back(truth->fGint);
198  fGQ2->push_back(truth->fgQ2);
199  fGq2->push_back(truth->fgq2);
200  fGW->push_back(truth->fgW);
201  fGT->push_back(truth->fgT);
202  fGX->push_back(truth->fgX);
203  fGY->push_back(truth->fgY);
204 
205  fFSleptonPx->push_back(truth->fFSleptonP4.Px());
206  fFSleptonPy->push_back(truth->fFSleptonP4.Py());
207  fFSleptonPz->push_back(truth->fFSleptonP4.Pz());
208  fFSleptonE->push_back(truth->fFSleptonP4.E());
209 
210  fFShadSystPx->push_back(truth->fFShadSystP4.Px());
211  fFShadSystPy->push_back(truth->fFShadSystP4.Py());
212  fFShadSystPz->push_back(truth->fFShadSystP4.Pz());
213  fFShadSystE->push_back(truth->fFShadSystP4.E());
214 
215  fIsCharm->push_back(truth->fIsCharm);
216  fCharmHadronPDG->push_back(truth->fCharmHadronPdg);
217  fIsStrange->push_back(truth->fIsStrange);
218  fStrangeHadronPDG->push_back(truth->fStrangeHadronPdg);
219  fNumProton->push_back(truth->fNumProton);
220  fNumNeutron->push_back(truth->fNumNeutron);
221  fNumPi0->push_back(truth->fNumPi0);
222  fNumPiPlus->push_back(truth->fNumPiPlus);
223  fNumPiMinus->push_back(truth->fNumPiMinus);
224  fResNum->push_back(truth->fResNum);
225  fDecayMode->push_back(truth->fDecayMode);
226 }//FillGTruth()
bool fIsCharm
did the interaction produce a charmed hadron?
Definition: GTruth.h:69
vector< double > * fFShadSystPz
Definition: FlatGenTree.h:240
vector< double > * fHitNucPy
Definition: FlatGenTree.h:219
double fgq2
Definition: GTruth.h:60
vector< double > * fTgtE
Definition: FlatGenTree.h:209
vector< int > * fNumPiPlus
Definition: FlatGenTree.h:250
int fCharmHadronPdg
Definition: GTruth.h:70
vector< double > * fGq2
Definition: FlatGenTree.h:227
int fStrangeHadronPdg
Definition: GTruth.h:72
vector< double > * fFSleptonPz
Definition: FlatGenTree.h:235
vector< double > * fGY
Definition: FlatGenTree.h:231
int fNumPiMinus
number of pi minuses after reaction, before FSI
Definition: GTruth.h:77
double fweight
event interaction weight (genie internal)
Definition: GTruth.h:32
vector< double > * fFSleptonPx
Definition: FlatGenTree.h:233
vector< double > * fTgtPx
Definition: FlatGenTree.h:206
vector< double > * fGQ2
Definition: FlatGenTree.h:226
int fNumProton
number of protons after reaction, before FSI
Definition: GTruth.h:73
vector< int > * fTgtZ
Definition: FlatGenTree.h:211
vector< double > * fProbability
Definition: FlatGenTree.h:195
vector< double > * fHitNucPx
Definition: FlatGenTree.h:218
int fGscatter
neutrino scattering code
Definition: GTruth.h:54
vector< bool > * fIsStrange
Definition: FlatGenTree.h:245
double fgY
Definition: GTruth.h:64
TLorentzVector fFSleptonP4
generated final state primary lepton (LAB frame) // added version 13
Definition: GTruth.h:65
double fgT
Definition: GTruth.h:62
vector< double > * fFSleptonE
Definition: FlatGenTree.h:236
vector< double > * fFShadSystE
Definition: FlatGenTree.h:241
int fNumNeutron
number of neutrons after reaction, before FSI
Definition: GTruth.h:74
int fResNum
resonance number
Definition: GTruth.h:78
vector< double > * fGT
Definition: FlatGenTree.h:229
vector< double > * fProbePz
Definition: FlatGenTree.h:203
TLorentzVector fVertex
Definition: GTruth.h:31
vector< double > * fTgtPy
Definition: FlatGenTree.h:207
vector< double > * fDiffXsec
Definition: FlatGenTree.h:197
vector< double > * fGW
Definition: FlatGenTree.h:228
vector< int > * fResNum
Definition: FlatGenTree.h:252
vector< int > * fDecayMode
Definition: FlatGenTree.h:253
vector< int > * fGscatter
Definition: FlatGenTree.h:224
double fprobability
interaction probability
Definition: GTruth.h:33
vector< int > * fGint
Definition: FlatGenTree.h:225
double fgX
Definition: GTruth.h:63
vector< int > * fGPhaseSpace
Definition: FlatGenTree.h:198
vector< int > * fNumPi0
Definition: FlatGenTree.h:249
int ftgtPDG
PDG of Target Nucleus, nucleon only if free.
Definition: GTruth.h:46
double fXsec
cross section of interaction
Definition: GTruth.h:34
vector< bool > * fIsCharm
Definition: FlatGenTree.h:243
TLorentzVector fProbeP4
Definition: GTruth.h:40
vector< double > * fFSleptonPy
Definition: FlatGenTree.h:234
TLorentzVector fHitNucP4
Definition: GTruth.h:50
vector< double > * fNuZ
Definition: FlatGenTree.h:190
int fNumPi0
number of pi0 after reaction, before FSI
Definition: GTruth.h:75
int fDecayMode
Definition: GTruth.h:79
vector< double > * fNuX
GTruth (one or more per genTree entry) //.
Definition: FlatGenTree.h:188
vector< int > * fHitQrkPDG
Definition: FlatGenTree.h:215
double fHitNucPos
Definition: GTruth.h:51
int fGPhaseSpace
phase space system of DiffXSec
Definition: GTruth.h:36
vector< int > * fTgtPDG
Definition: FlatGenTree.h:213
int fProbePDG
Definition: GTruth.h:39
vector< int > * fHitNucPDG
Definition: FlatGenTree.h:214
double fgW
Definition: GTruth.h:61
double fDiffXsec
differential cross section of interaction
Definition: GTruth.h:35
vector< double > * fTgtPz
Definition: FlatGenTree.h:208
vector< int > * fStrangeHadronPDG
Definition: FlatGenTree.h:246
int fNumPiPlus
number of pi pluses after reaction, before FSI
Definition: GTruth.h:76
vector< double > * fFShadSystPx
Definition: FlatGenTree.h:238
vector< int > * fNumProton
Definition: FlatGenTree.h:247
vector< int > * fNumPiMinus
Definition: FlatGenTree.h:251
vector< bool > * fIsSeaQuark
Definition: FlatGenTree.h:216
vector< double > * fProbePx
Definition: FlatGenTree.h:201
int fHitNucPDG
hit nucleon PDG code
Definition: GTruth.h:47
vector< double > * fNuY
Definition: FlatGenTree.h:189
vector< int > * fProbePDG
Definition: FlatGenTree.h:199
int fGint
interaction code
Definition: GTruth.h:55
vector< double > * fXsec
Definition: FlatGenTree.h:196
vector< int > * fNumNeutron
Definition: FlatGenTree.h:248
vector< double > * fGX
Definition: FlatGenTree.h:230
vector< double > * fProbePy
Definition: FlatGenTree.h:202
bool fIsSeaQuark
Definition: GTruth.h:49
int fHitQrkPDG
hit quark PDG code
Definition: GTruth.h:48
bool fIsStrange
strange production // added version 13
Definition: GTruth.h:71
TLorentzVector fFShadSystP4
generated final state hadronic system (LAB frame)
Definition: GTruth.h:66
vector< double > * fNuT
Definition: FlatGenTree.h:191
vector< double > * fHitNucPos
Definition: FlatGenTree.h:222
vector< double > * fFShadSystPy
Definition: FlatGenTree.h:239
double fgQ2
< these are for the internal (on shell) genie kinematics
Definition: GTruth.h:59
vector< double > * fWeight
Definition: FlatGenTree.h:194
vector< int > * fTgtA
Definition: FlatGenTree.h:212
vector< double > * fHitNucE
Definition: FlatGenTree.h:221
vector< double > * fHitNucPz
Definition: FlatGenTree.h:220
vector< double > * fProbeE
Definition: FlatGenTree.h:204
vector< int > * fCharmHadronPDG
Definition: FlatGenTree.h:244
void MillGenTree::MillTrees ( )
overridevirtual

Implements garana::Mill.

Definition at line 43 of file MillGenTree.cxx.

43  {
44 
45  if(!IsVerified()){
46  std::cerr << "WARNING(MillGenTree::MillTrees): "
47  << "trying to mill trees that have not been verified"
48  << std::endl;
49  return;
50  }
51 
52  std::cout << "MillGenTree: loop over " << fGenIn->NEntries() << " gen entries" << std::endl;
53 
54  //loop over input genTree events (entries)
55  for(size_t ientry=0; ientry<fGenIn->NEntries(); ientry++){
56 
57  //fGenOut->ClearVecs(); //clear previous entry's data (if any)
58  ClearVecs();
59  fGenIn->GetEntry(ientry);
60 
63 
65  fNGen = fGenIn->NGen();
66  std::cout << "MillGen: output NGen = " << fNGen << std::endl;
67  }
68 
69  //loop over gen entries (usually GTruths with 1 per event)
70  std::cout << "MillGenTree: loop over " << fGenIn->NGen() << " igen" <<std::endl;
71  for(size_t igen=0; igen<fGenIn->NGen(); igen++){
72 
73  if(branchToDrawOpt[kFSParticle]) {
74 
75  //loop over FSparticles associated with this GTruth
76  auto const& particles = fGenIn->GetParticles(igen);
77  fNFS->push_back(particles->size());
78  std::cout << "MillGenTree: igen->" << igen << " NFSP->"
79  << fNFS->back() << std::endl;
80  FillFSParticle(particles);
81 
82  }//if filling FSParticle branches
83 
85 
86  const GTruth* truth = fGenIn->GetGTruth(igen);
87 
88  if(!truth)
90  else
91  FillGTruth(truth);
92 
93  }//if filling GTruth branches
94  }//for gen entries
95 
96  fTreeIn->Fill(); //actually our fTreeOut, but it's called fTreeIn in FlatGenTree.h, fill once per event
97  }//for genTree entries
98 
99  fTreeIn->Write();
100 
101 }//Mill()
const std::vector< Int_t > * GetGIndex() const
whether or not subentry is GENIE interaction, index of GENIE interaction
Definition: GenTree.cxx:7
std::map< GenBranch, bool > branchToDrawOpt
Definition: MillGenTree.h:51
const GTruth * GetGTruth(const UInt_t &igen) const
StructuredGenTree * fGenIn
Definition: MillGenTree.h:32
const vector< Int_t > * fGIndex
Definition: FlatGenTree.h:90
TTree * fTreeIn
pointer to the analyzed TTree or TChain
Definition: TreeReader.h:51
void FillFSParticle(const vector< FSParticle > *fsp)
const vector< FSParticle > * GetParticles(const UInt_t &igen) const
vector< UInt_t > * fNFS
number of FSParticles for igen^th GTruth len=NGen
Definition: FlatGenTree.h:174
bool IsVerified() const
Definition: Mill.h:28
virtual void GetEntry(const UInt_t &ientry)
Definition: TreeReader.cxx:39
void FillGTruth(const GTruth *truth)
size_t NEntries() const
Definition: TreeReader.cxx:35
QTextStream & endl(QTextStream &s)
const UInt_t NGen() const override
bool MillGenTree::VerifyBranches ( )
overrideprivatevirtual

Implements garana::Mill.

Definition at line 103 of file MillGenTree.cxx.

103  {
104 
105  // get list of branches and check it matches what we expect
106  const TObjArray* branches = fGenIn->GetBranchList();
107  std::cout << "got ObjArray of branches from fTreeIn" << std::endl;
108  try {
109  if(!branches || branches->GetEntries()==0 )
110  throw branches;
111  }
112  catch(TObjArray* branches){
113  std::cerr << "ERROR(MillGenTree::VerifyBranches): no branches found in passed input tree"
114  << std::endl;
115  return false;
116  }
117 
118  if(branches->GetEntriesFast() != (Int_t)nameToGenBranch.size())
119  std::cout << "WARNING(MillGenTree::VerifyBranches): Mismatch in number of branches (expected "
120  << nameToGenBranch.size() << " but found " << branches->GetEntriesFast()
121  << ")" << std::endl;
122  else
123  std::cout << "found genTree with " << branches->GetEntriesFast() << " branches" << std::endl;
124 
125  // loop over branches
126  TIter next(branches);
127  TBranch* branch = nullptr;
128  while( (branch=(TBranch*)next())) {
129 
130  // check if branch is expected
131  if(nameToGenBranch.find(CharStarToString(branch->GetFullName()))!=nameToGenBranch.end()) {
132 
133  std::cout << " chopping branch '" << branch->GetFullName() << "'" << std::endl;
134 
135  if(nameToGenBranch[CharStarToString(branch->GetFullName())] == kEvent)
136  branchToDrawOpt[kEvent] = true;
137 
138  if(nameToGenBranch[CharStarToString(branch->GetFullName())] == kGIndex)
139  branchToDrawOpt[kGIndex] = true;
140 
141  if(nameToGenBranch[CharStarToString(branch->GetFullName())] == kGTruth)
142  branchToDrawOpt[kGTruth] = true;
143 
144  if(nameToGenBranch[CharStarToString(branch->GetFullName())] == kFSParticle)
146 
147  }//endif known branch
148 
149  else{
150  std::cout << "WARNING(MillGenTree): ignoring unknown branch '"
151  << branch->GetFullName() << "'" << std::endl;
152  }//else
153 
154  }//for branches
155 
156  fIsVerified = true;
157  return true;
158 
159 }//VerifyBranches()
std::map< GenBranch, bool > branchToDrawOpt
Definition: MillGenTree.h:51
StructuredGenTree * fGenIn
Definition: MillGenTree.h:32
std::map< std::string, GenBranch > nameToGenBranch
Definition: MillGenTree.h:44
std::string CharStarToString(const char *cstr)
Definition: Mill.cxx:12
bool fIsVerified
Definition: Mill.h:33
const TObjArray * GetBranchList() const
Definition: TreeReader.cxx:47
QTextStream & endl(QTextStream &s)

Member Data Documentation

std::map<GenBranch,bool> garana::MillGenTree::branchToDrawOpt
private
Initial value:
= {
{kEvent, false},
{kGIndex, false},
{kGTruth, false},
{kFSParticle, false}
}

Definition at line 51 of file MillGenTree.h.

StructuredGenTree* garana::MillGenTree::fGenIn = nullptr
private

Definition at line 32 of file MillGenTree.h.

std::map<std::string,GenBranch> garana::MillGenTree::nameToGenBranch
private
Initial value:
= {
{"Event", kEvent},
{"GIndex", kGIndex},
{"GTruth", kGTruth},
{"FSParticles", kFSParticle}
}

Definition at line 44 of file MillGenTree.h.


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