4 from GeneratorModules.EvgenAlg
import EvgenAlg
5 from AthenaPython.PyAthena
import StatusCode
7 from AthenaPython.PyAthena
import HepMC3
as HepMC
9 from AthenaPython.PyAthena
import HepMC
as HepMC
17 return math.sqrt(energy**2 - 938.272046**2)
20 class LheEVNTFiller(EvgenAlg):
22 def __init__(self, ecmEnergy, name="LheEVNTFiller"):
23 super(LheEVNTFiller, self).
__init__(name=name)
26 fileName =
"evrecs/evrecout.dat"
27 outputFileName =
"outputs/outputout.dat"
34 return StatusCode.Success
36 return StatusCode.Failure
46 for line
in inputOutputFile:
47 if 'Cross section =' in line:
48 splitLine = line.split()
50 if(splitLine[-1] ==
"pb"):
52 if(splitLine[-1] ==
"fb"):
54 if(splitLine[-1] ==
"ub"):
56 if(splitLine[-1] ==
"mb"):
58 print(
"MetaData: cross-section (nb)= "+
str(
float(splitLine[3])*factor))
64 for line
in inputfile:
65 if not event
and '<event>' not in line:
68 if not event
and '<event>' in line
and eventsSeen == self.
eventsProcessed:
72 if '<' in line
or '>' in line:
77 if event
and firstLine:
79 evt.weights().push_back(
float(line.split()[2]))
82 pos = HepMC.FourVector(0.0, 0.0, 0.0, 0.0)
83 gv = HepMC.GenVertex(pos)
84 ROOT.SetOwnership(gv,
False)
87 gp = HepMC.GenParticle()
91 gp.set_generated_mass(938.272046)
92 ROOT.SetOwnership(gp,
False)
93 gv.add_particle_out(gp)
95 pos = HepMC.FourVector(0.0, 0.0, 0.0, 0.0)
96 gv = HepMC.GenVertex(pos)
97 ROOT.SetOwnership(gv,
False)
100 gp = HepMC.GenParticle()
102 gp.set_pdg_id( 2212 )
104 gp.set_generated_mass(938.272046)
105 ROOT.SetOwnership(gp,
False)
106 gv.add_particle_out(gp)
110 pos = HepMC.FourVector(0.0, 0.0, 0.0, 0.0)
111 gv = HepMC.GenVertex(pos)
112 ROOT.SetOwnership(gv,
False)
114 mom = HepMC.FourVector(
float(line.split()[6])*1000. ,
float(line.split()[7])*1000. ,
float(line.split()[8])*1000. ,
float(line.split()[9])*1000. )
115 gp = HepMC.GenParticle()
116 gp.set_status(
int(line.split()[1]) )
117 gp.set_pdg_id(
int(line.split()[0]) )
119 gp.set_generated_mass(
float(line.split()[10]) * 1000.)
120 ROOT.SetOwnership(gp,
False)
121 gv.add_particle_out(gp)
125 return StatusCode.Success