3 import xml.parsers.expat
13 usage =
"usage: %s <DQM_File.root>" % os.path.basename(sys.argv[0])
23 f = TFile(infile,
'read')
24 ff = open(outfile,
'w')
27 reportSummary =
"<reportSummary>"
28 DQMDataDir =
"DQMData"
29 EventInfoDir =
"/Run summary/EventInfo"
30 ReportSummaryContentsDir =
"/Run summary/EventInfo/reportSummaryContents"
31 summary = std.vector(float)()
32 reportSummaryContents = std.vector(string)()
35 dirlist = dirtmp.GetListOfKeys()
36 iter = dirlist.MakeIterator()
42 dirName = td.GetName()
43 if(re.search(
'Run (\d+)', dirName)):
48 SummaryContentsDirExists = 0
51 global SummaryContentsDirExists
52 SummaryContentsDirExists = 0
53 ReportSummaryContentsDir =
"/Run summary/EventInfo/reportSummaryContents"
54 SummaryContentsDir = DQMDataDir +
'/' + rundirname +
'/' + subdet + ReportSummaryContentsDir
55 SegEventInfoDir = DQMDataDir +
'/' + rundirname +
'/' + subdet + EventInfoDir
59 dirlist = dirtmp.GetListOfKeys()
60 iter = dirlist.MakeIterator()
66 dirName = td.GetName()
67 if(re.search(
'reportSummaryContents', dirName)):
68 SummaryContentsDirExists = 1
71 if(SummaryContentsDirExists):
72 f.cd(SummaryContentsDir)
74 SummaryContentsDirExists = 0
75 print "Warning: No reportSummaryContents directory found in", subdet
76 return reportSummaryContents, summary
77 SummaryContentsDir = gDirectory
78 dirlist = SummaryContentsDir.GetListOfKeys()
79 iter = dirlist.MakeIterator()
84 keyName = tk.GetName()
85 mn = re.search(
'(<.+?>)', keyName)
87 reportSummaryContent = mn.group(0)
88 ms = re.split(
'=', keyName)
89 m = re.search(
'-?\d?\.?\d+', ms[1])
90 segsummary = m.group(0)
91 summary.push_back(float(segsummary))
92 reportSummaryContents.push_back(reportSummaryContent)
94 return reportSummaryContents, summary
98 reportSummaryDir = DQMDataDir +
'/' + rundirname +
'/' + subdet + EventInfoDir
100 f.cd(reportSummaryDir)
101 reportSummaryDir = gDirectory
102 dirlist = reportSummaryDir.GetListOfKeys()
103 iter = dirlist.MakeIterator()
108 keyName = tk.GetName()
109 if(re.search(reportSummary, keyName)):
110 ms = re.split(
'=', keyName)
111 m = re.search(
'-?\d?\.?\d+', ms[1])
112 detsummary = m.group(0)
117 DQMDataDir =
"DQMData"
121 dirlist = dirtmp.GetListOfKeys()
122 iter = dirlist.MakeIterator()
129 dirName = td.GetName()
130 if(re.search(
'Run (\d+)', dirName)):
135 RunDirFull = DQMDataDir +
'/' + rundirname
138 dirlist = dirtmp.GetListOfKeys()
139 iter = dirlist.MakeIterator()
143 SubDetectors =std.vector(string)()
147 dirName = td.GetName()
149 SubDetectors.push_back(dirName)
154 for subdet
in SubDetectors:
155 print >>ff,
'============================'
156 print >>ff, rundirname, subdet
158 if( SummaryContentsDirExists == 1):
160 reportSummaryContents.push_back(reportSummary)
163 print >> ff, reportSummaryContents[j], int(1000*i)
166 reportSummaryContents.clear()
167 print >> ff,
'============================'
def getDQMSegSummaryResult
def getDQMDetSummaryResult