Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EffPlotTool.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EffPlotTool.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 
13 
14 #include <TEfficiency.h>
15 
19 
22  : m_cfg(cfg), m_logger(Acts::getDefaultLogger("EffPlotTool", lvl)) {}
23 
25  EffPlotTool::EffPlotCache& effPlotCache) const {
26  PlotHelpers::Binning bPhi = m_cfg.varBinning.at("Phi");
27  PlotHelpers::Binning bEta = m_cfg.varBinning.at("Eta");
28  PlotHelpers::Binning bPt = m_cfg.varBinning.at("Pt");
29  ACTS_DEBUG("Initialize the histograms for efficiency plots");
30  // efficiency vs pT
31  effPlotCache.trackEff_vs_pT = PlotHelpers::bookEff(
32  "trackeff_vs_pT", "Tracking efficiency;Truth pT [GeV/c];Efficiency", bPt);
33  // efficiency vs eta
35  "trackeff_vs_eta", "Tracking efficiency;Truth #eta;Efficiency", bEta);
36  // efficiency vs phi
38  "trackeff_vs_phi", "Tracking efficiency;Truth #phi;Efficiency", bPhi);
39 }
40 
42  delete effPlotCache.trackEff_vs_pT;
43  delete effPlotCache.trackEff_vs_eta;
44  delete effPlotCache.trackEff_vs_phi;
45 }
46 
48  const EffPlotTool::EffPlotCache& effPlotCache) const {
49  ACTS_DEBUG("Write the plots to output file.");
50  effPlotCache.trackEff_vs_pT->Write();
51  effPlotCache.trackEff_vs_eta->Write();
52  effPlotCache.trackEff_vs_phi->Write();
53 }
54 
56  const ActsFatras::Particle& truthParticle,
57  bool status) const {
58  const auto t_phi = phi(truthParticle.direction());
59  const auto t_eta = eta(truthParticle.direction());
60  const auto t_pT = truthParticle.transverseMomentum();
61 
62  PlotHelpers::fillEff(effPlotCache.trackEff_vs_pT, t_pT, status);
63  PlotHelpers::fillEff(effPlotCache.trackEff_vs_eta, t_eta, status);
64  PlotHelpers::fillEff(effPlotCache.trackEff_vs_phi, t_phi, status);
65 }