45 def fillEvent(self, evt):
52 with open(self.outputFileName,
'r')
as inputOutputFile:
53 if self.eventsProcessed == 0:
54 for line
in inputOutputFile:
55 if 'Cross section =' in line:
56 splitLine = line.split()
58 if(splitLine[-1] ==
"pb"):
60 if(splitLine[-1] ==
"fb"):
62 if(splitLine[-1] ==
"ub"):
64 if(splitLine[-1] ==
"mb"):
66 print(
"MetaData: cross-section (nb)= "+
str(
float(splitLine[3])*factor))
70 with open(self.fileName,
'r')
as inputfile:
72 for line
in inputfile:
73 if not event
and '<event>' not in line:
76 if not event
and '<event>' in line
and eventsSeen == self.eventsProcessed:
80 if '<' in line
or '>' in line:
85 if event
and firstLine:
87 evt.weights().push_back(
float(line.split()[2]))
90 pos = HepMC.FourVector(0.0, 0.0, 0.0, 0.0)
91 gv = HepMC.GenVertex(pos)
92 ROOT.SetOwnership(gv,
False)
94 mom = HepMC.FourVector(0., 0.,
init_pz(self.beamEnergyMeV), self.beamEnergyMeV)
95 gp = HepMC.GenParticle()
99 gp.set_generated_mass(938.272046)
100 ROOT.SetOwnership(gp,
False)
101 gv.add_particle_out(gp)
103 pos = HepMC.FourVector(0.0, 0.0, 0.0, 0.0)
104 gv = HepMC.GenVertex(pos)
105 ROOT.SetOwnership(gv,
False)
107 mom = HepMC.FourVector(0., 0., -
init_pz(self.beamEnergyMeV), self.beamEnergyMeV)
108 gp = HepMC.GenParticle()
110 gp.set_pdg_id( 2212 )
112 gp.set_generated_mass(938.272046)
113 ROOT.SetOwnership(gp,
False)
114 gv.add_particle_out(gp)
118 pos = HepMC.FourVector(0.0, 0.0, 0.0, 0.0)
119 gv = HepMC.GenVertex(pos)
120 ROOT.SetOwnership(gv,
False)
122 mom = HepMC.FourVector(
float(line.split()[6])*1000. ,
float(line.split()[7])*1000. ,
float(line.split()[8])*1000. ,
float(line.split()[9])*1000. )
123 gp = HepMC.GenParticle()
124 gp.set_status(
int(line.split()[1]) )
125 gp.set_pdg_id(
int(line.split()[0]) )
127 gp.set_generated_mass(
float(line.split()[10]) * 1000.)
128 ROOT.SetOwnership(gp,
False)
129 gv.add_particle_out(gp)
131 self.eventsProcessed += 1
133 return StatusCode.Success