1 |
lsexton |
1.1 |
#!/usr/bin/env python
|
2 |
|
|
|
3 |
|
|
import sys
|
4 |
|
|
import copy
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
class Branch(object):
|
8 |
|
|
pass
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
def branchType(branch):
|
12 |
|
|
type = cmstools.ROOT.branchToClass(branch).GetName()
|
13 |
|
|
if "edm::Wrapper" in type:
|
14 |
|
|
type = type.replace("edm::Wrapper<","").rstrip(">")
|
15 |
|
|
return type
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
def dumpBranches(filename):
|
19 |
|
|
events = cmstools.EventTree(filename)
|
20 |
|
|
listOfBranches = events._tree.GetListOfBranches()
|
21 |
|
|
branches = []
|
22 |
|
|
for branch in listOfBranches:
|
23 |
|
|
tmpBranch = Branch()
|
24 |
|
|
tmpBranch.name = branch.GetName()
|
25 |
|
|
if not "EventAux" in tmpBranch.name:
|
26 |
hegner |
1.2 |
tmpBranch.process = tmpBranch.name.split("_")[3]
|
27 |
lsexton |
1.1 |
tmpBranch.label = tmpBranch.name.split("_")[2]
|
28 |
|
|
tmpBranch.type = branchType(branch)
|
29 |
|
|
tmpBranch.module = tmpBranch.name.split("_")[1]
|
30 |
|
|
tmpBranch.cpp = events.cppCode(tmpBranch.name)
|
31 |
|
|
branches.append(copy.copy(tmpBranch))
|
32 |
|
|
|
33 |
|
|
for branch in branches:
|
34 |
hegner |
1.2 |
print '%s "%s" "%s" "%s"' %(branch.type, branch.module, branch.label, branch.process)
|
35 |
lsexton |
1.1 |
|
36 |
|
|
|
37 |
|
|
if __name__ == "__main__":
|
38 |
|
|
|
39 |
|
|
args = sys.argv
|
40 |
|
|
if 2 == len(args):
|
41 |
|
|
try:
|
42 |
|
|
import PhysicsTools.PythonAnalysis as cmstools
|
43 |
|
|
import ROOT
|
44 |
|
|
ROOT.gSystem.Load("libFWCoreFWLite.so")
|
45 |
|
|
ROOT.AutoLibraryLoader.enable()
|
46 |
|
|
filename = args[1]
|
47 |
|
|
dumpBranches(filename)
|
48 |
|
|
except:
|
49 |
|
|
"Could not read %s" %filename
|
50 |
|
|
else:
|
51 |
|
|
print "Usage: EdmDumpEventContent filename.root"
|
52 |
|
|
|
53 |
|
|
|