Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-31 08:35:18

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