Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-26 08:22:21

0001 /** TRACCC library, part of the ACTS project (R&D line)
0002  *
0003  * (c) 2022-2023 CERN for the benefit of the ACTS project
0004  *
0005  * Mozilla Public License Version 2.0
0006  */
0007 
0008 #pragma once
0009 
0010 // Library include(s).
0011 #include "../utils/helpers.hpp"
0012 #include "traccc/resolution/res_plot_tool_config.hpp"
0013 
0014 // Project include(s).
0015 #include "traccc/edm/particle.hpp"
0016 #include "traccc/edm/track_parameters.hpp"
0017 
0018 // System include(s).
0019 #include <map>
0020 #include <memory>
0021 #include <string>
0022 
0023 namespace traccc {
0024 
0025 class res_plot_tool {
0026  public:
0027   /// @brief Nested Cache struct
0028   struct res_plot_cache {
0029 #ifdef TRACCC_HAVE_ROOT
0030     // Residuals and pulls for parameters
0031     std::map<std::string, std::unique_ptr<TH1>> residuals;
0032     std::map<std::string, std::unique_ptr<TH1>> pulls;
0033     std::map<std::string, std::shared_ptr<TH1>> resolutions_eta;
0034     std::map<std::string, std::shared_ptr<TH1>> resolutions_pT;
0035     std::map<std::string, std::unique_ptr<TH2>> residuals_eta;
0036     std::map<std::string, std::unique_ptr<TH2>> residuals_pT;
0037     std::map<std::string, std::map<std::size_t, std::shared_ptr<TH1>>>
0038         residuals_per_eta;
0039     std::map<std::string, std::map<std::size_t, std::shared_ptr<TH1>>>
0040         residuals_per_pT;
0041 #endif  // TRACCC_HAVE_ROOT
0042   };
0043 
0044   /// Constructor
0045   ///
0046   /// @param cfg Configuration struct
0047   res_plot_tool(const res_plot_tool_config& cfg);
0048 
0049   /// @brief book the resolution plots
0050   ///
0051   /// @param cache the cache for resolution plots
0052   void book(res_plot_cache& cache) const;
0053 
0054   /// @brief fill the cache
0055   ///
0056   /// @param cache the cache for resolution plots
0057   /// @param truth_param truth track parameter
0058   /// @param fit_param fitted track parameter
0059   void fill(res_plot_cache& cache, const bound_track_parameters<>& truth_param,
0060             const bound_track_parameters<>& fit_param,
0061             const particle& ptc) const;
0062 
0063   /// @brief write the resolution plots into ROOT
0064   ///
0065   /// @param cache the cache for resolution plots
0066   void write(res_plot_cache& cache) const;
0067 
0068  private:
0069   res_plot_tool_config m_cfg;  ///< The Config class
0070 };
0071 
0072 }  // namespace traccc