Line | |
---|
1 | #!/usr/bin/env python |
---|
2 | import os |
---|
3 | import ROOT |
---|
4 | import Delphes |
---|
5 | from AnalysisEvent import AnalysisEvent |
---|
6 | import EventSelection |
---|
7 | from CPconfig import configuration, eventDumpConfig |
---|
8 | |
---|
9 | def DumpEventInfo(event=None, eventNumber=None, path="./"): |
---|
10 | """Dump informations about a given event""" |
---|
11 | # in case no event is provided, find it using eventNumber |
---|
12 | if event is None: |
---|
13 | if eventNumber is None: |
---|
14 | print "DumpEventInfo Error: either pass an event or an event number" |
---|
15 | return |
---|
16 | # find event based on run and event |
---|
17 | if os.path.isdir(path): |
---|
18 | dirList=os.listdir(path) |
---|
19 | files=[] |
---|
20 | for fname in dirList: |
---|
21 | files.append(path+fname) |
---|
22 | elif os.path.isfile(path): |
---|
23 | files=[path] |
---|
24 | else: |
---|
25 | files=[] |
---|
26 | events = AnalysisEvent(files) |
---|
27 | EventSelection.prepareAnalysisEvent(events) |
---|
28 | DumpEventInfo(events[eventNumber]) |
---|
29 | return |
---|
30 | # run the producers when we want to print the outcome, and mute unneeded collections |
---|
31 | for product in eventDumpConfig.productsToPrint: getattr(event,product) |
---|
32 | for collection in eventDumpConfig.collectionsToHide: event.removeCollection(collection) |
---|
33 | # Now, we can go on with the printing. |
---|
34 | print event |
---|
35 | |
---|
36 | if __name__=="__main__": |
---|
37 | import sys |
---|
38 | DumpEventInfo(eventNumber=int(sys.argv[1]), path=sys.argv[2]) |
---|
39 | |
---|
Note: See
TracBrowser
for help on using the repository browser.