Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-01 07:56:14

0001 // Copyright 2023, Christopher Dilks
0002 // Subject to the terms in the LICENSE file found in the top-level directory.
0003 
0004 #include "ChargedParticle.h"
0005 
0006 namespace benchmarks {
0007 
0008   // set info from a single MCParticle
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   // set info from a (thrown) MCParticle of a collection
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 }