-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathhelper.py
39 lines (28 loc) · 1.14 KB
/
helper.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
33
34
35
36
37
38
39
import ROOT as R
def calc(varname):
if varname == "dijetpt": return calcDiJetPt
if varname == "dijetphi": return calcDiJetPhi
if varname == "pt_vis": return calcPtVis
def calcDiJetPt(row):
if row["jpt_1"] < 0 or row["jpt_2"] < 0: return -10.
jet1 = R.TLorentzVector()
jet2 = R.TLorentzVector()
jet1.SetPtEtaPhiM( row["jpt_1"], row["jeta_1"], row["jphi_1"], row["jm_1"] )
jet2.SetPtEtaPhiM( row["jpt_2"], row["jeta_2"], row["jphi_2"], row["jm_2"] )
dijet = jet1 + jet2
return dijet.Pt()
def calcDiJetPhi(row):
if row["jpt_1"] < 0 or row["jpt_2"] < 0: return -10.
jet1 = R.TLorentzVector()
jet2 = R.TLorentzVector()
jet1.SetPtEtaPhiM( row["jpt_1"], row["jeta_1"], row["jphi_1"], row["jm_1"] )
jet2.SetPtEtaPhiM( row["jpt_2"], row["jeta_2"], row["jphi_2"], row["jm_2"] )
dijet = jet1 + jet2
return dijet.Phi()
def calcPtVis(row):
leg1 = R.TLorentzVector()
leg2 = R.TLorentzVector()
leg1.SetPtEtaPhiM( row["pt_1"], row["eta_1"], row["phi_1"], row["m_1"] )
leg2.SetPtEtaPhiM( row["pt_2"], row["eta_2"], row["phi_2"], row["m_2"] )
vis = leg1 + leg2
return vis.Pt()