ATLAS Offline Software
Loading...
Searching...
No Matches
EventFiller.LheEVNTFiller Class Reference
Inheritance diagram for EventFiller.LheEVNTFiller:
Collaboration diagram for EventFiller.LheEVNTFiller:

Public Member Functions

 __init__ (self, ecmEnergy, name="LheEVNTFiller")
 initialize (self)
 fillEvent (self, evt)
 __init__ (self, ecmEnergy, name="LheEVNTFiller")
 initialize (self)
 fillEvent (self, evt)

Public Attributes

int beamEnergyMeV = ecmEnergy * 1000. / 2.

Static Public Attributes

str fileName = "evrecs/evrecout.dat"
str outputFileName = "outputs/outputout.dat"
int eventsProcessed = 0

Detailed Description

Definition at line 21 of file SFGen_i/python/EventFiller.py.

Constructor & Destructor Documentation

◆ __init__() [1/2]

EventFiller.LheEVNTFiller.__init__ ( self,
ecmEnergy,
name = "LheEVNTFiller" )

Definition at line 25 of file SFGen_i/python/EventFiller.py.

25 def __init__(self, ecmEnergy, name="LheEVNTFiller"):
26 super(LheEVNTFiller, self).__init__(name=name)
27 self.beamEnergyMeV = ecmEnergy * 1000. / 2.
28

◆ __init__() [2/2]

EventFiller.LheEVNTFiller.__init__ ( self,
ecmEnergy,
name = "LheEVNTFiller" )

Definition at line 22 of file Superchic_i/python/EventFiller.py.

22 def __init__(self, ecmEnergy, name="LheEVNTFiller"):
23 super(LheEVNTFiller, self).__init__(name=name)
24 self.beamEnergyMeV = ecmEnergy * 1000. / 2.
25

Member Function Documentation

◆ fillEvent() [1/2]

EventFiller.LheEVNTFiller.fillEvent ( self,
evt )

Definition at line 45 of file SFGen_i/python/EventFiller.py.

45 def fillEvent(self, evt):
46
47 eventsSeen = 0
48 firstLine = True
49
50# Reading cross section in the outputout.dat file in nb unit
51
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()
57 factor = 1.
58 if(splitLine[-1] == "pb"):
59 factor = 0.001
60 if(splitLine[-1] == "fb"):
61 factor = 0.000001
62 if(splitLine[-1] == "ub"):
63 factor = 1000.
64 if(splitLine[-1] == "mb"):
65 factor = 1000000.
66 print("MetaData: cross-section (nb)= "+str(float(splitLine[3])*factor))
67
68 break
69
70 with open(self.fileName, 'r') as inputfile:
71 event = False
72 for line in inputfile:
73 if not event and '<event>' not in line:
74 continue
75 # Check if we are just starting an event
76 if not event and '<event>' in line and eventsSeen == self.eventsProcessed:
77 event = True
78 continue
79 # Check if we have finished and are doing something else
80 if '<' in line or '>' in line:
81 event = False
82 eventsSeen += 1
83 firstLine = True
84 continue
85 if event and firstLine:
86 firstLine = False
87 evt.weights().push_back(float(line.split()[2]))
88
89 # Add the initial state protons
90 pos = HepMC.FourVector(0.0, 0.0, 0.0, 0.0)
91 gv = HepMC.GenVertex(pos)
92 ROOT.SetOwnership(gv, False)
93 evt.add_vertex(gv)
94 mom = HepMC.FourVector(0., 0., init_pz(self.beamEnergyMeV), self.beamEnergyMeV)
95 gp = HepMC.GenParticle()
96 gp.set_status( 2 )
97 gp.set_pdg_id( 2212 )
98 gp.set_momentum(mom)
99 gp.set_generated_mass(938.272046)
100 ROOT.SetOwnership(gp, False)
101 gv.add_particle_out(gp)
102
103 pos = HepMC.FourVector(0.0, 0.0, 0.0, 0.0)
104 gv = HepMC.GenVertex(pos)
105 ROOT.SetOwnership(gv, False)
106 evt.add_vertex(gv)
107 mom = HepMC.FourVector(0., 0., -init_pz(self.beamEnergyMeV), self.beamEnergyMeV)
108 gp = HepMC.GenParticle()
109 gp.set_status( 2 )
110 gp.set_pdg_id( 2212 )
111 gp.set_momentum(mom)
112 gp.set_generated_mass(938.272046)
113 ROOT.SetOwnership(gp, False)
114 gv.add_particle_out(gp)
115
116 continue
117 if event:
118 pos = HepMC.FourVector(0.0, 0.0, 0.0, 0.0)
119 gv = HepMC.GenVertex(pos)
120 ROOT.SetOwnership(gv, False)
121 evt.add_vertex(gv)
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]) )
126 gp.set_momentum(mom)
127 gp.set_generated_mass(float(line.split()[10]) * 1000.)
128 ROOT.SetOwnership(gp, False)
129 gv.add_particle_out(gp)
130
131 self.eventsProcessed += 1
132
133 return StatusCode.Success
134
if(febId1==febId2)
void print(char *figname, TCanvas *c1)

◆ fillEvent() [2/2]

EventFiller.LheEVNTFiller.fillEvent ( self,
evt )

Definition at line 39 of file Superchic_i/python/EventFiller.py.

39 def fillEvent(self, evt):
40
41 eventsSeen = 0
42 firstLine = True
43
44 with open(self.outputFileName, 'r') as inputOutputFile:
45 if self.eventsProcessed == 0:
46 for line in inputOutputFile:
47 if 'Cross section =' in line:
48 splitLine = line.split()
49 factor = 1.
50 if(splitLine[-1] == "pb"):
51 factor = 0.001
52 if(splitLine[-1] == "fb"):
53 factor = 0.000001
54 if(splitLine[-1] == "ub"):
55 factor = 1000.
56 if(splitLine[-1] == "mb"):
57 factor = 1000000.
58 print("MetaData: cross-section (nb)= "+str(float(splitLine[3])*factor))
59
60 break
61
62 with open(self.fileName, 'r') as inputfile:
63 event = False
64 for line in inputfile:
65 if not event and '<event>' not in line:
66 continue
67 # Check if we are just starting an event
68 if not event and '<event>' in line and eventsSeen == self.eventsProcessed:
69 event = True
70 continue
71 # Check if we have finished and are doing something else
72 if '<' in line or '>' in line:
73 event = False
74 eventsSeen += 1
75 firstLine = True
76 continue
77 if event and firstLine:
78 firstLine = False
79 evt.weights().push_back(float(line.split()[2]))
80
81 # Add the initial state protons
82 pos = HepMC.FourVector(0.0, 0.0, 0.0, 0.0)
83 gv = HepMC.GenVertex(pos)
84 ROOT.SetOwnership(gv, False)
85 evt.add_vertex(gv)
86 mom = HepMC.FourVector(0., 0., init_pz(self.beamEnergyMeV), self.beamEnergyMeV)
87 gp = HepMC.GenParticle()
88 gp.set_status( 4 )
89 gp.set_pdg_id( 2212 )
90 gp.set_momentum(mom)
91 gp.set_generated_mass(938.272046)
92 ROOT.SetOwnership(gp, False)
93 gv.add_particle_out(gp)
94
95 pos = HepMC.FourVector(0.0, 0.0, 0.0, 0.0)
96 gv = HepMC.GenVertex(pos)
97 ROOT.SetOwnership(gv, False)
98 evt.add_vertex(gv)
99 mom = HepMC.FourVector(0., 0., -init_pz(self.beamEnergyMeV), self.beamEnergyMeV)
100 gp = HepMC.GenParticle()
101 gp.set_status( 4 )
102 gp.set_pdg_id( 2212 )
103 gp.set_momentum(mom)
104 gp.set_generated_mass(938.272046)
105 ROOT.SetOwnership(gp, False)
106 gv.add_particle_out(gp)
107
108 continue
109 if event:
110 pos = HepMC.FourVector(0.0, 0.0, 0.0, 0.0)
111 gv = HepMC.GenVertex(pos)
112 ROOT.SetOwnership(gv, False)
113 evt.add_vertex(gv)
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]) )
118 gp.set_momentum(mom)
119 gp.set_generated_mass(float(line.split()[10]) * 1000.)
120 ROOT.SetOwnership(gp, False)
121 gv.add_particle_out(gp)
122
123 self.eventsProcessed += 1
124
125 return StatusCode.Success
126

◆ initialize() [1/2]

EventFiller.LheEVNTFiller.initialize ( self)

Definition at line 35 of file SFGen_i/python/EventFiller.py.

35 def initialize(self):
36
37 if(os.path.isfile(self.fileName) and os.path.isfile(self.outputFileName)):
38 print(self.fileName)
39 return StatusCode.Success
40 else:
41 return StatusCode.Failure
42
43# Filling the EVNT file
44
void initialize()

◆ initialize() [2/2]

EventFiller.LheEVNTFiller.initialize ( self)

Definition at line 30 of file Superchic_i/python/EventFiller.py.

30 def initialize(self):
31
32 if(os.path.isfile(self.fileName) and os.path.isfile(self.outputFileName)):
33 print(self.fileName)
34 return StatusCode.Success
35 else:
36 return StatusCode.Failure
37
38

Member Data Documentation

◆ beamEnergyMeV

int EventFiller.LheEVNTFiller.beamEnergyMeV = ecmEnergy * 1000. / 2.

Definition at line 27 of file SFGen_i/python/EventFiller.py.

◆ eventsProcessed

int EventFiller.LheEVNTFiller.eventsProcessed = 0
static

Definition at line 31 of file SFGen_i/python/EventFiller.py.

◆ fileName

str EventFiller.LheEVNTFiller.fileName = "evrecs/evrecout.dat"
static

Definition at line 29 of file SFGen_i/python/EventFiller.py.

◆ outputFileName

str EventFiller.LheEVNTFiller.outputFileName = "outputs/outputout.dat"
static

Definition at line 30 of file SFGen_i/python/EventFiller.py.


The documentation for this class was generated from the following files: