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 _conversionName =
"Tracks for conversions"
39 _trackQualityNameOrder = collections.OrderedDict([
40 (
"seeding_seeds",
"Seeds"),
41 (
"seeding_seedsa",
"Seeds A"),
42 (
"seeding_seedsb",
"Seeds B"),
43 (
"seeding_seedstripl",
"Seeds triplets"),
44 (
"seeding_seedspair",
"Seeds pairs"),
45 (
"building_",
"Built tracks"),
47 (
"highPurity",
"High purity tracks"),
48 (
"Pt",
"Tracks pT > 0.9 GeV"),
49 (
"highPurityPt",
"High purity tracks pT > 0.9 GeV"),
50 (
"ByOriginalAlgo",
"All tracks by originalAlgo"),
51 (
"highPurityByOriginalAlgo",
"High purity tracks by originalAlgo"),
52 (
"ByAlgoMask",
"All tracks by algoMask"),
53 (
"highPurityByAlgoMask",
"High purity tracks by algoMask"),
54 (
"btvLike",
"BTV-like"),
55 (
"ak4PFJets",
"AK4 PF jets"),
56 (
"allTPEffic_", _allTPEfficName),
57 (
"allTPEffic_highPurity", _allTPEfficName.replace(
"All",
"High purity")),
58 (
"fromPV_", _fromPVName),
59 (
"fromPV_highPurity",
"High purity "+
_lowerFirst(_fromPVName)),
60 (
"fromPVAllTP_", _fromPVAllTPName),
61 (
"fromPVAllTP_highPurity",
"High purity "+
_lowerFirst(_fromPVAllTPName)),
62 (
"fromPVAllTP_Pt", _fromPVAllTPName.replace(
"Tracks",
"Tracks pT > 0.9 GeV")),
63 (
"fromPVAllTP_highPurityPt",
"High purity "+
_lowerFirst(_fromPVAllTPName).
replace(
"tracks",
"tracks pT > 0.9 GeV")),
64 (
"fromPVAllTP2_", _fromPVAllTPName.replace(
"PV",
"PV v2")),
65 (
"fromPVAllTP2_highPurity",
"High purity "+
_lowerFirst(_fromPVAllTPName).
replace(
"PV",
"PV v2")),
66 (
"fromPVAllTP2_Pt", _fromPVAllTPName.replace(
"Tracks",
"Tracks pT > 0.9 GeV").
replace(
"PV",
"PV v2")),
67 (
"fromPVAllTP2_highPurityPt",
"High purity "+
_lowerFirst(_fromPVAllTPName).
replace(
"tracks",
"tracks pT > 0.9 GeV").
replace(
"PV",
"PV v2")),
68 (
"conversion_", _conversionName)
72 "ootb":
"Out of the box",
73 "iter0" :
"Iterative Step 0",
74 "iter1" :
"Iterative Step 1",
75 "iter2" :
"Iterative Step 2",
76 "iter3" :
"Iterative Step 3",
77 "iter4" :
"Iterative Step 4",
78 "iter5" :
"Iterative Step 5",
79 "iter6" :
"Iterative Step 6",
80 "iter7" :
"Iterative Step 7",
81 "iter9" :
"Iterative Step 9",
82 "iter10":
"Iterative Step 10",
87 'initialStepPreSplitting',
94 'detachedTripletStep',
98 'jetCoreRegionalStep',
99 'muonSeededStepInOut',
100 'muonSeededStepOutIn',
104 'ckfInOutFromConversions',
105 'ckfOutInFromConversions',
119 "summary":
"Summary",
122 "miniaod":
"MiniAOD",
126 _sectionNameMapOrder = collections.OrderedDict([
128 (
"seeding_seeds",
"Seeds"),
129 (
"building",
"Built tracks"),
131 (
"highPurity",
"High purity tracks"),
132 (
"allTPEffic", _allTPEfficName),
133 (
"allTPEffic_highPurity", _allTPEfficName.replace(
"All",
"High purity")),
134 (
"fromPV", _fromPVName),
135 (
"fromPV_highPurity",
"High purity "+
_lowerFirst(_fromPVName)),
136 (
"fromPVAllTP", _fromPVAllTPName),
137 (
"fromPVAllTP_highPurity",
"High purity "+
_lowerFirst(_fromPVAllTPName)),
138 (
"conversion", _conversionName),
140 (
"offlinePrimaryVertices",
"All vertices (offlinePrimaryVertices)"),
141 (
"selectedOfflinePrimaryVertices",
"Selected vertices (selectedOfflinePrimaryVertices)"),
144 (
"lambda",
"Lambda"),
146 _allTPEfficLegend =
"All tracks, efficiency denominator contains all TrackingParticles"
147 _fromPVLegend =
"Tracks from reco PV vs. TrackingParticles from gen PV (fake rate includes pileup tracks)"
148 _fromPVAllTPLegend =
"Tracks from reco PV, fake rate numerator contains all TrackingParticles (separates fake tracks from pileup tracks)"
149 _fromPVAllTPPtLegend =
"Tracks (pT > 0.9 GeV) from reco PV, fake rate numerator contains all TrackingParticles (separates fake tracks from pileup tracks)"
150 _fromPVAllTP2Legend =
"Tracks from reco PV (another method), fake rate numerator contains all TrackingParticles (separates fake tracks from pileup tracks)"
151 _fromPVAllTPPt2Legend =
"Tracks (pT > 0.9 GeV) from reco PV (another method), fake rate numerator contains all TrackingParticles (separates fake tracks from pileup tracks)"
155 "btvLike":
"BTV-like selected tracks",
156 "ak4PFJets":
"Tracks from AK4 PF jets (jet corrected pT > 10 GeV)",
157 "allTPEffic": _allTPEfficLegend,
158 "allTPEffic_": _allTPEfficLegend,
159 "allTPEffic_highPurity": _allTPEfficLegend.replace(
"All",
"High purity"),
160 "fromPV": _fromPVLegend,
161 "fromPV_": _fromPVLegend,
162 "fromPV_highPurity":
"High purity "+
_lowerFirst(_fromPVLegend),
163 "fromPVAllTP": _fromPVAllTPLegend,
164 "fromPVAllTP_": _fromPVAllTPLegend,
165 "fromPVAllTP_highPurity":
"High purity "+
_lowerFirst(_fromPVAllTPLegend),
166 "fromPVAllTP_Pt": _fromPVAllTPPtLegend,
167 "fromPVAllTP_highPurityPt":
"High purity "+
_lowerFirst(_fromPVAllTPPtLegend),
168 "fromPVAllTP2_": _fromPVAllTP2Legend,
169 "fromPVAllTP2_highPurity":
"High purity "+
_lowerFirst(_fromPVAllTP2Legend),
170 "fromPVAllTP2_Pt": _fromPVAllTPPt2Legend,
171 "fromPVAllTP2_highPurityPt":
"High purity "+
_lowerFirst(_fromPVAllTPPt2Legend),
176 def __init__(self, columnHeaders, rowHeaders, table, purpose, page, section):
177 if len(columnHeaders) != len(table):
178 raise Exception(
"Got %d columnHeaders for table with %d columns for page %s, section %s" % (len(columnHeaders), len(table), page, section))
179 lenRow = len(table[0])
180 for icol, column
in enumerate(table):
181 if len(column) != lenRow:
182 raise Exception(
"Got non-square table, first column has %d rows, column %d has %d rows" % (lenRow, icol, len(column)))
183 if len(rowHeaders) != lenRow:
184 raise Exception(
"Got %d rowHeaders for table with %d rows" % (len(rowHeaders), lenRow))
207 return len(self.
_table[0])
233 ' <title>%s</title>' % title,
251 for plotSet
in self._plotSets.itervalues():
269 self._content.extend([
275 f = open(fileName,
"w")
284 if section
in legends:
289 leg =
"<sup>%d</sup>" % legnum
290 leg2 =
"<sup>%d)</sup>" % legnum
291 self._legends.append(
"%s %s" % (leg2, legends[section]))
296 self._content.extend([
303 sections = self.
_orderSets(self._plotSets.keys())
304 for isec, section
in enumerate(sections):
307 self._content.extend([
310 files = [(os.path.basename(f), f)
for f
in self.
_plotSets[section]]
311 for row
in fileTable:
313 for i, (bsf, f)
in enumerate(files):
322 fileTable.append( [bsf] + [
None]*isec + [f] )
324 self._content.extend([
328 for row
in fileTable:
329 self._content.append(
' <tr>')
333 self._content.append(
' <td><a href="%s">%s</a></td>' % (elem, bs))
335 self._content.append(
' <td></td>')
336 self._content.append(
' </tr>')
339 self._content.extend([
349 self._columnHeaders.append(
"%s: %s" % (leg, header))
360 sections = self.
_orderSets(self._tables.keys())
361 for isec, section
in enumerate(sections):
365 self._content.extend([
368 ' <table border="1">'
372 data = table.tableAsRowColumn()
374 self._content.extend([
378 heads = table.columnHeaders()
379 if max(map(
lambda h: len(h), heads)) > 20:
382 self._content.append(
' <td>%s</td>' % head)
383 self._content.append(
' </tr>')
385 for irow, row
in enumerate(data):
390 self._content.extend([
392 ' <td>%s</td>' % table.rowHeaders()[irow]
395 for icol, item
in enumerate(row):
396 formatted = str(item)
if item
is not None else ""
397 self._content.append(
' <td align="right">%s</td>' % formatted)
398 self._content.append(
' </tr>')
400 self._content.append(
' </table>')
403 self._content.append(
' %s<br/>' % shortenedColumnHeader)
409 self._content.extend([
414 self._content.append(
' %s<br/>' % leg)
418 return _sectionNameMapOrder.get(section, section)
422 for section
in _sectionNameMapOrder.keys():
430 def __init__(self, title, sampleName, sample, fastVsFull):
436 if hasattr(sample,
"hasPileup"):
438 if sample.hasPileup():
439 self.
_prefix =
"pu"+sample.pileupType()
447 self.
_prefix += _sampleFileName.get(sample.label(), sample.label())+
"_"
450 if key
not in self.
_pages:
457 def addPlotSet(self, plotterFolder, dqmSubFolder, plotFiles):
458 pageKey = plotterFolder.getPage()
460 if dqmSubFolder
is not None:
461 pageKey = dqmSubFolder.translated
463 pageKey = plotterFolder.getName()
466 sectionName = plotterFolder.getSection()
467 if sectionName
is None:
468 if plotterFolder.getPage()
is not None and dqmSubFolder
is not None:
469 sectionName = dqmSubFolder.translated
473 page.addPlotSet(sectionName, plotFiles)
479 page = self.
_getPage(table.getPage(), Page)
480 page.addTable(table.getSection(), table)
492 fileName =
"%s%s.html" % (self.
_prefix, key)
493 page.write(os.path.join(baseDir, fileName))
498 return _pageNameMap.get(name, name)
507 super(TrackingIterPage, self).
__init__(*args, **kwargs)
510 return _trackQualityNameOrder.get(quality, quality)
514 for qual
in _trackQualityNameOrder.keys():
515 if qual
in qualities:
517 qualities.remove(qual)
518 ret.extend(qualities)
523 super(TrackingPageSet, self).
__init__(*args, **kwargs)
525 def addPlotSet(self, plotterFolder, dqmSubFolder, plotFiles):
526 (algo, quality) = dqmSubFolder.translated
529 sectionName = quality
535 if algo !=
"ootb" and not plotterFolder._plotFolder.isAlgoIterative(algo):
539 folderName = plotterFolder.getName()
541 sectionName = folderName+
"_"+sectionName
543 page = self.
_getPage(pageName, TrackingIterPage)
544 page.addPlotSet(sectionName, plotFiles)
547 return _trackAlgoName.get(algo, algo)
551 for algo
in _trackAlgoOrder:
571 if hasattr(sample,
"hasPileup"):
572 pileup =
"with no pileup"
573 if sample.hasPileup():
574 pileup =
"with %s pileup" % sample.pileupType()
575 self.
_sampleName +=
"%s sample %s" % (_sampleName.get(sample.name(), sample.name()), pileup)
577 params = [title, self.
_sampleName, sample, fastVsFull]
593 def addPlots(self, plotterFolder, dqmSubFolder, plotFiles):
594 page = self._purposePageMap.get(plotterFolder.getPurpose(), self.
_otherPages)
595 page.addPlotSet(plotterFolder, dqmSubFolder, plotFiles)
601 page = self._purposePageMap.get(table.getPurpose(), self.
_otherPages)
613 labelFiles = pages.write(baseDir)
614 for label, fname
in labelFiles:
615 ret.append(
' <li><a href="%s">%s</a></li>' % (fname, label))
626 self.
_title =
"Tracking validation "+validationName
632 ' <title>%s</title>' % self.
_title,
640 self._index.append(
' <p>%s</p>'%note)
643 key = (sample.digest(), fastVsFull)
651 self._currentSection.addPlots(*args, **kwargs)
654 self._currentSection.addTable(*args, **kwargs)
658 keys = self._sections.iterkeys()
665 ind_fast = newkeys.index( (key[0],
False) )
666 newkeys.insert(ind_fast+1, key)
670 self._index.extend(section.write(self.
_newBaseDir))
677 f = open(os.path.join(self.
_newBaseDir,
"index.html"),
"w")
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)