ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/CMSSW/PhysicsTools/PythonAnalysis/scripts/edmDumpEventContent
Revision: 1.3
Committed: Fri Apr 3 21:00:47 2009 UTC (16 years, 1 month ago) by hegner
Branch: MAIN
CVS Tags: CMSSW_2_2_13_offpatch1, CMSSW_2_2_13_HLT, CMSSW_2_2_13, CMSSW_2_2_12_HLT, CMSSW_2_2_12, CMSSW_3_1_0_pre9, CMSSW_3_1_0_pre8, CMSSW_2_2_11_offpatch1, CMSSW_2_2_11, CMSSW_2_2_11_HLT, CMSSW_3_1_0_pre7, CMSSW_2_2_10_HLT, CMSSW_2_2_10, CMSSW_2_2_9, CMSSW_3_1_0_pre6, CMSSW_2_2_8, CMSSW_3_1_0_pre5, V00-02-04
Changes since 1.2: +2 -1 lines
Log Message:
force ROOT to use batch mode

File Contents

# User Rev Content
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 hegner 1.3 sys.argv.append( '-b-' ) #to let ROOT understand we are in batch mode
44 lsexton 1.1 import ROOT
45     ROOT.gSystem.Load("libFWCoreFWLite.so")
46     ROOT.AutoLibraryLoader.enable()
47     filename = args[1]
48     dumpBranches(filename)
49     except:
50     "Could not read %s" %filename
51     else:
52 hegner 1.3 print "Usage: edmDumpEventContent filename.root"
53 lsexton 1.1
54