File indexing completed on 2025-07-27 07:54:08
0001
0002
0003
0004 #include "MC2ReconstructedParticle.h"
0005
0006 #include <edm4eic/ReconstructedParticleCollection.h>
0007 #include <edm4hep/Vector3d.h>
0008 #include <edm4hep/Vector3f.h>
0009 #include <fmt/core.h>
0010
0011 namespace eicrecon {
0012
0013 void MC2ReconstructedParticle::init() {}
0014
0015 void MC2ReconstructedParticle::process(const MC2ReconstructedParticle::Input& input,
0016 const MC2ReconstructedParticle::Output& output) const {
0017
0018 const auto [mc_particles] = input;
0019 auto [rec_particles] = output;
0020
0021 for (const auto& mc_particle : *mc_particles) {
0022
0023 if (mc_particle.getGeneratorStatus() != 1) {
0024 debug("ignoring particle with generatorStatus = {}", mc_particle.getGeneratorStatus());
0025 continue;
0026 }
0027
0028
0029 using MomType = decltype(edm4eic::ReconstructedParticle().getMomentum().x);
0030
0031 const MomType px = mc_particle.getMomentum().x;
0032 const MomType py = mc_particle.getMomentum().y;
0033 const MomType pz = mc_particle.getMomentum().z;
0034
0035 const MomType vx = mc_particle.getVertex().x;
0036 const MomType vy = mc_particle.getVertex().y;
0037 const MomType vz = mc_particle.getVertex().z;
0038
0039 auto rec_part = rec_particles->create();
0040 rec_part.setType(mc_particle.getGeneratorStatus());
0041 rec_part.setEnergy(mc_particle.getEnergy());
0042 rec_part.setMomentum({px, py, pz});
0043 rec_part.setReferencePoint({vx, vy, vz});
0044 rec_part.setCharge(mc_particle.getCharge());
0045 rec_part.setMass(mc_particle.getMass());
0046 rec_part.setGoodnessOfPID(1);
0047 rec_part.setCovMatrix({0, 0, 0, 0});
0048 rec_part.setPDG(mc_particle.getPDG());
0049 }
0050 }
0051
0052 }