Fork me on GitHub

source: git/python/DelphesAnalysis/DumpEventList.py@ 6519cfb

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

add DelphesAnalysis

  • Property mode set to 100644
File size: 909 bytes
Line 
1#!/usr/bin/env python
2import os
3import ROOT
4import Delphes
5from AnalysisEvent import AnalysisEvent
6import EventSelection
7
8def DumpEventList(category, path="./", output="eventlist.txt"):
9 """Dump a list of events in a given category"""
10 # input
11 if os.path.isdir(path):
12 dirList=os.listdir(path)
13 files=[]
14 for fname in dirList:
15 files.append(path+fname)
16 elif os.path.isfile(path):
17 files=[path]
18 else:
19 files=[]
20 # events
21 events = AnalysisEvent(files)
22 # output
23 event_list = open(output,"w")
24 # collections and producers used in the analysis
25 EventSelection.prepareAnalysisEvent(events)
26 for event in events:
27 # check category
28 if EventSelection.isInCategory(category, event.category):
29 # print
30 print >> event_list , "Event", event.event()
31
32if __name__=="__main__":
33 import sys
34 DumpEventList(int(sys.argv[1]), path=sys.argv[2], output="eventlist.txt")
35
Note: See TracBrowser for help on using the repository browser.