22 Factory class for line by line reads of output files
28 if self.
format not in self.file_formats.keys():
29 raise KeyError(
"Did not recognise builtin format "+self.
format+\
30 ". Should be one of "+str(self.file_formats.keys()))
34 Read a new hit from filehandle according to a predefined format
35 - filehandle = file handle object
36 Returns a new hit object
42 if(format.find(
'icool') > -1 ):
43 hit.set(
'pid', common.icool_pid_to_pdg[hit.get(
'pid')])
44 if( format.find(
'mars') > -1 ):
45 hit.set(
'pid', common.mars_pid_to_pdg[hit.get(
'pid')])
47 hit.set(
'mass', common.pdg_pid_to_mass[abs(hit.get(
'pid'))])
52 if hit.get(
'pid')
not in self.bad_pids:
53 print 'Warning - could not resolve PID ', hit.get(
'pid'), \
55 self.bad_pids.append(hit.get(
'pid'))
58 hit.set(
'charge', common.pdg_pid_to_charge[hit.get(
'pid')])
60 if hit.get(
'pid')
not in self.bad_pids:
61 print 'Warning - could not resolve PID ',hit.get(
'pid'),
' setting charge to 0.'
62 self.bad_pids.append(hit.get(
'pid'))
67 return cls.file_formats
71 'icool_for009' : [
'eventNumber',
'particleNumber',
'pid',
'status',
'station',
't',
'x',
'y',
'z',
'px',
'py',
'pz',
'bx',
'by',
'bz',
'local_weight',
72 'ex',
'ey',
'ez',
'',
'sx',
'sy',
'sz'],
73 'icool_for003' : [
'eventNumber',
'particleNumber',
'pid',
'status',
't',
'local_weight',
'x',
'y',
'z',
'px',
'py',
'pz',
'sx',
'sy',
'sz'],
74 'g4beamline_bl_track_file' : [
'x',
'y',
'z',
'px',
'py',
'pz',
't',
'pid',
'eventNumber',
'particleNumber',
'',
'local_weight'],
75 'mars_1' : [
'eventNumber',
'pid',
'x',
'y',
'z',
'px',
'py',
'pz',
'energy',
'ct',
'local_weight']
79 'icool_for009' : {
'eventNumber':
'',
'particleNumber':
'',
'pid':
'',
'status':
'',
'station':
'',
't':
's',
'x':
'm',
'y':
'm',
'z':
'm',
'px':
'GeV/c',
'py':
'GeV/c',
80 'pz':
'GeV/c',
'bx':
'T',
'by':
'T',
'bz':
'T',
'local_weight':
'',
81 'ex':
'GV/m',
'ey':
'GV/m',
'ez':
'GV/m',
'sx':
'',
'sy':
'',
'sz':
'',
'':
''},
82 'icool_for003' : {
'eventNumber':
'',
'particleNumber':
'',
'pid':
'',
'status':
'',
't':
's',
'local_weight':
'',
'x':
'm',
'y':
'm',
'z':
'm',
'px':
'GeV/c',
'py':
'GeV/c',
'pz':
'GeV/c',
'sx':
'',
'sy':
'',
'sz':
''},
83 'g4beamline_bl_track_file' : {
'x':
'mm',
'y':
'mm',
'z':
'mm',
'px':
'MeV/c',
'py':
'MeV/c',
'pz':
'MeV/c',
't':
'ns',
'pid':
'',
'eventNumber':
'',
'station':
'',
'local_weight':
'',
'particleNumber':
''},
84 'mars_1' : {
'eventNumber':
'',
'pid':
'',
'x':
'mm',
'y':
'mm',
'z':
'mm',
'px':
'GeV/c',
'py':
'GeV/c',
'pz':
'GeV/c',
'energy':
'GeV',
'ct':
'cm',
'local_weight':
''},
87 file_mass_shell = {
'icool_for009':
'energy',
88 'icool_for003':
'energy',
89 'g4beamline_bl_track_file':
'energy',
The hit factory module defines a number of factory classes used for generating hit objects...
Factory class for line by line reads of output files.
common module defines common utility data and functions that are used elsewhere
dictionary file_mass_shell
def make_hit
Read a new hit from filehandle according to a predefined format.