EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DuplicationPlotTool.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file DuplicationPlotTool.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
10 
12 
17 
21  : m_cfg(cfg),
22  m_logger(Acts::getDefaultLogger("DuplicationPlotTool", lvl)) {}
23 
25  DuplicationPlotTool::DuplicationPlotCache& duplicationPlotCache) const {
26  PlotHelpers::Binning bPt = m_cfg.varBinning.at("Pt");
27  PlotHelpers::Binning bEta = m_cfg.varBinning.at("Eta");
28  PlotHelpers::Binning bPhi = m_cfg.varBinning.at("Phi");
29  PlotHelpers::Binning bNum = m_cfg.varBinning.at("Num");
30  ACTS_DEBUG("Initialize the histograms for duplication rate plots");
31 
32  // duplication rate vs pT
33  duplicationPlotCache.duplicationRate_vs_pT =
34  PlotHelpers::bookEff("duplicationRate_vs_pT",
35  "Duplication rate;pT [GeV/c];Duplication rate", bPt);
36  // duplication rate vs eta
37  duplicationPlotCache.duplicationRate_vs_eta = PlotHelpers::bookEff(
38  "duplicationRate_vs_eta", "Duplication rate;#eta;Duplication rate", bEta);
39  // duplication rate vs phi
40  duplicationPlotCache.duplicationRate_vs_phi = PlotHelpers::bookEff(
41  "duplicationRate_vs_phi", "Duplication rate;#phi;Duplication rate", bPhi);
42 
43  // duplication number vs pT
44  duplicationPlotCache.nDuplicated_vs_pT = PlotHelpers::bookProf(
45  "nDuplicated_vs_pT", "Number of duplicated track candidates", bPt, bNum);
46  // duplication number vs eta
47  duplicationPlotCache.nDuplicated_vs_eta = PlotHelpers::bookProf(
48  "nDuplicated_vs_eta", "Number of duplicated track candidates", bEta,
49  bNum);
50  // duplication number vs phi
51  duplicationPlotCache.nDuplicated_vs_phi = PlotHelpers::bookProf(
52  "nDuplicated_vs_phi", "Number of duplicated track candidates", bPhi,
53  bNum);
54 }
55 
57  DuplicationPlotCache& duplicationPlotCache) const {
58  delete duplicationPlotCache.duplicationRate_vs_pT;
59  delete duplicationPlotCache.duplicationRate_vs_eta;
60  delete duplicationPlotCache.duplicationRate_vs_phi;
61  delete duplicationPlotCache.nDuplicated_vs_pT;
62  delete duplicationPlotCache.nDuplicated_vs_eta;
63  delete duplicationPlotCache.nDuplicated_vs_phi;
64 }
65 
67  const DuplicationPlotTool::DuplicationPlotCache& duplicationPlotCache)
68  const {
69  ACTS_DEBUG("Write the plots to output file.");
70  duplicationPlotCache.duplicationRate_vs_pT->Write();
71  duplicationPlotCache.duplicationRate_vs_eta->Write();
72  duplicationPlotCache.duplicationRate_vs_phi->Write();
73  duplicationPlotCache.nDuplicated_vs_pT->Write();
74  duplicationPlotCache.nDuplicated_vs_eta->Write();
75  duplicationPlotCache.nDuplicated_vs_phi->Write();
76 }
77 
79  DuplicationPlotTool::DuplicationPlotCache& duplicationPlotCache,
80  const Acts::BoundTrackParameters& fittedParameters, bool status) const {
81  const auto& momentum = fittedParameters.momentum();
82  const double fit_phi = phi(momentum);
83  const double fit_eta = eta(momentum);
84  const double fit_pT = perp(momentum);
85 
86  PlotHelpers::fillEff(duplicationPlotCache.duplicationRate_vs_pT, fit_pT,
87  status);
88  PlotHelpers::fillEff(duplicationPlotCache.duplicationRate_vs_eta, fit_eta,
89  status);
90  PlotHelpers::fillEff(duplicationPlotCache.duplicationRate_vs_phi, fit_phi,
91  status);
92 }
93 
95  DuplicationPlotTool::DuplicationPlotCache& duplicationPlotCache,
96  const ActsFatras::Particle& truthParticle, size_t nDuplicatedTracks) const {
97  const auto t_phi = phi(truthParticle.unitDirection());
98  const auto t_eta = eta(truthParticle.unitDirection());
99  const auto t_pT = truthParticle.transverseMomentum();
100 
101  PlotHelpers::fillProf(duplicationPlotCache.nDuplicated_vs_pT, t_pT,
102  nDuplicatedTracks);
103  PlotHelpers::fillProf(duplicationPlotCache.nDuplicated_vs_eta, t_eta,
104  nDuplicatedTracks);
105  PlotHelpers::fillProf(duplicationPlotCache.nDuplicated_vs_phi, t_phi,
106  nDuplicatedTracks);
107 }