Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:28:02

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2019 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 http://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   void book(TrackSummaryPlotCache& trackSummaryPlotCache) const;
0063 
0064   /// @brief fill reco track info w.r.t. fitted track parameters
0065   ///
0066   /// @param trackSummaryPlotCache cache object for track info plots
0067   /// @param fittedParameters fitted track parameters of this track
0068   /// @param nStates number of track states
0069   /// @param nMeasurements number of measurements
0070   /// @param nOutliers number of outliers
0071   /// @param nHoles number of holes
0072   void fill(TrackSummaryPlotCache& trackSummaryPlotCache,
0073             const Acts::BoundTrackParameters& fittedParameters,
0074             std::size_t nStates, std::size_t nMeasurements,
0075             std::size_t Outliers, std::size_t nHoles,
0076             std::size_t nSharedHits) const;
0077 
0078   /// @brief write the track info plots to file
0079   ///
0080   /// @param trackSummaryPlotCache cache object for track info plots
0081   void write(const TrackSummaryPlotCache& trackSummaryPlotCache) const;
0082 
0083   /// @brief delete the track info plots
0084   ///
0085   /// @param trackSummaryPlotCache cache object for track info plots
0086   void clear(TrackSummaryPlotCache& trackSummaryPlotCache) const;
0087 
0088  private:
0089   Config m_cfg;                                  ///< The Config class
0090   std::unique_ptr<const Acts::Logger> m_logger;  ///< The logging instance
0091 
0092   /// The logger
0093   const Acts::Logger& logger() const { return *m_logger; }
0094 };
0095 
0096 }  // namespace ActsExamples