File indexing completed on 2025-12-05 09:16:42
0001
0002
0003
0004
0005
0006
0007
0008
0009 #pragma once
0010
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Geometry/GeometryContext.hpp"
0013 #include "Acts/Surfaces/PerigeeSurface.hpp"
0014 #include "Acts/Utilities/Logger.hpp"
0015 #include "ActsExamples/EventData/SimParticle.hpp"
0016 #include "ActsExamples/Utilities/Helpers.hpp"
0017
0018 #include <map>
0019 #include <memory>
0020 #include <string>
0021
0022 class TEfficiency;
0023
0024 namespace ActsExamples {
0025
0026
0027
0028
0029 class EffPlotTool {
0030 public:
0031
0032 struct Config {
0033 std::map<std::string, PlotHelpers::Binning> varBinning = {
0034 {"Eta", PlotHelpers::Binning::Uniform("#eta", 40, -3.0, 3.0)},
0035 {"Phi", PlotHelpers::Binning::Uniform("#phi", 100, -std::numbers::pi,
0036 std::numbers::pi)},
0037 {"Pt", PlotHelpers::Binning::Uniform("pT [GeV/c]", 40, 0, 100)},
0038 {"LogPt",
0039 PlotHelpers::Binning::Logarithmic("pT [GeV/c]", 11, 0.1, 100)},
0040 {"LowPt", PlotHelpers::Binning::Uniform("pT [GeV/c]", 40, 0, 2)},
0041 {"D0", PlotHelpers::Binning::Uniform("d_0 [mm]", 200, -200, 200)},
0042 {"Z0", PlotHelpers::Binning::Uniform("z_0 [mm]", 50, -200, 200)},
0043 {"DeltaR", PlotHelpers::Binning::Uniform("#Delta R", 100, 0, 0.3)},
0044 {"prodR", PlotHelpers::Binning::Uniform("prod_R [mm]", 100, 0, 200)}};
0045
0046 double minTruthPt = 1.0 * Acts::UnitConstants::GeV;
0047
0048 std::vector<std::pair<double, double>> truthPtRangesForEta = {
0049 {0.9 * Acts::UnitConstants::GeV, 1.1 * Acts::UnitConstants::GeV},
0050 {9 * Acts::UnitConstants::GeV, 11 * Acts::UnitConstants::GeV},
0051 {90 * Acts::UnitConstants::GeV, 110 * Acts::UnitConstants::GeV}};
0052
0053 std::vector<std::pair<double, double>> truthAbsEtaRangesForPt = {
0054 {0, 0.2}, {0, 0.8}, {1, 2}, {2, 3}};
0055
0056
0057 std::shared_ptr<Acts::Surface> beamline =
0058 Acts::Surface::makeShared<Acts::PerigeeSurface>(Acts::Vector3::Zero());
0059 };
0060
0061
0062 struct Cache {
0063
0064 TEfficiency* trackEff_vs_eta{nullptr};
0065
0066 TEfficiency* trackEff_vs_phi{nullptr};
0067
0068 TEfficiency* trackEff_vs_pT{nullptr};
0069
0070 TEfficiency* trackEff_vs_LogPt{nullptr};
0071
0072 TEfficiency* trackEff_vs_LowPt{nullptr};
0073
0074 TEfficiency* trackEff_vs_d0{nullptr};
0075
0076 TEfficiency* trackEff_vs_z0{nullptr};
0077
0078 TEfficiency* trackEff_vs_DeltaR{nullptr};
0079
0080 TEfficiency* trackEff_vs_prodR{nullptr};
0081
0082
0083 TEfficiency* trackEff_vs_eta_phi{nullptr};
0084
0085 TEfficiency* trackEff_vs_eta_pt{nullptr};
0086
0087
0088 std::vector<TEfficiency*> trackEff_vs_eta_inPtRanges;
0089
0090 std::vector<TEfficiency*> trackEff_vs_pT_inAbsEtaRanges;
0091 };
0092
0093
0094
0095
0096
0097 EffPlotTool(const Config& cfg, Acts::Logging::Level lvl);
0098
0099
0100
0101
0102 void book(Cache& cache) const;
0103
0104
0105
0106
0107
0108
0109
0110
0111 void fill(const Acts::GeometryContext& gctx, Cache& cache,
0112 const SimParticleState& truthParticle, double deltaR,
0113 bool status) const;
0114
0115
0116
0117
0118 void write(const Cache& cache) const;
0119
0120
0121
0122
0123 void clear(Cache& cache) const;
0124
0125 private:
0126
0127 Config m_cfg;
0128
0129 std::unique_ptr<const Acts::Logger> m_logger;
0130
0131
0132 const Acts::Logger& logger() const { return *m_logger; }
0133 };
0134
0135 }