ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ResPlotTool.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ResPlotTool.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 
19 
20 namespace FW {
21 
22 // Tools to make hists to show residual, i.e. smoothed_parameter -
23 // truth_parameter, and pull, i.e. (smoothed_parameter -
24 // truth_parameter)/smoothed_paramter_error, of track parameters at perigee
25 // surface
26 class ResPlotTool {
28 
29  public:
31  struct Config {
33  std::vector<std::string> paramNames = {"d0", "z0", "phi",
34  "theta", "qop", "t"};
35 
37  std::map<std::string, PlotHelpers::Binning> varBinning = {
38  {"Eta", PlotHelpers::Binning("#eta", 40, -4, 4)},
39  {"Pt", PlotHelpers::Binning("pT [GeV/c]", 20, 0, 100)},
40  {"Pull", PlotHelpers::Binning("pull", 100, -5, 5)},
41  {"Residual_d0", PlotHelpers::Binning("r_{d0} [mm]", 100, -0.5, 0.5)},
42  {"Residual_z0", PlotHelpers::Binning("r_{z0} [mm]", 100, -0.5, 0.5)},
43  {"Residual_phi",
44  PlotHelpers::Binning("r_{#phi} [rad]", 100, -0.005, 0.005)},
45  {"Residual_theta",
46  PlotHelpers::Binning("r_{#theta} [rad]", 100, -0.005, 0.005)},
47  {"Residual_qop",
48  PlotHelpers::Binning("r_{q/p} [c/GeV]", 100, -0.005, 0.005)},
49  {"Residual_t", PlotHelpers::Binning("r_{t} [s]", 100, -1000, 1000)}};
50  };
51 
53  struct ResPlotCache {
54  std::map<std::string, TH1F*> res;
55  std::map<std::string, TH2F*> res_vs_eta;
56  std::map<std::string, TH1F*>
58  std::map<std::string, TH1F*>
60  std::map<std::string, TH2F*> res_vs_pT;
61  std::map<std::string, TH1F*>
63  std::map<std::string, TH1F*>
65 
66  std::map<std::string, TH1F*> pull;
67  std::map<std::string, TH2F*> pull_vs_eta;
68  std::map<std::string, TH1F*>
70  std::map<std::string, TH1F*>
72  std::map<std::string, TH2F*> pull_vs_pT;
73  std::map<std::string, TH1F*>
75  std::map<std::string, TH1F*>
77  };
78 
83  ResPlotTool(const Config& cfg, Acts::Logging::Level lvl);
84 
87  void book(ResPlotCache& resPlotCache) const;
88 
94  void fill(ResPlotCache& resPlotCache, const Acts::GeometryContext& gctx,
95  const ActsFatras::Particle& truthParticle,
96  const Acts::BoundParameters& fittedParamters) const;
97 
101  void refinement(ResPlotCache& resPlotCache) const;
102 
105  void write(const ResPlotCache& resPlotCache) const;
106 
109  void clear(ResPlotCache& resPlotCache) const;
110 
111  private:
113  std::unique_ptr<const Acts::Logger> m_logger;
114 
116  const Acts::Logger& logger() const { return *m_logger; }
117 };
118 
119 } // namespace FW