ATLAS Offline Software
Loading...
Searching...
No Matches
TrackDataNtupleTree.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include <iostream>
7
8TrackDataNtupleTree::TrackDataNtupleTree(TTree *tree, bool includingDAFdata) :
10 m_includingDAFdata(includingDAFdata)
11{
12 //std::cout<<"calling Constr from TrackDataNtupleTree with tree "<< tree<< std::endl;
13 // if parameter tree is not specified (or zero), connect the file
14 // used to generate this class and read the Tree.
15 if (tree == 0) {
16 TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("TrkValidation.root");
17 if (!f) {
18 f = new TFile("TrkValidation.root");
19 f->cd("TrkValidation.root:/FitterValidation");
20 }
21 tree = (TTree*)gDirectory->Get("OutputTrack");
22
23 }
25// for (int i=0; i<300; i++){
26// (*CompROTnContainedROTs)[i]=0;
27// }
28}
29
30Int_t TrackDataNtupleTree::Cut(Long64_t entry)
31{
32 //std::cout<<"calling Cut from TrackDataNtupleTree"<< std::endl;
33// This function may be called from Loop.
34// returns 1 if entry is accepted.
35// returns -1 otherwise.
36 return 1;
37}
38
39
41{
42 //std::cout<<"calling Destr from TrackDataNtupleTree"<< std::endl;
43 if (!fChain) return;
44 delete fChain->GetCurrentFile();
45}
46
47Int_t TrackDataNtupleTree::GetEntry(Long64_t entry)
48{
49 //std::cout<<"calling GetEntry from TrackDataNtupleTree"<< std::endl;
50 fChain->SetBranchStatus("*",0); // disable all branches
51 fChain->SetBranchStatus("RunNumber",1);
52 fChain->SetBranchStatus("EventNumber",1);
53 fChain->SetBranchStatus("TrackID",1);
54 fChain->SetBranchStatus("IterationIndex",1);
55 fChain->SetBranchStatus("nHits",1);
56 fChain->SetBranchStatus("DetectorType",1);
57 fChain->SetBranchStatus("outlierFlag",1);
58 fChain->SetBranchStatus("HitX",1);
59 fChain->SetBranchStatus("HitY",1);
60 fChain->SetBranchStatus("HitZ",1);
61 fChain->SetBranchStatus("HitLocal1",1);
62 fChain->SetBranchStatus("HitLocal2",1);
63 fChain->SetBranchStatus("HitSurfaceX",1);
64 fChain->SetBranchStatus("HitSurfaceY",1);
65 fChain->SetBranchStatus("HitSurfaceZ",1);
66 fChain->SetBranchStatus("TrackX",1);
67 fChain->SetBranchStatus("TrackY",1);
68 fChain->SetBranchStatus("TrackZ",1);
69 fChain->SetBranchStatus("TrackMomentumX",1);
70 fChain->SetBranchStatus("TrackMomentumY",1);
71 fChain->SetBranchStatus("TrackMomentumZ",1);
72 fChain->SetBranchStatus("TrackLocal1",1);
73 fChain->SetBranchStatus("TrackLocal2",1);
75 fChain->SetBranchStatus("CompROTnContainedROTs",1);
76 fChain->SetBranchStatus("CompROTcontainedROTsAssgnProbs",1);
77 // fChain->SetBranchStatus("CompROTcontainedROTsHitX",1);
78 // fChain->SetBranchStatus("CompROTcontainedROTsHitY",1);
79 // fChain->SetBranchStatus("CompROTcontainedROTsHitZ",1);
80 fChain->SetBranchStatus("CompROTcontainedROTsHitLocal1",1);
81 fChain->SetBranchStatus("CompROTcontainedROTsHitLocal2",1);
82 fChain->SetBranchStatus("CompROTcontainedROTsHitSurfaceX",1);
83 fChain->SetBranchStatus("CompROTcontainedROTsHitSurfaceY",1);
84 fChain->SetBranchStatus("CompROTcontainedROTsHitSurfaceZ",1);
85 }
86// Read contents of entry.
87 if (!fChain) return 0;
88 Int_t result = fChain->GetEntry(entry);
89
90/* for (int i=0; i<300; i++){
91 CompROTnContainedROTs[i]=0;
92 }*/
93 return result;
94}
95
96Long64_t TrackDataNtupleTree::LoadTree(Long64_t entry)
97{
98 //std::cout<<"calling LoadTree from TrackDataNtupleTree"<< std::endl;
99// Set the environment to read one entry
100 if (!fChain) return -5;
101 Long64_t centry = fChain->LoadTree(entry);
102 if (centry < 0) return centry;
103 if (fChain->IsA() != TChain::Class()) return centry;
104 TChain *chain = static_cast<TChain*>(fChain);
105 if (chain->GetTreeNumber() != fCurrent) {
106 fCurrent = chain->GetTreeNumber();
107 Notify();
108 }
109 return centry;
110}
111
113{
114// // The Init() function is called when the selector needs to initialize
115// // a new tree or chain. Typically here the branch addresses of the tree
116// // will be set. It is normaly not necessary to make changes to the
117// // generated code, but the routine can be extended by the user if needed.
118// // Init() will be called many times when running with PROOF.
119//
120// // Set branch addresses
121 //std::cout<<"calling Init from TrackDataNtupleTree"<< std::endl;
122 if (tree == 0) return;
123 fChain = tree;
124 fCurrent = -1;
125 fChain->SetMakeClass(1);
126 // Set object pointer
127 pullLocX = 0;
128 pullLocY = 0;
129 residualLocX = 0;
130 residualLocY = 0;
131 DetectorType = 0;
132 outlierFlag = 0;
133 PixPullPhi = 0;
134 PixPullEta = 0;
135 PixResPhi = 0;
136 PixResEta = 0;
137 SCTPull = 0;
138 SCTRes = 0;
139 TRTPull = 0;
140 TRTRes = 0;
141 HitX = 0;
142 HitY = 0;
143 HitZ = 0;
144 HitRadius = 0;
145 HitPhi = 0;
146 HitLocal1 = 0;
147 HitLocal2 = 0;
148 HitSurfaceX = 0;
149 HitSurfaceY = 0;
150 HitSurfaceZ = 0;
152 HitSurfacePhi = 0;
153 HitSurfaceTheta = 0;
154 TrackX = 0;
155 TrackY = 0;
156 TrackZ = 0;
157 TrackMomentumX = 0;
158 TrackMomentumY = 0;
159 TrackMomentumZ = 0;
160 TrackLocal1 = 0;
161 TrackLocal2 = 0;
165//
166 fChain->SetBranchAddress("RunNumber", &RunNumber, &b_run_number);
167 fChain->SetBranchAddress("EventNumber", &EventNumber, &b_event_number);
168 fChain->SetBranchAddress("TrackID", &TrackID, &b_ID_of_track_in_event);
169 fChain->SetBranchAddress("IterationIndex", &IterationIndex, &b_Iteration_of_a_track);
170 fChain->SetBranchAddress("nHits", &nHits, &b_Number_of_measurements_on_track);
171/* fChain->SetBranchAddress("TrackStatesUnbiased", &TrackStatesUnbiased, &b_are_track_states_unbiased);
172 fChain->SetBranchAddress("RecD0", &RecD0, &b_Reconstructed_d0);
173 fChain->SetBranchAddress("RecZ0", &RecZ0, &b_Reconstructed_z0);
174 fChain->SetBranchAddress("RecPhi0", &RecPhi0, &b_Reconstructed_phi0);
175 fChain->SetBranchAddress("RecTheta", &RecTheta, &b_Reconstructed_theta);
176 fChain->SetBranchAddress("RecEta", &RecEta, &b_Reconstructed_eta);
177 fChain->SetBranchAddress("RecQoverP", &RecQoverP, &b_Reconstructed_Q_over_p);
178 fChain->SetBranchAddress("RecErrD0", &RecErrD0, &b_err_d0);
179 fChain->SetBranchAddress("RecErrZ0", &RecErrZ0, &b_err_z0);
180 fChain->SetBranchAddress("RecErrPhi0", &RecErrPhi0, &b_err_phi0);
181 fChain->SetBranchAddress("RecErrTheta", &RecErrTheta, &b_err_theta);
182 fChain->SetBranchAddress("RecErrQoverP", &RecErrQoverP, &b_err_Q_over_p);
183 fChain->SetBranchAddress("Chi2overNdof", &Chi2overNdof, &b_Reco_Chi2_over_Ndof);
184 fChain->SetBranchAddress("Ndof", &Ndof, &b_Reco_Ndof);
185 fChain->SetBranchAddress("trk_Mc_d0", &trk_Mc_d0, &b_truth_d0);
186 fChain->SetBranchAddress("trk_Mc_z0", &trk_Mc_z0, &b_truth_z0);
187 fChain->SetBranchAddress("trk_Mc_phi0", &trk_Mc_phi0, &b_truth_phi0);
188 fChain->SetBranchAddress("trk_Mc_theta", &trk_Mc_theta, &b_truth_theta);
189 fChain->SetBranchAddress("trk_Mc_qOverP", &trk_Mc_qOverP, &b_truth_Q_over_p);
190 fChain->SetBranchAddress("trk_Mc_qOverPt", &trk_Mc_qOverPt, &b_truth_Q_over_pT);
191 fChain->SetBranchAddress("trk_Mc_eta", &trk_Mc_eta, &b_truth_eta);
192 fChain->SetBranchAddress("trk_Mc_diff_d0", &trk_Mc_diff_d0, &b_truth_reco_diff_d0);
193 fChain->SetBranchAddress("trk_Mc_diff_z0", &trk_Mc_diff_z0, &b_truth_reco_diff_z0);
194 fChain->SetBranchAddress("trk_Mc_diff_phi0", &trk_Mc_diff_phi0, &b_truth_reco_diff_phi0);
195 fChain->SetBranchAddress("trk_Mc_diff_theta", &trk_Mc_diff_theta, &b_truth_reco_diff_theta);
196 fChain->SetBranchAddress("trk_Mc_diff_qOverP", &trk_Mc_diff_qOverP, &b_truth_reco_diff_Q_over_p);
197 fChain->SetBranchAddress("trk_Mc_pull_d0", &trk_Mc_pull_d0, &b_truth_reco_pull_d0);
198 fChain->SetBranchAddress("trk_Mc_pull_z0", &trk_Mc_pull_z0, &b_truth_reco_pull_d0);
199 fChain->SetBranchAddress("trk_Mc_pull_phi0", &trk_Mc_pull_phi0, &b_truth_reco_pull_d0);
200 fChain->SetBranchAddress("trk_Mc_pull_theta", &trk_Mc_pull_theta, &b_truth_reco_pull_d0);
201 fChain->SetBranchAddress("trk_Mc_pull_qOverP", &trk_Mc_pull_qOverP, &b_truth_reco_pull_d0);
202 fChain->SetBranchAddress("trk_Mc_particleID", &trk_Mc_particleID, &b_truth_PDG_ID);
203 fChain->SetBranchAddress("trk_Mc_barcode", &trk_Mc_barcode, &b_truth_particle_barcode);
204 fChain->SetBranchAddress("trk_Mc_energy", &trk_Mc_energy, &b_truth_energy);
205 fChain->SetBranchAddress("pullLocX", &pullLocX, &b_pullLocX);
206 fChain->SetBranchAddress("pullLocY", &pullLocY, &b_pullLocY);
207 fChain->SetBranchAddress("residualLocX", &residualLocX, &b_residualLocX);
208 fChain->SetBranchAddress("residualLocY", &residualLocY, &b_residualLocY);*/
209 fChain->SetBranchAddress("DetectorType", &DetectorType, &b_DetectorType);
210 fChain->SetBranchAddress("outlierFlag", &outlierFlag, &b_outlierFlag);
211/* fChain->SetBranchAddress("nPixelHits", &nPixelHits, &b_number_Pixel_measurements);
212 fChain->SetBranchAddress("nSCTHits", &nSCTHits, &b_number_SCT_measurements);
213 fChain->SetBranchAddress("nTRTHits", &nTRTHits, &b_number_TRT_measurements);
214 fChain->SetBranchAddress("nMDTHits", &nMDTHits, &b_number_MDT_measurements);
215 fChain->SetBranchAddress("nCSCHits", &nCSCHits, &b_number_CSC_measurements);
216 fChain->SetBranchAddress("nRPCHits", &nRPCHits, &b_number_RPC_measurements);
217 fChain->SetBranchAddress("nTGCHits", &nTGCHits, &b_number_TGC_measurements);
218 fChain->SetBranchAddress("PixPullPhi", &PixPullPhi, &b_PixPullPhi);
219 fChain->SetBranchAddress("PixPullEta", &PixPullEta, &b_PixPullEta);
220 fChain->SetBranchAddress("PixResPhi", &PixResPhi, &b_PixResPhi);
221 fChain->SetBranchAddress("PixResEta", &PixResEta, &b_PixResEta);
222 fChain->SetBranchAddress("SCTPull", &SCTPull, &b_SCTPull);
223 fChain->SetBranchAddress("SCTRes", &SCTRes, &b_SCTRes);
224 fChain->SetBranchAddress("TRTPull", &TRTPull, &b_TRTPull);
225 fChain->SetBranchAddress("TRTRes", &TRTRes, &b_TRTRes);*/
226 fChain->SetBranchAddress("HitX", &HitX, &b_HitX);
227 fChain->SetBranchAddress("HitY", &HitY, &b_HitY);
228 fChain->SetBranchAddress("HitZ", &HitZ, &b_HitZ);
229/* fChain->SetBranchAddress("HitRadius", &HitRadius, &b_HitRadius);
230 fChain->SetBranchAddress("HitPhi", &HitPhi, &b_HitPhi);*/
231 fChain->SetBranchAddress("HitLocal1", &HitLocal1, &b_HitLocal1);
232 fChain->SetBranchAddress("HitLocal2", &HitLocal2, &b_HitLocal2);
233 fChain->SetBranchAddress("HitSurfaceX", &HitSurfaceX, &b_HitSurfaceX);
234 fChain->SetBranchAddress("HitSurfaceY", &HitSurfaceY, &b_HitSurfaceY);
235 fChain->SetBranchAddress("HitSurfaceZ", &HitSurfaceZ, &b_HitSurfaceZ);
236/* fChain->SetBranchAddress("HitSurfaceRadius", &HitSurfaceRadius, &b_HitSurfaceRadius);
237 fChain->SetBranchAddress("HitSurfacePhi", &HitSurfacePhi, &b_HitSurfacePhi);
238 fChain->SetBranchAddress("HitSurfaceTheta", &HitSurfaceTheta, &b_HitSurfaceTheta);*/
239 fChain->SetBranchAddress("TrackX", &TrackX, &b_TrackX);
240 fChain->SetBranchAddress("TrackY", &TrackY, &b_TrackY);
241 fChain->SetBranchAddress("TrackZ", &TrackZ, &b_TrackZ);
242 fChain->SetBranchAddress("TrackMomentumX", &TrackMomentumX, &b_TrackMomentumX);
243 fChain->SetBranchAddress("TrackMomentumY", &TrackMomentumY, &b_TrackMomentumY);
244 fChain->SetBranchAddress("TrackMomentumZ", &TrackMomentumZ, &b_TrackMomentumZ);
245 fChain->SetBranchAddress("TrackLocal1", &TrackLocal1, &b_TrackLocal1);
246 fChain->SetBranchAddress("TrackLocal2", &TrackLocal2, &b_TrackLocal2);
248 std::cout<<"setting branches to DAF data"<< std::endl;
249 fChain->SetBranchAddress("CompROTnContainedROTs", &CompROTnContainedROTs, &b_CompROTnContainedROTs);
250 fChain->SetBranchAddress("CompROTindexOfMaxAssgnProb", &CompROTindexOfMaxAssgnProb, &b_CompROTindexOfMaxAssgnProb);
251 fChain->SetBranchAddress("CompROTmaxAssgnProb", &CompROTmaxAssgnProb, &b_CompROTmaxAssgnProb);
252 // fChain->SetBranchAddress("CompROTindexOfMaxAssgnProb",CompROTindexOfMaxAssgnProb);
253 // fChain->SetBranchAddress("CompROTmaxAssgnProb",CompROTmaxAssgnProb);
254/* fChain->SetBranchAddress("CompROTcontainedROTsAssgnProbs",CompROTcontainedROTsAssgnProbs);
255 // fChain->SetBranchAddress("CompROTcontainedROTsResLocX",CompROTcontainedROTsResLocX);
256 // fChain->SetBranchAddress("CompROTcontainedROTsResLocY",CompROTcontainedROTsResLocY);
257 // fChain->SetBranchAddress("CompROTcontainedROTsPullLocX",CompROTcontainedROTsPullLocX);
258 // fChain->SetBranchAddress("CompROTcontainedROTsPullLocY",CompROTcontainedROTsPullLocY);
259 // fChain->SetBranchAddress("CompROTcontainedROTsHitX",CompROTcontainedROTsHitX);
260 // fChain->SetBranchAddress("CompROTcontainedROTsHitY",CompROTcontainedROTsHitY);
261 // fChain->SetBranchAddress("CompROTcontainedROTsHitZ",CompROTcontainedROTsHitZ);
262 fChain->SetBranchAddress("CompROTcontainedROTsHitLocal1",CompROTcontainedROTsHitLocal1);
263 fChain->SetBranchAddress("CompROTcontainedROTsHitLocal2",CompROTcontainedROTsHitLocal2);
264 fChain->SetBranchAddress("CompROTcontainedROTsHitSurfaceX",CompROTcontainedROTsHitSurfaceX);
265 fChain->SetBranchAddress("CompROTcontainedROTsHitSurfaceY",CompROTcontainedROTsHitSurfaceY);
266 fChain->SetBranchAddress("CompROTcontainedROTsHitSurfaceZ",CompROTcontainedROTsHitSurfaceZ);*/
267 }
268 Notify();
269}
270
272 {
273// // The Notify() function is called when a new file is opened. This
274// // can be either for a new TTree in a TChain or when when a new TTree
275// // is started when using PROOF. Typically here the branch pointers
276// // will be retrieved. It is normaly not necessary to make changes
277// // to the generated code, but the routine can be extended by the
278// // user if needed.
279//
280//std::cout<<"calling Notify from TrackDataNtupleTree"<< std::endl;
281return kTRUE;
282// // Get branch pointers
283// b_RunNumber = fChain->GetBranch("RunNumber");
284// b_EventNumber = fChain->GetBranch("EventNumber");
285// b_TrackID = fChain->GetBranch("TrackID");
286// b_IterationIndex = fChain->GetBranch("IterationIndex");
287// b_nHits = fChain->GetBranch("nHits");
288// b_TrackStatesUnbiased = fChain->GetBranch("TrackStatesUnbiased");
289// b_RecD0 = fChain->GetBranch("RecD0");
290// b_RecZ0 = fChain->GetBranch("RecZ0");
291// b_RecPhi0 = fChain->GetBranch("RecPhi0");
292// b_RecTheta = fChain->GetBranch("RecTheta");
293// b_RecEta = fChain->GetBranch("RecEta");
294// b_RecQoverP = fChain->GetBranch("RecQoverP");
295// b_RecErrD0 = fChain->GetBranch("RecErrD0");
296// b_RecErrZ0 = fChain->GetBranch("RecErrZ0");
297// b_RecErrPhi0 = fChain->GetBranch("RecErrPhi0");
298// b_RecErrTheta = fChain->GetBranch("RecErrTheta");
299// b_RecErrQoverP = fChain->GetBranch("RecErrQoverP");
300// b_Chi2overNdof = fChain->GetBranch("Chi2overNdof");
301// b_Ndof = fChain->GetBranch("Ndof");
302// b_pullLocX = fChain->GetBranch("pullLocX");
303// b_pullLocY = fChain->GetBranch("pullLocY");
304// b_residualLocX = fChain->GetBranch("residualLocX");
305// b_residualLocY = fChain->GetBranch("residualLocY");
306 b_DetectorType = fChain->GetBranch("DetectorType");
307 b_outlierFlag = fChain->GetBranch("outlierFlag");
308// b_nPixelHits = fChain->GetBranch("nPixelHits");
309// b_nSCTHits = fChain->GetBranch("nSCTHits");
310// b_nTRTHits = fChain->GetBranch("nTRTHits");
311// b_nMDTHits = fChain->GetBranch("nMDTHits");
312// b_nCSCHits = fChain->GetBranch("nCSCHits");
313// b_nRPCHits = fChain->GetBranch("nRPCHits");
314// b_nTGCHits = fChain->GetBranch("nTGCHits");
315// b_PixPullPhi = fChain->GetBranch("PixPullPhi");
316// b_PixPullEta = fChain->GetBranch("PixPullEta");
317// b_PixResPhi = fChain->GetBranch("PixResPhi");
318// b_PixResEta = fChain->GetBranch("PixResEta");
319// b_SCTPull = fChain->GetBranch("SCTPull");
320// b_SCTRes = fChain->GetBranch("SCTRes");
321// b_TRTPull = fChain->GetBranch("TRTPull");
322// b_TRTRes = fChain->GetBranch("TRTRes");
323 b_HitX = fChain->GetBranch("HitX");
324 b_HitY = fChain->GetBranch("HitY");
325 b_HitZ = fChain->GetBranch("HitZ");
326// b_HitRadius = fChain->GetBranch("HitRadius");
327// b_HitPhi = fChain->GetBranch("HitPhi");
328 b_HitLocal1 = fChain->GetBranch("HitLocal1");
329 b_HitLocal2 = fChain->GetBranch("HitLocal2");
330 b_HitSurfaceX = fChain->GetBranch("HitSurfaceX");
331 b_HitSurfaceY = fChain->GetBranch("HitSurfaceY");
332 b_HitSurfaceZ = fChain->GetBranch("HitSurfaceZ");
333// b_HitSurfaceRadius = fChain->GetBranch("HitSurfaceRadius");
334// b_HitSurfacePhi = fChain->GetBranch("HitSurfacePhi");
335// b_HitSurfaceTheta = fChain->GetBranch("HitSurfaceTheta");
336 b_TrackX = fChain->GetBranch("TrackX");
337 b_TrackY = fChain->GetBranch("TrackY");
338 b_TrackZ = fChain->GetBranch("TrackZ");
339 b_TrackMomentumX = fChain->GetBranch("TrackMomentumX");
340 b_TrackMomentumY = fChain->GetBranch("TrackMomentumY");
341 b_TrackMomentumZ = fChain->GetBranch("TrackMomentumZ");
342 b_TrackLocal1 = fChain->GetBranch("TrackLocal1");
343 b_TrackLocal2 = fChain->GetBranch("TrackLocal2");
344//
346 std::cout<<"getting branches to DAF data"<< std::endl;
347 b_CompROTnContainedROTs = fChain->GetBranch("CompROTnContainedROTs");
348 // b_CompROTindexOfMaxAssgnProb = fChain->GetBranch("CompROTindexOfMaxAssgnProb");
349 // b_CompROTmaxAssgnProb = fChain->GetBranch("CompROTmaxAssgnProb");
350// b_CompROTcontainedROTsAssgnProbs = fChain->GetBranch("CompROTcontainedROTsAssgnProbs");
351// // b_CompROTcontainedROTsResLocX = fChain->GetBranch("CompROTcontainedROTsResLocX");
352// // b_CompROTcontainedROTsResLocY = fChain->GetBranch("CompROTcontainedROTsResLocY");
353// // b_CompROTcontainedROTsPullLocX = fChain->GetBranch("CompROTcontainedROTsPullLocX");
354// // b_CompROTcontainedROTsPullLocY = fChain->GetBranch("CompROTcontainedROTsPullLocY");
355// // b_CompROTcontainedROTsHitX = fChain->GetBranch("CompROTcontainedROTsHitX");
356// // b_CompROTcontainedROTsHitY = fChain->GetBranch("CompROTcontainedROTsHitY");
357// // b_CompROTcontainedROTsHitZ = fChain->GetBranch("CompROTcontainedROTsHitZ");
358// b_CompROTcontainedROTsHitLocal1 = fChain->GetBranch("CompROTcontainedROTsHitLocal1");
359// b_CompROTcontainedROTsHitLocal2 = fChain->GetBranch("CompROTcontainedROTsHitLocal2");
360// b_CompROTcontainedROTsHitSurfaceX = fChain->GetBranch("CompROTcontainedROTsHitSurfaceX");
361// b_CompROTcontainedROTsHitSurfaceY = fChain->GetBranch("CompROTcontainedROTsHitSurfaceY");
362// b_CompROTcontainedROTsHitSurfaceZ = fChain->GetBranch("CompROTcontainedROTsHitSurfaceZ");
363 }
364 return kTRUE;
365 }
366
367void TrackDataNtupleTree::Show(Long64_t entry)
368{
369//std::cout<<"calling Show from TrackDataNtupleTree"<< std::endl;
370// Print contents of entry.
371// If entry is not specified, print current entry
372 if (!fChain) return;
373 fChain->Show(entry);
374}
375
377{
378//std::cout<<"calling Loop from TrackDataNtupleTree"<< std::endl;
379// In a ROOT session, you can do:
380// Root > .L TrkValidationNtupleOutputTrack.C
381// Root > TrkValidationNtupleOutputTrack t
382// Root > t.GetEntry(12); // Fill t data members with entry number 12
383// Root > t.Show(); // Show values of entry 12
384// Root > t.Show(16); // Read and show values of entry 16
385// Root > t.Loop(); // Loop on all entries
386//
387
388// This is the loop skeleton where:
389// jentry is the global entry number in the chain
390// ientry is the entry number in the current Tree
391// Note that the argument to GetEntry must be:
392// jentry for TChain::GetEntry
393// ientry for TTree::GetEntry and TBranch::GetEntry
394//
395// To read only selected branches, Insert statements like:
396// METHOD1:
397// fChain->SetBranchStatus("*",0); // disable all branches
398// fChain->SetBranchStatus("branchname",1); // activate branchname
399// METHOD2: replace line
400// fChain->GetEntry(jentry); //read all branches
401//by b_branchname->GetEntry(ientry); //read only this branch
402 if (fChain == 0) return;
403
404 Long64_t nentries = fChain->GetEntriesFast();
405
406 Int_t nbytes = 0, nb = 0;
407 for (Long64_t jentry=0; jentry<nentries;jentry++) {
408 Long64_t ientry = LoadTree(jentry);
409 if (ientry < 0) break;
410 nb = fChain->GetEntry(jentry); nbytes += nb;
411 // if (Cut(ientry) < 0) continue;
412 }
413}
414
TrackDataNtupleTree(TTree *tree=0, bool includingDAFdata=false)
virtual Int_t Cut(Long64_t entry)
virtual void Init(TTree *tree)
virtual Int_t GetEntry(Long64_t entry)
virtual void Show(Long64_t entry=-1)
virtual Long64_t LoadTree(Long64_t entry)
Int_t RunNumber
current Tree number in a TChain
TrkValidationNtupleOutputTrack(TTree *tree=0)
Int_t fCurrent
pointer to the analyzed TTree or TChain
TChain * tree