FlatGenTree.cxx
Go to the documentation of this file.
1 /*
2  * FlatGenTree.cxx
3  *
4  * Created on: Feb 9, 2021
5  * Author: chilgenb
6  */
7 
9 
10 using namespace garana;
11 
13 {
14  SetupRead(tree);
15  fNuP.SetPxPyPzE(0.,0.,0.,0.);
16  fNuVertex.SetXYZT(0.,0.,0.,0.);
17 }
18 
20 {
21  CheckOpt(opt);//sets TreeReader::fOpt
22 
23  if(fOpt=='r'){
24  std::cout << "constructed FlatGenTree object in read-only mode" << std::endl;
25  SetupRead(tree);
26  fNuP.SetPxPyPzE(0.,0.,0.,0.);
27  fNuVertex.SetXYZT(0.,0.,0.,0.);
28  FindFSLimits();
29  }
30  else {
31  std::cout << "constructed FlatGenTree object in write mode" << std::endl;
32  fTreeIn = tree;
33  SetVecs();
35  }
36 
37 }
38 
39 void FlatGenTree::GetEntry(const UInt_t& entry) {
40  this->fGenToFSLimits.clear();
41  fTreeIn->GetEntry(entry);
42  this->FindFSLimits();
43 }
44 
46 
47 std::cout << "FlatGenTree SetBranchAddresses()" << std::endl;
48 
49  if(fOpt=='r'){
50  fTreeIn->SetBranchAddress("Event", &fEvent, &b_Event );
51  fTreeIn->SetBranchAddress("NGen", &fNGen, &b_NGen );
52  fTreeIn->SetBranchAddress("GIndex", &fGIndex, &b_GIndex );
53  //fTreeIn->SetBranchAddress("FSIndex", &fFSIndex, &b_FSIndex );
54 
55 
56  //FSParticles
57  fTreeIn->SetBranchAddress("NFSParticle", &fNFS, &b_NFS );
58  fTreeIn->SetBranchAddress("FSParticleIndex", &fFSIndex, &b_FSIndex );
59  fTreeIn->SetBranchAddress("FSParticlePDG", &fFSPdg, &b_FSPdg );
60  fTreeIn->SetBranchAddress("FSParticleX", &fFSPosX, &b_FSPosX );
61  fTreeIn->SetBranchAddress("FSParticleY", &fFSPosY, &b_FSPosY );
62  fTreeIn->SetBranchAddress("FSParticleZ", &fFSPosZ, &b_FSPosZ );
63  fTreeIn->SetBranchAddress("FSParticleT", &fFST, &b_FST );
64  fTreeIn->SetBranchAddress("FSParticlePx", &fFSMomX, &b_FSMomX );
65  fTreeIn->SetBranchAddress("FSParticlePy", &fFSMomY, &b_FSMomY );
66  fTreeIn->SetBranchAddress("FSParticlePz", &fFSMomZ, &b_FSMomZ );
67  fTreeIn->SetBranchAddress("FSParticleE", &fFSE , &b_FSE );
68 
69  //GTruth
70  fTreeIn->SetBranchAddress("GNuX", &fNuX, &b_NuX );
71  fTreeIn->SetBranchAddress("GNuY", &fNuY, &b_NuY );
72  fTreeIn->SetBranchAddress("GNuZ", &fNuZ, &b_NuZ );
73  fTreeIn->SetBranchAddress("GNuT", &fNuT, &b_NuT );
74  fTreeIn->SetBranchAddress("GNuRegion", &fNuRegion, &b_NuRegion );
75 
76  fTreeIn->SetBranchAddress("GWeight", &fWeight, &b_Weight );
77  fTreeIn->SetBranchAddress("GProbability", &fProbability, &b_Probability );
78  fTreeIn->SetBranchAddress("GXsec", &fXsec, &b_Xsec );
79  fTreeIn->SetBranchAddress("GDiffXsec", &fDiffXsec, &b_DiffXsec );
80  fTreeIn->SetBranchAddress("GGPhaseSpace", &fGPhaseSpace, &b_GPhaseSpace );
81  fTreeIn->SetBranchAddress("GProbePDG", &fProbePDG, &b_ProbePDG );
82 
83  fTreeIn->SetBranchAddress("GProbePx", &fProbePx, &b_ProbePx );
84  fTreeIn->SetBranchAddress("GProbePy", &fProbePy, &b_ProbePy );
85  fTreeIn->SetBranchAddress("GProbePz", &fProbePz, &b_ProbePz );
86  fTreeIn->SetBranchAddress("GProbeE ", &fProbeE , &b_ProbeE );
87 
88  fTreeIn->SetBranchAddress("GTgtPx", &fTgtPx, &b_TgtPx );
89  fTreeIn->SetBranchAddress("GTgtPy", &fTgtPy, &b_TgtPy );
90  fTreeIn->SetBranchAddress("GTgtPz", &fTgtPz, &b_TgtPz );
91  fTreeIn->SetBranchAddress("GTgtE ", &fTgtE , &b_TgtE );
92 
93  fTreeIn->SetBranchAddress("GTgtZ", &fTgtZ, &b_TgtZ );
94  fTreeIn->SetBranchAddress("GTgtA", &fTgtA, &b_TgtA );
95  fTreeIn->SetBranchAddress("GTgtPDG", &fTgtPDG, &b_TgtPDG );
96  fTreeIn->SetBranchAddress("GHitNucPDG ", &fHitNucPDG, &b_HitNucPDG );
97  fTreeIn->SetBranchAddress("GHitQrkPDG ", &fHitQrkPDG, &b_HitQrkPDG );
98  fTreeIn->SetBranchAddress("GIsSeaQuark", &fIsSeaQuark, &b_IsSeaQuark );
99 
100  fTreeIn->SetBranchAddress("GHitNucPx", &fHitNucPx, &b_HitNucPx );
101  fTreeIn->SetBranchAddress("GHitNucPy", &fHitNucPy, &b_HitNucPy );
102  fTreeIn->SetBranchAddress("GHitNucPz", &fHitNucPz, &b_HitNucPz );
103  fTreeIn->SetBranchAddress("GHitNucE", &fHitNucE, &b_HitNucE );
104  fTreeIn->SetBranchAddress("GHitNucPos", &fHitNucPos, &b_HitNucPos );
105 
106  fTreeIn->SetBranchAddress("GGscatter", &fGscatter, &b_Gscatter );
107  fTreeIn->SetBranchAddress("GGint", &fGint, &b_Gint );
108  fTreeIn->SetBranchAddress("GGQ2", &fGQ2, &b_GQ2 );
109  fTreeIn->SetBranchAddress("GGq2", &fGq2, &b_Gq2 );
110  fTreeIn->SetBranchAddress("GGW", &fGW, &b_GW );
111  fTreeIn->SetBranchAddress("GGT", &fGT, &b_GT );
112  fTreeIn->SetBranchAddress("GGX", &fGX, &b_GX );
113  fTreeIn->SetBranchAddress("GGY", &fGY, &b_GY );
114 
115  fTreeIn->SetBranchAddress("GFSleptonPx", &fFSleptonPx, &b_FSleptonPx );
116  fTreeIn->SetBranchAddress("GFSleptonPy", &fFSleptonPy, &b_FSleptonPy );
117  fTreeIn->SetBranchAddress("GFSleptonPz", &fFSleptonPz, &b_FSleptonPz );
118  fTreeIn->SetBranchAddress("GFSleptonE", &fFSleptonE , &b_FSleptonE );
119 
120  fTreeIn->SetBranchAddress("GFShadSystPx", &fFShadSystPx, &b_FShadSystPx );
121  fTreeIn->SetBranchAddress("GFShadSystPy", &fFShadSystPy, &b_FShadSystPy );
122  fTreeIn->SetBranchAddress("GFShadSystPz", &fFShadSystPz, &b_FShadSystPz );
123  fTreeIn->SetBranchAddress("GFShadSystE", &fFShadSystE , &b_FShadSystE );
124 
125  fTreeIn->SetBranchAddress("GIsCharm", &fIsCharm, &b_IsCharm );
126  fTreeIn->SetBranchAddress("GCharmHadronPDG", &fCharmHadronPDG, &b_CharmHadronPDG );
127  fTreeIn->SetBranchAddress("GIsStrange", &fIsStrange, &b_IsStrange );
128  fTreeIn->SetBranchAddress("GStrangeHadronPDG", &fStrangeHadronPDG, &b_StrangeHadronPDG);
129  fTreeIn->SetBranchAddress("GNumProton", &fNumProton, &b_NumProton );
130  fTreeIn->SetBranchAddress("GNumNeutron", &fNumNeutron, &b_NumNeutron );
131  fTreeIn->SetBranchAddress("GNumPi0", &fNumPi0, &b_NumPi0 );
132  fTreeIn->SetBranchAddress("GNumPiPlus", &fNumPiPlus, &b_NumPiPlus );
133  fTreeIn->SetBranchAddress("GNumPiMinus", &fNumPiMinus, &b_NumPiMinus );
134  fTreeIn->SetBranchAddress("GResNum", &fResNum, &b_ResNum );
135  fTreeIn->SetBranchAddress("GDecayMode", &fDecayMode, &b_DecayMode );
136  }
137 
138 
139  if(fOpt=='w'){
140 
141  fTreeIn->Branch("Event", &fEvent, "Event/I");
142  fTreeIn->Branch("NGen", &fNGen, "NGen/I");
143  fTreeIn->Branch("GIndex", &fGIndex );
144 
145  //FSParticlees
146  fTreeIn->Branch("NFSParticle", &fNFS );
147  fTreeIn->Branch("FSParticleIndex", &fFSIndex );
148  fTreeIn->Branch("FSParticlePDG", &fFSPdg );
149  fTreeIn->Branch("FSParticleX", &fFSPosX );
150  fTreeIn->Branch("FSParticleY", &fFSPosY );
151  fTreeIn->Branch("FSParticleZ", &fFSPosZ );
152  fTreeIn->Branch("FSParticleT", &fFST );
153  fTreeIn->Branch("FSParticlePx", &fFSMomX );
154  fTreeIn->Branch("FSParticlePy", &fFSMomY );
155  fTreeIn->Branch("FSParticlePz", &fFSMomZ );
156  fTreeIn->Branch("FSParticleE", &fFSE );
157 
158  //GTruth
159  fTreeIn->Branch("GNuX", &fNuXObj );
160  fTreeIn->Branch("GNuY", &fNuYObj );
161  fTreeIn->Branch("GNuZ", &fNuZObj );
162  fTreeIn->Branch("GNuT", &fNuTObj );
163  fTreeIn->Branch("GNuRegion", &fNuVertex ); //TODO check if need obj
164 
165  fTreeIn->Branch("GWeight", &fWeightObj );
166  fTreeIn->Branch("GProbability", &fProbabilityObj );
167  fTreeIn->Branch("GXsec", &fXsecObj );
168  fTreeIn->Branch("GDiffXsec", &fDiffXsecObj );
169  fTreeIn->Branch("GGPhaseSpace", &fGPhaseSpaceObj );
170  fTreeIn->Branch("GProbePDG", &fProbePDGObj );
171 
172  fTreeIn->Branch("GProbePx", &fProbePxObj );
173  fTreeIn->Branch("GProbePy", &fProbePyObj );
174  fTreeIn->Branch("GProbePz", &fProbePzObj );
175  fTreeIn->Branch("GProbeE ", &fProbeEObj );
176 
177  fTreeIn->Branch("GTgtPx", &fTgtPxObj );
178  fTreeIn->Branch("GTgtPy", &fTgtPyObj );
179  fTreeIn->Branch("GTgtPz", &fTgtPzObj );
180  fTreeIn->Branch("GTgtE ", &fTgtEObj );
181 
182  fTreeIn->Branch("GTgtZ", &fTgtZObj );
183  fTreeIn->Branch("GTgtA", &fTgtAObj );
184  fTreeIn->Branch("GTgtPDG", &fTgtPDGObj );
185  fTreeIn->Branch("GHitNucPDG ", &fHitNucPDGObj );
186  fTreeIn->Branch("GHitQrkPDG ", &fHitQrkPDGObj );
187  fTreeIn->Branch("GIsSeaQuark", &fIsSeaQuarkObj );
188 
189  fTreeIn->Branch("GHitNucPx", &fHitNucPxObj );
190  fTreeIn->Branch("GHitNucPy", &fHitNucPyObj );
191  fTreeIn->Branch("GHitNucPz", &fHitNucPzObj );
192  fTreeIn->Branch("GHitNucE", &fHitNucEObj );
193  fTreeIn->Branch("GHitNucPos", &fHitNucPosObj );
194 
195  fTreeIn->Branch("GGscatter", &fGscatterObj );
196  fTreeIn->Branch("GGint", &fGintObj );
197  fTreeIn->Branch("GGQ2", &fGQ2Obj );
198  fTreeIn->Branch("GGq2", &fGq2Obj );
199  fTreeIn->Branch("GGW", &fGWObj );
200  fTreeIn->Branch("GGT", &fGTObj );
201  fTreeIn->Branch("GGX", &fGXObj );
202  fTreeIn->Branch("GGY", &fGYObj );
203 
204  fTreeIn->Branch("GFSleptonPx", &fFSleptonPxObj );
205  fTreeIn->Branch("GFSleptonPy", &fFSleptonPyObj );
206  fTreeIn->Branch("GFSleptonPz", &fFSleptonPzObj );
207  fTreeIn->Branch("GFSleptonE", &fFSleptonEObj );
208 
209  fTreeIn->Branch("GFShadSystPx", &fFShadSystPxObj );
210  fTreeIn->Branch("GFShadSystPy", &fFShadSystPyObj );
211  fTreeIn->Branch("GFShadSystPz", &fFShadSystPzObj );
212  fTreeIn->Branch("GFShadSystE", &fFShadSystEObj );
213 
214  fTreeIn->Branch("GIsCharm", &fIsCharmObj );
215  fTreeIn->Branch("GCharmHadronPDG", &fCharmHadronPDGObj );
216  fTreeIn->Branch("GIsStrange", &fIsStrangeObj );
217  fTreeIn->Branch("GStrangeHadronPDG", &fStrangeHadronPDGObj);
218  fTreeIn->Branch("GNumProton", &fNumProtonObj );
219  fTreeIn->Branch("GNumNeutron", &fNumNeutronObj );
220  fTreeIn->Branch("GNumPi0", &fNumPi0Obj );
221  fTreeIn->Branch("GNumPiPlus", &fNumPiPlusObj );
222  fTreeIn->Branch("GNumPiMinus", &fNumPiMinusObj );
223  fTreeIn->Branch("GResNum", &fResNumObj );
224  fTreeIn->Branch("GDecayMode", &fDecayModeObj );
225  }
226 
227  return true;
228 }
229 
230 //implement accessors inherited from GenTree
231 const UInt_t FlatGenTree::NGen() const {
232  return fNGen;
233 }
234 
235 const UInt_t FlatGenTree::NFSParticles(const UInt_t& igen) const {
236  return fNFS->at(igen);
237 }
238 
239 const Bool_t FlatGenTree::IsGenie(const UInt_t& igen ) const {
240 
241  if (fGIndex->at(igen) >-1)
242  return kTRUE;
243  else
244  return kFALSE;
245 }
246 
247 const Bool_t FlatGenTree::IsCC(const UInt_t& igen ) const {
248 
249  if(IsGenie(igen))
250  return fGint->at(igen) == 2;
251 
252  return kFALSE;
253 }
254 
255 const int FlatGenTree::NuRegion(const UInt_t& igen ) const {
256  return fNuRegion->at(igen);
257 }
258 
259 const Int_t FlatGenTree::NuPDG(const UInt_t& igen ) const {
260  return fProbePDG->at(igen);
261 }
262 
263 const TLorentzVector* FlatGenTree::NuP(const UInt_t& igen) {
264 
265  if(!IsGenie(igen))
266  return nullptr;
267 
268  fNuP.SetPxPyPzE(fProbePx->at(igen), fProbePy->at(igen),
269  fProbePz->at(igen), fProbeE->at(igen));
270  return &fNuP;
271 }
272 
273 const TLorentzVector* FlatGenTree::NuVertex(const UInt_t& igen) {
274 
275  if(!IsGenie(igen))
276  return nullptr;
277 
278  fNuVertex.SetXYZT(fNuX->at(igen), fNuY->at(igen),
279  fNuZ->at(igen), fNuT->at(igen));
280 
281  return &fNuVertex;
282 }
283 
284 const int FlatGenTree::ScatterCode(const UInt_t& igen) const {
285  return fGscatter->at(igen);
286 }
287 
288 const int FlatGenTree::InteractCode(const UInt_t& igen) const {
289  return fGint->at(igen);
290 }
291 
292 const TLorentzVector* FlatGenTree::TgtP4(const UInt_t& igen) const {
293  const TLorentzVector* v = new TLorentzVector(fTgtPx->at(igen),fTgtPy->at(igen),
294  fTgtPz->at(igen), fTgtE->at(igen));
295  return v;
296 }
297 
298 const int FlatGenTree::TgtZ(const UInt_t& igen ) const {
299  return fTgtZ->at(igen);
300 }
301 
302 const int FlatGenTree::TgtA(const UInt_t& igen ) const {
303  return fTgtA->at(igen);
304 }
305 
306 const int FlatGenTree::TgtPDG(const UInt_t& igen ) const {
307  return fTgtPDG->at(igen);
308 }
309 
310 const int FlatGenTree::HitNucPDG(const UInt_t& igen ) const {
311  return fHitNucPDG->at(igen);
312 }
313 
314 const TLorentzVector* FlatGenTree::HitNucP4(const UInt_t& igen ) const {
315  const TLorentzVector* v = new TLorentzVector(fHitNucPx->at(igen),fHitNucPy->at(igen),
316  fHitNucPz->at(igen), fHitNucE->at(igen));
317  return v;
318 }
319 
320 const double FlatGenTree::Q2(const UInt_t& igen ) const {
321  return fGQ2->at(igen);
322 }
323 
324 const double FlatGenTree::q2(const UInt_t& igen ) const {
325  return fGq2->at(igen);
326 }
327 
328 const double FlatGenTree::W(const UInt_t& igen ) const {
329  return fGW->at(igen);
330 }
331 
332 const double FlatGenTree::T(const UInt_t& igen ) const {
333  return fGT->at(igen);
334 }
335 
336 const double FlatGenTree::X(const UInt_t& igen ) const {
337  return fGX->at(igen);
338 }
339 
340 const double FlatGenTree::Y(const UInt_t& igen ) const {
341  return fGY->at(igen);
342 }
343 
344 const TLorentzVector* FlatGenTree::FSLeptonP4(const UInt_t& igen ) const {
345  const TLorentzVector* v = new TLorentzVector(fFSleptonPx->at(igen),fFSleptonPy->at(igen),
346  fFSleptonPz->at(igen), fFSleptonE->at(igen));
347  return v;
348 }
349 
350 const TLorentzVector* FlatGenTree::FSHadSystP4(const UInt_t& igen ) const {
351  const TLorentzVector* v = new TLorentzVector(fFShadSystPx->at(igen),fFShadSystPy->at(igen),
352  fFShadSystPz->at(igen), fFShadSystE->at(igen));
353  return v;
354 }
355 
356 const int FlatGenTree::NumNuProton(const UInt_t& igen) const {
357  return fNumProton->at(igen);
358 }
359 
360 const int FlatGenTree::NumNuNeutron(const UInt_t& igen) const {
361  return fNumNeutron->at(igen);
362 }
363 
364 const int FlatGenTree::NumNuPi0(const UInt_t& igen) const {
365  return fNumPi0->at(igen);
366 }
367 
368 const int FlatGenTree::NumNuPiPlus(const UInt_t& igen) const {
369  return fNumPiPlus->at(igen);
370 }
371 
372 const int FlatGenTree::NumNuPiMinus(const UInt_t& igen) const {
373  return fNumPiMinus->at(igen);
374 }
375 
376 const Float_t FlatGenTree::FSTotEnergy(const UInt_t& igen) const {
377 
378  Float_t e = 0.;
379  for(UInt_t i = fGenToFSLimits[igen].first; i < fGenToFSLimits[igen].second + 1; i++){
380  e += fFSE->at(i);
381  }
382  return e;
383 }
384 
385 const Float_t FlatGenTree::FSEnergy(const UInt_t& igen, const UInt_t& ifsp) const {
386  return fFSE->at(fGenToFSLimits[igen].first+ifsp);
387 }
388 
389 const Float_t FlatGenTree::FSPDG(const UInt_t& igen, const UInt_t& ifsp) const {
390  return fFSPdg->at(fGenToFSLimits[igen].first+ifsp);
391 }
392 
393 const Int_t FlatGenTree::FSTrackId(const UInt_t& igen, const UInt_t& ifsp) const {
394  return fFSTrackId->at(fGenToFSLimits[igen].first+ifsp);
395 }
396 
397  std::pair<UInt_t,UInt_t> FlatGenTree::FSParticlesFromGTruth(size_t igen) const{
398 
399  if(fGenToFSLimits.size()==0)
400  return {UINT_MAX,UINT_MAX};
401 
402  return fGenToFSLimits[igen];
403 
404  }
405 
407 
408  if(fOpt!='r')
409  return;
410  std::cout << "FindFSLimits called" << std::endl;
411 
412  if(fGenToFSLimits.size()!=0){
413  std::cerr << "FlatGenTree::FindFSLimits: fGenToFSLimits has already been filled"
414  << std::endl;
415  return;
416  }
417 
418  //it should be the case that FSParticle vecs are filled consecutively for each igen
419  fsBegin beg = 0;
420  fsEnd end =0;
421  if(fNGen>0){
422  std::cout << "In FindFSLimits, about to loop over " << fNGen << " igen" << std::endl;
423  }
424  else {
425  std::cerr << "FlatGenTree::FindFSLimits: bad NGen ("
426  << fNGen << ")" << std::endl;
427  return;
428  }
429 
430  for(UInt_t igen=1; igen<(UInt_t)fNGen+1; igen++){
431 
432  end = fNFS->at(igen-1) - 1 + beg;
433  std::cout << "igen = " << igen << ", beg = " << beg
434  << ", end = " << end << ", NFS = "
435  << fNFS->back() << std::endl;;
436  std::pair<fsBegin,fsEnd> limits = {beg,end};
437  fGenToFSLimits.push_back(limits);
438 
439  if(igen<(UInt_t)fNGen)
440  beg = fNFS->at(igen);
441  }
442 
443  std::cout << "done with FSLimits." << std::endl;
444  }
445 
447 
448  fNFS = /*new vector<UInt_t>();*/ &(fNFSObj);
449  fFSIndex = /*new vector<UInt_t>();*/ &(fFSIndexObj);
450  fFSPdg = /*new vector<UInt_t>();*/ &(fFSPdgObj);
451  fFSPosX = /*new vector<Float_t>();*/ &(fFSPosXObj);
452  fFSPosY = /*new vector<Float_t>();*/ &(fFSPosYObj);
453  fFSPosZ = /*new vector<Float_t>();*/ &(fFSPosZObj);
454  fFST = /*new vector<Float_t>();*/ &(fFSTObj);
455  fFSMomX = /*new vector<Float_t>();*/ &(fFSMomXObj);
456  fFSMomY = /*new vector<Float_t>();*/ &(fFSMomYObj);
457  fFSMomZ = /*new vector<Float_t>();*/ &(fFSMomZObj);
458  fFSE = /*new vector<Float_t>();*/ &(fFSEObj);
459 
460  fNuX = /*new vector<double>();*/ &(fNuXObj);
461  fNuY = /*new vector<double>();*/ &(fNuYObj);
462  fNuZ = /*new vector<double>();*/ &(fNuZObj);
463  fNuT = /*new vector<double>();*/ &(fNuTObj);
464 
465  fWeight = /*new vector<double>();*/ &(fWeightObj);
466  fProbability = /*new vector<double>();*/ &(fProbabilityObj);
467  fXsec = /*new vector<double>();*/ &(fXsecObj);
468  fDiffXsec = /*new vector<double>();*/ &(fDiffXsecObj);
469  fGPhaseSpace = /*new vector<int>();*/ &(fGPhaseSpaceObj);
470  fProbePDG = /*new vector<int>();*/ &(fProbePDGObj);
471 
472  fProbePx = /*new vector<double>();*/ &(fProbePxObj);
473  fProbePy = /*new vector<double>();*/ &(fProbePyObj);
474  fProbePz = /*new vector<double>();*/ &(fProbePzObj);
475  fProbeE = /*new vector<double>();*/ &(fProbeEObj);
476 
477  fTgtPx = /*new vector<double>();*/ &(fTgtPxObj);
478  fTgtPy = /*new vector<double>();*/ &(fTgtPyObj);
479  fTgtPz = /*new vector<double>();*/ &(fTgtPzObj);
480  fTgtE = /*new vector<double>();*/ &(fTgtEObj);
481 
482  fTgtZ = /*new vector<int>();*/ &(fTgtZObj);
483  fTgtA = /*new vector<int>();*/ &(fTgtAObj);
484  fTgtPDG = /*new vector<int>();*/ &(fTgtPDGObj);
485  fHitNucPDG = /*new vector<int>();*/ &(fHitNucPDGObj);
486  fHitQrkPDG = /*new vector<int>();*/ &(fHitQrkPDGObj);
487  fIsSeaQuark = /*new vector<bool>();*/ &(fIsSeaQuarkObj);
488 
489  fHitNucPx = /*new vector<double>();*/ &(fHitNucPxObj);
490  fHitNucPy = /*new vector<double>();*/ &(fHitNucPyObj);
491  fHitNucPz = /*new vector<double>();*/ &(fHitNucPzObj);
492  fHitNucE = /*new vector<double>();*/ &(fHitNucEObj);
493  fHitNucPos = /*new vector<double>();*/ &(fHitNucPosObj);
494 
495  fGscatter = /*new vector<int>();*/ &(fGscatterObj);
496  fGint = /*new vector<int>();*/ &(fGintObj);
497  fGQ2 = /*new vector<double>();*/ &(fGQ2Obj);
498  fGq2 = /*new vector<double>();*/ &(fGq2Obj);
499  fGW = /*new vector<double>();*/ &(fGWObj);
500  fGT = /*new vector<double>();*/ &(fGTObj);
501  fGX = /*new vector<double>();*/ &(fGXObj);
502  fGY = /*new vector<double>();*/ &(fGYObj);
503 
504  fFSleptonPx = /*new vector<double>();*/ &(fFSleptonPxObj);
505  fFSleptonPy = /*new vector<double>();*/ &(fFSleptonPyObj);
506  fFSleptonPz = /*new vector<double>();*/ &(fFSleptonPzObj);
507  fFSleptonE = /*new vector<double>();*/ &(fFSleptonEObj);
508 
509  fFShadSystPx = /*new vector<double>();*/ &(fFShadSystPxObj);
510  fFShadSystPy = /*new vector<double>();*/ &(fFShadSystPyObj);
511  fFShadSystPz = /*new vector<double>();*/ &(fFShadSystPzObj);
512  fFShadSystE = /*new vector<double>();*/ &(fFShadSystEObj);
513 
514  fIsCharm = /*new vector<bool>();*/ &(fIsCharmObj);
515  fCharmHadronPDG = /*new vector<int>();*/ &(fCharmHadronPDGObj);
516  fIsStrange = /*new vector<bool>();*/ &(fIsStrangeObj);
517  fStrangeHadronPDG = /*new vector<int>();*/ &(fStrangeHadronPDGObj);
518  fNumProton = /*new vector<int>();*/ &(fNumProtonObj);
519  fNumNeutron = /*new vector<int>();*/ &(fNumNeutronObj);
520  fNumPi0 = /*new vector<int>();*/ &(fNumPi0Obj);
521  fNumPiPlus = /*new vector<int>();*/ &(fNumPiPlusObj);
522  fNumPiMinus = /*new vector<int>();*/ &(fNumPiMinusObj);
523  fResNum = /*new vector<int>();*/ &(fResNumObj);
524  fDecayMode = /*new vector<int>();*/ &(fDecayModeObj);
525 
526  }
527 
529 
530  fNFS->clear();
531  fFSIndex->clear();
532  fFSPdg->clear();
533  fFSPosX->clear();
534  fFSPosY->clear();
535  fFSPosZ->clear();
536  fFST->clear();
537  fFSMomX->clear();
538  fFSMomY->clear();
539  fFSMomZ->clear();
540  fFSE->clear();
541 
542  fNuX->clear();
543  fNuY->clear();
544  fNuZ->clear();
545  fNuT->clear();
546 
547  fWeight->clear();
548  fProbability->clear();
549  fXsec->clear();
550  fDiffXsec->clear();
551  fGPhaseSpace->clear();
552  fProbePDG->clear();
553 
554  fProbePx->clear();
555  fProbePy->clear();
556  fProbePz->clear();
557  fProbeE->clear();
558 
559  fTgtPx->clear();
560  fTgtPy->clear();
561  fTgtPz->clear();
562  fTgtE->clear();
563 
564  fTgtZ->clear();
565  fTgtA->clear();
566  fTgtPDG->clear();
567  fHitNucPDG->clear();
568  fHitQrkPDG->clear();
569  fIsSeaQuark->clear();
570 
571  fHitNucPx->clear();
572  fHitNucPy->clear();
573  fHitNucPz->clear();
574  fHitNucE->clear();
575  fHitNucPos->clear();
576 
577  fGscatter->clear();
578  fGint->clear();
579  fGQ2->clear();
580  fGq2->clear();
581  fGW->clear();
582  fGT->clear();
583  fGX->clear();
584  fGY->clear();
585 
586  fFSleptonPx->clear();
587  fFSleptonPy->clear();
588  fFSleptonPz->clear();
589  fFSleptonE ->clear();
590 
591  fFShadSystPx->clear();
592  fFShadSystPy->clear();
593  fFShadSystPz->clear();
594  fFShadSystE->clear();
595 
596  fIsCharm->clear();
597  fCharmHadronPDG->clear();
598  fIsStrange->clear();
599  fStrangeHadronPDG->clear();
600  fNumProton->clear();
601  fNumNeutron->clear();
602  fNumPi0->clear();
603  fNumPiPlus->clear();
604  fNumPiMinus->clear();
605  fResNum->clear();
606  fDecayMode->clear();
607 
608  }
vector< double > fFShadSystEObj
Definition: FlatGenTree.h:158
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
vector< double > fTgtEObj
Definition: FlatGenTree.h:126
vector< int > fTgtZObj
Definition: FlatGenTree.h:128
vector< double > * fFShadSystPz
Definition: FlatGenTree.h:240
vector< double > fTgtPyObj
Definition: FlatGenTree.h:124
vector< double > * fHitNucPy
Definition: FlatGenTree.h:219
vector< double > fFShadSystPyObj
Definition: FlatGenTree.h:156
vector< int > fResNumObj
Definition: FlatGenTree.h:169
const double X(const UInt_t &igen) const override
const int NumNuNeutron(const UInt_t &igen) const override
number of neutrons after reaction, before FSI
vector< int > fNumPiMinusObj
Definition: FlatGenTree.h:168
vector< Float_t > fFSPosYObj
y-coordinate [cm]
Definition: FlatGenTree.h:97
vector< double > * fTgtE
Definition: FlatGenTree.h:209
vector< int > * fNumPiPlus
Definition: FlatGenTree.h:250
vector< Float_t > fFSPosXObj
x-coordinate [cm]
Definition: FlatGenTree.h:96
TBranch * b_NumProton
Definition: FlatGenTree.h:330
vector< double > fProbePzObj
Definition: FlatGenTree.h:120
TBranch * b_HitNucPy
Definition: FlatGenTree.h:302
QList< Entry > entry
TBranch * b_HitNucPos
Definition: FlatGenTree.h:305
vector< double > fFSleptonPxObj
Definition: FlatGenTree.h:150
const double Q2(const UInt_t &igen) const override
vector< double > * fGq2
Definition: FlatGenTree.h:227
vector< double > fHitNucPyObj
Definition: FlatGenTree.h:136
vector< Float_t > fFSMomXObj
momentum, x-component [GeV/c]
Definition: FlatGenTree.h:100
TBranch * b_Gscatter
Definition: FlatGenTree.h:307
const Int_t FSTrackId(const UInt_t &igen, const UInt_t &ifsp) const override
vector< double > fFShadSystPxObj
Definition: FlatGenTree.h:155
vector< double > fGWObj
Definition: FlatGenTree.h:145
vector< double > * fFSleptonPz
Definition: FlatGenTree.h:235
vector< Float_t > fFSMomZObj
momentum, z-component [GeV/c]
Definition: FlatGenTree.h:102
vector< double > * fGY
Definition: FlatGenTree.h:231
vector< Float_t > fFSTObj
time [ns]
Definition: FlatGenTree.h:99
const int NumNuPiPlus(const UInt_t &igen) const override
number of pi pluses after reaction, before FSI
vector< double > fHitNucPosObj
Definition: FlatGenTree.h:139
const int HitNucPDG(const UInt_t &igen) const override
hit nucleon PDG code
TBranch * b_FSleptonPz
Definition: FlatGenTree.h:318
const Float_t FSPDG(const UInt_t &igen, const UInt_t &ifsp) const override
TBranch * b_FShadSystPx
Definition: FlatGenTree.h:321
const vector< Int_t > * fGIndex
Definition: FlatGenTree.h:90
vector< int > fHitNucPDGObj
Definition: FlatGenTree.h:131
vector< double > fWeightObj
Definition: FlatGenTree.h:111
opt
Definition: train.py:196
vector< int > fGscatterObj
Definition: FlatGenTree.h:141
const int NumNuPiMinus(const UInt_t &igen) const override
number of pi minuses after reaction, before FSI
vector< int > fGintObj
Definition: FlatGenTree.h:142
vector< double > fFShadSystPzObj
Definition: FlatGenTree.h:157
vector< UInt_t > fFSIndexObj
Definition: FlatGenTree.h:94
vector< double > fHitNucEObj
Definition: FlatGenTree.h:138
const Float_t FSEnergy(const UInt_t &igen, const UInt_t &ifsp) const override
vector< double > * fFSleptonPx
Definition: FlatGenTree.h:233
vector< Float_t > * fFSPosY
y-coordinate [cm]
Definition: FlatGenTree.h:179
vector< double > * fTgtPx
Definition: FlatGenTree.h:206
vector< double > * fGQ2
Definition: FlatGenTree.h:226
const UInt_t NGen() const override
TBranch * b_HitNucPz
Definition: FlatGenTree.h:303
vector< int > * fTgtZ
Definition: FlatGenTree.h:211
vector< int > fNumNeutronObj
Definition: FlatGenTree.h:165
vector< int > fCharmHadronPDGObj
Definition: FlatGenTree.h:161
vector< double > * fProbability
Definition: FlatGenTree.h:195
const Float_t FSTotEnergy(const UInt_t &igen) const override
vector< double > fNuYObj
Definition: FlatGenTree.h:107
vector< double > * fHitNucPx
Definition: FlatGenTree.h:218
vector< double > fGYObj
Definition: FlatGenTree.h:148
TTree * fTreeIn
pointer to the analyzed TTree or TChain
Definition: TreeReader.h:51
vector< double > fDiffXsecObj
Definition: FlatGenTree.h:114
TBranch * b_FSleptonPx
Definition: FlatGenTree.h:316
const TLorentzVector * HitNucP4(const UInt_t &igen) const override
hit nucleon (initial) 4-momentum
vector< int > fStrangeHadronPDGObj
Definition: FlatGenTree.h:163
vector< bool > * fIsStrange
Definition: FlatGenTree.h:245
const int ScatterCode(const UInt_t &igen) const override
GENIE neutrino scattering code.
TBranch * b_IsStrange
Definition: FlatGenTree.h:328
vector< double > fGq2Obj
Definition: FlatGenTree.h:144
vector< int > fHitQrkPDGObj
Definition: FlatGenTree.h:132
TLorentzVector fNuVertex
Definition: FlatGenTree.h:86
vector< double > fTgtPzObj
Definition: FlatGenTree.h:125
vector< double > * fFSleptonE
Definition: FlatGenTree.h:236
TBranch * b_FShadSystE
Definition: FlatGenTree.h:324
vector< Float_t > * fFST
time [ns]
Definition: FlatGenTree.h:181
vector< double > * fFShadSystE
Definition: FlatGenTree.h:241
TBranch * b_HitQrkPDG
Definition: FlatGenTree.h:298
vector< double > fProbabilityObj
Definition: FlatGenTree.h:112
vector< double > fTgtPxObj
Definition: FlatGenTree.h:123
void CheckOpt(char opt)
Definition: TreeReader.cxx:67
vector< double > * fGT
Definition: FlatGenTree.h:229
vector< Float_t > fFSPosZObj
z-coordinate [cm]
Definition: FlatGenTree.h:98
vector< double > * fProbePz
Definition: FlatGenTree.h:203
vector< double > fHitNucPzObj
Definition: FlatGenTree.h:137
vector< double > fGTObj
Definition: FlatGenTree.h:146
const TLorentzVector * FSLeptonP4(const UInt_t &igen) const override
final state primary lepton 4-momentum (LAB frame)
vector< double > * fTgtPy
Definition: FlatGenTree.h:207
TBranch * b_NumNeutron
Definition: FlatGenTree.h:331
vector< Float_t > * fFSMomZ
momentum, z-component [GeV/c]
Definition: FlatGenTree.h:184
vector< double > * fDiffXsec
Definition: FlatGenTree.h:197
vector< double > * fGW
Definition: FlatGenTree.h:228
vector< int > * fResNum
Definition: FlatGenTree.h:252
vector< double > fFSleptonPzObj
Definition: FlatGenTree.h:152
vector< int > * fDecayMode
Definition: FlatGenTree.h:253
vector< double > fProbePyObj
Definition: FlatGenTree.h:119
vector< UInt_t > fFSPdgObj
particle PDG code
Definition: FlatGenTree.h:95
const int TgtZ(const UInt_t &igen) const override
target Z
vector< int > * fGscatter
Definition: FlatGenTree.h:224
vector< double > fHitNucPxObj
Definition: FlatGenTree.h:135
const double q2(const UInt_t &igen) const override
TBranch * b_NumPiPlus
Definition: FlatGenTree.h:333
const Bool_t IsGenie(const UInt_t &igen) const override
vector< Float_t > * fFSMomY
momentum, y-component [GeV/c]
Definition: FlatGenTree.h:183
const double e
vector< int > * fGint
Definition: FlatGenTree.h:225
const int InteractCode(const UInt_t &igen) const override
GENIE interaction code.
std::pair< UInt_t, UInt_t > FSParticlesFromGTruth(size_t igen) const
vector< int > * fGPhaseSpace
Definition: FlatGenTree.h:198
vector< int > fTgtAObj
Definition: FlatGenTree.h:129
vector< double > fNuXObj
GTruth (one or more per genTree entry) //.
Definition: FlatGenTree.h:106
vector< int > * fNumPi0
Definition: FlatGenTree.h:249
vector< int > fNumProtonObj
Definition: FlatGenTree.h:164
const TLorentzVector * FSHadSystP4(const UInt_t &igen) const override
final state hadronic system 4-momentum(LAB frame)
TBranch * b_GPhaseSpace
Definition: FlatGenTree.h:281
TBranch * b_FSleptonE
Definition: FlatGenTree.h:319
vector< UInt_t > * fNFS
number of FSParticles for igen^th GTruth len=NGen
Definition: FlatGenTree.h:174
vector< int > fTgtPDGObj
Definition: FlatGenTree.h:130
TBranch * b_DecayMode
Definition: FlatGenTree.h:336
vector< double > fXsecObj
Definition: FlatGenTree.h:113
const int NumNuPi0(const UInt_t &igen) const override
number of pi0 after reaction, before FSI
vector< int > fGPhaseSpaceObj
Definition: FlatGenTree.h:115
vector< bool > * fIsCharm
Definition: FlatGenTree.h:243
vector< Float_t > * fFSMomX
momentum, x-component [GeV/c]
Definition: FlatGenTree.h:182
vector< std::pair< fsBegin, fsEnd > > fGenToFSLimits
Definition: FlatGenTree.h:83
const Int_t NuPDG(const UInt_t &igen) const override
neutrino PDG code
vector< double > * fFSleptonPy
Definition: FlatGenTree.h:234
vector< Float_t > fFSEObj
total energy [GeV]
Definition: FlatGenTree.h:103
vector< double > * fNuZ
Definition: FlatGenTree.h:190
vector< bool > fIsStrangeObj
Definition: FlatGenTree.h:162
const int TgtA(const UInt_t &igen) const override
target A
const double W(const UInt_t &igen) const override
vector< int > * fNuRegion
Definition: FlatGenTree.h:192
TBranch * b_StrangeHadronPDG
Definition: FlatGenTree.h:329
void GetEntry(const UInt_t &ientry) override
Definition: FlatGenTree.cxx:39
TBranch * b_FSleptonPy
Definition: FlatGenTree.h:317
vector< double > fGQ2Obj
Definition: FlatGenTree.h:143
vector< double > * fNuX
GTruth (one or more per genTree entry) //.
Definition: FlatGenTree.h:188
const TLorentzVector * TgtP4(const UInt_t &igen) const override
target 4-momentum
const Bool_t IsCC(const UInt_t &igen) const override
whether interaction is CC or not
vector< int > * fHitQrkPDG
Definition: FlatGenTree.h:215
vector< double > fGXObj
Definition: FlatGenTree.h:147
vector< Float_t > fFSMomYObj
momentum, y-component [GeV/c]
Definition: FlatGenTree.h:101
TBranch * b_HitNucPx
Definition: FlatGenTree.h:301
vector< int > * fTgtPDG
Definition: FlatGenTree.h:213
const double T(const UInt_t &igen) const override
vector< UInt_t > * fFSIndex
Definition: FlatGenTree.h:175
const UInt_t NFSParticles(const UInt_t &igen) const override
vector< int > * fHitNucPDG
Definition: FlatGenTree.h:214
vector< Float_t > * fFSPosX
x-coordinate [cm]
Definition: FlatGenTree.h:178
vector< bool > fIsSeaQuarkObj
Definition: FlatGenTree.h:133
vector< double > * fTgtPz
Definition: FlatGenTree.h:208
TBranch * b_DiffXsec
Definition: FlatGenTree.h:280
vector< int > * fStrangeHadronPDG
Definition: FlatGenTree.h:246
vector< UInt_t > * fFSTrackId
particle generator track ID
Definition: FlatGenTree.h:176
TBranch * b_Probability
Definition: FlatGenTree.h:278
TBranch * b_Event
Definition: TreeReader.h:54
vector< double > fFSleptonPyObj
Definition: FlatGenTree.h:151
const TLorentzVector * NuP(const UInt_t &igen) override
initial neutrino 4-momentum
void SetupRead(TTree *tree)
Definition: TreeReader.cxx:6
TBranch * b_NuRegion
Definition: FlatGenTree.h:275
vector< double > * fFShadSystPx
Definition: FlatGenTree.h:238
vector< int > * fNumProton
Definition: FlatGenTree.h:247
vector< int > * fNumPiMinus
Definition: FlatGenTree.h:251
bool SetBranchAddresses() override
Definition: FlatGenTree.cxx:45
vector< double > fNuTObj
Definition: FlatGenTree.h:109
vector< double > fProbePxObj
Definition: FlatGenTree.h:118
const double Y(const UInt_t &igen) const override
vector< bool > * fIsSeaQuark
Definition: FlatGenTree.h:216
vector< double > fProbeEObj
Definition: FlatGenTree.h:121
vector< double > * fProbePx
Definition: FlatGenTree.h:201
vector< int > fProbePDGObj
Definition: FlatGenTree.h:116
TBranch * b_HitNucPDG
Definition: FlatGenTree.h:297
TLorentzVector fNuP
Definition: FlatGenTree.h:85
vector< double > * fNuY
Definition: FlatGenTree.h:189
vector< int > * fProbePDG
Definition: FlatGenTree.h:199
TBranch * b_CharmHadronPDG
Definition: FlatGenTree.h:327
vector< bool > fIsCharmObj
Definition: FlatGenTree.h:160
const TLorentzVector * NuVertex(const UInt_t &igen) override
4-position of neutrino vertex
TBranch * b_FShadSystPz
Definition: FlatGenTree.h:323
vector< double > * fXsec
Definition: FlatGenTree.h:196
vector< int > fDecayModeObj
Definition: FlatGenTree.h:170
vector< UInt_t > * fFSPdg
particle PDG code
Definition: FlatGenTree.h:177
vector< int > * fNumNeutron
Definition: FlatGenTree.h:248
vector< double > * fGX
Definition: FlatGenTree.h:230
vector< double > * fProbePy
Definition: FlatGenTree.h:202
vector< Float_t > * fFSPosZ
z-coordinate [cm]
Definition: FlatGenTree.h:180
vector< double > fNuZObj
Definition: FlatGenTree.h:108
Int_t fEvent
event number for tree entry
Definition: TreeReader.h:55
vector< Float_t > * fFSE
total energy [GeV]
Definition: FlatGenTree.h:185
vector< double > fFSleptonEObj
Definition: FlatGenTree.h:153
vector< double > * fNuT
Definition: FlatGenTree.h:191
vector< int > fNumPiPlusObj
Definition: FlatGenTree.h:167
vector< double > * fHitNucPos
Definition: FlatGenTree.h:222
const int NuRegion(const UInt_t &igen) const override
region code where the vertex is located
const int NumNuProton(const UInt_t &igen) const override
number of protons after reaction, before FSI
vector< int > fNumPi0Obj
Definition: FlatGenTree.h:166
vector< double > * fFShadSystPy
Definition: FlatGenTree.h:239
vector< double > * fWeight
Definition: FlatGenTree.h:194
vector< int > * fTgtA
Definition: FlatGenTree.h:212
TBranch * b_ProbePDG
Definition: FlatGenTree.h:282
TBranch * b_FShadSystPy
Definition: FlatGenTree.h:322
const Int_t TgtPDG(const UInt_t &igen) const override
PDG of Target Nucleus, nucleon only if free.
vector< double > * fHitNucE
Definition: FlatGenTree.h:221
QTextStream & endl(QTextStream &s)
vector< double > * fHitNucPz
Definition: FlatGenTree.h:220
TBranch * b_NumPiMinus
Definition: FlatGenTree.h:334
TBranch * b_IsSeaQuark
Definition: FlatGenTree.h:299
vector< double > * fProbeE
Definition: FlatGenTree.h:204
vector< int > * fCharmHadronPDG
Definition: FlatGenTree.h:244
vector< UInt_t > fNFSObj
number of FSParticles for igen^th GTruth len=NGen
Definition: FlatGenTree.h:93