File indexing completed on 2026-05-25 07:34:55
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Geometry/GeometryContext.hpp"
0012 #include "Acts/Utilities/Histogram.hpp"
0013 #include "Acts/Utilities/Logger.hpp"
0014 #include "ActsExamples/EventData/SimParticle.hpp"
0015
0016 #include <map>
0017 #include <memory>
0018 #include <string>
0019 #include <vector>
0020
0021 namespace ActsExamples {
0022
0023
0024
0025
0026
0027 class ResPlotTool {
0028 public:
0029 using AxisVariant = Acts::Experimental::AxisVariant;
0030 using BoostRegularAxis = Acts::Experimental::BoostRegularAxis;
0031 using Histogram1 = Acts::Experimental::Histogram1;
0032 using Histogram2 = Acts::Experimental::Histogram2;
0033 using Histogram3 = Acts::Experimental::Histogram3;
0034
0035
0036 struct Config {
0037
0038 std::vector<std::string> paramNames = {"d0", "z0", "phi",
0039 "theta", "qop", "t"};
0040
0041 std::string qOverPtName = "qopt";
0042 std::string relQoverPtName = "qopt_rel";
0043
0044
0045 std::map<std::string, AxisVariant> varBinning = {
0046 {"Eta", BoostRegularAxis(40, -4, 4, "#eta")},
0047 {"Phi", BoostRegularAxis(40, -std::numbers::pi, std::numbers::pi,
0048 "#phi [rad]")},
0049 {"Pt", BoostRegularAxis(40, 0, 100, "pT [GeV/c]")},
0050 {"Pull", BoostRegularAxis(100, -5, 5, "pull")},
0051 {"Residual_d0", BoostRegularAxis(100, -0.5, 0.5, "r_{d0} [mm]")},
0052 {"Residual_z0", BoostRegularAxis(100, -0.5, 0.5, "r_{z0} [mm]")},
0053 {"Residual_phi", BoostRegularAxis(100, -0.01, 0.01, "r_{#phi} [rad]")},
0054 {"Residual_theta",
0055 BoostRegularAxis(100, -0.01, 0.01, "r_{#theta} [rad]")},
0056 {"Residual_qop", BoostRegularAxis(100, -0.1, 0.1, "r_{q/p} [c/GeV]")},
0057 {"Residual_t", BoostRegularAxis(100, -100, 100, "r_{t} [mm/c]")},
0058 {"Residual_qopt", BoostRegularAxis(100, -0.1, 0.1, "r_{q/pT} [c/GeV]")},
0059 {"Residual_qopt_rel",
0060 BoostRegularAxis(100, -0.1, 0.1, "r_{rel q/pT} [%]")}};
0061 };
0062
0063
0064
0065 ResPlotTool(const Config& cfg, Acts::Logging::Level lvl);
0066
0067
0068
0069
0070 void fill(const Acts::GeometryContext& gctx,
0071 const SimParticleState& truthParticle,
0072 const Acts::BoundTrackParameters& fittedParamters);
0073
0074 const std::map<std::string, Histogram1>& res() const { return m_res; }
0075 const std::map<std::string, Histogram2>& resVsEta() const {
0076 return m_resVsEta;
0077 }
0078 const std::map<std::string, Histogram2>& resVsPt() const { return m_resVsPt; }
0079 const std::map<std::string, Histogram3>& resVsEtaPhi() const {
0080 return m_resVsEtaPhi;
0081 }
0082 const std::map<std::string, Histogram3>& resVsEtaPt() const {
0083 return m_resVsEtaPt;
0084 }
0085 const std::map<std::string, Histogram1>& pull() const { return m_pull; }
0086 const std::map<std::string, Histogram2>& pullVsEta() const {
0087 return m_pullVsEta;
0088 }
0089 const std::map<std::string, Histogram2>& pullVsPt() const {
0090 return m_pullVsPt;
0091 }
0092 const std::map<std::string, Histogram3>& pullVsEtaPhi() const {
0093 return m_pullVsEtaPhi;
0094 }
0095 const std::map<std::string, Histogram3>& pullVsEtaPt() const {
0096 return m_pullVsEtaPt;
0097 }
0098
0099 private:
0100 Config m_cfg;
0101
0102 std::unique_ptr<const Acts::Logger> m_logger;
0103
0104
0105 std::map<std::string, Histogram1> m_res;
0106
0107 std::map<std::string, Histogram2> m_resVsEta;
0108
0109 std::map<std::string, Histogram2> m_resVsPt;
0110
0111 std::map<std::string, Histogram3> m_resVsEtaPhi;
0112
0113 std::map<std::string, Histogram3> m_resVsEtaPt;
0114
0115
0116 std::map<std::string, Histogram1> m_pull;
0117
0118 std::map<std::string, Histogram2> m_pullVsEta;
0119
0120 std::map<std::string, Histogram2> m_pullVsPt;
0121
0122 std::map<std::string, Histogram3> m_pullVsEtaPhi;
0123
0124 std::map<std::string, Histogram3> m_pullVsEtaPt;
0125
0126 void fillResidual(const std::string& paramName, double residual,
0127 double truthEta, double truthPhi, double truthPt);
0128 void fillPull(const std::string& paramName, double pull, double truthEta,
0129 double truthPhi, double truthPt);
0130
0131 const Acts::Logger& logger() const { return *m_logger; }
0132 };
0133
0134 }