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 "RelValSingleMuPt1":
"Single Muon Pt 1",
20 "RelValSingleMuPt10":
"Single Muon Pt 10",
21 "RelValSingleMuPt10Extended":
"Single Muon Pt 10 (extended eta)",
22 "RelValSingleMuPt100":
"Single Muon Pt 100",
23 "RelValTenMuE_0_200":
"Ten muon Pt 0-200",
27 "RelValMinBias":
"minbias",
28 "RelValTTbar":
"ttbar",
29 "RelValQCD_Pt_600_800":
"qcd600",
30 "RelValQCD_Pt_3000_3500":
"qcd3000",
31 "RelValQCD_FlatPt_15_3000":
"qcdflat",
33 "RelValWjet_Pt_3000_3500":
"wjet3000",
34 "RelValH125GGgluonfusion":
"hgg",
35 "RelValSingleElectronPt35":
"ele35",
36 "RelValSingleElectronPt35Extended":
"ele35ext",
37 "RelValSingleElectronPt10":
"ele10",
38 "RelValSingleMuPt1":
"mu1",
39 "RelValSingleMuPt10":
"mu10",
40 "RelValSingleMuPt10Extended":
"mu10ext",
41 "RelValSingleMuPt100":
"mu100",
42 "RelValTenMuE_0_200":
"tenmu200",
45 _allName =
"All tracks" 46 _allTPEfficName = _allName+
" (all TPs)" 47 _fromPVName =
"Tracks from PV" 48 _fromPVAllTPName =
"Tracks from PV (all TPs)" 49 _tpPtLess09Name =
"All tracks (TP pT < 0.9 GeV)" 50 _tpEtaGreater2p7Name =
"All tracks (TP |eta| > 2.7)" 51 _conversionName =
"Tracks for conversions" 52 _gsfName =
"Electron GSF tracks" 53 _bhadronName =
"All tracks (B-hadron TPs)" 54 _displacedName =
"All tracks (TPs with no tip or lip cuts)" 58 return s.replace(
"tracks",
"tracks by originalAlgo")
60 return s.replace(
"tracks",
"tracks by algoMask")
62 return s.replace(
"All",
"High purity")
64 return s.replace(
"All",
"BTV-like")
66 return s.replace(
"All tracks",
"Tracks pT > 0.9 GeV")
68 return s.replace(
"Tracks",
"Tracks pT > 0.9 GeV").
replace(
"tracks",
"tracks pT > 0.9 GeV")
70 return s.replace(
"All",
"Pixel")
72 return s.replace(
"Tracks",
"Pixel tracks")
73 _trackQualityNameOrder = collections.OrderedDict([
74 (
"seeding_seeds",
"Seeds"),
75 (
"seeding_seedsa",
"Seeds A"),
76 (
"seeding_seedsb",
"Seeds B"),
77 (
"seeding_seedsc",
"Seeds C"),
78 (
"seeding_seedstripl",
"Seeds triplets"),
79 (
"seeding_seedspair",
"Seeds pairs"),
80 (
"building_",
"Built tracks"),
89 (
"tpPtLess09_", _tpPtLess09Name),
90 (
"tpPtLess09_highPurity",
_allToHP(_tpPtLess09Name)),
91 (
"tpPtLess09_ByOriginalAlgo",
_toOriAlgo(_tpPtLess09Name)),
93 (
"tpPtLess09_ByAlgoMask",
_toAlgoMask(_tpPtLess09Name)),
95 (
"tpEtaGreater2p7_", _tpEtaGreater2p7Name),
96 (
"tpEtaGreater2p7_highPurity",
_allToHP(_tpEtaGreater2p7Name)),
98 (
"ak4PFJets",
"AK4 PF jets"),
99 (
"allTPEffic_", _allTPEfficName),
100 (
"allTPEffic_highPurity",
_allToHP(_allTPEfficName)),
101 (
"fromPV_", _fromPVName),
102 (
"fromPV_highPurity",
_toHP(_fromPVName)),
103 (
"fromPV_Pt09",
_ptCut(_fromPVName)),
104 (
"fromPV_highPurityPt09",
_toHP(
_ptCut(_fromPVName))),
105 (
"fromPVAllTP_", _fromPVAllTPName),
106 (
"fromPVAllTP_highPurity",
_toHP(_fromPVAllTPName)),
107 (
"fromPVAllTP_Pt09",
_ptCut(_fromPVAllTPName)),
108 (
"fromPVAllTP_highPurityPt09",
_toHP(
_ptCut(_fromPVAllTPName))),
109 (
"fromPVAllTP2_", _fromPVAllTPName.replace(
"PV",
"PV v2")),
110 (
"fromPVAllTP2_highPurity",
"High purity "+
_lowerFirst(_fromPVAllTPName).
replace(
"PV",
"PV v2")),
111 (
"fromPVAllTP2_Pt09", _fromPVAllTPName.replace(
"Tracks",
"Tracks pT > 0.9 GeV").
replace(
"PV",
"PV v2")),
112 (
"fromPVAllTP2_highPurityPt09",
_toHP(
_ptCut(_fromPVAllTPName)).
replace(
"PV",
"PV v2")),
113 (
"conversion_", _conversionName),
115 (
"bhadron_", _bhadronName),
116 (
"bhadron_highPurity",
_allToHP(_bhadronName)),
117 (
"bhadron_ByOriginalAlgo",
_toOriAlgo(_bhadronName)),
121 (
"bhadron_btvLike",
_allToBTV(_bhadronName)),
122 (
"displaced_", _displacedName),
123 (
"displaced_highPurity",
_allToHP(_displacedName)),
124 (
"displaced_ByOriginalAlgo",
_toOriAlgo(_displacedName)),
126 (
"displaced_ByAlgoMask",
_toAlgoMask(_displacedName)),
131 (
"pixelFromPV_",
_toPixel(_fromPVName)),
133 (
"pixelFromPVAllTP_",
_toPixel(_fromPVAllTPName)),
140 "ootb":
"Out of the box",
141 "iter0" :
"Iterative Step 0",
142 "iter1" :
"Iterative Step 1",
143 "iter2" :
"Iterative Step 2",
144 "iter3" :
"Iterative Step 3",
145 "iter4" :
"Iterative Step 4",
146 "iter5" :
"Iterative Step 5",
147 "iter6" :
"Iterative Step 6",
148 "iter7" :
"Iterative Step 7",
149 "iter9" :
"Iterative Step 9",
150 "iter10":
"Iterative Step 10",
151 "pixel":
"Pixel tracks",
156 'initialStepPreSplitting',
160 'detachedTripletStep',
167 'displacedGeneralStep',
168 'jetCoreRegionalStep',
169 'muonSeededStepInOut',
170 'muonSeededStepOutIn',
171 'displacedRegionalStep',
175 'ckfInOutFromConversions',
176 'ckfOutInFromConversions',
192 "summary":
"Summary",
195 "miniaod":
"MiniAOD",
198 "pixel":
"Pixel tracks",
202 _sectionNameMapOrder = collections.OrderedDict([
204 (
"seeding_seeds",
"Seeds"),
205 (
"building",
"Built tracks"),
210 (
"tpPtLess09", _tpPtLess09Name),
211 (
"tpPtLess09_highPurity",
_allToHP(_tpPtLess09Name)),
212 (
"tpEtaGreater2p7", _tpEtaGreater2p7Name),
213 (
"tpEtaGreater2p7_highPurity",
_allToHP(_tpEtaGreater2p7Name)),
214 (
"btvLike",
"BTV-like"),
215 (
"ak4PFJets",
"AK4 PF jets"),
216 (
"allTPEffic", _allTPEfficName),
217 (
"allTPEffic_highPurity",
_allToHP(_allTPEfficName)),
218 (
"fromPV", _fromPVName),
219 (
"fromPV_highPurity",
"High purity "+
_lowerFirst(_fromPVName)),
220 (
"fromPVAllTP", _fromPVAllTPName),
221 (
"fromPVAllTP_highPurity",
"High purity "+
_lowerFirst(_fromPVAllTPName)),
222 (
"conversion", _conversionName),
224 (
"bhadron", _bhadronName),
225 (
"bhadron_highPurity",
_allToHP(_bhadronName)),
226 (
"displaced", _displacedName),
227 (
"displaced_highPurity",
_allToHP(_displacedName)),
231 (
"pixelFromPV",
_toPixel(_fromPVName)),
233 (
"pixelFromPVAllTP",
_toPixel(_fromPVAllTPName)),
238 (
"genvertex",
"Gen vertices"),
239 (
"pixelVertices",
"Pixel vertices"),
240 (
"selectedPixelVertices",
"Selected pixel vertices"),
241 (
"firstStepPrimaryVerticesPreSplitting",
"firstStepPrimaryVerticesPreSplitting"),
242 (
"firstStepPrimaryVertices",
"firstStepPrimaryVertices"),
243 (
"offlinePrimaryVertices",
"All vertices (offlinePrimaryVertices)"),
244 (
"selectedOfflinePrimaryVertices",
"Selected vertices (selectedOfflinePrimaryVertices)"),
245 (
"offlinePrimaryVerticesWithBS",
"All vertices with BS constraint"),
246 (
"selectedOfflinePrimaryVerticesWithBS",
"Selected vertices with BS constraint"),
249 (
"lambda",
"Lambda"),
251 _btvLegend =
"BTV-like selected tracks" 252 _allTPEfficLegend =
"All tracks, efficiency denominator contains all TrackingParticles" 253 _fromPVLegend =
"Tracks from reco PV vs. TrackingParticles from gen PV (fake rate includes pileup tracks)" 254 _fromPVPtLegend =
"Tracks (pT > 0.9 GeV) from reco PV vs. TrackingParticles from gen PV (fake rate includes pileup tracks)" 255 _fromPVAllTPLegend =
"Tracks from reco PV, fake rate numerator contains all TrackingParticles (separates fake tracks from pileup tracks)" 256 _fromPVAllTPPtLegend =
"Tracks (pT > 0.9 GeV) from reco PV, fake rate numerator contains all TrackingParticles (separates fake tracks from pileup tracks)" 257 _fromPVAllTP2Legend =
"Tracks from reco PV (another method), fake rate numerator contains all TrackingParticles (separates fake tracks from pileup tracks)" 258 _fromPVAllTPPt2Legend =
"Tracks (pT > 0.9 GeV) from reco PV (another method), fake rate numerator contains all TrackingParticles (separates fake tracks from pileup tracks)" 259 _bhadronLegend =
"All tracks, efficiency denominator contains only TrackingParticles from B-hadron decays" 260 _bhadronPtLegend =
"Tracks (pT > 0.9 GeV), efficiency denominator contains only TrackingParticles from B-hadron decays" 264 "btvLike": _btvLegend,
265 "ak4PFJets":
"Tracks from AK4 PF jets (jet corrected pT > 10 GeV)",
266 "allTPEffic": _allTPEfficLegend,
267 "allTPEffic_": _allTPEfficLegend,
268 "allTPEffic_highPurity":
_allToHP(_allTPEfficLegend),
269 "fromPV": _fromPVLegend,
270 "fromPV_": _fromPVLegend,
271 "fromPV_highPurity":
_toHP(_fromPVLegend),
272 "fromPV_Pt09": _fromPVPtLegend,
273 "fromPV_highPurity_Pt09":
_toHP(_fromPVPtLegend),
274 "fromPVAllTP": _fromPVAllTPLegend,
275 "fromPVAllTP_": _fromPVAllTPLegend,
276 "fromPVAllTP_highPurity":
_toHP(_fromPVAllTPLegend),
277 "fromPVAllTP_Pt09": _fromPVAllTPPtLegend,
278 "fromPVAllTP_highPurityPt09":
_toHP(_fromPVAllTPPtLegend),
279 "fromPVAllTP2_": _fromPVAllTP2Legend,
280 "fromPVAllTP2_highPurity":
_toHP(_fromPVAllTP2Legend),
281 "fromPVAllTP2_Pt09": _fromPVAllTPPt2Legend,
282 "fromPVAllTP2_highPurityPt09":
_toHP(_fromPVAllTPPt2Legend),
283 "bhadron_": _bhadronLegend,
284 "bhadron_highPurity":
_allToHP(_bhadronLegend),
285 "bhadron_btvLike": _bhadronLegend.replace(
"All tracks", _btvLegend),
286 "pixelFromPV_": _fromPVLegend,
287 "pixelFromPV_Pt09": _fromPVPtLegend,
288 "pixelFromPVAllTP_": _fromPVAllTPLegend,
289 "pixelFromPVAllTP_Pt09": _fromPVAllTPPtLegend,
290 "pixelbhadron_": _bhadronLegend,
291 "pixelbhadron_Pt09": _bhadronPtLegend,
296 def __init__(self, columnHeaders, rowHeaders, table, purpose, page, section):
297 if len(columnHeaders) != len(table):
298 raise Exception(
"Got %d columnHeaders for table with %d columns for page %s, section %s" % (len(columnHeaders), len(table), page, section))
299 lenRow = len(table[0])
300 for icol, column
in enumerate(table):
301 if len(column) != lenRow:
302 raise Exception(
"Got non-square table, first column has %d rows, column %d has %d rows" % (lenRow, icol, len(column)))
303 if len(rowHeaders) != lenRow:
304 raise Exception(
"Got %d rowHeaders for table with %d rows" % (len(rowHeaders), lenRow))
327 return len(self.
_table[0])
356 ' <title>%s</title>' % title,
401 f = open(fileName,
"w")
410 if section
in legends:
415 leg =
"<sup>%d</sup>" % legnum
416 leg2 =
"<sup>%d)</sup>" % legnum
430 for isec, section
in enumerate(sections):
436 files = [(os.path.basename(f), f)
for f
in self.
_plotSets[section]]
437 for row
in fileTable:
439 for i, (bsf, f)
in enumerate(files):
448 fileTable.append( [bsf] + [
None]*isec + [f] )
454 for row
in fileTable:
459 self.
_content.
append(
' <td><a href="%s">%s</a></td>' % (elem, bs))
470 first_row = fileTable[0]
472 ' <a href="%s">Browse Folder</a>' % (first_row[1][0:first_row[1].rfind(
'/')])
493 for isec, section
in enumerate(sections):
500 ' <table border="1">' 504 data = table.tableAsRowColumn()
510 heads = table.columnHeaders()
511 if max(
map(
lambda h: len(h), heads)) > 20:
517 for irow, row
in enumerate(data):
524 ' <td>%s</td>' % table.rowHeaders()[irow]
527 for icol, item
in enumerate(row):
528 formatted =
str(item)
if item
is not None else "" 550 return _sectionNameMapOrder.get(section, section)
553 keys_sorted = sorted(keys)
555 for section
in _sectionNameMapOrder.keys():
556 if section
in keys_sorted:
558 keys_sorted.remove(section)
559 ret.extend(keys_sorted)
563 def __init__(self, title, sampleName, sample, fastVsFull, pileupComparison, dqmSubFolderTranslatedToSectionName=None):
575 self.
_prefix += _sampleFileName.get(sample.label(), sample.label())+
"_" 576 if hasattr(sample,
"hasScenario")
and sample.hasScenario():
577 self.
_prefix += sample.scenario()+
"_" 579 if hasattr(sample,
"hasPileup"):
580 if sample.hasPileup():
581 self.
_prefix +=
"pu"+
str(sample.pileupNumber())+
"_"+sample.pileupType()+
"_" 589 if key
not in self.
_pages:
596 def addPlotSet(self, plotterFolder, dqmSubFolder, plotFiles):
597 pageKey = plotterFolder.getPage()
599 if dqmSubFolder
is not None:
600 pageKey = dqmSubFolder.translated
602 pageKey = plotterFolder.getName()
605 sectionName = plotterFolder.getSection()
606 if sectionName
is None:
607 if plotterFolder.getPage()
is not None and dqmSubFolder
is not None:
611 sectionName = dqmSubFolder.translated
615 page.addPlotSet(sectionName, plotFiles)
621 page = self.
_getPage(table.getPage(), Page)
622 page.addTable(table.getSection(), table)
634 fileName =
"%s%s.html" % (self.
_prefix, key)
635 page.write(os.path.join(baseDir, fileName))
640 return _pageNameMap.get(name, name)
649 super(TrackingIterPage, self).
__init__(*args, **kwargs)
652 return _trackQualityNameOrder.get(quality, quality)
656 for qual
in _trackQualityNameOrder.keys():
657 if qual
in qualities:
659 qualities.remove(qual)
660 ret.extend(qualities)
665 super(TrackingPageSet, self).
__init__(*args, **kwargs)
667 def addPlotSet(self, plotterFolder, dqmSubFolder, plotFiles):
668 (algo, quality) = dqmSubFolder.translated
671 sectionName = quality
677 if algo !=
"ootb" and not plotterFolder._plotFolder.isAlgoIterative(algo):
681 folderName = plotterFolder.getName()
683 sectionName = folderName+
"_"+sectionName
685 page = self.
_getPage(pageName, TrackingIterPage)
686 page.addPlotSet(sectionName, plotFiles)
689 return _trackAlgoName.get(algo, algo)
693 for algo
in _trackAlgoOrder:
703 def __init__(self, sample, title, fastVsFull, pileupComparison):
713 if hasattr(sample,
"hasPileup"):
714 pileup =
"with no pileup" 715 if sample.hasPileup():
716 pileup =
"with %d pileup (%s)" % (sample.pileupNumber(), sample.pileupType())
717 if pileupComparison
is not None:
718 pileup +=
" "+pileupComparison
719 if hasattr(sample,
"customPileupLabel"):
720 pileup = sample.customPileupLabel()
723 if hasattr(sample,
"hasScenario")
and sample.hasScenario():
724 scenario =
" (\"%s\")" % sample.scenario()
725 self.
_sampleName +=
"%s sample%s %s" % (_sampleName.get(sample.name(), sample.name()), scenario, pileup)
727 params = [title, self.
_sampleName, sample, fastVsFull, pileupComparison
is not None]
734 self.
_hltPages =
PageSet(*params, dqmSubFolderTranslatedToSectionName=
lambda algoQuality: algoQuality[0])
749 def addPlots(self, plotterFolder, dqmSubFolder, plotFiles):
751 page.addPlotSet(plotterFolder, dqmSubFolder, plotFiles)
769 labelFiles = pages.write(baseDir)
770 for label, fname
in labelFiles:
771 ret.append(
' <li><a href="%s">%s</a></li>' % (fname, label))
782 self.
_title =
"Tracking validation "+validationName
788 ' <title>%s</title>' % self.
_title,
798 def beginSample(self, sample, fastVsFull=False, pileupComparison=None):
801 rightAfterRefSample = fastVsFull
or (pileupComparison
is not None)
803 key = (sample.digest(), rightAfterRefSample)
825 ind_fast = newkeys.index( (key[0],
False) )
826 newkeys.insert(ind_fast+1, key)
837 f = open(os.path.join(self.
_newBaseDir,
"index.html"),
"w")
def _appendColumnHeader(self, header)
def write(self, fileName)
_dqmSubFolderTranslatedToSectionName
def __init__(self, columnHeaders, rowHeaders, table, purpose, page, section)
def addTable(self, args, kwargs)
def addTable(self, args, kwargs)
def addPlots(self, args, kwargs)
def __init__(self, args, kwargs)
ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE constexpr float zip(ConstView const &tracks, int32_t i)
def _mapPagesName(self, name)
def __init__(self, sample, title, fastVsFull, pileupComparison)
def replace(string, replacements)
def __init__(self, title, sampleName)
def _mapPagesName(self, algo)
def _orderSets(self, qualities)
def _orderSets(self, keys)
def __init__(self, title, sampleName, sample, fastVsFull, pileupComparison, dqmSubFolderTranslatedToSectionName=None)
def _mapSectionName(self, section)
def __init__(self, args, kwargs)
def addTable(self, table)
def addPlots(self, args, kwargs)
def _orderPages(self, algos)
def _appendLegend(self, section)
def addPlotSet(self, section, plotSet)
def addPlotSet(self, plotterFolder, dqmSubFolder, plotFiles)
def addTable(self, table)
def _getPage(self, key, pageClass)
def _mapSectionName(self, quality)
def addPlotSet(self, plotterFolder, dqmSubFolder, plotFiles)
def _formatPlotSets(self)
def tableAsRowColumn(self)
def beginSample(self, sample, fastVsFull=False, pileupComparison=None)
def beginSample(self, args, kwargs)
def __init__(self, validationName, newBaseDir)
def tableAsColumnRow(self)
def addPlots(self, plotterFolder, dqmSubFolder, plotFiles)
def _orderPages(self, keys)
def addTable(self, section, table)