Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MakeNewMatcherTuplePlots.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MakeNewMatcherTuplePlots.cxx
1 // ----------------------------------------------------------------------------
2 // 'MakeNewMatcherTuplePlots.cxx'
3 // Derek Anderson
4 // 01.24.2024
5 //
6 // Short macro to make plots from the
7 // output of the modified ClusMatchTree
8 // module.
9 // ----------------------------------------------------------------------------
10 
11 #include <array>
12 #include <string>
13 #include <vector>
14 #include <utility>
15 #include <iostream>
16 #include "TH1.h"
17 #include "TH2.h"
18 #include "TFile.h"
19 #include "TTree.h"
20 #include "TError.h"
21 
22 using namespace std;
23 
24 // global constants
25 static const size_t NSectors = 12;
26 
27 
28 
29 // main body of macro ---------------------------------------------------------
30 
32 
33  // io parameters
34  const string sOutput("newMatcherTuplePlots_oneMatchPerParticle_forZVtxCutComp_oddFrac05150.pt10n1evt500pim.d1m2y2024.root");
35  const string sInTrue("input/merged/sPhenixG4_oneMatchPerParticle_forCrossCheck_newMatcher.pt10num1evt500pim.d25m1y2024.root");
36  const string sInReco("input/merged/sPhenixG4_oneMatchPerParticle_forCrossCheck_newMatcher.pt10num1evt500pim.d25m1y2024.root");
37  const string sTreeTrue("ntForEvalComp");
38  const string sTreeReco("ntForEvalComp");
39 
40  // cut options
41  const bool doZVtxCut(true);
42  const bool doPhiCut(false);
43 
44  // weird track & cut parameters
45  const pair<float, float> oddPtFrac = {0.5, 1.5};
46  const pair<float, float> zVtxRange = {-1., 1.};
47 
48  // phi cut parameters
49  const float sigCutVal(0.75);
50  const array<pair<float, float>, NSectors> phiSectors = {
51  make_pair(-2.92, 0.12),
52  make_pair(-2.38, 0.05),
53  make_pair(-1.93, 0.18),
54  make_pair(-1.33, 0.07),
55  make_pair(-0.90, 0.24),
56  make_pair(-0.29, 0.09),
57  make_pair(0.23, 0.11),
58  make_pair(0.73, 0.10),
59  make_pair(1.28, 0.10),
60  make_pair(1.81, 0.08),
61  make_pair(2.23, 0.18),
62  make_pair(2.80, 0.17)
63  };
64 
65  // lower verbosity
66  gErrorIgnoreLevel = kError;
67  cout << "\n Staring new matcher plot script..." << endl;
68 
69  // open files
70  TFile* fOutput = new TFile(sOutput.data(), "recreate");
71  TFile* fInTrue = new TFile(sInTrue.data(), "read");
72  TFile* fInReco = new TFile(sInReco.data(), "read");
73  if (!fOutput || !fInTrue || !fInReco) {
74  cerr << "PANIC: couldn't open a file!\n"
75  << " fOutput = " << fOutput << "fInTrue = " << fInTrue << ", fInReco = " << fInReco << "\n"
76  << endl;
77  return;
78  }
79  cout << " Opened files." << endl;
80 
81  // grab input tree
82  TTree* tInTrue = (TTree*) fInTrue -> Get(sTreeTrue.data());
83  TTree* tInReco = (TTree*) fInReco -> Get(sTreeReco.data());
84  if (!tInTrue || !tInReco) {
85  cerr << "PANIC: couldn't grab input tree!\n"
86  << " sTreeTrue = " << sTreeTrue << ", tInTrue = " << tInTrue << "\n"
87  << " sTreeReco = " << sTreeReco << ", tInReco = " << tInReco << "\n"
88  << endl;
89  return;
90  }
91  cout << " Grabbed input trees." << endl;
92 
93  // declare input leaves
94  Float_t tru_evtid;
95  Float_t tru_trkid;
96  Float_t tru_pt;
97  Float_t tru_eta;
98  Float_t tru_phi;
99  Float_t tru_nmvtxclust_trkmatcher;
100  Float_t tru_ninttclust_trkmatcher;
101  Float_t tru_ntpclust_trkmatcher;
102  Float_t tru_nmvtxclust_manual;
103  Float_t tru_ninttclust_manual;
104  Float_t tru_ntpcclust_manual;
105  Float_t tru_nmvtxlayer_;
106  Float_t tru_ninttlayer;
107  Float_t tru_ntpclayer;
108  Float_t tru_deltapt;
109  Float_t tru_quality;
110  Float_t tru_dcaxy;
111  Float_t tru_dcaz;
112  Float_t tru_sigmadcaxy;
113  Float_t tru_sigmadacz;
114  Float_t tru_vx;
115  Float_t tru_vy;
116  Float_t tru_vz;
117  Float_t tru_gtrkid;
118  Float_t tru_gpt;
119  Float_t tru_geta;
120  Float_t tru_gphi;
121  Float_t tru_gnmvtxclust_trkmatcher;
122  Float_t tru_gninttclust_trkmatcher;
123  Float_t tru_gntpclust_trkmatchergnmvtxclust_manual;
124  Float_t tru_gninttclust_manual;
125  Float_t tru_gntpcclust_manual;
126  Float_t tru_gnmvtxlayer;
127  Float_t tru_gninttlayer;
128  Float_t tru_gntpclayer;
129  Float_t tru_gdeltapt;
130  Float_t tru_gquality;
131  Float_t tru_gdcaxy;
132  Float_t tru_gdcaz;
133  Float_t tru_gsigmadcaxy;
134  Float_t tru_gsigmadacz;
135  Float_t tru_gvx;
136  Float_t tru_gvy;
137  Float_t tru_gvz;
138  Float_t tru_fracnmvtxmatched;
139  Float_t tru_fracninttmatched;
140  Float_t tru_fracntpcmatched;
141 
142  Float_t rec_evtid;
143  Float_t rec_trkid;
144  Float_t rec_pt;
145  Float_t rec_eta;
146  Float_t rec_phi;
147  Float_t rec_nmvtxclust_trkmatcher;
148  Float_t rec_ninttclust_trkmatcher;
149  Float_t rec_ntpclust_trkmatcher;
150  Float_t rec_nmvtxclust_manual;
151  Float_t rec_ninttclust_manual;
152  Float_t rec_ntpcclust_manual;
153  Float_t rec_nmvtxlayer_;
154  Float_t rec_ninttlayer;
155  Float_t rec_ntpclayer;
156  Float_t rec_deltapt;
157  Float_t rec_quality;
158  Float_t rec_dcaxy;
159  Float_t rec_dcaz;
160  Float_t rec_sigmadcaxy;
161  Float_t rec_sigmadacz;
162  Float_t rec_vx;
163  Float_t rec_vy;
164  Float_t rec_vz;
165  Float_t rec_gtrkid;
166  Float_t rec_gpt;
167  Float_t rec_geta;
168  Float_t rec_gphi;
169  Float_t rec_gnmvtxclust_trkmatcher;
170  Float_t rec_gninttclust_trkmatcher;
171  Float_t rec_gntpclust_trkmatchergnmvtxclust_manual;
172  Float_t rec_gninttclust_manual;
173  Float_t rec_gntpcclust_manual;
174  Float_t rec_gnmvtxlayer;
175  Float_t rec_gninttlayer;
176  Float_t rec_gntpclayer;
177  Float_t rec_gdeltapt;
178  Float_t rec_gquality;
179  Float_t rec_gdcaxy;
180  Float_t rec_gdcaz;
181  Float_t rec_gsigmadcaxy;
182  Float_t rec_gsigmadacz;
183  Float_t rec_gvx;
184  Float_t rec_gvy;
185  Float_t rec_gvz;
186  Float_t rec_fracnmvtxmatched;
187  Float_t rec_fracninttmatched;
188  Float_t rec_fracntpcmatched;
189 
190  // set branch addresses
191  tInTrue -> SetBranchAddress("evtid", &tru_evtid);
192  tInTrue -> SetBranchAddress("trkid", &tru_trkid);
193  tInTrue -> SetBranchAddress("pt", &tru_pt);
194  tInTrue -> SetBranchAddress("eta", &tru_eta);
195  tInTrue -> SetBranchAddress("phi", &tru_phi);
196  tInTrue -> SetBranchAddress("nmvtxclust_trkmatcher", &tru_nmvtxclust_trkmatcher);
197  tInTrue -> SetBranchAddress("ninttclust_trkmatcher", &tru_ninttclust_trkmatcher);
198  tInTrue -> SetBranchAddress("ntpclust_trkmatcher", &tru_ntpclust_trkmatcher);
199  tInTrue -> SetBranchAddress("nmvtxclust_manual", &tru_nmvtxclust_manual);
200  tInTrue -> SetBranchAddress("ninttclust_manual", &tru_ninttclust_manual);
201  tInTrue -> SetBranchAddress("ntpcclust_manual", &tru_ntpcclust_manual);
202  tInTrue -> SetBranchAddress("nmvtxlayer_", &tru_nmvtxlayer_);
203  tInTrue -> SetBranchAddress("ninttlayer", &tru_ninttlayer);
204  tInTrue -> SetBranchAddress("ntpclayer", &tru_ntpclayer);
205  tInTrue -> SetBranchAddress("deltapt", &tru_deltapt);
206  tInTrue -> SetBranchAddress("quality", &tru_quality);
207  tInTrue -> SetBranchAddress("dcaxy", &tru_dcaxy);
208  tInTrue -> SetBranchAddress("dcaz", &tru_dcaz);
209  tInTrue -> SetBranchAddress("sigmadcaxy", &tru_sigmadcaxy);
210  tInTrue -> SetBranchAddress("sigmadacz", &tru_sigmadacz);
211  tInTrue -> SetBranchAddress("vx", &tru_vx);
212  tInTrue -> SetBranchAddress("vy", &tru_vy);
213  tInTrue -> SetBranchAddress("vz", &tru_vz);
214  tInTrue -> SetBranchAddress("gtrkid", &tru_gtrkid);
215  tInTrue -> SetBranchAddress("gpt", &tru_gpt);
216  tInTrue -> SetBranchAddress("geta", &tru_geta);
217  tInTrue -> SetBranchAddress("gphi", &tru_gphi);
218  tInTrue -> SetBranchAddress("gnmvtxclust_trkmatcher", &tru_gnmvtxclust_trkmatcher);
219  tInTrue -> SetBranchAddress("gninttclust_trkmatcher", &tru_gninttclust_trkmatcher);
220  tInTrue -> SetBranchAddress("gntpclust_trkmatchergnmvtxclust_manual", &tru_gntpclust_trkmatchergnmvtxclust_manual);
221  tInTrue -> SetBranchAddress("gninttclust_manual", &tru_gninttclust_manual);
222  tInTrue -> SetBranchAddress("gntpcclust_manual", &tru_gntpcclust_manual);
223  tInTrue -> SetBranchAddress("gnmvtxlayer", &tru_gnmvtxlayer);
224  tInTrue -> SetBranchAddress("gninttlayer", &tru_gninttlayer);
225  tInTrue -> SetBranchAddress("gntpclayer", &tru_gntpclayer);
226  tInTrue -> SetBranchAddress("gdeltapt", &tru_gdeltapt);
227  tInTrue -> SetBranchAddress("gquality", &tru_gquality);
228  tInTrue -> SetBranchAddress("gdcaxy", &tru_gdcaxy);
229  tInTrue -> SetBranchAddress("gdcaz", &tru_gdcaz);
230  tInTrue -> SetBranchAddress("gsigmadcaxy", &tru_gsigmadcaxy);
231  tInTrue -> SetBranchAddress("gsigmadacz", &tru_gsigmadacz);
232  tInTrue -> SetBranchAddress("gvx", &tru_gvx);
233  tInTrue -> SetBranchAddress("gvy", &tru_gvy);
234  tInTrue -> SetBranchAddress("gvz", &tru_gvz);
235  tInTrue -> SetBranchAddress("fracnmvtxmatched", &tru_fracnmvtxmatched);
236  tInTrue -> SetBranchAddress("fracninttmatched", &tru_fracninttmatched);
237  tInTrue -> SetBranchAddress("fracntpcmatched", &tru_fracntpcmatched);
238 
239  tInReco -> SetBranchAddress("evtid", &rec_evtid);
240  tInReco -> SetBranchAddress("trkid", &rec_trkid);
241  tInReco -> SetBranchAddress("pt", &rec_pt);
242  tInReco -> SetBranchAddress("eta", &rec_eta);
243  tInReco -> SetBranchAddress("phi", &rec_phi);
244  tInReco -> SetBranchAddress("nmvtxclust_trkmatcher", &rec_nmvtxclust_trkmatcher);
245  tInReco -> SetBranchAddress("ninttclust_trkmatcher", &rec_ninttclust_trkmatcher);
246  tInReco -> SetBranchAddress("ntpclust_trkmatcher", &rec_ntpclust_trkmatcher);
247  tInReco -> SetBranchAddress("nmvtxclust_manual", &rec_nmvtxclust_manual);
248  tInReco -> SetBranchAddress("ninttclust_manual", &rec_ninttclust_manual);
249  tInReco -> SetBranchAddress("ntpcclust_manual", &rec_ntpcclust_manual);
250  tInReco -> SetBranchAddress("nmvtxlayer_", &rec_nmvtxlayer_);
251  tInReco -> SetBranchAddress("ninttlayer", &rec_ninttlayer);
252  tInReco -> SetBranchAddress("ntpclayer", &rec_ntpclayer);
253  tInReco -> SetBranchAddress("deltapt", &rec_deltapt);
254  tInReco -> SetBranchAddress("quality", &rec_quality);
255  tInReco -> SetBranchAddress("dcaxy", &rec_dcaxy);
256  tInReco -> SetBranchAddress("dcaz", &rec_dcaz);
257  tInReco -> SetBranchAddress("sigmadcaxy", &rec_sigmadcaxy);
258  tInReco -> SetBranchAddress("sigmadacz", &rec_sigmadacz);
259  tInReco -> SetBranchAddress("vx", &rec_vx);
260  tInReco -> SetBranchAddress("vy", &rec_vy);
261  tInReco -> SetBranchAddress("vz", &rec_vz);
262  tInReco -> SetBranchAddress("gtrkid", &rec_gtrkid);
263  tInReco -> SetBranchAddress("gpt", &rec_gpt);
264  tInReco -> SetBranchAddress("geta", &rec_geta);
265  tInReco -> SetBranchAddress("gphi", &rec_gphi);
266  tInReco -> SetBranchAddress("gnmvtxclust_trkmatcher", &rec_gnmvtxclust_trkmatcher);
267  tInReco -> SetBranchAddress("gninttclust_trkmatcher", &rec_gninttclust_trkmatcher);
268  tInReco -> SetBranchAddress("gntpclust_trkmatchergnmvtxclust_manual", &rec_gntpclust_trkmatchergnmvtxclust_manual);
269  tInReco -> SetBranchAddress("gninttclust_manual", &rec_gninttclust_manual);
270  tInReco -> SetBranchAddress("gntpcclust_manual", &rec_gntpcclust_manual);
271  tInReco -> SetBranchAddress("gnmvtxlayer", &rec_gnmvtxlayer);
272  tInReco -> SetBranchAddress("gninttlayer", &rec_gninttlayer);
273  tInReco -> SetBranchAddress("gntpclayer", &rec_gntpclayer);
274  tInReco -> SetBranchAddress("gdeltapt", &rec_gdeltapt);
275  tInReco -> SetBranchAddress("gquality", &rec_gquality);
276  tInReco -> SetBranchAddress("gdcaxy", &rec_gdcaxy);
277  tInReco -> SetBranchAddress("gdcaz", &rec_gdcaz);
278  tInReco -> SetBranchAddress("gsigmadcaxy", &rec_gsigmadcaxy);
279  tInReco -> SetBranchAddress("gsigmadacz", &rec_gsigmadacz);
280  tInReco -> SetBranchAddress("gvx", &rec_gvx);
281  tInReco -> SetBranchAddress("gvy", &rec_gvy);
282  tInReco -> SetBranchAddress("gvz", &rec_gvz);
283  tInReco -> SetBranchAddress("fracnmvtxmatched", &rec_fracnmvtxmatched);
284  tInReco -> SetBranchAddress("fracninttmatched", &rec_fracninttmatched);
285  tInReco -> SetBranchAddress("fracntpcmatched", &rec_fracntpcmatched);
286  cout << " Set input branches." << endl;
287 
288  // histogram indices
289  enum Var {
290  NTot,
291  NIntt,
292  NMvtx,
293  NTpc,
294  RTot,
295  RIntt,
296  RMvtx,
297  RTpc,
298  Phi,
299  Eta,
300  Pt,
301  Frac
302  };
303  enum Type {
304  Truth,
305  Track,
306  Weird,
307  Normal
308  };
309  enum Comp {
310  VsTruthPt,
311  VsNumTpc
312  };
313 
314  // output histogram base names
315  const vector<vector<string>> vecHistBase = {
316  {"hTruthNumTot", "hTrackNumTot", "hWeirdNumTot", "hNormNumTot"},
317  {"hTruthNumIntt", "hTrackNumIntt", "hWeirdNumIntt", "hNormNumIntt"},
318  {"hTruthNumMvtx", "hTrackNumMvtx", "hWeirdNumMvtx", "hNormNumMvtx"},
319  {"hTruthNumTpc", "hTrackNumTpc", "hWeirdNumTpc", "hNormNumTpc"},
320  {"hTruthRatTot", "hTrackRatTot", "hWeirdRatTot", "hNormRatTot"},
321  {"hTruthRatIntt", "hTrackRatIntt", "hWeirdRatIntt", "hNormRatIntt"},
322  {"hTruthRatMvtx", "hTrackRatMvtx", "hWeirdRatMvtx", "hNormRatMvtx"},
323  {"hTruthRatTpc", "hTrackRatTpc", "hWeirdRatTpc", "hNormRatTpc"},
324  {"hTruthPhi", "hTrackPhi", "hWeirdPhi", "hNormPhi"},
325  {"hTruthEta", "hTrackEta", "hWeirdEta", "hNormEta"},
326  {"hTruthPt", "hTrackPt", "hWeirdPt", "hNormPt"},
327  {"hTruthFrac", "hTrackFrac", "hWeirdFrac", "hNormFrac"}
328  };
329  const size_t nHistRows = vecHistBase.size();
330  const size_t nHistTypes = vecHistBase[0].size();
331 
332  // 2D histogram name modifiers
333  const vector<string> vecVsHistModifiers = {
334  "VsTruthPt",
335  "VsNumTpc"
336  };
337  const size_t nVsHistMods = vecVsHistModifiers.size();
338 
339  // axis titles
340  const string sCount("counts");
341  const vector<string> vecBaseAxisVars = {
342  "N^{tot} = N_{hit}^{mvtx} + N_{hit}^{intt} + N_{clust}^{tpc}",
343  "N_{hit}^{intt}",
344  "N_{hit}^{mvtx}",
345  "N_{clust}^{tpc}",
346  "N_{reco}^{tot} / N_{true}^{tot}",
347  "N_{reco}^{intt} / N_{true}^{intt}",
348  "N_{reco}^{mvtx} / N_{true}^{mvtx}",
349  "N_{reco}^{tpc} / N_{true}^{tpc}",
350  "#varphi",
351  "#eta",
352  "p_{T} [GeV/c]",
353  "p_{T}^{reco} / p_{T}^{true}"
354  };
355  const vector<string> vecVsAxisVars = {
356  "p_{T}^{true} [GeV/c]",
357  "N_{clust}^{tpc}"
358  };
359 
360  // output histogram no. of bins
361  const uint32_t nNumBins = 101;
362  const uint32_t nRatBins = 120;
363  const uint32_t nEtaBins = 80;
364  const uint32_t nPhiBins = 360;
365  const uint32_t nPtBins = 101;
366  const uint32_t nFracBins = 110;
367 
368  // output histogram bin ranges
369  const pair<float, float> xNumBins = {-0.5, 100.5};
370  const pair<float, float> xRatBins = {-0.5, 5.5};
371  const pair<float, float> xEtaBins = {-2., 2.};
372  const pair<float, float> xPhiBins = {-3.15, 3.15};
373  const pair<float, float> xPtBins = {-1., 100.};
374  const pair<float, float> xFracBins = {-0.5, 10.5};
375 
376  // output histogram base binning definitions
377  vector<tuple<uint32_t, pair<float, float>>> vecBaseHistBins = {
378  make_tuple(nNumBins, xNumBins),
379  make_tuple(nNumBins, xNumBins),
380  make_tuple(nNumBins, xNumBins),
381  make_tuple(nNumBins, xNumBins),
382  make_tuple(nRatBins, xRatBins),
383  make_tuple(nRatBins, xRatBins),
384  make_tuple(nRatBins, xRatBins),
385  make_tuple(nRatBins, xRatBins),
386  make_tuple(nPhiBins, xPhiBins),
387  make_tuple(nEtaBins, xEtaBins),
388  make_tuple(nPtBins, xPtBins),
389  make_tuple(nFracBins, xFracBins)
390  };
391 
392  // output 2D histogram x-axis binning
393  vector<tuple<uint32_t, pair<float, float>>> vecVsHistBins = {
394  make_tuple(nPtBins, xPtBins),
395  make_tuple(nNumBins, xNumBins)
396  };
397 
398  // make 1D histograms
399  vector<vector<TH1D*>> vecHist1D(nHistRows);
400  for (size_t iHistRow = 0; iHistRow < nHistRows; iHistRow++) {
401  for (const string sHistBase : vecHistBase[iHistRow]) {
402  vecHist1D[iHistRow].push_back(
403  new TH1D(
404  sHistBase.data(),
405  "",
406  get<0>(vecBaseHistBins[iHistRow]),
407  get<1>(vecBaseHistBins[iHistRow]).first,
408  get<1>(vecBaseHistBins[iHistRow]).second
409  )
410  );
411  } // end type loop
412  } // end row loop
413 
414  // make 2D histograms
415  vector<vector<vector<TH2D*>>> vecHist2D(nHistRows, vector<vector<TH2D*>>(nHistTypes));
416  for (size_t iHistRow = 0; iHistRow < nHistRows; iHistRow++) {
417  for (size_t iHistType = 0; iHistType < nHistTypes; iHistType++) {
418  for (size_t iVsHistMod = 0; iVsHistMod < nVsHistMods; iVsHistMod++) {
419  const string sHistName2D = vecHistBase[iHistRow][iHistType] + vecVsHistModifiers[iVsHistMod];
420  vecHist2D[iHistRow][iHistType].push_back(
421  new TH2D(
422  sHistName2D.data(),
423  "",
424  get<0>(vecVsHistBins[iVsHistMod]),
425  get<1>(vecVsHistBins[iVsHistMod]).first,
426  get<1>(vecVsHistBins[iVsHistMod]).second,
427  get<0>(vecBaseHistBins[iHistRow]),
428  get<1>(vecBaseHistBins[iHistRow]).first,
429  get<1>(vecBaseHistBins[iHistRow]).second
430  )
431  );
432  } // end modifier loop
433  } // end type loop
434  } // end row loop
435 
436  // set errors
437  for (auto histRow1D : vecHist1D) {
438  for (auto hist1D : histRow1D) {
439  hist1D -> Sumw2();
440  }
441  }
442 
443  for (auto histRow2D : vecHist2D) {
444  for (auto histType2D : histRow2D) {
445  for (auto hist2D: histType2D) {
446  hist2D -> Sumw2();
447  }
448  }
449  }
450 
451  // grab no. of entries
452  const int64_t nTrueEntries = tInTrue -> GetEntries();
453  const int64_t nRecoEntries = tInReco -> GetEntries();
454  cout << " Beginning truth particle loop: " << nTrueEntries << " to process" << endl;
455 
456  // loop over truth particles
457  int64_t nTrueBytes = 0;
458  for (int64_t iTrueEntry = 0; iTrueEntry < nTrueEntries; iTrueEntry++) {
459 
460  // grab truth particle entry
461  const int64_t trueBytes = tInTrue -> GetEntry(iTrueEntry);
462  if (trueBytes < 0) {
463  cerr << "PANIC: issue with entry " << iTrueEntry << "! Aborting loop!\n" << endl;
464  break;
465  } else {
466  nTrueBytes += trueBytes;
467  }
468 
469  const int64_t iTrueProg = iTrueEntry + 1;
470  if (iTrueProg == nTrueEntries) {
471  cout << " Processing entry " << iTrueProg << "/" << nTrueEntries << "..." << endl;
472  } else {
473  cout << " Processing entry " << iTrueProg << "/" << nTrueEntries << "...\r" << flush;
474  }
475 
476  // run calculations
477  const float tru_gnclust = tru_gnmvtxclust_trkmatcher + tru_gninttclust_trkmatcher + tru_gntpcclust_manual;
478 
479  // check if near sector
480  bool isNearSector = false;
481  if (doPhiCut) {
482  for (size_t iSector = 0; iSector < NSectors; iSector++) {
483  const float cutVal = sigCutVal * phiSectors[iSector].second;
484  const float minPhi = phiSectors[iSector].first - cutVal;
485  const float maxPhi = phiSectors[iSector].first + cutVal;
486  const bool isNear = ((tru_gphi >= minPhi) && (tru_gphi <= maxPhi));
487  if (isNear) {
488  isNearSector = true;
489  break;
490  }
491  } // end sector loop
492  } // end if (doPhiCut)
493 
494  // apply cuts
495  const bool isInZVtxCut = ((tru_gvz >= zVtxRange.first) && (tru_gvz <= zVtxRange.second));
496  if (doZVtxCut && !isInZVtxCut) continue;
497  if (doPhiCut && isNearSector) continue;
498 
499 
500  // fill truth 1D histograms
501  vecHist1D[Var::NTot][Type::Truth] -> Fill(tru_gnclust);
502  vecHist1D[Var::NIntt][Type::Truth] -> Fill(tru_gninttclust_trkmatcher);
503  vecHist1D[Var::NMvtx][Type::Truth] -> Fill(tru_gnmvtxclust_trkmatcher);
504  vecHist1D[Var::NTpc][Type::Truth] -> Fill(tru_gntpcclust_manual);
505  vecHist1D[Var::RTot][Type::Truth] -> Fill(1.);
506  vecHist1D[Var::RIntt][Type::Truth] -> Fill(1.);
507  vecHist1D[Var::RMvtx][Type::Truth] -> Fill(1.);
508  vecHist1D[Var::RTpc][Type::Truth] -> Fill(1.);
509  vecHist1D[Var::Phi][Type::Truth] -> Fill(tru_gphi);
510  vecHist1D[Var::Eta][Type::Truth] -> Fill(tru_geta);
511  vecHist1D[Var::Pt][Type::Truth] -> Fill(tru_gpt);
512  vecHist1D[Var::Frac][Type::Truth] -> Fill(1.);
513 
514  // fill truth 2D histograms
515  vecHist2D[Var::NTot][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, tru_gnclust);
516  vecHist2D[Var::NIntt][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, tru_gninttclust_trkmatcher);
517  vecHist2D[Var::NMvtx][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, tru_gnmvtxclust_trkmatcher);
518  vecHist2D[Var::NTpc][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, tru_gntpcclust_manual);
519  vecHist2D[Var::RTot][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, 1.);
520  vecHist2D[Var::RIntt][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, 1.);
521  vecHist2D[Var::RMvtx][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, 1.);
522  vecHist2D[Var::RTpc][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, 1.);
523  vecHist2D[Var::Phi][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, tru_gphi);
524  vecHist2D[Var::Eta][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, tru_geta);
525  vecHist2D[Var::Pt][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, tru_gpt);
526  vecHist2D[Var::Frac][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, 1.);
527 
528  vecHist2D[Var::NTot][Type::Truth][Comp::VsNumTpc] -> Fill(tru_ntpclust_trkmatcher, tru_gnclust);
529  vecHist2D[Var::NIntt][Type::Truth][Comp::VsNumTpc] -> Fill(tru_ntpclust_trkmatcher, tru_gninttclust_trkmatcher);
530  vecHist2D[Var::NMvtx][Type::Truth][Comp::VsNumTpc] -> Fill(tru_ntpclust_trkmatcher, tru_gnmvtxclust_trkmatcher);
531  vecHist2D[Var::NTpc][Type::Truth][Comp::VsNumTpc] -> Fill(tru_ntpclust_trkmatcher, tru_gntpcclust_manual);
532  vecHist2D[Var::RTot][Type::Truth][Comp::VsNumTpc] -> Fill(tru_ntpclust_trkmatcher, 1.);
533  vecHist2D[Var::RIntt][Type::Truth][Comp::VsNumTpc] -> Fill(tru_ntpclust_trkmatcher, 1.);
534  vecHist2D[Var::RMvtx][Type::Truth][Comp::VsNumTpc] -> Fill(tru_ntpclust_trkmatcher, 1.);
535  vecHist2D[Var::RTpc][Type::Truth][Comp::VsNumTpc] -> Fill(tru_ntpclust_trkmatcher, 1.);
536  vecHist2D[Var::Phi][Type::Truth][Comp::VsNumTpc] -> Fill(tru_ntpclust_trkmatcher, tru_gphi);
537  vecHist2D[Var::Eta][Type::Truth][Comp::VsNumTpc] -> Fill(tru_ntpclust_trkmatcher, tru_geta);
538  vecHist2D[Var::Pt][Type::Truth][Comp::VsNumTpc] -> Fill(tru_ntpclust_trkmatcher, tru_gpt);
539  vecHist2D[Var::Frac][Type::Truth][Comp::VsNumTpc] -> Fill(tru_ntpclust_trkmatcher, 1.);
540  } // end truth particle loop
541 
542  // announce next entry loop
543  cout << " Finished truth particle loop.\n"
544  << " Beginning reconstructed track loop: " << nRecoEntries << " to process"
545  << endl;
546 
547  // loop over reco tracks
548  int64_t nRecoBytes = 0;
549  for (int64_t iRecoEntry = 0; iRecoEntry < nRecoEntries; iRecoEntry++) {
550 
551  // grab reco track entry
552  const int64_t recoBytes = tInReco -> GetEntry(iRecoEntry);
553  if (recoBytes < 0) {
554  cerr << "PANIC: issue with entry " << iRecoEntry << "! Aborting loop!\n" << endl;
555  break;
556  } else {
557  nRecoBytes += recoBytes;
558  }
559 
560  const int64_t iRecoProg = iRecoEntry + 1;
561  if (iRecoProg == nRecoEntries) {
562  cout << " Processing entry " << iRecoProg << "/" << nRecoEntries << "..." << endl;
563  } else {
564  cout << " Processing entry " << iRecoProg << "/" << nRecoEntries << "...\r" << flush;
565  }
566 
567  // run calculations
568  const double rec_nclus = rec_ninttclust_trkmatcher + rec_nmvtxclust_trkmatcher + rec_ntpclust_trkmatcher;
569  const double rec_gnclus = rec_gninttclust_trkmatcher + rec_gnmvtxclust_trkmatcher + rec_gntpcclust_manual;
570  const double rec_rnclus = rec_nclus / rec_gnclus;
571  const double rec_rintt = rec_ninttclust_trkmatcher / rec_gninttclust_trkmatcher;
572  const double rec_rmaps = rec_nmvtxclust_trkmatcher / rec_gnmvtxclust_trkmatcher;
573  const double rec_rtpc = rec_ntpclust_trkmatcher / rec_gntpcclust_manual;
574  const double rec_ptfrac = rec_pt / rec_gpt;
575 
576  // check if near sector
577  bool isNearSector = false;
578  if (doPhiCut) {
579  for (size_t iSector = 0; iSector < NSectors; iSector++) {
580  const float cutVal = sigCutVal * phiSectors[iSector].second;
581  const float minPhi = phiSectors[iSector].first - cutVal;
582  const float maxPhi = phiSectors[iSector].first + cutVal;
583  const bool isNear = ((rec_phi >= minPhi) && (rec_phi <= maxPhi));
584  if (isNear) {
585  isNearSector = true;
586  break;
587  }
588  } // end sector loop
589  } // end if (doPhiCut)
590 
591  // apply cuts
592  const bool isInZVtxCut = ((rec_vz >= zVtxRange.first) && (rec_vz <= zVtxRange.second));
593  if (doZVtxCut && !isInZVtxCut) continue;
594  if (doPhiCut && isNearSector) continue;
595 
596  // fill all matched reco 1D histograms
597  vecHist1D[Var::NTot][Type::Track] -> Fill(rec_nclus);
598  vecHist1D[Var::NIntt][Type::Track] -> Fill(rec_ninttclust_trkmatcher);
599  vecHist1D[Var::NMvtx][Type::Track] -> Fill(rec_nmvtxclust_trkmatcher);
600  vecHist1D[Var::NTpc][Type::Track] -> Fill(rec_ntpclust_trkmatcher);
601  vecHist1D[Var::RTot][Type::Track] -> Fill(rec_rnclus);
602  vecHist1D[Var::RIntt][Type::Track] -> Fill(rec_rintt);
603  vecHist1D[Var::RMvtx][Type::Track] -> Fill(rec_rmaps);
604  vecHist1D[Var::RTpc][Type::Track] -> Fill(rec_rtpc);
605  vecHist1D[Var::Phi][Type::Track] -> Fill(rec_phi);
606  vecHist1D[Var::Eta][Type::Track] -> Fill(rec_eta);
607  vecHist1D[Var::Pt][Type::Track] -> Fill(rec_pt);
608  vecHist1D[Var::Frac][Type::Track] -> Fill(rec_ptfrac);
609 
610  // fill all matched reco 2D histograms
611  vecHist2D[Var::NTot][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_nclus);
612  vecHist2D[Var::NIntt][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_ninttclust_trkmatcher);
613  vecHist2D[Var::NMvtx][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_nmvtxclust_trkmatcher);
614  vecHist2D[Var::NTpc][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_ntpclust_trkmatcher);
615  vecHist2D[Var::RTot][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rnclus);
616  vecHist2D[Var::RIntt][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rintt);
617  vecHist2D[Var::RMvtx][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rmaps);
618  vecHist2D[Var::RTpc][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rtpc);
619  vecHist2D[Var::Phi][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_phi);
620  vecHist2D[Var::Eta][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_eta);
621  vecHist2D[Var::Pt][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_pt);
622  vecHist2D[Var::Frac][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_ptfrac);
623 
624  vecHist2D[Var::NTot][Type::Track][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_nclus);
625  vecHist2D[Var::NIntt][Type::Track][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_ninttclust_trkmatcher);
626  vecHist2D[Var::NMvtx][Type::Track][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_nmvtxclust_trkmatcher);
627  vecHist2D[Var::NTpc][Type::Track][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_ntpclust_trkmatcher);
628  vecHist2D[Var::RTot][Type::Track][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_rnclus);
629  vecHist2D[Var::RIntt][Type::Track][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_rintt);
630  vecHist2D[Var::RMvtx][Type::Track][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_rmaps);
631  vecHist2D[Var::RTpc][Type::Track][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_rtpc);
632  vecHist2D[Var::Phi][Type::Track][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_phi);
633  vecHist2D[Var::Eta][Type::Track][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_eta);
634  vecHist2D[Var::Pt][Type::Track][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_pt);
635  vecHist2D[Var::Frac][Type::Track][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_ptfrac);
636 
637  // fill weird and normal matched reco 1D histograms
638  const bool isNormalTrack = ((rec_ptfrac >= oddPtFrac.first) && (rec_ptfrac <= oddPtFrac.second));
639  if (isNormalTrack) {
640  vecHist1D[Var::NTot][Type::Normal] -> Fill(rec_nclus);
641  vecHist1D[Var::NIntt][Type::Normal] -> Fill(rec_ninttclust_trkmatcher);
642  vecHist1D[Var::NMvtx][Type::Normal] -> Fill(rec_nmvtxclust_trkmatcher);
643  vecHist1D[Var::NTpc][Type::Normal] -> Fill(rec_ntpclust_trkmatcher);
644  vecHist1D[Var::RTot][Type::Normal] -> Fill(rec_rnclus);
645  vecHist1D[Var::RIntt][Type::Normal] -> Fill(rec_rintt);
646  vecHist1D[Var::RMvtx][Type::Normal] -> Fill(rec_rmaps);
647  vecHist1D[Var::RTpc][Type::Normal] -> Fill(rec_rtpc);
648  vecHist1D[Var::Phi][Type::Normal] -> Fill(rec_phi);
649  vecHist1D[Var::Eta][Type::Normal] -> Fill(rec_eta);
650  vecHist1D[Var::Pt][Type::Normal] -> Fill(rec_pt);
651  vecHist1D[Var::Frac][Type::Normal] -> Fill(rec_ptfrac);
652 
653  vecHist2D[Var::NTot][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_nclus);
654  vecHist2D[Var::NIntt][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_ninttclust_trkmatcher);
655  vecHist2D[Var::NMvtx][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_nmvtxclust_trkmatcher);
656  vecHist2D[Var::NTpc][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_ntpclust_trkmatcher);
657  vecHist2D[Var::RTot][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rnclus);
658  vecHist2D[Var::RIntt][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rintt);
659  vecHist2D[Var::RMvtx][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rmaps);
660  vecHist2D[Var::RTpc][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rtpc);
661  vecHist2D[Var::Phi][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_phi);
662  vecHist2D[Var::Eta][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_eta);
663  vecHist2D[Var::Pt][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_pt);
664  vecHist2D[Var::Frac][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_ptfrac);
665 
666  vecHist2D[Var::NTot][Type::Normal][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_nclus);
667  vecHist2D[Var::NIntt][Type::Normal][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_ninttclust_trkmatcher);
668  vecHist2D[Var::NMvtx][Type::Normal][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_nmvtxclust_trkmatcher);
669  vecHist2D[Var::NTpc][Type::Normal][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_ntpclust_trkmatcher);
670  vecHist2D[Var::RTot][Type::Normal][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_rnclus);
671  vecHist2D[Var::RIntt][Type::Normal][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_rintt);
672  vecHist2D[Var::RMvtx][Type::Normal][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_rmaps);
673  vecHist2D[Var::RTpc][Type::Normal][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_rtpc);
674  vecHist2D[Var::Phi][Type::Normal][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_phi);
675  vecHist2D[Var::Eta][Type::Normal][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_eta);
676  vecHist2D[Var::Pt][Type::Normal][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_pt);
677  vecHist2D[Var::Frac][Type::Normal][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_ptfrac);
678  } else {
679  vecHist1D[Var::NTot][Type::Weird] -> Fill(rec_nclus);
680  vecHist1D[Var::NIntt][Type::Weird] -> Fill(rec_ninttclust_trkmatcher);
681  vecHist1D[Var::NMvtx][Type::Weird] -> Fill(rec_nmvtxclust_trkmatcher);
682  vecHist1D[Var::NTpc][Type::Weird] -> Fill(rec_ntpclust_trkmatcher);
683  vecHist1D[Var::RTot][Type::Weird] -> Fill(rec_rnclus);
684  vecHist1D[Var::RIntt][Type::Weird] -> Fill(rec_rintt);
685  vecHist1D[Var::RMvtx][Type::Weird] -> Fill(rec_rmaps);
686  vecHist1D[Var::RTpc][Type::Weird] -> Fill(rec_rtpc);
687  vecHist1D[Var::Phi][Type::Weird] -> Fill(rec_phi);
688  vecHist1D[Var::Eta][Type::Weird] -> Fill(rec_eta);
689  vecHist1D[Var::Pt][Type::Weird] -> Fill(rec_pt);
690  vecHist1D[Var::Frac][Type::Weird] -> Fill(rec_ptfrac);
691 
692  vecHist2D[Var::NTot][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_nclus);
693  vecHist2D[Var::NIntt][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_ninttclust_trkmatcher);
694  vecHist2D[Var::NMvtx][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_nmvtxclust_trkmatcher);
695  vecHist2D[Var::NTpc][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_ntpclust_trkmatcher);
696  vecHist2D[Var::RTot][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rnclus);
697  vecHist2D[Var::RIntt][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rintt);
698  vecHist2D[Var::RMvtx][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rmaps);
699  vecHist2D[Var::RTpc][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rtpc);
700  vecHist2D[Var::Phi][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_phi);
701  vecHist2D[Var::Eta][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_eta);
702  vecHist2D[Var::Pt][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_pt);
703  vecHist2D[Var::Frac][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_ptfrac);
704 
705  vecHist2D[Var::NTot][Type::Weird][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_nclus);
706  vecHist2D[Var::NIntt][Type::Weird][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_ninttclust_trkmatcher);
707  vecHist2D[Var::NMvtx][Type::Weird][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_nmvtxclust_trkmatcher);
708  vecHist2D[Var::NTpc][Type::Weird][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_ntpclust_trkmatcher);
709  vecHist2D[Var::RTot][Type::Weird][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_rnclus);
710  vecHist2D[Var::RIntt][Type::Weird][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_rintt);
711  vecHist2D[Var::RMvtx][Type::Weird][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_rmaps);
712  vecHist2D[Var::RTpc][Type::Weird][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_rtpc);
713  vecHist2D[Var::Phi][Type::Weird][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_phi);
714  vecHist2D[Var::Eta][Type::Weird][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_eta);
715  vecHist2D[Var::Pt][Type::Weird][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_pt);
716  vecHist2D[Var::Frac][Type::Weird][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_ptfrac);
717  }
718  } // end reco track loop
719  cout << " Finished reconstructed track loop." << endl;
720 
721  // set axis titles
722  size_t iVar = 0;
723  for (auto histRow1D : vecHist1D) {
724  for (auto hist1D : histRow1D) {
725  hist1D -> GetXaxis() -> SetTitle(vecBaseAxisVars.at(iVar).data());
726  hist1D -> GetYaxis() -> SetTitle(sCount.data());
727  }
728  ++iVar;
729  }
730  iVar = 0;
731 
732  size_t iComp = 0;
733  for (auto histRow2D : vecHist2D) {
734  for (auto histType2D : histRow2D) {
735  iComp = 0;
736  for (auto hist2D : histType2D) {
737  hist2D -> GetXaxis() -> SetTitle(vecVsAxisVars.at(iComp).data());
738  hist2D -> GetYaxis() -> SetTitle(vecBaseAxisVars.at(iVar).data());
739  hist2D -> GetZaxis() -> SetTitle(sCount.data());
740  ++iComp;
741  }
742  }
743  ++iVar;
744  }
745  cout << " Set axis titles." << endl;
746 
747  // save histograms
748  fOutput -> cd();
749  for (auto histRow1D : vecHist1D) {
750  for (auto hist1D : histRow1D) {
751  hist1D -> Write();
752  }
753  }
754  for (auto histRow2D : vecHist2D) {
755  for (auto histType2D : histRow2D) {
756  for (auto hist2D: histType2D) {
757  hist2D -> Write();
758  }
759  }
760  }
761  cout << " Saved histograms." << endl;
762 
763  // close files
764  fOutput -> cd();
765  fOutput -> Close();
766  fInTrue -> cd();
767  fInTrue -> Close();
768  fInReco -> cd();
769  fInReco -> Close();
770 
771  // exit
772  cout << " Finished new matcher plot script!\n" << endl;
773  return;
774 
775 } // end 'MakeNewMatcherTuplePlots()'
776 
777 // end ------------------------------------------------------------------------
778