Fork me on GitHub

source: git/python/JetControlPlots.py@ 952bbbc

Last change on this file since 952bbbc was ae1d49f, checked in by pavel <pavel@…>, 12 years ago

add DelphesAnalysis

  • Property mode set to 100644
File size: 1.8 KB
Line 
1from BaseControlPlots import BaseControlPlots
2
3# Requirements:
4# event.jets
5# event.bjets
6# event.MEt
7
8class JetControlPlots(BaseControlPlots):
9 """A class to create control plots for jetmet"""
10
11 def __init__(self, dir=None, dataset=None, mode="plots"):
12 # create output file if needed. If no file is given, it means it is delegated
13 BaseControlPlots.__init__(self, dir=dir, purpose="jetmet", dataset=dataset, mode=mode)
14
15 def beginJob(self):
16 # declare histograms
17 self.add("JetPt","Jet Pt",100,0,200)
18 self.add("JetEta","Jet Eta",100,-5,5)
19 self.add("JetPhi","Jet Phi",64,-3.2,3.2)
20 self.add("BjetPt","B Jet Pt",100,0,200)
21 self.add("BjetEta","B Jet Eta",100,-5,5)
22 self.add("BjetPhi","B Jet Phi",64,-3.2,3.2)
23 self.add("MET","MET",100,0,200)
24 self.add("METphi","MET phi",64,-3.2,3.2)
25 self.add("Njets","Jet multiplicity",10,0,10)
26 self.add("Nbjets","B Jet multiplicity",10,0,10)
27
28 def process(self, event):
29 #get information
30 result = { }
31 result["JetPt"] = [ ]
32 result["JetEta"] = [ ]
33 result["JetPhi"] = [ ]
34 result["BjetPt"] = [ ]
35 result["BjetEta"] = [ ]
36 result["BjetPhi"] = [ ]
37 nb=0
38 for jet in event.selectedJets:
39 result["JetPt"].append(jet.PT)
40 result["JetEta"].append(jet.Eta)
41 result["JetPhi"].append(jet.Phi)
42 if jet.BTag:
43 nb+=1
44 result["BjetPt"].append(jet.PT)
45 result["BjetEta"].append(jet.Eta)
46 result["BjetPhi"].append(jet.Phi)
47 result["Njets"] = len(event.selectedJets)
48 result["Nbjets"] = nb
49 result["MET"] = event.MEt[0].MET
50 result["METphi"] = event.MEt[0].Phi
51 return result
52
53if __name__=="__main__":
54 import sys
55 from DelphesAnalysis.BaseControlPlots import runTest
56 runTest(sys.argv[1], JetControlPlots())
57
Note: See TracBrowser for help on using the repository browser.