|
||||
File indexing completed on 2025-01-18 09:11:48
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/Logger.hpp" 0013 #include "ActsExamples/EventData/SimParticle.hpp" 0014 #include "ActsExamples/Utilities/Helpers.hpp" 0015 0016 #include <cstddef> 0017 #include <map> 0018 #include <memory> 0019 #include <string> 0020 0021 class TEfficiency; 0022 class TH2F; 0023 namespace ActsFatras { 0024 class Particle; 0025 } // namespace ActsFatras 0026 0027 namespace ActsExamples { 0028 0029 // Tools to make fake rate plots to show tracking fake rate. 0030 // 0031 // The fake rate is investigated for all reco tracks. A track is 'fake' if it's 0032 // not matched with truth. 0033 class FakeRatePlotTool { 0034 public: 0035 /// @brief The nested configuration struct 0036 struct Config { 0037 std::map<std::string, PlotHelpers::Binning> varBinning = { 0038 {"Eta", PlotHelpers::Binning("#eta", 40, -4, 4)}, 0039 {"Phi", PlotHelpers::Binning("#phi", 100, -3.15, 3.15)}, 0040 {"Pt", PlotHelpers::Binning("pT [GeV/c]", 40, 0, 100)}, 0041 {"Num", PlotHelpers::Binning("N", 30, -0.5, 29.5)}}; 0042 }; 0043 0044 /// @brief Nested Cache struct 0045 struct FakeRatePlotCache { 0046 TH2F* nReco_vs_pT; ///< Number of reco tracks vs pT scatter plot 0047 TH2F* nTruthMatched_vs_pT; ///< Number of truth-matched reco tracks vs pT 0048 ///< scatter plot 0049 TH2F* nFake_vs_pT; ///< Number of fake (truth-unmatched) tracks vs pT 0050 ///< scatter plot 0051 TH2F* nReco_vs_eta; ///< Number of reco tracks vs eta scatter plot 0052 TH2F* nTruthMatched_vs_eta; ///< Number of truth-matched reco tracks vs eta 0053 ///< scatter plot 0054 TH2F* nFake_vs_eta; ///< Number of fake (truth-unmatched) tracks vs eta 0055 ///< scatter plot 0056 TEfficiency* fakeRate_vs_pT; ///< Tracking fake rate vs pT 0057 TEfficiency* fakeRate_vs_eta; ///< Tracking fake rate vs eta 0058 TEfficiency* fakeRate_vs_phi; ///< Tracking fake rate vs phi 0059 }; 0060 0061 /// Constructor 0062 /// 0063 /// @param cfg Configuration struct 0064 /// @param lvl Message level declaration 0065 FakeRatePlotTool(const Config& cfg, Acts::Logging::Level lvl); 0066 0067 /// @brief book the fake rate plots 0068 /// 0069 /// @param fakeRatePlotCache the cache for fake rate plots 0070 void book(FakeRatePlotCache& fakeRatePlotCache) const; 0071 0072 /// @brief fill fake rate w.r.t. fitted track parameters 0073 /// 0074 /// @param fakeRatePlotCache cache object for fake rate plots 0075 /// @param fittedParameters fitted track parameters of this track 0076 /// @param status the reconstructed track is fake or not 0077 void fill(FakeRatePlotCache& fakeRatePlotCache, 0078 const Acts::BoundTrackParameters& fittedParameters, 0079 bool status) const; 0080 0081 /// @brief fill number of reco/truth-matched/fake tracks for a truth particle 0082 /// seed 0083 /// 0084 /// @param fakeRatePlotCache cache object for fake rate plots 0085 /// @param truthParticle the truth Particle 0086 /// @param nTruthMatchedTracks the number of truth-Matched tracks 0087 /// @param nFakeTracks the number of fake tracks 0088 void fill(FakeRatePlotCache& fakeRatePlotCache, 0089 const SimParticleState& truthParticle, 0090 std::size_t nTruthMatchedTracks, std::size_t nFakeTracks) const; 0091 0092 /// @brief write the fake rate plots to file 0093 /// 0094 /// @param fakeRatePlotCache cache object for fake rate plots 0095 void write(const FakeRatePlotCache& fakeRatePlotCache) const; 0096 0097 /// @brief delete the fake rate plots 0098 /// 0099 /// @param fakeRatePlotCache cache object for fake rate plots 0100 void clear(FakeRatePlotCache& fakeRatePlotCache) const; 0101 0102 private: 0103 Config m_cfg; ///< The Config class 0104 std::unique_ptr<const Acts::Logger> m_logger; ///< The logging instance 0105 0106 /// The logger 0107 const Acts::Logger& logger() const { return *m_logger; } 0108 }; 0109 0110 } // namespace ActsExamples
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |