5 return s[0].lower()+s[1:]
8 "RelValMinBias":
"Min Bias",
9 "RelValTTbar":
"TTbar",
10 "RelValQCD_Pt_600_800":
"QCD Pt 600 to 800",
11 "RelValQCD_Pt_3000_3500":
"QCD Pt 3000 to 3500",
12 "RelValQCD_FlatPt_15_3000":
"QCD Flat Pt 15 to 3000",
14 "RelValWjet_Pt_3000_3500":
"Wjet Pt 3000 to 3500",
15 "RelValSingleElectronPt35":
"Single Electron Pt 35",
16 "RelValSingleElectronPt10":
"Single Electron Pt 10",
17 "RelValSingleMuPt10":
"Single Muon Pt 10",
18 "RelValSingleMuPt100":
"Single Muon Pt 100",
22 "RelValMinBias":
"minbias",
23 "RelValTTbar":
"ttbar",
24 "RelValQCD_Pt600_800":
"qcd600",
25 "RelValQCD_Pt3000_3500":
"qcd3000",
26 "RelValQCD_FlatPt_15_3000":
"qcdflat",
28 "RelValWjet_Pt_3000_3500":
"wjet3000",
29 "RelValSingleElectronPt35":
"ele35",
30 "RelValSingleElectronPt10":
"ele10",
31 "RelValSingleMuPt10":
"mu10",
32 "RelValSingleMuPt100":
"mu100",
35 _allTPEfficName =
"All tracks (all TPs)"
36 _fromPVName =
"Tracks from PV"
37 _fromPVAllTPName =
"Tracks from PV (all TPs)"
38 _trackQualityNameOrder = collections.OrderedDict([
40 (
"highPurity",
"High purity tracks"),
41 (
"btvLike",
"BTV-like"),
42 (
"ak4PFJets",
"AK4 PF jets"),
43 (
"allTPEffic_", _allTPEfficName),
44 (
"allTPEffic_highPurity", _allTPEfficName.replace(
"All",
"High purity")),
45 (
"fromPV_", _fromPVName),
46 (
"fromPV_highPurity",
"High purity "+
_lowerFirst(_fromPVName)),
47 (
"fromPVAllTP_", _fromPVAllTPName),
48 (
"fromPVAllTP_highPurity",
"High purity "+
_lowerFirst(_fromPVAllTPName)),
52 "ootb":
"Out of the box"
60 'detachedTripletStep',
64 'jetCoreRegionalStep',
65 'muonSeededStepInOut',
66 'muonSeededStepOutIn',
75 _sectionNameMapOrder = collections.OrderedDict([
78 (
"highPurity",
"High purity tracks"),
79 (
"allTPEffic", _allTPEfficName),
80 (
"allTPEffic_highPurity", _allTPEfficName.replace(
"All",
"High purity")),
81 (
"fromPV", _fromPVName),
82 (
"fromPV_highPurity",
"High purity "+
_lowerFirst(_fromPVName)),
83 (
"fromPVAllTP", _fromPVAllTPName),
84 (
"fromPVAllTP_highPurity",
"High purity "+
_lowerFirst(_fromPVAllTPName)),
86 (
"offlinePrimaryVertices",
"All vertices (offlinePrimaryVertices)"),
87 (
"selectedOfflinePrimaryVertices",
"Selected vertices (selectedOfflinePrimaryVertices)"),
89 _allTPEfficLegend =
"All tracks, efficiency denominator contains all TrackingParticles"
90 _fromPVLegend =
"Tracks from reco PV vs. TrackingParticles from gen PV (fake rate includes pileup tracks)"
91 _fromPVAllTPLegend =
"Tracks from reco PV, fake rate numerator contains all TrackingParticles (separates fake tracks from pileup tracks)"
92 _sectionNameLegend = {
93 "btvLike":
"BTV-like selected tracks",
94 "ak4PFJets":
"Tracks from AK4 PF jets (jet corrected pT > 10 GeV)",
95 "allTPEffic": _allTPEfficLegend,
96 "allTPEffic_": _allTPEfficLegend,
97 "allTPEffic_highPurity": _allTPEfficLegend.replace(
"All",
"High purity"),
98 "fromPV": _fromPVLegend,
99 "fromPV_": _fromPVLegend,
100 "fromPV_highPurity":
"High purity "+
_lowerFirst(_fromPVLegend),
101 "fromPVAllTP": _fromPVAllTPLegend,
102 "fromPVAllTP_": _fromPVAllTPLegend,
103 "fromPVAllTP_highPurity":
"High purity "+
_lowerFirst(_fromPVAllTPLegend),
117 ' <title>%s</title>' % title,
120 self._content.append(
' <base href="%s"/>' % base)
121 self._content.extend([
135 sections = self.
_orderSets(self._plotSets.keys())
137 self._content.extend([
145 for isec, section
in enumerate(sections):
147 if section
in _sectionNameLegend:
148 legnum = len(legends)+1
149 leg =
"<sup>%d</sup>" % legnum
150 leg2 =
"<sup>%d</sup>" % legnum
151 legends.append(
"%s %s" % (leg2, _sectionNameLegend[section]))
153 self._content.extend([
156 files = [(os.path.basename(f), f)
for f
in self.
_plotSets[section]]
157 for row
in fileTable:
159 for i, (bsf, f)
in enumerate(files):
168 fileTable.append( [bsf] + [
None]*isec + [f] )
170 self._content.extend([
174 for row
in fileTable:
175 self._content.append(
' <tr>')
179 self._content.append(
' <td><a href="%s">%s</a></td>' % (elem, bs))
181 self._content.append(
' <td></td>')
182 self._content.append(
' </tr>')
185 self._content.extend([
189 self._content.extend([
194 self._content.append(
' %s<br/>' % leg)
196 self._content.extend([
202 f = open(fileName,
"w")
209 return _sectionNameMapOrder.get(section, section)
213 for section
in _sectionNameMapOrder.keys():
221 def __init__(self, title, base, sampleName, sample, fastVsFull):
228 if hasattr(sample,
"hasPileup"):
230 if sample.hasPileup():
231 self.
_prefix =
"pu"+sample.pileupType()
239 self.
_prefix += _sampleFileName.get(sample.label(), sample.label())+
"_"
241 def addPlotSet(self, plotterFolder, dqmSubFolder, plotFiles):
242 pageKey = plotterFolder.getPage()
244 if dqmSubFolder
is not None:
245 pageKey = dqmSubFolder.translated
247 pageKey = plotterFolder.getName()
249 if pageKey
not in self.
_pages:
251 self.
_pages[pageKey] = page
253 page = self.
_pages[pageKey]
254 sectionName = plotterFolder.getSection()
255 if sectionName
is None:
256 if plotterFolder.getPage()
is not None and dqmSubFolder
is not None:
257 sectionName = dqmSubFolder.translated
261 page.addPlotSet(sectionName, plotFiles)
270 fileName =
"%s%s.html" % (self.
_prefix, key)
271 page.write(os.path.join(baseDir, fileName))
276 return _pageNameMap.get(name, name)
285 super(TrackingIterPage, self).
__init__(*args, **kwargs)
288 return _trackQualityNameOrder.get(quality, quality)
292 for qual
in _trackQualityNameOrder.keys():
293 if qual
in qualities:
295 qualities.remove(qual)
296 ret.extend(qualities)
301 super(TrackingPageSet, self).
__init__(*args, **kwargs)
303 def addPlotSet(self, plotterFolder, dqmSubFolder, plotFiles):
304 (algo, quality) = dqmSubFolder.translated
307 sectionName = quality
310 if "ootb" not in algo
and "Step" not in algo:
314 folderName = plotterFolder.getName()
316 sectionName = folderName+
"_"+sectionName
318 if pageName
not in self.
_pages:
320 self.
_pages[pageName] = page
322 page = self.
_pages[pageName]
323 page.addPlotSet(sectionName, plotFiles)
326 return _trackAlgoName.get(algo, algo)
330 for algo
in _trackAlgoOrder:
340 def __init__(self, sample, fastVsFull, title, base):
350 if hasattr(sample,
"hasPileup"):
351 pileup =
"with no pileup"
352 if sample.hasPileup():
353 pileup =
"with %s pileup" % sample.pileupType()
354 self.
_sampleName +=
"%s sample %s" % (_sampleName.get(sample.name(), sample.name()), pileup)
356 params = [title, base, self.
_sampleName, sample, fastVsFull]
363 def addPlots(self, plotterFolder, dqmSubFolder, plotFiles):
364 params = [plotterFolder, dqmSubFolder, plotFiles]
366 purpose = plotterFolder.getPurpose()
368 self._iterationPages.addPlotSet(*params)
370 self._summaryPage.addPlotSet(*params)
372 self._vertexPage.addPlotSet(*params)
374 self._miniaodPage.addPlotSet(*params)
376 self._otherPages.addPlotSet(*params)
386 labelFiles = pages.write(baseDir)
387 for label, fname
in labelFiles:
388 ret.append(
' <li><a href="%s">%s</a></li>' % (fname, label))
398 def __init__(self, validationName, newBaseDir, baseUrl=None):
399 self.
_title =
"Tracking validation "+validationName
406 ' <title>%s</title>' % self.
_title,
408 if self.
_base is not None:
409 self._index.append(
' <base href="%s"/>' % self.
_base)
418 key = (sample.digest(), fastVsFull)
426 self._currentSection.addPlots(*args, **kwargs)
430 keys = self._sections.iterkeys()
437 ind_fast = newkeys.index( (key[0],
False) )
438 newkeys.insert(ind_fast+1, key)
442 self._index.extend(section.write(self.
_newBaseDir))
449 f = open(os.path.join(self.
_newBaseDir,
"index.html"),
"w")