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 CERN for the benefit of the ACTS project
0004  *
0005  * Mozilla Public License Version 2.0
0006  */
0007 
0008 // Library include(s).
0009 #include "helpers.hpp"
0010 
0011 namespace traccc::plot_helpers {
0012 
0013 #ifdef TRACCC_HAVE_ROOT
0014 
0015 std::unique_ptr<TH1> book_histo(std::string_view hist_name,
0016                                 std::string_view hist_title,
0017                                 const binning& var_binning) {
0018   auto result = std::make_unique<TH1F>(
0019       hist_name.data(),
0020       (std::string(hist_title) + ";" + var_binning.title + ";Entries").c_str(),
0021       var_binning.n_bins, var_binning.min, var_binning.max);
0022   result->Sumw2();
0023   return result;
0024 }
0025 
0026 std::unique_ptr<TH2> book_histo(std::string_view hist_name,
0027                                 std::string_view hist_title,
0028                                 const binning& var_x_binning,
0029                                 const binning& var_y_binning) {
0030   auto result = std::make_unique<TH2F>(hist_name.data(), hist_title.data(),
0031                                        var_x_binning.n_bins, var_x_binning.min,
0032                                        var_x_binning.max, var_y_binning.n_bins,
0033                                        var_y_binning.min, var_y_binning.max);
0034 
0035   result->GetXaxis()->SetTitle(var_x_binning.title.c_str());
0036   result->GetYaxis()->SetTitle(var_y_binning.title.c_str());
0037   result->Sumw2();
0038   return result;
0039 }
0040 
0041 std::unique_ptr<TEfficiency> book_eff(std::string_view eff_name,
0042                                       std::string_view eff_title,
0043                                       const binning& var_binning) {
0044   return std::make_unique<TEfficiency>(eff_name.data(), eff_title.data(),
0045                                        var_binning.n_bins, var_binning.min,
0046                                        var_binning.max);
0047 }
0048 
0049 std::unique_ptr<TProfile> book_prof(std::string_view prof_name,
0050                                     std::string_view prof_title,
0051                                     const binning& var_x_binning,
0052                                     const binning& var_y_binning) {
0053   return std::make_unique<TProfile>(
0054       prof_name.data(),
0055       (std::string(prof_title) + ";" + var_x_binning.title + ";" +
0056        var_y_binning.title)
0057           .c_str(),
0058       var_x_binning.n_bins, var_x_binning.min, var_x_binning.max,
0059       var_y_binning.min, var_y_binning.max);
0060 }
0061 
0062 #endif  // TRACCC_HAVE_ROOT
0063 
0064 }  // namespace traccc::plot_helpers