@@ -77,6 +77,10 @@ void seeding_performance_writer::write(
7777 const measurement_collection_types::const_device measurements (
7878 measurements_view);
7979
80+ const std::size_t n_seeds = seeds.size ();
81+
82+ std::size_t total_fake_seeds = 0 ;
83+
8084 // Iterate over the seeds.
8185 for (edm::seed_collection::const_device::size_type i = 0u ; i < seeds.size ();
8286 ++i) {
@@ -143,34 +147,75 @@ void seeding_performance_writer::write(
143147 assert (seed_measurements.size () > 0u );
144148 if (static_cast <double >(particle_hit_counts.at (0 ).hit_counts ) /
145149 static_cast <double >(seed_measurements.size ()) >
146- m_cfg.matching_ratio ) {
150+ m_cfg.truth_config . matching_ratio ) {
147151 auto pid = particle_hit_counts.at (0 ).ptc .particle_id ;
148152 match_counter[pid]++;
153+ } else {
154+ total_fake_seeds++;
149155 }
150156 }
151157
158+ std::size_t total_truth_particles = 0 ;
159+ std::size_t total_matched_truth_particles = 0 ;
160+ std::size_t total_duplicate_seeds = 0 ;
161+
152162 for (auto const & [pid, ptc] : evt_data.m_particle_map ) {
163+ std::size_t num_measurements = 0 ;
164+
165+ // Find the number of measurements belonging to this track
166+ if (auto it = evt_data.m_ptc_to_meas_map .find (ptc);
167+ it != evt_data.m_ptc_to_meas_map .end ()) {
168+ num_measurements = it->second .size ();
169+ } else {
170+ continue ;
171+ }
153172
154173 // Count only charged particles which satisfiy pT_cut
155- if (ptc.charge == 0 || vector::perp (ptc.momentum ) < m_cfg.pT_cut ||
156- ptc.vertex [2 ] < m_cfg.z_min || ptc.vertex [2 ] > m_cfg.z_max ||
157- vector::perp (ptc.vertex ) > m_cfg.r_max ) {
174+ if (ptc.charge == 0 ||
175+ vector::perp (ptc.momentum ) < m_cfg.truth_config .pT_min ||
176+ ptc.vertex [2 ] < m_cfg.truth_config .z_min ||
177+ ptc.vertex [2 ] > m_cfg.truth_config .z_max ||
178+ vector::perp (ptc.vertex ) > m_cfg.truth_config .r_max ||
179+ num_measurements < m_cfg.truth_config .min_track_candidates ) {
158180 continue ;
159181 }
160182
183+ total_truth_particles++;
184+
161185 bool is_matched = false ;
162186 std::size_t n_matched_seeds_for_particle = 0 ;
163187 auto it = match_counter.find (pid);
164188 if (it != match_counter.end ()) {
165189 is_matched = true ;
166190 n_matched_seeds_for_particle = it->second ;
191+ total_matched_truth_particles++;
192+ total_duplicate_seeds += n_matched_seeds_for_particle - 1 ;
167193 }
168194
169195 m_data->m_eff_plot_tool .fill (m_data->m_eff_plot_cache , ptc, is_matched);
170196 m_data->m_duplication_plot_tool .fill (m_data->m_duplication_plot_cache ,
171197 ptc,
172198 n_matched_seeds_for_particle - 1 );
173199 }
200+
201+ TRACCC_INFO (" Total number of truth particles was "
202+ << total_truth_particles);
203+ TRACCC_INFO (" Total number of found seeds was " << n_seeds);
204+ TRACCC_INFO (" Total number of seed-matched particles was "
205+ << total_matched_truth_particles);
206+ TRACCC_INFO (" Total number of duplicate seeds was "
207+ << total_duplicate_seeds);
208+ TRACCC_INFO (" Total number of fake seeds was " << total_fake_seeds);
209+ TRACCC_INFO (" Total seed efficiency was "
210+ << (100 . * static_cast <double >(total_matched_truth_particles) /
211+ static_cast <double >(total_truth_particles))
212+ << " %" );
213+ TRACCC_INFO (" Total seed duplicate rate was "
214+ << (static_cast <double >(total_duplicate_seeds) /
215+ static_cast <double >(total_matched_truth_particles)));
216+ TRACCC_INFO (" Total seed fake rate was "
217+ << (static_cast <double >(total_fake_seeds) /
218+ static_cast <double >(total_truth_particles)));
174219}
175220
176221void seeding_performance_writer::finalize () {
0 commit comments