-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLHEevent.py
32 lines (27 loc) · 1.05 KB
/
LHEevent.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import ROOT as rt
class LHEevent():
def __init__(self):
self.Particles = []
self.Model = "NONE"
self.sMotherMass = -999
self.LSPMass = -999
def fillEvent(self, lheLines):
# check that this is a good event
if lheLines[0].find("<event>") == -1 or lheLines[-1].find("</event>") == -1:
print "THIS IS NOT A LHE EVENT"
return 0
for i in range(2,len(lheLines)-1):
self.Particles.append(self.readParticle(lheLines[i]))
return 1
def readParticle(self, lheLine):
dataIN = lheLine[:-1].split(" ")
dataINgood = []
for entry in dataIN:
if entry != "": dataINgood.append(entry)
return {'ID': int(dataINgood[0]),
'mIdx': int(dataINgood[2])-1,
'Px' : float(dataINgood[6]),
'Py' : float(dataINgood[7]),
'Pz' : float(dataINgood[8]),
'E' : float(dataINgood[9]),
'M' : float(dataINgood[10])}