28 #include <TPaveText.h>
29 #include <TDirectory.h>
45 if (config.has_value()) {
46 m_config = config.value();
50 m_vecHistDirs.clear();
51 m_vecRatioDirs.clear();
52 m_vecPlotDirs.clear();
53 m_vecTreeHists1D.clear();
54 m_vecTupleHists1D.clear();
55 m_vecOldHists1D.clear();
56 m_vecTreeHists2D.clear();
57 m_vecTupleHists2D.clear();
58 m_vecOldHists2D.clear();
77 cout <<
"\n Beginning track matcher comparison...\n"
94 cout <<
" Analysis:" << endl;
109 cout <<
" End:" << endl;
112 MakeRatiosAndPlots(m_vecTreeHists1D, m_vecTreeHists2D, Src::NewTree,
"VsNewTree");
113 MakeRatiosAndPlots(m_vecTupleHists1D, m_vecTupleHists2D, Src::NewTuple,
"VsNewTuple");
119 cout <<
" Finished track matcher comparison!\n" << endl;
130 m_outFile =
new TFile(m_config.outFileName.data(),
"recreate");
132 cerr <<
"PANIC: couldn't open output file!" << endl;
135 cout <<
" Opened output file." << endl;
138 m_vecHistDirs.resize(m_const.nDirHist);
139 m_vecRatioDirs.resize(m_const.nDirRatio);
140 m_vecPlotDirs.resize(m_const.nDirPlot);
142 m_vecHistDirs[Src::NewTree] = (TDirectory*) m_outFile -> mkdir(m_config.histDirNames.at(Src::NewTree).data());
143 m_vecHistDirs[Src::NewTuple] = (TDirectory*) m_outFile -> mkdir(m_config.histDirNames.at(Src::NewTuple).data());
144 m_vecHistDirs[Src::OldTuple] = (TDirectory*) m_outFile -> mkdir(m_config.histDirNames.at(Src::OldTuple).data());
145 m_vecRatioDirs[Src::NewTree] = (TDirectory*) m_outFile -> mkdir(m_config.ratioDirNames.at(Src::NewTree).data());
146 m_vecRatioDirs[Src::NewTuple] = (TDirectory*) m_outFile -> mkdir(m_config.ratioDirNames.at(Src::NewTuple).data());
147 m_vecPlotDirs[Src::NewTree] = (TDirectory*) m_outFile -> mkdir(m_config.plotDirNames.at(Src::NewTree).data());
148 m_vecPlotDirs[Src::NewTuple] = (TDirectory*) m_outFile -> mkdir(m_config.plotDirNames.at(Src::NewTuple).data());
151 cout <<
" Created output directories." << endl;
161 m_treeInFileTrue =
new TFile(m_config.newInFileName.data(),
"read");
162 m_tupleInFileTrue =
new TFile(m_config.newInFileName.data(),
"read");
163 m_oldInFileTrue =
new TFile(m_config.oldInFileName.data(),
"read");
164 if (!m_treeInFileTrue || !m_tupleInFileTrue || !m_oldInFileTrue) {
165 cerr <<
"PANIC: couldn't open an input file!\n"
166 <<
" m_treeInFileTrue = " << m_treeInFileTrue <<
"\n"
167 <<
" m_tupleInFileTrue = " << m_tupleInFileTrue <<
"\n"
168 <<
" m_oldInFileTrue = " << m_oldInFileTrue
170 assert(m_treeInFileTrue && m_tupleInFileTrue && m_oldInFileTrue);
172 cout <<
" Opened truth input files." << endl;
175 m_treeInFileReco =
new TFile(m_config.newInFileName.data(),
"read");
176 m_tupleInFileReco =
new TFile(m_config.newInFileName.data(),
"read");
177 m_oldInFileReco =
new TFile(m_config.oldInFileName.data(),
"read");
178 if (!m_treeInFileReco || !m_tupleInFileReco || !m_oldInFileReco) {
179 cerr <<
"PANIC: couldn't open an input file!\n"
180 <<
" m_treeInFileReco = " << m_treeInFileReco <<
"\n"
181 <<
" m_tupleInFileReco = " << m_tupleInFileReco <<
"\n"
182 <<
" m_oldInFileReco = " << m_oldInFileReco
184 assert(m_treeInFileReco && m_tupleInFileReco && m_oldInFileReco);
186 cout <<
" Opened reco input files." << endl;
189 m_tTreeTrue = (TTree*) m_treeInFileTrue ->
Get(m_config.newTreeTrueName.data());
190 m_ntTupleTrue = (TNtuple*) m_tupleInFileTrue ->
Get(m_config.newTupleTrueName.data());
191 m_ntOldTrue = (TNtuple*) m_oldInFileTrue ->
Get(m_config.oldTupleTrueName.data());
192 if (!m_tTreeTrue || !m_ntTupleTrue || !m_ntOldTrue) {
193 cerr <<
"PANIC: couldn't grab an input truth tree/tuple!\n"
194 <<
" m_tTreeTrue = " << m_tTreeTrue <<
"\n"
195 <<
" m_ntTupleTrue = " << m_ntTupleTrue <<
"\n"
196 <<
" m_ntOldTrue = " << m_ntOldTrue
198 assert(m_tTreeTrue && m_ntTupleTrue && m_ntOldTrue);
200 cout <<
" Grabbed input truth trees/tuples." << endl;
203 m_tTreeReco = (TTree*) m_treeInFileReco ->
Get(m_config.newTreeRecoName.data());
204 m_ntTupleReco = (TNtuple*) m_tupleInFileReco ->
Get(m_config.newTupleRecoName.data());
205 m_ntOldReco = (TNtuple*) m_oldInFileReco ->
Get(m_config.oldTupleRecoName.data());
206 if (!m_tTreeReco || !m_ntTupleReco || !m_ntOldReco) {
207 cerr <<
"PANIC: couldn't grab an input truth tree/tuple!\n"
208 <<
" m_tTreeReco = " << m_tTreeReco <<
"\n"
209 <<
" m_ntTupleReco = " << m_ntTupleReco <<
"\n"
210 <<
" m_ntOldReco = " << m_ntOldReco
212 assert(m_tTreeReco && m_ntTupleReco && m_ntOldReco);
216 cout <<
" Grabbed input truth trees/tuples." << endl;
226 const size_t nHistRows = m_hist.vecNameBase.size();
227 const size_t nHistTypes = m_hist.vecNameBase[0].size();
228 const size_t nVsHistMods = m_hist.vecVsModifiers.size();
229 cout <<
" Initializing histograms." << endl;
232 vector<tuple<uint32_t, pair<float, float>>> vecBaseHistBins = m_hist.GetVecHistBins();
233 vector<tuple<uint32_t, pair<float, float>>> vecVsHistBins = m_hist.GetVecVsHistBins();
236 TH1::SetDefaultSumw2(
true);
237 TH2::SetDefaultSumw2(
true);
240 m_vecTreeHists1D.resize(nHistRows);
241 m_vecTupleHists1D.resize(nHistRows);
242 m_vecOldHists1D.resize(nHistRows);
243 for (
size_t iHistRow = 0; iHistRow < nHistRows; iHistRow++) {
244 for (
size_t iHistType = 0; iHistType < nHistTypes; iHistType++) {
247 const string sTreeHist1D = m_hist.vecNameBase[iHistRow][iHistType] +
"_" + m_config.newTreeLabel;
248 const string sTupleHist1D = m_hist.vecNameBase[iHistRow][iHistType] +
"_" + m_config.newTupleLabel;
249 const string sOldHist1D = m_hist.vecNameBase[iHistRow][iHistType] +
"_" + m_config.oldTupleLabel;
252 m_vecTreeHists1D[iHistRow].push_back(
256 get<0>(vecBaseHistBins[iHistRow]),
257 get<1>(vecBaseHistBins[iHistRow]).first,
258 get<1>(vecBaseHistBins[iHistRow]).second
261 m_vecTupleHists1D[iHistRow].push_back(
265 get<0>(vecBaseHistBins[iHistRow]),
266 get<1>(vecBaseHistBins[iHistRow]).first,
267 get<1>(vecBaseHistBins[iHistRow]).second
270 m_vecOldHists1D[iHistRow].push_back(
274 get<0>(vecBaseHistBins[iHistRow]),
275 get<1>(vecBaseHistBins[iHistRow]).first,
276 get<1>(vecBaseHistBins[iHistRow]).second
281 m_vecTreeHists1D[iHistRow].back() ->
GetXaxis() ->
SetTitle(m_hist.vecBaseAxisVars.at(iHistRow).data());
282 m_vecTupleHists1D[iHistRow].back() ->
GetXaxis() ->
SetTitle(m_hist.vecBaseAxisVars.at(iHistRow).data());
283 m_vecOldHists1D[iHistRow].back() ->
GetXaxis() ->
SetTitle(m_hist.vecBaseAxisVars.at(iHistRow).data());
284 m_vecTreeHists1D[iHistRow].back() ->
GetYaxis() ->
SetTitle(m_config.count.data());
285 m_vecTupleHists1D[iHistRow].back() ->
GetYaxis() ->
SetTitle(m_config.count.data());
286 m_vecOldHists1D[iHistRow].back() ->
GetYaxis() ->
SetTitle(m_config.count.data());
289 cout <<
" Initialized 1D histograms." << endl;
292 m_vecTreeHists2D.resize(nHistRows);
293 m_vecTupleHists2D.resize(nHistRows);
294 m_vecOldHists2D.resize(nHistRows);
295 for (
size_t iHistRow = 0; iHistRow < nHistRows; iHistRow++) {
298 m_vecTreeHists2D[iHistRow].resize(nHistTypes);
299 m_vecTupleHists2D[iHistRow].resize(nHistTypes);
300 m_vecOldHists2D[iHistRow].resize(nHistTypes);
301 for (
size_t iHistType = 0; iHistType < nHistTypes; iHistType++) {
302 for (
size_t iVsHistMod = 0; iVsHistMod < nVsHistMods; iVsHistMod++) {
305 const string sTreeHist2D = m_hist.vecNameBase[iHistRow][iHistType] + m_hist.vecVsModifiers[iVsHistMod] +
"_" + m_config.newTreeLabel;
306 const string sTupleHist2D = m_hist.vecNameBase[iHistRow][iHistType] + m_hist.vecVsModifiers[iVsHistMod] +
"_" + m_config.newTupleLabel;
307 const string sOldHist2D = m_hist.vecNameBase[iHistRow][iHistType] + m_hist.vecVsModifiers[iVsHistMod] +
"_" + m_config.oldTupleLabel;
310 m_vecTreeHists2D[iHistRow][iHistType].push_back(
314 get<0>(vecVsHistBins[iVsHistMod]),
315 get<1>(vecVsHistBins[iVsHistMod]).first,
316 get<1>(vecVsHistBins[iVsHistMod]).second,
317 get<0>(vecBaseHistBins[iHistRow]),
318 get<1>(vecBaseHistBins[iHistRow]).first,
319 get<1>(vecBaseHistBins[iHistRow]).second
322 m_vecTupleHists2D[iHistRow][iHistType].push_back(
326 get<0>(vecVsHistBins[iVsHistMod]),
327 get<1>(vecVsHistBins[iVsHistMod]).first,
328 get<1>(vecVsHistBins[iVsHistMod]).second,
329 get<0>(vecBaseHistBins[iHistRow]),
330 get<1>(vecBaseHistBins[iHistRow]).first,
331 get<1>(vecBaseHistBins[iHistRow]).second
334 m_vecOldHists2D[iHistRow][iHistType].push_back(
338 get<0>(vecVsHistBins[iVsHistMod]),
339 get<1>(vecVsHistBins[iVsHistMod]).first,
340 get<1>(vecVsHistBins[iVsHistMod]).second,
341 get<0>(vecBaseHistBins[iHistRow]),
342 get<1>(vecBaseHistBins[iHistRow]).first,
343 get<1>(vecBaseHistBins[iHistRow]).second
348 m_vecTreeHists2D[iHistRow][iHistType].back() ->
GetXaxis() ->
SetTitle(m_hist.vecVsAxisVars.at(iVsHistMod).data());
349 m_vecTupleHists2D[iHistRow][iHistType].back() ->
GetXaxis() ->
SetTitle(m_hist.vecVsAxisVars.at(iVsHistMod).data());
350 m_vecOldHists2D[iHistRow][iHistType].back() ->
GetXaxis() ->
SetTitle(m_hist.vecVsAxisVars.at(iVsHistMod).data());
351 m_vecTreeHists2D[iHistRow][iHistType].back() ->
GetYaxis() ->
SetTitle(m_hist.vecBaseAxisVars.at(iHistRow).data());
352 m_vecTupleHists2D[iHistRow][iHistType].back() ->
GetYaxis() ->
SetTitle(m_hist.vecBaseAxisVars.at(iHistRow).data());
353 m_vecOldHists2D[iHistRow][iHistType].back() ->
GetYaxis() ->
SetTitle(m_hist.vecBaseAxisVars.at(iHistRow).data());
354 m_vecTreeHists2D[iHistRow][iHistType].back() ->
GetZaxis() ->
SetTitle(m_config.count.data());
355 m_vecTupleHists2D[iHistRow][iHistType].back() ->
GetZaxis() ->
SetTitle(m_config.count.data());
356 m_vecOldHists2D[iHistRow][iHistType].back() ->
GetZaxis() ->
SetTitle(m_config.count.data());
362 cout <<
" Initialized 2D output histograms." << endl;
372 cout <<
" Grabbing new matcher tree histograms:" << endl;
377 float tru_centrality;
378 int tru_ntrackmatches;
393 float tru_matchrat_intt;
394 float tru_matchrat_mvtx;
395 float tru_matchrat_tpc;
399 float rec_centrality;
400 int rec_ntrackmatches;
415 float rec_matchrat_intt;
416 float rec_matchrat_mvtx;
417 float rec_matchrat_tpc;
463 cout <<
" Set input branches." << endl;
466 const int64_t nTrueEntries = m_tTreeTrue -> GetEntries();
467 const int64_t nRecoEntries = m_tTreeReco -> GetEntries();
468 cout <<
" Beginning truth particle loop: " << nTrueEntries <<
" to process" << endl;
471 int64_t nTrueBytes = 0;
472 for (int64_t iTrueEntry = 0; iTrueEntry < nTrueEntries; iTrueEntry++) {
475 const int64_t trueBytes = m_tTreeTrue ->
GetEntry(iTrueEntry);
477 cerr <<
"PANIC: issue with entry " << iTrueEntry <<
"! Aborting loop!\n" << endl;
480 nTrueBytes += trueBytes;
483 const int64_t iTrueProg = iTrueEntry + 1;
484 if (iTrueProg == nTrueEntries) {
485 cout <<
" Processing entry " << iTrueProg <<
"/" << nTrueEntries <<
"..." << endl;
487 cout <<
" Processing entry " << iTrueProg <<
"/" << nTrueEntries <<
"...\r" <<
flush;
492 if (!tru_is_G4track)
continue;
497 (
double) tru_nclusintt,
499 (
double) tru_nclustpc,
518 FillHistogram1D(content, Type::Truth, m_vecTreeHists1D);
519 FillHistogram2D(content, Type::Truth, Comp::VsTruthPt, tru_trkpt, m_vecTreeHists2D);
520 FillHistogram2D(content, Type::Truth, Comp::VsNumTpc, tru_nclustpc, m_vecTreeHists2D);
524 cout <<
" Finished truth particle loop.\n"
525 <<
" Beginning reconstructed track loop: " << nRecoEntries <<
" to process"
530 int64_t nRecoBytes = 0;
531 for (int64_t iRecoEntry = 0; iRecoEntry < nRecoEntries; iRecoEntry++) {
534 const int64_t recoBytes = m_tTreeReco ->
GetEntry(iRecoEntry);
536 cerr <<
"PANIC: issue with entry " << iRecoEntry <<
"! Aborting loop!\n" << endl;
539 nRecoBytes += recoBytes;
542 const int64_t iRecoProg = iRecoEntry + 1;
543 if (iRecoProg == nRecoEntries) {
544 cout <<
" Processing entry " << iRecoProg <<
"/" << nRecoEntries <<
"..." << endl;
546 cout <<
" Processing entry " << iRecoProg <<
"/" << nRecoEntries <<
"...\r" <<
flush;
551 if (!rec_is_matched || !rec_is_Svtrack)
continue;
558 (
double) rec_nclusintt,
560 (
double) rec_nclustpc,
580 FillHistogram1D(content,
Type::Track, m_vecTreeHists1D);
581 FillHistogram2D(content,
Type::Track, Comp::VsTruthPt, rec_trkpt, m_vecTreeHists2D);
582 FillHistogram2D(content,
Type::Track, Comp::VsTruthPt, rec_nclustpc, m_vecTreeHists2D);
586 const bool isWeirdTrack =
true;
588 FillHistogram1D(content, Type::Weird, m_vecTreeHists1D);
589 FillHistogram2D(content, Type::Weird, Comp::VsTruthPt, rec_trkpt, m_vecTreeHists2D);
590 FillHistogram2D(content, Type::Weird, Comp::VsNumTpc, rec_nclustpc, m_vecTreeHists2D);
592 FillHistogram1D(content, Type::Normal, m_vecTreeHists1D);
593 FillHistogram2D(content, Type::Normal, Comp::VsTruthPt, rec_trkpt, m_vecTreeHists2D);
594 FillHistogram2D(content, Type::Normal, Comp::VsNumTpc, rec_nclustpc, m_vecTreeHists2D);
599 cout <<
" Finished reconstructed track loop.\n"
600 <<
" Finished getting histograms from new matcher cluster tree."
611 cout <<
" Grabbing new matcher tuple histograms:" << endl;
619 float tru_nmvtxclust_trkmatcher;
620 float tru_ninttclust_trkmatcher;
621 float tru_ntpclust_trkmatcher;
622 float tru_nmvtxclust_manual;
623 float tru_ninttclust_manual;
624 float tru_ntpcclust_manual;
625 float tru_nmvtxlayer_;
626 float tru_ninttlayer;
632 float tru_sigmadcaxy;
641 float tru_gnmvtxclust_trkmatcher;
642 float tru_gninttclust_trkmatcher;
643 float tru_gntpclust_trkmatcher;
644 float tru_gnmvtxclust_manual;
645 float tru_gninttclust_manual;
646 float tru_gntpcclust_manual;
647 float tru_gnmvtxlayer;
648 float tru_gninttlayer;
649 float tru_gntpclayer;
654 float tru_gsigmadcaxy;
655 float tru_gsigmadacz;
659 float tru_fracnmvtxmatched;
660 float tru_fracninttmatched;
661 float tru_fracntpcmatched;
668 float rec_nmvtxclust_trkmatcher;
669 float rec_ninttclust_trkmatcher;
670 float rec_ntpclust_trkmatcher;
671 float rec_nmvtxclust_manual;
672 float rec_ninttclust_manual;
673 float rec_ntpcclust_manual;
674 float rec_nmvtxlayer_;
675 float rec_ninttlayer;
681 float rec_sigmadcaxy;
690 float rec_gnmvtxclust_trkmatcher;
691 float rec_gninttclust_trkmatcher;
692 float rec_gntpclust_trkmatcher;
693 float rec_gnmvtxclust_manual;
694 float rec_gninttclust_manual;
695 float rec_gntpcclust_manual;
696 float rec_gnmvtxlayer;
697 float rec_gninttlayer;
698 float rec_gntpclayer;
703 float rec_gsigmadcaxy;
704 float rec_gsigmadacz;
708 float rec_fracnmvtxmatched;
709 float rec_fracninttmatched;
710 float rec_fracntpcmatched;
718 m_ntTupleTrue ->
SetBranchAddress(
"nmvtxclust_trkmatcher", &tru_nmvtxclust_trkmatcher);
719 m_ntTupleTrue ->
SetBranchAddress(
"ninttclust_trkmatcher", &tru_ninttclust_trkmatcher);
720 m_ntTupleTrue ->
SetBranchAddress(
"ntpclust_trkmatcher", &tru_ntpclust_trkmatcher);
721 m_ntTupleTrue ->
SetBranchAddress(
"nmvtxclust_manual", &tru_nmvtxclust_manual);
722 m_ntTupleTrue ->
SetBranchAddress(
"ninttclust_manual", &tru_ninttclust_manual);
723 m_ntTupleTrue ->
SetBranchAddress(
"ntpcclust_manual", &tru_ntpcclust_manual);
740 m_ntTupleTrue ->
SetBranchAddress(
"gnmvtxclust_trkmatcher",&tru_gnmvtxclust_trkmatcher);
741 m_ntTupleTrue ->
SetBranchAddress(
"gninttclust_trkmatcher",&tru_gninttclust_trkmatcher);
742 m_ntTupleTrue ->
SetBranchAddress(
"gntpclust_trkmatcher", &tru_gntpclust_trkmatcher);
743 m_ntTupleTrue ->
SetBranchAddress(
"gnmvtxclust_manual", &tru_gnmvtxclust_manual);
744 m_ntTupleTrue ->
SetBranchAddress(
"gninttclust_manual", &tru_gninttclust_manual);
745 m_ntTupleTrue ->
SetBranchAddress(
"gntpcclust_manual", &tru_gntpcclust_manual);
758 m_ntTupleTrue ->
SetBranchAddress(
"fracnmvtxmatched", &tru_fracnmvtxmatched);
759 m_ntTupleTrue ->
SetBranchAddress(
"fracninttmatched", &tru_fracninttmatched);
767 m_ntTupleReco ->
SetBranchAddress(
"nmvtxclust_trkmatcher", &rec_nmvtxclust_trkmatcher);
768 m_ntTupleReco ->
SetBranchAddress(
"ninttclust_trkmatcher", &rec_ninttclust_trkmatcher);
769 m_ntTupleReco ->
SetBranchAddress(
"ntpclust_trkmatcher", &rec_ntpclust_trkmatcher);
770 m_ntTupleReco ->
SetBranchAddress(
"nmvtxclust_manual", &rec_nmvtxclust_manual);
771 m_ntTupleReco ->
SetBranchAddress(
"ninttclust_manual", &rec_ninttclust_manual);
772 m_ntTupleReco ->
SetBranchAddress(
"ntpcclust_manual", &rec_ntpcclust_manual);
789 m_ntTupleReco ->
SetBranchAddress(
"gnmvtxclust_trkmatcher", &rec_gnmvtxclust_trkmatcher);
790 m_ntTupleReco ->
SetBranchAddress(
"gninttclust_trkmatcher", &rec_gninttclust_trkmatcher);
791 m_ntTupleReco ->
SetBranchAddress(
"gntpclust_trkmatcher", &rec_gntpclust_trkmatcher);
792 m_ntTupleReco ->
SetBranchAddress(
"gnmvtxclust_manual", &rec_gnmvtxclust_manual);
793 m_ntTupleReco ->
SetBranchAddress(
"gninttclust_manual", &rec_gninttclust_manual);
794 m_ntTupleReco ->
SetBranchAddress(
"gntpcclust_manual", &rec_gntpcclust_manual);
807 m_ntTupleReco ->
SetBranchAddress(
"fracnmvtxmatched", &rec_fracnmvtxmatched);
808 m_ntTupleReco ->
SetBranchAddress(
"fracninttmatched", &rec_fracninttmatched);
810 cout <<
" Set input branches." << endl;
813 const int64_t nTrueEntries = m_ntTupleTrue -> GetEntries();
814 const int64_t nRecoEntries = m_ntTupleReco -> GetEntries();
815 cout <<
" Beginning truth particle loop: " << nTrueEntries <<
" to process" << endl;
818 int64_t nTrueBytes = 0;
819 for (int64_t iTrueEntry = 0; iTrueEntry < nTrueEntries; iTrueEntry++) {
822 const int64_t trueBytes = m_ntTupleTrue ->
GetEntry(iTrueEntry);
824 cerr <<
"PANIC: issue with entry " << iTrueEntry <<
"! Aborting loop!\n" << endl;
827 nTrueBytes += trueBytes;
830 const int64_t iTrueProg = iTrueEntry + 1;
831 if (iTrueProg == nTrueEntries) {
832 cout <<
" Processing entry " << iTrueProg <<
"/" << nTrueEntries <<
"..." << endl;
834 cout <<
" Processing entry " << iTrueProg <<
"/" << nTrueEntries <<
"...\r" <<
flush;
838 bool isNearSector =
false;
839 if (m_config.doPhiCut) {
840 isNearSector = IsNearSector(tru_gphi);
844 const bool isInZVtxCut = ((tru_gvz >= m_config.zVtxRange.first) && (tru_gvz <= m_config.zVtxRange.second));
845 if (m_config.doZVtxCut && !isInZVtxCut)
continue;
846 if (m_config.doPhiCut && isNearSector)
continue;
849 const float tru_gnclust = tru_gnmvtxclust_trkmatcher + tru_gninttclust_trkmatcher + tru_gntpclust_trkmatcher;
854 tru_gninttclust_trkmatcher,
855 tru_gnmvtxclust_trkmatcher,
856 tru_gntpclust_trkmatcher,
875 FillHistogram1D(content, Type::Truth, m_vecTupleHists1D);
876 FillHistogram2D(content, Type::Truth, Comp::VsTruthPt, tru_gpt, m_vecTupleHists2D);
877 FillHistogram2D(content, Type::Truth, Comp::VsNumTpc, tru_ntpclust_trkmatcher, m_vecTupleHists2D);
881 cout <<
" Finished truth particle loop.\n"
882 <<
" Beginning reconstructed track loop: " << nRecoEntries <<
" to process"
886 int64_t nRecoBytes = 0;
887 for (int64_t iRecoEntry = 0; iRecoEntry < nRecoEntries; iRecoEntry++) {
890 const int64_t recoBytes = m_ntTupleReco ->
GetEntry(iRecoEntry);
892 cerr <<
"PANIC: issue with entry " << iRecoEntry <<
"! Aborting loop!\n" << endl;
895 nRecoBytes += recoBytes;
898 const int64_t iRecoProg = iRecoEntry + 1;
899 if (iRecoProg == nRecoEntries) {
900 cout <<
" Processing entry " << iRecoProg <<
"/" << nRecoEntries <<
"..." << endl;
902 cout <<
" Processing entry " << iRecoProg <<
"/" << nRecoEntries <<
"...\r" <<
flush;
906 bool isNearSector =
false;
907 if (m_config.doPhiCut) {
908 isNearSector = IsNearSector(rec_phi);
912 const bool isInZVtxCut = ((rec_vz >= m_config.zVtxRange.first) && (rec_vz <= m_config.zVtxRange.second));
913 if (m_config.doZVtxCut && !isInZVtxCut)
continue;
914 if (m_config.doPhiCut && isNearSector)
continue;
918 const double rec_nclus = rec_ninttclust_trkmatcher + rec_nmvtxclust_trkmatcher + rec_ntpclust_trkmatcher;
919 const double rec_gnclus = rec_gninttclust_trkmatcher + rec_gnmvtxclust_trkmatcher + rec_gntpcclust_manual;
920 const double rec_rnclus = rec_nclus / rec_gnclus;
921 const double rec_rintt = rec_ninttclust_trkmatcher / rec_gninttclust_trkmatcher;
922 const double rec_rmaps = rec_nmvtxclust_trkmatcher / rec_gnmvtxclust_trkmatcher;
923 const double rec_rtpc = rec_ntpclust_trkmatcher / rec_gntpcclust_manual;
924 const double rec_ptfrac = rec_pt / rec_gpt;
925 const double rec_ptper = rec_deltapt / rec_pt;
926 const double rec_etaper = 1.;
927 const double rec_phiper = 1.;
928 const double rec_ptres = abs(rec_pt - rec_gpt) / rec_gpt;
929 const double rec_etares = abs(rec_eta - rec_geta) / rec_geta;
930 const double rec_phires = abs(rec_phi - rec_gphi) / rec_gphi;
935 rec_ninttclust_trkmatcher,
936 rec_nmvtxclust_trkmatcher,
937 rec_ntpclust_trkmatcher,
956 FillHistogram1D(content,
Type::Track, m_vecTupleHists1D);
957 FillHistogram2D(content,
Type::Track, Comp::VsTruthPt, rec_gpt, m_vecTupleHists2D);
958 FillHistogram2D(content,
Type::Track, Comp::VsNumTpc, rec_ntpclust_trkmatcher, m_vecTupleHists2D);
961 const bool isNormalTrack = ((rec_ptfrac >= m_config.oddPtFrac.first) && (rec_ptfrac <= m_config.oddPtFrac.second));
963 FillHistogram1D(content, Type::Normal, m_vecTupleHists1D);
964 FillHistogram2D(content, Type::Normal, Comp::VsTruthPt, rec_gpt, m_vecTupleHists2D);
965 FillHistogram2D(content, Type::Normal, Comp::VsNumTpc, rec_ntpclust_trkmatcher, m_vecTupleHists2D);
967 FillHistogram1D(content, Type::Weird, m_vecTupleHists1D);
968 FillHistogram2D(content, Type::Weird, Comp::VsTruthPt, rec_gpt, m_vecTupleHists2D);
969 FillHistogram2D(content, Type::Weird, Comp::VsNumTpc, rec_ntpclust_trkmatcher, m_vecTupleHists2D);
974 cout <<
" Finished reconstructed track loop.\n"
975 <<
" Finished getting histograms from new matcher track tuple."
986 cout <<
" Grabbing old matcher tuple histograms:" << endl;
1073 float tru_dca2dsigma;
1075 float tru_dca3dxysigma;
1077 float tru_dca3dzsigma;
1081 float tru_nfromtruth;
1084 float tru_nwrongmaps;
1086 float tru_nwrongintt;
1088 float tru_nwrongtpc;
1090 float tru_nwrongmms;
1092 float tru_nwrongtpc1;
1093 float tru_ntrutpc11;
1094 float tru_nwrongtpc11;
1096 float tru_nwrongtpc2;
1098 float tru_nwrongtpc3;
1099 float tru_layersfromtruth;
1106 float tru_nhittpcall;
1107 float tru_nhittpcin;
1108 float tru_nhittpcmid;
1109 float tru_nhittpcout;
1112 float tru_nclusintt;
1113 float tru_nclusmaps;
1162 float rec_dca2dsigma;
1164 float rec_dca3dxysigma;
1166 float rec_dca3dzsigma;
1199 float rec_nfromtruth;
1202 float rec_nwrongmaps;
1204 float rec_nwrongintt;
1206 float rec_nwrongtpc;
1208 float rec_nwrongmms;
1210 float rec_nwrongtpc1;
1211 float rec_ntrutpc11;
1212 float rec_nwrongtpc11;
1214 float rec_nwrongtpc2;
1216 float rec_nwrongtpc3;
1217 float rec_layersfromtruth;
1224 float rec_nhittpcall;
1225 float rec_nhittpcin;
1226 float rec_nhittpcmid;
1227 float rec_nhittpcout;
1230 float rec_nclusintt;
1231 float rec_nclusmaps;
1479 cout <<
" Set input branches." << endl;
1482 const int64_t nTrueEntries = m_ntOldTrue -> GetEntries();
1483 const int64_t nRecoEntries = m_ntOldReco -> GetEntries();
1484 cout <<
" Beginning truth particle loop: " << nTrueEntries <<
" to process" << endl;
1487 int64_t nTrueBytes = 0;
1488 for (int64_t iTrueEntry = 0; iTrueEntry < nTrueEntries; iTrueEntry++) {
1491 const int64_t trueBytes = m_ntOldTrue ->
GetEntry(iTrueEntry);
1492 if (trueBytes < 0) {
1493 cerr <<
"PANIC: issue with entry " << iTrueEntry <<
"! Aborting loop!\n" << endl;
1496 nTrueBytes += trueBytes;
1499 const int64_t iTrueProg = iTrueEntry + 1;
1500 if (iTrueProg == nTrueEntries) {
1501 cout <<
" Processing entry " << iTrueProg <<
"/" << nTrueEntries <<
"..." << endl;
1503 cout <<
" Processing entry " << iTrueProg <<
"/" << nTrueEntries <<
"...\r" <<
flush;
1507 if (isnan(tru_trackID))
continue;
1510 bool isNearSector =
false;
1511 if (m_config.doPhiCut) {
1512 isNearSector = IsNearSector(tru_gphi);
1516 const bool isPrimary = (tru_gprimary == 1);
1517 const bool isInZVtxCut = ((tru_gvz > m_config.zVtxRange.first) && (tru_gvz < m_config.zVtxRange.second));
1518 if (m_config.useOnlyPrimTrks && !isPrimary)
continue;
1519 if (m_config.doZVtxCut && !isInZVtxCut)
continue;
1520 if (m_config.doPhiCut && isNearSector)
continue;
1523 const double tru_gntot = tru_gnintt + tru_gnmaps + tru_gntpc;
1549 FillHistogram1D(content, Type::Truth, m_vecOldHists1D);
1550 FillHistogram2D(content, Type::Truth, Comp::VsTruthPt, tru_gpt, m_vecOldHists2D);
1551 FillHistogram2D(content, Type::Truth, Comp::VsNumTpc, tru_gntpc, m_vecOldHists2D);
1555 cout <<
" Finished truth particle loop.\n"
1556 <<
" Beginning reconstructed track loop: " << nRecoEntries <<
" to process"
1560 int64_t nRecoBytes = 0;
1561 for (int64_t iRecoEntry = 0; iRecoEntry < nRecoEntries; iRecoEntry++) {
1564 const int64_t recoBytes = m_ntOldReco ->
GetEntry(iRecoEntry);
1565 if (recoBytes < 0) {
1566 cerr <<
"PANIC: issue with entry " << iRecoEntry <<
"! Aborting loop!\n" << endl;
1569 nRecoBytes += recoBytes;
1572 const int64_t iRecoProg = iRecoEntry + 1;
1573 if (iRecoProg == nRecoEntries) {
1574 cout <<
" Processing entry " << iRecoProg <<
"/" << nRecoEntries <<
"..." << endl;
1576 cout <<
" Processing entry " << iRecoProg <<
"/" << nRecoEntries <<
"...\r" <<
flush;
1580 if (isnan(rec_gpt))
continue;
1583 bool isNearSector =
false;
1584 if (m_config.doPhiCut) {
1585 isNearSector = IsNearSector(rec_phi);
1589 const bool isPrimary = (rec_gprimary == 1);
1590 const bool isInZVtxCut = ((rec_vz > m_config.zVtxRange.first) && (rec_vz < m_config.zVtxRange.second));
1591 if (m_config.useOnlyPrimTrks && !isPrimary)
continue;
1592 if (m_config.doZVtxCut && !isInZVtxCut)
continue;
1593 if (m_config.doPhiCut && isNearSector)
continue;
1596 const double rec_ntot = rec_nintt + rec_nmaps + rec_ntpc;
1597 const double rec_gntot = rec_gnintt + rec_gnmaps + rec_gntpc;
1598 const double rec_rtot = rec_ntot / rec_gntot;
1599 const double rec_rintt = rec_nintt / rec_gnintt;
1600 const double rec_rmaps = rec_nmaps / rec_gnmaps;
1601 const double rec_rtpc = rec_ntpc / rec_gntpc;
1602 const double rec_ptfrac = rec_pt / rec_gpt;
1603 const double rec_ptper = rec_deltapt / rec_pt;
1604 const double rec_etaper = rec_deltaeta / rec_eta;
1605 const double rec_phiper = rec_deltaphi / rec_phi;
1606 const double rec_ptres = abs(rec_pt - rec_gpt) / rec_gpt;
1607 const double rec_etares = abs(rec_eta - rec_geta) / rec_geta;
1608 const double rec_phires = abs(rec_phi - rec_gphi) / rec_gphi;
1634 FillHistogram1D(content,
Type::Track, m_vecOldHists1D);
1635 FillHistogram2D(content,
Type::Track, Comp::VsTruthPt, rec_gpt, m_vecOldHists2D);
1636 FillHistogram2D(content,
Type::Track, Comp::VsNumTpc, rec_gntpc, m_vecOldHists2D);
1639 const bool isNormalTrack = ((rec_ptfrac >= m_config.oddPtFrac.first) && (rec_ptfrac <= m_config.oddPtFrac.second));
1640 if (isNormalTrack) {
1641 FillHistogram1D(content, Type::Normal, m_vecOldHists1D);
1642 FillHistogram2D(content, Type::Normal, Comp::VsTruthPt, rec_gpt, m_vecOldHists2D);
1643 FillHistogram2D(content, Type::Normal, Comp::VsNumTpc, rec_gntpc, m_vecOldHists2D);
1645 FillHistogram1D(content, Type::Weird, m_vecOldHists1D);
1646 FillHistogram2D(content, Type::Weird, Comp::VsTruthPt, rec_gpt, m_vecOldHists2D);
1647 FillHistogram2D(content, Type::Weird, Comp::VsNumTpc, rec_gntpc, m_vecOldHists2D);
1652 cout <<
" Finished reconstructed track loop.\n"
1653 <<
" Finished getting histograms from old matcher track tuple."
1662 const vector<vector<TH1D*>> vecNewHists1D,
1663 const vector<vector<vector<TH2D*>>> vecNewHists2D,
1669 const size_t nHistRows1D = m_vecOldHists1D.size();
1670 const size_t nHistRows2D = m_vecOldHists2D.size();
1671 const size_t nHistTypes1D = m_vecOldHists1D.front().size();
1672 const size_t nHistTypes2D = m_vecOldHists2D.front().size();
1673 const size_t nHist2D = m_vecOldHists2D.front().front().size();
1674 cout <<
" Making ratios and plots:" << endl;
1677 vector<vector<string>> vecCanvasNames1D(nHistRows1D);
1678 for (
size_t iHistRow1D = 0; iHistRow1D < nHistRows1D; iHistRow1D++) {
1679 vecCanvasNames1D[iHistRow1D].resize(nHistTypes1D);
1680 for (
size_t iHistType1D = 0; iHistType1D < nHistTypes1D; iHistType1D++) {
1681 vecCanvasNames1D[iHistRow1D][iHistType1D] = m_hist.vecNameBase[iHistRow1D][iHistType1D];
1682 vecCanvasNames1D[iHistRow1D][iHistType1D].replace(0, 1,
"c");
1687 vector<vector<vector<string>>> vecCanvasNames2D(nHistRows2D);
1688 for (
size_t iHistRow2D = 0; iHistRow2D < nHistRows2D; iHistRow2D++) {
1689 vecCanvasNames2D[iHistRow2D].resize(nHistRows2D);
1690 for (
size_t iHistType2D = 0; iHistType2D < nHistTypes2D; iHistType2D++) {
1691 vecCanvasNames2D[iHistRow2D][iHistType2D].resize(nHist2D);
1692 for (
size_t iHist2D = 0; iHist2D < nHist2D; iHist2D++) {
1693 vecCanvasNames2D[iHistRow2D][iHistType2D][iHist2D] = m_hist.vecNameBase[iHistRow2D][iHistType2D];
1694 vecCanvasNames2D[iHistRow2D][iHistType2D][iHist2D] += m_hist.vecVsModifiers[iHist2D];
1695 vecCanvasNames2D[iHistRow2D][iHistType2D][iHist2D].replace(0, 1,
"c");
1699 cout <<
" Set up canvas names." << endl;
1704 if (m_config.doIntNorm) {
1705 for (
auto oldHistRow1D : m_vecOldHists1D) {
1706 for (
auto hOldHist1D : oldHistRow1D) {
1707 const double intOld1D = hOldHist1D -> Integral();
1708 if (intOld1D > 0.) {
1709 hOldHist1D -> Scale(1. / intOld1D);
1713 for (
auto newHistRow1D : vecNewHists1D) {
1714 for (
auto hNewHist1D : newHistRow1D) {
1715 const double intNew1D = hNewHist1D -> Integral();
1716 if (intNew1D > 0.) {
1717 hNewHist1D -> Scale(1. / intNew1D);
1721 for (
auto oldHistRow2D : m_vecOldHists2D) {
1722 for (
auto oldHistTypes2D : oldHistRow2D) {
1723 for (
auto hOldHist2D : oldHistTypes2D) {
1724 const double intOld2D = hOldHist2D -> Integral();
1725 if (intOld2D > 0.) {
1726 hOldHist2D -> Scale(1. / intOld2D);
1731 for (
auto newHistRow2D : vecNewHists2D) {
1732 for (
auto newHistTypes2D : newHistRow2D) {
1733 for (
auto hNewHist2D : newHistTypes2D) {
1734 const double intNew2D = hNewHist2D -> Integral();
1735 if (intNew2D > 0.) {
1736 hNewHist2D -> Scale(1. / intNew2D);
1741 cout <<
" Normalized histograms." << endl;
1745 if (m_config.matchVertScales) {
1746 for (
size_t iHistRow2D = 0; iHistRow2D < nHistRows2D; iHistRow2D++) {
1747 for (
size_t iHistType2D = 0; iHistType2D < nHistTypes2D; iHistType2D++) {
1748 for (
size_t iHist2D = 0; iHist2D < nHist2D; iHist2D++) {
1749 const float oldMin = m_vecOldHists2D[iHistRow2D][iHistType2D][iHist2D] -> GetMinimum(0.);
1750 const float oldMax = m_vecOldHists2D[iHistRow2D][iHistType2D][iHist2D] -> GetMaximum();
1751 const float newMin = vecNewHists2D[iHistRow2D][iHistType2D][iHist2D] -> GetMinimum(0.);
1752 const float newMax = vecNewHists2D[iHistRow2D][iHistType2D][iHist2D] -> GetMaximum();
1753 const float setMin =
min(oldMin, newMin);
1754 const float setMax = max(oldMax, newMax);
1755 m_vecOldHists2D[iHistRow2D][iHistType2D][iHist2D] ->
GetZaxis() -> SetRangeUser(setMin, setMax);
1756 vecNewHists2D[iHistRow2D][iHistType2D][iHist2D] ->
GetZaxis() -> SetRangeUser(setMin, setMax);
1760 cout <<
" Adjusted z-axis scales to match." << endl;
1764 string countUse(
"");
1765 if (m_config.doIntNorm) {
1766 countUse = m_config.norm;
1768 countUse = m_config.count;
1774 vector<vector<TH1D*>> vecRatios1D(nHistRows1D);
1775 for (
size_t iHistRow1D = 0; iHistRow1D < nHistRows1D; iHistRow1D++) {
1776 vecRatios1D[iHistRow1D].resize(nHistTypes1D);
1777 for (
size_t iHist1D = 0; iHist1D < nHistTypes1D; iHist1D++) {
1780 TString sRatioName = m_vecOldHists1D[iHistRow1D][iHist1D] -> GetName();
1781 sRatioName.Append(
"_");
1782 sRatioName.Append(sLabel.data());
1784 vecRatios1D[iHistRow1D][iHist1D] = (TH1D*) m_vecOldHists1D[iHistRow1D][iHist1D] -> Clone();
1785 vecRatios1D[iHistRow1D][iHist1D] ->
SetName(sRatioName.Data());
1786 vecRatios1D[iHistRow1D][iHist1D] ->
Reset(
"ICES");
1787 vecRatios1D[iHistRow1D][iHist1D] -> Divide(m_vecOldHists1D[iHistRow1D][iHist1D], vecNewHists1D[iHistRow1D][iHist1D], 1., 1.);
1792 vector<vector<vector<TH2D*>>> vecRatios2D(nHistRows2D);
1793 for (
size_t iHistRow2D = 0; iHistRow2D < nHistRows2D; iHistRow2D++) {
1794 vecRatios2D[iHistRow2D].resize(nHistTypes2D);
1795 for (
size_t iHistType2D = 0; iHistType2D < nHistTypes2D; iHistType2D++) {
1796 vecRatios2D[iHistRow2D][iHistType2D].resize(nHist2D);
1797 for (
size_t iHist2D = 0; iHist2D < nHist2D; iHist2D++) {
1800 TString sRatioName = m_vecOldHists2D[iHistRow2D][iHistType2D][iHist2D] -> GetName();
1801 sRatioName.Append(
"_");
1802 sRatioName.Append(sLabel.data());
1804 vecRatios2D[iHistRow2D][iHistType2D][iHist2D] = (TH2D*) m_vecOldHists2D[iHistRow2D][iHistType2D][iHist2D] -> Clone();
1805 vecRatios2D[iHistRow2D][iHistType2D][iHist2D] ->
SetName(sRatioName.Data());
1806 vecRatios2D[iHistRow2D][iHistType2D][iHist2D] ->
Reset(
"ICES");
1807 vecRatios2D[iHistRow2D][iHistType2D][iHist2D] -> Divide(m_vecOldHists2D[iHistRow2D][iHistType2D][iHist2D], vecNewHists2D[iHistRow2D][iHistType2D][iHist2D], 1., 1.);
1811 cout <<
" Calculated ratios." << endl;
1816 const uint32_t fTxt(42);
1817 const uint32_t fAln(12);
1818 const uint32_t fCnt(1);
1819 const float fLabH[m_const.nAxes] = {0.04, 0.04, 0.03};
1820 const float fLabR1[m_const.nAxes] = {0.074, 0.074, 0.056};
1821 const float fLabR2[m_const.nAxes] = {0.04, 0.04, 0.03};
1822 const float fTitH[m_const.nAxes] = {0.04, 0.04, 0.04};
1823 const float fTitR1[m_const.nAxes] = {0.074, 0.074, 0.056};
1824 const float fTitR2[m_const.nAxes] = {0.04, 0.04, 0.04};
1825 const float fOffTH[m_const.nAxes] = {1.0, 1.3, 1.2};
1826 const float fOffTR1[m_const.nAxes] = {0.8, 0.8, 1.0};
1827 const float fOffTR2[m_const.nAxes] = {1.0, 1.3, 1.2};
1828 const float fOffLH[m_const.nAxes] = {0.005, 0.005, 0.000};
1829 const float fOffLR1[m_const.nAxes] = {0.005, 0.005, 0.000};
1830 const float fOffLR2[m_const.nAxes] = {0.005, 0.005, 0.000};
1833 for (
auto oldHistRow1D : m_vecOldHists1D) {
1834 for (
auto hOldHist1D : oldHistRow1D) {
1843 hOldHist1D -> SetTitleFont(fTxt);
1844 hOldHist1D ->
GetXaxis() -> SetTitleFont(fTxt);
1845 hOldHist1D ->
GetXaxis() -> SetTitleSize(fTitH[0]);
1846 hOldHist1D ->
GetXaxis() -> SetTitleOffset(fOffTH[0]);
1847 hOldHist1D ->
GetXaxis() -> SetLabelFont(fTxt);
1848 hOldHist1D ->
GetXaxis() -> SetLabelSize(fLabH[0]);
1849 hOldHist1D ->
GetXaxis() -> SetLabelOffset(fOffLH[0]);
1850 hOldHist1D ->
GetXaxis() -> CenterTitle(fCnt);
1852 hOldHist1D ->
GetYaxis() -> SetTitleFont(fTxt);
1853 hOldHist1D ->
GetYaxis() -> SetTitleSize(fTitH[1]);
1854 hOldHist1D ->
GetYaxis() -> SetTitleOffset(fOffTH[1]);
1855 hOldHist1D ->
GetYaxis() -> SetLabelFont(fTxt);
1856 hOldHist1D ->
GetYaxis() -> SetLabelSize(fLabH[1]);
1857 hOldHist1D ->
GetYaxis() -> SetLabelOffset(fOffLH[1]);
1858 hOldHist1D ->
GetYaxis() -> CenterTitle(fCnt);
1861 for (
auto oldHistRow2D : m_vecOldHists2D) {
1862 for (
auto oldHistTypes2D : oldHistRow2D) {
1863 for (
auto hOldHist2D : oldHistTypes2D) {
1871 hOldHist2D ->
SetTitle(m_config.legOld.data());
1872 hOldHist2D -> SetTitleFont(fTxt);
1873 hOldHist2D ->
GetXaxis() -> SetTitleFont(fTxt);
1874 hOldHist2D ->
GetXaxis() -> SetTitleSize(fTitH[0]);
1875 hOldHist2D ->
GetXaxis() -> SetTitleOffset(fOffTH[0]);
1876 hOldHist2D ->
GetXaxis() -> SetLabelFont(fTxt);
1877 hOldHist2D ->
GetXaxis() -> SetLabelSize(fLabH[0]);
1878 hOldHist2D ->
GetXaxis() -> SetLabelOffset(fOffLH[0]);
1879 hOldHist2D ->
GetXaxis() -> CenterTitle(fCnt);
1880 hOldHist2D ->
GetYaxis() -> SetTitleFont(fTxt);
1881 hOldHist2D ->
GetYaxis() -> SetTitleSize(fTitH[1]);
1882 hOldHist2D ->
GetYaxis() -> SetTitleOffset(fOffTH[1]);
1883 hOldHist2D ->
GetYaxis() -> SetLabelFont(fTxt);
1884 hOldHist2D ->
GetYaxis() -> SetLabelSize(fLabH[1]);
1885 hOldHist2D ->
GetYaxis() -> SetLabelOffset(fOffLH[1]);
1886 hOldHist2D ->
GetYaxis() -> CenterTitle(fCnt);
1888 hOldHist2D ->
GetZaxis() -> SetTitleFont(fTxt);
1889 hOldHist2D ->
GetZaxis() -> SetTitleSize(fTitH[2]);
1890 hOldHist2D ->
GetZaxis() -> SetTitleOffset(fOffTH[2]);
1891 hOldHist2D ->
GetZaxis() -> SetLabelFont(fTxt);
1892 hOldHist2D ->
GetZaxis() -> SetLabelSize(fLabH[2]);
1893 hOldHist2D ->
GetZaxis() -> SetLabelOffset(fOffLH[2]);
1894 hOldHist2D ->
GetZaxis() -> CenterTitle(fCnt);
1900 for (
auto newHistRow1D : vecNewHists1D) {
1901 for (
auto hNewHist1D : newHistRow1D) {
1910 hNewHist1D -> SetTitleFont(fTxt);
1911 hNewHist1D ->
GetXaxis() -> SetTitleFont(fTxt);
1912 hNewHist1D ->
GetXaxis() -> SetTitleSize(fTitH[0]);
1913 hNewHist1D ->
GetXaxis() -> SetTitleOffset(fOffTH[0]);
1914 hNewHist1D ->
GetXaxis() -> SetLabelFont(fTxt);
1915 hNewHist1D ->
GetXaxis() -> SetLabelSize(fLabH[0]);
1916 hNewHist1D ->
GetXaxis() -> SetLabelOffset(fOffLH[0]);
1917 hNewHist1D ->
GetXaxis() -> CenterTitle(fCnt);
1919 hNewHist1D ->
GetYaxis() -> SetTitleFont(fTxt);
1920 hNewHist1D ->
GetYaxis() -> SetTitleSize(fTitH[1]);
1921 hNewHist1D ->
GetYaxis() -> SetTitleOffset(fOffTH[1]);
1922 hNewHist1D ->
GetYaxis() -> SetLabelFont(fTxt);
1923 hNewHist1D ->
GetYaxis() -> SetLabelSize(fLabH[1]);
1924 hNewHist1D ->
GetYaxis() -> SetLabelOffset(fOffLH[1]);
1925 hNewHist1D ->
GetYaxis() -> CenterTitle(fCnt);
1928 for (
auto newHistRow2D : vecNewHists2D) {
1929 for (
auto newHistTypes2D : newHistRow2D) {
1930 for (
auto hNewHist2D : newHistTypes2D) {
1938 hNewHist2D ->
SetTitle(m_config.legNew.data());
1939 hNewHist2D -> SetTitleFont(fTxt);
1940 hNewHist2D ->
GetXaxis() -> SetTitleFont(fTxt);
1941 hNewHist2D ->
GetXaxis() -> SetTitleSize(fTitH[0]);
1942 hNewHist2D ->
GetXaxis() -> SetTitleOffset(fOffTH[0]);
1943 hNewHist2D ->
GetXaxis() -> SetLabelFont(fTxt);
1944 hNewHist2D ->
GetXaxis() -> SetLabelSize(fLabH[0]);
1945 hNewHist2D ->
GetXaxis() -> SetLabelOffset(fOffLH[0]);
1946 hNewHist2D ->
GetXaxis() -> CenterTitle(fCnt);
1947 hNewHist2D ->
GetYaxis() -> SetTitleFont(fTxt);
1948 hNewHist2D ->
GetYaxis() -> SetTitleSize(fTitH[1]);
1949 hNewHist2D ->
GetYaxis() -> SetTitleOffset(fOffTH[1]);
1950 hNewHist2D ->
GetYaxis() -> SetLabelFont(fTxt);
1951 hNewHist2D ->
GetYaxis() -> SetLabelSize(fLabH[1]);
1952 hNewHist2D ->
GetYaxis() -> SetLabelOffset(fOffLH[1]);
1953 hNewHist2D ->
GetYaxis() -> CenterTitle(fCnt);
1955 hNewHist2D ->
GetZaxis() -> SetTitleFont(fTxt);
1956 hNewHist2D ->
GetZaxis() -> SetTitleSize(fTitH[2]);
1957 hNewHist2D ->
GetZaxis() -> SetTitleOffset(fOffTH[2]);
1958 hNewHist2D ->
GetZaxis() -> SetLabelFont(fTxt);
1959 hNewHist2D ->
GetZaxis() -> SetLabelSize(fLabH[2]);
1960 hNewHist2D ->
GetZaxis() -> SetLabelOffset(fOffLH[2]);
1961 hNewHist2D ->
GetZaxis() -> CenterTitle(fCnt);
1967 for (
auto ratioRow1D : vecRatios1D) {
1968 for (
auto hRatio1D : ratioRow1D) {
1977 hRatio1D -> SetTitleFont(fTxt);
1978 hRatio1D ->
GetXaxis() -> SetTitleFont(fTxt);
1979 hRatio1D ->
GetXaxis() -> SetTitleSize(fTitR1[0]);
1980 hRatio1D ->
GetXaxis() -> SetTitleOffset(fOffTR1[0]);
1981 hRatio1D ->
GetXaxis() -> SetLabelFont(fTxt);
1982 hRatio1D ->
GetXaxis() -> SetLabelSize(fLabR1[0]);
1983 hRatio1D ->
GetXaxis() -> SetLabelOffset(fOffLR1[0]);
1984 hRatio1D ->
GetXaxis() -> CenterTitle(fCnt);
1986 hRatio1D ->
GetYaxis() -> SetTitleFont(fTxt);
1987 hRatio1D ->
GetYaxis() -> SetTitleSize(fTitR1[1]);
1988 hRatio1D ->
GetYaxis() -> SetTitleOffset(fOffTR1[1]);
1989 hRatio1D ->
GetYaxis() -> SetLabelFont(fTxt);
1990 hRatio1D ->
GetYaxis() -> SetLabelSize(fLabR1[1]);
1991 hRatio1D ->
GetYaxis() -> SetLabelOffset(fOffLR1[1]);
1992 hRatio1D ->
GetYaxis() -> CenterTitle(fCnt);
1995 for (
auto ratioRow2D : vecRatios2D) {
1996 for (
auto ratioTypes2D : ratioRow2D) {
1997 for (
auto hRatio2D : ratioTypes2D) {
2006 hRatio2D -> SetTitleFont(fTxt);
2007 hRatio2D ->
GetXaxis() -> SetTitleFont(fTxt);
2008 hRatio2D ->
GetXaxis() -> SetTitleSize(fTitR2[0]);
2009 hRatio2D ->
GetXaxis() -> SetTitleOffset(fOffTR2[0]);
2010 hRatio2D ->
GetXaxis() -> SetLabelFont(fTxt);
2011 hRatio2D ->
GetXaxis() -> SetLabelSize(fLabR2[0]);
2012 hRatio2D ->
GetXaxis() -> SetLabelOffset(fOffLR2[0]);
2013 hRatio2D ->
GetXaxis() -> CenterTitle(fCnt);
2014 hRatio2D ->
GetYaxis() -> SetTitleFont(fTxt);
2015 hRatio2D ->
GetYaxis() -> SetTitleSize(fTitR2[1]);
2016 hRatio2D ->
GetYaxis() -> SetTitleOffset(fOffTR2[1]);
2017 hRatio2D ->
GetYaxis() -> SetLabelFont(fTxt);
2018 hRatio2D ->
GetYaxis() -> SetLabelSize(fLabR2[1]);
2019 hRatio2D ->
GetYaxis() -> SetLabelOffset(fOffLR2[1]);
2020 hRatio2D ->
GetYaxis() -> CenterTitle(fCnt);
2022 hRatio2D ->
GetZaxis() -> SetTitleFont(fTxt);
2023 hRatio2D ->
GetZaxis() -> SetTitleSize(fTitR2[2]);
2024 hRatio2D ->
GetZaxis() -> SetTitleOffset(fOffTR2[2]);
2025 hRatio2D ->
GetZaxis() -> SetLabelFont(fTxt);
2026 hRatio2D ->
GetZaxis() -> SetLabelSize(fLabR2[2]);
2027 hRatio2D ->
GetZaxis() -> SetLabelOffset(fOffLR2[2]);
2028 hRatio2D ->
GetZaxis() -> CenterTitle(fCnt);
2032 cout <<
" Set styles." << endl;
2037 const uint32_t fColLe(0);
2038 const uint32_t fFilLe(0);
2039 const uint32_t fLinLe(0);
2040 const float fLegXY[m_const.nVtx] = {0.1, 0.1, 0.3, 0.2};
2042 TLegend *
leg =
new TLegend(fLegXY[0], fLegXY[1], fLegXY[2], fLegXY[3], m_config.header.data());
2048 leg -> SetTextAlign(fAln);
2049 leg ->
AddEntry(m_vecOldHists1D.front().front(), m_config.legOld.data(),
"pf");
2050 leg ->
AddEntry(vecNewHists1D.front().front(), m_config.legNew.data(),
"pf");
2051 cout <<
" Made legend." << endl;
2054 const uint32_t fColTx(0);
2055 const uint32_t fFilTx(0);
2056 const uint32_t fLinTx(0);
2057 const float fTxtXY[m_const.nVtx] = {0.3, 0.1, 0.5, 0.25};
2059 TPaveText *txt =
new TPaveText(fTxtXY[0], fTxtXY[1], fTxtXY[2], fTxtXY[3],
"NDC NB");
2065 txt -> SetTextAlign(fAln);
2066 for (
string txtLine : m_config.info) {
2067 txt -> AddText(txtLine.data());
2069 cout <<
" Made text." << endl;
2074 const uint32_t width1D(750);
2075 const uint32_t width2D(1500);
2076 const uint32_t width2DR(2250);
2077 const uint32_t height(750);
2078 const uint32_t heightR1(900);
2079 const uint32_t heightR2(500);
2080 const uint32_t fMode(0);
2081 const uint32_t fBord(2);
2082 const uint32_t fGrid(0);
2083 const uint32_t fTick(1);
2084 const uint32_t fLogX(0);
2085 const uint32_t fLogY(1);
2086 const uint32_t fLogZ(1);
2087 const uint32_t fFrame(0);
2088 const string sOldPadName(
"pOld");
2089 const string sNewPadName(
"pNew");
2090 const string sHistPadName(
"pHist");
2091 const string sRatPadName(
"pRatio");
2092 const float fMargin1D[m_const.nSide] = {0.02, 0.02, 0.15, 0.15};
2093 const float fMargin1DH[m_const.nSide] = {0.02, 0.02, 0.005, 0.15};
2094 const float fMargin1DR[m_const.nSide] = {0.005, 0.02, 0.2, 0.15};
2095 const float fMargin2D[m_const.nSide] = {0.10, 0.15, 0.15, 0.15};
2096 const float xyOldPad[m_const.nVtx] = {0.0, 0.0, 0.5, 1.0};
2097 const float xyOldPadR[m_const.nVtx] = {0.0, 0.0, 0.33, 1.0};
2098 const float xyNewPad[m_const.nVtx] = {0.5, 0.0, 1.0, 1.0};
2099 const float xyNewPadR[m_const.nVtx] = {0.33, 0.0, 0.66, 1.0};
2100 const float xyHistPadR[m_const.nVtx] = {0.0, 0.33, 1.0, 1.0};
2101 const float xyRatPadR1[m_const.nVtx] = {0.0, 0.0, 1.0, 0.33};
2102 const float xyRatPadR2[m_const.nVtx] = {0.66, 0.0, 1.0, 1.0};
2105 for (
size_t iHistRow1D = 0; iHistRow1D < nHistRows1D; iHistRow1D++) {
2106 for (
size_t iHist1D = 0; iHist1D < nHistTypes1D; iHist1D++) {
2109 const string sName = vecCanvasNames1D[iHistRow1D][iHist1D] +
"_" + sLabel;
2113 TCanvas* cPlot1D =
new TCanvas(sName.data(),
"", width1D, height);
2114 cPlot1D -> SetGrid(fGrid, fGrid);
2115 cPlot1D -> SetTicks(fTick, fTick);
2123 cPlot1D -> SetLogx(fLogX);
2128 m_vecOldHists1D[iHistRow1D][iHist1D] ->
Draw();
2129 vecNewHists1D[iHistRow1D][iHist1D] ->
Draw(
"same");
2134 m_vecPlotDirs.at(iDir) ->
cd();
2141 for (
size_t iHistRow1D = 0; iHistRow1D < nHistRows1D; iHistRow1D++) {
2142 for (
size_t iHist1D = 0; iHist1D < nHistTypes1D; iHist1D++) {
2145 const string sNameWithRatio = vecCanvasNames1D[iHistRow1D][iHist1D] +
"WithRatio_" + sLabel;
2148 TCanvas* cPlot1D =
new TCanvas(sNameWithRatio.data(),
"", width1D, heightR1);
2149 TPad* pPadH1D =
new TPad(sHistPadName.data(),
"", xyHistPadR[0], xyHistPadR[1], xyHistPadR[2], xyHistPadR[3]);
2150 TPad* pPadR1D =
new TPad(sRatPadName.data(),
"", xyRatPadR1[0], xyRatPadR1[1], xyRatPadR1[2], xyRatPadR1[3]);
2151 cPlot1D -> SetGrid(fGrid, fGrid);
2152 cPlot1D -> SetTicks(fTick, fTick);
2155 pPadH1D -> SetGrid(fGrid, fGrid);
2156 pPadH1D -> SetTicks(fTick, fTick);
2164 pPadH1D -> SetLogx(fLogX);
2166 pPadR1D -> SetGrid(fGrid, fGrid);
2167 pPadR1D -> SetTicks(fTick, fTick);
2175 pPadR1D -> SetLogx(fLogX);
2183 m_vecOldHists1D[iHistRow1D][iHist1D] ->
Draw();
2184 vecNewHists1D[iHistRow1D][iHist1D] ->
Draw(
"same");
2190 vecRatios1D[iHistRow1D][iHist1D] ->
Draw();
2193 m_vecPlotDirs.at(iDir) ->
cd();
2200 for (
size_t iHistRow2D = 0; iHistRow2D < nHistRows2D; iHistRow2D++) {
2201 for (
size_t iHistType2D = 0; iHistType2D < nHistTypes2D; iHistType2D++) {
2202 for (
size_t iHist2D = 0; iHist2D < nHist2D; iHist2D++) {
2205 TCanvas* cPlot2D =
new TCanvas(vecCanvasNames2D[iHistRow2D][iHistType2D][iHist2D].
data(),
"", width2D, height);
2206 TPad* pOld =
new TPad(sOldPadName.data(),
"", xyOldPad[0], xyOldPad[1], xyOldPad[2], xyOldPad[3]);
2207 TPad* pNew =
new TPad(sNewPadName.data(),
"", xyNewPad[0], xyNewPad[1], xyNewPad[2], xyNewPad[3]);
2208 cPlot2D -> SetGrid(fGrid, fGrid);
2209 cPlot2D -> SetTicks(fTick, fTick);
2212 pOld -> SetGrid(fGrid, fGrid);
2213 pOld -> SetTicks(fTick, fTick);
2221 pOld -> SetLogx(fLogX);
2223 pOld -> SetLogz(fLogZ);
2224 pNew -> SetGrid(fGrid, fGrid);
2225 pNew -> SetTicks(fTick, fTick);
2233 pNew -> SetLogx(fLogX);
2235 pNew -> SetLogz(fLogZ);
2242 m_vecOldHists2D[iHistRow2D][iHistType2D][iHist2D] ->
Draw(
"colz");
2244 vecNewHists2D[iHistRow2D][iHistType2D][iHist2D] ->
Draw(
"colz");
2249 m_vecPlotDirs.at(iDir) ->
cd();
2257 for (
size_t iHistRow2D = 0; iHistRow2D < nHistRows2D; iHistRow2D++) {
2258 for (
size_t iHistType2D = 0; iHistType2D < nHistTypes2D; iHistType2D++) {
2259 for (
size_t iHist2D = 0; iHist2D < nHist2D; iHist2D++) {
2262 const string sNameWithRatio = vecCanvasNames2D[iHistRow2D][iHistType2D][iHist2D] +
"_" + sLabel;
2265 TCanvas* cPlot2D =
new TCanvas(sNameWithRatio.data(),
"", width2DR, heightR2);
2266 TPad* pOld =
new TPad(sOldPadName.data(),
"", xyOldPadR[0], xyOldPadR[1], xyOldPadR[2], xyOldPadR[3]);
2267 TPad* pNew =
new TPad(sNewPadName.data(),
"", xyNewPadR[0], xyNewPadR[1], xyNewPadR[2], xyNewPadR[3]);
2268 TPad* pRat =
new TPad(sRatPadName.data(),
"", xyRatPadR2[0], xyRatPadR2[1], xyRatPadR2[2], xyRatPadR2[3]);
2269 cPlot2D -> SetGrid(fGrid, fGrid);
2270 cPlot2D -> SetTicks(fTick, fTick);
2273 pOld -> SetGrid(fGrid, fGrid);
2274 pOld -> SetTicks(fTick, fTick);
2282 pOld -> SetLogx(fLogX);
2284 pOld -> SetLogz(fLogZ);
2285 pNew -> SetGrid(fGrid, fGrid);
2286 pNew -> SetTicks(fTick, fTick);
2294 pNew -> SetLogx(fLogX);
2296 pNew -> SetLogz(fLogZ);
2297 pRat -> SetGrid(fGrid, fGrid);
2298 pRat -> SetTicks(fTick, fTick);
2306 pRat -> SetLogx(fLogX);
2308 pRat -> SetLogz(fLogZ);
2316 m_vecOldHists2D[iHistRow2D][iHistType2D][iHist2D] ->
Draw(
"colz");
2319 vecNewHists2D[iHistRow2D][iHistType2D][iHist2D] ->
Draw(
"colz");
2321 vecRatios2D[iHistRow2D][iHistType2D][iHist2D] ->
Draw(
"colz");
2324 m_vecPlotDirs.at(iDir) ->
cd();
2330 cout <<
" Made 2D plot with ratio." << endl;
2333 m_vecRatioDirs.at(iDir) ->
cd();
2334 for (
auto histRow1D : vecRatios1D) {
2335 for (
auto hRatio1D : histRow1D) {
2336 hRatio1D ->
Write();
2339 for (
auto histRow2D : vecRatios2D) {
2340 for (
auto histTypes2D : histRow2D) {
2341 for (
auto hRatio2D : histTypes2D) {
2342 hRatio2D ->
Write();
2348 cout <<
" Saved ratio histograms.\n"
2349 <<
" Finished making ratios and plots."
2360 for (
size_t iHistRow = 0; iHistRow < m_vecTreeHists1D.size(); iHistRow++) {
2361 for (
size_t iHistType = 0; iHistType < m_vecTreeHists1D[iHistRow].size(); iHistType++) {
2362 m_vecHistDirs[Src::NewTree] ->
cd();
2363 m_vecTreeHists1D[iHistRow][iHistType] ->
Write();
2364 m_vecHistDirs[Src::NewTuple] ->
cd();
2365 m_vecTupleHists1D[iHistRow][iHistType] ->
Write();
2366 m_vecHistDirs[Src::OldTuple] ->
cd();
2367 m_vecOldHists1D[iHistRow][iHistType] ->
Write();
2370 cout <<
" Saved 1d histograms." << endl;
2373 for (
size_t iHistRow = 0; iHistRow < m_vecTreeHists2D.size(); iHistRow++) {
2374 for (
size_t iHistType = 0; iHistType < m_vecTreeHists2D[iHistRow].size(); iHistType++) {
2375 for (
size_t iVsHistMod = 0; iVsHistMod < m_vecTreeHists2D[iHistRow][iHistType].size(); iVsHistMod++) {
2376 m_vecHistDirs[Src::NewTree] ->
cd();
2377 m_vecTreeHists2D[iHistRow][iHistType][iVsHistMod] ->
Write();
2378 m_vecHistDirs[Src::NewTuple] ->
cd();
2379 m_vecTupleHists2D[iHistRow][iHistType][iVsHistMod] ->
Write();
2380 m_vecHistDirs[Src::OldTuple] ->
cd();
2381 m_vecOldHists2D[iHistRow][iHistType][iVsHistMod] ->
Write();
2387 cout <<
" Saved 2d histograms." << endl;
2396 m_treeInFileTrue ->
cd();
2397 m_treeInFileTrue ->
Close();
2398 m_treeInFileReco ->
cd();
2399 m_treeInFileReco ->
Close();
2400 m_tupleInFileTrue ->
cd();
2401 m_tupleInFileTrue ->
Close();
2402 m_tupleInFileReco ->
cd();
2403 m_tupleInFileReco ->
Close();
2404 m_oldInFileTrue ->
cd();
2405 m_oldInFileTrue ->
Close();
2406 m_oldInFileReco ->
cd();
2407 m_oldInFileReco ->
Close();
2410 cout <<
" Closed input files." << endl;
2420 m_outFile ->
Close();
2423 cout <<
" Closed output file." << endl;
2435 const vector<vector<TH1D*>> vecHist1D
2438 vecHist1D.at(Var::NTot).at(type) ->
Fill(content.
nTot);
2439 vecHist1D.at(Var::NIntt).at(type) ->
Fill(content.
nIntt);
2440 vecHist1D.at(Var::NMvtx).at(type) ->
Fill(content.
nMvtx);
2441 vecHist1D.at(Var::NTpc).at(type) ->
Fill(content.
nTpc);
2442 vecHist1D.at(Var::RTot).at(type) ->
Fill(content.
rTot);
2443 vecHist1D.at(Var::RIntt).at(type) ->
Fill(content.
rIntt);
2444 vecHist1D.at(Var::RMvtx).at(type) ->
Fill(content.
rMvtx);
2445 vecHist1D.at(Var::RTpc).at(type) ->
Fill(content.
rTpc);
2446 vecHist1D.at(Var::Phi).at(type) ->
Fill(content.
phi);
2449 vecHist1D.at(Var::Frac).at(type) ->
Fill(content.
ptFrac);
2450 vecHist1D.at(Var::Qual).at(type) ->
Fill(content.
quality);
2451 vecHist1D.at(Var::PtErr).at(type) ->
Fill(content.
ptErr);
2452 vecHist1D.at(Var::EtaErr).at(type) ->
Fill(content.
etaErr);
2453 vecHist1D.at(Var::PhiErr).at(type) ->
Fill(content.
phiErr);
2454 vecHist1D.at(Var::PtRes).at(type) ->
Fill(content.
ptRes);
2455 vecHist1D.at(Var::EtaRes).at(type) ->
Fill(content.
etaRes);
2456 vecHist1D.at(Var::PhiRes).at(type) ->
Fill(content.
phiRes);
2467 const Comp comparison,
2469 const vector<vector<vector<TH2D*>>> vecHist2D
2473 vecHist2D.at(Var::NTot).at(type).at(comparison) ->
Fill(value, content.
nTot);
2474 vecHist2D.at(Var::NIntt).at(type).at(comparison) ->
Fill(value, content.
nIntt);
2475 vecHist2D.at(Var::NMvtx).at(type).at(comparison) ->
Fill(value, content.
nMvtx);
2476 vecHist2D.at(Var::NTpc).at(type).at(comparison) ->
Fill(value, content.
nTpc);
2477 vecHist2D.at(Var::RTot).at(type).at(comparison) ->
Fill(value, content.
rTot);
2478 vecHist2D.at(Var::RIntt).at(type).at(comparison) ->
Fill(value, content.
rIntt);
2479 vecHist2D.at(Var::RMvtx).at(type).at(comparison) ->
Fill(value, content.
rMvtx);
2480 vecHist2D.at(Var::RTpc).at(type).at(comparison) ->
Fill(value, content.
rTpc);
2481 vecHist2D.at(Var::Phi).at(type).at(comparison) ->
Fill(value, content.
phi);
2482 vecHist2D.at(
Var::Eta).at(type).at(comparison) ->
Fill(value, content.
eta);
2483 vecHist2D.at(
Var::Pt).at(type).at(comparison) ->
Fill(value, content.
pt);
2484 vecHist2D.at(Var::Frac).at(type).at(comparison) ->
Fill(value, content.
ptFrac);
2485 vecHist2D.at(Var::Qual).at(type).at(comparison) ->
Fill(value, content.
quality);
2486 vecHist2D.at(Var::PtErr).at(type).at(comparison) ->
Fill(value, content.
ptErr);
2487 vecHist2D.at(Var::EtaErr).at(type).at(comparison) ->
Fill(value, content.
etaErr);
2488 vecHist2D.at(Var::PhiErr).at(type).at(comparison) ->
Fill(value, content.
phiErr);
2489 vecHist2D.at(Var::PtRes).at(type).at(comparison) ->
Fill(value, content.
ptRes);
2490 vecHist2D.at(Var::EtaRes).at(type).at(comparison) ->
Fill(value, content.
etaRes);
2491 vecHist2D.at(Var::PhiRes).at(type).at(comparison) ->
Fill(value, content.
phiRes);
2500 bool isNearSector =
false;
2501 for (
size_t iSector = 0; iSector < m_const.nSectors; iSector++) {
2502 const float cutVal = m_config.sigCutVal * m_config.phiSectors[iSector].second;
2503 const float minPhi = m_config.phiSectors[iSector].first - cutVal;
2504 const float maxPhi = m_config.phiSectors[iSector].first + cutVal;
2505 const bool isNear = ((phi >=
minPhi) && (phi <= maxPhi));
2507 isNearSector =
true;
2511 return isNearSector;