-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprintEvents.py
More file actions
50 lines (34 loc) · 1.02 KB
/
printEvents.py
File metadata and controls
50 lines (34 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import sys,string,os.path,glob
EXEC="root -b -q -l -n"
# EXEC="root"
mymacro="printEvents.cc"
def usage():
""" Usage: printEvents <directory or filename> <treeName>
Printout the leaves on <rootfile>
"""
pass
if __name__ == '__main__':
narg=len(sys.argv)
if narg < 2 :
print usage.__doc__
sys.exit(1)
rootpath=os.path.join(os.environ['HOME'],"rootmacros")
rootmacro=os.path.join(rootpath,mymacro)
rootdir=sys.argv[1]
rootTree="HltTree"
if narg == 3:
rootTree=sys.argv[2]
if (os.path.isdir(rootdir)):
os.chdir(rootdir)
#filelist=os.listdir(".")
filelist=glob.glob("./*.root")
else:
filelist=[rootdir]
print filelist
for rootfile in filelist:
Command="\'" + rootmacro + "(\"" + rootfile + "\"," +\
"\"" + rootTree + "\"" +\
")\'"
myargs = string.join([EXEC,Command])
# print "Command arguments: ",myargs
os.system(myargs)