Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

Atlfast::ChargeService Class Reference

Service providing the charge of HepMC::GenParticle / ReconstructedParticle. More...

#include <ChargeService.h>

List of all members.


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

Detailed Description

Service providing the charge of HepMC::GenParticle / ReconstructedParticle.

Definition at line 22 of file ChargeService.h.


Constructor & Destructor Documentation

Atlfast::ChargeService::ChargeService  
 

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   }

Atlfast::ChargeService::ChargeService const ChargeService &    other
 

Copy Constructor.

Definition at line 16 of file ChargeService.cxx.

00016                                                          :
00017     m_particleDataTable(other.m_particleDataTable){}
  

Member Function Documentation

double Atlfast::ChargeService::operator() const HepMC::GenParticle *    p const
 

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   }

double Atlfast::ChargeService::operator() const ReconstructedParticle *    p const
 

returns charge of ReconstructedParticle

Definition at line 50 of file ChargeService.cxx.

00050                                                                       {
00051     return (*this)(p->truth());
00052   }

Member Data Documentation

HepMC::ParticleDataTable Atlfast::ChargeService::m_particleDataTable [private]
 

Definition at line 33 of file ChargeService.h.

Referenced by ChargeService().


The documentation for this class was generated from the following files:
Generated on Wed Jan 15 11:00:34 2003 for AtlfastUtils by doxygen1.3-rc1