Fork me on GitHub

source: git/python/TopControlPlots.py@ 621f6a3

ImprovedOutputFile Timing dual_readout llp
Last change on this file since 621f6a3 was ae1d49f, checked in by pavel <pavel@…>, 12 years ago

add DelphesAnalysis

  • Property mode set to 100644
File size: 2.7 KB
Line 
1from BaseControlPlots import BaseControlPlots
2import ROOT
3
4# Requirements:
5# event.topCandidates_L
6# event.topCandidates_H
7# event.topPairCandidates
8
9class TopControlPlots(BaseControlPlots):
10 """A class to create control plots for jetmet"""
11
12 def __init__(self, dir=None, dataset=None, mode="plots"):
13 # create output file if needed. If no file is given, it means it is delegated
14 BaseControlPlots.__init__(self, dir=dir, purpose="top", dataset=dataset, mode=mode)
15
16 def beginJob(self):
17 # declare histograms
18 self.add("Hmass","hadronic top mass",1000,0,1000)
19 self.add("Hpt","hadronic top transverse momentum",1000,0,1000)
20 self.add("bestHmass","hadronic top mass",1000,0,1000)
21 self.add("bestHpt","Hadronic top transverse momentum",1000,0,1000)
22 self.add("bestLmass","leptonic top transverse mass",1000,0,1000)
23 self.add("bestLpt","leptonic top transverse momentum",1000,0,1000)
24 self.add("mass1","hadronic top mass",1000,0,1000)
25 self.add("pt1","hadronic top transverse momentum",1000,0,1000)
26 self.add("mass2","leptonic top transverse mass",1000,0,1000)
27 self.add("pt2","leptonic top transverse momentum",1000,0,1000)
28
29 def process(self, event):
30 #get information
31 result = { }
32 result["Hmass"] = [ ]
33 result["Hpt"] = [ ]
34 for top in event.topCandidates_H:
35 result["Hmass"].append((top[0].P4()+top[1].P4()+top[2].P4()).M())
36 result["Hpt"].append((top[0].P4()+top[1].P4()+top[2].P4()).Pt())
37 if len(event.topCandidates_H):
38 top = event.topCandidates_H[0]
39 result["bestHmass"] = (top[0].P4()+top[1].P4()+top[2].P4()).M()
40 result["bestHpt"] = (top[0].P4()+top[1].P4()+top[2].P4()).Pt()
41 if len(event.topCandidates_L):
42 top = event.topCandidates_L[0]
43 met = ROOT.TLorentzVector()
44 met.SetPtEtaPhiE(top[2].MET,0,top[2].Phi,top[2].MET)
45 momentum = top[0].P4()+top[1].P4()+met
46 momentum.SetPz(0)
47 result["bestLmass"] = momentum.M()
48 result["bestLpt"] = momentum.Pt()
49 if len(event.topPairCandidates):
50 top = event.topPairCandidates[0][:3]
51 result["mass1"] = (top[0].P4()+top[1].P4()+top[2].P4()).M()
52 result["pt1"] = (top[0].P4()+top[1].P4()+top[2].P4()).Pt()
53 top = event.topPairCandidates[0][3:]
54 met = ROOT.TLorentzVector()
55 met.SetPtEtaPhiE(top[2].MET,0,top[2].Phi,top[2].MET)
56 momentum = top[0].P4()+top[1].P4()+met
57 momentum.SetPz(0)
58 result["mass2"] = momentum.M()
59 result["pt2"] =momentum.Pt()
60 return result
61
62if __name__=="__main__":
63 import sys
64 from DelphesAnalysis.BaseControlPlots import runTest
65 runTest(sys.argv[1], TopControlPlots())
66
Note: See TracBrowser for help on using the repository browser.