ATLAS Offline Software
Loading...
Searching...
No Matches
PDGHelpers Namespace Reference

Classes

class  ExtraParticle
class  PDGParser

Functions

 getPDGTABLE (table)
 getExtraParticleAcceptList (acceptlist)
 updateExtraParticleAcceptList (listName='G4particle_acceptlist_ExtraParticles.txt', pdgcodes=[])

Detailed Description

Parser for the PDGTABLE.MeV file

    Creates a compact object that holds configuration
    for the ExtraParticlesPhysicsTool.

    Gaudi cannot parse nested std::map objects, so the extra
    particles are converted into a

      std::map< std::string, std::vector< double > >

    object and ordering of the values is therefore important.

    Rows are:
        name
        mass [MeV]
        width [MeV]
        pdg
        lifetime [ns]

    Charge, spin, parity, and isospin3 are set to zero.

    AUTHOR: miha muskinja
    DATE: August 2019

Function Documentation

◆ getExtraParticleAcceptList()

PDGHelpers.getExtraParticleAcceptList ( acceptlist)

Definition at line 47 of file PDGHelpers.py.

47def getExtraParticleAcceptList(acceptlist):
48 # Delete a local file if present
49 if os.path.isfile(acceptlist):
50 os.remove(acceptlist)
51 #create blank file
52 blank = open('G4particle_acceptlist_ExtraParticles.txt', 'x')
53 blank.close()
54 return True
55
56

◆ getPDGTABLE()

PDGHelpers.getPDGTABLE ( table)

Definition at line 37 of file PDGHelpers.py.

37def getPDGTABLE(table):
38 # Delete a local file if present
39 if os.path.isfile(table):
40 os.remove(table)
41 # Grab the file
42 os.system('get_files -data %s' % table)
43 return True
44
45
46@lru_cache

◆ updateExtraParticleAcceptList()

PDGHelpers.updateExtraParticleAcceptList ( listName = 'G4particle_acceptlist_ExtraParticles.txt',
pdgcodes = [] )

Definition at line 57 of file PDGHelpers.py.

57def updateExtraParticleAcceptList(listName='G4particle_acceptlist_ExtraParticles.txt', pdgcodes=[]):
58 if getExtraParticleAcceptList(listName):
59 import shutil
60 shutil.copy(listName, listName+'.org')
61 existingpdgcodes = [int(x) for x in open(listName).readlines()]
62 newpdgcodes = list(set(pdgcodes).difference(existingpdgcodes))
63 # update the acceptlist for GenParticleSimAcceptList
64 with open(listName, 'a') as writer:
65 for pdg in newpdgcodes:
66 writer.write('%s\n' % pdg)
67
68
STL class.