/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Public Attributes
GenMuon::TestMasses::MassiveFailure Class Reference
Inheritance diagram for GenMuon::TestMasses::MassiveFailure:
Inheritance graph
[legend]
Collaboration diagram for GenMuon::TestMasses::MassiveFailure:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def initialize
def execute
def __init__
def initialize
def execute
def finalize
def verbose
def debug
def info
def warning
def error
def fatal
def getAES
def initializeHeader
def finalizeHeader

Public Attributes

 ppsvc
 msgSvc
 archiveSvc
 stats
 defaultInputLocation
 execNumber
 currentJobId

Detailed Description

Definition at line 19 of file TestMasses.py.


Constructor & Destructor Documentation

def GenMuon::TestMasses::MassiveFailure::__init__ (   self,
  name = 'MassiveFailure' 
)

Definition at line 21 of file TestMasses.py.

00022                                                :
00023         DybPythonAlg.__init__(self, name)
00024         self.ppsvc = None
00025         return


Member Function Documentation

def GenMuon::TestMasses::MassiveFailure::initialize (   self)

Definition at line 26 of file TestMasses.py.

00027                         :
00028         sc = DybPythonAlg.initialize(self)
00029         if sc.isFailure(): return sc
00030 
00031         self.ppsvc = self.svc('IParticlePropertySvc','ParticlePropertySvc')
00032         if not self.ppsvc:
00033             self.error('Failed to get the ParticlePropertySvc')
00034             return FAILURE
00035 
00036         return SUCCESS

def GenMuon::TestMasses::MassiveFailure::execute (   self)

Definition at line 37 of file TestMasses.py.

00038                      :
00039         tes = self.evtSvc()
00040         gh = tes['/Event/Gen/GenHeader']
00041         if not gh:
00042             self.error('Failed to get a GenHeader')
00043             return FAILURE
00044 
00045         ge = gh.event()
00046         if not ge:
00047             self.error('Failed to get a GenEvent')
00048             return FAILURE
00049 
00050         for part in irange(ge.particles_begin(),ge.particles_end()):
00051             mom = part.momentum() # HepMC::FourVector
00052             pid = part.pdg_id()   # int
00053 
00054             prop = self.ppsvc.findByStdHepID(pid)
00055             if not prop:
00056                 self.warning('No particle property for PID %d'%pid)
00057                 continue
00058 
00059             def check_mass(label,mtest,mcalc):
00060                 dM = fabs(mtest-mcalc)
00061                 dM_rat = dM / mtest
00062                 dM_eps = 0.01*units.MeV
00063                 if dM_rat > 0.001 or dM > dM_eps:
00064                     self.warning('PID %d has %s mass %.2f MeV but calculated as %.2f MeV' % \
00065                                  (pid, label, mtest / units.MeV, mcalc / units.MeV))
00066                     return False
00067                 return True
00068 
00069             mcalc = sqrt(fabs( mom.t()**2 - (mom.x()**2 + mom.y()**2 + mom.z()**2) ))
00070             ok1 = check_mass('generated',part.generated_mass(),mcalc)
00071             ok2 = check_mass('property',prop.mass(),mcalc)
00072             if not ok1 and not ok2:
00073                 error("Failed to get reasonable mass")
00074                 return FAILURE
00075             else:
00076                 self.info('PID %d has mass %.2f MeV, energy %.2f GeV/c' % \
00077                               (pid, mcalc / units.MeV, mom.e() / units.GeV ))
00078             continue
00079         return SUCCESS
00080 


Member Data Documentation

Definition at line 21 of file TestMasses.py.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:20:55 for GenMuon by doxygen 1.7.4