Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-30 08:00:44

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::string label = "track";
0039     std::map<std::string, AxisVariant> varBinning = {
0040         {"Eta", BoostRegularAxis(40, -3.0, 3.0, "truth #eta")},
0041         {"Phi", BoostRegularAxis(100, -std::numbers::pi, std::numbers::pi,
0042                                  "truth #phi")},
0043         {"Pt", BoostRegularAxis(40, 0, 100, "truth p_{T} [GeV/c]")},
0044         {"LogPt", BoostLogAxis(11, 0.1, 100, "truth p_{T} [GeV/c]")},
0045         {"LowPt", BoostRegularAxis(40, 0, 2, "truth p_{T} [GeV/c]")},
0046         {"D0", BoostRegularAxis(200, -200, 200, "truth d_{0} [mm]")},
0047         {"Z0", BoostRegularAxis(50, -200, 200, "truth z_{0} [mm]")},
0048         {"DeltaR", BoostRegularAxis(100, 0, 0.3, "truth #Delta R")},
0049         {"prodR", BoostRegularAxis(100, 0, 200, "truth R_{prod} [mm]")}};
0050 
0051     double minTruthPt = 1.0 * Acts::UnitConstants::GeV;
0052 
0053     std::vector<std::pair<double, double>> truthPtRangesForEta = {
0054         {0.9 * Acts::UnitConstants::GeV, 1.1 * Acts::UnitConstants::GeV},
0055         {9 * Acts::UnitConstants::GeV, 11 * Acts::UnitConstants::GeV},
0056         {90 * Acts::UnitConstants::GeV, 110 * Acts::UnitConstants::GeV}};
0057 
0058     std::vector<std::pair<double, double>> truthAbsEtaRangesForPt = {
0059         {0, 0.2}, {0, 0.8}, {1, 2}, {2, 3}};
0060 
0061     /// Beamline to estimate d0 and z0
0062     std::shared_ptr<Acts::Surface> beamline =
0063         Acts::Surface::makeShared<Acts::PerigeeSurface>(Acts::Vector3::Zero());
0064   };
0065 
0066   /// Constructor
0067   ///
0068   /// @param cfg Configuration struct
0069   /// @param lvl Message level declaration
0070   EffPlotTool(const Config& cfg, Acts::Logging::Level lvl);
0071 
0072   /// @brief fill efficiency plots
0073   ///
0074   /// @param gctx geometry context
0075   /// @param truthParticle the truth Particle
0076   /// @param deltaR the distance to the closest truth particle
0077   /// @param status the reconstruction status
0078   void fill(const Acts::GeometryContext& gctx,
0079             const SimParticleState& truthParticle, double deltaR, bool status);
0080 
0081   /// @brief Accessors for efficiency maps (const reference)
0082   const std::map<std::string, Efficiency1>& efficiencies1D() const {
0083     return m_efficiencies1D;
0084   }
0085   const std::map<std::string, Efficiency2>& efficiencies2D() const {
0086     return m_efficiencies2D;
0087   }
0088   const std::vector<Efficiency1>& trackEffVsEtaInPtRanges() const {
0089     return m_trackEffVsEtaInPtRanges;
0090   }
0091   const std::vector<Efficiency1>& trackEffVsPtInAbsEtaRanges() const {
0092     return m_trackEffVsPtInAbsEtaRanges;
0093   }
0094 
0095  private:
0096   const Acts::Logger& logger() const { return *m_logger; }
0097 
0098   Config m_cfg;
0099   std::unique_ptr<const Acts::Logger> m_logger;
0100 
0101   std::map<std::string, Efficiency1> m_efficiencies1D;
0102   std::map<std::string, Efficiency2> m_efficiencies2D;
0103   std::vector<Efficiency1> m_trackEffVsEtaInPtRanges;
0104   std::vector<Efficiency1> m_trackEffVsPtInAbsEtaRanges;
0105 };
0106 
0107 }  // namespace ActsExamples