File indexing completed on 2025-07-01 07:56:14
0001
0002
0003
0004 #include "ChargedParticle.h"
0005
0006 namespace benchmarks {
0007
0008
0009 void ChargedParticle::SetSingleParticle(const edm4hep::MCParticle& mc_part) {
0010 m_momentum = edm4hep::utils::magnitude(mc_part.getMomentum());
0011 m_eta = edm4hep::utils::eta(mc_part.getMomentum());
0012 m_pdg = mc_part.getPDG();
0013 }
0014
0015
0016 void ChargedParticle::SetSingleParticle(const edm4hep::MCParticleCollection& mc_parts) {
0017 int n_thrown = 0;
0018 for(const auto& mc_part : mc_parts) {
0019 if(mc_part.getGeneratorStatus() == 1) {
0020 this->SetSingleParticle(mc_part);
0021 n_thrown++;
0022 }
0023 }
0024 if(n_thrown == 0) m_log->warn("ChargedParticle::SetSingleParticle: no particle found");
0025 if(n_thrown > 1) m_log->warn("ChargedParticle::SetSingleParticle: found {} particles (more than one)", n_thrown);
0026 }
0027
0028 }