Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-21 08:21:02

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 fake ratio plots.
0023 ///
0024 /// The fake ratio (formerly called fake rate) is evaluated on all reco tracks.
0025 /// A track is 'fake' if it's not matched with truth.
0026 class FakePlotTool {
0027  public:
0028   using AxisVariant = Acts::Experimental::AxisVariant;
0029   using BoostRegularAxis = Acts::Experimental::BoostRegularAxis;
0030   using Efficiency1 = Acts::Experimental::Efficiency1;
0031   using Histogram2 = Acts::Experimental::Histogram2;
0032 
0033   /// @brief The nested configuration struct
0034   struct Config {
0035     std::string label = "track";
0036     /// Truth-particle binning (used by nRecoTracks/nTruthMatched/nFake plots).
0037     std::map<std::string, AxisVariant> varBinning = {
0038         {"Eta", BoostRegularAxis(40, -4, 4, "truth #eta")},
0039         {"Phi", BoostRegularAxis(100, -3.15, 3.15, "truth #phi")},
0040         {"Pt", BoostRegularAxis(40, 0, 100, "truth p_{T} [GeV/c]")},
0041         {"Num", BoostRegularAxis(30, -0.5, 29.5, "N")}};
0042     /// Reconstructed-track binning (used by fake-ratio plots).
0043     std::map<std::string, AxisVariant> recoVarBinning = {
0044         {"Eta", BoostRegularAxis(40, -4, 4, "reco #eta")},
0045         {"Phi", BoostRegularAxis(100, -3.15, 3.15, "reco #phi")},
0046         {"Pt", BoostRegularAxis(40, 0, 100, "reco p_{T} [GeV/c]")},
0047         {"Num", BoostRegularAxis(30, -0.5, 29.5, "N")}};
0048   };
0049 
0050   /// Constructor
0051   ///
0052   /// @param cfg Configuration struct
0053   /// @param lvl Message level declaration
0054   FakePlotTool(const Config& cfg, Acts::Logging::Level lvl);
0055 
0056   /// @brief fill fake ratio w.r.t. fitted track parameters
0057   ///
0058   /// @param fittedParameters fitted track parameters of this track
0059   /// @param status the reconstructed track is fake or not
0060   void fill(const Acts::BoundTrackParameters& fittedParameters, bool status);
0061 
0062   /// @brief fill number of reco/truth-matched/fake tracks for a truth particle
0063   ///
0064   /// @param truthParticle the truth Particle
0065   /// @param nTruthMatchedTracks the number of truth-matched tracks
0066   /// @param nFakeTracks the number of fake tracks
0067   void fill(const SimParticleState& truthParticle,
0068             std::size_t nTruthMatchedTracks, std::size_t nFakeTracks);
0069 
0070   /// @brief Accessors for histogram maps (const reference)
0071   const std::map<std::string, Histogram2>& histograms() const {
0072     return m_histograms;
0073   }
0074   const std::map<std::string, Efficiency1>& efficiencies() const {
0075     return m_efficiencies;
0076   }
0077 
0078  private:
0079   const Acts::Logger& logger() const { return *m_logger; }
0080 
0081   Config m_cfg;
0082   std::unique_ptr<const Acts::Logger> m_logger;
0083 
0084   std::map<std::string, Histogram2> m_histograms;
0085   std::map<std::string, Efficiency1> m_efficiencies;
0086 };
0087 
0088 }  // namespace ActsExamples