Fork me on GitHub

source: git/python/LeptonControlPlots.py@ 46c8df8

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

add DelphesAnalysis

  • Property mode set to 100644
File size: 1.5 KB
RevLine 
[ae1d49f]1from BaseControlPlots import BaseControlPlots
2
3# Requirements:
4# event.muons
5# event.electrons
6
7class LeptonControlPlots(BaseControlPlots):
8 """A class to create control plots for leptons"""
9
10 def __init__(self, dir=None, dataset=None, mode="plots"):
11 # create output file if needed. If no file is given, it means it is delegated
12 BaseControlPlots.__init__(self, dir=dir, purpose="leptons", dataset=dataset, mode=mode)
13
14 def beginJob(self):
15 # declare histograms
16 self.add("ElectronPt","Electron Pt",100,0,200)
17 self.add("MuonPt","Muon Pt",100,0,200)
18 self.add("ElectronEta","Electron Eta",50,-2.5,2.5)
19 self.add("MuonEta","Muon Eta",50,-2.5,2.5)
20 self.add("NMuons","Muon multiplicity",10,0,10)
21 self.add("NElectrons","Electron multiplicity",10,0,10)
22
23 def process(self, event):
24 #get information
25 result = { }
26 result["ElectronPt"] = [ ]
27 result["MuonPt"] = [ ]
28 result["ElectronEta"] = [ ]
29 result["MuonEta"] = [ ]
30 for mu in event.muons:
31 result["MuonPt"].append(mu.PT)
32 result["MuonEta"].append(mu.Eta)
33 for ele in event.electrons:
34 result["ElectronPt"].append(ele.PT)
35 result["ElectronEta"].append(ele.Eta)
36 result["NMuons"] = event.muons.GetEntries()
37 result["NElectrons"] = event.electrons.GetEntries()
38 return result
39
40if __name__=="__main__":
41 import sys
42 from DelphesAnalysis.BaseControlPlots import runTest
43 runTest(sys.argv[1], LeptonControlPlots())
44
Note: See TracBrowser for help on using the repository browser.