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 "RelValH125GGgluonfusion":
"Higgs to gamma gamma",
16 "RelValSingleElectronPt35":
"Single Electron Pt 35",
17 "RelValSingleElectronPt35Extended":
"Single Electron Pt 35 (extended eta)",
18 "RelValSingleElectronPt10":
"Single Electron Pt 10",
19 "RelValSingleMuPt10":
"Single Muon Pt 10",
20 "RelValSingleMuPt10Extended":
"Single Muon Pt 10 (extended eta)",
21 "RelValSingleMuPt100":
"Single Muon Pt 100",
22 "RelValTenMuE_0_200":
"Ten muon Pt 0-200",
26 "RelValMinBias":
"minbias",
27 "RelValTTbar":
"ttbar",
28 "RelValQCD_Pt_600_800":
"qcd600",
29 "RelValQCD_Pt_3000_3500":
"qcd3000",
30 "RelValQCD_FlatPt_15_3000":
"qcdflat",
32 "RelValWjet_Pt_3000_3500":
"wjet3000",
33 "RelValH125GGgluonfusion":
"hgg",
34 "RelValSingleElectronPt35":
"ele35",
35 "RelValSingleElectronPt35Extended":
"ele35ext",
36 "RelValSingleElectronPt10":
"ele10",
37 "RelValSingleMuPt10":
"mu10",
38 "RelValSingleMuPt10Extended":
"mu10ext",
39 "RelValSingleMuPt100":
"mu100",
40 "RelValTenMuE_0_200":
"tenmu200",
43 _allTPEfficName =
"All tracks (all TPs)"
44 _fromPVName =
"Tracks from PV"
45 _fromPVAllTPName =
"Tracks from PV (all TPs)"
46 _conversionName =
"Tracks for conversions"
47 _gsfName =
"Electron GSF tracks"
51 return s.replace(
"All",
"High purity")
53 return s.replace(
"Tracks",
"Tracks pT > 0.9 GeV").
replace(
"tracks",
"tracks pT > 0.9 GeV")
54 _trackQualityNameOrder = collections.OrderedDict([
55 (
"seeding_seeds",
"Seeds"),
56 (
"seeding_seedsa",
"Seeds A"),
57 (
"seeding_seedsb",
"Seeds B"),
58 (
"seeding_seedstripl",
"Seeds triplets"),
59 (
"seeding_seedspair",
"Seeds pairs"),
60 (
"building_",
"Built tracks"),
62 (
"highPurity",
"High purity tracks"),
63 (
"Pt09",
"Tracks pT > 0.9 GeV"),
64 (
"highPurityPt09",
"High purity tracks pT > 0.9 GeV"),
65 (
"ByOriginalAlgo",
"All tracks by originalAlgo"),
66 (
"highPurityByOriginalAlgo",
"High purity tracks by originalAlgo"),
67 (
"ByAlgoMask",
"All tracks by algoMask"),
68 (
"highPurityByAlgoMask",
"High purity tracks by algoMask"),
69 (
"btvLike",
"BTV-like"),
70 (
"ak4PFJets",
"AK4 PF jets"),
71 (
"allTPEffic_", _allTPEfficName),
72 (
"allTPEffic_highPurity",
_allToHP(_allTPEfficName)),
73 (
"fromPV_", _fromPVName),
74 (
"fromPV_highPurity",
_toHP(_fromPVName)),
75 (
"fromPV_Pt09",
_ptCut(_fromPVName)),
76 (
"fromPV_highPurityPt09",
_toHP(
_ptCut(_fromPVName))),
77 (
"fromPVAllTP_", _fromPVAllTPName),
78 (
"fromPVAllTP_highPurity",
_toHP(_fromPVAllTPName)),
79 (
"fromPVAllTP_Pt09",
_ptCut(_fromPVAllTPName)),
80 (
"fromPVAllTP_highPurityPt09",
_toHP(
_ptCut(_fromPVAllTPName))),
81 (
"fromPVAllTP2_", _fromPVAllTPName.replace(
"PV",
"PV v2")),
82 (
"fromPVAllTP2_highPurity",
"High purity "+
_lowerFirst(_fromPVAllTPName).
replace(
"PV",
"PV v2")),
83 (
"fromPVAllTP2_Pt09", _fromPVAllTPName.replace(
"Tracks",
"Tracks pT > 0.9 GeV").
replace(
"PV",
"PV v2")),
84 (
"fromPVAllTP2_highPurityPt09",
_toHP(
_ptCut(_fromPVAllTPName)).
replace(
"PV",
"PV v2")),
85 (
"conversion_", _conversionName),
90 "ootb":
"Out of the box",
91 "iter0" :
"Iterative Step 0",
92 "iter1" :
"Iterative Step 1",
93 "iter2" :
"Iterative Step 2",
94 "iter3" :
"Iterative Step 3",
95 "iter4" :
"Iterative Step 4",
96 "iter5" :
"Iterative Step 5",
97 "iter6" :
"Iterative Step 6",
98 "iter7" :
"Iterative Step 7",
99 "iter9" :
"Iterative Step 9",
100 "iter10":
"Iterative Step 10",
105 'initialStepPreSplitting',
109 'detachedTripletStep',
116 'jetCoreRegionalStep',
117 'muonSeededStepInOut',
118 'muonSeededStepOutIn',
122 'ckfInOutFromConversions',
123 'ckfOutInFromConversions',
138 "summary":
"Summary",
141 "miniaod":
"MiniAOD",
145 _sectionNameMapOrder = collections.OrderedDict([
147 (
"seeding_seeds",
"Seeds"),
148 (
"building",
"Built tracks"),
150 (
"highPurity",
"High purity tracks"),
151 (
"btvLike",
"BTV-like"),
152 (
"ak4PFJets",
"AK4 PF jets"),
153 (
"allTPEffic", _allTPEfficName),
154 (
"allTPEffic_highPurity", _allTPEfficName.replace(
"All",
"High purity")),
155 (
"fromPV", _fromPVName),
156 (
"fromPV_highPurity",
"High purity "+
_lowerFirst(_fromPVName)),
157 (
"fromPVAllTP", _fromPVAllTPName),
158 (
"fromPVAllTP_highPurity",
"High purity "+
_lowerFirst(_fromPVAllTPName)),
159 (
"conversion", _conversionName),
162 (
"genvertex",
"Gen vertices"),
163 (
"pixelVertices",
"Pixel vertices"),
164 (
"selectedPixelVertices",
"Selected pixel vertices"),
165 (
"firstStepPrimaryVerticesPreSplitting",
"firstStepPrimaryVerticesPreSplitting"),
166 (
"firstStepPrimaryVertices",
"firstStepPrimaryVertices"),
167 (
"offlinePrimaryVertices",
"All vertices (offlinePrimaryVertices)"),
168 (
"selectedOfflinePrimaryVertices",
"Selected vertices (selectedOfflinePrimaryVertices)"),
169 (
"offlinePrimaryVerticesWithBS",
"All vertices with BS constraint"),
170 (
"selectedOfflinePrimaryVerticesWithBS",
"Selected vertices with BS constraint"),
173 (
"lambda",
"Lambda"),
175 _allTPEfficLegend =
"All tracks, efficiency denominator contains all TrackingParticles"
176 _fromPVLegend =
"Tracks from reco PV vs. TrackingParticles from gen PV (fake rate includes pileup tracks)"
177 _fromPVPtLegend =
"Tracks (pT > 0.9 GeV) from reco PV vs. TrackingParticles from gen PV (fake rate includes pileup tracks)"
178 _fromPVAllTPLegend =
"Tracks from reco PV, fake rate numerator contains all TrackingParticles (separates fake tracks from pileup tracks)"
179 _fromPVAllTPPtLegend =
"Tracks (pT > 0.9 GeV) from reco PV, fake rate numerator contains all TrackingParticles (separates fake tracks from pileup tracks)"
180 _fromPVAllTP2Legend =
"Tracks from reco PV (another method), fake rate numerator contains all TrackingParticles (separates fake tracks from pileup tracks)"
181 _fromPVAllTPPt2Legend =
"Tracks (pT > 0.9 GeV) from reco PV (another method), fake rate numerator contains all TrackingParticles (separates fake tracks from pileup tracks)"
185 "btvLike":
"BTV-like selected tracks",
186 "ak4PFJets":
"Tracks from AK4 PF jets (jet corrected pT > 10 GeV)",
187 "allTPEffic": _allTPEfficLegend,
188 "allTPEffic_": _allTPEfficLegend,
189 "allTPEffic_highPurity":
_allToHP(_allTPEfficLegend),
190 "fromPV": _fromPVLegend,
191 "fromPV_": _fromPVLegend,
192 "fromPV_highPurity":
_toHP(_fromPVLegend),
193 "fromPV_Pt09": _fromPVPtLegend,
194 "fromPV_highPurity_Pt09":
_toHP(_fromPVPtLegend),
195 "fromPVAllTP": _fromPVAllTPLegend,
196 "fromPVAllTP_": _fromPVAllTPLegend,
197 "fromPVAllTP_highPurity":
_toHP(_fromPVAllTPLegend),
198 "fromPVAllTP_Pt09": _fromPVAllTPPtLegend,
199 "fromPVAllTP_highPurityPt09":
_toHP(_fromPVAllTPPtLegend),
200 "fromPVAllTP2_": _fromPVAllTP2Legend,
201 "fromPVAllTP2_highPurity":
_toHP(_fromPVAllTP2Legend),
202 "fromPVAllTP2_Pt09": _fromPVAllTPPt2Legend,
203 "fromPVAllTP2_highPurityPt09":
_toHP(_fromPVAllTPPt2Legend),
208 def __init__(self, columnHeaders, rowHeaders, table, purpose, page, section):
209 if len(columnHeaders) != len(table):
210 raise Exception(
"Got %d columnHeaders for table with %d columns for page %s, section %s" % (len(columnHeaders), len(table), page, section))
211 lenRow = len(table[0])
212 for icol, column
in enumerate(table):
213 if len(column) != lenRow:
214 raise Exception(
"Got non-square table, first column has %d rows, column %d has %d rows" % (lenRow, icol, len(column)))
215 if len(rowHeaders) != lenRow:
216 raise Exception(
"Got %d rowHeaders for table with %d rows" % (len(rowHeaders), lenRow))
239 return len(self.
_table[0])
265 ' <title>%s</title>' % title,
286 for plotSet
in self._plotSets.itervalues():
304 self._content.extend([
310 f = open(fileName,
"w")
319 if section
in legends:
324 leg =
"<sup>%d</sup>" % legnum
325 leg2 =
"<sup>%d)</sup>" % legnum
326 self._legends.append(
"%s %s" % (leg2, legends[section]))
331 self._content.extend([
338 sections = self.
_orderSets(self._plotSets.keys())
339 for isec, section
in enumerate(sections):
342 self._content.extend([
345 files = [(os.path.basename(f), f)
for f
in self.
_plotSets[section]]
346 for row
in fileTable:
348 for i, (bsf, f)
in enumerate(files):
357 fileTable.append( [bsf] + [
None]*isec + [f] )
359 self._content.extend([
363 for row
in fileTable:
364 self._content.append(
' <tr>')
368 self._content.append(
' <td><a href="%s">%s</a></td>' % (elem, bs))
370 self._content.append(
' <td></td>')
371 self._content.append(
' </tr>')
374 self._content.extend([
384 self._columnHeaders.append(
"%s: %s" % (leg, header))
395 sections = self.
_orderSets(self._tables.keys())
396 for isec, section
in enumerate(sections):
400 self._content.extend([
403 ' <table border="1">'
407 data = table.tableAsRowColumn()
409 self._content.extend([
413 heads = table.columnHeaders()
414 if max(map(
lambda h: len(h), heads)) > 20:
417 self._content.append(
' <td>%s</td>' % head)
418 self._content.append(
' </tr>')
420 for irow, row
in enumerate(data):
425 self._content.extend([
427 ' <td>%s</td>' % table.rowHeaders()[irow]
430 for icol, item
in enumerate(row):
431 formatted = str(item)
if item
is not None else ""
432 self._content.append(
' <td align="right">%s</td>' % formatted)
433 self._content.append(
' </tr>')
435 self._content.append(
' </table>')
438 self._content.append(
' %s<br/>' % shortenedColumnHeader)
444 self._content.extend([
449 self._content.append(
' %s<br/>' % leg)
453 return _sectionNameMapOrder.get(section, section)
457 for section
in _sectionNameMapOrder.keys():
465 def __init__(self, title, sampleName, sample, fastVsFull, pileupComparison):
476 self.
_prefix += _sampleFileName.get(sample.label(), sample.label())+
"_"
477 if hasattr(sample,
"hasScenario")
and sample.hasScenario():
478 self.
_prefix += sample.scenario()+
"_"
480 if hasattr(sample,
"hasPileup"):
481 if sample.hasPileup():
482 self.
_prefix +=
"pu"+str(sample.pileupNumber())+
"_"+sample.pileupType()+
"_"
490 if key
not in self.
_pages:
497 def addPlotSet(self, plotterFolder, dqmSubFolder, plotFiles):
498 pageKey = plotterFolder.getPage()
500 if dqmSubFolder
is not None:
501 pageKey = dqmSubFolder.translated
503 pageKey = plotterFolder.getName()
506 sectionName = plotterFolder.getSection()
507 if sectionName
is None:
508 if plotterFolder.getPage()
is not None and dqmSubFolder
is not None:
509 sectionName = dqmSubFolder.translated
513 page.addPlotSet(sectionName, plotFiles)
519 page = self.
_getPage(table.getPage(), Page)
520 page.addTable(table.getSection(), table)
532 fileName =
"%s%s.html" % (self.
_prefix, key)
533 page.write(os.path.join(baseDir, fileName))
538 return _pageNameMap.get(name, name)
547 super(TrackingIterPage, self).
__init__(*args, **kwargs)
550 return _trackQualityNameOrder.get(quality, quality)
554 for qual
in _trackQualityNameOrder.keys():
555 if qual
in qualities:
557 qualities.remove(qual)
558 ret.extend(qualities)
563 super(TrackingPageSet, self).
__init__(*args, **kwargs)
565 def addPlotSet(self, plotterFolder, dqmSubFolder, plotFiles):
566 (algo, quality) = dqmSubFolder.translated
569 sectionName = quality
575 if algo !=
"ootb" and not plotterFolder._plotFolder.isAlgoIterative(algo):
579 folderName = plotterFolder.getName()
581 sectionName = folderName+
"_"+sectionName
583 page = self.
_getPage(pageName, TrackingIterPage)
584 page.addPlotSet(sectionName, plotFiles)
587 return _trackAlgoName.get(algo, algo)
591 for algo
in _trackAlgoOrder:
601 def __init__(self, sample, title, fastVsFull, pileupComparison):
611 if hasattr(sample,
"hasPileup"):
612 pileup =
"with no pileup"
613 if sample.hasPileup():
614 pileup =
"with %d pileup (%s)" % (sample.pileupNumber(), sample.pileupType())
615 if pileupComparison
is not None:
616 pileup +=
" "+pileupComparison
617 if hasattr(sample,
"customPileupLabel"):
618 pileup = sample.customPileupLabel()
621 if hasattr(sample,
"hasScenario")
and sample.hasScenario():
622 scenario =
" (\"%s\")" % sample.scenario()
623 self.
_sampleName +=
"%s sample%s %s" % (_sampleName.get(sample.name(), sample.name()), scenario, pileup)
625 params = [title, self.
_sampleName, sample, fastVsFull, pileupComparison
is not None]
641 def addPlots(self, plotterFolder, dqmSubFolder, plotFiles):
642 page = self._purposePageMap.get(plotterFolder.getPurpose(), self.
_otherPages)
643 page.addPlotSet(plotterFolder, dqmSubFolder, plotFiles)
649 page = self._purposePageMap.get(table.getPurpose(), self.
_otherPages)
661 labelFiles = pages.write(baseDir)
662 for label, fname
in labelFiles:
663 ret.append(
' <li><a href="%s">%s</a></li>' % (fname, label))
674 self.
_title =
"Tracking validation "+validationName
680 ' <title>%s</title>' % self.
_title,
688 self._index.append(
' <p>%s</p>'%note)
690 def beginSample(self, sample, fastVsFull=False, pileupComparison=None):
693 rightAfterRefSample = fastVsFull
or (pileupComparison
is not None)
695 key = (sample.digest(), rightAfterRefSample)
703 self._currentSection.addPlots(*args, **kwargs)
706 self._currentSection.addTable(*args, **kwargs)
710 keys = self._sections.iterkeys()
717 ind_fast = newkeys.index( (key[0],
False) )
718 newkeys.insert(ind_fast+1, key)
722 self._index.extend(section.write(self.
_newBaseDir))
729 f = open(os.path.join(self.
_newBaseDir,
"index.html"),
"w")
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)