Skip to content

Commit

Permalink
Backup
Browse files Browse the repository at this point in the history
  • Loading branch information
beomki-yeo committed Oct 13, 2024
1 parent 1690e8b commit 0bf980e
Showing 1 changed file with 46 additions and 48 deletions.
94 changes: 46 additions & 48 deletions performance/src/efficiency/seeding_performance_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<TFile> 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<TFile> 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

0 comments on commit 0bf980e

Please sign in to comment.