File indexing completed on 2025-09-18 08:17:47
0001
0002
0003 #include "ElectronReconstruction.h"
0004
0005 #include <edm4eic/ClusterCollection.h>
0006 #include <edm4eic/ReconstructedParticleCollection.h>
0007 #include <edm4hep/utils/vector_utils.h>
0008 #include <fmt/core.h>
0009 #include <podio/RelationRange.h>
0010 #include <gsl/pointers>
0011
0012 #include "algorithms/reco/ElectronReconstructionConfig.h"
0013
0014 namespace eicrecon {
0015
0016 void ElectronReconstruction::process(const Input& input, const Output& output) const {
0017
0018 const auto [rcparts] = input;
0019 auto [out_electrons] = output;
0020
0021
0022
0023
0024
0025
0026
0027 out_electrons
0028 ->setSubsetCollection();
0029
0030 for (const auto particle : *rcparts) {
0031
0032 if (particle.getClusters().empty()) {
0033 continue;
0034 }
0035 if (particle.getCharge() == 0) {
0036 continue;
0037 }
0038 double E = particle.getClusters()[0].getEnergy();
0039 double p = edm4hep::utils::magnitude(particle.getMomentum());
0040 double EOverP = E / p;
0041
0042 trace("ReconstructedElectron: Energy={} GeV, p={} GeV, E/p = {} for PDG (from truth): {}", E, p,
0043 EOverP, particle.getPDG());
0044
0045 if (EOverP >= m_cfg.min_energy_over_momentum && EOverP <= m_cfg.max_energy_over_momentum) {
0046 out_electrons->push_back(particle);
0047 }
0048 }
0049 debug("Found {} electron candidates", out_electrons->size());
0050 }
0051 }