File indexing completed on 2025-01-18 09:11:48
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/EventData/TrackParameters.hpp"
0012 #include "Acts/Geometry/GeometryContext.hpp"
0013 #include "Acts/Utilities/Logger.hpp"
0014 #include "ActsExamples/EventData/SimParticle.hpp"
0015 #include "ActsExamples/Utilities/Helpers.hpp"
0016
0017 #include <map>
0018 #include <memory>
0019 #include <string>
0020 #include <vector>
0021
0022 class TH1F;
0023 class TH2F;
0024 namespace ActsFatras {
0025 class Particle;
0026 }
0027
0028 namespace ActsExamples {
0029
0030
0031
0032
0033
0034 class ResPlotTool {
0035 public:
0036
0037 struct Config {
0038
0039 std::vector<std::string> paramNames = {"d0", "z0", "phi",
0040 "theta", "qop", "t"};
0041
0042
0043 std::map<std::string, PlotHelpers::Binning> varBinning = {
0044 {"Eta", PlotHelpers::Binning("#eta", 40, -4, 4)},
0045 {"Pt", PlotHelpers::Binning("pT [GeV/c]", 40, 0, 100)},
0046 {"Pull", PlotHelpers::Binning("pull", 100, -5, 5)},
0047 {"Residual_d0", PlotHelpers::Binning("r_{d0} [mm]", 100, -0.5, 0.5)},
0048 {"Residual_z0", PlotHelpers::Binning("r_{z0} [mm]", 100, -0.5, 0.5)},
0049 {"Residual_phi",
0050 PlotHelpers::Binning("r_{#phi} [rad]", 100, -0.01, 0.01)},
0051 {"Residual_theta",
0052 PlotHelpers::Binning("r_{#theta} [rad]", 100, -0.01, 0.01)},
0053 {"Residual_qop",
0054 PlotHelpers::Binning("r_{q/p} [c/GeV]", 100, -0.1, 0.1)},
0055 {"Residual_t", PlotHelpers::Binning("r_{t} [s]", 100, -1000, 1000)}};
0056 };
0057
0058
0059 struct ResPlotCache {
0060 std::map<std::string, TH1F*> res;
0061 std::map<std::string, TH2F*> res_vs_eta;
0062 std::map<std::string, TH1F*>
0063 resMean_vs_eta;
0064 std::map<std::string, TH1F*>
0065 resWidth_vs_eta;
0066 std::map<std::string, TH2F*> res_vs_pT;
0067 std::map<std::string, TH1F*>
0068 resMean_vs_pT;
0069 std::map<std::string, TH1F*>
0070 resWidth_vs_pT;
0071
0072 std::map<std::string, TH1F*> pull;
0073 std::map<std::string, TH2F*> pull_vs_eta;
0074 std::map<std::string, TH1F*>
0075 pullMean_vs_eta;
0076 std::map<std::string, TH1F*>
0077 pullWidth_vs_eta;
0078 std::map<std::string, TH2F*> pull_vs_pT;
0079 std::map<std::string, TH1F*>
0080 pullMean_vs_pT;
0081 std::map<std::string, TH1F*>
0082 pullWidth_vs_pT;
0083 };
0084
0085
0086
0087
0088
0089 ResPlotTool(const Config& cfg, Acts::Logging::Level lvl);
0090
0091
0092
0093
0094 void book(ResPlotCache& resPlotCache) const;
0095
0096
0097
0098
0099
0100
0101
0102 void fill(ResPlotCache& resPlotCache, const Acts::GeometryContext& gctx,
0103 const SimParticleState& truthParticle,
0104 const Acts::BoundTrackParameters& fittedParamters) const;
0105
0106
0107
0108
0109
0110 void refinement(ResPlotCache& resPlotCache) const;
0111
0112
0113
0114
0115 void write(const ResPlotCache& resPlotCache) const;
0116
0117
0118
0119
0120 void clear(ResPlotCache& resPlotCache) const;
0121
0122 private:
0123 Config m_cfg;
0124 std::unique_ptr<const Acts::Logger> m_logger;
0125
0126
0127 const Acts::Logger& logger() const { return *m_logger; }
0128 };
0129
0130 }