#include <ChargeService.h>
Public Methods | |
ChargeService () | |
Default Constructor. | |
ChargeService (const ChargeService &other) | |
Copy Constructor. | |
double | operator() (const HepMC::GenParticle *p) const |
returns charge of HepMC::GenParticle | |
double | operator() (const ReconstructedParticle *p) const |
returns charge of ReconstructedParticle | |
Private Attributes | |
HepMC::ParticleDataTable | m_particleDataTable |
Definition at line 22 of file ChargeService.h.
|
Default Constructor.
Definition at line 11 of file ChargeService.cxx. References m_particleDataTable.
00011 { 00012 HepMC::IO_PDG_ParticleDataTable pdg_io("PDGTABLE"); 00013 m_particleDataTable = *pdg_io.read_particle_data_table(); 00014 m_particleDataTable.make_antiparticles_from_particles(); 00015 } |
|
Copy Constructor.
Definition at line 16 of file ChargeService.cxx.
00016 : 00017 m_particleDataTable(other.m_particleDataTable){} |
|
returns charge of HepMC::GenParticle
Definition at line 19 of file ChargeService.cxx.
00019 { 00020 00021 //does particle exist in table only positive ids for neutrals !? 00022 HepMC::ParticleData* ap = m_particleDataTable.find( abs( p->pdg_id() ) ); 00023 00024 if(!ap){ 00025 std::cout << "ChargeService WARNING: abs(id) " 00026 << abs(p->pdg_id()) 00027 << " is not in particle data table"<<std::endl; 00028 return 0.; 00029 } 00030 00031 //if in table, and the charge is 0, return 0. 00032 double c = ap->charge(); 00033 if(c==0) return 0.; 00034 00035 00036 //if in table, and the charge is not 0, use signed id. 00037 00038 HepMC::ParticleData* pp = m_particleDataTable.find( p->pdg_id() ); 00039 00040 if(!pp){ 00041 std::cout << "ChargeService WARNING: id " 00042 << p->pdg_id()<< " is not in particle data table"<<std::endl; 00043 return 0.; 00044 } 00045 00046 return pp->charge(); 00047 00048 } |
|
returns charge of ReconstructedParticle
Definition at line 50 of file ChargeService.cxx.
00050 {
00051 return (*this)(p->truth());
00052 }
|
|
Definition at line 33 of file ChargeService.h. Referenced by ChargeService(). |