EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EffPlotTool.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file EffPlotTool.hpp
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 
9 #pragma once
10 
14 
15 #include <map>
16 #include <memory>
17 #include <string>
18 
19 namespace ActsExamples {
20 
21 // Tools to make efficiency plots to show tracking efficiency.
22 // For the moment, the efficiency is taken as the fraction of successfully
23 // smoothed track over all tracks
24 class EffPlotTool {
25  public:
27  struct Config {
28  std::map<std::string, PlotHelpers::Binning> varBinning = {
29  {"Eta", PlotHelpers::Binning("#eta", 40, -4, 4)},
30  {"Phi", PlotHelpers::Binning("#phi", 100, -3.15, 3.15)},
31  {"Pt", PlotHelpers::Binning("pT [GeV/c]", 40, 0, 100)}};
32  };
33 
35  struct EffPlotCache {
36  TEfficiency* trackEff_vs_pT;
37  TEfficiency* trackEff_vs_eta;
38  TEfficiency* trackEff_vs_phi;
39  };
40 
45  EffPlotTool(const Config& cfg, Acts::Logging::Level lvl);
46 
50  void book(EffPlotCache& effPlotCache) const;
51 
57  void fill(EffPlotCache& effPlotCache,
58  const ActsFatras::Particle& truthParticle, bool status) const;
59 
63  void write(const EffPlotCache& effPlotCache) const;
64 
68  void clear(EffPlotCache& effPlotCache) const;
69 
70  private:
72  std::unique_ptr<const Acts::Logger> m_logger;
73 
75  const Acts::Logger& logger() const { return *m_logger; }
76 };
77 
78 } // namespace ActsExamples