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) 2023-2025 CERN for the benefit of the ACTS project
0004  *
0005  * Mozilla Public License Version 2.0
0006  */
0007 
0008 #pragma once
0009 
0010 // Project include(s).
0011 #include "traccc/utils/prob.hpp"
0012 
0013 namespace traccc {
0014 
0015 template <typename track_backend_t>
0016 void stat_plot_tool::fill(stat_plot_cache& cache,
0017                           const edm::track<track_backend_t>& fit_res) const {
0018   // Avoid unused variable warnings when building the code without ROOT.
0019   (void)cache;
0020   (void)fit_res;
0021 
0022 #ifdef TRACCC_HAVE_ROOT
0023   const scalar ndf = fit_res.ndf();
0024   const scalar chi2 = fit_res.chi2();
0025   cache.ndf_hist->Fill(ndf);
0026   cache.chi2_hist->Fill(chi2);
0027   cache.reduced_chi2_hist->Fill(chi2 / ndf);
0028   cache.pval_hist->Fill(fit_res.pval());
0029 #endif  // TRACCC_HAVE_ROOT
0030 }
0031 
0032 template <typename track_state_backend_t>
0033 void stat_plot_tool::fill(
0034     stat_plot_cache& cache,
0035     const edm::track_state<track_state_backend_t>& trk_state,
0036     const edm::measurement_collection::host& measurements) const {
0037   // Avoid unused variable warnings when building the code without ROOT.
0038   (void)cache;
0039   (void)trk_state;
0040   (void)measurements;
0041 
0042 #ifdef TRACCC_HAVE_ROOT
0043   const unsigned int D =
0044       measurements.at(trk_state.measurement_index()).dimensions();
0045   const scalar filtered_chi2 = trk_state.filtered_chi2();
0046   const scalar smoothed_chi2 = trk_state.smoothed_chi2();
0047   cache.chi2_filtered_hist[D]->Fill(filtered_chi2);
0048   cache.chi2_smoothed_hist[D]->Fill(smoothed_chi2);
0049   cache.pval_filtered_hist[D]->Fill(
0050       prob(filtered_chi2, static_cast<traccc::scalar>(D)));
0051   cache.pval_smoothed_hist[D]->Fill(
0052       prob(smoothed_chi2, static_cast<traccc::scalar>(D)));
0053 #endif  // TRACCC_HAVE_ROOT
0054 }
0055 
0056 }  // namespace traccc