ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/CMSSW/PhysicsTools/PythonAnalysis/scripts/EdmDumpEventContent
Revision: 1.1
Committed: Fri Mar 2 12:42:31 2007 UTC (18 years, 2 months ago) by hegner
Branch: MAIN
CVS Tags: V00-01-03
Log Message:
dumps event content similar to module DumpEventContent

File Contents

# User Rev Content
1 hegner 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     tmpBranch.label = tmpBranch.name.split("_")[2]
27     tmpBranch.type = branchType(branch)
28     tmpBranch.module = tmpBranch.name.split("_")[1]
29     tmpBranch.cpp = events.cppCode(tmpBranch.name)
30     branches.append(copy.copy(tmpBranch))
31    
32     for branch in branches:
33     print '%s "%s" "%s"' %(branch.type, branch.module, branch.label)
34    
35    
36     if __name__ == "__main__":
37    
38     args = sys.argv
39     if 2 == len(args):
40     try:
41     import PhysicsTools.PythonAnalysis.cmstools as cmstools
42     import ROOT
43     ROOT.gSystem.Load("libFWCoreFWLite.so")
44     ROOT.AutoLibraryLoader.enable()
45     filename = args[1]
46     dumpBranches(filename)
47     except:
48     "Could not read %s" %filename
49     else:
50     print "Usage: EdmDumpEventContent filename.root"
51    
52