@@ -58,11 +58,11 @@ void Truthiness::process(const Truthiness::Input& input,
5858
5959 const double assoc_penalty = energy_penalty + momentum_penalty + pdg_penalty;
6060
61- debug (" Association: MC PDG={} (E={:.3f}, p=[{:.3f},{:.3f},{:.3f}]) <-> "
61+ trace (" Association: MC PDG={} (E={:.3f}, p=[{:.3f},{:.3f},{:.3f}]) <-> "
6262 " RC PDG={} (E={:.3f}, p=[{:.3f},{:.3f},{:.3f}])" ,
6363 mc_part.getPDG (), mc_energy, mc_momentum.x , mc_momentum.y , mc_momentum.z ,
6464 rc_part.getPDG (), rc_energy, rc_momentum.x , rc_momentum.y , rc_momentum.z );
65- debug (" Energy penalty: {:.6f}, Momentum penalty: {:.6f}, PDG penalty: {:.0f}" , energy_penalty,
65+ trace (" Energy penalty: {:.6f}, Momentum penalty: {:.6f}, PDG penalty: {:.0f}" , energy_penalty,
6666 momentum_penalty, pdg_penalty);
6767
6868 truthiness += assoc_penalty;
@@ -74,13 +74,13 @@ void Truthiness::process(const Truthiness::Input& input,
7474 if (mc_part.getGeneratorStatus () == 2 && mc_part.getCharge () != 0.0 ) {
7575 if (associated_mc_particles.find (mc_part) == associated_mc_particles.end ()) {
7676 unassociated_mc_count++;
77- debug (" Unassociated MC particle: PDG={}, charge={:.1f}, status={}" , mc_part.getPDG (),
77+ trace (" Unassociated MC particle: PDG={}, charge={:.1f}, status={}" , mc_part.getPDG (),
7878 mc_part.getCharge (), mc_part.getGeneratorStatus ());
7979 }
8080 }
8181 }
8282 const double mc_penalty = static_cast <double >(unassociated_mc_count);
83- debug (" Unassociated charged MC particles (status 2): {} (penalty: {:.0f})" , unassociated_mc_count,
83+ trace (" Unassociated charged MC particles (status 2): {} (penalty: {:.0f})" , unassociated_mc_count,
8484 mc_penalty);
8585 truthiness += mc_penalty;
8686
@@ -89,19 +89,24 @@ void Truthiness::process(const Truthiness::Input& input,
8989 for (const auto & rc_part : *rc_particles) {
9090 if (associated_rc_particles.find (rc_part) == associated_rc_particles.end ()) {
9191 unassociated_rc_count++;
92- debug (" Unassociated reconstructed particle: PDG={}, E={:.3f}, p=[{:.3f},{:.3f},{:.3f}]" ,
92+ trace (" Unassociated reconstructed particle: PDG={}, E={:.3f}, p=[{:.3f},{:.3f},{:.3f}]" ,
9393 rc_part.getPDG (), rc_part.getEnergy (), rc_part.getMomentum ().x , rc_part.getMomentum ().y ,
9494 rc_part.getMomentum ().z );
9595 }
9696 }
9797 const double rc_penalty = static_cast <double >(unassociated_rc_count);
98- debug (" Unassociated reconstructed particles: {} (penalty: {:.0f})" , unassociated_rc_count,
98+ trace (" Unassociated reconstructed particles: {} (penalty: {:.0f})" , unassociated_rc_count,
9999 rc_penalty);
100100 truthiness += rc_penalty;
101101
102+ // Update statistics using online updating formula
103+ // avg_n = avg_(n-1) + (x_n - avg_(n-1)) / n
104+ m_event_count++;
105+ m_average_truthiness += (truthiness - m_average_truthiness) / m_event_count;
106+
102107 // Report final truthiness
103- info (" Event truthiness: {:.6f} (from {} associations, {} unassociated MC, {} unassociated RC)" ,
104- truthiness, associations->size (), unassociated_mc_count, unassociated_rc_count);
108+ debug (" Event truthiness: {:.6f} (from {} associations, {} unassociated MC, {} unassociated RC)" ,
109+ truthiness, associations->size (), unassociated_mc_count, unassociated_rc_count);
105110}
106111
107112} // namespace eicrecon
0 commit comments