5 from GeneratorModules.EvgenAlg
import EvgenAlg
6 from AthenaPython.PyAthena
import StatusCode
8 from AthenaPython.PyAthena
import HepMC3
as HepMC
10 from AthenaPython.PyAthena
import HepMC
as HepMC
19 return math.sqrt(energy**2 - 938.272046**2)
25 def __init__(self, ecmEnergy, name="LheEVNTFiller"):
26 super(LheEVNTFiller, self).
__init__(name=name)
29 fileName =
"evrecs/evrecout.dat"
30 outputFileName =
"outputs/outputout.dat"
39 return StatusCode.Success
41 return StatusCode.Failure
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))
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)
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)
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)
133 return StatusCode.Success