Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MakeOldEvaluatorPlots.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MakeOldEvaluatorPlots.cxx
1 // ----------------------------------------------------------------------------
2 // 'MakeNewMatcherPlots.cxx'
3 // Derek Anderson
4 // 08.24.2023
5 //
6 // Short macro to make plots from the
7 // output of the SvtxEvaluator module.
8 // ----------------------------------------------------------------------------
9 
10 #include <string>
11 #include <vector>
12 #include <utility>
13 #include <iostream>
14 #include "TH1.h"
15 #include "TH2.h"
16 #include "TFile.h"
17 #include "TError.h"
18 #include "TChain.h"
19 #include "TNtuple.h"
20 
21 using namespace std;
22 
23 // global constants
24 static const size_t NSectors = 12;
25 
26 
27 
28 // main body of macro ---------------------------------------------------------
29 
30 
32 
33  // io parameters
34  const string sOutput("oldEvalPlots_oneMatchPerParticle_embedScanOn_forZVtxCutComp_oddFrac05150.pt10n1evt500pim.d1m2y2024.root");
35  const string sTupleTrue("ntp_gtrack");
36  const string sTupleReco("ntp_track");
37  const vector<string> vecInTrue = {
38  "input/merged/sPhenixG4_oneMatchPerParticle_oldEval_forCrossCheck.pt10num1evt500pim.d25m1y2024.root"
39  };
40  const vector<string> vecInReco = {
41  "input/merged/sPhenixG4_oneMatchPerParticle_oldEval_forCrossCheck.pt10num1evt500pim.d25m1y2024.root"
42  };
43 
44  // cut options
45  const bool useOnlyPrimTrks(true);
46  const bool doZVtxCut(true);
47  const bool doPhiCut(false);
48 
49  // weird track parameters
50  const pair<float, float> oddPtFrac = {0.5, 1.5};
51  const pair<float, float> zVtxRange = {-1., 1.};
52 
53  // phi cut parameters
54  const float sigCutVal(0.75);
55  const array<pair<float, float>, NSectors> phiSectors = {
56  make_pair(-2.92, 0.12),
57  make_pair(-2.38, 0.05),
58  make_pair(-1.93, 0.18),
59  make_pair(-1.33, 0.07),
60  make_pair(-0.90, 0.24),
61  make_pair(-0.29, 0.09),
62  make_pair(0.23, 0.11),
63  make_pair(0.73, 0.10),
64  make_pair(1.28, 0.10),
65  make_pair(1.81, 0.08),
66  make_pair(2.23, 0.18),
67  make_pair(2.80, 0.17)
68  };
69 
70  // lower verbosity
71  gErrorIgnoreLevel = kError;
72  cout << "\n Staring old evaluator plot script..." << endl;
73 
74  // open files
75  TFile* fOutput = new TFile(sOutput.data(), "recreate");
76  if (!fOutput) {
77  cerr << "PANIC: couldn't open output file!\n"
78  << " fOutput = " << fOutput << "\n"
79  << endl;
80  return;
81  }
82  cout << " Opened files." << endl;
83 
84  // grab input trees
85  TChain* tInTrue = new TChain(sTupleTrue.data());
86  TChain* tInReco = new TChain(sTupleReco.data());
87  for (const string sInTrue : vecInTrue) {
88  const int added = tInTrue -> Add(sInTrue.data());
89  if (added != 1) {
90  cerr << "WARNING: was not able to add ntuple from file \'" << sInTrue << "\'!\n"
91  << " return value = " << added
92  << endl;
93  }
94  }
95  for (const string sInReco : vecInReco) {
96  const int added = tInReco -> Add(sInReco.data());
97  if (added != 1) {
98  cerr << "WARNING: was not able to add ntuple from file \'" << sInReco << "\'!\n"
99  << " return value = " << added
100  << endl;
101  }
102  }
103  cout << " Grabbed input trees." << endl;
104 
105  // declare input leaves
106  Float_t tru_event;
107  Float_t tru_seed;
108  Float_t tru_gntracks;
109  Float_t tru_gnchghad;
110  Float_t tru_gtrackID;
111  Float_t tru_gflavor;
112  Float_t tru_gnhits;
113  Float_t tru_gnmaps;
114  Float_t tru_gnintt;
115  Float_t tru_gnmms;
116  Float_t tru_gnintt1;
117  Float_t tru_gnintt2;
118  Float_t tru_gnintt3;
119  Float_t tru_gnintt4;
120  Float_t tru_gnintt5;
121  Float_t tru_gnintt6;
122  Float_t tru_gnintt7;
123  Float_t tru_gnintt8;
124  Float_t tru_gntpc;
125  Float_t tru_gnlmaps;
126  Float_t tru_gnlintt;
127  Float_t tru_gnltpc;
128  Float_t tru_gnlmms;
129  Float_t tru_gpx;
130  Float_t tru_gpy;
131  Float_t tru_gpz;
132  Float_t tru_gpt;
133  Float_t tru_geta;
134  Float_t tru_gphi;
135  Float_t tru_gvx;
136  Float_t tru_gvy;
137  Float_t tru_gvz;
138  Float_t tru_gvt;
139  Float_t tru_gfpx;
140  Float_t tru_gfpy;
141  Float_t tru_gfpz;
142  Float_t tru_gfx;
143  Float_t tru_gfy;
144  Float_t tru_gfz;
145  Float_t tru_gembed;
146  Float_t tru_gprimary;
147  Float_t tru_trackID;
148  Float_t tru_px;
149  Float_t tru_py;
150  Float_t tru_pz;
151  Float_t tru_pt;
152  Float_t tru_eta;
153  Float_t tru_phi;
154  Float_t tru_deltapt;
155  Float_t tru_deltaeta;
156  Float_t tru_deltaphi;
157  Float_t tru_siqr;
158  Float_t tru_siphi;
159  Float_t tru_sithe;
160  Float_t tru_six0;
161  Float_t tru_siy0;
162  Float_t tru_tpqr;
163  Float_t tru_tpphi;
164  Float_t tru_tpthe;
165  Float_t tru_tpx0;
166  Float_t tru_tpy0;
167  Float_t tru_charge;
168  Float_t tru_quality;
169  Float_t tru_chisq;
170  Float_t tru_ndf;
171  Float_t tru_nhits;
172  Float_t tru_layers;
173  Float_t tru_nmaps;
174  Float_t tru_nintt;
175  Float_t tru_ntpc;
176  Float_t tru_nmms;
177  Float_t tru_ntpc1;
178  Float_t tru_ntpc11;
179  Float_t tru_ntpc2;
180  Float_t tru_ntpc3;
181  Float_t tru_nlmaps;
182  Float_t tru_nlintt;
183  Float_t tru_nltpc;
184  Float_t tru_nlmms;
185  Float_t tru_vertexID;
186  Float_t tru_vx;
187  Float_t tru_vy;
188  Float_t tru_vz;
189  Float_t tru_dca2d;
190  Float_t tru_dca2dsigma;
191  Float_t tru_dca3dxy;
192  Float_t tru_dca3dxysigma;
193  Float_t tru_dca3dz;
194  Float_t tru_dca3dzsigma;
195  Float_t tru_pcax;
196  Float_t tru_pcay;
197  Float_t tru_pcaz;
198  Float_t tru_nfromtruth;
199  Float_t tru_nwrong;
200  Float_t tru_ntrumaps;
201  Float_t tru_nwrongmaps;
202  Float_t tru_ntruintt;
203  Float_t tru_nwrongintt;
204  Float_t tru_ntrutpc;
205  Float_t tru_nwrongtpc;
206  Float_t tru_ntrumms;
207  Float_t tru_nwrongmms;
208  Float_t tru_ntrutpc1;
209  Float_t tru_nwrongtpc1;
210  Float_t tru_ntrutpc11;
211  Float_t tru_nwrongtpc11;
212  Float_t tru_ntrutpc2;
213  Float_t tru_nwrongtpc2;
214  Float_t tru_ntrutpc3;
215  Float_t tru_nwrongtpc3;
216  Float_t tru_layersfromtruth;
217  Float_t tru_npedge;
218  Float_t tru_nredge;
219  Float_t tru_nbig;
220  Float_t tru_novlp;
221  Float_t tru_merr;
222  Float_t tru_msize;
223  Float_t tru_nhittpcall;
224  Float_t tru_nhittpcin;
225  Float_t tru_nhittpcmid;
226  Float_t tru_nhittpcout;
227  Float_t tru_nclusall;
228  Float_t tru_nclustpc;
229  Float_t tru_nclusintt;
230  Float_t tru_nclusmaps;
231  Float_t tru_nclusmms;
232 
233  Float_t rec_event;
234  Float_t rec_seed;
235  Float_t rec_trackID;
236  Float_t rec_crossing;
237  Float_t rec_px;
238  Float_t rec_py;
239  Float_t rec_pz;
240  Float_t rec_pt;
241  Float_t rec_eta;
242  Float_t rec_phi;
243  Float_t rec_deltapt;
244  Float_t rec_deltaeta;
245  Float_t rec_deltaphi;
246  Float_t rec_siqr;
247  Float_t rec_siphi;
248  Float_t rec_sithe;
249  Float_t rec_six0;
250  Float_t rec_siy0;
251  Float_t rec_tpqr;
252  Float_t rec_tpphi;
253  Float_t rec_tpthe;
254  Float_t rec_tpx0;
255  Float_t rec_tpy0;
256  Float_t rec_charge;
257  Float_t rec_quality;
258  Float_t rec_chisq;
259  Float_t rec_ndf;
260  Float_t rec_nhits;
261  Float_t rec_nmaps;
262  Float_t rec_nintt;
263  Float_t rec_ntpc;
264  Float_t rec_nmms;
265  Float_t rec_ntpc1;
266  Float_t rec_ntpc11;
267  Float_t rec_ntpc2;
268  Float_t rec_ntpc3;
269  Float_t rec_nlmaps;
270  Float_t rec_nlintt;
271  Float_t rec_nltpc;
272  Float_t rec_nlmms;
273  Float_t rec_layers;
274  Float_t rec_vertexID;
275  Float_t rec_vx;
276  Float_t rec_vy;
277  Float_t rec_vz;
278  Float_t rec_dca2d;
279  Float_t rec_dca2dsigma;
280  Float_t rec_dca3dxy;
281  Float_t rec_dca3dxysigma;
282  Float_t rec_dca3dz;
283  Float_t rec_dca3dzsigma;
284  Float_t rec_pcax;
285  Float_t rec_pcay;
286  Float_t rec_pcaz;
287  Float_t rec_gtrackID;
288  Float_t rec_gflavor;
289  Float_t rec_gnhits;
290  Float_t rec_gnmaps;
291  Float_t rec_gnintt;
292  Float_t rec_gntpc;
293  Float_t rec_gnmms;
294  Float_t rec_gnlmaps;
295  Float_t rec_gnlintt;
296  Float_t rec_gnltpc;
297  Float_t rec_gnlmms;
298  Float_t rec_gpx;
299  Float_t rec_gpy;
300  Float_t rec_gpz;
301  Float_t rec_gpt;
302  Float_t rec_geta;
303  Float_t rec_gphi;
304  Float_t rec_gvx;
305  Float_t rec_gvy;
306  Float_t rec_gvz;
307  Float_t rec_gvt;
308  Float_t rec_gfpx;
309  Float_t rec_gfpy;
310  Float_t rec_gfpz;
311  Float_t rec_gfx;
312  Float_t rec_gfy;
313  Float_t rec_gfz;
314  Float_t rec_gembed;
315  Float_t rec_gprimary;
316  Float_t rec_nfromtruth;
317  Float_t rec_nwrong;
318  Float_t rec_ntrumaps;
319  Float_t rec_nwrongmaps;
320  Float_t rec_ntruintt;
321  Float_t rec_nwrongintt;
322  Float_t rec_ntrutpc;
323  Float_t rec_nwrongtpc;
324  Float_t rec_ntrumms;
325  Float_t rec_nwrongmms;
326  Float_t rec_ntrutpc1;
327  Float_t rec_nwrongtpc1;
328  Float_t rec_ntrutpc11;
329  Float_t rec_nwrongtpc11;
330  Float_t rec_ntrutpc2;
331  Float_t rec_nwrongtpc2;
332  Float_t rec_ntrutpc3;
333  Float_t rec_nwrongtpc3;
334  Float_t rec_layersfromtruth;
335  Float_t rec_npedge;
336  Float_t rec_nredge;
337  Float_t rec_nbig;
338  Float_t rec_novlp;
339  Float_t rec_merr;
340  Float_t rec_msize;
341  Float_t rec_nhittpcall;
342  Float_t rec_nhittpcin;
343  Float_t rec_nhittpcmid;
344  Float_t rec_nhittpcout;
345  Float_t rec_nclusall;
346  Float_t rec_nclustpc;
347  Float_t rec_nclusintt;
348  Float_t rec_nclusmaps;
349  Float_t rec_nclusmms;
350 
351  // Set branch addresses.
352  tInTrue -> SetBranchAddress("event", &tru_event);
353  tInTrue -> SetBranchAddress("seed", &tru_seed);
354  tInTrue -> SetBranchAddress("gntracks", &tru_gntracks);
355  tInTrue -> SetBranchAddress("gnchghad", &tru_gnchghad);
356  tInTrue -> SetBranchAddress("gtrackID", &tru_gtrackID);
357  tInTrue -> SetBranchAddress("gflavor", &tru_gflavor);
358  tInTrue -> SetBranchAddress("gnhits", &tru_gnhits);
359  tInTrue -> SetBranchAddress("gnmaps", &tru_gnmaps);
360  tInTrue -> SetBranchAddress("gnintt", &tru_gnintt);
361  tInTrue -> SetBranchAddress("gnmms", &tru_gnmms);
362  tInTrue -> SetBranchAddress("gnintt1", &tru_gnintt1);
363  tInTrue -> SetBranchAddress("gnintt2", &tru_gnintt2);
364  tInTrue -> SetBranchAddress("gnintt3", &tru_gnintt3);
365  tInTrue -> SetBranchAddress("gnintt4", &tru_gnintt4);
366  tInTrue -> SetBranchAddress("gnintt5", &tru_gnintt5);
367  tInTrue -> SetBranchAddress("gnintt6", &tru_gnintt6);
368  tInTrue -> SetBranchAddress("gnintt7", &tru_gnintt7);
369  tInTrue -> SetBranchAddress("gnintt8", &tru_gnintt8);
370  tInTrue -> SetBranchAddress("gntpc", &tru_gntpc);
371  tInTrue -> SetBranchAddress("gnlmaps", &tru_gnlmaps);
372  tInTrue -> SetBranchAddress("gnlintt", &tru_gnlintt);
373  tInTrue -> SetBranchAddress("gnltpc", &tru_gnltpc);
374  tInTrue -> SetBranchAddress("gnlmms", &tru_gnlmms);
375  tInTrue -> SetBranchAddress("gpx", &tru_gpx);
376  tInTrue -> SetBranchAddress("gpy", &tru_gpy);
377  tInTrue -> SetBranchAddress("gpz", &tru_gpz);
378  tInTrue -> SetBranchAddress("gpt", &tru_gpt);
379  tInTrue -> SetBranchAddress("geta", &tru_geta);
380  tInTrue -> SetBranchAddress("gphi", &tru_gphi);
381  tInTrue -> SetBranchAddress("gvx", &tru_gvx);
382  tInTrue -> SetBranchAddress("gvy", &tru_gvy);
383  tInTrue -> SetBranchAddress("gvz", &tru_gvz);
384  tInTrue -> SetBranchAddress("gvt", &tru_gvt);
385  tInTrue -> SetBranchAddress("gfpx", &tru_gfpx);
386  tInTrue -> SetBranchAddress("gfpy", &tru_gfpy);
387  tInTrue -> SetBranchAddress("gfpz", &tru_gfpz);
388  tInTrue -> SetBranchAddress("gfx", &tru_gfx);
389  tInTrue -> SetBranchAddress("gfy", &tru_gfy);
390  tInTrue -> SetBranchAddress("gfz", &tru_gfz);
391  tInTrue -> SetBranchAddress("gembed", &tru_gembed);
392  tInTrue -> SetBranchAddress("gprimary", &tru_gprimary);
393  tInTrue -> SetBranchAddress("trackID", &tru_trackID);
394  tInTrue -> SetBranchAddress("px", &tru_px);
395  tInTrue -> SetBranchAddress("py", &tru_py);
396  tInTrue -> SetBranchAddress("pz", &tru_pz);
397  tInTrue -> SetBranchAddress("pt", &tru_pt);
398  tInTrue -> SetBranchAddress("eta", &tru_eta);
399  tInTrue -> SetBranchAddress("phi", &tru_phi);
400  tInTrue -> SetBranchAddress("deltapt", &tru_deltapt);
401  tInTrue -> SetBranchAddress("deltaeta", &tru_deltaeta);
402  tInTrue -> SetBranchAddress("deltaphi", &tru_deltaphi);
403  tInTrue -> SetBranchAddress("siqr", &tru_siqr);
404  tInTrue -> SetBranchAddress("siphi", &tru_siphi);
405  tInTrue -> SetBranchAddress("sithe", &tru_sithe);
406  tInTrue -> SetBranchAddress("six0", &tru_six0);
407  tInTrue -> SetBranchAddress("siy0", &tru_siy0);
408  tInTrue -> SetBranchAddress("tpqr", &tru_tpqr);
409  tInTrue -> SetBranchAddress("tpphi", &tru_tpphi);
410  tInTrue -> SetBranchAddress("tpthe", &tru_tpthe);
411  tInTrue -> SetBranchAddress("tpx0", &tru_tpx0);
412  tInTrue -> SetBranchAddress("tpy0", &tru_tpy0);
413  tInTrue -> SetBranchAddress("charge", &tru_charge);
414  tInTrue -> SetBranchAddress("quality", &tru_quality);
415  tInTrue -> SetBranchAddress("chisq", &tru_chisq);
416  tInTrue -> SetBranchAddress("ndf", &tru_ndf);
417  tInTrue -> SetBranchAddress("nhits", &tru_nhits);
418  tInTrue -> SetBranchAddress("layers", &tru_layers);
419  tInTrue -> SetBranchAddress("nmaps", &tru_nmaps);
420  tInTrue -> SetBranchAddress("nintt", &tru_nintt);
421  tInTrue -> SetBranchAddress("ntpc", &tru_ntpc);
422  tInTrue -> SetBranchAddress("nmms", &tru_nmms);
423  tInTrue -> SetBranchAddress("ntpc1", &tru_ntpc1);
424  tInTrue -> SetBranchAddress("ntpc11", &tru_ntpc11);
425  tInTrue -> SetBranchAddress("ntpc2", &tru_ntpc2);
426  tInTrue -> SetBranchAddress("ntpc3", &tru_ntpc3);
427  tInTrue -> SetBranchAddress("nlmaps", &tru_nlmaps);
428  tInTrue -> SetBranchAddress("nlintt", &tru_nlintt);
429  tInTrue -> SetBranchAddress("nltpc", &tru_nltpc);
430  tInTrue -> SetBranchAddress("nlmms", &tru_nlmms);
431  tInTrue -> SetBranchAddress("vertexID", &tru_vertexID);
432  tInTrue -> SetBranchAddress("vx", &tru_vx);
433  tInTrue -> SetBranchAddress("vy", &tru_vy);
434  tInTrue -> SetBranchAddress("vz", &tru_vz);
435  tInTrue -> SetBranchAddress("dca2d", &tru_dca2d);
436  tInTrue -> SetBranchAddress("dca2dsigma", &tru_dca2dsigma);
437  tInTrue -> SetBranchAddress("dca3dxy", &tru_dca3dxy);
438  tInTrue -> SetBranchAddress("dca3dxysigma", &tru_dca3dxysigma);
439  tInTrue -> SetBranchAddress("dca3dz", &tru_dca3dz);
440  tInTrue -> SetBranchAddress("dca3dzsigma", &tru_dca3dzsigma);
441  tInTrue -> SetBranchAddress("pcax", &tru_pcax);
442  tInTrue -> SetBranchAddress("pcay", &tru_pcay);
443  tInTrue -> SetBranchAddress("pcaz", &tru_pcaz);
444  tInTrue -> SetBranchAddress("nfromtruth", &tru_nfromtruth);
445  tInTrue -> SetBranchAddress("nwrong", &tru_nwrong);
446  tInTrue -> SetBranchAddress("ntrumaps", &tru_ntrumaps);
447  tInTrue -> SetBranchAddress("nwrongmaps", &tru_nwrongmaps);
448  tInTrue -> SetBranchAddress("ntruintt", &tru_ntruintt);
449  tInTrue -> SetBranchAddress("nwrongintt", &tru_nwrongintt);
450  tInTrue -> SetBranchAddress("ntrutpc", &tru_ntrutpc);
451  tInTrue -> SetBranchAddress("nwrongtpc", &tru_nwrongtpc);
452  tInTrue -> SetBranchAddress("ntrumms", &tru_ntrumms);
453  tInTrue -> SetBranchAddress("nwrongmms", &tru_nwrongmms);
454  tInTrue -> SetBranchAddress("ntrutpc1", &tru_ntrutpc1);
455  tInTrue -> SetBranchAddress("nwrongtpc1", &tru_nwrongtpc1);
456  tInTrue -> SetBranchAddress("ntrutpc11", &tru_ntrutpc11);
457  tInTrue -> SetBranchAddress("nwrongtpc11", &tru_nwrongtpc11);
458  tInTrue -> SetBranchAddress("ntrutpc2", &tru_ntrutpc2);
459  tInTrue -> SetBranchAddress("nwrongtpc2", &tru_nwrongtpc2);
460  tInTrue -> SetBranchAddress("ntrutpc3", &tru_ntrutpc3);
461  tInTrue -> SetBranchAddress("nwrongtpc3", &tru_nwrongtpc3);
462  tInTrue -> SetBranchAddress("layersfromtruth", &tru_layersfromtruth);
463  tInTrue -> SetBranchAddress("npedge", &tru_npedge);
464  tInTrue -> SetBranchAddress("nredge", &tru_nredge);
465  tInTrue -> SetBranchAddress("nbig", &tru_nbig);
466  tInTrue -> SetBranchAddress("novlp", &tru_novlp);
467  tInTrue -> SetBranchAddress("merr", &tru_merr);
468  tInTrue -> SetBranchAddress("msize", &tru_msize);
469  tInTrue -> SetBranchAddress("nhittpcall", &tru_nhittpcall);
470  tInTrue -> SetBranchAddress("nhittpcin", &tru_nhittpcin);
471  tInTrue -> SetBranchAddress("nhittpcmid", &tru_nhittpcmid);
472  tInTrue -> SetBranchAddress("nhittpcout", &tru_nhittpcout);
473  tInTrue -> SetBranchAddress("nclusall", &tru_nclusall);
474  tInTrue -> SetBranchAddress("nclustpc", &tru_nclustpc);
475  tInTrue -> SetBranchAddress("nclusintt", &tru_nclusintt);
476  tInTrue -> SetBranchAddress("nclusmaps", &tru_nclusmaps);
477  tInTrue -> SetBranchAddress("nclusmms", &tru_nclusmms);
478 
479  tInReco -> SetBranchAddress("event", &rec_event);
480  tInReco -> SetBranchAddress("seed", &rec_seed);
481  tInReco -> SetBranchAddress("trackID", &rec_trackID);
482  tInReco -> SetBranchAddress("crossing", &rec_crossing);
483  tInReco -> SetBranchAddress("px", &rec_px);
484  tInReco -> SetBranchAddress("py", &rec_py);
485  tInReco -> SetBranchAddress("pz", &rec_pz);
486  tInReco -> SetBranchAddress("pt", &rec_pt);
487  tInReco -> SetBranchAddress("eta", &rec_eta);
488  tInReco -> SetBranchAddress("phi", &rec_phi);
489  tInReco -> SetBranchAddress("deltapt", &rec_deltapt);
490  tInReco -> SetBranchAddress("deltaeta", &rec_deltaeta);
491  tInReco -> SetBranchAddress("deltaphi", &rec_deltaphi);
492  tInReco -> SetBranchAddress("siqr", &rec_siqr);
493  tInReco -> SetBranchAddress("siphi", &rec_siphi);
494  tInReco -> SetBranchAddress("sithe", &rec_sithe);
495  tInReco -> SetBranchAddress("six0", &rec_six0);
496  tInReco -> SetBranchAddress("siy0", &rec_siy0);
497  tInReco -> SetBranchAddress("tpqr", &rec_tpqr);
498  tInReco -> SetBranchAddress("tpphi", &rec_tpphi);
499  tInReco -> SetBranchAddress("tpthe", &rec_tpthe);
500  tInReco -> SetBranchAddress("tpx0", &rec_tpx0);
501  tInReco -> SetBranchAddress("tpy0", &rec_tpy0);
502  tInReco -> SetBranchAddress("charge", &rec_charge);
503  tInReco -> SetBranchAddress("quality", &rec_quality);
504  tInReco -> SetBranchAddress("chisq", &rec_chisq);
505  tInReco -> SetBranchAddress("ndf", &rec_ndf);
506  tInReco -> SetBranchAddress("nhits", &rec_nhits);
507  tInReco -> SetBranchAddress("nmaps", &rec_nmaps);
508  tInReco -> SetBranchAddress("nintt", &rec_nintt);
509  tInReco -> SetBranchAddress("ntpc", &rec_ntpc);
510  tInReco -> SetBranchAddress("nmms", &rec_nmms);
511  tInReco -> SetBranchAddress("ntpc1", &rec_ntpc1);
512  tInReco -> SetBranchAddress("ntpc11", &rec_ntpc11);
513  tInReco -> SetBranchAddress("ntpc2", &rec_ntpc2);
514  tInReco -> SetBranchAddress("ntpc3", &rec_ntpc3);
515  tInReco -> SetBranchAddress("nlmaps", &rec_nlmaps);
516  tInReco -> SetBranchAddress("nlintt", &rec_nlintt);
517  tInReco -> SetBranchAddress("nltpc", &rec_nltpc);
518  tInReco -> SetBranchAddress("nlmms", &rec_nlmms);
519  tInReco -> SetBranchAddress("layers", &rec_layers);
520  tInReco -> SetBranchAddress("vertexID", &rec_vertexID);
521  tInReco -> SetBranchAddress("vx", &rec_vx);
522  tInReco -> SetBranchAddress("vy", &rec_vy);
523  tInReco -> SetBranchAddress("vz", &rec_vz);
524  tInReco -> SetBranchAddress("dca2d", &rec_dca2d);
525  tInReco -> SetBranchAddress("dca2dsigma", &rec_dca2dsigma);
526  tInReco -> SetBranchAddress("dca3dxy", &rec_dca3dxy);
527  tInReco -> SetBranchAddress("dca3dxysigma", &rec_dca3dxysigma);
528  tInReco -> SetBranchAddress("dca3dz", &rec_dca3dz);
529  tInReco -> SetBranchAddress("dca3dzsigma", &rec_dca3dzsigma);
530  tInReco -> SetBranchAddress("pcax", &rec_pcax);
531  tInReco -> SetBranchAddress("pcay", &rec_pcay);
532  tInReco -> SetBranchAddress("pcaz", &rec_pcaz);
533  tInReco -> SetBranchAddress("gtrackID", &rec_gtrackID);
534  tInReco -> SetBranchAddress("gflavor", &rec_gflavor);
535  tInReco -> SetBranchAddress("gnhits", &rec_gnhits);
536  tInReco -> SetBranchAddress("gnmaps", &rec_gnmaps);
537  tInReco -> SetBranchAddress("gnintt", &rec_gnintt);
538  tInReco -> SetBranchAddress("gntpc", &rec_gntpc);
539  tInReco -> SetBranchAddress("gnmms", &rec_gnmms);
540  tInReco -> SetBranchAddress("gnlmaps", &rec_gnlmaps);
541  tInReco -> SetBranchAddress("gnlintt", &rec_gnlintt);
542  tInReco -> SetBranchAddress("gnltpc", &rec_gnltpc);
543  tInReco -> SetBranchAddress("gnlmms", &rec_gnlmms);
544  tInReco -> SetBranchAddress("gpx", &rec_gpx);
545  tInReco -> SetBranchAddress("gpy", &rec_gpy);
546  tInReco -> SetBranchAddress("gpz", &rec_gpz);
547  tInReco -> SetBranchAddress("gpt", &rec_gpt);
548  tInReco -> SetBranchAddress("geta", &rec_geta);
549  tInReco -> SetBranchAddress("gphi", &rec_gphi);
550  tInReco -> SetBranchAddress("gvx", &rec_gvx);
551  tInReco -> SetBranchAddress("gvy", &rec_gvy);
552  tInReco -> SetBranchAddress("gvz", &rec_gvz);
553  tInReco -> SetBranchAddress("gvt", &rec_gvt);
554  tInReco -> SetBranchAddress("gfpx", &rec_gfpx);
555  tInReco -> SetBranchAddress("gfpy", &rec_gfpy);
556  tInReco -> SetBranchAddress("gfpz", &rec_gfpz);
557  tInReco -> SetBranchAddress("gfx", &rec_gfx);
558  tInReco -> SetBranchAddress("gfy", &rec_gfy);
559  tInReco -> SetBranchAddress("gfz", &rec_gfz);
560  tInReco -> SetBranchAddress("gembed", &rec_gembed);
561  tInReco -> SetBranchAddress("gprimary", &rec_gprimary);
562  tInReco -> SetBranchAddress("nfromtruth", &rec_nfromtruth);
563  tInReco -> SetBranchAddress("nwrong", &rec_nwrong);
564  tInReco -> SetBranchAddress("ntrumaps", &rec_ntrumaps);
565  tInReco -> SetBranchAddress("nwrongmaps", &rec_nwrongmaps);
566  tInReco -> SetBranchAddress("ntruintt", &rec_ntruintt);
567  tInReco -> SetBranchAddress("nwrongintt", &rec_nwrongintt);
568  tInReco -> SetBranchAddress("ntrutpc", &rec_ntrutpc);
569  tInReco -> SetBranchAddress("nwrongtpc", &rec_nwrongtpc);
570  tInReco -> SetBranchAddress("ntrumms", &rec_ntrumms);
571  tInReco -> SetBranchAddress("nwrongmms", &rec_nwrongmms);
572  tInReco -> SetBranchAddress("ntrutpc1", &rec_ntrutpc1);
573  tInReco -> SetBranchAddress("nwrongtpc1", &rec_nwrongtpc1);
574  tInReco -> SetBranchAddress("ntrutpc11", &rec_ntrutpc11);
575  tInReco -> SetBranchAddress("nwrongtpc11", &rec_nwrongtpc11);
576  tInReco -> SetBranchAddress("ntrutpc2", &rec_ntrutpc2);
577  tInReco -> SetBranchAddress("nwrongtpc2", &rec_nwrongtpc2);
578  tInReco -> SetBranchAddress("ntrutpc3", &rec_ntrutpc3);
579  tInReco -> SetBranchAddress("nwrongtpc3", &rec_nwrongtpc3);
580  tInReco -> SetBranchAddress("layersfromtruth", &rec_layersfromtruth);
581  tInReco -> SetBranchAddress("npedge", &rec_npedge);
582  tInReco -> SetBranchAddress("nredge", &rec_nredge);
583  tInReco -> SetBranchAddress("nbig", &rec_nbig);
584  tInReco -> SetBranchAddress("novlp", &rec_novlp);
585  tInReco -> SetBranchAddress("merr", &rec_merr);
586  tInReco -> SetBranchAddress("msize", &rec_msize);
587  tInReco -> SetBranchAddress("nhittpcall", &rec_nhittpcall);
588  tInReco -> SetBranchAddress("nhittpcin", &rec_nhittpcin);
589  tInReco -> SetBranchAddress("nhittpcmid", &rec_nhittpcmid);
590  tInReco -> SetBranchAddress("nhittpcout", &rec_nhittpcout);
591  tInReco -> SetBranchAddress("nclusall", &rec_nclusall);
592  tInReco -> SetBranchAddress("nclustpc", &rec_nclustpc);
593  tInReco -> SetBranchAddress("nclusintt", &rec_nclusintt);
594  tInReco -> SetBranchAddress("nclusmaps", &rec_nclusmaps);
595  tInReco -> SetBranchAddress("nclusmms", &rec_nclusmms);
596  cout << " Set input branches." << endl;
597 
598  // histogram indices
599  enum Var {
600  NTot,
601  NIntt,
602  NMvtx,
603  NTpc,
604  RTot,
605  RIntt,
606  RMvtx,
607  RTpc,
608  Phi,
609  Eta,
610  Pt,
611  Frac
612  };
613  enum Type {
614  Truth,
615  Track,
616  Weird,
617  Normal
618  };
619  enum Comp {
620  VsTruthPt,
621  VsNumTpc
622  };
623 
624  // output histogram base names
625  const vector<vector<string>> vecHistBase = {
626  {"hTruthNumTot", "hTrackNumTot", "hWeirdNumTot", "hNormNumTot"},
627  {"hTruthNumIntt", "hTrackNumIntt", "hWeirdNumIntt", "hNormNumIntt"},
628  {"hTruthNumMvtx", "hTrackNumMvtx", "hWeirdNumMvtx", "hNormNumMvtx"},
629  {"hTruthNumTpc", "hTrackNumTpc", "hWeirdNumTpc", "hNormNumTpc"},
630  {"hTruthRatTot", "hTrackRatTot", "hWeirdRatTot", "hNormRatTot"},
631  {"hTruthRatIntt", "hTrackRatIntt", "hWeirdRatIntt", "hNormRatIntt"},
632  {"hTruthRatMvtx", "hTrackRatMvtx", "hWeirdRatMvtx", "hNormRatMvtx"},
633  {"hTruthRatTpc", "hTrackRatTpc", "hWeirdRatTpc", "hNormRatTpc"},
634  {"hTruthPhi", "hTrackPhi", "hWeirdPhi", "hNormPhi"},
635  {"hTruthEta", "hTrackEta", "hWeirdEta", "hNormEta"},
636  {"hTruthPt", "hTrackPt", "hWeirdPt", "hNormPt"},
637  {"hTruthFrac", "hTrackFrac", "hWeirdFrac", "hNormFrac"}
638  };
639  const size_t nHistRows = vecHistBase.size();
640  const size_t nHistTypes = vecHistBase[0].size();
641 
642  // 2D histogram name modifiers
643  const vector<string> vecVsHistModifiers = {
644  "VsTruthPt",
645  "VsNumTpc"
646  };
647  const size_t nVsHistMods = vecVsHistModifiers.size();
648 
649  // axis titles
650  const string sCount("counts");
651  const vector<string> vecBaseAxisVars = {
652  "N^{tot} = N_{hit}^{mvtx} + N_{hit}^{intt} + N_{clust}^{tpc}",
653  "N_{hit}^{intt}",
654  "N_{hit}^{mvtx}",
655  "N_{clust}^{tpc}",
656  "N_{reco}^{tot} / N_{true}^{tot}",
657  "N_{reco}^{intt} / N_{true}^{intt}",
658  "N_{reco}^{mvtx} / N_{true}^{mvtx}",
659  "N_{reco}^{tpc} / N_{true}^{tpc}",
660  "#varphi",
661  "#eta",
662  "p_{T} [GeV/c]",
663  "p_{T}^{reco} / p_{T}^{true}"
664  };
665  const vector<string> vecVsAxisVars = {
666  "p_{T}^{true} [GeV/c]",
667  "N_{clust}^{tpc}"
668  };
669 
670  // output histogram no. of bins
671  const uint32_t nNumBins = 101;
672  const uint32_t nRatBins = 120;
673  const uint32_t nEtaBins = 80;
674  const uint32_t nPhiBins = 360;
675  const uint32_t nPtBins = 101;
676  const uint32_t nFracBins = 110;
677 
678  // output histogram bin ranges
679  const pair<float, float> xNumBins = {-0.5, 100.5};
680  const pair<float, float> xRatBins = {-0.5, 5.5};
681  const pair<float, float> xEtaBins = {-2., 2.};
682  const pair<float, float> xPhiBins = {-3.15, 3.15};
683  const pair<float, float> xPtBins = {-1., 100.};
684  const pair<float, float> xFracBins = {-0.5, 10.5};
685 
686  // output histogram base binning definitions
687  vector<tuple<uint32_t, pair<float, float>>> vecBaseHistBins = {
688  make_tuple(nNumBins, xNumBins),
689  make_tuple(nNumBins, xNumBins),
690  make_tuple(nNumBins, xNumBins),
691  make_tuple(nNumBins, xNumBins),
692  make_tuple(nRatBins, xRatBins),
693  make_tuple(nRatBins, xRatBins),
694  make_tuple(nRatBins, xRatBins),
695  make_tuple(nRatBins, xRatBins),
696  make_tuple(nPhiBins, xPhiBins),
697  make_tuple(nEtaBins, xEtaBins),
698  make_tuple(nPtBins, xPtBins),
699  make_tuple(nFracBins, xFracBins)
700  };
701 
702  // output 2D histogram x-axis binning
703  vector<tuple<uint32_t, pair<float, float>>> vecVsHistBins = {
704  make_tuple(nPtBins, xPtBins),
705  make_tuple(nNumBins, xNumBins)
706  };
707 
708  // make 1D histograms
709  vector<vector<TH1D*>> vecHist1D(nHistRows);
710  for (size_t iHistRow = 0; iHistRow < nHistRows; iHistRow++) {
711  for (const string sHistBase : vecHistBase[iHistRow]) {
712  vecHist1D[iHistRow].push_back(
713  new TH1D(
714  sHistBase.data(),
715  "",
716  get<0>(vecBaseHistBins[iHistRow]),
717  get<1>(vecBaseHistBins[iHistRow]).first,
718  get<1>(vecBaseHistBins[iHistRow]).second
719  )
720  );
721  } // end type loop
722  } // end row loop
723 
724  // make 2D histograms
725  vector<vector<vector<TH2D*>>> vecHist2D(nHistRows, vector<vector<TH2D*>>(nHistTypes));
726  for (size_t iHistRow = 0; iHistRow < nHistRows; iHistRow++) {
727  for (size_t iHistType = 0; iHistType < nHistTypes; iHistType++) {
728  for (size_t iVsHistMod = 0; iVsHistMod < nVsHistMods; iVsHistMod++) {
729  const string sHistName2D = vecHistBase[iHistRow][iHistType] + vecVsHistModifiers[iVsHistMod];
730  vecHist2D[iHistRow][iHistType].push_back(
731  new TH2D(
732  sHistName2D.data(),
733  "",
734  get<0>(vecVsHistBins[iVsHistMod]),
735  get<1>(vecVsHistBins[iVsHistMod]).first,
736  get<1>(vecVsHistBins[iVsHistMod]).second,
737  get<0>(vecBaseHistBins[iHistRow]),
738  get<1>(vecBaseHistBins[iHistRow]).first,
739  get<1>(vecBaseHistBins[iHistRow]).second
740  )
741  );
742  } // end modifier loop
743  } // end type loop
744  } // end row loop
745 
746  // set errors
747  for (auto histRow1D : vecHist1D) {
748  for (auto hist1D : histRow1D) {
749  hist1D -> Sumw2();
750  }
751  }
752 
753  for (auto histRow2D : vecHist2D) {
754  for (auto histType2D : histRow2D) {
755  for (auto hist2D: histType2D) {
756  hist2D -> Sumw2();
757  }
758  }
759  }
760 
761  // grab no. of entries
762  const int64_t nTrueEntries = tInTrue -> GetEntries();
763  const int64_t nRecoEntries = tInReco -> GetEntries();
764  cout << " Beginning truth particle loop: " << nTrueEntries << " to process" << endl;
765 
766  // loop over truth particles
767  int64_t nTrueBytes = 0;
768  for (int64_t iTrueEntry = 0; iTrueEntry < nTrueEntries; iTrueEntry++) {
769 
770  // grab truth particle entry
771  const int64_t trueBytes = tInTrue -> GetEntry(iTrueEntry);
772  if (trueBytes < 0) {
773  cerr << "PANIC: issue with entry " << iTrueEntry << "! Aborting loop!\n" << endl;
774  break;
775  } else {
776  nTrueBytes += trueBytes;
777  }
778 
779  const int64_t iTrueProg = iTrueEntry + 1;
780  if (iTrueProg == nTrueEntries) {
781  cout << " Processing entry " << iTrueProg << "/" << nTrueEntries << "..." << endl;
782  } else {
783  cout << " Processing entry " << iTrueProg << "/" << nTrueEntries << "...\r" << flush;
784  }
785 
786  // skip nan's
787  if (isnan(tru_trackID)) continue;
788 
789  // run calculations
790  const double tru_gntot = tru_gnintt + tru_gnmaps + tru_gntpc;
791 
792  // check if near sector
793  bool isNearSector = false;
794  if (doPhiCut) {
795  for (size_t iSector = 0; iSector < NSectors; iSector++) {
796  const float cutVal = sigCutVal * phiSectors[iSector].second;
797  const float minPhi = phiSectors[iSector].first - cutVal;
798  const float maxPhi = phiSectors[iSector].first + cutVal;
799  const bool isNear = ((tru_gphi >= minPhi) && (tru_gphi <= maxPhi));
800  if (isNear) {
801  isNearSector = true;
802  break;
803  }
804  } // end sector loop
805  } // end if (doPhiCut)
806 
807  // apply cuts
808  const bool isPrimary = (tru_gprimary == 1);
809  const bool isInZVtxCut = ((tru_gvz > zVtxRange.first) && (tru_gvz < zVtxRange.second));
810  if (useOnlyPrimTrks && !isPrimary) continue;
811  if (doZVtxCut && !isInZVtxCut) continue;
812  if (doPhiCut && isNearSector) continue;
813 
814  // fill truth 1D histograms
815  vecHist1D[Var::NTot][Type::Truth] -> Fill(tru_gntot);
816  vecHist1D[Var::NIntt][Type::Truth] -> Fill(tru_gnintt);
817  vecHist1D[Var::NMvtx][Type::Truth] -> Fill(tru_gnmaps);
818  vecHist1D[Var::NTpc][Type::Truth] -> Fill(tru_gntpc);
819  vecHist1D[Var::RTot][Type::Truth] -> Fill(1.);
820  vecHist1D[Var::RIntt][Type::Truth] -> Fill(1.);
821  vecHist1D[Var::RMvtx][Type::Truth] -> Fill(1.);
822  vecHist1D[Var::RTpc][Type::Truth] -> Fill(1.);
823  vecHist1D[Var::Phi][Type::Truth] -> Fill(tru_gphi);
824  vecHist1D[Var::Eta][Type::Truth] -> Fill(tru_geta);
825  vecHist1D[Var::Pt][Type::Truth] -> Fill(tru_gpt);
826  vecHist1D[Var::Frac][Type::Truth] -> Fill(1.);
827 
828  // fill truth 2D histograms
829  vecHist2D[Var::NTot][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, tru_gntot);
830  vecHist2D[Var::NIntt][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, tru_gnintt);
831  vecHist2D[Var::NMvtx][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, tru_gnmaps);
832  vecHist2D[Var::NTpc][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, tru_gntpc);
833  vecHist2D[Var::RTot][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, 1.);
834  vecHist2D[Var::RIntt][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, 1.);
835  vecHist2D[Var::RMvtx][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, 1.);
836  vecHist2D[Var::RTpc][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, 1.);
837  vecHist2D[Var::Phi][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, tru_gphi);
838  vecHist2D[Var::Eta][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, tru_geta);
839  vecHist2D[Var::Pt][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, tru_gpt);
840  vecHist2D[Var::Frac][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, 1.);
841 
842  vecHist2D[Var::NTot][Type::Truth][Comp::VsNumTpc] -> Fill(tru_gntpc, tru_gntot);
843  vecHist2D[Var::NIntt][Type::Truth][Comp::VsNumTpc] -> Fill(tru_gntpc, tru_gnintt);
844  vecHist2D[Var::NMvtx][Type::Truth][Comp::VsNumTpc] -> Fill(tru_gntpc, tru_gnmaps);
845  vecHist2D[Var::NTpc][Type::Truth][Comp::VsNumTpc] -> Fill(tru_gntpc, tru_gntpc);
846  vecHist2D[Var::RTot][Type::Truth][Comp::VsNumTpc] -> Fill(tru_gntpc, 1.);
847  vecHist2D[Var::RIntt][Type::Truth][Comp::VsNumTpc] -> Fill(tru_gntpc, 1.);
848  vecHist2D[Var::RMvtx][Type::Truth][Comp::VsNumTpc] -> Fill(tru_gntpc, 1.);
849  vecHist2D[Var::RTpc][Type::Truth][Comp::VsNumTpc] -> Fill(tru_gntpc, 1.);
850  vecHist2D[Var::Phi][Type::Truth][Comp::VsNumTpc] -> Fill(tru_gntpc, tru_gphi);
851  vecHist2D[Var::Eta][Type::Truth][Comp::VsNumTpc] -> Fill(tru_gntpc, tru_geta);
852  vecHist2D[Var::Pt][Type::Truth][Comp::VsNumTpc] -> Fill(tru_gntpc, tru_gpt);
853  vecHist2D[Var::Frac][Type::Truth][Comp::VsNumTpc] -> Fill(tru_gntpc, 1.);
854  } // end truth particle loop
855 
856  // announce next entry loop
857  cout << " Finished truth particle loop.\n"
858  << " Beginning reconstructed track loop: " << nRecoEntries << " to process"
859  << endl;
860 
861  // loop over reco tracks
862  int64_t nRecoBytes = 0;
863  for (int64_t iRecoEntry = 0; iRecoEntry < nRecoEntries; iRecoEntry++) {
864 
865  // grab reco track entry
866  const int64_t recoBytes = tInReco -> GetEntry(iRecoEntry);
867  if (recoBytes < 0) {
868  cerr << "PANIC: issue with entry " << iRecoEntry << "! Aborting loop!\n" << endl;
869  break;
870  } else {
871  nRecoBytes += recoBytes;
872  }
873 
874  const int64_t iRecoProg = iRecoEntry + 1;
875  if (iRecoProg == nRecoEntries) {
876  cout << " Processing entry " << iRecoProg << "/" << nRecoEntries << "..." << endl;
877  } else {
878  cout << " Processing entry " << iRecoProg << "/" << nRecoEntries << "...\r" << flush;
879  }
880 
881  // skip nan's
882  if (isnan(rec_gpt)) continue;
883 
884  // run calculations
885  const double rec_ntot = rec_nintt + rec_nmaps + rec_ntpc;
886  const double rec_gntot = rec_gnintt + rec_gnmaps + rec_gntpc;
887  const double rec_rtot = rec_ntot / rec_gntot;
888  const double rec_rintt = rec_nintt / rec_gnintt;
889  const double rec_rmaps = rec_nmaps / rec_gnmaps;
890  const double rec_rtpc = rec_ntpc / rec_gntpc;
891  const double rec_ptfrac = rec_pt / rec_gpt;
892 
893  // check if near sector
894  bool isNearSector = false;
895  if (doPhiCut) {
896  for (size_t iSector = 0; iSector < NSectors; iSector++) {
897  const float cutVal = sigCutVal * phiSectors[iSector].second;
898  const float minPhi = phiSectors[iSector].first - cutVal;
899  const float maxPhi = phiSectors[iSector].first + cutVal;
900  const bool isNear = ((rec_phi >= minPhi) && (rec_phi <= maxPhi));
901  if (isNear) {
902  isNearSector = true;
903  break;
904  }
905  } // end sector loop
906  } // end if (doPhiCut)
907 
908  // apply cuts
909  const bool isPrimary = (rec_gprimary == 1);
910  const bool isInZVtxCut = ((rec_gvz > zVtxRange.first) && (rec_gvz < zVtxRange.second));
911  if (useOnlyPrimTrks && !isPrimary) continue;
912  if (doZVtxCut && !isInZVtxCut) continue;
913  if (doPhiCut && isNearSector) continue;
914 
915  // fill all matched reco 1D histograms
916  vecHist1D[Var::NTot][Type::Track] -> Fill(rec_ntot);
917  vecHist1D[Var::NIntt][Type::Track] -> Fill(rec_nintt);
918  vecHist1D[Var::NMvtx][Type::Track] -> Fill(rec_nmaps);
919  vecHist1D[Var::NTpc][Type::Track] -> Fill(rec_ntpc);
920  vecHist1D[Var::RTot][Type::Track] -> Fill(rec_rtot);
921  vecHist1D[Var::RIntt][Type::Track] -> Fill(rec_rintt);
922  vecHist1D[Var::RMvtx][Type::Track] -> Fill(rec_rmaps);
923  vecHist1D[Var::RTpc][Type::Track] -> Fill(rec_rtpc);
924  vecHist1D[Var::Phi][Type::Track] -> Fill(rec_phi);
925  vecHist1D[Var::Eta][Type::Track] -> Fill(rec_eta);
926  vecHist1D[Var::Pt][Type::Track] -> Fill(rec_pt);
927  vecHist1D[Var::Frac][Type::Track] -> Fill(rec_ptfrac);
928 
929  // fill all matched reco 2D histograms
930  vecHist2D[Var::NTot][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_ntot);
931  vecHist2D[Var::NIntt][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_nintt);
932  vecHist2D[Var::NMvtx][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_nmaps);
933  vecHist2D[Var::NTpc][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_ntpc);
934  vecHist2D[Var::RTot][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rtot);
935  vecHist2D[Var::RIntt][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rintt);
936  vecHist2D[Var::RMvtx][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rmaps);
937  vecHist2D[Var::RTpc][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rtpc);
938  vecHist2D[Var::Phi][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_phi);
939  vecHist2D[Var::Eta][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_eta);
940  vecHist2D[Var::Pt][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_pt);
941  vecHist2D[Var::Frac][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_ptfrac);
942 
943  vecHist2D[Var::NTot][Type::Track][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_ntot);
944  vecHist2D[Var::NIntt][Type::Track][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_nintt);
945  vecHist2D[Var::NMvtx][Type::Track][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_nmaps);
946  vecHist2D[Var::NTpc][Type::Track][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_ntpc);
947  vecHist2D[Var::RTot][Type::Track][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_rtpc);
948  vecHist2D[Var::RIntt][Type::Track][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_rintt);
949  vecHist2D[Var::RMvtx][Type::Track][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_rmaps);
950  vecHist2D[Var::RTpc][Type::Track][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_rtpc);
951  vecHist2D[Var::Phi][Type::Track][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_phi);
952  vecHist2D[Var::Eta][Type::Track][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_eta);
953  vecHist2D[Var::Pt][Type::Track][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_pt);
954  vecHist2D[Var::Frac][Type::Track][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_ptfrac);
955 
956  // fill weird and normal matched reco 1D histograms
957  const bool isNormalTrack = ((rec_ptfrac >= oddPtFrac.first) && (rec_ptfrac <= oddPtFrac.second));
958  if (isNormalTrack) {
959  vecHist1D[Var::NTot][Type::Normal] -> Fill(rec_ntot);
960  vecHist1D[Var::NIntt][Type::Normal] -> Fill(rec_nintt);
961  vecHist1D[Var::NMvtx][Type::Normal] -> Fill(rec_nmaps);
962  vecHist1D[Var::NTpc][Type::Normal] -> Fill(rec_ntpc);
963  vecHist1D[Var::RTot][Type::Normal] -> Fill(rec_rtot);
964  vecHist1D[Var::RIntt][Type::Normal] -> Fill(rec_rintt);
965  vecHist1D[Var::RMvtx][Type::Normal] -> Fill(rec_rmaps);
966  vecHist1D[Var::RTpc][Type::Normal] -> Fill(rec_rtpc);
967  vecHist1D[Var::Phi][Type::Normal] -> Fill(rec_phi);
968  vecHist1D[Var::Eta][Type::Normal] -> Fill(rec_eta);
969  vecHist1D[Var::Pt][Type::Normal] -> Fill(rec_pt);
970  vecHist1D[Var::Frac][Type::Normal] -> Fill(rec_ptfrac);
971 
972  vecHist2D[Var::NTot][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_ntot);
973  vecHist2D[Var::NIntt][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_nintt);
974  vecHist2D[Var::NMvtx][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_nmaps);
975  vecHist2D[Var::NTpc][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_ntpc);
976  vecHist2D[Var::RTot][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rtot);
977  vecHist2D[Var::RIntt][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rintt);
978  vecHist2D[Var::RMvtx][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rmaps);
979  vecHist2D[Var::RTpc][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rtpc);
980  vecHist2D[Var::Phi][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_phi);
981  vecHist2D[Var::Eta][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_eta);
982  vecHist2D[Var::Pt][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_pt);
983  vecHist2D[Var::Frac][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_ptfrac);
984 
985  vecHist2D[Var::NTot][Type::Normal][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_ntot);
986  vecHist2D[Var::NIntt][Type::Normal][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_nintt);
987  vecHist2D[Var::NMvtx][Type::Normal][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_nmaps);
988  vecHist2D[Var::NTpc][Type::Normal][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_ntpc);
989  vecHist2D[Var::RTot][Type::Normal][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_rtot);
990  vecHist2D[Var::RIntt][Type::Normal][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_rintt);
991  vecHist2D[Var::RMvtx][Type::Normal][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_rmaps);
992  vecHist2D[Var::RTpc][Type::Normal][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_rtpc);
993  vecHist2D[Var::Phi][Type::Normal][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_phi);
994  vecHist2D[Var::Eta][Type::Normal][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_eta);
995  vecHist2D[Var::Pt][Type::Normal][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_pt);
996  vecHist2D[Var::Frac][Type::Normal][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_ptfrac);
997  } else {
998  vecHist1D[Var::NTot][Type::Weird] -> Fill(rec_ntot);
999  vecHist1D[Var::NIntt][Type::Weird] -> Fill(rec_nintt);
1000  vecHist1D[Var::NMvtx][Type::Weird] -> Fill(rec_nmaps);
1001  vecHist1D[Var::NTpc][Type::Weird] -> Fill(rec_ntpc);
1002  vecHist1D[Var::RTot][Type::Weird] -> Fill(rec_rtot);
1003  vecHist1D[Var::RIntt][Type::Weird] -> Fill(rec_rintt);
1004  vecHist1D[Var::RMvtx][Type::Weird] -> Fill(rec_rmaps);
1005  vecHist1D[Var::RTpc][Type::Weird] -> Fill(rec_rtpc);
1006  vecHist1D[Var::Phi][Type::Weird] -> Fill(rec_phi);
1007  vecHist1D[Var::Eta][Type::Weird] -> Fill(rec_eta);
1008  vecHist1D[Var::Pt][Type::Weird] -> Fill(rec_pt);
1009  vecHist1D[Var::Frac][Type::Weird] -> Fill(rec_ptfrac);
1010 
1011  vecHist2D[Var::NTot][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_ntot);
1012  vecHist2D[Var::NIntt][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_nintt);
1013  vecHist2D[Var::NMvtx][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_nmaps);
1014  vecHist2D[Var::NTpc][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_ntpc);
1015  vecHist2D[Var::RTot][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rtot);
1016  vecHist2D[Var::RIntt][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rintt);
1017  vecHist2D[Var::RMvtx][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rmaps);
1018  vecHist2D[Var::RTpc][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rtpc);
1019  vecHist2D[Var::Phi][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_phi);
1020  vecHist2D[Var::Eta][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_eta);
1021  vecHist2D[Var::Pt][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_pt);
1022  vecHist2D[Var::Frac][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_ptfrac);
1023 
1024  vecHist2D[Var::NTot][Type::Weird][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_ntot);
1025  vecHist2D[Var::NIntt][Type::Weird][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_nintt);
1026  vecHist2D[Var::NMvtx][Type::Weird][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_nmaps);
1027  vecHist2D[Var::NTpc][Type::Weird][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_ntpc);
1028  vecHist2D[Var::RTot][Type::Weird][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_rtpc);
1029  vecHist2D[Var::RIntt][Type::Weird][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_rintt);
1030  vecHist2D[Var::RMvtx][Type::Weird][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_rmaps);
1031  vecHist2D[Var::RTpc][Type::Weird][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_rtpc);
1032  vecHist2D[Var::Phi][Type::Weird][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_phi);
1033  vecHist2D[Var::Eta][Type::Weird][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_eta);
1034  vecHist2D[Var::Pt][Type::Weird][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_pt);
1035  vecHist2D[Var::Frac][Type::Weird][Comp::VsNumTpc] -> Fill(rec_gntpc, rec_ptfrac);
1036  }
1037  } // end reco track loop
1038  cout << " Finished reconstructed track loop." << endl;
1039 
1040  // set axis titles
1041  size_t iVar = 0;
1042  for (auto histRow1D : vecHist1D) {
1043  for (auto hist1D : histRow1D) {
1044  hist1D -> GetXaxis() -> SetTitle(vecBaseAxisVars.at(iVar).data());
1045  hist1D -> GetYaxis() -> SetTitle(sCount.data());
1046  }
1047  ++iVar;
1048  }
1049  iVar = 0;
1050 
1051  size_t iComp = 0;
1052  for (auto histRow2D : vecHist2D) {
1053  for (auto histType2D : histRow2D) {
1054  iComp = 0;
1055  for (auto hist2D : histType2D) {
1056  hist2D -> GetXaxis() -> SetTitle(vecVsAxisVars.at(iComp).data());
1057  hist2D -> GetYaxis() -> SetTitle(vecBaseAxisVars.at(iVar).data());
1058  hist2D -> GetZaxis() -> SetTitle(sCount.data());
1059  ++iComp;
1060  }
1061  }
1062  ++iVar;
1063  }
1064  cout << " Set axis titles." << endl;
1065 
1066  // save histograms
1067  fOutput -> cd();
1068  for (auto histRow1D : vecHist1D) {
1069  for (auto hist1D : histRow1D) {
1070  hist1D -> Write();
1071  }
1072  }
1073  for (auto histRow2D : vecHist2D) {
1074  for (auto histType2D : histRow2D) {
1075  for (auto hist2D: histType2D) {
1076  hist2D -> Write();
1077  }
1078  }
1079  }
1080  cout << " Saved histograms." << endl;
1081 
1082  // close files
1083  fOutput -> cd();
1084  fOutput -> Close();
1085 
1086  // exit
1087  cout << " Finished old evaluator plot script!\n" << endl;
1088  return;
1089 
1090 }
1091 
1092 // end ------------------------------------------------------------------------