Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CompareOldVsNewPlots.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CompareOldVsNewPlots.cxx
1 // ----------------------------------------------------------------------------
2 // 'CompareOldVsNewPlots.cxx'
3 // Derek Anderson
4 // 08.29.2023
5 //
6 // Construct a series of plots comparing the
7 // output of the old evalautor vs. the new
8 // truth-track matcher (ie. the output of
9 // MakeOldEvaluatorPlots.cxx vs.
10 // MakeNewMatcherPlots.cxx)
11 // ----------------------------------------------------------------------------
12 
13 #include <cmath>
14 #include <array>
15 #include <string>
16 #include <vector>
17 #include <utility>
18 #include <iostream>
19 #include "TH1.h"
20 #include "TH2.h"
21 #include "TPad.h"
22 #include "TFile.h"
23 #include "TLine.h"
24 #include "TError.h"
25 #include "TString.h"
26 #include "TLegend.h"
27 #include "TCanvas.h"
28 #include "TPaveText.h"
29 #include "TDirectory.h"
30 
31 using namespace std;
32 
33 // global constants
34 static const size_t NDir = 4;
35 static const size_t NVtx = 4;
36 static const size_t NSide = 4;
37 static const size_t NAxes = 3;
38 
39 
40 
42 
43  // lower verbosity
44  gErrorIgnoreLevel = kError;
45  cout << "\n Beginning old vs. new comparison script..." << endl;
46 
47  // options ------------------------------------------------------------------
48 
49  // io parameters
50  const string sOutput("oldVsNewComparisonWithNoNorm_oneMatchPerParticle_zVtxCutComp_odd05150.pt10n1evt500pim.d1m2y2024.root");
51  const string sInOld("oldEvalPlots_oneMatchPerParticle_embedScanOn_forZVtxCutComp_oddFrac05150.pt10n1evt500pim.d1m2y2024.root");
52  const string sInNew("newMatcherTuplePlots_oneMatchPerParticle_forZVtxCutComp_oddFrac05150.pt10n1evt500pim.d1m2y2024.root");
53 
54  // style parameters
55  const pair<uint32_t, uint32_t> fCol = {923, 899};
56  const pair<uint32_t, uint32_t> fMar = {20, 25};
57  const pair<uint32_t, uint32_t> fLin = {1, 1};
58  const pair<uint32_t, uint32_t> fWid = {1, 1};
59  const pair<uint32_t, uint32_t> fFil = {0, 0};
60 
61  // histogram parameters
62  const string sRatioLabel = "Ratio";
63  const pair<string, string> sHistLabels = {"Old", "New"};
64  const array<string, NDir> arrDirNames = {"OldHists", "NewHists", "Ratios", "Plots"};
65 
66  // accessor for directories
67  enum Dir {Old, New, Ratio, Plot};
68 
69  // text parameters
70  const string sLegOld = "evaluator";
71  const string sLegNew = "truth matcher";
72  const string sHeader = "";
73  const string sCount = "counts";
74  const string sNorm = "normalized counts";
75  const string sRatio = "ratio";
76  const vector<string> vecTxt = {
77  "#bf{#it{sPHENIX}} Simulation",
78  "1 #pi^{-}/event, p_{T} = 10 GeV/c",
79  "#bf{Only #pi^{-}}"
80  };
81 
82  // plot parameters
83  const bool doIntNorm = false;
84  const bool matchVertScales = true;
85 
86  // histograms to compare
87  const vector<string> vecInHists1D = {
88  "hTruthNumTot",
89  "hTrackNumTot",
90  "hWeirdNumTot",
91  "hNormNumTot",
92  "hTruthNumIntt",
93  "hTrackNumIntt",
94  "hWeirdNumIntt",
95  "hNormNumIntt",
96  "hTruthNumMvtx",
97  "hTrackNumMvtx",
98  "hWeirdNumMvtx",
99  "hNormNumMvtx",
100  "hTruthNumTpc",
101  "hTrackNumTpc",
102  "hWeirdNumTpc",
103  "hNormNumTpc",
104  "hTruthRatTot",
105  "hTrackRatTot",
106  "hWeirdRatTot",
107  "hNormRatTot",
108  "hTruthRatIntt",
109  "hTrackRatIntt",
110  "hWeirdRatIntt",
111  "hNormRatIntt",
112  "hTruthRatMvtx",
113  "hTrackRatMvtx",
114  "hWeirdRatMvtx",
115  "hNormRatMvtx",
116  "hTruthRatTpc",
117  "hTrackRatTpc",
118  "hWeirdRatTpc",
119  "hNormRatTpc",
120  "hTruthPhi",
121  "hTrackPhi",
122  "hWeirdPhi",
123  "hNormPhi",
124  "hTruthEta",
125  "hTrackEta",
126  "hWeirdEta",
127  "hNormEta",
128  "hTruthPt",
129  "hTrackPt",
130  "hWeirdPt",
131  "hNormPt",
132  "hTruthFrac",
133  "hTrackFrac",
134  "hWeirdFrac",
135  "hNormFrac"
136  };
137  const vector<string> vecInHists2D = {
138  "hTruthNumTotVsTruthPt",
139  "hTruthNumTotVsNumTpc",
140  "hTrackNumTotVsTruthPt",
141  "hTrackNumTotVsNumTpc",
142  "hWeirdNumTotVsTruthPt",
143  "hWeirdNumTotVsNumTpc",
144  "hNormNumTotVsTruthPt",
145  "hNormNumTotVsNumTpc",
146  "hTruthNumInttVsTruthPt",
147  "hTruthNumInttVsNumTpc",
148  "hTrackNumInttVsTruthPt",
149  "hTrackNumInttVsNumTpc",
150  "hWeirdNumInttVsTruthPt",
151  "hWeirdNumInttVsNumTpc",
152  "hNormNumInttVsTruthPt",
153  "hNormNumInttVsNumTpc",
154  "hTruthNumMvtxVsTruthPt",
155  "hTruthNumMvtxVsNumTpc",
156  "hTrackNumMvtxVsTruthPt",
157  "hTrackNumMvtxVsNumTpc",
158  "hWeirdNumMvtxVsTruthPt",
159  "hWeirdNumMvtxVsNumTpc",
160  "hNormNumMvtxVsTruthPt",
161  "hNormNumMvtxVsNumTpc",
162  "hTruthNumTpcVsTruthPt",
163  "hTruthNumTpcVsNumTpc",
164  "hTrackNumTpcVsTruthPt",
165  "hTrackNumTpcVsNumTpc",
166  "hWeirdNumTpcVsTruthPt",
167  "hWeirdNumTpcVsNumTpc",
168  "hNormNumTpcVsTruthPt",
169  "hNormNumTpcVsNumTpc",
170  "hTruthRatTotVsTruthPt",
171  "hTruthRatTotVsNumTpc",
172  "hTrackRatTotVsTruthPt",
173  "hTrackRatTotVsNumTpc",
174  "hWeirdRatTotVsTruthPt",
175  "hWeirdRatTotVsNumTpc",
176  "hNormRatTotVsTruthPt",
177  "hNormRatTotVsNumTpc",
178  "hTruthRatInttVsTruthPt",
179  "hTruthRatInttVsNumTpc",
180  "hTrackRatInttVsTruthPt",
181  "hTrackRatInttVsNumTpc",
182  "hWeirdRatInttVsTruthPt",
183  "hWeirdRatInttVsNumTpc",
184  "hNormRatInttVsTruthPt",
185  "hNormRatInttVsNumTpc",
186  "hTruthRatMvtxVsTruthPt",
187  "hTruthRatMvtxVsNumTpc",
188  "hTrackRatMvtxVsTruthPt",
189  "hTrackRatMvtxVsNumTpc",
190  "hWeirdRatMvtxVsTruthPt",
191  "hWeirdRatMvtxVsNumTpc",
192  "hNormRatMvtxVsTruthPt",
193  "hNormRatMvtxVsNumTpc",
194  "hTruthRatTpcVsTruthPt",
195  "hTruthRatTpcVsNumTpc",
196  "hTrackRatTpcVsTruthPt",
197  "hTrackRatTpcVsNumTpc",
198  "hWeirdRatTpcVsTruthPt",
199  "hWeirdRatTpcVsNumTpc",
200  "hNormRatTpcVsTruthPt",
201  "hNormRatTpcVsNumTpc",
202  "hTruthPhiVsTruthPt",
203  "hTruthPhiVsNumTpc",
204  "hTrackPhiVsTruthPt",
205  "hTrackPhiVsNumTpc",
206  "hWeirdPhiVsTruthPt",
207  "hWeirdPhiVsNumTpc",
208  "hNormPhiVsTruthPt",
209  "hNormPhiVsNumTpc",
210  "hTruthEtaVsTruthPt",
211  "hTruthEtaVsNumTpc",
212  "hTrackEtaVsTruthPt",
213  "hTrackEtaVsNumTpc",
214  "hWeirdEtaVsTruthPt",
215  "hWeirdEtaVsNumTpc",
216  "hNormEtaVsTruthPt",
217  "hNormEtaVsNumTpc",
218  "hTruthPtVsTruthPt",
219  "hTruthPtVsNumTpc",
220  "hTrackPtVsTruthPt",
221  "hTrackPtVsNumTpc",
222  "hWeirdPtVsTruthPt",
223  "hWeirdPtVsNumTpc",
224  "hNormPtVsTruthPt",
225  "hNormPtVsNumTpc",
226  "hTruthFracVsTruthPt",
227  "hTruthFracVsNumTpc",
228  "hTrackFracVsTruthPt",
229  "hTrackFracVsNumTpc",
230  "hWeirdFracVsTruthPt",
231  "hWeirdFracVsNumTpc",
232  "hNormFracVsTruthPt",
233  "hNormFracVsNumTpc"
234  };
235 
236  // canvas names
237  vector<string> vecCanvasNames1D = {
238  "cTruthNumTot",
239  "cTrackNumTot",
240  "cWeirdNumTot",
241  "cNormNumTot",
242  "cTruthNumIntt",
243  "cTrackNumIntt",
244  "cWeirdNumIntt",
245  "cNormNumIntt",
246  "cTruthNumMvtx",
247  "cTrackNumMvtx",
248  "cWeirdNumMvtx",
249  "cNormNumMvtx",
250  "cTruthNumTpc",
251  "cTrackNumTpc",
252  "cWeirdNumTpc",
253  "cNormNumTpc",
254  "cTruthRatTot",
255  "cTrackRatTot",
256  "cWeirdRatTot",
257  "cNormRatTot",
258  "cTruthRatIntt",
259  "cTrackRatIntt",
260  "cWeirdRatIntt",
261  "cNormRatIntt",
262  "cTruthRatMvtx",
263  "cTrackRatMvtx",
264  "cWeirdRatMvtx",
265  "cNormRatMvtx",
266  "cTruthRatTpc",
267  "cTrackRatTpc",
268  "cWeirdRatTpc",
269  "cNormRatTpc",
270  "cTruthPhi",
271  "cTrackPhi",
272  "cWeirdPhi",
273  "cNormPhi",
274  "cTruthEta",
275  "cTrackEta",
276  "cWeirdEta",
277  "cNormEta",
278  "cTruthPt",
279  "cTrackPt",
280  "cWeirdPt",
281  "cNormPt",
282  "cTruthFrac",
283  "cTrackFrac",
284  "cWeirdFrac",
285  "cNormFrac"
286  };
287  vector<string> vecCanvasNames2D = {
288  "cTruthNumTotVsTruthPt",
289  "cTruthNumTotVsNumTpc",
290  "cTrackNumTotVsTruthPt",
291  "cTrackNumTotVsNumTpc",
292  "cWeirdNumTotVsTruthPt",
293  "cWeirdNumTotVsNumTpc",
294  "cNormNumTotVsTruthPt",
295  "cNormNumTotVsNumTpc",
296  "cTruthNumInttVsTruthPt",
297  "cTruthNumInttVsNumTpc",
298  "cTrackNumInttVsTruthPt",
299  "cTrackNumInttVsNumTpc",
300  "cWeirdNumInttVsTruthPt",
301  "cWeirdNumInttVsNumTpc",
302  "cNormNumInttVsTruthPt",
303  "cNormNumInttVsNumTpc",
304  "cTruthNumMvtxVsTruthPt",
305  "cTruthNumMvtxVsNumTpc",
306  "cTrackNumMvtxVsTruthPt",
307  "cTrackNumMvtxVsNumTpc",
308  "cWeirdNumMvtxVsTruthPt",
309  "cWeirdNumMvtxVsNumTpc",
310  "cNormNumMvtxVsTruthPt",
311  "cNormNumMvtxVsNumTpc",
312  "cTruthNumTpcVsTruthPt",
313  "cTruthNumTpcVsNumTpc",
314  "cTrackNumTpcVsTruthPt",
315  "cTrackNumTpcVsNumTpc",
316  "cWeirdNumTpcVsTruthPt",
317  "cWeirdNumTpcVsNumTpc",
318  "cNormNumTpcVsTruthPt",
319  "cNormNumTpcVsNumTpc",
320  "cTruthRatTotVsTruthPt",
321  "cTruthRatTotVsNumTpc",
322  "cTrackRatTotVsTruthPt",
323  "cTrackRatTotVsNumTpc",
324  "cWeirdRatTotVsTruthPt",
325  "cWeirdRatTotVsNumTpc",
326  "cNormRatTotVsTruthPt",
327  "cNormRatTotVsNumTpc",
328  "cTruthRatInttVsTruthPt",
329  "cTruthRatInttVsNumTpc",
330  "cTrackRatInttVsTruthPt",
331  "cTrackRatInttVsNumTpc",
332  "cWeirdRatInttVsTruthPt",
333  "cWeirdRatInttVsNumTpc",
334  "cNormRatInttVsTruthPt",
335  "cNormRatInttVsNumTpc",
336  "cTruthRatMvtxVsTruthPt",
337  "cTruthRatMvtxVsNumTpc",
338  "cTrackRatMvtxVsTruthPt",
339  "cTrackRatMvtxVsNumTpc",
340  "cWeirdRatMvtxVsTruthPt",
341  "cWeirdRatMvtxVsNumTpc",
342  "cNormRatMvtxVsTruthPt",
343  "cNormRatMvtxVsNumTpc",
344  "cTruthRatTpcVsTruthPt",
345  "cTruthRatTpcVsNumTpc",
346  "cTrackRatTpcVsTruthPt",
347  "cTrackRatTpcVsNumTpc",
348  "cWeirdRatTpcVsTruthPt",
349  "cWeirdRatTpcVsNumTpc",
350  "cNormRatTpcVsTruthPt",
351  "cNormRatTpcVsNumTpc",
352  "cTruthPhiVsTruthPt",
353  "cTruthPhiVsNumTpc",
354  "cTrackPhiVsTruthPt",
355  "cTrackPhiVsNumTpc",
356  "cWeirdPhiVsTruthPt",
357  "cWeirdPhiVsNumTpc",
358  "cNormPhiVsTruthPt",
359  "cNormPhiVsNumTpc",
360  "cTruthEtaVsTruthPt",
361  "cTruthEtaVsNumTpc",
362  "cTrackEtaVsTruthPt",
363  "cTrackEtaVsNumTpc",
364  "cWeirdEtaVsTruthPt",
365  "cWeirdEtaVsNumTpc",
366  "cNormEtaVsTruthPt",
367  "cNormEtaVsNumTpc",
368  "cTruthPtVsTruthPt",
369  "cTruthPtVsNumTpc",
370  "cTrackPtVsTruthPt",
371  "cTrackPtVsNumTpc",
372  "cWeirdPtVsTruthPt",
373  "cWeirdPtVsNumTpc",
374  "cNormPtVsTruthPt",
375  "cNormPtVsNumTpc",
376  "cTruthFracVsTruthPt",
377  "cTruthFracVsNumTpc",
378  "cTrackFracVsTruthPt",
379  "cTrackFracVsNumTpc",
380  "cWeirdFracVsTruthPt",
381  "cWeirdFracVsNumTpc",
382  "cNormFracVsTruthPt",
383  "cNormFracVsNumTpc"
384  };
385 
386  // open files and load histograms -------------------------------------------
387 
388  // open files
389  TFile* fOutput = new TFile(sOutput.data(), "recreate");
390  TFile* fInOld = new TFile(sInOld.data(), "read");
391  TFile* fInNew = new TFile(sInNew.data(), "read");
392  if (!fOutput || !fInOld || !fInNew) {
393  cerr << "PANIC: couldn't open a file!\n"
394  << " fOutput = " << fOutput << "fInOld = " << fInOld << ", fInNew = " << fInNew << "\n"
395  << endl;
396  return;
397  }
398  cout << " Opened files." << endl;
399 
400  // grab histograms
401  vector<TH1D*> vecOldHists1D;
402  vector<TH1D*> vecNewHists1D;
403  vector<TH2D*> vecOldHists2D;
404  vector<TH2D*> vecNewHists2D;
405  for (const string sInHist1D : vecInHists1D) {
406  vecOldHists1D.push_back((TH1D*) fInOld -> Get(sInHist1D.data()));
407  vecNewHists1D.push_back((TH1D*) fInNew -> Get(sInHist1D.data()));
408  if (!vecOldHists1D.back() || !vecNewHists1D.back()) {
409  cerr << "PANIC: couldn't grab the 1D histogram '" << sInHist1D << "' from an input file!\n"
410  << " hInOld1D = " << vecOldHists1D.back() << ", hInNew1D = " << vecNewHists1D.back() << "\n"
411  << endl;
412  return;
413  }
414  }
415  for (const string sInHist2D : vecInHists2D) {
416  vecOldHists2D.push_back((TH2D*) fInOld -> Get(sInHist2D.data()));
417  vecNewHists2D.push_back((TH2D*) fInNew -> Get(sInHist2D.data()));
418  if (!vecOldHists2D.back() || !vecNewHists2D.back()) {
419  cerr << "PANIC: couldn't grab the 2D histogram '" << sInHist2D << "' from an input file!\n"
420  << " hInOld2D = " << vecOldHists2D.back() << ", hInNew2D = " << vecNewHists2D.back() << "\n"
421  << endl;
422  return;
423  }
424  }
425  cout << " Grabbed histograms." << endl;
426 
427  // normalize histograms and set axes' ranges as needed ----------------------
428 
429  // normalize by integral if needed
430  if (doIntNorm) {
431  for (TH1D* hOldHist1D : vecOldHists1D) {
432  const double intOld1D = hOldHist1D -> Integral();
433  if (intOld1D > 0.) {
434  hOldHist1D -> Scale(1. / intOld1D);
435  }
436  }
437  for (TH1D* hNewHist1D : vecNewHists1D) {
438  const double intNew1D = hNewHist1D -> Integral();
439  if (intNew1D > 0.) {
440  hNewHist1D -> Scale(1. / intNew1D);
441  }
442  }
443  for (TH2D* hOldHist2D : vecOldHists2D) {
444  const double intOld2D = hOldHist2D -> Integral();
445  if (intOld2D > 0.) {
446  hOldHist2D -> Scale(1. / intOld2D);
447  }
448  }
449  for (TH2D* hNewHist2D : vecNewHists2D) {
450  const double intNew2D = hNewHist2D -> Integral();
451  if (intNew2D > 0.) {
452  hNewHist2D -> Scale(1. / intNew2D);
453  }
454  }
455  cout << " Normalized histograms." << endl;
456  }
457 
458  // set z-axis ranges if needed
459  if (matchVertScales) {
460  size_t nHist2D = vecOldHists2D.size();
461  for (size_t iHist2D = 0; iHist2D < nHist2D; iHist2D++) {
462  const float oldMin = vecOldHists2D[iHist2D] -> GetMinimum(0.);
463  const float oldMax = vecOldHists2D[iHist2D] -> GetMaximum();
464  const float newMin = vecNewHists2D[iHist2D] -> GetMinimum(0.);
465  const float newMax = vecNewHists2D[iHist2D] -> GetMaximum();
466  const float setMin = min(oldMin, newMin);
467  const float setMax = max(oldMax, newMax);
468  vecOldHists2D[iHist2D] -> GetZaxis() -> SetRangeUser(setMin, setMax);
469  vecNewHists2D[iHist2D] -> GetZaxis() -> SetRangeUser(setMin, setMax);
470  }
471  cout << " Adjusted z-axis scales to match." << endl;
472  }
473 
474  // pick relevant count
475  string sCountUse("");
476  if (doIntNorm) {
477  sCountUse = sNorm;
478  } else {
479  sCountUse = sCount;
480  }
481 
482  // calculate ratios ---------------------------------------------------------
483 
484  vector<TH1D*> vecRatios1D(vecOldHists1D.size());
485  vector<TH2D*> vecRatios2D(vecOldHists2D.size());
486  for (size_t iHist1D = 0; iHist1D < vecOldHists1D.size(); iHist1D++) {
487 
488  // make histogram name
489  TString sRatioName = vecOldHists1D.at(iHist1D) -> GetName();
490  sRatioName.Append("_");
491  sRatioName.Append(sRatioLabel.data());
492 
493  vecRatios1D.at(iHist1D) = (TH1D*) vecOldHists1D.at(iHist1D) -> Clone();
494  vecRatios1D.at(iHist1D) -> SetName(sRatioName.Data());
495  vecRatios1D.at(iHist1D) -> Reset("ICES");
496  vecRatios1D.at(iHist1D) -> Divide(vecOldHists1D.at(iHist1D), vecNewHists1D.at(iHist1D), 1., 1.);
497  }
498  for (size_t iHist2D = 0; iHist2D < vecOldHists2D.size(); iHist2D++) {
499 
500  // make histogram name
501  TString sRatioName = vecOldHists2D.at(iHist2D) -> GetName();
502  sRatioName.Append("_");
503  sRatioName.Append(sRatioLabel.data());
504 
505  vecRatios2D.at(iHist2D) = (TH2D*) vecOldHists2D.at(iHist2D) -> Clone();
506  vecRatios2D.at(iHist2D) -> SetName(sRatioName.Data());
507  vecRatios2D.at(iHist2D) -> Reset("ICES");
508  vecRatios2D.at(iHist2D) -> Divide(vecOldHists2D.at(iHist2D), vecNewHists2D.at(iHist2D), 1., 1.);
509  }
510  cout << " Calculated ratios." << endl;
511 
512  // set histogram styles -----------------------------------------------------
513 
514  // style options
515  const uint32_t fTxt(42);
516  const uint32_t fAln(12);
517  const uint32_t fCnt(1);
518  const float fLabH[NAxes] = {0.04, 0.04, 0.03};
519  const float fLabR1[NAxes] = {0.074, 0.074, 0.056};
520  const float fLabR2[NAxes] = {0.04, 0.04, 0.03};
521  const float fTitH[NAxes] = {0.04, 0.04, 0.04};
522  const float fTitR1[NAxes] = {0.074, 0.074, 0.056};
523  const float fTitR2[NAxes] = {0.04, 0.04, 0.04};
524  const float fOffTH[NAxes] = {1.0, 1.3, 1.2};
525  const float fOffTR1[NAxes] = {0.8, 0.8, 1.0};
526  const float fOffTR2[NAxes] = {1.0, 1.3, 1.2};
527  const float fOffLH[NAxes] = {0.005, 0.005, 0.000};
528  const float fOffLR1[NAxes] = {0.005, 0.005, 0.000};
529  const float fOffLR2[NAxes] = {0.005, 0.005, 0.000};
530 
531  // set old histogram styles
532  for (TH1D* hOldHist1D : vecOldHists1D) {
533 
534  // label histogram accordingly
535  TString sOldName = hOldHist1D -> GetName();
536  sOldName.Append("_");
537  sOldName.Append(sHistLabels.first.data());
538 
539  // set style
540  hOldHist1D -> SetName(sOldName.Data());
541  hOldHist1D -> SetMarkerColor(fCol.first);
542  hOldHist1D -> SetMarkerStyle(fMar.first);
543  hOldHist1D -> SetFillColor(fCol.first);
544  hOldHist1D -> SetFillStyle(fFil.first);
545  hOldHist1D -> SetLineColor(fCol.first);
546  hOldHist1D -> SetLineStyle(fLin.first);
547  hOldHist1D -> SetLineWidth(fWid.first);
548  hOldHist1D -> SetTitle("");
549  hOldHist1D -> SetTitleFont(fTxt);
550  hOldHist1D -> GetXaxis() -> SetTitleFont(fTxt);
551  hOldHist1D -> GetXaxis() -> SetTitleSize(fTitH[0]);
552  hOldHist1D -> GetXaxis() -> SetTitleOffset(fOffTH[0]);
553  hOldHist1D -> GetXaxis() -> SetLabelFont(fTxt);
554  hOldHist1D -> GetXaxis() -> SetLabelSize(fLabH[0]);
555  hOldHist1D -> GetXaxis() -> SetLabelOffset(fOffLH[0]);
556  hOldHist1D -> GetXaxis() -> CenterTitle(fCnt);
557  hOldHist1D -> GetYaxis() -> SetTitle(sCountUse.data());
558  hOldHist1D -> GetYaxis() -> SetTitleFont(fTxt);
559  hOldHist1D -> GetYaxis() -> SetTitleSize(fTitH[1]);
560  hOldHist1D -> GetYaxis() -> SetTitleOffset(fOffTH[1]);
561  hOldHist1D -> GetYaxis() -> SetLabelFont(fTxt);
562  hOldHist1D -> GetYaxis() -> SetLabelSize(fLabH[1]);
563  hOldHist1D -> GetYaxis() -> SetLabelOffset(fOffLH[1]);
564  hOldHist1D -> GetYaxis() -> CenterTitle(fCnt);
565  }
566  for (TH2D* hOldHist2D : vecOldHists2D) {
567 
568  // label histogram accordingly
569  TString sOldName = hOldHist2D -> GetName();
570  sOldName.Append("_");
571  sOldName.Append(sHistLabels.first.data());
572 
573  // set style
574  hOldHist2D -> SetName(sOldName.Data());
575  hOldHist2D -> SetMarkerColor(fCol.first);
576  hOldHist2D -> SetMarkerStyle(fMar.first);
577  hOldHist2D -> SetFillColor(fCol.first);
578  hOldHist2D -> SetFillStyle(fFil.first);
579  hOldHist2D -> SetLineColor(fCol.first);
580  hOldHist2D -> SetLineStyle(fLin.first);
581  hOldHist2D -> SetLineWidth(fWid.first);
582  hOldHist2D -> SetTitle(sLegOld.data());
583  hOldHist2D -> SetTitleFont(fTxt);
584  hOldHist2D -> GetXaxis() -> SetTitleFont(fTxt);
585  hOldHist2D -> GetXaxis() -> SetTitleSize(fTitH[0]);
586  hOldHist2D -> GetXaxis() -> SetTitleOffset(fOffTH[0]);
587  hOldHist2D -> GetXaxis() -> SetLabelFont(fTxt);
588  hOldHist2D -> GetXaxis() -> SetLabelSize(fLabH[0]);
589  hOldHist2D -> GetXaxis() -> SetLabelOffset(fOffLH[0]);
590  hOldHist2D -> GetXaxis() -> CenterTitle(fCnt);
591  hOldHist2D -> GetYaxis() -> SetTitleFont(fTxt);
592  hOldHist2D -> GetYaxis() -> SetTitleSize(fTitH[1]);
593  hOldHist2D -> GetYaxis() -> SetTitleOffset(fOffTH[1]);
594  hOldHist2D -> GetYaxis() -> SetLabelFont(fTxt);
595  hOldHist2D -> GetYaxis() -> SetLabelSize(fLabH[1]);
596  hOldHist2D -> GetYaxis() -> SetLabelOffset(fOffLH[1]);
597  hOldHist2D -> GetYaxis() -> CenterTitle(fCnt);
598  hOldHist2D -> GetZaxis() -> SetTitle(sCountUse.data());
599  hOldHist2D -> GetZaxis() -> SetTitleFont(fTxt);
600  hOldHist2D -> GetZaxis() -> SetTitleSize(fTitH[2]);
601  hOldHist2D -> GetZaxis() -> SetTitleOffset(fOffTH[2]);
602  hOldHist2D -> GetZaxis() -> SetLabelFont(fTxt);
603  hOldHist2D -> GetZaxis() -> SetLabelSize(fLabH[2]);
604  hOldHist2D -> GetZaxis() -> SetLabelOffset(fOffLH[2]);
605  hOldHist2D -> GetZaxis() -> CenterTitle(fCnt);
606  }
607 
608  // set new histogram styles
609  for (TH1D* hNewHist1D : vecNewHists1D) {
610 
611  // label histogram accordingly
612  TString sNewName = hNewHist1D -> GetName();
613  sNewName.Append("_");
614  sNewName.Append(sHistLabels.second.data());
615 
616  // set style
617  hNewHist1D -> SetName(sNewName.Data());
618  hNewHist1D -> SetMarkerColor(fCol.second);
619  hNewHist1D -> SetMarkerStyle(fMar.second);
620  hNewHist1D -> SetFillColor(fCol.second);
621  hNewHist1D -> SetFillStyle(fFil.second);
622  hNewHist1D -> SetLineColor(fCol.second);
623  hNewHist1D -> SetLineStyle(fLin.second);
624  hNewHist1D -> SetLineWidth(fWid.second);
625  hNewHist1D -> SetTitle("");
626  hNewHist1D -> SetTitleFont(fTxt);
627  hNewHist1D -> GetXaxis() -> SetTitleFont(fTxt);
628  hNewHist1D -> GetXaxis() -> SetTitleSize(fTitH[0]);
629  hNewHist1D -> GetXaxis() -> SetTitleOffset(fOffTH[0]);
630  hNewHist1D -> GetXaxis() -> SetLabelFont(fTxt);
631  hNewHist1D -> GetXaxis() -> SetLabelSize(fLabH[0]);
632  hNewHist1D -> GetXaxis() -> SetLabelOffset(fOffLH[0]);
633  hNewHist1D -> GetXaxis() -> CenterTitle(fCnt);
634  hNewHist1D -> GetYaxis() -> SetTitle(sCountUse.data());
635  hNewHist1D -> GetYaxis() -> SetTitleFont(fTxt);
636  hNewHist1D -> GetYaxis() -> SetTitleSize(fTitH[1]);
637  hNewHist1D -> GetYaxis() -> SetTitleOffset(fOffTH[1]);
638  hNewHist1D -> GetYaxis() -> SetLabelFont(fTxt);
639  hNewHist1D -> GetYaxis() -> SetLabelSize(fLabH[1]);
640  hNewHist1D -> GetYaxis() -> SetLabelOffset(fOffLH[1]);
641  hNewHist1D -> GetYaxis() -> CenterTitle(fCnt);
642  }
643  for (TH2D* hNewHist2D : vecNewHists2D) {
644 
645  // label histogram accordingly
646  TString sNewName = hNewHist2D -> GetName();
647  sNewName.Append("_");
648  sNewName.Append(sHistLabels.second.data());
649 
650  // set style
651  hNewHist2D -> SetName(sNewName.Data());
652  hNewHist2D -> SetMarkerColor(fCol.first);
653  hNewHist2D -> SetMarkerStyle(fMar.first);
654  hNewHist2D -> SetFillColor(fCol.first);
655  hNewHist2D -> SetFillStyle(fFil.first);
656  hNewHist2D -> SetLineColor(fCol.first);
657  hNewHist2D -> SetLineStyle(fLin.first);
658  hNewHist2D -> SetLineWidth(fWid.first);
659  hNewHist2D -> SetTitle(sLegNew.data());
660  hNewHist2D -> SetTitleFont(fTxt);
661  hNewHist2D -> GetXaxis() -> SetTitleFont(fTxt);
662  hNewHist2D -> GetXaxis() -> SetTitleSize(fTitH[0]);
663  hNewHist2D -> GetXaxis() -> SetTitleOffset(fOffTH[0]);
664  hNewHist2D -> GetXaxis() -> SetLabelFont(fTxt);
665  hNewHist2D -> GetXaxis() -> SetLabelSize(fLabH[0]);
666  hNewHist2D -> GetXaxis() -> SetLabelOffset(fOffLH[0]);
667  hNewHist2D -> GetXaxis() -> CenterTitle(fCnt);
668  hNewHist2D -> GetYaxis() -> SetTitleFont(fTxt);
669  hNewHist2D -> GetYaxis() -> SetTitleSize(fTitH[1]);
670  hNewHist2D -> GetYaxis() -> SetTitleOffset(fOffTH[1]);
671  hNewHist2D -> GetYaxis() -> SetLabelFont(fTxt);
672  hNewHist2D -> GetYaxis() -> SetLabelSize(fLabH[1]);
673  hNewHist2D -> GetYaxis() -> SetLabelOffset(fOffLH[1]);
674  hNewHist2D -> GetYaxis() -> CenterTitle(fCnt);
675  hNewHist2D -> GetZaxis() -> SetTitle(sCountUse.data());
676  hNewHist2D -> GetZaxis() -> SetTitleFont(fTxt);
677  hNewHist2D -> GetZaxis() -> SetTitleSize(fTitH[2]);
678  hNewHist2D -> GetZaxis() -> SetTitleOffset(fOffTH[2]);
679  hNewHist2D -> GetZaxis() -> SetLabelFont(fTxt);
680  hNewHist2D -> GetZaxis() -> SetLabelSize(fLabH[2]);
681  hNewHist2D -> GetZaxis() -> SetLabelOffset(fOffLH[2]);
682  hNewHist2D -> GetZaxis() -> CenterTitle(fCnt);
683  }
684 
685 
686  // set ratio styles
687  for (TH1D* hRatio1D : vecRatios1D) {
688  hRatio1D -> SetMarkerColor(fCol.first);
689  hRatio1D -> SetMarkerStyle(fMar.first);
690  hRatio1D -> SetFillColor(fCol.first);
691  hRatio1D -> SetFillStyle(fFil.first);
692  hRatio1D -> SetLineColor(fCol.first);
693  hRatio1D -> SetLineStyle(fLin.first);
694  hRatio1D -> SetLineWidth(fWid.first);
695  hRatio1D -> SetTitle("");
696  hRatio1D -> SetTitleFont(fTxt);
697  hRatio1D -> GetXaxis() -> SetTitleFont(fTxt);
698  hRatio1D -> GetXaxis() -> SetTitleSize(fTitR1[0]);
699  hRatio1D -> GetXaxis() -> SetTitleOffset(fOffTR1[0]);
700  hRatio1D -> GetXaxis() -> SetLabelFont(fTxt);
701  hRatio1D -> GetXaxis() -> SetLabelSize(fLabR1[0]);
702  hRatio1D -> GetXaxis() -> SetLabelOffset(fOffLR1[0]);
703  hRatio1D -> GetXaxis() -> CenterTitle(fCnt);
704  hRatio1D -> GetYaxis() -> SetTitle(sRatio.data());
705  hRatio1D -> GetYaxis() -> SetTitleFont(fTxt);
706  hRatio1D -> GetYaxis() -> SetTitleSize(fTitR1[1]);
707  hRatio1D -> GetYaxis() -> SetTitleOffset(fOffTR1[1]);
708  hRatio1D -> GetYaxis() -> SetLabelFont(fTxt);
709  hRatio1D -> GetYaxis() -> SetLabelSize(fLabR1[1]);
710  hRatio1D -> GetYaxis() -> SetLabelOffset(fOffLR1[1]);
711  hRatio1D -> GetYaxis() -> CenterTitle(fCnt);
712  }
713  for (TH2D* hRatio2D : vecRatios2D) {
714  hRatio2D -> SetMarkerColor(fCol.first);
715  hRatio2D -> SetMarkerStyle(fMar.first);
716  hRatio2D -> SetFillColor(fCol.first);
717  hRatio2D -> SetFillStyle(fFil.first);
718  hRatio2D -> SetLineColor(fCol.first);
719  hRatio2D -> SetLineStyle(fLin.first);
720  hRatio2D -> SetLineWidth(fWid.first);
721  hRatio2D -> SetTitle("");
722  hRatio2D -> SetTitleFont(fTxt);
723  hRatio2D -> GetXaxis() -> SetTitleFont(fTxt);
724  hRatio2D -> GetXaxis() -> SetTitleSize(fTitR2[0]);
725  hRatio2D -> GetXaxis() -> SetTitleOffset(fOffTR2[0]);
726  hRatio2D -> GetXaxis() -> SetLabelFont(fTxt);
727  hRatio2D -> GetXaxis() -> SetLabelSize(fLabR2[0]);
728  hRatio2D -> GetXaxis() -> SetLabelOffset(fOffLR2[0]);
729  hRatio2D -> GetXaxis() -> CenterTitle(fCnt);
730  hRatio2D -> GetYaxis() -> SetTitleFont(fTxt);
731  hRatio2D -> GetYaxis() -> SetTitleSize(fTitR2[1]);
732  hRatio2D -> GetYaxis() -> SetTitleOffset(fOffTR2[1]);
733  hRatio2D -> GetYaxis() -> SetLabelFont(fTxt);
734  hRatio2D -> GetYaxis() -> SetLabelSize(fLabR2[1]);
735  hRatio2D -> GetYaxis() -> SetLabelOffset(fOffLR2[1]);
736  hRatio2D -> GetYaxis() -> CenterTitle(fCnt);
737  hRatio2D -> GetZaxis() -> SetTitle(sRatio.data());
738  hRatio2D -> GetZaxis() -> SetTitleFont(fTxt);
739  hRatio2D -> GetZaxis() -> SetTitleSize(fTitR2[2]);
740  hRatio2D -> GetZaxis() -> SetTitleOffset(fOffTR2[2]);
741  hRatio2D -> GetZaxis() -> SetLabelFont(fTxt);
742  hRatio2D -> GetZaxis() -> SetLabelSize(fLabR2[2]);
743  hRatio2D -> GetZaxis() -> SetLabelOffset(fOffLR2[2]);
744  hRatio2D -> GetZaxis() -> CenterTitle(fCnt);
745  }
746  cout << " Set styles." << endl;
747 
748  // make legends and text boxes ----------------------------------------------
749 
750  // make legend
751  const uint32_t fColLe(0);
752  const uint32_t fFilLe(0);
753  const uint32_t fLinLe(0);
754  const float fLegXY[NVtx] = {0.1, 0.1, 0.3, 0.2};
755 
756  TLegend *leg = new TLegend(fLegXY[0], fLegXY[1], fLegXY[2], fLegXY[3], sHeader.data());
757  leg -> SetFillColor(fColLe);
758  leg -> SetFillStyle(fFilLe);
759  leg -> SetLineColor(fColLe);
760  leg -> SetLineStyle(fLinLe);
761  leg -> SetTextFont(fTxt);
762  leg -> SetTextAlign(fAln);
763  leg -> AddEntry(vecOldHists1D.front(), sLegOld.data(), "pf");
764  leg -> AddEntry(vecNewHists1D.front(), sLegNew.data(), "pf");
765  cout << " Made legend." << endl;
766 
767  // make text
768  const uint32_t fColTx(0);
769  const uint32_t fFilTx(0);
770  const uint32_t fLinTx(0);
771  const float fTxtXY[NVtx] = {0.3, 0.1, 0.5, 0.25};
772 
773  TPaveText *txt = new TPaveText(fTxtXY[0], fTxtXY[1], fTxtXY[2], fTxtXY[3], "NDC NB");
774  txt -> SetFillColor(fColTx);
775  txt -> SetFillStyle(fFilTx);
776  txt -> SetLineColor(fColTx);
777  txt -> SetLineStyle(fLinTx);
778  txt -> SetTextFont(fTxt);
779  txt -> SetTextAlign(fAln);
780  for (const string txtLine : vecTxt) {
781  txt -> AddText(txtLine.data());
782  }
783  cout << " Made text." << endl;
784 
785  // make plots ---------------------------------------------------------------
786 
787  // create output directories
788  array<TDirectory*, NDir> arrOutDirs;
789  for (size_t iDir = 0; iDir < NDir; iDir++) {
790  arrOutDirs[iDir] = fOutput -> mkdir(arrDirNames[iDir].data());
791  }
792  cout << " Made directories." << endl;
793 
794  // canvas parameters
795  const uint32_t width1D(750);
796  const uint32_t width2D(1500);
797  const uint32_t width2DR(2250);
798  const uint32_t height(750);
799  const uint32_t heightR1(900);
800  const uint32_t heightR2(500);
801  const uint32_t fMode(0);
802  const uint32_t fBord(2);
803  const uint32_t fGrid(0);
804  const uint32_t fTick(1);
805  const uint32_t fLogX(0);
806  const uint32_t fLogY(1);
807  const uint32_t fLogZ(1);
808  const uint32_t fFrame(0);
809  const string sOldPadName("pOld");
810  const string sNewPadName("pNew");
811  const string sHistPadName("pHist");
812  const string sRatPadName("pRatio");
813  const float fMargin1D[NSide] = {0.02, 0.02, 0.15, 0.15};
814  const float fMargin1DH[NSide] = {0.02, 0.02, 0.005, 0.15};
815  const float fMargin1DR[NSide] = {0.005, 0.02, 0.2, 0.15};
816  const float fMargin2D[NSide] = {0.10, 0.15, 0.15, 0.15};
817  const float xyOldPad[NVtx] = {0.0, 0.0, 0.5, 1.0};
818  const float xyOldPadR[NVtx] = {0.0, 0.0, 0.33, 1.0};
819  const float xyNewPad[NVtx] = {0.5, 0.0, 1.0, 1.0};
820  const float xyNewPadR[NVtx] = {0.33, 0.0, 0.66, 1.0};
821  const float xyHistPadR[NVtx] = {0.0, 0.33, 1.0, 1.0};
822  const float xyRatPadR1[NVtx] = {0.0, 0.0, 1.0, 0.33};
823  const float xyRatPadR2[NVtx] = {0.66, 0.0, 1.0, 1.0};
824 
825  // make 1D plots
826  size_t iDraw1D = 0;
827  for (const string sCanvasName : vecCanvasNames1D) {
828 
829  // construct canvas
830  TCanvas* cPlot1D = new TCanvas(sCanvasName.data(), "", width1D, height);
831  cPlot1D -> SetGrid(fGrid, fGrid);
832  cPlot1D -> SetTicks(fTick, fTick);
833  cPlot1D -> SetBorderMode(fMode);
834  cPlot1D -> SetBorderSize(fBord);
835  cPlot1D -> SetFrameBorderMode(fFrame);
836  cPlot1D -> SetTopMargin(fMargin1D[0]);
837  cPlot1D -> SetRightMargin(fMargin1D[1]);
838  cPlot1D -> SetBottomMargin(fMargin1D[2]);
839  cPlot1D -> SetLeftMargin(fMargin1D[3]);
840  cPlot1D -> SetLogx(fLogX);
841  cPlot1D -> SetLogy(fLogY);
842  cPlot1D -> cd();
843 
844  // draw old vs. new histograms
845  vecOldHists1D.at(iDraw1D) -> Draw();
846  vecNewHists1D.at(iDraw1D) -> Draw("same");
847 
848  // draw text and save
849  leg -> Draw();
850  txt -> Draw();
851  arrOutDirs[Dir::Plot] -> cd();
852  cPlot1D -> Write();
853  cPlot1D -> Close();
854 
855  // increment counter
856  ++iDraw1D;
857  }
858 
859  iDraw1D = 0;
860  for (const string sCanvasName : vecCanvasNames1D) {
861 
862  // make new name
863  const string sNameWithRatio = sCanvasName + "_" + sRatioLabel;
864 
865  // construct canvas
866  TCanvas* cPlot1D = new TCanvas(sNameWithRatio.data(), "", width1D, heightR1);
867  TPad* pPadH1D = new TPad(sHistPadName.data(), "", xyHistPadR[0], xyHistPadR[1], xyHistPadR[2], xyHistPadR[3]);
868  TPad* pPadR1D = new TPad(sRatPadName.data(), "", xyRatPadR1[0], xyRatPadR1[1], xyRatPadR1[2], xyRatPadR1[3]);
869  cPlot1D -> SetGrid(fGrid, fGrid);
870  cPlot1D -> SetTicks(fTick, fTick);
871  cPlot1D -> SetBorderMode(fMode);
872  cPlot1D -> SetBorderSize(fBord);
873  pPadH1D -> SetGrid(fGrid, fGrid);
874  pPadH1D -> SetTicks(fTick, fTick);
875  pPadH1D -> SetBorderMode(fMode);
876  pPadH1D -> SetBorderSize(fBord);
877  pPadH1D -> SetFrameBorderMode(fFrame);
878  pPadH1D -> SetTopMargin(fMargin1DH[0]);
879  pPadH1D -> SetRightMargin(fMargin1DH[1]);
880  pPadH1D -> SetBottomMargin(fMargin1DH[2]);
881  pPadH1D -> SetLeftMargin(fMargin1DH[3]);
882  pPadH1D -> SetLogx(fLogX);
883  pPadH1D -> SetLogy(fLogY);
884  pPadR1D -> SetGrid(fGrid, fGrid);
885  pPadR1D -> SetTicks(fTick, fTick);
886  pPadR1D -> SetBorderMode(fMode);
887  pPadR1D -> SetBorderSize(fBord);
888  pPadR1D -> SetFrameBorderMode(fFrame);
889  pPadR1D -> SetTopMargin(fMargin1DR[0]);
890  pPadR1D -> SetRightMargin(fMargin1DR[1]);
891  pPadR1D -> SetBottomMargin(fMargin1DR[2]);
892  pPadR1D -> SetLeftMargin(fMargin1DR[3]);
893  pPadR1D -> SetLogx(fLogX);
894  pPadR1D -> SetLogy(fLogY);
895  cPlot1D -> cd();
896  pPadH1D -> Draw();
897  pPadR1D -> Draw();
898 
899  // draw old vs. new histograms
900  pPadH1D -> cd();
901  vecOldHists1D.at(iDraw1D) -> Draw();
902  vecNewHists1D.at(iDraw1D) -> Draw("same");
903  leg -> Draw();
904  txt -> Draw();
905 
906  // draw ratio
907  pPadR1D -> cd();
908  vecRatios1D.at(iDraw1D) -> Draw();
909 
910  // draw text and save
911  arrOutDirs[Dir::Plot] -> cd();
912  cPlot1D -> Write();
913  cPlot1D -> Close();
914 
915  // increment counter
916  ++iDraw1D;
917  }
918 
919  // make 2D plots
920  size_t iDraw2D = 0;
921  for (const string sCanvasName : vecCanvasNames2D) {
922 
923  // construct canvas
924  TCanvas* cPlot2D = new TCanvas(sCanvasName.data(), "", width2D, height);
925  TPad* pOld = new TPad(sOldPadName.data(), "", xyOldPad[0], xyOldPad[1], xyOldPad[2], xyOldPad[3]);
926  TPad* pNew = new TPad(sNewPadName.data(), "", xyNewPad[0], xyNewPad[1], xyNewPad[2], xyNewPad[3]);
927  cPlot2D -> SetGrid(fGrid, fGrid);
928  cPlot2D -> SetTicks(fTick, fTick);
929  cPlot2D -> SetBorderMode(fMode);
930  cPlot2D -> SetBorderSize(fBord);
931  pOld -> SetGrid(fGrid, fGrid);
932  pOld -> SetTicks(fTick, fTick);
933  pOld -> SetBorderMode(fMode);
934  pOld -> SetBorderSize(fBord);
935  pOld -> SetFrameBorderMode(fFrame);
936  pOld -> SetTopMargin(fMargin2D[0]);
937  pOld -> SetRightMargin(fMargin2D[1]);
938  pOld -> SetBottomMargin(fMargin2D[2]);
939  pOld -> SetLeftMargin(fMargin2D[3]);
940  pOld -> SetLogx(fLogX);
941  pOld -> SetLogy(fLogY);
942  pOld -> SetLogz(fLogZ);
943  pNew -> SetGrid(fGrid, fGrid);
944  pNew -> SetTicks(fTick, fTick);
945  pNew -> SetBorderMode(fMode);
946  pNew -> SetBorderSize(fBord);
947  pNew -> SetFrameBorderMode(fFrame);
948  pNew -> SetTopMargin(fMargin2D[0]);
949  pNew -> SetRightMargin(fMargin2D[1]);
950  pNew -> SetBottomMargin(fMargin2D[2]);
951  pNew -> SetLeftMargin(fMargin2D[3]);
952  pNew -> SetLogx(fLogX);
953  pNew -> SetLogy(fLogY);
954  pNew -> SetLogz(fLogZ);
955  cPlot2D -> cd();
956  pOld -> Draw();
957  pNew -> Draw();
958 
959  // draw old vs. new histograms
960  pOld -> cd();
961  vecOldHists2D.at(iDraw2D) -> Draw("colz");
962  pNew -> cd();
963  vecNewHists2D.at(iDraw2D) -> Draw("colz");
964 
965  // draw text and save
966  pNew -> cd();
967  txt -> Draw();
968  arrOutDirs[Dir::Plot] -> cd();
969  cPlot2D -> Write();
970  cPlot2D -> Close();
971 
972  // increment counter
973  ++iDraw2D;
974  }
975 
976  iDraw2D = 0;
977  for (const string sCanvasName : vecCanvasNames2D) {
978 
979  // make new name
980  const string sNameWithRatio = sCanvasName + "_" + sRatioLabel;
981 
982  // construct canvas
983  TCanvas* cPlot2D = new TCanvas(sNameWithRatio.data(), "", width2D, heightR2);
984  TPad* pOld = new TPad(sOldPadName.data(), "", xyOldPadR[0], xyOldPadR[1], xyOldPadR[2], xyOldPadR[3]);
985  TPad* pNew = new TPad(sNewPadName.data(), "", xyNewPadR[0], xyNewPadR[1], xyNewPadR[2], xyNewPadR[3]);
986  TPad* pRat = new TPad(sRatPadName.data(), "", xyRatPadR2[0], xyRatPadR2[1], xyRatPadR2[2], xyRatPadR2[3]);
987  cPlot2D -> SetGrid(fGrid, fGrid);
988  cPlot2D -> SetTicks(fTick, fTick);
989  cPlot2D -> SetBorderMode(fMode);
990  cPlot2D -> SetBorderSize(fBord);
991  pOld -> SetGrid(fGrid, fGrid);
992  pOld -> SetTicks(fTick, fTick);
993  pOld -> SetBorderMode(fMode);
994  pOld -> SetBorderSize(fBord);
995  pOld -> SetFrameBorderMode(fFrame);
996  pOld -> SetTopMargin(fMargin2D[0]);
997  pOld -> SetRightMargin(fMargin2D[1]);
998  pOld -> SetBottomMargin(fMargin2D[2]);
999  pOld -> SetLeftMargin(fMargin2D[3]);
1000  pOld -> SetLogx(fLogX);
1001  pOld -> SetLogy(fLogY);
1002  pOld -> SetLogz(fLogZ);
1003  pNew -> SetGrid(fGrid, fGrid);
1004  pNew -> SetTicks(fTick, fTick);
1005  pNew -> SetBorderMode(fMode);
1006  pNew -> SetBorderSize(fBord);
1007  pNew -> SetFrameBorderMode(fFrame);
1008  pNew -> SetTopMargin(fMargin2D[0]);
1009  pNew -> SetRightMargin(fMargin2D[1]);
1010  pNew -> SetBottomMargin(fMargin2D[2]);
1011  pNew -> SetLeftMargin(fMargin2D[3]);
1012  pNew -> SetLogx(fLogX);
1013  pNew -> SetLogy(fLogY);
1014  pNew -> SetLogz(fLogZ);
1015  pRat -> SetGrid(fGrid, fGrid);
1016  pRat -> SetTicks(fTick, fTick);
1017  pRat -> SetBorderMode(fMode);
1018  pRat -> SetBorderSize(fBord);
1019  pRat -> SetFrameBorderMode(fFrame);
1020  pRat -> SetTopMargin(fMargin2D[0]);
1021  pRat -> SetRightMargin(fMargin2D[1]);
1022  pRat -> SetBottomMargin(fMargin2D[2]);
1023  pRat -> SetLeftMargin(fMargin2D[3]);
1024  pRat -> SetLogx(fLogX);
1025  pRat -> SetLogy(fLogY);
1026  pRat -> SetLogz(fLogZ);
1027  cPlot2D -> cd();
1028  pOld -> Draw();
1029  pNew -> Draw();
1030  pRat -> Draw();
1031 
1032  // draw old vs. new vs. ratio histograms
1033  pOld -> cd();
1034  vecOldHists2D.at(iDraw2D) -> Draw("colz");
1035  txt -> Draw();
1036  pNew -> cd();
1037  vecNewHists2D.at(iDraw2D) -> Draw("colz");
1038  pRat -> cd();
1039  vecRatios2D.at(iDraw2D) -> Draw("colz");
1040 
1041  // draw text and save
1042  arrOutDirs[Dir::Plot] -> cd();
1043  cPlot2D -> Write();
1044  cPlot2D -> Close();
1045 
1046  // increment counter
1047  ++iDraw2D;
1048  }
1049  cout << " Made plots." << endl;
1050 
1051  // save histogarms and close ------------------------------------------------
1052 
1053  // save old histograms
1054  arrOutDirs[Dir::Old] -> cd();
1055  for (TH1D* hOldHist1D : vecOldHists1D) {
1056  hOldHist1D -> Write();
1057  }
1058  for (TH2D* hOldHist2D : vecOldHists2D) {
1059  hOldHist2D -> Write();
1060  }
1061 
1062  // save new histograms
1063  arrOutDirs[Dir::New] -> cd();
1064  for (TH1D* hNewHist1D : vecNewHists1D) {
1065  hNewHist1D -> Write();
1066  }
1067  for (TH2D* hNewHist2D : vecNewHists2D) {
1068  hNewHist2D -> Write();
1069  }
1070 
1071  // save ratio histograms
1072  arrOutDirs[Dir::Ratio] -> cd();
1073  for (TH1D* hRatio1D : vecRatios1D) {
1074  hRatio1D -> Write();
1075  }
1076  for (TH2D* hRatio2D : vecRatios2D) {
1077  hRatio2D -> Write();
1078  }
1079  cout << " Saved histograms." << endl;
1080 
1081  // close files
1082  fOutput -> cd();
1083  fOutput -> Close();
1084  fInOld -> cd();
1085  fInOld -> Close();
1086  fInNew -> cd();
1087  fInNew -> Close();
1088 
1089  // exit
1090  cout << " Finished old vs. new comparison script!\n" << endl;
1091  return;
1092 
1093 }
1094 
1095 // end ------------------------------------------------------------------------