ECCE @ 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 
11 #include <map>
12 #include <memory>
13 #include <string>
14 
18 
19 namespace FW {
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]", 20, 0, 100)}};
32  };
33 
35  struct EffPlotCache {
36  TEfficiency* trackeff_vs_eta;
37  TEfficiency* trackeff_vs_phi;
38  TEfficiency* trackeff_vs_pT;
39  };
40 
45  EffPlotTool(const Config& cfg, Acts::Logging::Level lvl);
46 
49  void book(EffPlotCache& effPlotCache) const;
50 
56  void fill(EffPlotCache& effPlotCache,
57  const ActsFatras::Particle& truthParticle, bool status) const;
58 
61  void write(const EffPlotCache& effPlotCache) const;
62 
65  void clear(EffPlotCache& effPlotCache) const;
66 
67  private:
69  std::unique_ptr<const Acts::Logger> m_logger;
70 
72  const Acts::Logger& logger() const { return *m_logger; }
73 };
74 
75 } // namespace FW