Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-03 07:48:08

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
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/Histogram.hpp"
0015 #include "Acts/Utilities/Logger.hpp"
0016 #include "ActsExamples/EventData/SimParticle.hpp"
0017 
0018 #include <map>
0019 #include <memory>
0020 #include <string>
0021 #include <vector>
0022 
0023 namespace ActsExamples {
0024 
0025 /// Tools to make efficiency plots to show tracking efficiency.
0026 /// For the moment, the efficiency is taken as the fraction of successfully
0027 /// smoothed track over all tracks
0028 class EffPlotTool {
0029  public:
0030   using AxisVariant = Acts::Experimental::AxisVariant;
0031   using BoostLogAxis = Acts::Experimental::BoostLogAxis;
0032   using BoostRegularAxis = Acts::Experimental::BoostRegularAxis;
0033   using Efficiency1 = Acts::Experimental::Efficiency1;
0034   using Efficiency2 = Acts::Experimental::Efficiency2;
0035 
0036   /// @brief The nested configuration struct
0037   struct Config {
0038     std::map<std::string, AxisVariant> varBinning = {
0039         {"Eta", BoostRegularAxis(40, -3.0, 3.0, "#eta")},
0040         {"Phi",
0041          BoostRegularAxis(100, -std::numbers::pi, std::numbers::pi, "#phi")},
0042         {"Pt", BoostRegularAxis(40, 0, 100, "pT [GeV/c]")},
0043         {"LogPt", BoostLogAxis(11, 0.1, 100, "pT [GeV/c]")},
0044         {"LowPt", BoostRegularAxis(40, 0, 2, "pT [GeV/c]")},
0045         {"D0", BoostRegularAxis(200, -200, 200, "d_0 [mm]")},
0046         {"Z0", BoostRegularAxis(50, -200, 200, "z_0 [mm]")},
0047         {"DeltaR", BoostRegularAxis(100, 0, 0.3, "#Delta R")},
0048         {"prodR", BoostRegularAxis(100, 0, 200, "prod_R [mm]")}};
0049 
0050     double minTruthPt = 1.0 * Acts::UnitConstants::GeV;
0051 
0052     std::vector<std::pair<double, double>> truthPtRangesForEta = {
0053         {0.9 * Acts::UnitConstants::GeV, 1.1 * Acts::UnitConstants::GeV},
0054         {9 * Acts::UnitConstants::GeV, 11 * Acts::UnitConstants::GeV},
0055         {90 * Acts::UnitConstants::GeV, 110 * Acts::UnitConstants::GeV}};
0056 
0057     std::vector<std::pair<double, double>> truthAbsEtaRangesForPt = {
0058         {0, 0.2}, {0, 0.8}, {1, 2}, {2, 3}};
0059 
0060     /// Beamline to estimate d0 and z0
0061     std::shared_ptr<Acts::Surface> beamline =
0062         Acts::Surface::makeShared<Acts::PerigeeSurface>(Acts::Vector3::Zero());
0063   };
0064 
0065   /// Constructor
0066   ///
0067   /// @param cfg Configuration struct
0068   /// @param lvl Message level declaration
0069   EffPlotTool(const Config& cfg, Acts::Logging::Level lvl);
0070 
0071   /// @brief fill efficiency plots
0072   ///
0073   /// @param gctx geometry context
0074   /// @param truthParticle the truth Particle
0075   /// @param deltaR the distance to the closest truth particle
0076   /// @param status the reconstruction status
0077   void fill(const Acts::GeometryContext& gctx,
0078             const SimParticleState& truthParticle, double deltaR, bool status);
0079 
0080   /// @brief Accessors for efficiency maps (const reference)
0081   const std::map<std::string, Efficiency1>& efficiencies1D() const {
0082     return m_efficiencies1D;
0083   }
0084   const std::map<std::string, Efficiency2>& efficiencies2D() const {
0085     return m_efficiencies2D;
0086   }
0087   const std::vector<Efficiency1>& trackEffVsEtaInPtRanges() const {
0088     return m_trackEffVsEtaInPtRanges;
0089   }
0090   const std::vector<Efficiency1>& trackEffVsPtInAbsEtaRanges() const {
0091     return m_trackEffVsPtInAbsEtaRanges;
0092   }
0093 
0094  private:
0095   const Acts::Logger& logger() const { return *m_logger; }
0096 
0097   Config m_cfg;
0098   std::unique_ptr<const Acts::Logger> m_logger;
0099 
0100   std::map<std::string, Efficiency1> m_efficiencies1D;
0101   std::map<std::string, Efficiency2> m_efficiencies2D;
0102   std::vector<Efficiency1> m_trackEffVsEtaInPtRanges;
0103   std::vector<Efficiency1> m_trackEffVsPtInAbsEtaRanges;
0104 };
0105 
0106 }  // namespace ActsExamples