Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
STrackCutStudy.io.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file STrackCutStudy.io.h
1 // ----------------------------------------------------------------------------
2 // 'STrackCutStudy.io.h'
3 // Derek Anderson
4 // 03.14.2022
5 //
6 // Reads in the 'ntp_track' Ntuple
7 // generated by the SVtxEvaluator
8 // class and studies the impact
9 // of cutting on various quantities.
10 // ----------------------------------------------------------------------------
11 
12 #pragma once
13 
14 using namespace std;
15 
16 
17 
18 // i/o methods ----------------------------------------------------------------
19 
20 void STrackCutStudy::SetBatchMode(const Bool_t doBatch) {
21 
22  inBatchMode = doBatch;
23  if (inBatchMode) {
24  cout << " Will run in batch mode." << endl;
25  } else {
26  cout << " Will not run in batch mode." << endl;
27  }
28  return;
29 
30 } // end 'SetBatchMode(Bool_t)'
31 
32 
33 
34 void STrackCutStudy::SetInputOutputFiles(const TString sEmbedOnlyInput, const TString sPileupInput, const TString sOutput) {
35 
36  sInFileEO = sEmbedOnlyInput;
37  sInFilePU = sPileupInput;
38  sOutfile = sOutput;
39  cout << " Set i/o files:\n"
40  << " Embed Only = " << sInFileEO.Data() << "\n"
41  << " With Pileup = " << sInFilePU.Data() << "\n"
42  << " Output = " << sOutput.Data()
43  << endl;
44  return;
45 
46 } // end 'SetInputOutputFiles(TString, TString, TString)'
47 
48 
49 
50 void STrackCutStudy::SetInputTuples(const TString sEmbedOnlyTuple, const TString sPileupTuple, const TString sEmbedOnlyClusterTuple) {
51 
52  sInTupleEO = sEmbedOnlyTuple;
53  sInTuplePU = sPileupTuple;
54  sInClustEO = sEmbedOnlyClusterTuple;
55  cout << " Set input track tuples:\n"
56  << " Embed Only = " << sInTupleEO.Data() << "\n"
57  << " With Pileup = " << sInTuplePU.Data()
58  << endl;
59 
60  if (sEmbedOnlyClusterTuple != "") {
61  cout << " Set input cluster tuples:\n"
62  << " Embed-only cluster tuple = " << sInClustEO.Data()
63  << endl;
64  }
65  return;
66 
67 } // end 'SetInputTuples(TString, TString)'
68 
69 
70 
71 void STrackCutStudy::SetStudyParameters(const Bool_t plots, const Bool_t pileup, const Bool_t intNorm, const Bool_t beforeCuts, const Bool_t avgClustCalc, const Double_t normalFracMin, const Double_t normalFracMax) {
72 
73  makePlots = plots;
74  doPileup = pileup;
75  doIntNorm = intNorm;
76  doBeforeCuts = beforeCuts;
77  doAvgClustCalc = avgClustCalc;
78  normalPtFracMin = normalFracMin;
79  normalPtFracMax = normalFracMax;
80  cout << " Set normal pT fraction:\n"
81  << " Normal Pt Fraction = (" << normalPtFracMin << ", " << normalPtFracMax << ")"
82  << endl;
83 
84  if (makePlots) {
85  cout << " Making plots." << endl;
86  } else {
87  cout << " Not making plots." << endl;
88  }
89 
90  if (doPileup) {
91  cout << " Looking at pileup tuple." << endl;
92  } else {
93  cout << " Not looking at pileup tuple." << endl;
94  }
95 
96  if (doIntNorm) {
97  cout << " Normalizing by integral." << endl;
98  } else {
99  cout << " No normalization." << endl;
100  }
101 
102  if (doBeforeCuts) {
103  cout << " Including quantities before cuts." << endl;
104  } else {
105  cout << " Not including quantities before cuts." << endl;
106  }
107 
108  if (doAvgClustCalc) {
109  cout << " Will calculate average cluster size." << endl;
110  } else {
111  cout << " Will not calculate average cluster size." << endl;
112  }
113  return;
114 
115 } // end 'SetStudyParameters(bool, bool, bool, bool, bool, double, double)'
116 
117 
118 
119 void STrackCutStudy::SetCutFlags(const Bool_t doPrimary, const Bool_t doMVtx, const Bool_t doTpc, const Bool_t doVz, const Bool_t doDcaXY, const Bool_t doDcaZ, const Bool_t doQuality) {
120 
121  doPrimaryCut = doPrimary;
122  doMVtxCut = doMVtx;
123  doTpcCut = doTpc;
124  doVzCut = doVz;
125  doDcaXyCut = doDcaXY;
126  doDcaZCut = doDcaZ;
127  doQualityCut = doQuality;
128  cout << " Set cut flags:\n"
129  << " doPrimaryCut = " << doPrimaryCut << "\n"
130  << " doMVtxCut = " << doMVtxCut << "\n"
131  << " doTpcCut = " << doTpcCut << "\n"
132  << " doVzCut = " << doVzCut << "\n"
133  << " doDcaXyCut = " << doDcaXyCut << "\n"
134  << " doDCaZCut = " << doDcaZCut << "\n"
135  << " doQualityCut = " << doQualityCut
136  << endl;
137  return;
138 
139 
140 } // end 'SetCutFlags(Bool_t, Bool_t, Bool_t, Bool_t, Bool_t, Bool_t, Bool_t)'
141 
142 
143 
144 void STrackCutStudy::SetTrackCuts(const pair<UInt_t, UInt_t> nMVtxRange, const pair<UInt_t, UInt_t> nTpcRange, const pair<Double_t, Double_t> vzRange, const pair<Double_t, Double_t> dcaXyRange, const pair <Double_t, Double_t> dcaZRange, const pair<Double_t, Double_t> qualityRange) {
145 
146  nMVtxCut = nMVtxRange;
147  nTpcCut = nTpcRange;
148  vzCut = vzRange;
149  dcaXyCut = dcaXyRange;
150  dcaZCut = dcaZRange;
151  qualityCut = qualityRange;
152  cout << " Set track cuts:\n"
153  << " mvtx hits = (" << nMVtxCut.first << ", " << nMVtxCut.second << ")\n"
154  << " tpc hits = (" << nTpcCut.first << ", " << nTpcCut.second << ")\n"
155  << " z-vertex = (" << vzCut.first << ", " << vzCut.second << ")\n"
156  << " dca (xy) = (" << dcaXyCut.first << ", " << dcaXyCut.second << ")\n"
157  << " dca (z) = (" << dcaZCut.first << ", " << dcaZCut.second << ")\n"
158  << " quality = (" << qualityCut.first << ", " << qualityCut.second << ")"
159  << endl;
160  return;
161 
162 } // end 'SetTrackCuts(pair<UInt_t, UInt_t>, pair<UInt_t, UInt_t>, pair<Double_t, Double_t>, pair<Double_t, Double_t>, pair<Double_t, Double_t>, pair<Double_t, Double_t>)'
163 
164 
165 
166 void STrackCutStudy::SetPlotText(const Ssiz_t nTxtE, const Ssiz_t nTxtP, const TString sTxtE[], const TString sTxtP[]) {
167 
168  nTxtEO = nTxtE;
169  nTxtPU = nTxtP;
170  for (Ssiz_t iTxtEO = 0; iTxtEO < nTxtEO; iTxtEO++) {
171  sTxtEO.push_back(sTxtE[iTxtEO]);
172  }
173  for (Ssiz_t iTxtPU = 0; iTxtPU < nTxtPU; iTxtPU++) {
174  sTxtPU.push_back(sTxtP[iTxtPU]);
175  }
176  cout << " Set plot text." << endl;
177  return;
178 
179 } // end 'SetPlotText(Ssiz_t, Ssiz_t, TString[], TString[])'
180 
181 
182 
184 
185  // open files
186  fOut = new TFile(sOutfile.Data(), "recreate");
187  fInEO = new TFile(sInFileEO.Data(), "read");
188  fInPU = new TFile(sInFilePU.Data(), "read");
189  if (!fOut || !fInEO || !fInPU) {
190  cerr << "PANIC: couldn't open a file!\n"
191  << " fOut = " << fOut << ", fInEO = " << fInEO << ", fInPU = " << fInPU << "\n"
192  << endl;
193  assert(fOut && fInEO && fInPU);
194  }
195  cout << " Initialized files." << endl;
196  return;
197 
198 } // end 'InitFiles()'
199 
200 
201 
203 
204  // grab embed-only tuples
205  ntTrkEO = (TNtuple*) fInEO -> Get(sInTupleEO.Data());
206  if (!ntTrkEO) {
207  cerr << "PANIC: couldn't grab an input Ntuple!\n"
208  << " ntTrkEO = " << ntTrkEO << "\n"
209  << endl;
210  assert(ntTrkEO);
211  }
212 
213  if (doPileup) {
214  ntTrkPU = (TNtuple*) fInPU -> Get(sInTuplePU.Data());
215  if (!ntTrkPU) {
216  cerr << "PANIC: couldn't grab an input Ntuple!\n"
217  << " ntTrkPU = " << ntTrkPU << "\n"
218  << endl;
219  assert(ntTrkPU);
220  }
221  }
222 
223  if (doAvgClustCalc) {
224  ntClustEO = (TNtuple*) fInEO -> Get(sInClustEO.Data());
225  if (!ntClustEO) {
226  cerr << "PANIC: couldn't grab an input cluster NTuple!\n"
227  << " ntClustEO = " << ntClustEO << "\n"
228  << endl;
229  assert(ntClustEO);
230  }
231  }
232  cout << " Initialized input ntuples." << endl;
233 
234  // set embed-only branch addresses
235  ntTrkEO -> SetBranchAddress("event", &event);
236  ntTrkEO -> SetBranchAddress("seed", &seed);
237  ntTrkEO -> SetBranchAddress("trackID", &trackID);
238  ntTrkEO -> SetBranchAddress("crossing", &crossing);
239  ntTrkEO -> SetBranchAddress("px", &px);
240  ntTrkEO -> SetBranchAddress("py", &py);
241  ntTrkEO -> SetBranchAddress("pz", &pz);
242  ntTrkEO -> SetBranchAddress("pt", &pt);
243  ntTrkEO -> SetBranchAddress("eta", &eta);
244  ntTrkEO -> SetBranchAddress("phi", &phi);
245  ntTrkEO -> SetBranchAddress("deltapt", &deltapt);
246  ntTrkEO -> SetBranchAddress("deltaeta", &deltaeta);
247  ntTrkEO -> SetBranchAddress("deltaphi", &deltaphi);
248  ntTrkEO -> SetBranchAddress("charge", &charge);
249  ntTrkEO -> SetBranchAddress("quality", &quality);
250  ntTrkEO -> SetBranchAddress("chisq", &chisq);
251  ntTrkEO -> SetBranchAddress("ndf", &ndf);
252  ntTrkEO -> SetBranchAddress("nhits", &nhits);
253  ntTrkEO -> SetBranchAddress("nmaps", &nmaps);
254  ntTrkEO -> SetBranchAddress("nintt", &nintt);
255  ntTrkEO -> SetBranchAddress("ntpc", &ntpc);
256  ntTrkEO -> SetBranchAddress("nmms", &nmms);
257  ntTrkEO -> SetBranchAddress("ntpc1", &ntpc1);
258  ntTrkEO -> SetBranchAddress("ntpc11", &ntpc11);
259  ntTrkEO -> SetBranchAddress("ntpc2", &ntpc2);
260  ntTrkEO -> SetBranchAddress("ntpc3", &ntpc3);
261  ntTrkEO -> SetBranchAddress("nlmaps", &nlmaps);
262  ntTrkEO -> SetBranchAddress("nlintt", &nlintt);
263  ntTrkEO -> SetBranchAddress("nltpc", &nltpc);
264  ntTrkEO -> SetBranchAddress("nlmms", &nlmms);
265  ntTrkEO -> SetBranchAddress("layers", &layers);
266  ntTrkEO -> SetBranchAddress("vertexID", &vertexID);
267  ntTrkEO -> SetBranchAddress("vx", &vx);
268  ntTrkEO -> SetBranchAddress("vy", &vy);
269  ntTrkEO -> SetBranchAddress("vz", &vz);
270  ntTrkEO -> SetBranchAddress("dca2d", &dca2d);
271  ntTrkEO -> SetBranchAddress("dca2dsigma", &dca2dsigma);
272  ntTrkEO -> SetBranchAddress("dca3dxy", &dca3dxy);
273  ntTrkEO -> SetBranchAddress("dca3dxysigma", &dca3dxysigma);
274  ntTrkEO -> SetBranchAddress("dca3dz", &dca3dz);
275  ntTrkEO -> SetBranchAddress("dca3dzsigma", &dca3dzsigma);
276  ntTrkEO -> SetBranchAddress("pcax", &pcax);
277  ntTrkEO -> SetBranchAddress("pcay", &pcay);
278  ntTrkEO -> SetBranchAddress("pcaz", &pcaz);
279  ntTrkEO -> SetBranchAddress("gtrackID", &gtrackID);
280  ntTrkEO -> SetBranchAddress("gflavor", &gflavor);
281  ntTrkEO -> SetBranchAddress("gnhits", &gnhits);
282  ntTrkEO -> SetBranchAddress("gnmaps", &gnmaps);
283  ntTrkEO -> SetBranchAddress("gnintt", &gnintt);
284  ntTrkEO -> SetBranchAddress("gntpc", &gntpc);
285  ntTrkEO -> SetBranchAddress("gnmms", &gnmms);
286  ntTrkEO -> SetBranchAddress("gnlmaps", &gnlmaps);
287  ntTrkEO -> SetBranchAddress("gnlintt", &gnlintt);
288  ntTrkEO -> SetBranchAddress("gnltpc", &gnltpc);
289  ntTrkEO -> SetBranchAddress("gnlmms", &gnlmms);
290  ntTrkEO -> SetBranchAddress("gpx", &gpx);
291  ntTrkEO -> SetBranchAddress("gpy", &gpy);
292  ntTrkEO -> SetBranchAddress("gpz", &gpz);
293  ntTrkEO -> SetBranchAddress("gpt", &gpt);
294  ntTrkEO -> SetBranchAddress("geta", &geta);
295  ntTrkEO -> SetBranchAddress("gphi", &gphi);
296  ntTrkEO -> SetBranchAddress("gvx", &gvx);
297  ntTrkEO -> SetBranchAddress("gvy", &gvy);
298  ntTrkEO -> SetBranchAddress("gvz", &gvz);
299  ntTrkEO -> SetBranchAddress("gvt", &gvt);
300  ntTrkEO -> SetBranchAddress("gfpx", &gfpx);
301  ntTrkEO -> SetBranchAddress("gfpy", &gfpy);
302  ntTrkEO -> SetBranchAddress("gfpz", &gfpz);
303  ntTrkEO -> SetBranchAddress("gfx", &gfx);
304  ntTrkEO -> SetBranchAddress("gfy", &gfy);
305  ntTrkEO -> SetBranchAddress("gfz", &gfz);
306  ntTrkEO -> SetBranchAddress("gembed", &gembed);
307  ntTrkEO -> SetBranchAddress("gprimary", &gprimary);
308  ntTrkEO -> SetBranchAddress("nfromtruth", &nfromtruth);
309  ntTrkEO -> SetBranchAddress("nwrong", &nwrong);
310  ntTrkEO -> SetBranchAddress("ntrumaps", &ntrumaps);
311  ntTrkEO -> SetBranchAddress("ntruintt", &ntruintt);
312  ntTrkEO -> SetBranchAddress("ntrutpc", &ntrutpc);
313  ntTrkEO -> SetBranchAddress("ntrumms", &ntrumms);
314  ntTrkEO -> SetBranchAddress("ntrutpc1", &ntrutpc1);
315  ntTrkEO -> SetBranchAddress("ntrutpc11", &ntrutpc11);
316  ntTrkEO -> SetBranchAddress("ntrutpc2", &ntrutpc2);
317  ntTrkEO -> SetBranchAddress("ntrutpc3", &ntrutpc3);
318  ntTrkEO -> SetBranchAddress("layersfromtruth", &layersfromtruth);
319  ntTrkEO -> SetBranchAddress("nhittpcall", &nhittpcall);
320  ntTrkEO -> SetBranchAddress("nhittpcin", &nhittpcin);
321  ntTrkEO -> SetBranchAddress("nhittpcmid", &nhittpcmid);
322  ntTrkEO -> SetBranchAddress("nhittpcout", &nhittpcout);
323  ntTrkEO -> SetBranchAddress("nclusall", &nclusall);
324  ntTrkEO -> SetBranchAddress("nclustpc", &nclustpc);
325  ntTrkEO -> SetBranchAddress("nclusintt", &nclusintt);
326  ntTrkEO -> SetBranchAddress("nclusmaps", &nclusmaps);
327  ntTrkEO -> SetBranchAddress("nclusmms", &nclusmms);
328 
329  // set with-pileup branch
330  if (doPileup) {
331  ntTrkPU -> SetBranchAddress("event", &pu_event);
332  ntTrkPU -> SetBranchAddress("seed", &pu_seed);
333  ntTrkPU -> SetBranchAddress("gntracks", &pu_gntracks);
334  ntTrkPU -> SetBranchAddress("gtrackID", &pu_gtrackID);
335  ntTrkPU -> SetBranchAddress("gflavor", &pu_gflavor);
336  ntTrkPU -> SetBranchAddress("gnhits", &pu_gnhits);
337  ntTrkPU -> SetBranchAddress("gnmaps", &pu_gnmaps);
338  ntTrkPU -> SetBranchAddress("gnintt", &pu_gnintt);
339  ntTrkPU -> SetBranchAddress("gnmms", &pu_gnmms);
340  ntTrkPU -> SetBranchAddress("gnintt1", &pu_gnintt1);
341  ntTrkPU -> SetBranchAddress("gnintt2", &pu_gnintt2);
342  ntTrkPU -> SetBranchAddress("gnintt3", &pu_gnintt3);
343  ntTrkPU -> SetBranchAddress("gnintt4", &pu_gnintt4);
344  ntTrkPU -> SetBranchAddress("gnintt5", &pu_gnintt5);
345  ntTrkPU -> SetBranchAddress("gnintt6", &pu_gnintt6);
346  ntTrkPU -> SetBranchAddress("gnintt7", &pu_gnintt7);
347  ntTrkPU -> SetBranchAddress("gnintt8", &pu_gnintt8);
348  ntTrkPU -> SetBranchAddress("gntpc", &pu_gntpc);
349  ntTrkPU -> SetBranchAddress("gnlmaps", &pu_gnlmaps);
350  ntTrkPU -> SetBranchAddress("gnlintt", &pu_gnlintt);
351  ntTrkPU -> SetBranchAddress("gnltpc", &pu_gnltpc);
352  ntTrkPU -> SetBranchAddress("gnlmms", &pu_gnlmms);
353  ntTrkPU -> SetBranchAddress("gpx", &pu_gpx);
354  ntTrkPU -> SetBranchAddress("gpy", &pu_gpy);
355  ntTrkPU -> SetBranchAddress("gpz", &pu_gpz);
356  ntTrkPU -> SetBranchAddress("gpt", &pu_gpt);
357  ntTrkPU -> SetBranchAddress("geta", &pu_geta);
358  ntTrkPU -> SetBranchAddress("gphi", &pu_gphi);
359  ntTrkPU -> SetBranchAddress("gvx", &pu_gvx);
360  ntTrkPU -> SetBranchAddress("gvy", &pu_gvy);
361  ntTrkPU -> SetBranchAddress("gvz", &pu_gvz);
362  ntTrkPU -> SetBranchAddress("gvt", &pu_gvt);
363  ntTrkPU -> SetBranchAddress("gfpx", &pu_gfpx);
364  ntTrkPU -> SetBranchAddress("gfpy", &pu_gfpy);
365  ntTrkPU -> SetBranchAddress("gfpz", &pu_gfpz);
366  ntTrkPU -> SetBranchAddress("gfx", &pu_gfx);
367  ntTrkPU -> SetBranchAddress("gfy", &pu_gfy);
368  ntTrkPU -> SetBranchAddress("gfz", &pu_gfz);
369  ntTrkPU -> SetBranchAddress("gembed", &pu_gembed);
370  ntTrkPU -> SetBranchAddress("gprimary", &pu_gprimary);
371  ntTrkPU -> SetBranchAddress("trackID", &pu_trackID);
372  ntTrkPU -> SetBranchAddress("px", &pu_px);
373  ntTrkPU -> SetBranchAddress("py", &pu_py);
374  ntTrkPU -> SetBranchAddress("pz", &pu_pz);
375  ntTrkPU -> SetBranchAddress("pt", &pu_pt);
376  ntTrkPU -> SetBranchAddress("eta", &pu_eta);
377  ntTrkPU -> SetBranchAddress("phi", &pu_phi);
378  ntTrkPU -> SetBranchAddress("deltapt", &pu_deltapt);
379  ntTrkPU -> SetBranchAddress("deltaeta", &pu_deltaeta);
380  ntTrkPU -> SetBranchAddress("deltaphi", &pu_deltaphi);
381  ntTrkPU -> SetBranchAddress("charge", &pu_charge);
382  ntTrkPU -> SetBranchAddress("quality", &pu_quality);
383  ntTrkPU -> SetBranchAddress("chisq", &pu_chisq);
384  ntTrkPU -> SetBranchAddress("ndf", &pu_ndf);
385  ntTrkPU -> SetBranchAddress("nhits", &pu_nhits);
386  ntTrkPU -> SetBranchAddress("layers", &pu_layers);
387  ntTrkPU -> SetBranchAddress("nmaps", &pu_nmaps);
388  ntTrkPU -> SetBranchAddress("nintt", &pu_nintt);
389  ntTrkPU -> SetBranchAddress("ntpc", &pu_ntpc);
390  ntTrkPU -> SetBranchAddress("nmms", &pu_nmms);
391  ntTrkPU -> SetBranchAddress("ntpc1", &pu_ntpc1);
392  ntTrkPU -> SetBranchAddress("ntpc11", &pu_ntpc11);
393  ntTrkPU -> SetBranchAddress("ntpc2", &pu_ntpc2);
394  ntTrkPU -> SetBranchAddress("ntpc3", &pu_ntpc3);
395  ntTrkPU -> SetBranchAddress("nlmaps", &pu_nlmaps);
396  ntTrkPU -> SetBranchAddress("nlintt", &pu_nlintt);
397  ntTrkPU -> SetBranchAddress("nltpc", &pu_nltpc);
398  ntTrkPU -> SetBranchAddress("nlmms", &pu_nlmms);
399  ntTrkPU -> SetBranchAddress("vertexID", &pu_vertexID);
400  ntTrkPU -> SetBranchAddress("vx", &pu_vx);
401  ntTrkPU -> SetBranchAddress("vy", &pu_vy);
402  ntTrkPU -> SetBranchAddress("vz", &pu_vz);
403  ntTrkPU -> SetBranchAddress("dca2d", &pu_dca2d);
404  ntTrkPU -> SetBranchAddress("dca2dsigma", &pu_dca2dsigma);
405  ntTrkPU -> SetBranchAddress("dca3dxy", &pu_dca3dxy);
406  ntTrkPU -> SetBranchAddress("dca3dxysigma", &pu_dca3dxysigma);
407  ntTrkPU -> SetBranchAddress("dca3dz", &pu_dca3dz);
408  ntTrkPU -> SetBranchAddress("dca3dzsigma", &pu_dca3dzsigma);
409  ntTrkPU -> SetBranchAddress("pcax", &pu_pcax);
410  ntTrkPU -> SetBranchAddress("pcay", &pu_pcay);
411  ntTrkPU -> SetBranchAddress("pcaz", &pu_pcaz);
412  ntTrkPU -> SetBranchAddress("nfromtruth", &pu_nfromtruth);
413  ntTrkPU -> SetBranchAddress("nwrong", &pu_nwrong);
414  ntTrkPU -> SetBranchAddress("ntrumaps", &pu_ntrumaps);
415  ntTrkPU -> SetBranchAddress("ntruintt", &pu_ntruintt);
416  ntTrkPU -> SetBranchAddress("ntrutpc", &pu_ntrutpc);
417  ntTrkPU -> SetBranchAddress("ntrumms", &pu_ntrumms);
418  ntTrkPU -> SetBranchAddress("ntrutpc1", &pu_ntrutpc1);
419  ntTrkPU -> SetBranchAddress("ntrutpc11", &pu_ntrutpc11);
420  ntTrkPU -> SetBranchAddress("ntrutpc2", &pu_ntrutpc2);
421  ntTrkPU -> SetBranchAddress("ntrutpc3", &pu_ntrutpc3);
422  ntTrkPU -> SetBranchAddress("layersfromtruth", &pu_layersfromtruth);
423  ntTrkPU -> SetBranchAddress("nhittpcall", &pu_nhittpcall);
424  ntTrkPU -> SetBranchAddress("nhittpcin", &pu_nhittpcin);
425  ntTrkPU -> SetBranchAddress("nhittpcmid", &pu_nhittpcmid);
426  ntTrkPU -> SetBranchAddress("nhittpcout", &pu_nhittpcout);
427  ntTrkPU -> SetBranchAddress("nclusall", &pu_nclusall);
428  ntTrkPU -> SetBranchAddress("nclustpc", &pu_nclustpc);
429  ntTrkPU -> SetBranchAddress("nclusintt", &pu_nclusintt);
430  ntTrkPU -> SetBranchAddress("nclusmaps", &pu_nclusmaps);
431  ntTrkPU -> SetBranchAddress("nclusmms", &pu_nclusmms);
432  }
433  cout << " Set branch addresses." << endl;
434  return;
435 
436 } // end 'InitTuples()'
437 
438 
439 
441 
442  // create output directories
443  TDirectory *dOut[NType];
444  for (UInt_t iDir = 0; iDir < NType; iDir++) {
445 
446  // check if directory should be created
447  if (isBeforeCuts[iDir] || isPileup[iDir]) {
448  if (isBeforeCuts[iDir] && !doBeforeCuts) continue;
449  if (isPileup[iDir] && !doPileup) continue;
450  }
451 
452  // create directory
453  fOut -> cd();
454  dOut[iDir] = (TDirectory*) fOut -> mkdir(sTrkNames[iDir].Data());
455  }
456  cout << " Made directories." << endl;
457 
458  // save histograms
459  for (int iType = 0; iType < NType; iType++) {
460 
461  // check if histograms should be saved
462  if (isBeforeCuts[iType] || isPileup[iType]) {
463  if (isBeforeCuts[iType] && !doBeforeCuts) continue;
464  if (isPileup[iType] && !doPileup) continue;
465  }
466 
467  dOut[iType] -> cd();
468  for (size_t iTrkVar = 0; iTrkVar < NTrkVar; iTrkVar++) {
469  hTrkVar[iType][iTrkVar] -> Write();
470  hTrkVarDiff[iType][iTrkVar] -> Write();
471  hTrkVarFrac[iType][iTrkVar] -> Write();
472  hTrkVarVsNTpc[iType][iTrkVar] -> Write();
473  hTrkVarVsPtReco[iType][iTrkVar] -> Write();
474  hTrkVarVsPtTrue[iType][iTrkVar] -> Write();
475  hTrkVarVsPtFrac[iType][iTrkVar] -> Write();
476  }
477  for (size_t iPhysVar = 0; iPhysVar < NPhysVar; iPhysVar++) {
478  hPhysVar[iType][iPhysVar] -> Write();
479  hPhysVarDiff[iType][iPhysVar] -> Write();
480  hPhysVarFrac[iType][iPhysVar] -> Write();
481  hPhysVarVsNTpc[iType][iPhysVar] -> Write();
482  hPhysVarVsPtReco[iType][iPhysVar] -> Write();
483  hPhysVarVsPtTrue[iType][iPhysVar] -> Write();
484  hPhysVarVsPtFrac[iType][iPhysVar] -> Write();
485  }
486  } // end type loop
487 
488  cout << " Saved histograms." << endl;
489  return;
490 
491 } // end 'SaveHists()'
492 
493 // end ------------------------------------------------------------------------