Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:11:53

0001 // ----------------------------------------------------------------------------
0002 // 'MakeNewMatcherTuplePlots.cxx'
0003 // Derek Anderson
0004 // 01.24.2024
0005 //
0006 // Short macro to make plots from the
0007 // output of the modified ClusMatchTree
0008 // module.
0009 // ----------------------------------------------------------------------------
0010 
0011 #include <array>
0012 #include <string>
0013 #include <vector>
0014 #include <utility>
0015 #include <iostream>
0016 #include "TH1.h"
0017 #include "TH2.h"
0018 #include "TFile.h"
0019 #include "TTree.h"
0020 #include "TError.h"
0021 
0022 using namespace std;
0023 
0024 // global constants
0025 static const size_t NSectors = 12;
0026 
0027 
0028 
0029 // main body of macro ---------------------------------------------------------
0030 
0031 void MakeNewMatcherTuplePlots() {
0032 
0033   // io parameters
0034   const string sOutput("newMatcherTuplePlots_oneMatchPerParticle_forZVtxCutComp_oddFrac05150.pt10n1evt500pim.d1m2y2024.root");
0035   const string sInTrue("input/merged/sPhenixG4_oneMatchPerParticle_forCrossCheck_newMatcher.pt10num1evt500pim.d25m1y2024.root");
0036   const string sInReco("input/merged/sPhenixG4_oneMatchPerParticle_forCrossCheck_newMatcher.pt10num1evt500pim.d25m1y2024.root");
0037   const string sTreeTrue("ntForEvalComp");
0038   const string sTreeReco("ntForEvalComp");
0039 
0040   // cut options
0041   const bool doZVtxCut(true);
0042   const bool doPhiCut(false);
0043 
0044   // weird track & cut parameters
0045   const pair<float, float> oddPtFrac = {0.5, 1.5};
0046   const pair<float, float> zVtxRange = {-1., 1.};
0047 
0048   // phi cut parameters
0049   const float sigCutVal(0.75);
0050   const array<pair<float, float>, NSectors> phiSectors = {
0051     make_pair(-2.92, 0.12),
0052     make_pair(-2.38, 0.05),
0053     make_pair(-1.93, 0.18),
0054     make_pair(-1.33, 0.07),
0055     make_pair(-0.90, 0.24),
0056     make_pair(-0.29, 0.09),
0057     make_pair(0.23,  0.11),
0058     make_pair(0.73,  0.10),
0059     make_pair(1.28,  0.10),
0060     make_pair(1.81,  0.08),
0061     make_pair(2.23,  0.18),
0062     make_pair(2.80,  0.17)
0063   };
0064 
0065   // lower verbosity
0066   gErrorIgnoreLevel = kError;
0067   cout << "\n  Staring new matcher plot script..." << endl;
0068 
0069   // open files
0070   TFile* fOutput = new TFile(sOutput.data(), "recreate");
0071   TFile* fInTrue = new TFile(sInTrue.data(), "read");
0072   TFile* fInReco = new TFile(sInReco.data(), "read");
0073   if (!fOutput || !fInTrue || !fInReco) {
0074      cerr << "PANIC: couldn't open a file!\n"
0075           << "       fOutput = " << fOutput << "fInTrue = " << fInTrue << ", fInReco = " << fInReco << "\n"
0076           << endl;
0077     return;
0078   }
0079   cout << "    Opened files." << endl;
0080 
0081   // grab input tree
0082   TTree* tInTrue = (TTree*) fInTrue -> Get(sTreeTrue.data());
0083   TTree* tInReco = (TTree*) fInReco -> Get(sTreeReco.data());
0084   if (!tInTrue || !tInReco) {
0085     cerr << "PANIC: couldn't grab input tree!\n"
0086          << "       sTreeTrue = " << sTreeTrue << ", tInTrue = " << tInTrue << "\n"
0087          << "       sTreeReco = " << sTreeReco << ", tInReco = " << tInReco << "\n"
0088          << endl;
0089     return;
0090   }
0091   cout << "    Grabbed input trees." << endl;
0092 
0093   // declare input leaves
0094   Float_t tru_evtid;
0095   Float_t tru_trkid;
0096   Float_t tru_pt;
0097   Float_t tru_eta;
0098   Float_t tru_phi;
0099   Float_t tru_nmvtxclust_trkmatcher;
0100   Float_t tru_ninttclust_trkmatcher;
0101   Float_t tru_ntpclust_trkmatcher;
0102   Float_t tru_nmvtxclust_manual;
0103   Float_t tru_ninttclust_manual;
0104   Float_t tru_ntpcclust_manual;
0105   Float_t tru_nmvtxlayer_;
0106   Float_t tru_ninttlayer;
0107   Float_t tru_ntpclayer;
0108   Float_t tru_deltapt;
0109   Float_t tru_quality;
0110   Float_t tru_dcaxy;
0111   Float_t tru_dcaz;
0112   Float_t tru_sigmadcaxy;
0113   Float_t tru_sigmadacz;
0114   Float_t tru_vx;
0115   Float_t tru_vy;
0116   Float_t tru_vz;
0117   Float_t tru_gtrkid;
0118   Float_t tru_gpt;
0119   Float_t tru_geta;
0120   Float_t tru_gphi;
0121   Float_t tru_gnmvtxclust_trkmatcher;
0122   Float_t tru_gninttclust_trkmatcher;
0123   Float_t tru_gntpclust_trkmatchergnmvtxclust_manual;
0124   Float_t tru_gninttclust_manual;
0125   Float_t tru_gntpcclust_manual;
0126   Float_t tru_gnmvtxlayer;
0127   Float_t tru_gninttlayer;
0128   Float_t tru_gntpclayer;
0129   Float_t tru_gdeltapt;
0130   Float_t tru_gquality;
0131   Float_t tru_gdcaxy;
0132   Float_t tru_gdcaz;
0133   Float_t tru_gsigmadcaxy;
0134   Float_t tru_gsigmadacz;
0135   Float_t tru_gvx;
0136   Float_t tru_gvy;
0137   Float_t tru_gvz;
0138   Float_t tru_fracnmvtxmatched;
0139   Float_t tru_fracninttmatched;
0140   Float_t tru_fracntpcmatched;
0141 
0142   Float_t rec_evtid;
0143   Float_t rec_trkid;
0144   Float_t rec_pt;
0145   Float_t rec_eta;
0146   Float_t rec_phi;
0147   Float_t rec_nmvtxclust_trkmatcher;
0148   Float_t rec_ninttclust_trkmatcher;
0149   Float_t rec_ntpclust_trkmatcher;
0150   Float_t rec_nmvtxclust_manual;
0151   Float_t rec_ninttclust_manual;
0152   Float_t rec_ntpcclust_manual;
0153   Float_t rec_nmvtxlayer_;
0154   Float_t rec_ninttlayer;
0155   Float_t rec_ntpclayer;
0156   Float_t rec_deltapt;
0157   Float_t rec_quality;
0158   Float_t rec_dcaxy;
0159   Float_t rec_dcaz;
0160   Float_t rec_sigmadcaxy;
0161   Float_t rec_sigmadacz;
0162   Float_t rec_vx;
0163   Float_t rec_vy;
0164   Float_t rec_vz;
0165   Float_t rec_gtrkid;
0166   Float_t rec_gpt;
0167   Float_t rec_geta;
0168   Float_t rec_gphi;
0169   Float_t rec_gnmvtxclust_trkmatcher;
0170   Float_t rec_gninttclust_trkmatcher;
0171   Float_t rec_gntpclust_trkmatchergnmvtxclust_manual;
0172   Float_t rec_gninttclust_manual;
0173   Float_t rec_gntpcclust_manual;
0174   Float_t rec_gnmvtxlayer;
0175   Float_t rec_gninttlayer;
0176   Float_t rec_gntpclayer;
0177   Float_t rec_gdeltapt;
0178   Float_t rec_gquality;
0179   Float_t rec_gdcaxy;
0180   Float_t rec_gdcaz;
0181   Float_t rec_gsigmadcaxy;
0182   Float_t rec_gsigmadacz;
0183   Float_t rec_gvx;
0184   Float_t rec_gvy;
0185   Float_t rec_gvz;
0186   Float_t rec_fracnmvtxmatched;
0187   Float_t rec_fracninttmatched;
0188   Float_t rec_fracntpcmatched;
0189  
0190   // set branch addresses
0191   tInTrue -> SetBranchAddress("evtid",                                  &tru_evtid);
0192   tInTrue -> SetBranchAddress("trkid",                                  &tru_trkid);
0193   tInTrue -> SetBranchAddress("pt",                                     &tru_pt);
0194   tInTrue -> SetBranchAddress("eta",                                    &tru_eta);
0195   tInTrue -> SetBranchAddress("phi",                                    &tru_phi);
0196   tInTrue -> SetBranchAddress("nmvtxclust_trkmatcher",                  &tru_nmvtxclust_trkmatcher);
0197   tInTrue -> SetBranchAddress("ninttclust_trkmatcher",                  &tru_ninttclust_trkmatcher);
0198   tInTrue -> SetBranchAddress("ntpclust_trkmatcher",                    &tru_ntpclust_trkmatcher);
0199   tInTrue -> SetBranchAddress("nmvtxclust_manual",                      &tru_nmvtxclust_manual);
0200   tInTrue -> SetBranchAddress("ninttclust_manual",                      &tru_ninttclust_manual);
0201   tInTrue -> SetBranchAddress("ntpcclust_manual",                       &tru_ntpcclust_manual);
0202   tInTrue -> SetBranchAddress("nmvtxlayer_",                            &tru_nmvtxlayer_);
0203   tInTrue -> SetBranchAddress("ninttlayer",                             &tru_ninttlayer);
0204   tInTrue -> SetBranchAddress("ntpclayer",                              &tru_ntpclayer);
0205   tInTrue -> SetBranchAddress("deltapt",                                &tru_deltapt);
0206   tInTrue -> SetBranchAddress("quality",                                &tru_quality);
0207   tInTrue -> SetBranchAddress("dcaxy",                                  &tru_dcaxy);
0208   tInTrue -> SetBranchAddress("dcaz",                                   &tru_dcaz);
0209   tInTrue -> SetBranchAddress("sigmadcaxy",                             &tru_sigmadcaxy);
0210   tInTrue -> SetBranchAddress("sigmadacz",                              &tru_sigmadacz);
0211   tInTrue -> SetBranchAddress("vx",                                     &tru_vx);
0212   tInTrue -> SetBranchAddress("vy",                                     &tru_vy);
0213   tInTrue -> SetBranchAddress("vz",                                     &tru_vz);
0214   tInTrue -> SetBranchAddress("gtrkid",                                 &tru_gtrkid);
0215   tInTrue -> SetBranchAddress("gpt",                                    &tru_gpt);
0216   tInTrue -> SetBranchAddress("geta",                                   &tru_geta);
0217   tInTrue -> SetBranchAddress("gphi",                                   &tru_gphi);
0218   tInTrue -> SetBranchAddress("gnmvtxclust_trkmatcher",                 &tru_gnmvtxclust_trkmatcher);
0219   tInTrue -> SetBranchAddress("gninttclust_trkmatcher",                 &tru_gninttclust_trkmatcher);
0220   tInTrue -> SetBranchAddress("gntpclust_trkmatchergnmvtxclust_manual", &tru_gntpclust_trkmatchergnmvtxclust_manual);
0221   tInTrue -> SetBranchAddress("gninttclust_manual",                     &tru_gninttclust_manual);
0222   tInTrue -> SetBranchAddress("gntpcclust_manual",                      &tru_gntpcclust_manual);
0223   tInTrue -> SetBranchAddress("gnmvtxlayer",                            &tru_gnmvtxlayer);
0224   tInTrue -> SetBranchAddress("gninttlayer",                            &tru_gninttlayer);
0225   tInTrue -> SetBranchAddress("gntpclayer",                             &tru_gntpclayer);
0226   tInTrue -> SetBranchAddress("gdeltapt",                               &tru_gdeltapt);
0227   tInTrue -> SetBranchAddress("gquality",                               &tru_gquality);
0228   tInTrue -> SetBranchAddress("gdcaxy",                                 &tru_gdcaxy);
0229   tInTrue -> SetBranchAddress("gdcaz",                                  &tru_gdcaz);
0230   tInTrue -> SetBranchAddress("gsigmadcaxy",                            &tru_gsigmadcaxy);
0231   tInTrue -> SetBranchAddress("gsigmadacz",                             &tru_gsigmadacz);
0232   tInTrue -> SetBranchAddress("gvx",                                    &tru_gvx);
0233   tInTrue -> SetBranchAddress("gvy",                                    &tru_gvy);
0234   tInTrue -> SetBranchAddress("gvz",                                    &tru_gvz);
0235   tInTrue -> SetBranchAddress("fracnmvtxmatched",                       &tru_fracnmvtxmatched);
0236   tInTrue -> SetBranchAddress("fracninttmatched",                       &tru_fracninttmatched);
0237   tInTrue -> SetBranchAddress("fracntpcmatched",                        &tru_fracntpcmatched);
0238 
0239   tInReco -> SetBranchAddress("evtid",                                  &rec_evtid);
0240   tInReco -> SetBranchAddress("trkid",                                  &rec_trkid);
0241   tInReco -> SetBranchAddress("pt",                                     &rec_pt);
0242   tInReco -> SetBranchAddress("eta",                                    &rec_eta);
0243   tInReco -> SetBranchAddress("phi",                                    &rec_phi);
0244   tInReco -> SetBranchAddress("nmvtxclust_trkmatcher",                  &rec_nmvtxclust_trkmatcher);
0245   tInReco -> SetBranchAddress("ninttclust_trkmatcher",                  &rec_ninttclust_trkmatcher);
0246   tInReco -> SetBranchAddress("ntpclust_trkmatcher",                    &rec_ntpclust_trkmatcher);
0247   tInReco -> SetBranchAddress("nmvtxclust_manual",                      &rec_nmvtxclust_manual);
0248   tInReco -> SetBranchAddress("ninttclust_manual",                      &rec_ninttclust_manual);
0249   tInReco -> SetBranchAddress("ntpcclust_manual",                       &rec_ntpcclust_manual);
0250   tInReco -> SetBranchAddress("nmvtxlayer_",                            &rec_nmvtxlayer_);
0251   tInReco -> SetBranchAddress("ninttlayer",                             &rec_ninttlayer);
0252   tInReco -> SetBranchAddress("ntpclayer",                              &rec_ntpclayer);
0253   tInReco -> SetBranchAddress("deltapt",                                &rec_deltapt);
0254   tInReco -> SetBranchAddress("quality",                                &rec_quality);
0255   tInReco -> SetBranchAddress("dcaxy",                                  &rec_dcaxy);
0256   tInReco -> SetBranchAddress("dcaz",                                   &rec_dcaz);
0257   tInReco -> SetBranchAddress("sigmadcaxy",                             &rec_sigmadcaxy);
0258   tInReco -> SetBranchAddress("sigmadacz",                              &rec_sigmadacz);
0259   tInReco -> SetBranchAddress("vx",                                     &rec_vx);
0260   tInReco -> SetBranchAddress("vy",                                     &rec_vy);
0261   tInReco -> SetBranchAddress("vz",                                     &rec_vz);
0262   tInReco -> SetBranchAddress("gtrkid",                                 &rec_gtrkid);
0263   tInReco -> SetBranchAddress("gpt",                                    &rec_gpt);
0264   tInReco -> SetBranchAddress("geta",                                   &rec_geta);
0265   tInReco -> SetBranchAddress("gphi",                                   &rec_gphi);
0266   tInReco -> SetBranchAddress("gnmvtxclust_trkmatcher",                 &rec_gnmvtxclust_trkmatcher);
0267   tInReco -> SetBranchAddress("gninttclust_trkmatcher",                 &rec_gninttclust_trkmatcher);
0268   tInReco -> SetBranchAddress("gntpclust_trkmatchergnmvtxclust_manual", &rec_gntpclust_trkmatchergnmvtxclust_manual);
0269   tInReco -> SetBranchAddress("gninttclust_manual",                     &rec_gninttclust_manual);
0270   tInReco -> SetBranchAddress("gntpcclust_manual",                      &rec_gntpcclust_manual);
0271   tInReco -> SetBranchAddress("gnmvtxlayer",                            &rec_gnmvtxlayer);
0272   tInReco -> SetBranchAddress("gninttlayer",                            &rec_gninttlayer);
0273   tInReco -> SetBranchAddress("gntpclayer",                             &rec_gntpclayer);
0274   tInReco -> SetBranchAddress("gdeltapt",                               &rec_gdeltapt);
0275   tInReco -> SetBranchAddress("gquality",                               &rec_gquality);
0276   tInReco -> SetBranchAddress("gdcaxy",                                 &rec_gdcaxy);
0277   tInReco -> SetBranchAddress("gdcaz",                                  &rec_gdcaz);
0278   tInReco -> SetBranchAddress("gsigmadcaxy",                            &rec_gsigmadcaxy);
0279   tInReco -> SetBranchAddress("gsigmadacz",                             &rec_gsigmadacz);
0280   tInReco -> SetBranchAddress("gvx",                                    &rec_gvx);
0281   tInReco -> SetBranchAddress("gvy",                                    &rec_gvy);
0282   tInReco -> SetBranchAddress("gvz",                                    &rec_gvz);
0283   tInReco -> SetBranchAddress("fracnmvtxmatched",                       &rec_fracnmvtxmatched);
0284   tInReco -> SetBranchAddress("fracninttmatched",                       &rec_fracninttmatched);
0285   tInReco -> SetBranchAddress("fracntpcmatched",                        &rec_fracntpcmatched);
0286   cout << "    Set input branches." << endl;
0287 
0288   // histogram indices
0289   enum Var {
0290     NTot,
0291     NIntt,
0292     NMvtx,
0293     NTpc,
0294     RTot,
0295     RIntt,
0296     RMvtx,
0297     RTpc,
0298     Phi,
0299     Eta,
0300     Pt,
0301     Frac
0302   };
0303   enum Type {
0304     Truth,
0305     Track,
0306     Weird,
0307     Normal
0308   };
0309   enum Comp {
0310     VsTruthPt,
0311     VsNumTpc
0312   };
0313 
0314   // output histogram base names
0315   const vector<vector<string>> vecHistBase = {
0316     {"hTruthNumTot",  "hTrackNumTot",  "hWeirdNumTot",  "hNormNumTot"},
0317     {"hTruthNumIntt", "hTrackNumIntt", "hWeirdNumIntt", "hNormNumIntt"},
0318     {"hTruthNumMvtx", "hTrackNumMvtx", "hWeirdNumMvtx", "hNormNumMvtx"},
0319     {"hTruthNumTpc",  "hTrackNumTpc",  "hWeirdNumTpc",  "hNormNumTpc"},
0320     {"hTruthRatTot",  "hTrackRatTot",  "hWeirdRatTot",  "hNormRatTot"},
0321     {"hTruthRatIntt", "hTrackRatIntt", "hWeirdRatIntt", "hNormRatIntt"},
0322     {"hTruthRatMvtx", "hTrackRatMvtx", "hWeirdRatMvtx", "hNormRatMvtx"},
0323     {"hTruthRatTpc",  "hTrackRatTpc",  "hWeirdRatTpc",  "hNormRatTpc"},
0324     {"hTruthPhi",     "hTrackPhi",     "hWeirdPhi",     "hNormPhi"},
0325     {"hTruthEta",     "hTrackEta",     "hWeirdEta",     "hNormEta"},
0326     {"hTruthPt",      "hTrackPt",      "hWeirdPt",      "hNormPt"},
0327     {"hTruthFrac",    "hTrackFrac",    "hWeirdFrac",    "hNormFrac"}
0328   };
0329   const size_t nHistRows  = vecHistBase.size();
0330   const size_t nHistTypes = vecHistBase[0].size();
0331 
0332   // 2D histogram name modifiers
0333   const vector<string> vecVsHistModifiers = {
0334     "VsTruthPt",
0335     "VsNumTpc"
0336   };
0337   const size_t nVsHistMods = vecVsHistModifiers.size();
0338 
0339   // axis titles
0340   const string         sCount("counts");
0341   const vector<string> vecBaseAxisVars = {
0342     "N^{tot} = N_{hit}^{mvtx} + N_{hit}^{intt} + N_{clust}^{tpc}",
0343     "N_{hit}^{intt}",
0344     "N_{hit}^{mvtx}",
0345     "N_{clust}^{tpc}",
0346     "N_{reco}^{tot} / N_{true}^{tot}",
0347     "N_{reco}^{intt} / N_{true}^{intt}",
0348     "N_{reco}^{mvtx} / N_{true}^{mvtx}",
0349     "N_{reco}^{tpc} / N_{true}^{tpc}",
0350     "#varphi",
0351     "#eta",
0352     "p_{T} [GeV/c]",
0353     "p_{T}^{reco} / p_{T}^{true}"
0354   };
0355   const vector<string> vecVsAxisVars = {
0356     "p_{T}^{true} [GeV/c]",
0357     "N_{clust}^{tpc}"
0358   };
0359 
0360   // output histogram no. of bins
0361   const uint32_t nNumBins  = 101;
0362   const uint32_t nRatBins  = 120;
0363   const uint32_t nEtaBins  = 80;
0364   const uint32_t nPhiBins  = 360;
0365   const uint32_t nPtBins   = 101;
0366   const uint32_t nFracBins = 110;
0367 
0368   // output histogram bin ranges
0369   const pair<float, float> xNumBins  = {-0.5,  100.5};
0370   const pair<float, float> xRatBins  = {-0.5,  5.5};
0371   const pair<float, float> xEtaBins  = {-2.,   2.};
0372   const pair<float, float> xPhiBins  = {-3.15, 3.15};
0373   const pair<float, float> xPtBins   = {-1.,   100.};
0374   const pair<float, float> xFracBins = {-0.5,  10.5};
0375 
0376   // output histogram base binning definitions
0377   vector<tuple<uint32_t, pair<float, float>>> vecBaseHistBins = {
0378     make_tuple(nNumBins,  xNumBins),
0379     make_tuple(nNumBins,  xNumBins),
0380     make_tuple(nNumBins,  xNumBins),
0381     make_tuple(nNumBins,  xNumBins),
0382     make_tuple(nRatBins,  xRatBins),
0383     make_tuple(nRatBins,  xRatBins),
0384     make_tuple(nRatBins,  xRatBins),
0385     make_tuple(nRatBins,  xRatBins),
0386     make_tuple(nPhiBins,  xPhiBins),
0387     make_tuple(nEtaBins,  xEtaBins),
0388     make_tuple(nPtBins,   xPtBins),
0389     make_tuple(nFracBins, xFracBins)
0390   };
0391 
0392   // output 2D histogram x-axis binning
0393   vector<tuple<uint32_t, pair<float, float>>> vecVsHistBins = {
0394     make_tuple(nPtBins,  xPtBins),
0395     make_tuple(nNumBins, xNumBins)
0396   };
0397 
0398   // make 1D histograms
0399   vector<vector<TH1D*>> vecHist1D(nHistRows);
0400   for (size_t iHistRow = 0; iHistRow < nHistRows; iHistRow++) {
0401     for (const string sHistBase : vecHistBase[iHistRow]) {
0402       vecHist1D[iHistRow].push_back(
0403         new TH1D(
0404           sHistBase.data(),
0405           "",
0406           get<0>(vecBaseHistBins[iHistRow]),
0407           get<1>(vecBaseHistBins[iHistRow]).first,
0408           get<1>(vecBaseHistBins[iHistRow]).second
0409         )
0410       );
0411     }  // end type loop
0412   }  // end row loop
0413 
0414   // make 2D histograms
0415   vector<vector<vector<TH2D*>>> vecHist2D(nHistRows, vector<vector<TH2D*>>(nHistTypes));
0416   for (size_t iHistRow = 0; iHistRow < nHistRows; iHistRow++) {
0417     for (size_t iHistType = 0; iHistType < nHistTypes; iHistType++) {
0418       for (size_t iVsHistMod = 0; iVsHistMod < nVsHistMods; iVsHistMod++) {
0419         const string sHistName2D = vecHistBase[iHistRow][iHistType] + vecVsHistModifiers[iVsHistMod];
0420         vecHist2D[iHistRow][iHistType].push_back(
0421           new TH2D(
0422             sHistName2D.data(),
0423             "",
0424             get<0>(vecVsHistBins[iVsHistMod]),
0425             get<1>(vecVsHistBins[iVsHistMod]).first,
0426             get<1>(vecVsHistBins[iVsHistMod]).second,
0427             get<0>(vecBaseHistBins[iHistRow]),
0428             get<1>(vecBaseHistBins[iHistRow]).first,
0429             get<1>(vecBaseHistBins[iHistRow]).second
0430           )
0431         );
0432       }  // end modifier loop
0433     }  // end type loop
0434   }  // end row loop
0435 
0436   // set errors
0437   for (auto histRow1D : vecHist1D) {
0438     for (auto hist1D : histRow1D) {
0439       hist1D -> Sumw2();
0440     }
0441   }
0442 
0443   for (auto histRow2D : vecHist2D) {
0444     for (auto histType2D : histRow2D) {
0445       for (auto hist2D: histType2D) {
0446         hist2D -> Sumw2();
0447       }
0448     }
0449   }
0450 
0451   // grab no. of entries
0452   const int64_t nTrueEntries = tInTrue -> GetEntries();
0453   const int64_t nRecoEntries = tInReco -> GetEntries(); 
0454   cout << "    Beginning truth particle loop: " << nTrueEntries << " to process" << endl;
0455 
0456   // loop over truth particles
0457   int64_t nTrueBytes = 0;
0458   for (int64_t iTrueEntry = 0; iTrueEntry < nTrueEntries; iTrueEntry++) {
0459 
0460     // grab truth particle entry
0461     const int64_t trueBytes = tInTrue -> GetEntry(iTrueEntry);
0462     if (trueBytes < 0) {
0463       cerr << "PANIC: issue with entry " << iTrueEntry << "! Aborting loop!\n" << endl;
0464       break;
0465     } else {
0466       nTrueBytes += trueBytes;
0467     }
0468 
0469     const int64_t iTrueProg = iTrueEntry + 1;
0470     if (iTrueProg == nTrueEntries) {
0471       cout << "      Processing entry " << iTrueProg << "/" << nTrueEntries << "..." << endl;
0472     } else {
0473       cout << "      Processing entry " << iTrueProg << "/" << nTrueEntries << "...\r" << flush;
0474     }
0475 
0476     // run calculations
0477     const float tru_gnclust = tru_gnmvtxclust_trkmatcher + tru_gninttclust_trkmatcher + tru_gntpcclust_manual;
0478 
0479     // check if near sector
0480     bool isNearSector = false;
0481     if (doPhiCut) {
0482       for (size_t iSector = 0; iSector < NSectors; iSector++) {
0483         const float cutVal = sigCutVal * phiSectors[iSector].second;
0484         const float minPhi = phiSectors[iSector].first - cutVal;
0485         const float maxPhi = phiSectors[iSector].first + cutVal;
0486         const bool  isNear = ((tru_gphi >= minPhi) && (tru_gphi <= maxPhi));
0487         if (isNear) {
0488           isNearSector = true;
0489           break;
0490         }
0491       }  // end sector loop
0492     }  // end if (doPhiCut)
0493 
0494     // apply cuts
0495     const bool isInZVtxCut  = ((tru_gvz >= zVtxRange.first) && (tru_gvz <= zVtxRange.second));
0496     if (doZVtxCut && !isInZVtxCut) continue;
0497     if (doPhiCut  && isNearSector) continue;
0498 
0499 
0500     // fill truth 1D histograms
0501     vecHist1D[Var::NTot][Type::Truth]  -> Fill(tru_gnclust);
0502     vecHist1D[Var::NIntt][Type::Truth] -> Fill(tru_gninttclust_trkmatcher);
0503     vecHist1D[Var::NMvtx][Type::Truth] -> Fill(tru_gnmvtxclust_trkmatcher);
0504     vecHist1D[Var::NTpc][Type::Truth]  -> Fill(tru_gntpcclust_manual);
0505     vecHist1D[Var::RTot][Type::Truth]  -> Fill(1.);
0506     vecHist1D[Var::RIntt][Type::Truth] -> Fill(1.);
0507     vecHist1D[Var::RMvtx][Type::Truth] -> Fill(1.);
0508     vecHist1D[Var::RTpc][Type::Truth]  -> Fill(1.);
0509     vecHist1D[Var::Phi][Type::Truth]   -> Fill(tru_gphi);
0510     vecHist1D[Var::Eta][Type::Truth]   -> Fill(tru_geta);
0511     vecHist1D[Var::Pt][Type::Truth]    -> Fill(tru_gpt);
0512     vecHist1D[Var::Frac][Type::Truth]  -> Fill(1.);
0513 
0514     // fill truth 2D histograms
0515     vecHist2D[Var::NTot][Type::Truth][Comp::VsTruthPt]  -> Fill(tru_gpt, tru_gnclust);
0516     vecHist2D[Var::NIntt][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, tru_gninttclust_trkmatcher);
0517     vecHist2D[Var::NMvtx][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, tru_gnmvtxclust_trkmatcher);
0518     vecHist2D[Var::NTpc][Type::Truth][Comp::VsTruthPt]  -> Fill(tru_gpt, tru_gntpcclust_manual);
0519     vecHist2D[Var::RTot][Type::Truth][Comp::VsTruthPt]  -> Fill(tru_gpt, 1.);
0520     vecHist2D[Var::RIntt][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, 1.);
0521     vecHist2D[Var::RMvtx][Type::Truth][Comp::VsTruthPt] -> Fill(tru_gpt, 1.);
0522     vecHist2D[Var::RTpc][Type::Truth][Comp::VsTruthPt]  -> Fill(tru_gpt, 1.);
0523     vecHist2D[Var::Phi][Type::Truth][Comp::VsTruthPt]   -> Fill(tru_gpt, tru_gphi);
0524     vecHist2D[Var::Eta][Type::Truth][Comp::VsTruthPt]   -> Fill(tru_gpt, tru_geta);
0525     vecHist2D[Var::Pt][Type::Truth][Comp::VsTruthPt]    -> Fill(tru_gpt, tru_gpt);
0526     vecHist2D[Var::Frac][Type::Truth][Comp::VsTruthPt]  -> Fill(tru_gpt, 1.);
0527 
0528     vecHist2D[Var::NTot][Type::Truth][Comp::VsNumTpc]  -> Fill(tru_ntpclust_trkmatcher, tru_gnclust);
0529     vecHist2D[Var::NIntt][Type::Truth][Comp::VsNumTpc] -> Fill(tru_ntpclust_trkmatcher, tru_gninttclust_trkmatcher);
0530     vecHist2D[Var::NMvtx][Type::Truth][Comp::VsNumTpc] -> Fill(tru_ntpclust_trkmatcher, tru_gnmvtxclust_trkmatcher);
0531     vecHist2D[Var::NTpc][Type::Truth][Comp::VsNumTpc]  -> Fill(tru_ntpclust_trkmatcher, tru_gntpcclust_manual);
0532     vecHist2D[Var::RTot][Type::Truth][Comp::VsNumTpc]  -> Fill(tru_ntpclust_trkmatcher, 1.);
0533     vecHist2D[Var::RIntt][Type::Truth][Comp::VsNumTpc] -> Fill(tru_ntpclust_trkmatcher, 1.);
0534     vecHist2D[Var::RMvtx][Type::Truth][Comp::VsNumTpc] -> Fill(tru_ntpclust_trkmatcher, 1.);
0535     vecHist2D[Var::RTpc][Type::Truth][Comp::VsNumTpc]  -> Fill(tru_ntpclust_trkmatcher, 1.);
0536     vecHist2D[Var::Phi][Type::Truth][Comp::VsNumTpc]   -> Fill(tru_ntpclust_trkmatcher, tru_gphi);
0537     vecHist2D[Var::Eta][Type::Truth][Comp::VsNumTpc]   -> Fill(tru_ntpclust_trkmatcher, tru_geta);
0538     vecHist2D[Var::Pt][Type::Truth][Comp::VsNumTpc]    -> Fill(tru_ntpclust_trkmatcher, tru_gpt);
0539     vecHist2D[Var::Frac][Type::Truth][Comp::VsNumTpc]  -> Fill(tru_ntpclust_trkmatcher, 1.);
0540   }  // end truth particle loop
0541 
0542   // announce next entry loop
0543   cout << "    Finished truth particle loop.\n"
0544        << "    Beginning reconstructed track loop: " << nRecoEntries << " to process"
0545        << endl;
0546 
0547   // loop over reco tracks
0548   int64_t nRecoBytes = 0;
0549   for (int64_t iRecoEntry = 0; iRecoEntry < nRecoEntries; iRecoEntry++) {
0550 
0551     // grab reco track entry
0552     const int64_t recoBytes = tInReco -> GetEntry(iRecoEntry);
0553     if (recoBytes < 0) {
0554       cerr << "PANIC: issue with entry " << iRecoEntry << "! Aborting loop!\n" << endl;
0555       break;
0556     } else {
0557       nRecoBytes += recoBytes;
0558     }
0559 
0560     const int64_t iRecoProg = iRecoEntry + 1;
0561     if (iRecoProg == nRecoEntries) {
0562       cout << "      Processing entry " << iRecoProg << "/" << nRecoEntries << "..." << endl;
0563     } else {
0564       cout << "      Processing entry " << iRecoProg << "/" << nRecoEntries << "...\r" << flush;
0565     }
0566 
0567     // run calculations
0568     const double rec_nclus  = rec_ninttclust_trkmatcher + rec_nmvtxclust_trkmatcher + rec_ntpclust_trkmatcher;
0569     const double rec_gnclus = rec_gninttclust_trkmatcher + rec_gnmvtxclust_trkmatcher + rec_gntpcclust_manual;
0570     const double rec_rnclus = rec_nclus / rec_gnclus;
0571     const double rec_rintt  = rec_ninttclust_trkmatcher / rec_gninttclust_trkmatcher;
0572     const double rec_rmaps  = rec_nmvtxclust_trkmatcher / rec_gnmvtxclust_trkmatcher;
0573     const double rec_rtpc   = rec_ntpclust_trkmatcher / rec_gntpcclust_manual;
0574     const double rec_ptfrac = rec_pt / rec_gpt;
0575 
0576     // check if near sector
0577     bool isNearSector = false;
0578     if (doPhiCut) {
0579       for (size_t iSector = 0; iSector < NSectors; iSector++) {
0580         const float cutVal = sigCutVal * phiSectors[iSector].second;
0581         const float minPhi = phiSectors[iSector].first - cutVal;
0582         const float maxPhi = phiSectors[iSector].first + cutVal;
0583         const bool  isNear = ((rec_phi >= minPhi) && (rec_phi <= maxPhi));
0584         if (isNear) {
0585           isNearSector = true;
0586           break;
0587         }
0588       }  // end sector loop
0589     }  // end if (doPhiCut)
0590 
0591     // apply cuts
0592     const bool isInZVtxCut = ((rec_vz >= zVtxRange.first) && (rec_vz <= zVtxRange.second));
0593     if (doZVtxCut && !isInZVtxCut) continue;
0594     if (doPhiCut  && isNearSector) continue;
0595 
0596     // fill all matched reco 1D histograms
0597     vecHist1D[Var::NTot][Type::Track]  -> Fill(rec_nclus);
0598     vecHist1D[Var::NIntt][Type::Track] -> Fill(rec_ninttclust_trkmatcher);
0599     vecHist1D[Var::NMvtx][Type::Track] -> Fill(rec_nmvtxclust_trkmatcher);
0600     vecHist1D[Var::NTpc][Type::Track]  -> Fill(rec_ntpclust_trkmatcher);
0601     vecHist1D[Var::RTot][Type::Track]  -> Fill(rec_rnclus);
0602     vecHist1D[Var::RIntt][Type::Track] -> Fill(rec_rintt);
0603     vecHist1D[Var::RMvtx][Type::Track] -> Fill(rec_rmaps);
0604     vecHist1D[Var::RTpc][Type::Track]  -> Fill(rec_rtpc);
0605     vecHist1D[Var::Phi][Type::Track]   -> Fill(rec_phi);
0606     vecHist1D[Var::Eta][Type::Track]   -> Fill(rec_eta);
0607     vecHist1D[Var::Pt][Type::Track]    -> Fill(rec_pt);
0608     vecHist1D[Var::Frac][Type::Track]  -> Fill(rec_ptfrac);
0609 
0610     // fill all matched reco 2D histograms
0611     vecHist2D[Var::NTot][Type::Track][Comp::VsTruthPt]  -> Fill(rec_gpt, rec_nclus);
0612     vecHist2D[Var::NIntt][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_ninttclust_trkmatcher);
0613     vecHist2D[Var::NMvtx][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_nmvtxclust_trkmatcher);
0614     vecHist2D[Var::NTpc][Type::Track][Comp::VsTruthPt]  -> Fill(rec_gpt, rec_ntpclust_trkmatcher);
0615     vecHist2D[Var::RTot][Type::Track][Comp::VsTruthPt]  -> Fill(rec_gpt, rec_rnclus);
0616     vecHist2D[Var::RIntt][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rintt);
0617     vecHist2D[Var::RMvtx][Type::Track][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rmaps);
0618     vecHist2D[Var::RTpc][Type::Track][Comp::VsTruthPt]  -> Fill(rec_gpt, rec_rtpc);
0619     vecHist2D[Var::Phi][Type::Track][Comp::VsTruthPt]   -> Fill(rec_gpt, rec_phi);
0620     vecHist2D[Var::Eta][Type::Track][Comp::VsTruthPt]   -> Fill(rec_gpt, rec_eta);
0621     vecHist2D[Var::Pt][Type::Track][Comp::VsTruthPt]    -> Fill(rec_gpt, rec_pt);
0622     vecHist2D[Var::Frac][Type::Track][Comp::VsTruthPt]  -> Fill(rec_gpt, rec_ptfrac);
0623 
0624     vecHist2D[Var::NTot][Type::Track][Comp::VsNumTpc]  -> Fill(rec_ntpclust_trkmatcher, rec_nclus);
0625     vecHist2D[Var::NIntt][Type::Track][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_ninttclust_trkmatcher);
0626     vecHist2D[Var::NMvtx][Type::Track][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_nmvtxclust_trkmatcher);
0627     vecHist2D[Var::NTpc][Type::Track][Comp::VsNumTpc]  -> Fill(rec_ntpclust_trkmatcher, rec_ntpclust_trkmatcher);
0628     vecHist2D[Var::RTot][Type::Track][Comp::VsNumTpc]  -> Fill(rec_ntpclust_trkmatcher, rec_rnclus);
0629     vecHist2D[Var::RIntt][Type::Track][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_rintt);
0630     vecHist2D[Var::RMvtx][Type::Track][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_rmaps);
0631     vecHist2D[Var::RTpc][Type::Track][Comp::VsNumTpc]  -> Fill(rec_ntpclust_trkmatcher, rec_rtpc);
0632     vecHist2D[Var::Phi][Type::Track][Comp::VsNumTpc]   -> Fill(rec_ntpclust_trkmatcher, rec_phi);
0633     vecHist2D[Var::Eta][Type::Track][Comp::VsNumTpc]   -> Fill(rec_ntpclust_trkmatcher, rec_eta);
0634     vecHist2D[Var::Pt][Type::Track][Comp::VsNumTpc]    -> Fill(rec_ntpclust_trkmatcher, rec_pt);
0635     vecHist2D[Var::Frac][Type::Track][Comp::VsNumTpc]  -> Fill(rec_ntpclust_trkmatcher, rec_ptfrac);
0636 
0637     // fill weird and normal matched reco 1D histograms
0638     const bool isNormalTrack = ((rec_ptfrac >= oddPtFrac.first) && (rec_ptfrac <= oddPtFrac.second));
0639     if (isNormalTrack) {
0640       vecHist1D[Var::NTot][Type::Normal]  -> Fill(rec_nclus);
0641       vecHist1D[Var::NIntt][Type::Normal] -> Fill(rec_ninttclust_trkmatcher);
0642       vecHist1D[Var::NMvtx][Type::Normal] -> Fill(rec_nmvtxclust_trkmatcher);
0643       vecHist1D[Var::NTpc][Type::Normal]  -> Fill(rec_ntpclust_trkmatcher);
0644       vecHist1D[Var::RTot][Type::Normal]  -> Fill(rec_rnclus);
0645       vecHist1D[Var::RIntt][Type::Normal] -> Fill(rec_rintt);
0646       vecHist1D[Var::RMvtx][Type::Normal] -> Fill(rec_rmaps);
0647       vecHist1D[Var::RTpc][Type::Normal]  -> Fill(rec_rtpc);
0648       vecHist1D[Var::Phi][Type::Normal]   -> Fill(rec_phi);
0649       vecHist1D[Var::Eta][Type::Normal]   -> Fill(rec_eta);
0650       vecHist1D[Var::Pt][Type::Normal]    -> Fill(rec_pt);
0651       vecHist1D[Var::Frac][Type::Normal]  -> Fill(rec_ptfrac);
0652 
0653       vecHist2D[Var::NTot][Type::Normal][Comp::VsTruthPt]  -> Fill(rec_gpt, rec_nclus);
0654       vecHist2D[Var::NIntt][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_ninttclust_trkmatcher);
0655       vecHist2D[Var::NMvtx][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_nmvtxclust_trkmatcher);
0656       vecHist2D[Var::NTpc][Type::Normal][Comp::VsTruthPt]  -> Fill(rec_gpt, rec_ntpclust_trkmatcher);
0657       vecHist2D[Var::RTot][Type::Normal][Comp::VsTruthPt]  -> Fill(rec_gpt, rec_rnclus);
0658       vecHist2D[Var::RIntt][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rintt);
0659       vecHist2D[Var::RMvtx][Type::Normal][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rmaps);
0660       vecHist2D[Var::RTpc][Type::Normal][Comp::VsTruthPt]  -> Fill(rec_gpt, rec_rtpc);
0661       vecHist2D[Var::Phi][Type::Normal][Comp::VsTruthPt]   -> Fill(rec_gpt, rec_phi);
0662       vecHist2D[Var::Eta][Type::Normal][Comp::VsTruthPt]   -> Fill(rec_gpt, rec_eta);
0663       vecHist2D[Var::Pt][Type::Normal][Comp::VsTruthPt]    -> Fill(rec_gpt, rec_pt);
0664       vecHist2D[Var::Frac][Type::Normal][Comp::VsTruthPt]  -> Fill(rec_gpt, rec_ptfrac);
0665 
0666       vecHist2D[Var::NTot][Type::Normal][Comp::VsNumTpc]  -> Fill(rec_ntpclust_trkmatcher, rec_nclus);
0667       vecHist2D[Var::NIntt][Type::Normal][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_ninttclust_trkmatcher);
0668       vecHist2D[Var::NMvtx][Type::Normal][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_nmvtxclust_trkmatcher);
0669       vecHist2D[Var::NTpc][Type::Normal][Comp::VsNumTpc]  -> Fill(rec_ntpclust_trkmatcher, rec_ntpclust_trkmatcher);
0670       vecHist2D[Var::RTot][Type::Normal][Comp::VsNumTpc]  -> Fill(rec_ntpclust_trkmatcher, rec_rnclus);
0671       vecHist2D[Var::RIntt][Type::Normal][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_rintt);
0672       vecHist2D[Var::RMvtx][Type::Normal][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_rmaps);
0673       vecHist2D[Var::RTpc][Type::Normal][Comp::VsNumTpc]  -> Fill(rec_ntpclust_trkmatcher, rec_rtpc);
0674       vecHist2D[Var::Phi][Type::Normal][Comp::VsNumTpc]   -> Fill(rec_ntpclust_trkmatcher, rec_phi);
0675       vecHist2D[Var::Eta][Type::Normal][Comp::VsNumTpc]   -> Fill(rec_ntpclust_trkmatcher, rec_eta);
0676       vecHist2D[Var::Pt][Type::Normal][Comp::VsNumTpc]    -> Fill(rec_ntpclust_trkmatcher, rec_pt);
0677       vecHist2D[Var::Frac][Type::Normal][Comp::VsNumTpc]  -> Fill(rec_ntpclust_trkmatcher, rec_ptfrac);
0678     } else {
0679       vecHist1D[Var::NTot][Type::Weird]  -> Fill(rec_nclus);
0680       vecHist1D[Var::NIntt][Type::Weird] -> Fill(rec_ninttclust_trkmatcher);
0681       vecHist1D[Var::NMvtx][Type::Weird] -> Fill(rec_nmvtxclust_trkmatcher);
0682       vecHist1D[Var::NTpc][Type::Weird]  -> Fill(rec_ntpclust_trkmatcher);
0683       vecHist1D[Var::RTot][Type::Weird]  -> Fill(rec_rnclus);
0684       vecHist1D[Var::RIntt][Type::Weird] -> Fill(rec_rintt);
0685       vecHist1D[Var::RMvtx][Type::Weird] -> Fill(rec_rmaps);
0686       vecHist1D[Var::RTpc][Type::Weird]  -> Fill(rec_rtpc);
0687       vecHist1D[Var::Phi][Type::Weird]   -> Fill(rec_phi);
0688       vecHist1D[Var::Eta][Type::Weird]   -> Fill(rec_eta);
0689       vecHist1D[Var::Pt][Type::Weird]    -> Fill(rec_pt);
0690       vecHist1D[Var::Frac][Type::Weird]  -> Fill(rec_ptfrac);
0691 
0692       vecHist2D[Var::NTot][Type::Weird][Comp::VsTruthPt]  -> Fill(rec_gpt, rec_nclus);
0693       vecHist2D[Var::NIntt][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_ninttclust_trkmatcher);
0694       vecHist2D[Var::NMvtx][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_nmvtxclust_trkmatcher);
0695       vecHist2D[Var::NTpc][Type::Weird][Comp::VsTruthPt]  -> Fill(rec_gpt, rec_ntpclust_trkmatcher);
0696       vecHist2D[Var::RTot][Type::Weird][Comp::VsTruthPt]  -> Fill(rec_gpt, rec_rnclus);
0697       vecHist2D[Var::RIntt][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rintt);
0698       vecHist2D[Var::RMvtx][Type::Weird][Comp::VsTruthPt] -> Fill(rec_gpt, rec_rmaps);
0699       vecHist2D[Var::RTpc][Type::Weird][Comp::VsTruthPt]  -> Fill(rec_gpt, rec_rtpc);
0700       vecHist2D[Var::Phi][Type::Weird][Comp::VsTruthPt]   -> Fill(rec_gpt, rec_phi);
0701       vecHist2D[Var::Eta][Type::Weird][Comp::VsTruthPt]   -> Fill(rec_gpt, rec_eta);
0702       vecHist2D[Var::Pt][Type::Weird][Comp::VsTruthPt]    -> Fill(rec_gpt, rec_pt);
0703       vecHist2D[Var::Frac][Type::Weird][Comp::VsTruthPt]  -> Fill(rec_gpt, rec_ptfrac);
0704 
0705       vecHist2D[Var::NTot][Type::Weird][Comp::VsNumTpc]  -> Fill(rec_ntpclust_trkmatcher, rec_nclus);
0706       vecHist2D[Var::NIntt][Type::Weird][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_ninttclust_trkmatcher);
0707       vecHist2D[Var::NMvtx][Type::Weird][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_nmvtxclust_trkmatcher);
0708       vecHist2D[Var::NTpc][Type::Weird][Comp::VsNumTpc]  -> Fill(rec_ntpclust_trkmatcher, rec_ntpclust_trkmatcher);
0709       vecHist2D[Var::RTot][Type::Weird][Comp::VsNumTpc]  -> Fill(rec_ntpclust_trkmatcher, rec_rnclus);
0710       vecHist2D[Var::RIntt][Type::Weird][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_rintt);
0711       vecHist2D[Var::RMvtx][Type::Weird][Comp::VsNumTpc] -> Fill(rec_ntpclust_trkmatcher, rec_rmaps);
0712       vecHist2D[Var::RTpc][Type::Weird][Comp::VsNumTpc]  -> Fill(rec_ntpclust_trkmatcher, rec_rtpc);
0713       vecHist2D[Var::Phi][Type::Weird][Comp::VsNumTpc]   -> Fill(rec_ntpclust_trkmatcher, rec_phi);
0714       vecHist2D[Var::Eta][Type::Weird][Comp::VsNumTpc]   -> Fill(rec_ntpclust_trkmatcher, rec_eta);
0715       vecHist2D[Var::Pt][Type::Weird][Comp::VsNumTpc]    -> Fill(rec_ntpclust_trkmatcher, rec_pt);
0716       vecHist2D[Var::Frac][Type::Weird][Comp::VsNumTpc]  -> Fill(rec_ntpclust_trkmatcher, rec_ptfrac);
0717     }
0718   }  // end reco track loop
0719   cout << "    Finished reconstructed track loop."  << endl;
0720 
0721   // set axis titles
0722   size_t iVar = 0;
0723   for (auto histRow1D : vecHist1D) {
0724     for (auto hist1D : histRow1D) {
0725       hist1D -> GetXaxis() -> SetTitle(vecBaseAxisVars.at(iVar).data());
0726       hist1D -> GetYaxis() -> SetTitle(sCount.data());
0727     }
0728     ++iVar;
0729   }
0730   iVar = 0;
0731 
0732   size_t iComp = 0;
0733   for (auto histRow2D : vecHist2D) {
0734     for (auto histType2D : histRow2D) {
0735       iComp = 0;
0736       for (auto hist2D : histType2D) {
0737         hist2D -> GetXaxis() -> SetTitle(vecVsAxisVars.at(iComp).data());
0738         hist2D -> GetYaxis() -> SetTitle(vecBaseAxisVars.at(iVar).data());
0739         hist2D -> GetZaxis() -> SetTitle(sCount.data());
0740         ++iComp;
0741       }
0742     }
0743     ++iVar;
0744   }
0745   cout << "    Set axis titles." << endl;
0746 
0747   // save histograms
0748   fOutput -> cd();
0749   for (auto histRow1D : vecHist1D) {
0750     for (auto hist1D : histRow1D) {
0751       hist1D -> Write();
0752     }
0753   }
0754   for (auto histRow2D : vecHist2D) {
0755     for (auto histType2D : histRow2D) {
0756       for (auto hist2D: histType2D) {
0757         hist2D -> Write();
0758       }
0759     }
0760   }
0761   cout << "    Saved histograms." << endl;
0762 
0763   // close files
0764   fOutput -> cd();
0765   fOutput -> Close();
0766   fInTrue -> cd();
0767   fInTrue -> Close();
0768   fInReco -> cd();
0769   fInReco -> Close();
0770 
0771   // exit
0772   cout << "  Finished new matcher plot script!\n" << endl;
0773   return;
0774 
0775 }  // end 'MakeNewMatcherTuplePlots()'
0776 
0777 // end ------------------------------------------------------------------------
0778