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