Analysis Software
Documentation for sPHENIX simulation 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 class TEfficiency;
20 namespace ActsFatras {
21 class Particle;
22 } // namespace ActsFatras
23 
24 namespace ActsExamples {
25 
26 // Tools to make efficiency plots to show tracking efficiency.
27 // For the moment, the efficiency is taken as the fraction of successfully
28 // smoothed track over all tracks
29 class EffPlotTool {
30  public:
32  struct Config {
33  std::map<std::string, PlotHelpers::Binning> varBinning = {
34  {"Eta", PlotHelpers::Binning("#eta", 40, -4, 4)},
35  {"Phi", PlotHelpers::Binning("#phi", 100, -3.15, 3.15)},
36  {"Pt", PlotHelpers::Binning("pT [GeV/c]", 40, 0, 100)}};
37  };
38 
40  struct EffPlotCache {
41  TEfficiency* trackEff_vs_pT{nullptr};
42  TEfficiency* trackEff_vs_eta{nullptr};
43  TEfficiency* trackEff_vs_phi{nullptr};
44  };
45 
51 
55  void book(EffPlotCache& effPlotCache) const;
56 
62  void fill(EffPlotCache& effPlotCache,
63  const ActsFatras::Particle& truthParticle, bool status) const;
64 
68  void write(const EffPlotCache& effPlotCache) const;
69 
73  void clear(EffPlotCache& effPlotCache) const;
74 
75  private:
77  std::unique_ptr<const Acts::Logger> m_logger;
78 
80  const Acts::Logger& logger() const { return *m_logger; }
81 };
82 
83 } // namespace ActsExamples