Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 09:41:49

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