From 0bf980e29f6a2b3589a929b4d035873a2b413acc Mon Sep 17 00:00:00 2001 From: Beomki Yeo Date: Sun, 13 Oct 2024 04:49:56 +0200 Subject: [PATCH] Backup --- .../efficiency/seeding_performance_writer.cpp | 94 +++++++++---------- 1 file changed, 46 insertions(+), 48 deletions(-) diff --git a/performance/src/efficiency/seeding_performance_writer.cpp b/performance/src/efficiency/seeding_performance_writer.cpp index 46fb4f0a1e..f2967aad70 100644 --- a/performance/src/efficiency/seeding_performance_writer.cpp +++ b/performance/src/efficiency/seeding_performance_writer.cpp @@ -81,63 +81,61 @@ void seeding_performance_writer::write( } else { particle_hit_counts = identify_contributing_particles( measurements, evt_data.m_meas_to_ptc_map); + } + + // Consider it being matched if hit counts is larger than the half + // of the number of measurements + assert(measurements.size() > 0u); + if (particle_hit_counts.at(0).hit_counts / measurements.size() > + m_cfg.matching_ratio) { + auto pid = particle_hit_counts.at(0).ptc.particle_id; + match_counter[pid]++; + } + + for (auto const& [pid, ptc] : evt_data.m_particle_map) { - // Consider it being matched if hit counts is larger than the half - // of the number of measurements - assert(measurements.size() > 0u); - if (particle_hit_counts.at(0).hit_counts / measurements.size() > - m_cfg.matching_ratio) { - auto pid = particle_hit_counts.at(0).ptc.particle_id; - match_counter[pid]++; + // Count only charged particles which satisfiy pT_cut + if (ptc.charge == 0 || getter::perp(ptc.momentum) < m_cfg.pT_cut || + ptc.vertex[2] < m_cfg.z_min || ptc.vertex[2] > m_cfg.z_max || + getter::perp(ptc.vertex) > m_cfg.r_max) { + continue; } - for (auto const& [pid, ptc] : evt_data.m_particle_map) { - - // Count only charged particles which satisfiy pT_cut - if (ptc.charge == 0 || - getter::perp(ptc.momentum) < m_cfg.pT_cut || - ptc.vertex[2] < m_cfg.z_min || - ptc.vertex[2] > m_cfg.z_max || - getter::perp(ptc.vertex) > m_cfg.r_max) { - continue; - } - - bool is_matched = false; - std::size_t n_matched_seeds_for_particle = 0; - auto it = match_counter.find(pid); - if (it != match_counter.end()) { - is_matched = true; - n_matched_seeds_for_particle = it->second; - } - - m_data->m_eff_plot_tool.fill(m_data->m_eff_plot_cache, ptc, - is_matched); - m_data->m_duplication_plot_tool.fill( - m_data->m_duplication_plot_cache, ptc, - n_matched_seeds_for_particle - 1); + bool is_matched = false; + std::size_t n_matched_seeds_for_particle = 0; + auto it = match_counter.find(pid); + if (it != match_counter.end()) { + is_matched = true; + n_matched_seeds_for_particle = it->second; } + + m_data->m_eff_plot_tool.fill(m_data->m_eff_plot_cache, ptc, + is_matched); + m_data->m_duplication_plot_tool.fill( + m_data->m_duplication_plot_cache, ptc, + n_matched_seeds_for_particle - 1); } + } - void seeding_performance_writer::finalize() { + void seeding_performance_writer::finalize() { #ifdef TRACCC_HAVE_ROOT - // Open the output file. - std::unique_ptr ofile( - TFile::Open(m_cfg.file_path.c_str(), m_cfg.file_mode.c_str())); - if ((!ofile) || ofile->IsZombie()) { - throw std::runtime_error("Could not open output file \"" + - m_cfg.file_path + "\" in mode \"" + - m_cfg.file_mode + "\""); - } - ofile->cd(); + // Open the output file. + std::unique_ptr ofile( + TFile::Open(m_cfg.file_path.c_str(), m_cfg.file_mode.c_str())); + if ((!ofile) || ofile->IsZombie()) { + throw std::runtime_error("Could not open output file \"" + + m_cfg.file_path + "\" in mode \"" + + m_cfg.file_mode + "\""); + } + ofile->cd(); #else - std::cout << "ROOT file \"" << m_cfg.file_path - << "\" is NOT created" << std::endl; + std::cout << "ROOT file \"" << m_cfg.file_path << "\" is NOT created" + << std::endl; #endif // TRACCC_HAVE_ROOT - m_data->m_eff_plot_tool.write(m_data->m_eff_plot_cache); - m_data->m_duplication_plot_tool.write( - m_data->m_duplication_plot_cache); - } + m_data->m_eff_plot_tool.write(m_data->m_eff_plot_cache); + m_data->m_duplication_plot_tool.write(m_data->m_duplication_plot_cache); + } - } // namespace traccc +} // namespace traccc