Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 08:33:39

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/Utilities/Helpers.hpp"
0014 #include "ActsFatras/EventData/Particle.hpp"
0015 
0016 #include <cstddef>
0017 #include <map>
0018 #include <memory>
0019 #include <string>
0020 
0021 class TProfile;
0022 
0023 namespace ActsExamples {
0024 
0025 // Tools to make track info plots to show tracking track info.
0026 class TrackSummaryPlotTool {
0027  public:
0028   /// @brief The nested configuration struct
0029   struct Config {
0030     std::map<std::string, PlotHelpers::Binning> varBinning = {
0031         {"Eta", PlotHelpers::Binning("#eta", 40, -4, 4)},
0032         {"Phi", PlotHelpers::Binning("#phi", 100, -3.15, 3.15)},
0033         {"Pt", PlotHelpers::Binning("pT [GeV/c]", 40, 0, 100)},
0034         {"Num", PlotHelpers::Binning("N", 30, -0.5, 29.5)}};
0035   };
0036 
0037   /// @brief Nested Cache struct
0038   struct TrackSummaryPlotCache {
0039     TProfile* nStates_vs_eta;  ///< Number of total states vs eta
0040     TProfile*
0041         nMeasurements_vs_eta;    ///< Number of non-outlier measurements vs eta
0042     TProfile* nHoles_vs_eta;     ///< Number of holes vs eta
0043     TProfile* nOutliers_vs_eta;  ///< Number of outliers vs eta
0044     TProfile* nSharedHits_vs_eta;  ///< Number of Shared Hits vs eta
0045     TProfile* nStates_vs_pt;       ///< Number of total states vs pt
0046     TProfile*
0047         nMeasurements_vs_pt;      ///< Number of non-outlier measurements vs pt
0048     TProfile* nHoles_vs_pt;       ///< Number of holes vs pt
0049     TProfile* nOutliers_vs_pt;    ///< Number of outliers vs pt
0050     TProfile* nSharedHits_vs_pt;  ///< Number of Shared Hits vs pt
0051   };
0052 
0053   /// Constructor
0054   ///
0055   /// @param cfg Configuration struct
0056   /// @param lvl Message level declaration
0057   TrackSummaryPlotTool(const Config& cfg, Acts::Logging::Level lvl);
0058 
0059   /// @brief book the track info plots
0060   ///
0061   /// @param trackSummaryPlotCache the cache for track info plots
0062   /// @param prefix a prefix prepended to the name, concatenation with '_'
0063   void book(TrackSummaryPlotCache& trackSummaryPlotCache,
0064             const std::string& prefix = "") const;
0065 
0066   /// @brief fill reco track info w.r.t. fitted track parameters
0067   ///
0068   /// @param trackSummaryPlotCache cache object for track info plots
0069   /// @param fittedParameters fitted track parameters of this track
0070   /// @param nStates number of track states
0071   /// @param nMeasurements number of measurements
0072   /// @param nOutliers number of outliers
0073   /// @param nHoles number of holes
0074   void fill(TrackSummaryPlotCache& trackSummaryPlotCache,
0075             const Acts::BoundTrackParameters& fittedParameters,
0076             std::size_t nStates, std::size_t nMeasurements,
0077             std::size_t Outliers, std::size_t nHoles,
0078             std::size_t nSharedHits) const;
0079 
0080   /// @brief write the track info plots to file
0081   ///
0082   /// @param trackSummaryPlotCache cache object for track info plots
0083   void write(const TrackSummaryPlotCache& trackSummaryPlotCache) const;
0084 
0085   /// @brief delete the track info plots
0086   ///
0087   /// @param trackSummaryPlotCache cache object for track info plots
0088   void clear(TrackSummaryPlotCache& trackSummaryPlotCache) const;
0089 
0090  private:
0091   Config m_cfg;                                  ///< The Config class
0092   std::unique_ptr<const Acts::Logger> m_logger;  ///< The logging instance
0093 
0094   /// The logger
0095   const Acts::Logger& logger() const { return *m_logger; }
0096 };
0097 
0098 }  // namespace ActsExamples