@@ -36,14 +36,8 @@ void Truthiness::process(const Truthiness::Input& input,
3636
3737#if __has_include(<edm4eic/Truthiness.h>)
3838 // Vectors to store per-association contributions
39- std::vector<float > assoc_truthiness_vec;
40- std::vector<float > assoc_pid_vec;
41- std::vector<float > assoc_energy_vec;
42- std::vector<float > assoc_momentum_vec;
39+ std::vector<edm4eic::TruthinessContribution> assoc_truthiness_vec;
4340 assoc_truthiness_vec.reserve (associations->size ());
44- assoc_pid_vec.reserve (associations->size ());
45- assoc_energy_vec.reserve (associations->size ());
46- assoc_momentum_vec.reserve (associations->size ());
4741#endif
4842
4943 // Process all associations
@@ -91,10 +85,9 @@ void Truthiness::process(const Truthiness::Input& input,
9185 total_momentum_contribution += momentum_penalty;
9286
9387#if __has_include(<edm4eic/Truthiness.h>)
94- assoc_truthiness_vec.push_back (static_cast <float >(assoc_penalty));
95- assoc_pid_vec.push_back (static_cast <float >(pdg_penalty));
96- assoc_energy_vec.push_back (static_cast <float >(energy_penalty));
97- assoc_momentum_vec.push_back (static_cast <float >(momentum_penalty));
88+ assoc_truthiness_vec.push_back ({.pid = static_cast <float >(pdg_penalty),
89+ .energy = static_cast <float >(energy_penalty),
90+ .momentum = static_cast <float >(momentum_penalty)});
9891#endif
9992 }
10093
@@ -159,36 +152,28 @@ void Truthiness::process(const Truthiness::Input& input,
159152 auto truthiness_obj = truthiness_output->create ();
160153
161154 // Set scalar values
162- truthiness_obj.setEvent_truthiness (static_cast <float >(truthiness));
163- truthiness_obj.setEvent_pid_contribution (static_cast <float >(total_pid_contribution));
164- truthiness_obj.setEvent_energy_contribution (static_cast <float >(total_energy_contribution));
165- truthiness_obj.setEvent_momentum_contribution (static_cast <float >(total_momentum_contribution));
166- truthiness_obj.setUnassociated_mc_particles_contribution (static_cast <float >(mc_penalty));
167- truthiness_obj.setUnassociated_rc_particles_contribution (static_cast <float >(rc_penalty));
155+ truthiness_obj.setTruthiness (static_cast <float >(truthiness));
156+ truthiness_obj.setAssociationContribution (
157+ {.pid = static_cast <float >(total_pid_contribution),
158+ .energy = static_cast <float >(total_energy_contribution),
159+ .momentum = static_cast <float >(total_momentum_contribution)});
160+ truthiness_obj.setUnassociatedMCParticlesContribution (static_cast <float >(mc_penalty));
161+ truthiness_obj.setUnassociatedRecoParticlesContribution (static_cast <float >(rc_penalty));
168162
169163 // Add associations and their contributions
170164 for (const auto & assoc : *associations) {
171165 truthiness_obj.addToAssociations (assoc);
172166 }
173167 for (const auto & val : assoc_truthiness_vec) {
174- truthiness_obj.addToAssociation_truthiness (val);
175- }
176- for (const auto & val : assoc_pid_vec) {
177- truthiness_obj.addToAssociation_pid_contribution (val);
178- }
179- for (const auto & val : assoc_energy_vec) {
180- truthiness_obj.addToAssociation_energy_contribution (val);
181- }
182- for (const auto & val : assoc_momentum_vec) {
183- truthiness_obj.addToAssociation_momentum_contribution (val);
168+ truthiness_obj.addToAssociationContributions (val);
184169 }
185170
186171 // Add unassociated particles
187172 for (const auto & mc_part : unassociated_mc_vec) {
188- truthiness_obj.addToUnassociated_mc_particles (mc_part);
173+ truthiness_obj.addToUnassociatedMCParticles (mc_part);
189174 }
190175 for (const auto & rc_part : unassociated_rc_vec) {
191- truthiness_obj.addToUnassociated_rc_particles (rc_part);
176+ truthiness_obj.addToUnassociatedRecoParticles (rc_part);
192177 }
193178#endif
194179}
0 commit comments