Fork me on GitHub

source: svn/trunk/python/DelphesAnalysis/EventSelectionControlPlots.py@ 1388

Last change on this file since 1388 was 1112, checked in by Pavel Demin, 12 years ago

add DelphesAnalysis

File size: 1.4 KB
Line 
1import ROOT
2import sys
3import os
4from AnalysisEvent import AnalysisEvent
5from BaseControlPlots import BaseControlPlots
6from CPconfig import configuration
7import EventSelection
8
9# Requirements:
10# fully implemented EventSelection
11# categories stored as event.category
12
13class EventSelectionControlPlots(BaseControlPlots):
14 """A class to create control plots for event selection"""
15
16 def __init__(self, dir=None, dataset=None, mode="plots"):
17 # create output file if needed. If no file is given, it means it is delegated
18 BaseControlPlots.__init__(self, dir=dir, purpose="eventSelection", dataset=dataset, mode=mode)
19 self.eventCategories = EventSelection.eventCategories()
20
21 def beginJob(self):
22 # declare histograms
23 self.add("event","Event number",1000,0,100000)
24 self.add("category","event category",self.eventCategories+1,0,self.eventCategories+1)
25
26 def process(self, event):
27 """EventSelectionControlPlots"""
28 result = { }
29 ## event category
30 categoryData = event.category
31 result["category"] = [ ]
32 for category in range(self.eventCategories):
33 if EventSelection.isInCategory(category, categoryData):
34 result["category"].append(category)
35 result["event"] = event.event()
36 return result
37
38if __name__=="__main__":
39 import sys
40 from BaseControlPlots import runTest
41 runTest(sys.argv[1], EventSelectionControlPlots())
42
Note: See TracBrowser for help on using the repository browser.