Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-29 08:40:55

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/Utilities/Histogram.hpp"
0012 #include "Acts/Utilities/Logger.hpp"
0013 #include "ActsExamples/EventData/SimParticle.hpp"
0014 
0015 #include <cstddef>
0016 #include <map>
0017 #include <memory>
0018 #include <string>
0019 
0020 namespace ActsExamples {
0021 
0022 /// Tools to make duplication ratio (formerly called duplication rate) and
0023 /// duplication number plots to show tracking duplication.
0024 ///
0025 /// The duplication ratio is evaluated on truth-matched reco tracks. If there
0026 /// is more than one track matched to the same truth particle, the reco track
0027 /// with the highest matching probability is tagged as 'real' and the others are
0028 /// 'duplicated'.
0029 class DuplicationPlotTool {
0030  public:
0031   using AxisVariant = Acts::Experimental::AxisVariant;
0032   using BoostRegularAxis = Acts::Experimental::BoostRegularAxis;
0033   using Efficiency1 = Acts::Experimental::Efficiency1;
0034   using ProfileHistogram1 = Acts::Experimental::ProfileHistogram1;
0035 
0036   /// @brief The nested configuration struct
0037   struct Config {
0038     std::map<std::string, AxisVariant> varBinning = {
0039         {"Eta", BoostRegularAxis(40, -4, 4, "#eta")},
0040         {"Phi", BoostRegularAxis(100, -3.15, 3.15, "#phi")},
0041         {"Pt", BoostRegularAxis(40, 0, 100, "pT [GeV/c]")},
0042         {"Num", BoostRegularAxis(30, -0.5, 29.5, "N")}};
0043   };
0044 
0045   /// Constructor
0046   ///
0047   /// @param cfg Configuration struct
0048   /// @param lvl Message level declaration
0049   DuplicationPlotTool(const Config& cfg, Acts::Logging::Level lvl);
0050 
0051   /// @brief fill duplication ratio w.r.t. fitted track parameters
0052   ///
0053   /// @param fittedParameters fitted track parameters of this track
0054   /// @param status the (truth-matched) reconstructed track is duplicated or not
0055   void fill(const Acts::BoundTrackParameters& fittedParameters, bool status);
0056 
0057   /// @brief fill number of duplicated tracks for a truth particle seed
0058   ///
0059   /// @param truthParticle the truth Particle
0060   /// @param nDuplicatedTracks the number of matched tracks
0061   void fill(const SimParticleState& truthParticle, std::size_t nMatchedTracks);
0062 
0063   /// @brief Accessors for histogram maps (const reference)
0064   const std::map<std::string, ProfileHistogram1>& profiles() const {
0065     return m_profiles;
0066   }
0067   const std::map<std::string, Efficiency1>& efficiencies() const {
0068     return m_efficiencies;
0069   }
0070 
0071  private:
0072   const Acts::Logger& logger() const { return *m_logger; }
0073 
0074   Config m_cfg;
0075   std::unique_ptr<const Acts::Logger> m_logger;
0076 
0077   std::map<std::string, ProfileHistogram1> m_profiles;
0078   std::map<std::string, Efficiency1> m_efficiencies;
0079 };
0080 
0081 }  // namespace ActsExamples