CMS 3D CMS Logo

trackingPlots.py
Go to the documentation of this file.
1 from __future__ import absolute_import
2 from builtins import range
3 import os
4 import copy
5 import collections
6 
7 import six
8 import ROOT
9 ROOT.gROOT.SetBatch(True)
10 ROOT.PyConfig.IgnoreCommandLineOptions = True
11 
12 from .plotting import Subtract, FakeDuplicate, CutEfficiency, Transform, AggregateBins, ROC, Plot, PlotEmpty, PlotGroup, PlotOnSideGroup, PlotFolder, Plotter
13 from .html import PlotPurpose
14 from . import plotting
15 from . import validation
16 from . import html
17 
18 
23 
24 _maxEff = [0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 0.8, 1.025, 1.2, 1.5, 2]
25 _maxFake = [0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 0.8, 1.025]
26 
27 #_minMaxResol = [1e-5, 2e-5, 5e-5, 1e-4, 2e-4, 5e-4, 1e-3, 2e-3, 5e-3, 1e-2, 2e-2, 5e-2, 0.1, 0.2, 0.5, 1]
28 _minMaxResol = [1e-5, 4e-5, 1e-4, 4e-4, 1e-3, 4e-3, 1e-2, 4e-2, 0.1, 0.4, 1]
29 _minMaxN = [5e-1, 5, 5e1, 5e2, 5e3, 5e4, 5e5, 5e6, 5e7, 5e8, 5e9]
30 
31 _minHits = [0, 5, 10]
32 _maxHits = [5, 10, 20, 40, 60, 80]
33 _minLayers = [0, 5, 10]
34 _maxLayers = [5, 10, 25]
35 _maxPixelLayers = 8
36 _min3DLayers = [0, 5, 10]
37 _max3DLayers = [5, 10, 20]
38 _minZ = [-60, -40, -20, -10, -5]
39 _maxZ = [5, 10, 20, 40, 60]
40 _minPU = [0, 10, 20, 50, 100, 150]
41 _maxPU = [20, 50, 65, 80, 100, 150, 200, 250]
42 _minMaxTracks = [0, 200, 500, 1000, 1500, 2000]
43 _minMaxMVA = [-1.025, -0.5, 0, 0.5, 1.025]
44 
46  return ([-x for x in ma], ma)
47 
48 (_minResidualPhi, _maxResidualPhi) = _minMaxResidual([1e-4, 2e-4]) # rad
49 (_minResidualCotTheta, _maxResidualCotTheta) = _minMaxResidual([1e-4, 2e-4])
50 (_minResidualDxy, _maxResidualDxy) = _minMaxResidual([10, 20, 50, 100]) # um
51 (_minResidualDz, _maxResidualDz) = (_minResidualDxy, _maxResidualDxy)
52 (_minResidualPt, _maxResidualPt) = _minMaxResidual([1, 1.5, 2, 5]) # %
53 
54 
55 _legendDy_1row = 0.46
56 _legendDy_2rows = -0.025
57 _legendDy_2rows_3cols = -0.17
58 _legendDy_4rows = 0.09
59 
60 # Ok, because of the way the "reference release" histograms are
61 # stored, this histogram is not accessible for the summary plots. To
62 # be fixed later with (large) reorganization of how things work.
63 #_trackingNumberOfEventsHistogram = "DQMData/Run 1/Tracking/Run summary/Track/general_trackingParticleRecoAsssociation/tracks"
64 
65 _trackingIterationOrderHistogram = "DQMData/Run 1/Tracking/Run summary/TrackBuilding/num_reco_coll"
66 
67 def _makeEffFakeDupPlots(postfix, quantity, unit="", common={}, effopts={}, fakeopts={}):
68  p = postfix
69  q = quantity
70  xq = q
71  if unit != "":
72  xq += " (" + unit + ")"
73 
74  effargs = dict(xtitle="TP "+xq , ytitle="efficiency vs "+q , ymax=_maxEff)
75  fakeargs = dict(xtitle="track "+xq, ytitle="fake+duplicates rate vs "+q, ymax=_maxFake)
76  effargs.update(common)
77  fakeargs.update(common)
78  effargs.update(effopts)
79  fakeargs.update(fakeopts)
80 
81  return [
82  Plot("effic_vs_"+p, **effargs),
83  Plot(FakeDuplicate("fakeduprate_vs_"+p, assoc="num_assoc(recoToSim)_"+p, dup="num_duplicate_"+p, reco="num_reco_"+p, title="fake+duplicates vs "+q), **fakeargs)
84  ]
85 
86 def _makeFakeDupPileupPlots(postfix, quantity, unit="", xquantity="", xtitle=None, common={}):
87  p = postfix
88  q = quantity
89  if xtitle is None:
90  if xquantity != "":
91  xq = xquantity
92  else:
93  xq = q
94  if unit != "":
95  xq += " (" + unit + ")"
96  xtitle="track "+xq
97 
98  return [
99  Plot("fakerate_vs_"+p , xtitle=xtitle, ytitle="fakerate vs "+q , ymax=_maxFake, **common),
100  Plot("duplicatesRate_"+p, xtitle=xtitle, ytitle="duplicates rate vs "+q, ymax=_maxFake, **common),
101  Plot("pileuprate_"+p , xtitle=xtitle, ytitle="pileup rate vs "+q , ymax=_maxFake, **common),
102  ]
103 
104 def _makeFakeDist(postfix):
105  return Subtract("num_fake_"+postfix, "num_reco_"+postfix, "num_assoc(recoToSim)_"+postfix)
106 
107 def _makeDistPlots(postfix, quantity, common={}):
108  p = postfix
109  q = quantity
110 
111  args = dict(xtitle="track "+q, ylog=True, ymin=_minMaxN, ymax=_minMaxN)
112  args.update(common)
113 
114  return [
115  Plot("num_reco_"+p , ytitle="tracks", **args),
116  Plot("num_assoc(recoToSim)_"+p, ytitle="true tracks", **args),
117  Plot(_makeFakeDist(p), ytitle="fake tracks", **args),
118  Plot("num_duplicate_"+p , ytitle="duplicate tracks", **args),
119  ]
120 
121 def _makeDistSimPlots(postfix, quantity, common={}):
122  p = postfix
123  q = quantity
124 
125  args = dict(xtitle="TP "+q, ylog=True, ymin=_minMaxN, ymax=_minMaxN)
126  args.update(common)
127 
128  return [
129  Plot("num_simul_"+p , ytitle="TrackingParticles", **args),
130  Plot("num_assoc(simToReco)_"+p, ytitle="Reconstructed TPs", **args),
131  ]
132 
133 def _makeMVAPlots(num, hp=False):
134  pfix = "_hp" if hp else ""
135  pfix2 = "Hp" if hp else ""
136 
137  xtitle = "MVA%d output"%num
138  xtitlecut = "Cut on MVA%d output"%num
139  args = dict(xtitle=xtitle, ylog=True, ymin=_minMaxN, ymax=_minMaxN)
140 
141  argsroc = dict(
142  xtitle="Efficiency (excl. trk eff)", ytitle="Fake rate",
143  xmax=_maxEff, ymax=_maxFake,
144  drawStyle="EP",
145  )
146  argsroc2 = dict(
147  ztitle="Cut on MVA%d"%num,
148  xtitleoffset=5, ytitleoffset=6.5, ztitleoffset=4,
149  adjustMarginRight=0.12
150  )
151  argsroc2.update(argsroc)
152  argsroc2["drawStyle"] = "pcolz"
153 
154  argsprofile = dict(ymin=_minMaxMVA, ymax=_minMaxMVA)
155 
156  true_cuteff = CutEfficiency("trueeff_vs_mva%dcut%s"%(num,pfix), "num_assoc(recoToSim)_mva%dcut%s"%(num,pfix))
157  fake_cuteff = CutEfficiency("fakeeff_vs_mva%dcut%s"%(num,pfix), Subtract("num_fake_mva%dcut%s"%(num,pfix), "num_reco_mva%dcut%s"%(num,pfix), "num_assoc(recoToSim)_mva%dcut%s"%(num,pfix)))
158 
159  return [
160  PlotGroup("mva%d%s"%(num,pfix2), [
161  Plot("num_assoc(recoToSim)_mva%d%s"%(num,pfix), ytitle="true tracks", **args),
162  Plot(Subtract("num_fake_mva%d%s"%(num,pfix), "num_reco_mva%d%s"%(num,pfix), "num_assoc(recoToSim)_mva%d%s"%(num,pfix)), ytitle="fake tracks", **args),
163  Plot("effic_vs_mva%dcut%s"%(num,pfix), xtitle=xtitlecut, ytitle="Efficiency (excl. trk eff)", ymax=_maxEff),
164  #
165  Plot("fakerate_vs_mva%dcut%s"%(num,pfix), xtitle=xtitlecut, ytitle="Fake rate", ymax=_maxFake),
166  Plot(ROC("effic_vs_fake_mva%d%s"%(num,pfix), "effic_vs_mva%dcut%s"%(num,pfix), "fakerate_vs_mva%dcut%s"%(num,pfix)), **argsroc),
167  Plot(ROC("effic_vs_fake_mva%d%s"%(num,pfix), "effic_vs_mva%dcut%s"%(num,pfix), "fakerate_vs_mva%dcut%s"%(num,pfix), zaxis=True), **argsroc2),
168  # Same signal efficiency, background efficiency, and ROC definitions as in TMVA
169  Plot(true_cuteff, xtitle=xtitlecut, ytitle="True track selection efficiency", ymax=_maxEff),
170  Plot(fake_cuteff, xtitle=xtitlecut, ytitle="Fake track selection efficiency", ymax=_maxEff),
171  Plot(ROC("true_eff_vs_fake_rej_mva%d%s"%(num,pfix), true_cuteff, Transform("fake_rej_mva%d%s"%(num,pfix), fake_cuteff, lambda x: 1-x)), xtitle="True track selection efficiency", ytitle="Fake track rejection", xmax=_maxEff, ymax=_maxEff),
172  ], ncols=3, legendDy=_legendDy_1row),
173  PlotGroup("mva%d%sPtEta"%(num,pfix2), [
174  Plot("mva_assoc(recoToSim)_mva%d%s_pT"%(num,pfix), xtitle="Track p_{T} (GeV)", ytitle=xtitle+" for true tracks", xlog=True, **argsprofile),
175  Plot("mva_fake_mva%d%s_pT"%(num,pfix), xtitle="Track p_{T} (GeV)", ytitle=xtitle+" for fake tracks", xlog=True, **argsprofile),
176  Plot("mva_assoc(recoToSim)_mva%d%s_eta"%(num,pfix), xtitle="Track #eta", ytitle=xtitle+" for true tracks", **argsprofile),
177  Plot("mva_fake_mva%d%s_eta"%(num,pfix), xtitle="Track #eta", ytitle=xtitle+" for fake tracks", **argsprofile),
178  ], legendDy=_legendDy_2rows)
179  ]
180 
181 _effandfakePtEtaPhi = PlotGroup("effandfakePtEtaPhi", [
182  Plot("efficPt", title="Efficiency vs p_{T}", xtitle="TP p_{T} (GeV)", ytitle="efficiency vs p_{T}", xlog=True, ymax=_maxEff),
183  Plot(FakeDuplicate("fakeduprate_vs_pT", assoc="num_assoc(recoToSim)_pT", dup="num_duplicate_pT", reco="num_reco_pT", title="fake+duplicates vs p_{T}"),
184  xtitle="track p_{T} (GeV)", ytitle="fake+duplicates rate vs p_{T}", ymax=_maxFake, xlog=True),
185  Plot("effic", xtitle="TP #eta", ytitle="efficiency vs #eta", title="", ymax=_maxEff),
186  Plot(FakeDuplicate("fakeduprate_vs_eta", assoc="num_assoc(recoToSim)_eta", dup="num_duplicate_eta", reco="num_reco_eta", title=""),
187  xtitle="track #eta", ytitle="fake+duplicates rate vs #eta", ymax=_maxFake),
188 ] +
189  _makeEffFakeDupPlots("phi", "#phi")
190 )
191 
192 _effandfakeDxyDzBS = PlotGroup("effandfakeDxyDzBS",
193  _makeEffFakeDupPlots("dxy" , "dxy" , "cm") +
194  _makeEffFakeDupPlots("dz" , "dz" , "cm"),
195  legendDy=_legendDy_2rows
196 )
197 _effandfakeDxyDzPV = PlotGroup("effandfakeDxyDzPV",
198  _makeEffFakeDupPlots("dxypv" , "dxy(PV)", "cm") +
199  _makeEffFakeDupPlots("dxypv_zoomed", "dxy(PV)", "cm") +
200  _makeEffFakeDupPlots("dzpv" , "dz(PV)" , "cm") +
201  _makeEffFakeDupPlots("dzpv_zoomed" , "dz(PV)" , "cm"),
202  legendDy=_legendDy_4rows
203 )
204 _effandfakeHitsLayers = PlotGroup("effandfakeHitsLayers",
205  _makeEffFakeDupPlots("hit" , "hits" , common=dict(xmin=_minHits , xmax=_maxHits)) +
206  _makeEffFakeDupPlots("layer" , "layers" , common=dict(xmin=_minLayers , xmax=_maxLayers)) +
207  _makeEffFakeDupPlots("pixellayer", "pixel layers", common=dict( xmax=_maxPixelLayers)) +
208  _makeEffFakeDupPlots("3Dlayer" , "3D layers" , common=dict(xmin=_min3DLayers, xmax=_max3DLayers)),
209  legendDy=_legendDy_4rows
210 )
211 _common = {"ymin": 0, "ymax": _maxEff}
212 _effandfakePos = PlotGroup("effandfakePos",
213  _makeEffFakeDupPlots("vertpos", "vert r", "cm", fakeopts=dict(xtitle="track ref. point r (cm)", ytitle="fake+duplicates vs. r"), common=dict(xlog=True)) +
214  _makeEffFakeDupPlots("zpos" , "vert z", "cm", fakeopts=dict(xtitle="track ref. point z (cm)", ytitle="fake+duplicates vs. z")) +
215  _makeEffFakeDupPlots("simpvz" , "Sim. PV z", "cm", common=dict(xtitle="Sim. PV z (cm)", xmin=_minZ, xmax=_maxZ))
216 )
217 _effandfakeDeltaRPU = PlotGroup("effandfakeDeltaRPU",
218  _makeEffFakeDupPlots("dr" , "#DeltaR", effopts=dict(xtitle="TP min #DeltaR"), fakeopts=dict(xtitle="track min #DeltaR"), common=dict(xlog=True)) +
219  _makeEffFakeDupPlots("drj" , "#DeltaR(track, jet)", effopts=dict(xtitle="#DeltaR(TP, jet)", ytitle="efficiency vs #DeltaR(TP, jet"), fakeopts=dict(xtitle="#DeltaR(track, jet)"), common=dict(xlog=True))+
220  _makeEffFakeDupPlots("pu" , "PU" , common=dict(xtitle="Pileup", xmin=_minPU, xmax=_maxPU)),
221  legendDy=_legendDy_4rows
222 )
223 
224 
225 _algos_common = dict(removeEmptyBins=True, xbinlabelsize=10, xbinlabeloption="d")
226 _duplicateAlgo = PlotOnSideGroup("duplicateAlgo", Plot("duplicates_oriAlgo_vs_oriAlgo", drawStyle="COLZ", adjustMarginLeft=0.1, adjustMarginRight=0.1, **_algos_common))
227 
228 _dupandfakePtEtaPhi = PlotGroup("dupandfakePtEtaPhi", [
229  Plot("fakeratePt", xtitle="track p_{T} (GeV)", ytitle="fakerate vs p_{T}", xlog=True, ymax=_maxFake),
230  Plot("duplicatesRate_Pt", xtitle="track p_{T} (GeV)", ytitle="duplicates rate vs p_{T}", ymax=_maxFake, xlog=True),
231  Plot("pileuprate_Pt", xtitle="track p_{T} (GeV)", ytitle="pileup rate vs p_{T}", ymax=_maxFake, xlog=True),
232  Plot("fakerate", xtitle="track #eta", ytitle="fakerate vs #eta", title="", ymax=_maxFake),
233  Plot("duplicatesRate", xtitle="track #eta", ytitle="duplicates rate vs #eta", title="", ymax=_maxFake),
234  Plot("pileuprate", xtitle="track #eta", ytitle="pileup rate vs #eta", title="", ymax=_maxFake),
235 ] + _makeFakeDupPileupPlots("phi", "#phi"),
236  ncols=3
237 )
238 _dupandfakeDxyDzBS = PlotGroup("dupandfakeDxyDzBS",
239  _makeFakeDupPileupPlots("dxy" , "dxy" , "cm") +
240  _makeFakeDupPileupPlots("dz" , "dz" , "cm"),
241  ncols=3, legendDy=_legendDy_2rows_3cols
242 )
243 _dupandfakeDxyDzPV = PlotGroup("dupandfakeDxyDzPV",
244  _makeFakeDupPileupPlots("dxypv" , "dxy(PV)", "cm") +
245  _makeFakeDupPileupPlots("dxypv_zoomed", "dxy(PV)", "cm") +
246  _makeFakeDupPileupPlots("dzpv" , "dz(PV)" , "cm") +
247  _makeFakeDupPileupPlots("dzpv_zoomed" , "dz(PV)" , "cm"),
248  ncols=3, legendDy=_legendDy_4rows
249 )
250 _dupandfakeHitsLayers = PlotGroup("dupandfakeHitsLayers",
251  _makeFakeDupPileupPlots("hit" , "hits" , common=dict(xmin=_minHits , xmax=_maxHits)) +
252  _makeFakeDupPileupPlots("layer" , "layers" , common=dict(xmin=_minLayers , xmax=_maxLayers)) +
253  _makeFakeDupPileupPlots("pixellayer", "pixel layers", common=dict( xmax=_maxPixelLayers)) +
254  _makeFakeDupPileupPlots("3Dlayer" , "3D layers" , common=dict(xmin=_min3DLayers, xmax=_max3DLayers)),
255  ncols=3, legendDy=_legendDy_4rows
256 )
257 _dupandfakePos = PlotGroup("dupandfakePos",
258  _makeFakeDupPileupPlots("vertpos", "r", "cm", xquantity="ref. point r (cm)", common=dict(xlog=True)) +
259  _makeFakeDupPileupPlots("zpos" , "z", "cm", xquantity="ref. point z (cm)") +
260  _makeFakeDupPileupPlots("simpvz" , "Sim. PV z", xtitle="Sim. PV z (cm)", common=dict(xmin=_minZ, xmax=_maxZ)),
261  ncols=3,
262 )
263 _dupandfakeDeltaRPU = PlotGroup("dupandfakeDeltaRPU",
264  _makeFakeDupPileupPlots("dr" , "#DeltaR", xquantity="min #DeltaR", common=dict(xlog=True)) +
265  _makeFakeDupPileupPlots("drj" , "#DeltaR(track, jet)", xtitle="#DeltaR(track, jet)", common=dict(xlog=True)) +
266  _makeFakeDupPileupPlots("pu" , "PU" , xtitle="Pileup", common=dict(xmin=_minPU, xmax=_maxPU)),
267  ncols=3
268 )
269 _seedingLayerSet_common = dict(removeEmptyBins=True, xbinlabelsize=8, xbinlabeloption="d", adjustMarginRight=0.1)
270 _dupandfakeSeedingPlots = _makeFakeDupPileupPlots("seedingLayerSet", "seeding layers", xtitle="", common=_seedingLayerSet_common)
271 _dupandfakeChi2Seeding = PlotGroup("dupandfakeChi2Seeding",
272  _makeFakeDupPileupPlots("chi2", "#chi^{2}") +
273  _dupandfakeSeedingPlots,
274  ncols=3, legendDy=_legendDy_2rows_3cols
275 )
276 
277 _common = {
278  "ytitle": "Fake+pileup rate",
279  "ymax": _maxFake,
280  "drawStyle": "EP",
281 }
282 _common2 = {}
283 _common2.update(_common)
284 _common2["drawStyle"] = "pcolz"
285 _common2["ztitleoffset"] = 1.5
286 _common2["xtitleoffset"] = 7
287 _common2["ytitleoffset"] = 10
288 _common2["ztitleoffset"] = 6
289 _pvassociation1 = PlotGroup("pvassociation1", [
290  Plot(ROC("effic_vs_fakepileup_dzpvcut", "effic_vs_dzpvcut", FakeDuplicate("fakepileup_vs_dzpvcut", assoc="num_assoc(recoToSim)_dzpvcut", reco="num_reco_dzpvcut", dup="num_pileup_dzpvcut")),
291  xtitle="Efficiency vs. cut on dz(PV)", **_common),
292  Plot(ROC("effic_vs_fakepileup2_dzpvcut", "effic_vs_dzpvcut", FakeDuplicate("fakepileup_vs_dzpvcut", assoc="num_assoc(recoToSim)_dzpvcut", reco="num_reco_dzpvcut", dup="num_pileup_dzpvcut"), zaxis=True),
293  xtitle="Efficiency", ztitle="Cut on dz(PV)", **_common2),
294  #
295  Plot(ROC("effic_vs_fakepileup_dzpvsigcut", "effic_vs_dzpvsigcut", FakeDuplicate("fakepileup_vs_dzpvsigcut", assoc="num_assoc(recoToSim)_dzpvsigcut", reco="num_reco_dzpvsigcut", dup="num_pileup_dzpvsigcut")),
296  xtitle="Efficiency vs. cut on dz(PV)/dzError", **_common),
297  Plot(ROC("effic_vs_fakepileup2_dzpvsigcut", "effic_vs_dzpvsigcut", FakeDuplicate("fakepileup_vs_dzpvsigcut", assoc="num_assoc(recoToSim)_dzpvsigcut", reco="num_reco_dzpvsigcut", dup="num_pileup_dzpvsigcut"), zaxis=True),
298  xtitle="Efficiency", ztitle="Cut on dz(PV)/dzError", **_common2),
299 
300  Plot(ROC("effic_vs_fakepileup_dzpvcut_pt", "effic_vs_dzpvcut_pt", FakeDuplicate("fakepileup_vs_dzpvcut_pt", assoc="num_assoc(recoToSim)_dzpvcut_pt", reco="num_reco_dzpvcut_pt", dup="num_pileup_dzpvcut_pt")),
301  xtitle="Efficiency (p_{T} weighted) vs. cut on dz(PV)", **_common),
302  Plot(ROC("effic_vs_fakepileup2_dzpvcut_pt", "effic_vs_dzpvcut_pt", FakeDuplicate("fakepileup_vs_dzpvcut_pt", assoc="num_assoc(recoToSim)_dzpvcut_pt", reco="num_reco_dzpvcut_pt", dup="num_pileup_dzpvcut_pt"), zaxis=True),
303  xtitle="Efficiency (p_{T} weighted)", ztitle="Cut on dz(PV)", **_common2),
304  #
305  Plot(ROC("effic_vs_fakepileup_dzpvsigcut_pt", "effic_vs_dzpvsigcut_pt", FakeDuplicate("fakepileup_vs_dzpvsigcut_pt", assoc="num_assoc(recoToSim)_dzpvsigcut_pt", reco="num_reco_dzpvsigcut_pt", dup="num_pileup_dzpvsigcut_pt")),
306  xtitle="Efficiency (p_{T} weighted) vs. cut on dz(PV)/dzError", **_common),
307  Plot(ROC("effic_vs_fakepileup2_dzpvsigcut_pt", "effic_vs_dzpvsigcut_pt", FakeDuplicate("fakepileup_vs_dzpvsigcut_pt", assoc="num_assoc(recoToSim)_dzpvsigcut_pt", reco="num_reco_dzpvsigcut_pt", dup="num_pileup_dzpvsigcut_pt"), zaxis=True),
308  xtitle="Efficiency (p_{T} weighted)", ztitle="Cut on dz(PV)/dzError", **_common2),
309 ], onlyForPileup=True,
310  legendDy=_legendDy_4rows
311 )
312 _pvassociation2 = PlotGroup("pvassociation2", [
313  Plot("effic_vs_dzpvcut", xtitle="Cut on dz(PV) (cm)", ytitle="Efficiency vs. cut on dz(PV)", ymax=_maxEff),
314  Plot("effic_vs_dzpvcut2", xtitle="Cut on dz(PV) (cm)", ytitle="Efficiency (excl. trk eff)", ymax=_maxEff),
315  Plot("fakerate_vs_dzpvcut", xtitle="Cut on dz(PV) (cm)", ytitle="Fake rate vs. cut on dz(PV)", ymax=_maxFake),
316  Plot("pileuprate_dzpvcut", xtitle="Cut on dz(PV) (cm)", ytitle="Pileup rate vs. cut on dz(PV)", ymax=_maxFake),
317  #
318  Plot("effic_vs_dzpvsigcut", xtitle="Cut on dz(PV)/dzError", ytitle="Efficiency vs. cut on dz(PV)/dzError", ymax=_maxEff),
319  Plot("effic_vs_dzpvsigcut2", xtitle="Cut on dz(PV)/dzError", ytitle="Efficiency (excl. trk eff)", ymax=_maxEff),
320  Plot("fakerate_vs_dzpvsigcut", xtitle="Cut on dz(PV)/dzError", ytitle="Fake rate vs. cut on dz(PV)/dzError", ymax=_maxFake),
321  Plot("pileuprate_dzpvsigcut", xtitle="Cut on dz(PV)/dzError", ytitle="Pileup rate vs. cut on dz(PV)/dzError", ymax=_maxFake),
322 ], onlyForPileup=True,
323  legendDy=_legendDy_4rows
324 )
325 _pvassociation3 = PlotGroup("pvassociation3", [
326  Plot("effic_vs_dzpvcut_pt", xtitle="Cut on dz(PV) (cm)", ytitle="Efficiency (p_{T} weighted)", ymax=_maxEff),
327  Plot("effic_vs_dzpvcut2_pt", xtitle="Cut on dz(PV) (cm)", ytitle="Efficiency (p_{T} weighted, excl. trk eff)", ymax=_maxEff),
328  Plot("fakerate_vs_dzpvcut_pt", xtitle="Cut on dz(PV) (cm)", ytitle="Fake rate (p_{T} weighted)", ymax=_maxFake),
329  Plot("pileuprate_dzpvcut_pt", xtitle="Cut on dz(PV) (cm)", ytitle="Pileup rate (p_{T} weighted)", ymax=_maxFake),
330  #
331  Plot("effic_vs_dzpvsigcut_pt", xtitle="Cut on dz(PV)/dzError", ytitle="Efficiency (p_{T} weighted)", ymax=_maxEff),
332  Plot("effic_vs_dzpvsigcut2_pt", xtitle="Cut on dz(PV)/dzError", ytitle="Efficiency (p_{T} weighted, excl. trk eff)", ymax=_maxEff),
333  Plot("fakerate_vs_dzpvsigcut_pt", xtitle="Cut on dz(PV)/dzError", ytitle="Fake rate (p_{T} weighted)", ymax=_maxFake),
334  Plot("pileuprate_dzpvsigcut_pt", xtitle="Cut on dz(PV)/dzError", ytitle="Pileup rate (p_{T} weighted)", ymax=_maxFake),
335 ], onlyForPileup=True,
336  legendDy=_legendDy_4rows
337 )
338 
339 
340 # These don't exist in FastSim
341 _common = {"normalizeToUnitArea": True, "stat": True, "drawStyle": "hist"}
342 _dedx = PlotGroup("dedx", [
343  Plot("h_dedx_estim1", xtitle="dE/dx, harm2", **_common),
344  Plot("h_dedx_estim2", xtitle="dE/dx, trunc40", **_common),
345  Plot("h_dedx_nom1", xtitle="dE/dx number of measurements", title="", **_common),
346  Plot("h_dedx_sat1", xtitle="dE/dx number of measurements with saturation", title="", **_common),
347  ],
348  legendDy=_legendDy_2rows
349 )
350 
351 _chargemisid = PlotGroup("chargemisid", [
352  Plot("chargeMisIdRate", xtitle="#eta", ytitle="charge mis-id rate vs #eta", ymax=0.05),
353  Plot("chargeMisIdRate_Pt", xtitle="p_{T}", ytitle="charge mis-id rate vs p_{T}", xmax=300, ymax=0.1, xlog=True),
354  Plot("chargeMisIdRate_hit", xtitle="hits", ytitle="charge mis-id rate vs hits", title=""),
355  Plot("chargeMisIdRate_phi", xtitle="#phi", ytitle="charge mis-id rate vs #phi", title="", ymax=0.01),
356  Plot("chargeMisIdRate_dxy", xtitle="dxy", ytitle="charge mis-id rate vs dxy", ymax=0.1),
357  Plot("chargeMisIdRate_dz", xtitle="dz", ytitle="charge mis-id rate vs dz", ymax=0.1)
358 ])
359 _common = {"stat": True, "normalizeToUnitArea": True, "ylog": True, "ymin": 1e-6, "drawStyle": "hist"}
360 _hitsAndPt = PlotGroup("hitsAndPt", [
361  Plot("missing_inner_layers", xmin=_minLayers, xmax=_maxLayers, ymax=1, **_common),
362  Plot("missing_outer_layers", xmin=_minLayers, xmax=_maxLayers, ymax=1, **_common),
363  Plot("hits_eta", xtitle="track #eta", ytitle="<hits> vs #eta", ymin=_minHits, ymax=_maxHits, statyadjust=[0,0,-0.15],
364  fallback={"name": "nhits_vs_eta", "profileX": True}),
365  Plot("hits", stat=True, xtitle="track hits", xmin=_minHits, xmax=_maxHits, ylog=True, ymin=[5e-1, 5, 5e1, 5e2, 5e3], drawStyle="hist"),
366  Plot("num_simul_pT", xtitle="TP p_{T}", xlog=True, ymax=[1e-1, 2e-1, 5e-1, 1], **_common),
367  Plot("num_reco_pT", xtitle="track p_{T}", xlog=True, ymax=[1e-1, 2e-1, 5e-1, 1], **_common)
368 ])
369 _tuning = PlotGroup("tuning", [
370  Plot("chi2", stat=True, normalizeToUnitArea=True, ylog=True, ymin=1e-6, ymax=[0.1, 0.2, 0.5, 1.0001], drawStyle="hist", xtitle="#chi^{2}", ratioUncertainty=False),
371  Plot("chi2_prob", stat=True, normalizeToUnitArea=True, drawStyle="hist", xtitle="Prob(#chi^{2})"),
372  Plot("chi2mean", title="", xtitle="#eta", ytitle="< #chi^{2} / ndf >", ymin=[0, 0.5], ymax=[2, 2.5, 3, 5],
373  fallback={"name": "chi2_vs_eta", "profileX": True}),
374  Plot("ptres_vs_eta_Mean", scale=100, title="", xtitle="TP #eta (PCA to beamline)", ytitle="< #delta p_{T} / p_{T} > (%)", ymin=_minResidualPt, ymax=_maxResidualPt),
375  Plot("chi2mean_vs_pt", title="", xtitle="p_{T}", ytitle="< #chi^{2} / ndf >", ymin=[0, 0.5], ymax=[2, 2.5, 3, 5], xlog=True, fallback={"name": "chi2_vs_pt", "profileX": True}),
376  Plot("ptres_vs_pt_Mean", title="", xtitle="p_{T}", ytitle="< #delta p_{T}/p_{T} > (%)", scale=100, ymin=_minResidualPt, ymax=_maxResidualPt,xlog=True)
377 ])
378 _common = {"stat": True, "fit": True, "normalizeToUnitArea": True, "drawStyle": "hist", "drawCommand": "", "xmin": -10, "xmax": 10, "ylog": True, "ymin": 5e-5, "ymax": [0.01, 0.05, 0.1, 0.2, 0.5, 0.8, 1.025], "ratioUncertainty": False}
379 _pulls = PlotGroup("pulls", [
380  Plot("pullPt", **_common),
381  Plot("pullQoverp", **_common),
382  Plot("pullPhi", **_common),
383  Plot("pullTheta", **_common),
384  Plot("pullDxy", **_common),
385  Plot("pullDz", **_common),
386 ],
387  legendDx=0.1, legendDw=-0.1, legendDh=-0.015
388 )
389 _common = {"title": "", "ylog": True, "xtitle": "TP #eta (PCA to beamline)", "ymin": _minMaxResol, "ymax": _minMaxResol}
390 _resolutionsEta = PlotGroup("resolutionsEta", [
391  Plot("phires_vs_eta_Sigma", ytitle="#sigma(#delta #phi) (rad)", **_common),
392  Plot("cotThetares_vs_eta_Sigma", ytitle="#sigma(#delta cot(#theta))", **_common),
393  Plot("dxyres_vs_eta_Sigma", ytitle="#sigma(#delta d_{xy}) (cm)", **_common),
394  Plot("dzres_vs_eta_Sigma", ytitle="#sigma(#delta d_{z}) (cm)", **_common),
395  Plot("ptres_vs_eta_Sigma", ytitle="#sigma(#delta p_{T}/p_{T})", **_common),
396 ])
397 _common = {"title": "", "ylog": True, "xlog": True, "xtitle": "TP p_{T} (PCA to beamline)", "xmin": 0.1, "xmax": 1000, "ymin": _minMaxResol, "ymax": _minMaxResol}
398 _resolutionsPt = PlotGroup("resolutionsPt", [
399  Plot("phires_vs_pt_Sigma", ytitle="#sigma(#delta #phi) (rad)", **_common),
400  Plot("cotThetares_vs_pt_Sigma", ytitle="#sigma(#delta cot(#theta))", **_common),
401  Plot("dxyres_vs_pt_Sigma", ytitle="#sigma(#delta d_{xy}) (cm)", **_common),
402  Plot("dzres_vs_pt_Sigma", ytitle="#sigma(#delta d_{z}) (cm)", **_common),
403  Plot("ptres_vs_pt_Sigma", ytitle="#sigma(#delta p_{T}/p_{T})", **_common),
404 ])
405 _common = {"title": "", "ylog": True, "xtitle": "TP #Phi (PCA to beamline)", "ymin": _minMaxResol, "ymax": _minMaxResol}
406 _resolutionsPhi = PlotGroup("resolutionsPhi", [
407  Plot("dxyres_vs_phi_Sigma", ytitle="#sigma(#delta d_{xy}) (cm)", **_common),
408  Plot("dzres_vs_phi_Sigma", ytitle="#sigma(#delta d_{z}) (cm)", **_common),
409  Plot("phires_vs_phi_Sigma", ytitle="#sigma(#delta #phi) (rad)", **_common),
410  Plot("ptres_vs_phi_Sigma", ytitle="#sigma(#delta p_{T}/p_{T})", **_common),
411 ])
412 
413 
414 _extDistPtEtaPhi = PlotGroup("distPtEtaPhi",
415  _makeDistPlots("pT", "p_{T} (GeV)", common=dict(xlog=True)) +
416  _makeDistPlots("eta", "#eta") +
417  _makeDistPlots("phi", "#phi"),
418  ncols=4)
419 _extDistDxyDzBS = PlotGroup("distDxyDzBS",
420  _makeDistPlots("dxy" , "dxy (cm)") +
421  _makeDistPlots("dz" , "dz (cm)"),
422  ncols=4, legendDy=_legendDy_2rows)
423 _extDistDxyDzPV = PlotGroup("distDxyDzPV",
424  _makeDistPlots("dxypv" , "dxy(PV) (cm)") +
425  _makeDistPlots("dxypv_zoomed", "dxy(PV) (cm)") +
426  _makeDistPlots("dzpv" , "dz(PV) (cm)") +
427  _makeDistPlots("dzpv_zoomed" , "dz(PV) (cm)"),
428  ncols=4, legendDy=_legendDy_4rows)
429 _extDistHitsLayers = PlotGroup("distHitsLayers",
430  _makeDistPlots("hit" , "hits" , common=dict(xmin=_minHits , xmax=_maxHits)) +
431  _makeDistPlots("layer" , "layers" , common=dict(xmin=_minLayers , xmax=_maxLayers)) +
432  _makeDistPlots("pixellayer", "pixel layers", common=dict( xmax=_maxPixelLayers)) +
433  _makeDistPlots("3Dlayer" , "3D layers" , common=dict(xmin=_min3DLayers, xmax=_max3DLayers)),
434  ncols=4, legendDy=_legendDy_4rows,
435 )
436 _extDistPos = PlotGroup("distPos",
437  _makeDistPlots("vertpos", "ref. point r (cm)", common=dict(xlog=True)) +
438  _makeDistPlots("zpos" , "ref. point z (cm)") +
439  _makeDistPlots("simpvz" , "Sim. PV z (cm)", common=dict(xmin=_minZ, xmax=_maxZ)),
440  ncols=3,
441 )
442 _extDistDeltaR = PlotGroup("distDeltaR",
443  _makeDistPlots("dr" , "min #DeltaR", common=dict(xlog=True)) +
444  _makeDistPlots("drj" , "#DeltaR(track, jet)", common=dict(xlog=True)),
445  ncols=2, legendDy=_legendDy_2rows,
446 )
447 _extDistSeedingPlots = _makeDistPlots("seedingLayerSet", "seeding layers", common=dict(xtitle="", **_seedingLayerSet_common))
448 _extDistChi2Seeding = PlotGroup("distChi2Seeding",
449  _makeDistPlots("chi2", "#chi^{2}") +
450  _extDistSeedingPlots,
451  ncols=4, legendDy=_legendDy_2rows_3cols
452 )
453 _common = dict(title="", xtitle="TP #eta (PCA to beamline)")
454 _extResidualEta = PlotGroup("residualEta", [
455  Plot("phires_vs_eta_Mean", ytitle="< #delta #phi > (rad)", ymin=_minResidualPhi, ymax=_maxResidualPhi, **_common),
456  Plot("cotThetares_vs_eta_Mean", ytitle="< #delta cot(#theta) >", ymin=_minResidualCotTheta, ymax=_maxResidualCotTheta, **_common),
457  Plot("dxyres_vs_eta_Mean", ytitle="< #delta d_{xy} > (#mum)", scale=10000, ymin=_minResidualDxy, ymax=_maxResidualDxy, **_common),
458  Plot("dzres_vs_eta_Mean", ytitle="< #delta d_{z} > (#mum)", scale=10000, ymin=_minResidualDz, ymax=_maxResidualDz, **_common),
459  Plot("ptres_vs_eta_Mean", ytitle="< #delta p_{T}/p_{T} > (%)", scale=100, ymin=_minResidualPt, ymax=_maxResidualPt, **_common), # same as in tuning, but to be complete
460 ])
461 _common = dict(title="", xlog=True, xtitle="TP p_{T} (PCA to beamline)", xmin=0.1, xmax=1000)
462 _extResidualPt = PlotGroup("residualPt", [
463  Plot("phires_vs_pt_Mean", ytitle="< #delta #phi > (rad)", ymin=_minResidualPhi, ymax=_maxResidualPhi, **_common),
464  Plot("cotThetares_vs_pt_Mean", ytitle="< #delta cot(#theta > )", ymin=_minResidualCotTheta, ymax=_maxResidualCotTheta, **_common),
465  Plot("dxyres_vs_pt_Mean", ytitle="< #delta d_{xy} > (#mum)", scale=10000, ymin=_minResidualDxy, ymax=_maxResidualDxy, **_common),
466  Plot("dzres_vs_pt_Mean", ytitle="< #delta d_{z} > (#mum)", scale=10000, ymin=_minResidualDz, ymax=_maxResidualDz, **_common),
467  Plot("ptres_vs_pt_Mean", ytitle="< #delta p_{T}/p_{T} > (%)", scale=100, ymin=_minResidualPt, ymax=_maxResidualPt, **_common), # same as in tuning, but to be complete
468 ])
469 _common = dict(title="", ytitle="Selected tracks/TrackingParticles", ymax=_maxEff)
470 _extNrecVsNsim = PlotGroup("nrecVsNsim", [
471  Plot("nrec_vs_nsim", title="", xtitle="TrackingParticles", ytitle="Tracks", profileX=True, xmin=_minMaxTracks, xmax=_minMaxTracks, ymin=_minMaxTracks, ymax=_minMaxTracks),
472  Plot("nrecPerNsim_vs_pu", xtitle="Pileup", xmin=_minPU, xmax=_maxPU, **_common),
473  Plot("nrecPerNsimPt", xtitle="p_{T} (GeV)", xlog=True, **_common),
474  Plot("nrecPerNsim", xtitle="#eta", **_common)
475 ], legendDy=_legendDy_2rows)
476 _extHitsLayers = PlotGroup("hitsLayers", [
477  Plot("PXLhits_vs_eta", xtitle="#eta", ytitle="<pixel hits>"),
478  Plot("PXLlayersWithMeas_vs_eta", xtitle="#eta", ytitle="<pixel layers>"),
479  Plot("STRIPhits_vs_eta", xtitle="#eta", ytitle="<strip hits>"),
480  Plot("STRIPlayersWithMeas_vs_eta", xtitle="#eta", ytitle="<strip layers>"),
481 ], legendDy=_legendDy_2rows)
482 
483 
484 
485 _extDistSimPtEtaPhi = PlotGroup("distsimPtEtaPhi",
486  _makeDistSimPlots("pT", "p_{T} (GeV)", common=dict(xlog=True)) +
487  _makeDistSimPlots("eta", "#eta") +
488  _makeDistSimPlots("phi", "#phi"),
489  ncols=2)
490 _extDistSimDxyDzBS = PlotGroup("distsimDxyDzBS",
491  _makeDistSimPlots("dxy" , "dxy (cm)") +
492  _makeDistSimPlots("dz" , "dz (cm)"),
493  ncols=2, legendDy=_legendDy_2rows)
494 _extDistSimDxyDzPV = PlotGroup("distsimDxyDzPV",
495  _makeDistSimPlots("dxypv" , "dxy(PV) (cm)") +
496  _makeDistSimPlots("dxypv_zoomed", "dxy(PV) (cm)") +
497  _makeDistSimPlots("dzpv" , "dz(PV) (cm)") +
498  _makeDistSimPlots("dzpv_zoomed" , "dz(PV) (cm)"),
499  ncols=2, legendDy=_legendDy_4rows)
500 _extDistSimHitsLayers = PlotGroup("distsimHitsLayers",
501  _makeDistSimPlots("hit" , "hits" , common=dict(xmin=_minHits , xmax=_maxHits)) +
502  _makeDistSimPlots("layer" , "layers" , common=dict(xmin=_minLayers , xmax=_maxLayers)) +
503  _makeDistSimPlots("pixellayer", "pixel layers", common=dict( xmax=_maxPixelLayers)) +
504  _makeDistSimPlots("3Dlayer" , "3D layers" , common=dict(xmin=_min3DLayers, xmax=_max3DLayers)),
505  ncols=2, legendDy=_legendDy_4rows,
506 )
507 _extDistSimPos = PlotGroup("distsimPos",
508  _makeDistSimPlots("vertpos", "vert r (cm)", common=dict(xlog=True)) +
509  _makeDistSimPlots("zpos" , "vert z (cm)") +
510  _makeDistSimPlots("simpvz" , "Sim. PV z (cm)", common=dict(xmin=_minZ, xmax=_maxZ)),
511  ncols=3,
512 )
513 _extDistSimDeltaR = PlotGroup("distsimDeltaR",
514  _makeDistSimPlots("dr" , "min #DeltaR", common=dict(xlog=True)) +
515  _makeDistSimPlots("drj" , "#DeltaR(TP, jet)", common=dict(xlog=True)),
516  ncols=2, legendDy=_legendDy_2rows,
517 )
518 
519 
524 
525 _possibleTrackingNonIterationColls = [
526  'ak4PFJets',
527  'btvLike',
528 ]
529 _possibleTrackingColls = [
530  'initialStepPreSplitting',
531  'initialStep',
532  'highPtTripletStep', # phase1
533  'detachedQuadStep', # phase1
534  'detachedTripletStep',
535  'lowPtQuadStep', # phase1
536  'lowPtTripletStep',
537  'pixelPairStepA', # seeds
538  'pixelPairStepB', # seeds
539  'pixelPairStepC', # seeds
540  'pixelPairStep',
541  'mixedTripletStepA', # seeds
542  'mixedTripletStepB', # seeds
543  'mixedTripletStep',
544  'pixelLessStep',
545  'tobTecStepPair', # seeds
546  'tobTecStepTripl', # seeds
547  'tobTecStep',
548  'jetCoreRegionalStep',
549  'muonSeededStepInOut',
550  'muonSeededStepOutIn',
551  'duplicateMerge',
552 ] + _possibleTrackingNonIterationColls
553 _possibleTrackingCollsOld = {
554  "Zero" : "iter0",
555  "First" : "iter1",
556  "Second": "iter2",
557  "Third" : "iter3",
558  "Fourth": "iter4",
559  "Fifth" : "iter5",
560  "Sixth" : "iter6",
561  "Seventh": "iter7",
562  "Ninth" : "iter9",
563  "Tenth" : "iter10",
564 }
565 
567  ret = subfolder.replace("trackingParticleRecoAsssociation", "AssociatorByHitsRecoDenom")
568  for (old, new) in [("InitialStep", "Zero"),
569  ("HighPtTripletStep", "First"),
570  ("LowPtQuadStep", "Second"),
571  ("LowPtTripletStep", "Third"),
572  ("DetachedQuadStep", "Fourth"),
573  ("PixelPairStep", "Fifth"),
574  ("MuonSeededStepInOut", "Ninth"),
575  ("MuonSeededStepOutIn", "Tenth")]:
576  ret = ret.replace(old, new)
577  if ret == subfolder:
578  return None
579  return ret
581  for (old, new) in [("initialStep", "iter0"),
582  ("highPtTripletStep", "iter1"),
583  ("lowPtQuadStep", "iter2"),
584  ("lowPtTripletStep", "iter3"),
585  ("detachedQuadStep", "iter4"),
586  ("pixelPairStep", "iter5"),
587  ("muonSeededStepInOut", "iter9"),
588  ("muonSeededStepOutIn", "iter10")]:
589  path = path.replace(old, new)
590  return path
591 
593  return subfolder.replace("trackingParticleRecoAsssociation", "trackingParticleRecoAsssociationSignal")
595  return subfolder.replace("quickAssociatorByHits", "quickAssociatorByHitsConversion")
597  return subfolder.replace("quickAssociatorByHits", "quickAssociatorByHitsPreSplitting")
598 
599 # Additional "quality" flags than highPurity. In a separate list to
600 # allow customization.
601 _additionalTrackQualities = [
602  "Pt09",
603  "ByOriginalAlgo",
604  "ByAlgoMask"
605 ]
607  if "Hp" in collName:
608  quality = "highPurity"
609  else:
610  quality = ""
611  collNameNoQuality = collName.replace("Hp", "")
612  for qual in _additionalTrackQualities:
613  if qual in collName:
614  quality += qual
615  collNameNoQuality = collNameNoQuality.replace(qual, "")
616 
617  collNameNoQuality = collNameNoQuality.replace("Tracks", "", 1) # make summary naming consistent with iteration folders
618  collNameLow = collNameNoQuality.lower().replace("frompv2", "").replace("frompv", "").replace("frompvalltp", "").replace("alltp", "")
619 
620  if collNameLow.find("seed") == 0:
621  collNameLow = collNameLow[4:]
622  if collNameLow == "initialstepseedspresplitting":
623  collNameLow = "initialsteppresplittingseeds"
624  elif collNameLow == "muonseededseedsinout":
625  collNameLow = "muonseededstepinoutseeds"
626  elif collNameLow == "muonseededseedsoutin":
627  collNameLow = "muonseededstepoutinseeds"
628 
629  i_seeds = collNameLow.index("seeds")
630  quality = collNameLow[i_seeds:]+quality
631 
632  collNameLow = collNameLow[:i_seeds]
633 
634  algo = None
635  prefixes = ["cutsreco", "cutsrecofrompv", "cutsrecofrompv2", "cutsrecofrompvalltp", "cutsrecoetagreater2p7"]
636  if collNameLow in ["general", "generalfrompv", "generaletagreater2p7"]+prefixes:
637  algo = "ootb"
638  else:
639  def testColl(coll):
640  for pfx in prefixes:
641  if coll == collNameLow.replace(pfx, ""):
642  return True
643  return False
644 
645  for coll in _possibleTrackingColls:
646  if testColl(coll.lower()):
647  algo = coll
648  break
649  # next try "old style"
650  if algo is None:
651  for coll, name in six.iteritems(_possibleTrackingCollsOld):
652  if testColl(coll.lower()):
653  algo = name
654  break
655 
656  # fallback
657  if algo is None:
658  algo = collNameNoQuality
659 
660  # fix for track collection naming convention
661  if algo == "muonSeededInOut":
662  algo = "muonSeededStepInOut"
663  if algo == "muonSeededOutIn":
664  algo = "muonSeededStepOutIn"
665 
666  return (algo, quality)
667 
668 def _collhelper(name):
669  return (name, [name])
670 _collLabelMap = collections.OrderedDict(map(_collhelper, ["generalTracks"]+_possibleTrackingColls))
671 _collLabelMapHp = collections.OrderedDict(map(_collhelper, ["generalTracks"]+[n for n in _possibleTrackingColls if "Step" in n]))
672 def _summaryBinRename(binLabel, highPurity, byOriginalAlgo, byAlgoMask, ptCut, seeds):
673  (algo, quality) = _mapCollectionToAlgoQuality(binLabel)
674  if algo == "ootb":
675  algo = "generalTracks"
676  ret = None
677 
678  if byOriginalAlgo:
679  if algo != "generalTracks" and "ByOriginalAlgo" not in quality: # keep generalTracks bin as well
680  return None
681  quality = quality.replace("ByOriginalAlgo", "")
682  if byAlgoMask:
683  if algo != "generalTracks" and "ByAlgoMask" not in quality: # keep generalTracks bin as well
684  return None
685  quality = quality.replace("ByAlgoMask", "")
686  if ptCut:
687  if "Pt09" not in quality:
688  return None
689  quality = quality.replace("Pt09", "")
690 
691  if highPurity:
692  if quality == "highPurity":
693  ret = algo
694  elif seeds:
695  i_seeds = quality.find("seeds")
696  if i_seeds == 0:
697  ret = algo
698  seedSubColl = quality[i_seeds+5:]
699  if seedSubColl != "":
700  ret += seedSubColl[0].upper() + seedSubColl[1:]
701  else:
702  if quality == "":
703  ret = algo
704 
705  return ret
706 
707 def _constructSummary(mapping=None, highPurity=False, byOriginalAlgo=False, byAlgoMask=False, ptCut=False, seeds=False, midfix=""):
708  _common = {"drawStyle": "EP", "xbinlabelsize": 10, "xbinlabeloption": "d"}
709  _commonN = dict(ylog=True, ymin=_minMaxN, ymax=_minMaxN,
710  normalizeToNumberOfEvents=True,
711  )
712  _commonN.update(_common)
713  _commonAB = dict(mapping=mapping,
714  renameBin=lambda bl: _summaryBinRename(bl, highPurity, byOriginalAlgo, byAlgoMask, ptCut, seeds),
715  ignoreMissingBins=True,
716  originalOrder=True,
717  )
718  if byOriginalAlgo or byAlgoMask:
719  _commonAB["minExistingBins"] = 2
720  prefix = "summary"+midfix
721 
722  h_eff = "effic_vs_coll"
723  h_fakerate = "fakerate_vs_coll"
724  h_duplicaterate = "duplicatesRate_coll"
725  h_pileuprate = "pileuprate_coll"
726 
727  h_reco = "num_reco_coll"
728  h_true = "num_assoc(recoToSim)_coll"
729  h_fake = Subtract("num_fake_coll_orig", "num_reco_coll", "num_assoc(recoToSim)_coll")
730  h_duplicate = "num_duplicate_coll"
731  h_pileup = "num_pileup_coll"
732  if mapping is not None:
733  h_eff = AggregateBins("efficiency", h_eff, **_commonAB)
734  h_fakerate = AggregateBins("fakerate", h_fakerate, **_commonAB)
735  h_duplicaterate = AggregateBins("duplicatesRate", h_duplicaterate, **_commonAB)
736  h_pileuprate = AggregateBins("pileuprate", h_pileuprate, **_commonAB)
737 
738  h_reco = AggregateBins("num_reco_coll", h_reco, **_commonAB)
739  h_true = AggregateBins("num_true_coll", h_true, **_commonAB)
740  h_fake = AggregateBins("num_fake_coll", h_fake, **_commonAB)
741  h_duplicate = AggregateBins("num_duplicate_coll", h_duplicate, **_commonAB)
742  h_pileup = AggregateBins("num_pileup_coll", h_pileup, **_commonAB)
743 
744  summary = PlotGroup(prefix, [
745  Plot(h_eff, title="Efficiency vs collection", ytitle="Efficiency", ymin=1e-3, ymax=1, ylog=True, **_common),
746  Plot(h_fakerate, title="Fakerate vs collection", ytitle="Fake rate", ymax=_maxFake, **_common),
747  #
748  Plot(h_duplicaterate, title="Duplicates rate vs collection", ytitle="Duplicates rate", ymax=_maxFake, **_common),
749  Plot(h_pileuprate, title="Pileup rate vs collection", ytitle="Pileup rate", ymax=_maxFake, **_common),
750  ],
751  legendDy=_legendDy_2rows
752  )
753  summaryN = PlotGroup(prefix+"_ntracks", [
754  # FIXME
755  #Plot(h_reco, ytitle="Tracks/event", title="Number of tracks/event vs collection", **_commonN),
756  #Plot(h_true, ytitle="True tracks/event", title="Number of true tracks/event vs collection", **_commonN),
757  #Plot(h_fake, ytitle="Fake tracks/event", title="Number of fake tracks/event vs collection", **_commonN),
758  #Plot(h_duplicate, ytitle="Duplicate tracks/event", title="Number of duplicate tracks/event vs collection", **_commonN),
759  #Plot(h_pileup, ytitle="Pileup tracks/event", title="Number of pileup tracks/event vs collection", **_commonN),
760  Plot(h_reco, ytitle="Tracks", title="Number of tracks vs collection", **_commonN),
761  Plot(h_true, ytitle="True tracks", title="Number of true tracks vs collection", **_commonN),
762  Plot(h_fake, ytitle="Fake tracks", title="Number of fake tracks vs collection", **_commonN),
763  Plot(h_duplicate, ytitle="Duplicate tracks", title="Number of duplicate tracks vs collection", **_commonN),
764  Plot(h_pileup, ytitle="Pileup tracks", title="Number of pileup tracks vs collection", **_commonN),
765  ])
766 
767  return (summary, summaryN)
768 
769 (_summaryRaw, _summaryRawN) = _constructSummary(midfix="Raw")
770 (_summary, _summaryN) = _constructSummary(_collLabelMap)
771 (_summaryHp, _summaryNHp) = _constructSummary(_collLabelMapHp, highPurity=True)
772 (_summaryByOriginalAlgo, _summaryByOriginalAlgoN) = _constructSummary(_collLabelMapHp, byOriginalAlgo=True, midfix="ByOriginalAlgo")
773 (_summaryByOriginalAlgoHp, _summaryByOriginalAlgoNHp) = _constructSummary(_collLabelMapHp, byOriginalAlgo=True, midfix="ByOriginalAlgo", highPurity=True)
774 (_summaryByAlgoMask, _summaryByAlgoMaskN) = _constructSummary(_collLabelMapHp, byAlgoMask=True, midfix="ByAlgoMask")
775 (_summaryByAlgoMaskHp, _summaryByAlgoMaskNHp) = _constructSummary(_collLabelMapHp, byAlgoMask=True, midfix="ByAlgoMask", highPurity=True)
776 (_summaryPt09, _summaryPt09N) = _constructSummary(_collLabelMap, ptCut=True, midfix="Pt09")
777 (_summaryPt09Hp, _summaryPt09NHp) = _constructSummary(_collLabelMap, ptCut=True, midfix="Pt09", highPurity=True)
778 (_summarySeeds, _summarySeedsN) = _constructSummary(_collLabelMapHp, seeds=True)
779 
780 
785 
786 _common = {"normalizeToUnitArea": True, "ylog": True, "ymin": [1e-7, 1e-6, 1e-5, 1e-4, 1e-3, 1e-2], "ymax": [1e-2, 1e-1, 1.1]}
787 _commonStatus = {}
788 _commonStatus.update(_common)
789 _commonStatus.update({"xbinlabelsize": 10, "xbinlabeloption": "d", "drawStyle": "hist", "adjustMarginRight": 0.08})
790 _commonLabelSize = {}
791 _commonLabelSize.update(_common)
792 _commonLabelSize.update({"xlabelsize": 17})
793 
794 _packedCandidateFlow = PlotGroup("flow", [
795  Plot("selectionFlow", xbinlabelsize=10, xbinlabeloption="d", adjustMarginRight=0.1, drawStyle="hist", ylog=True, ymin=[0.9, 9, 9e1, 9e2, 9e3, 9e4, 9e5, 9e6, 9e7]),
796  Plot("diffCharge", xtitle="Charge", **_common),
797  Plot("diffIsHighPurity", xtitle="High purity status", **_common),
798  Plot("diffNdof", xtitle="ndof", **_common),
799  Plot("diffNormalizedChi2", xtitle="#chi^{2}/ndof", **_common),
800 ])
801 
802 _packedCandidateHitsHitPattern = PlotGroup("hitsHitPattern", [
803  Plot("diffHitPatternNumberOfValidHits", xtitle="Valid hits (via HitPattern)", **_common),
804  Plot("diffHitPatternNumberOfValidPixelHits", xtitle="Valid pixel hits (via HitPattern)", **_common),
805  Plot("diffHitPatternHasValidHitInFirstPixelBarrel", xtitle="Has valid hit in BPix1 layer (via HitPattern)", **_common),
806  Plot("diffHitPatternNumberOfLostPixelHits", xtitle="Lost pixel hits (via HitPattern)", **_common),
807 ],
808  legendDy=_legendDy_2rows
809 )
810 _packedCandidateHits = PlotGroup("hits", [
811  Plot("diffNumberOfHits", xtitle="Hits", **_common),
812  Plot("diffNumberOfPixelHits", xtitle="Pixel hits", **_common),
813  Plot("diffLostInnerHits", xtitle="Lost inner hits", **_common),
814  Plot("numberHitsOverMax", xtitle="Number of overflown hits", **_common),
815  Plot("numberPixelHitsOverMax", xtitle="Number of overflown pixel hits", **_common),
816  Plot("numberStripHitsOverMax", xtitle="Number of overflown strip hits", **_common),
817 ],
818  ncols=3, legendDy=_legendDy_2rows_3cols
819 )
820 
821 _packedCandidateLayers = PlotGroup("layers", [
822  PlotEmpty(),
823  Plot("diffNumberOfPixelLayers", xtitle="Pixel layers", **_common),
824  Plot("diffNumberOfStripLayers", xtitle="Strip layers", **_common),
825  #
826  Plot("diffHitPatternTrackerLayersWithMeasurement", xtitle="Layers (via HitPattern)", **_common),
827  Plot("diffHitPatternPixelLayersWithMeasurement", xtitle="Pixel layers (via HitPattern)", **_common),
828  Plot("diffHitPatternStripLayersWithMeasurement", xtitle="Strip layers (via HitPattern)", **_common),
829  #
830  Plot("numberLayersOverMax", xtitle="Number of overflown layers", **_common),
831  Plot("numberPixelLayersOverMax", xtitle="Number of overflown pixel layers", **_common),
832  Plot("numberStripLayersOverMax", xtitle="Number of overflown strip layers", **_common),
833 ],
834  ncols=3
835 )
836 
837 
838 _packedCandidateImpactParameter1 = PlotGroup("impactParameter1", [
839  Plot("diffDxyAssocPV", xtitle="dxy(assocPV)", adjustMarginRight=0.02, **_commonLabelSize),
840  Plot("diffDxyAssocPVStatus", **_commonStatus),
841  Plot("diffDxyAssocPVUnderOverFlowSign", xtitle="dxy(assocPV)", **_common),
842  Plot("diffDzAssocPV", xtitle="dz(assocPV)", adjustMarginRight=0.02, **_commonLabelSize),
843  Plot("diffDzAssocPVStatus", **_commonStatus),
844  Plot("diffDzAssocPVUnderOverFlowSign", xtitle="dz(assocPV)", **_common),
845  Plot("diffDxyError", xtitle="dxyError()", adjustMarginRight=0.02, **_commonLabelSize),
846  Plot("diffDszError", xtitle="dszError()", adjustMarginRight=0.02, **_commonLabelSize),
847  Plot("diffDzError", xtitle="dzError()", adjustMarginRight=0.02, **_commonLabelSize),
848 
849 ],
850  ncols=3
851 )
852 
853 _packedCandidateImpactParameter2 = PlotGroup("impactParameter2", [
854  Plot("diffDxyPV", xtitle="dxy(PV) via PC", **_commonLabelSize),
855  Plot("diffDzPV", xtitle="dz(PV) via PC", **_commonLabelSize),
856  Plot("diffTrackDxyAssocPV", xtitle="dxy(PV) via PC::bestTrack()", **_commonLabelSize),
857  Plot("diffTrackDzAssocPV", xtitle="dz(PV) via PC::bestTrack()", **_commonLabelSize),
858  Plot("diffTrackDxyError", xtitle="dxyError() via PC::bestTrack()", adjustMarginRight=0.02, **_commonLabelSize),
859  Plot("diffTrackDzError", xtitle="dzError() via PC::bestTrack()", **_commonLabelSize),
860 ])
861 
862 _packedCandidateCovarianceMatrix1 = PlotGroup("covarianceMatrix1", [
863  Plot("diffCovQoverpQoverp", xtitle="cov(qoverp, qoverp)", **_commonLabelSize),
864  Plot("diffCovQoverpQoverpStatus", **_commonStatus),
865  Plot("diffCovQoverpQoverpUnderOverFlowSign", xtitle="cov(qoverp, qoverp)", **_common),
866  Plot("diffCovLambdaLambda", xtitle="cov(lambda, lambda)", **_commonLabelSize),
867  Plot("diffCovLambdaLambdaStatus", **_commonStatus),
868  Plot("diffCovLambdaLambdaUnderOverFlowSign", xtitle="cov(lambda, lambda)", **_common),
869  Plot("diffCovLambdaDsz", xtitle="cov(lambda, dsz)", **_commonLabelSize),
870  Plot("diffCovLambdaDszStatus", **_commonStatus),
871  Plot("diffCovLambdaDszUnderOverFlowSign", xtitle="cov(lambda, dsz)", **_common),
872  Plot("diffCovPhiPhi", xtitle="cov(phi, phi)", **_commonLabelSize),
873  Plot("diffCovPhiPhiStatus", **_commonStatus),
874  Plot("diffCovPhiPhiUnderOverFlowSign", xtitle="cov(phi, phi)", **_common),
875 ],
876  ncols=3, legendDy=_legendDy_4rows
877 )
878 _packedCandidateCovarianceMatrix2 = PlotGroup("covarianceMatrix2", [
879  Plot("diffCovPhiDxy", xtitle="cov(phi, dxy)", **_commonLabelSize),
880  Plot("diffCovPhiDxyStatus", **_commonStatus),
881  Plot("diffCovPhiDxyUnderOverFlowSign", xtitle="cov(phi, dxy)", **_common),
882  Plot("diffCovDxyDxy", xtitle="cov(dxy, dxy)", adjustMarginRight=0.02, **_commonLabelSize),
883  Plot("diffCovDxyDxyStatus", **_commonStatus),
884  Plot("diffCovDxyDxyUnderOverFlowSign", xtitle="cov(dxy, dxy)", **_common),
885  Plot("diffCovDxyDsz", xtitle="cov(dxy, dsz)", adjustMarginRight=0.02, **_commonLabelSize),
886  Plot("diffCovDxyDszStatus", **_commonStatus),
887  Plot("diffCovDxyDszUnderOverFlowSign", xtitle="cov(dxy, dsz)", **_common),
888  Plot("diffCovDszDsz", xtitle="cov(dsz, dsz)", adjustMarginRight=0.02, **_commonLabelSize),
889  Plot("diffCovDszDszStatus", **_commonStatus),
890  Plot("diffCovDszDszUnderOverFlowSign", xtitle="cov(dsz, dsz)", **_common),
891 ],
892  ncols=3, legendDy=_legendDy_4rows
893 )
894 
895 _common["xlabelsize"] = 16
896 _packedCandidateVertex = PlotGroup("vertex", [
897  Plot("diffVx", xtitle="Reference point x", **_common),
898  Plot("diffVy", xtitle="Reference point y", **_common),
899  Plot("diffVz", xtitle="Reference point z", **_common),
900 ],
901  legendDy=_legendDy_2rows
902 )
903 
904 _common["adjustMarginRight"] = 0.05
905 _packedCandidateKinematics = PlotGroup("kinematics", [
906  Plot("diffPt", xtitle="p_{T}", **_common),
907  Plot("diffPtError", xtitle="p_{T} error", **_common),
908  Plot("diffEta", xtitle="#eta", **_common),
909  Plot("diffEtaError", xtitle="#eta error", **_common),
910  Plot("diffPhi", xtitle="#phi", **_common),
911 ])
912 
914  def __init__(self, *args, **kwargs):
915  self._fallbackRefFiles = kwargs.pop("fallbackRefFiles", [])
916  PlotFolder.__init__(self, *args, **kwargs)
917 
918  def translateSubFolder(self, dqmSubFolderName):
919  spl = dqmSubFolderName.split("_")
920  if len(spl) != 2:
921  return None
922  collName = spl[0]
923  return _mapCollectionToAlgoQuality(collName)
924 
925  def iterSelectionName(self, plotFolderName, translatedDqmSubFolder):
926  (algoOrig, quality) = translatedDqmSubFolder
927 
928  for fallback in [lambda n: n]+self._fallbackRefFiles:
929  algo = fallback(algoOrig)
930 
931  ret = ""
932  if plotFolderName != "":
933  ret += "_"+plotFolderName
934  if quality != "":
935  ret += "_"+quality
936  if not (algo == "ootb" and quality != ""):
937  ret += "_"+algo
938  yield ret
939 
940  def limitSubFolder(self, limitOnlyTo, translatedDqmSubFolder):
941  """Return True if this subfolder should be processed
942 
943  Arguments:
944  limitOnlyTo -- Function '(algo, quality) -> bool'
945  translatedDqmSubFolder -- Return value of translateSubFolder
946  """
947  (algo, quality) = translatedDqmSubFolder
948  return limitOnlyTo(algo, quality)
949 
950  # track-specific hack
951  def isAlgoIterative(self, algo):
952  return algo not in _possibleTrackingNonIterationColls
953 
955  class GeneralTracks: pass
956  class GeneralTracksPt09: pass
957  class HighPurity: pass
958  class HighPurityPt09: pass
959  class BTVLike: pass
960  class AK4PFJets: pass
961  class Pixel: pass
962 
963  def __init__(self, section, collection=GeneralTracks):
964  self._collection = collection
966  self._page = "summary"
967  self._section = section
968 
969  def getPurpose(self):
970  return self._purpose
971 
972  def getPage(self):
973  return self._page
974 
975  def getSection(self, dqmSubFolder):
976  return self._section
977 
978  def create(self, tdirectory):
979  def _getAlgoQuality(data, algo, quality):
980  for label, value in six.iteritems(data):
981  (a, q) = _mapCollectionToAlgoQuality(label)
982  if a == algo and q == quality:
983  return value[0] # value is (value, uncertainty) tuple
984  return None
985  def _getN(hname):
986  h = tdirectory.Get(hname)
987  if not h:
988  return None
991  return _getAlgoQuality(data, "ootb", "")
993  return _getAlgoQuality(data, "ootb", "Pt09")
995  return _getAlgoQuality(data, "ootb", "highPurity")
997  return _getAlgoQuality(data, "ootb", "highPurityPt09")
999  return _getAlgoQuality(data, "btvLike", "")
1001  return _getAlgoQuality(data, "ak4PFJets", "")
1003  return _getAlgoQuality(data, "pixel", "")
1004  else:
1005  raise Exception("Collection not recognized, %s" % str(self._collection))
1006  def _formatOrNone(num, func):
1007  if num is None:
1008  return None
1009  return func(num)
1010 
1011  n_tps = _formatOrNone(_getN("num_simul_coll"), int)
1012  n_m_tps = _formatOrNone(_getN("num_assoc(simToReco)_coll"), int)
1013 
1014  n_tracks = _formatOrNone(_getN("num_reco_coll"), int)
1015  n_true = _formatOrNone(_getN("num_assoc(recoToSim)_coll"), int)
1016  if n_tracks is not None and n_true is not None:
1017  n_fake = n_tracks-n_true
1018  else:
1019  n_fake = None
1020  n_pileup = _formatOrNone(_getN("num_pileup_coll"), int)
1021  n_duplicate = _formatOrNone(_getN("num_duplicate_coll"), int)
1022 
1023  eff = _formatOrNone(_getN("effic_vs_coll"), lambda n: "%.4f" % n)
1024  eff_nopt = _formatOrNone(_getN("effic_vs_coll_allPt"), lambda n: "%.4f" % n)
1025  fake = _formatOrNone(_getN("fakerate_vs_coll"), lambda n: "%.4f" % n)
1026  duplicate = _formatOrNone(_getN("duplicatesRate_coll"), lambda n: "%.4f" % n)
1027 
1028  ret = [eff, n_tps, n_m_tps,
1029  eff_nopt, fake, duplicate,
1030  n_tracks, n_true, n_fake, n_pileup, n_duplicate]
1031  if ret.count(None) == len(ret):
1032  return None
1033  return ret
1034 
1035  def headers(self):
1036  return [
1037  "Efficiency",
1038  "Number of TrackingParticles (after cuts)",
1039  "Number of matched TrackingParticles",
1040  "Efficiency (w/o pT cut)",
1041  "Fake rate",
1042  "Duplicate rate",
1043  "Number of tracks",
1044  "Number of true tracks",
1045  "Number of fake tracks",
1046  "Number of pileup tracks",
1047  "Number of duplicate tracks"
1048  ]
1049 
1050 # Provide a "PlotGroup" interface, but provide a html page
1052  def __init__(self, fileName, plots, titles, isRate, **kwargs):
1053  self._plots = plots
1054  self._titles = titles
1055  self._fileName = fileName
1056  self._format = "%.4g" if isRate else "%d"
1057 
1058  if len(plots) != len(titles):
1059  raise Exception("Number of plots (%d) has to be the same as number of titles (%d)" % (len(plots), len(titles)))
1060 
1061  def _set(attr, default):
1062  setattr(self, "_"+attr, kwargs.get(attr, default))
1063 
1064  _set("onlyForPileup", False)
1065 
1066  def onlyForPileup(self):
1067  """Return True if the PlotGroup is intended only for pileup samples"""
1068  return self._onlyForPileup
1069 
1070  def create(self, tdirectoryNEvents, requireAllHistograms=False):
1071  # [plot][histo]
1072  for plot in self._plots:
1073  plot.create(tdirectoryNEvents, requireAllHistograms)
1074 
1075  def draw(self, legendLabels, prefix=None, directory="", *args, **kwargs):
1076  # Do not make the table if it would be empty
1077  onlyEmptyPlots = True
1078  for plot in self._plots:
1079  if not plot.isEmpty():
1080  onlyEmptyPlots = False
1081  break
1082  if onlyEmptyPlots:
1083  return []
1084 
1085  haveShortLabels = False
1086  legendLabels = legendLabels[:]
1087  if max(map(len, legendLabels)) > 20:
1088  haveShortLabels = True
1089  labels_short = [str(chr(ord('A')+i)) for i in range(len(legendLabels))]
1090  for i, ls in enumerate(labels_short):
1091  legendLabels[i] = "%s: %s" % (ls, legendLabels[i])
1092  else:
1093  labels_short = legendLabels
1094 
1095  content = [
1096  '<html>',
1097  ' <body>',
1098  ' <table border="1">',
1099  ' <tr>',
1100  ]
1101 
1102 
1103  histos_linear = []
1104  histos_index = []
1105  labels = []
1106  for plot, title in zip(self._plots, self._titles):
1107  h_tmp = []
1108  l_tmp = []
1109  for h, l in zip(plot._histograms, labels_short):
1110  if h is not None:
1111  h_tmp.append(len(histos_linear))
1112  histos_linear.append(h)
1113  l_tmp.append(l)
1114 
1115  if len(h_tmp) > 0:
1116  histos_index.append(h_tmp)
1117  labels.append(l_tmp)
1118  content.extend([
1119  ' <td></td>',
1120  ' <td colspan="%d">%s</td>' % (len(h_tmp), title),
1121  ])
1122 
1123  if len(histos_linear) == 0:
1124  return []
1125 
1126  content.extend([
1127  ' </tr>',
1128  ' <tr>',
1129  ])
1130 
1131  xbinlabels = plotting._mergeBinLabelsX(histos_linear)
1132  histos_linear = plotting._th1IncludeOnlyBins(histos_linear, xbinlabels)
1133  if len(histos_linear) == 0:
1134  return []
1135  (histos_linear_new, xbinlabels) = plotting._th1RemoveEmptyBins(histos_linear, xbinlabels)
1136  # in practice either all histograms are returned, or none, but let's add a check anyway
1137  if len(histos_linear_new) > 0 and len(histos_linear_new) != len(histos_linear):
1138  raise Exception("This should never happen. len(histos_linear_new) %d != len(histos_linear) %d" % (len(histos_linear_new), len(histos_linear)))
1139  histos_linear = histos_linear_new
1140  if len(histos_linear) == 0:
1141  return []
1142 
1143  data = [ [h.GetBinContent(i) for i in range(1, h.GetNbinsX()+1)] for h in histos_linear]
1144  table = html.Table(["dummy"]*len(histos_linear), xbinlabels, data, None, None, None)
1145  data = table.tableAsRowColumn()
1146 
1147  for labs in labels:
1148  content.append(' <td></td>')
1149  content.extend([' <td>%s</td>' % lab for lab in labs])
1150  content.extend([
1151  ' </tr>',
1152  ])
1153 
1154  for irow, row in enumerate(data):
1155  content.extend([
1156  ' <tr>',
1157  ' <td>%s</td>' % table.rowHeaders()[irow]
1158  ])
1159 
1160  for hindices in histos_index:
1161  for hindex in hindices:
1162  item = row[hindex]
1163  formatted = self._format%item if item is not None else ""
1164  content.append(' <td align="right">%s</td>' % formatted)
1165  content.append(' <td></td>')
1166  del content[-1]
1167  content.append(' </tr>')
1168 
1169  content.append(' </table>')
1170  if haveShortLabels:
1171  for lab in legendLabels:
1172  content.append(' %s<br/>' % lab)
1173 
1174  content.extend([
1175  ' </body>',
1176  '<html>'
1177  ])
1178 
1179  name = self._fileName
1180  if prefix is not None:
1181  name = prefix+name
1182  name += ".html"
1183  name = os.path.join(directory, name)
1184 
1185  with open(name, "w") as f:
1186  for line in content:
1187  f.write(line)
1188  f.write("\n")
1189  return [name]
1190 
1191 _dupandfakeSeedingTable = TrackingSeedingLayerTable("dupandfakeSeeding", [p.clone() for p in _dupandfakeSeedingPlots],
1192  ["Fake rate", "Duplicate rate", "Pileup rate"], isRate=True)
1193 _extDistSeedingTable = TrackingSeedingLayerTable("distSeeding", [p.clone() for p in _extDistSeedingPlots],
1194  ["All tracks", "True tracks", "Fake tracks", "Duplicate tracks"], isRate=False)
1195 
1196 def _trackingFolders(lastDirName="Track"):
1197  return [
1198  "DQMData/Run 1/Tracking/Run summary/"+lastDirName,
1199  "DQMData/Tracking/"+lastDirName,
1200  "DQMData/Run 1/RecoTrackV/Run summary/"+lastDirName,
1201  "DQMData/RecoTrackV/"+lastDirName,
1202  ]
1203 
1204 _simBasedPlots = [
1205  _effandfakePtEtaPhi,
1206  _effandfakeDxyDzBS,
1207  _effandfakeDxyDzPV,
1208  _effandfakeHitsLayers,
1209  _effandfakePos,
1210  _effandfakeDeltaRPU,
1211  _duplicateAlgo,
1212 ]
1213 _recoBasedPlots = [
1214  _dupandfakePtEtaPhi,
1215  _dupandfakeDxyDzBS,
1216  _dupandfakeDxyDzPV,
1217  _dupandfakeHitsLayers,
1218  _dupandfakePos,
1219  _dupandfakeDeltaRPU,
1220  _dupandfakeChi2Seeding,
1221  _dupandfakeSeedingTable,
1222  _pvassociation1,
1223  _pvassociation2,
1224  _pvassociation3,
1225  _dedx,
1226 # _chargemisid,
1227  _hitsAndPt,
1228  _pulls,
1229  _resolutionsEta,
1230  _resolutionsPhi,
1231  _resolutionsPt,
1232  _tuning,
1233 ]
1234 _seedingBuildingPlots = _simBasedPlots + [
1235  _dupandfakePtEtaPhi,
1236  _dupandfakeDxyDzBS,
1237  _dupandfakeDxyDzPV,
1238  _dupandfakeHitsLayers,
1239  _dupandfakePos,
1240  _dupandfakeDeltaRPU,
1241  _dupandfakeChi2Seeding,
1242  _dupandfakeSeedingTable,
1243  _hitsAndPt,
1244 ] + _makeMVAPlots(1) \
1245  + _makeMVAPlots(2) \
1246  + _makeMVAPlots(2, hp=True) \
1247  + _makeMVAPlots(3) \
1248  + _makeMVAPlots(3, hp=True)
1249 # add more if needed
1250 _buildingExtendedPlots = [
1251  _pulls,
1252  _resolutionsEta,
1253  _resolutionsPhi,
1254  _resolutionsPt,
1255  _tuning,
1256 ]
1257 _extendedPlots = [
1258  _extDistPtEtaPhi,
1259  _extDistDxyDzBS,
1260  _extDistDxyDzPV,
1261  _extDistHitsLayers,
1262  _extDistPos,
1263  _extDistDeltaR,
1264  _extDistChi2Seeding,
1265  _extDistSeedingTable,
1266  _extResidualEta,
1267  _extResidualPt,
1268  _extNrecVsNsim,
1269  _extHitsLayers,
1270  _extDistSimPtEtaPhi,
1271  _extDistSimDxyDzBS,
1272  _extDistSimDxyDzPV,
1273  _extDistSimHitsLayers,
1274  _extDistSimPos,
1275  _extDistSimDeltaR,
1276 ]
1277 _summaryPlots = [
1278  _summary,
1279  _summaryN,
1280  _summaryByOriginalAlgo,
1281  _summaryByOriginalAlgoN,
1282  _summaryByAlgoMask,
1283  _summaryByAlgoMaskN,
1284  _summaryPt09,
1285  _summaryPt09N,
1286 ]
1287 _summaryPlotsHp = [
1288  _summaryHp,
1289  _summaryNHp,
1290  _summaryByOriginalAlgoHp,
1291  _summaryByOriginalAlgoNHp,
1292  _summaryByAlgoMaskHp,
1293  _summaryByAlgoMaskNHp,
1294  _summaryPt09Hp,
1295  _summaryPt09NHp,
1296 ]
1297 _summaryPlotsSeeds = [
1298  _summarySeeds,
1299  _summarySeedsN,
1300 ]
1301 _packedCandidatePlots = [
1302  _packedCandidateFlow,
1303  _packedCandidateKinematics,
1304  _packedCandidateVertex,
1305  _packedCandidateImpactParameter1,
1306  _packedCandidateImpactParameter2,
1307  _packedCandidateCovarianceMatrix1,
1308  _packedCandidateCovarianceMatrix2,
1309  _packedCandidateHits,
1310  _packedCandidateHitsHitPattern,
1311  _packedCandidateLayers,
1312 ]
1313 plotter = Plotter()
1314 plotterExt = Plotter()
1315 def _appendTrackingPlots(lastDirName, name, algoPlots, onlyForPileup=False, onlyForElectron=False, onlyForConversion=False, onlyForBHadron=False, seeding=False, building=False, rawSummary=False, highPuritySummary=True):
1316  folders = _trackingFolders(lastDirName)
1317  # to keep backward compatibility, this set of plots has empty name
1318  limiters = dict(onlyForPileup=onlyForPileup, onlyForElectron=onlyForElectron, onlyForConversion=onlyForConversion, onlyForBHadron=onlyForBHadron)
1319  commonForTPF = dict(purpose=PlotPurpose.TrackingIteration, fallbackRefFiles=[
1320  _trackingRefFileFallbackSLHC_Phase1PU140
1321  ], **limiters)
1322  common = dict(fallbackDqmSubFolders=[
1323  _trackingSubFoldersFallbackSLHC_Phase1PU140,
1324  _trackingSubFoldersFallbackFromPV, _trackingSubFoldersFallbackConversion,
1325  _trackingSubFoldersFallbackPreSplitting])
1326  plotter.append(name, folders, TrackingPlotFolder(*algoPlots, **commonForTPF), **common)
1327  extendedPlots = []
1328  if building:
1329  extendedPlots.extend(_buildingExtendedPlots)
1330  extendedPlots.extend(_extendedPlots)
1331  plotterExt.append(name, folders, TrackingPlotFolder(*extendedPlots, **commonForTPF), **common)
1332 
1333  summaryName = ""
1334  if name != "":
1335  summaryName += name+"_"
1336  summaryName += "summary"
1337  summaryPlots = []
1338  if rawSummary:
1339  summaryPlots.extend([_summaryRaw, _summaryRawN])
1340  summaryPlots.extend(_summaryPlots)
1341 
1342  common = dict(loopSubFolders=False, purpose=PlotPurpose.TrackingSummary, page="summary",
1343  #numberOfEventsHistogram=_trackingNumberOfEventsHistogram, # FIXME
1344  **limiters)
1345  plotter.append(summaryName, folders,
1346  PlotFolder(*summaryPlots, section=name, **common))
1347  if highPuritySummary:
1348  plotter.append(summaryName+"_highPurity", folders,
1349  PlotFolder(*_summaryPlotsHp, section=name+"_highPurity" if name != "" else "highPurity", **common),
1350  fallbackNames=[summaryName]) # backward compatibility for release validation, the HP plots used to be in the same directory with all-track plots
1351  if seeding:
1352  plotter.append(summaryName+"_seeds", folders,
1353  PlotFolder(*_summaryPlotsSeeds, section=name+"_seeds", **common))
1354 
1355  plotter.appendTable(summaryName, folders, TrackingSummaryTable(section=name))
1356  plotter.appendTable(summaryName, folders, TrackingSummaryTable(section=name+"Pt09", collection=TrackingSummaryTable.GeneralTracksPt09))
1357  if highPuritySummary:
1358  sectionName = name+"_highPurity" if name != "" else "highPurity"
1359  plotter.appendTable(summaryName+"_highPurity", folders, TrackingSummaryTable(section=sectionName, collection=TrackingSummaryTable.HighPurity))
1360  plotter.appendTable(summaryName+"_highPurity", folders, TrackingSummaryTable(section=sectionName+"Pt09", collection=TrackingSummaryTable.HighPurityPt09))
1361  if name == "":
1362  plotter.appendTable(summaryName, folders, TrackingSummaryTable(section="btvLike", collection=TrackingSummaryTable.BTVLike))
1363  plotter.appendTable(summaryName, folders, TrackingSummaryTable(section="ak4PFJets", collection=TrackingSummaryTable.AK4PFJets))
1364 _appendTrackingPlots("Track", "", _simBasedPlots+_recoBasedPlots)
1365 _appendTrackingPlots("TrackTPPtLess09", "tpPtLess09", _simBasedPlots)
1366 _appendTrackingPlots("TrackTPEtaGreater2p7", "tpEtaGreater2p7", _simBasedPlots+_recoBasedPlots)
1367 _appendTrackingPlots("TrackAllTPEffic", "allTPEffic", _simBasedPlots, onlyForPileup=True)
1368 _appendTrackingPlots("TrackFromPV", "fromPV", _simBasedPlots+_recoBasedPlots, onlyForPileup=True)
1369 _appendTrackingPlots("TrackFromPVAllTP", "fromPVAllTP", _simBasedPlots+_recoBasedPlots, onlyForPileup=True)
1370 _appendTrackingPlots("TrackFromPVAllTP2", "fromPVAllTP2", _simBasedPlots+_recoBasedPlots, onlyForPileup=True)
1371 _appendTrackingPlots("TrackSeeding", "seeding", _seedingBuildingPlots, seeding=True)
1372 _appendTrackingPlots("TrackBuilding", "building", _seedingBuildingPlots, building=True)
1373 _appendTrackingPlots("TrackConversion", "conversion", _simBasedPlots+_recoBasedPlots, onlyForConversion=True, rawSummary=True, highPuritySummary=False)
1374 _appendTrackingPlots("TrackGsf", "gsf", _simBasedPlots+_recoBasedPlots, onlyForElectron=True, rawSummary=True, highPuritySummary=False)
1375 _appendTrackingPlots("TrackBHadron", "bhadron", _simBasedPlots+_recoBasedPlots, onlyForBHadron=True)
1376 # Pixel tracks
1377 _common = dict(purpose=PlotPurpose.Pixel, page="pixel")
1378 plotter.append("pixelTrack", _trackingFolders("PixelTrack"), TrackingPlotFolder(*(_simBasedPlots+_recoBasedPlots), **_common))
1379 plotterExt.append("pixelTrack", _trackingFolders("PixelTrack"), TrackingPlotFolder(*_extendedPlots, **_common))
1380 plotter.append("pixelTrack_summary", _trackingFolders("PixelTrack"), PlotFolder(_summaryRaw, _summaryRawN, loopSubFolders=False, purpose=PlotPurpose.TrackingSummary, page="summary", section="pixel"))
1381 plotter.appendTable("pixelTrack_summary", _trackingFolders("PixelTrack"), TrackingSummaryTable(section="pixel", collection=TrackingSummaryTable.Pixel))
1382 
1383 
1384 # MiniAOD
1385 plotter.append("packedCandidate", _trackingFolders("PackedCandidate"),
1386  PlotFolder(*_packedCandidatePlots, loopSubFolders=False,
1387  purpose=PlotPurpose.MiniAOD, page="miniaod", section="PackedCandidate"))
1388 plotter.append("packedCandidateLostTracks", _trackingFolders("PackedCandidate/lostTracks"),
1389  PlotFolder(*_packedCandidatePlots, loopSubFolders=False,
1390  purpose=PlotPurpose.MiniAOD, page="miniaod", section="PackedCandidate (lostTracks)"))
1391 
1392 # HLT
1393 _hltFolder = [
1394  "DQMData/Run 1/HLT/Run summary/Tracking/ValidationWRTtp",
1395 ]
1396 plotterHLT = Plotter()
1397 plotterHLTExt = Plotter()
1398 _common = dict(purpose=PlotPurpose.HLT, page="hlt")
1399 plotterHLT.append("hlt", _hltFolder, TrackingPlotFolder(*(_simBasedPlots+_recoBasedPlots), **_common))
1400 plotterHLTExt.append("hlt", _hltFolder, TrackingPlotFolder(*_extendedPlots, **_common))
1401 
1402 # Timing
1404  def __init__(self, name, clusterMasking=None, seeding=None, building=None, fit=None, selection=None, other=[]):
1405  self._name = name
1406 
1407  def _set(param, name, modules):
1408  if param is not None:
1409  setattr(self, name, param)
1410  else:
1411  setattr(self, name, modules)
1412 
1413  _set(clusterMasking, "_clusterMasking", [self._name+"Clusters"])
1414  # it's fine to include e.g. quadruplets here also for pair
1415  # steps, as non-existing modules are just ignored
1416  _set(seeding, "_seeding", [self._name+"SeedingLayers", self._name+"TrackingRegions", self._name+"HitDoublets", self._name+"HitTriplets", self._name+"HitQuadruplets", self._name+"Seeds"])
1417  _set(building, "_building", [self._name+"TrackCandidates"])
1418  _set(fit, "_fit", [self._name+"Tracks"])
1419  _set(selection, "_selection", [self._name])
1420  self._other = other
1421 
1422  def name(self):
1423  return self._name
1424 
1425  def all(self):
1426  return self._clusterMasking+self._seeding+self._building+self._fit+self._selection+self._other
1427 
1428  def clusterMasking(self):
1429  return self._clusterMasking
1430 
1431  def seeding(self):
1432  return self._seeding
1433 
1434  def building(self):
1435  return self._building
1436 
1437  def fit(self):
1438  return self._fit
1439 
1440  def selection(self):
1441  return self._selection
1442 
1443  def other(self):
1444  return self._other
1445 
1446  def modules(self):
1447  return [("ClusterMask", self.clusterMasking()),
1448  ("Seeding", self.seeding()),
1449  ("Building", self.building()),
1450  ("Fit", self.fit()),
1451  ("Selection", self.selection()),
1452  ("Other", self.other())]
1453 
1454 
1455 _iterations = [
1456  Iteration("initialStepPreSplitting", clusterMasking=[],
1457  seeding=["initialStepSeedLayersPreSplitting",
1458  "initialStepTrackingRegionsPreSplitting",
1459  "initialStepHitDoubletsPreSplitting",
1460  "initialStepHitTripletsPreSplitting",
1461  "initialStepHitQuadrupletsPreSplitting",
1462  "initialStepSeedsPreSplitting"],
1463  building=["initialStepTrackCandidatesPreSplitting"],
1464  fit=["initialStepTracksPreSplitting"],
1465  other=["firstStepPrimaryVerticesPreSplitting",
1466  "initialStepTrackRefsForJetsPreSplitting",
1467  "caloTowerForTrkPreSplitting",
1468  "ak4CaloJetsForTrkPreSplitting",
1469  "jetsForCoreTrackingPreSplitting",
1470  "siPixelClusters",
1471  "siPixelRecHits",
1472  "MeasurementTrackerEvent",
1473  "siPixelClusterShapeCache"]),
1474  Iteration("initialStep", clusterMasking=[],
1475  selection=["initialStepClassifier1",
1476  "initialStepClassifier2",
1477  "initialStepClassifier3",
1478  "initialStep",
1479  "initialStepSelector"],
1480  building=["initialStepTrackCandidatesMkFitInput",
1481  "initialStepTrackCandidatesMkFit",
1482  "initialStepTrackCandidates"],
1483  other=["firstStepPrimaryVerticesUnsorted",
1484  "initialStepTrackRefsForJets",
1485  "caloTowerForTrk",
1486  "ak4CaloJetsForTrk",
1487  "firstStepPrimaryVertices"]),
1488  Iteration("highPtTripletStep",
1489  selection=["highPtTripletStepClassifier1",
1490  "highPtTripletStepClassifier2",
1491  "highPtTripletStepClassifier3",
1492  "highPtTripletStep",
1493  "highPtTripletStepSelector"]),
1494  Iteration("detachedQuadStep",
1495  selection=["detachedQuadStepClassifier1",
1496  "detachedQuadStepClassifier2",
1497  "detachedQuadStep",
1498  "detachedQuadStepSelector"]),
1499  Iteration("detachedTripletStep",
1500  selection=["detachedTripletStepClassifier1",
1501  "detachedTripletStepClassifier2",
1502  "detachedTripletStep",
1503  "detachedTripletStepSelector"]),
1504  Iteration("lowPtQuadStep",
1505  selection=["lowPtQuadStepClassifier1",
1506  "lowPtQuadStepClassifier2",
1507  "lowPtQuadStep",
1508  "lowPtQuadStepSelector"]),
1509  Iteration("lowPtTripletStep",
1510  selection=["lowPtTripletStepClassifier1",
1511  "lowPtTripletStepClassifier2",
1512  "lowPtTripletStep",
1513  "lowPtTripletStepSelector"]),
1514  Iteration("pixelPairStep",
1515  seeding=["pixelPairStepSeedLayers",
1516  "pixelPairStepSeedLayersB",
1517  "pixelPairStepSeedLayersC",
1518  "pixelPairStepTrackingRegions",
1519  "pixelPairStepTrackingRegionsB",
1520  "pixelPairStepTrackingRegionsC",
1521  "pixelPairStepTrackingRegionsSeedLayersB",
1522  "pixelPairStepHitDoublets",
1523  "pixelPairStepHitDoubletsB",
1524  "pixelPairStepHitDoubletsC",
1525  "pixelPairStepSeedsA",
1526  "pixelPairStepSeedsB",
1527  "pixelPairStepSeedsC",
1528  "pixelPairStepSeeds",],
1529  selection=["pixelPairStep",
1530  "pixelPairStepSelector"]),
1531  Iteration("mixedTripletStep",
1532  seeding=["mixedTripletStepSeedLayersA",
1533  "mixedTripletStepSeedLayersB",
1534  "mixedTripletStepTrackingRegionsA",
1535  "mixedTripletStepTrackingRegionsB",
1536  "mixedTripletStepHitDoubletsA",
1537  "mixedTripletStepHitDoubletsB",
1538  "mixedTripletStepHitTripletsA",
1539  "mixedTripletStepHitTripletsB",
1540  "mixedTripletStepSeedsA",
1541  "mixedTripletStepSeedsB",
1542  "mixedTripletStepSeeds"],
1543  selection=["mixedTripletStepClassifier1",
1544  "mixedTripletStepClassifier2",
1545  "mixedTripletStep",
1546  "mixedTripletStepSelector"]),
1547  Iteration("pixelLessStep",
1548  selection=["pixelLessStepClassifier1",
1549  "pixelLessStepClassifier2",
1550  "pixelLessStep",
1551  "pixelLessStepSelector"]),
1552  Iteration("tobTecStep",
1553  seeding=["tobTecStepSeedLayersTripl",
1554  "tobTecStepSeedLayersPair",
1555  "tobTecStepTrackingRegionsTripl",
1556  "tobTecStepTrackingRegionsPair",
1557  "tobTecStepHitDoubletsTripl",
1558  "tobTecStepHitDoubletsPair",
1559  "tobTecStepHitTripletsTripl",
1560  "tobTecStepSeedsTripl",
1561  "tobTecStepSeedsPair",
1562  "tobTecStepSeeds"],
1563  selection=["tobTecStepClassifier1",
1564  "tobTecStepClassifier2",
1565  "tobTecStep",
1566  "tobTecStepSelector"]),
1567  Iteration("jetCoreRegionalStep",
1568  clusterMasking=[],
1569  other=["jetsForCoreTracking",
1570  "firstStepGoodPrimaryVertices",
1571  ]),
1572  Iteration("muonSeededSteps",
1573  clusterMasking=[],
1574  seeding=["muonSeededSeedsInOut",
1575  "muonSeededSeedsOutIn"],
1576  building=["muonSeededTrackCandidatesInOut",
1577  "muonSeededTrackCandidatesOutIn"],
1578  fit=["muonSeededTracksInOut",
1579  "muonSeededTracksOutIn"],
1580  selection=["muonSeededTracksInOutClassifier",
1581  "muonSeededTracksInOutSelector",
1582  "muonSeededTracksOutIntClassifier",
1583  "muonSeededTracksOutIntSelector"],
1584 # other=["earlyMuons"]
1585  ),
1586  Iteration("duplicateMerge",
1587  clusterMasking=[], seeding=[],
1588  building=["duplicateTrackCandidates"],
1589  fit=["mergedDuplicateTracks"],
1590  selection=["duplicateTrackClassifier"]),
1591  Iteration("generalTracks",
1592  clusterMasking=[], seeding=[], building=[], fit=[], selection=[],
1593  other=["preDuplicateMergingGeneralTracks",
1594  "generalTracks"]),
1595  Iteration("ConvStep",
1596  clusterMasking=["convClusters"],
1597  seeding=["convLayerPairs",
1598  "photonConvTrajSeedFromSingleLeg"],
1599  building=["convTrackCandidates"],
1600  fit=["convStepTracks"],
1601  selection=["convStepSelector"]),
1602  Iteration("Other", clusterMasking=[], seeding=[], building=[], fit=[], selection=[],
1603  other=["trackerClusterCheckPreSplitting",
1604  "trackerClusterCheck"]),
1605 ]
1606 
1607 def _iterModuleMap(includeConvStep=True, onlyConvStep=False):
1608  iterations = _iterations
1609  if not includeConvStep:
1610  iterations = [i for i in iterations if i.name() != "ConvStep"]
1611  if onlyConvStep:
1612  iterations = [i for i in iterations if i.name() == "ConvStep"]
1613  return collections.OrderedDict([(i.name(), i.all()) for i in iterations])
1615  def getProp(prop):
1616  ret = []
1617  for i in _iterations:
1618  if i.name() == "ConvStep":
1619  continue
1620  ret.extend(getattr(i, prop)())
1621  return ret
1622 
1623  return collections.OrderedDict([
1624  ("ClusterMask", getProp("clusterMasking")),
1625  ("Seeding", getProp("seeding")),
1626  ("Building", getProp("building")),
1627  ("Fitting", getProp("fit")),
1628  ("Selection", getProp("selection")),
1629  ("Other", getProp("other"))
1630  ])
1631 
1633  def __init__(self, name, timeHisto):
1634  self._name = name
1635  self._timeHisto = timeHisto
1636  self._eventsHisto = "path time_real"
1637  self._cache = {}
1638 
1639  def __str__(self):
1640  return self._name
1641 
1642  def _create(self, tdirectory):
1643  timeTh1 = plotting._getOrCreateObject(tdirectory, self._timeHisto)
1644  if timeTh1 is None:
1645  return None
1646 
1647  eventsTh1 = plotting._getOrCreateObject(tdirectory, self._eventsHisto)
1648  if eventsTh1 is None:
1649  return None
1650  nevents = eventsTh1.GetEntries()
1651  if nevents == 0:
1652  return None
1653 
1654  ret = timeTh1.Clone(self._name)
1655  xaxis = ret.GetXaxis()
1656  for i in range(1, ret.GetNbinsX()+1):
1657  ret.SetBinContent(i, ret.GetBinContent(i)/nevents)
1658  ret.SetBinError(i, ret.GetBinError(i)/nevents)
1659  xaxis.SetBinLabel(i, xaxis.GetBinLabel(i).replace(" (unscheduled)", ""))
1660  return ret
1661 
1662  def create(self, tdirectory):
1663  path = tdirectory.GetPath()
1664  if path not in self._cache:
1665  self._cache[path] = self._create(tdirectory)
1666  return self._cache[path]
1667 
1669  def __init__(self, name, timeHisto, selectedTracks=False):
1670  self._name = name
1671  self._timeHisto = timeHisto
1672  self._selectedTracks = selectedTracks
1673 
1674  def __str__(self):
1675  return self._name
1676 
1677  def _getDirectory(self, tfile):
1678  for dirName in _trackingFolders():
1679  tdir = tfile.Get(dirName)
1680  if tdir != None:
1681  return tdir
1682  return None
1683 
1684  def create(self, tdirectory):
1685  timeTh1 = plotting._getOrCreateObject(tdirectory, self._timeHisto)
1686  if timeTh1 is None:
1687  return None
1688 
1689  # this is bit of a hack, but as long as it is needed only
1690  # here, I won't invest in better solution
1691  tfile = tdirectory.GetFile()
1692  trkDir = self._getDirectory(tfile)
1693  if trkDir is None:
1694  return None
1695 
1696  iterMap = copy.copy(_collLabelMapHp)
1697  del iterMap["generalTracks"]
1698  del iterMap["jetCoreRegionalStep"] # this is expensive per track on purpose
1699  if self._selectedTracks:
1700  renameBin = lambda bl: _summaryBinRename(bl, highPurity=True, byOriginalAlgo=False, byAlgoMask=True, ptCut=False, seeds=False)
1701  else:
1702  renameBin = lambda bl: _summaryBinRename(bl, highPurity=False, byOriginalAlgo=False, byAlgoMask=False, ptCut=False, seeds=False)
1703  recoAB = AggregateBins("tmp", "num_reco_coll", mapping=iterMap,ignoreMissingBins=True, renameBin=renameBin)
1704  h_reco_per_iter = recoAB.create(trkDir)
1705  if h_reco_per_iter is None:
1706  return None
1707  values = {}
1708  for i in range(1, h_reco_per_iter.GetNbinsX()+1):
1709  values[h_reco_per_iter.GetXaxis().GetBinLabel(i)] = h_reco_per_iter.GetBinContent(i)
1710 
1711 
1712  result = []
1713  for i in range(1, timeTh1.GetNbinsX()+1):
1714  iterName = timeTh1.GetXaxis().GetBinLabel(i)
1715  if iterName in values:
1716  ntrk = values[iterName]
1717  result.append( (iterName,
1718  timeTh1.GetBinContent(i)/ntrk if ntrk > 0 else 0,
1719  timeTh1.GetBinError(i)/ntrk if ntrk > 0 else 0) )
1720 
1721  if len(result) == 0:
1722  return None
1723 
1724  res = ROOT.TH1F(self._name, self._name, len(result), 0, len(result))
1725  for i, (label, value, error) in enumerate(result):
1726  res.GetXaxis().SetBinLabel(i+1, label)
1727  res.SetBinContent(i+1, value)
1728  res.SetBinError(i+1, error)
1729 
1730  return res
1731 
1733  def __init__(self):
1734  self._cache = {}
1735 
1736  def _findOrder(self, f):
1737  h = f.Get(_trackingIterationOrderHistogram)
1738  if not h:
1739  return None
1740  xaxis = h.GetXaxis()
1741  def _edit(s):
1742  # remove "Tracks" from the track producer name to get the iteration name
1743  # muonSeeded iterations do not have "Step" in the producer name, so add it here
1744  return s.replace("Tracks", "").replace("muonSeeded", "muonSeededStep")
1745  return [_edit(xaxis.GetBinLabel(i)) for i in range(1, h.GetNbinsX()+1)]
1746 
1747  def __call__(self, tdirectory, labels):
1748  ret = list(range(0, len(labels)))
1749  f = tdirectory.GetFile()
1750  if not f:
1751  return ret
1752 
1753  if not f.GetName() in self._cache:
1754  r = self._findOrder(f)
1755  if r is None:
1756  return ret
1757  self._cache[f.GetName()] = r
1758  order = self._cache[f.GetName()]
1759 
1760  # O(N^2) I know, but we're talking about O(10) elements...
1761  orderIndices = []
1762  for l in order:
1763  try:
1764  orderIndices.append(labels.index(l))
1765  except ValueError:
1766  pass
1767  ret = []
1768  for i, l in enumerate(labels):
1769  if l in order:
1770  try:
1771  found = orderIndices.index(i)
1772  if found == 0:
1773  ret.append(i)
1774  else:
1775  ret.append(orderIndices[0])
1776  except ValueError:
1777  ret.append(orderIndices[0])
1778  orderIndices.pop(0)
1779  else:
1780  ret.append(i)
1781  return ret
1782 
1783 _time_per_event_cpu = TimePerEventPlot("timePerEvent", "module_time_thread_total")
1784 _time_per_event_real = TimePerEventPlot("timePerEvent", "module_time_real_total")
1785 
1787  def __init__(self):
1789  self._page = "timing"
1790  self._section = "timing"
1791 
1792  def getPurpose(self):
1793  return self._purpose
1794 
1795  def getPage(self):
1796  return self._page
1797 
1798  def getSection(self, dqmSubFolder):
1799  return self._section
1800 
1801  def _getValues(self, tdirectory, histo):
1802  h = tdirectory.Get(histo)
1803  totalReco = None
1804  if h:
1805  totalReco = "%.1f" % h.Integral()
1806 
1807  creator = AggregateBins("iteration", histo, _iterModuleMap(includeConvStep=False), ignoreMissingBins=True)
1808  h = creator.create(tdirectory)
1809  totalTracking = None
1810  if h:
1811  totalTracking = "%.1f" % h.Integral()
1812 
1813  creator = AggregateBins("iteration", histo, _iterModuleMap(onlyConvStep=True), ignoreMissingBins=True)
1814  h = creator.create(tdirectory)
1815  totalConvStep = None
1816  if h:
1817  totalConvStep = "%.1f" % h.Integral()
1818 
1819  return [
1820  totalReco,
1821  totalTracking,
1822  totalConvStep,
1823  ]
1824 
1825  def create(self, tdirectory):
1826  cpuValues = self._getValues(tdirectory, _time_per_event_cpu)
1827  realValues = self._getValues(tdirectory, _time_per_event_real)
1828 
1829  return cpuValues + realValues
1830 
1831  def headers(self):
1832  return [
1833  "Average reco CPU time / event (ms)",
1834  "Average tracking (w/o convStep) CPU time / event (ms)",
1835  "Average convStep CPU time / event (ms)",
1836  "Average reco real time / event (ms)",
1837  "Average tracking (w/o convStep) real time / event (ms)",
1838  "Average convStep real time / event (ms)",
1839  ]
1840 
1841 _common = {
1842  "drawStyle": "P",
1843  "xbinlabelsize": 10,
1844  "xbinlabeloption": "d"
1845 }
1846 
1847 _iteration_reorder = TrackingIterationOrder()
1848 _time_per_iter_cpu = AggregateBins("iteration", _time_per_event_cpu, _iterModuleMap(), ignoreMissingBins=True, reorder=_iteration_reorder)
1849 _time_per_iter_real = AggregateBins("iteration", _time_per_event_real, _iterModuleMap(), ignoreMissingBins=True, reorder=_iteration_reorder)
1850 
1851 _timing_summaryCPU = PlotGroup("summaryCPU", [
1852  Plot(_time_per_iter_cpu,
1853  ytitle="Average CPU time (ms)", title="Average CPU time / event", legendDx=-0.4, **_common),
1854  Plot(AggregateBins("iteration_fraction", _time_per_event_cpu, _iterModuleMap(), ignoreMissingBins=True, reorder=_iteration_reorder),
1855  ytitle="Fraction", title="", normalizeToUnitArea=True, **_common),
1856  #
1857  Plot(AggregateBins("step", _time_per_event_cpu, _stepModuleMap(), ignoreMissingBins=True),
1858  ytitle="Average CPU time (ms)", title="Average CPU time / event", **_common),
1859  Plot(AggregateBins("step_fraction", _time_per_event_cpu, _stepModuleMap(), ignoreMissingBins=True),
1860  ytitle="Fraction", title="", normalizeToUnitArea=True, **_common),
1861  #
1862  Plot(TimePerTrackPlot("iteration_track", _time_per_iter_cpu, selectedTracks=False),
1863  ytitle="Average CPU time / built track (ms)", title="Average CPU time / built track", **_common),
1864  Plot(TimePerTrackPlot("iteration_trackhp", _time_per_iter_cpu, selectedTracks=True),
1865  ytitle="Average CPU time / selected track (ms)", title="Average CPU time / selected HP track by algoMask", **_common),
1866  ],
1867 )
1868 _timing_summaryReal = PlotGroup("summaryReal", [
1869  Plot(_time_per_iter_real,
1870  ytitle="Average real time (ms)", title="Average real time / event", legendDx=-0.4, **_common),
1871  Plot(AggregateBins("iteration_fraction", _time_per_event_real, _iterModuleMap(), ignoreMissingBins=True, reorder=_iteration_reorder),
1872  ytitle="Fraction", title="", normalizeToUnitArea=True, **_common),
1873  #
1874  Plot(AggregateBins("step", _time_per_event_real, _stepModuleMap(), ignoreMissingBins=True),
1875  ytitle="Average real time (ms)", title="Average real time / event", **_common),
1876  Plot(AggregateBins("step_fraction", _time_per_event_real, _stepModuleMap(), ignoreMissingBins=True),
1877  ytitle="Fraction", title="", normalizeToUnitArea=True, **_common),
1878  #
1879  Plot(TimePerTrackPlot("iteration_track", _time_per_iter_real, selectedTracks=False),
1880  ytitle="Average real time / built track (ms)", title="Average real time / built track", **_common),
1881  Plot(TimePerTrackPlot("iteration_trackhp", _time_per_iter_real, selectedTracks=True),
1882  ytitle="Average real time / selected track (ms)", title="Average real time / selected HP track by algoMask", **_common),
1883  ],
1884 )
1885 
1886 _timing_iterationsCPU = PlotGroup("iterationsCPU", [
1887  Plot(AggregateBins(i.name(), _time_per_event_cpu, collections.OrderedDict(i.modules()), ignoreMissingBins=True),
1888  ytitle="Average CPU time (ms)", title=i.name(), **_common)
1889  for i in _iterations
1890 ],
1891  ncols=4, legend=False
1892 )
1893 _timing_iterationsReal = PlotGroup("iterationsReal", [
1894  Plot(AggregateBins(i.name(), _time_per_event_real, collections.OrderedDict(i.modules()), ignoreMissingBins=True),
1895  ytitle="Average real time (ms)", title=i.name(), **_common)
1896  for i in _iterations
1897 ],
1898  ncols=4, legend=False
1899 )
1900 
1901 # TODO: to be updated to new FastTimerService format later
1902 #_pixelTiming = PlotGroup("pixelTiming", [
1903 # Plot(AggregateBins("pixel", "reconstruction_step_module_average", {"pixelTracks": ["pixelTracks"]}), ytitle="Average processing time [ms]", title="Average processing time / event", drawStyle="HIST")
1904 #])
1905 
1906 _timeFolders = [
1907 # "DQMData/Run 1/DQM/Run summary/TimerService/process RECO paths/path reconstruction_step",
1908  "DQMData/Run 1/DQM/Run summary/TimerService/process RECO paths/path prevalidation_step", # because of unscheduled, it's actually prevalidation_step that has all the tracking modules?
1909 ]
1910 timePlotter = Plotter()
1911 timePlotter.append("timing", _timeFolders, PlotFolder(
1912  _timing_summaryCPU,
1913  _timing_iterationsCPU,
1914  _timing_summaryReal,
1915  _timing_iterationsReal,
1916  # _pixelTiming,
1917  loopSubFolders=False, purpose=PlotPurpose.Timing, page="timing"
1918 ))
1919 timePlotter.appendTable("timing", _timeFolders, TrackingTimingTable())
1920 
1921 _common = {"stat": True, "normalizeToUnitArea": True, "drawStyle": "hist"}
1922 _tplifetime = PlotGroup("tplifetime", [
1923  Plot("TPlip", xtitle="TP lip", **_common),
1924  Plot("TPtip", xtitle="TP tip", **_common),
1925 ])
1926 
1927 tpPlotter = Plotter()
1928 tpPlotter.append("tp", [
1929  "DQMData/Run 1/Tracking/Run summary/TrackingMCTruth/TrackingParticle",
1930  "DQMData/Tracking/TrackingMCTruth/TrackingParticle",
1931 ], PlotFolder(
1932  _tplifetime,
1933 ))
trackingPlots.TrackingSeedingLayerTable._fileName
_fileName
Definition: trackingPlots.py:1055
trackingPlots.Iteration.clusterMasking
def clusterMasking(self)
Definition: trackingPlots.py:1428
trackingPlots._makeDistPlots
def _makeDistPlots(postfix, quantity, common={})
Definition: trackingPlots.py:107
trackingPlots.TimePerTrackPlot._selectedTracks
_selectedTracks
Definition: trackingPlots.py:1672
trackingPlots._trackingFolders
def _trackingFolders(lastDirName="Track")
Definition: trackingPlots.py:1196
trackingPlots.Iteration._other
_other
Definition: trackingPlots.py:1420
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
trackingPlots.TrackingSummaryTable.HighPurityPt09
Definition: trackingPlots.py:958
plotting.Plot
Definition: plotting.py:1694
trackingPlots.TrackingSummaryTable._purpose
_purpose
Definition: trackingPlots.py:965
trackingPlots.TimePerTrackPlot.create
def create(self, tdirectory)
Definition: trackingPlots.py:1684
trackingPlots.TrackingSummaryTable._collection
_collection
Definition: trackingPlots.py:964
trackingPlots.TimePerEventPlot._timeHisto
_timeHisto
Definition: trackingPlots.py:1635
plotting.PlotFolder
Definition: plotting.py:2543
trackingPlots.TimePerEventPlot._eventsHisto
_eventsHisto
Definition: trackingPlots.py:1636
plotting.FakeDuplicate
Definition: plotting.py:845
html.PlotPurpose.TrackingIteration
Definition: html.py:301
plotting._mergeBinLabelsX
def _mergeBinLabelsX(histos)
Definition: plotting.py:706
trackingPlots.TrackingPlotFolder.iterSelectionName
def iterSelectionName(self, plotFolderName, translatedDqmSubFolder)
Definition: trackingPlots.py:925
trackingPlots.Iteration.fit
def fit(self)
Definition: trackingPlots.py:1437
trackingPlots.TrackingSeedingLayerTable.create
def create(self, tdirectoryNEvents, requireAllHistograms=False)
Definition: trackingPlots.py:1070
trackingPlots.Iteration.other
def other(self)
Definition: trackingPlots.py:1443
trackingPlots.TrackingTimingTable._purpose
_purpose
Definition: trackingPlots.py:1788
trackingPlots._makeFakeDist
def _makeFakeDist(postfix)
Definition: trackingPlots.py:104
trackingPlots.TrackingSummaryTable.GeneralTracks
Definition: trackingPlots.py:955
trackingPlots._trackingSubFoldersFallbackPreSplitting
def _trackingSubFoldersFallbackPreSplitting(subfolder)
Definition: trackingPlots.py:596
trackingPlots.Iteration.seeding
def seeding(self)
Definition: trackingPlots.py:1431
trackingPlots.Iteration.name
def name(self)
Definition: trackingPlots.py:1422
trackingPlots.Iteration._name
_name
Definition: trackingPlots.py:1405
trackingPlots.TrackingTimingTable
Definition: trackingPlots.py:1786
trackingPlots.TrackingSeedingLayerTable.draw
def draw(self, legendLabels, prefix=None, directory="", *args, **kwargs)
Definition: trackingPlots.py:1075
trackingPlots.TrackingPlotFolder._fallbackRefFiles
_fallbackRefFiles
Definition: trackingPlots.py:915
trackingPlots.TimePerEventPlot.__init__
def __init__(self, name, timeHisto)
Definition: trackingPlots.py:1633
html.PlotPurpose.MiniAOD
Definition: html.py:304
html.PlotPurpose.HLT
Definition: html.py:306
trackingPlots.TrackingSummaryTable.getPage
def getPage(self)
Definition: trackingPlots.py:972
trackingPlots.TrackingSummaryTable._page
_page
Definition: trackingPlots.py:966
plotting.CutEfficiency
Definition: plotting.py:897
plotting.PlotOnSideGroup
Definition: plotting.py:2516
trackingPlots.TrackingSeedingLayerTable._format
_format
Definition: trackingPlots.py:1056
trackingPlots._stepModuleMap
def _stepModuleMap()
Definition: trackingPlots.py:1614
trackingPlots._makeDistSimPlots
def _makeDistSimPlots(postfix, quantity, common={})
Definition: trackingPlots.py:121
trackingPlots.Iteration.modules
def modules(self)
Definition: trackingPlots.py:1446
trackingPlots._summaryBinRename
def _summaryBinRename(binLabel, highPurity, byOriginalAlgo, byAlgoMask, ptCut, seeds)
Definition: trackingPlots.py:672
trackingPlots._iterModuleMap
def _iterModuleMap(includeConvStep=True, onlyConvStep=False)
Definition: trackingPlots.py:1607
trackingPlots.TimePerEventPlot._name
_name
Definition: trackingPlots.py:1634
html.PlotPurpose.Timing
Definition: html.py:305
trackingPlots._collhelper
def _collhelper(name)
Definition: trackingPlots.py:668
trackingPlots.TrackingPlotFolder
Definition: trackingPlots.py:913
trackingPlots.TrackingTimingTable.__init__
def __init__(self)
Definition: trackingPlots.py:1787
trackingPlots.TrackingSeedingLayerTable.__init__
def __init__(self, fileName, plots, titles, isRate, **kwargs)
Definition: trackingPlots.py:1052
html.Table
Definition: html.py:253
trackingPlots.TimePerTrackPlot.__init__
def __init__(self, name, timeHisto, selectedTracks=False)
Definition: trackingPlots.py:1669
trackingPlots.TimePerEventPlot.__str__
def __str__(self)
Definition: trackingPlots.py:1639
trackingPlots.TrackingTimingTable.getSection
def getSection(self, dqmSubFolder)
Definition: trackingPlots.py:1798
trackingPlots.TrackingPlotFolder.isAlgoIterative
def isAlgoIterative(self, algo)
Definition: trackingPlots.py:951
trackingPlots.TrackingPlotFolder.translateSubFolder
def translateSubFolder(self, dqmSubFolderName)
Definition: trackingPlots.py:918
trackingPlots.TrackingSeedingLayerTable._titles
_titles
Definition: trackingPlots.py:1054
trackingPlots.Iteration.building
def building(self)
Definition: trackingPlots.py:1434
plotting._th1IncludeOnlyBins
def _th1IncludeOnlyBins(histos, xbinlabels)
Definition: plotting.py:743
trackingPlots.TrackingSummaryTable.BTVLike
Definition: trackingPlots.py:959
trackingPlots._mapCollectionToAlgoQuality
def _mapCollectionToAlgoQuality(collName)
Definition: trackingPlots.py:606
str
#define str(s)
Definition: TestProcessor.cc:48
trackingPlots.TrackingPlotFolder.__init__
def __init__(self, *args, **kwargs)
Definition: trackingPlots.py:914
trackingPlots.TrackingIterationOrder._findOrder
def _findOrder(self, f)
Definition: trackingPlots.py:1736
trackingPlots.Iteration.all
def all(self)
Definition: trackingPlots.py:1425
html.PlotPurpose.Pixel
Definition: html.py:307
html.PlotPurpose.TrackingSummary
Definition: html.py:302
plotting._th1RemoveEmptyBins
def _th1RemoveEmptyBins(histos, xbinlabels)
Definition: plotting.py:606
plotting.Plotter
Definition: plotting.py:2962
trackingPlots.TrackingSummaryTable
Definition: trackingPlots.py:954
trackingPlots.TrackingSummaryTable.Pixel
Definition: trackingPlots.py:961
trackingPlots.TrackingIterationOrder.__init__
def __init__(self)
Definition: trackingPlots.py:1733
trackingPlots._minMaxResidual
def _minMaxResidual(ma)
Definition: trackingPlots.py:45
trackingPlots._trackingSubFoldersFallbackSLHC_Phase1PU140
def _trackingSubFoldersFallbackSLHC_Phase1PU140(subfolder)
Definition: trackingPlots.py:566
plotting.Subtract
Definition: plotting.py:760
trackingPlots.TrackingSummaryTable.create
def create(self, tdirectory)
Definition: trackingPlots.py:978
trackingPlots.TrackingSeedingLayerTable._plots
_plots
Definition: trackingPlots.py:1053
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
trackingPlots.Iteration.__init__
def __init__(self, name, clusterMasking=None, seeding=None, building=None, fit=None, selection=None, other=[])
Definition: trackingPlots.py:1404
Exception
trackingPlots.TrackingTimingTable._section
_section
Definition: trackingPlots.py:1790
trackingPlots.TrackingIterationOrder
Definition: trackingPlots.py:1732
trackingPlots.TimePerEventPlot.create
def create(self, tdirectory)
Definition: trackingPlots.py:1662
trackingPlots.TimePerTrackPlot._timeHisto
_timeHisto
Definition: trackingPlots.py:1671
trackingPlots.TrackingIterationOrder.__call__
def __call__(self, tdirectory, labels)
Definition: trackingPlots.py:1747
trackingPlots.Iteration.selection
def selection(self)
Definition: trackingPlots.py:1440
trackingPlots._trackingSubFoldersFallbackConversion
def _trackingSubFoldersFallbackConversion(subfolder)
Definition: trackingPlots.py:594
trackingPlots._appendTrackingPlots
def _appendTrackingPlots(lastDirName, name, algoPlots, onlyForPileup=False, onlyForElectron=False, onlyForConversion=False, onlyForBHadron=False, seeding=False, building=False, rawSummary=False, highPuritySummary=True)
Definition: trackingPlots.py:1315
trackingPlots.TrackingSummaryTable.HighPurity
Definition: trackingPlots.py:957
trackingPlots.TimePerTrackPlot._name
_name
Definition: trackingPlots.py:1670
TrackCollections2monitor_cff.func
func
Definition: TrackCollections2monitor_cff.py:359
trackingPlots.TrackingTimingTable.getPurpose
def getPurpose(self)
Definition: trackingPlots.py:1792
trackingPlots._trackingSubFoldersFallbackFromPV
def _trackingSubFoldersFallbackFromPV(subfolder)
Definition: trackingPlots.py:592
ComparisonHelper::zip
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
Definition: L1TStage2CaloLayer1.h:38
plotting.ROC
Definition: plotting.py:1120
plotting._getOrCreateObject
def _getOrCreateObject(tdirectory, nameOrCreator)
Definition: plotting.py:58
plotting.Transform
Definition: plotting.py:808
trackingPlots.TrackingPlotFolder.limitSubFolder
def limitSubFolder(self, limitOnlyTo, translatedDqmSubFolder)
Definition: trackingPlots.py:940
trackingPlots.TrackingSummaryTable.headers
def headers(self)
Definition: trackingPlots.py:1035
trackingPlots.TimePerEventPlot._create
def _create(self, tdirectory)
Definition: trackingPlots.py:1642
plotting.AggregateBins
Definition: plotting.py:947
trackingPlots.TrackingSummaryTable.getSection
def getSection(self, dqmSubFolder)
Definition: trackingPlots.py:975
trackingPlots.TrackingTimingTable._page
_page
Definition: trackingPlots.py:1789
trackingPlots._makeMVAPlots
def _makeMVAPlots(num, hp=False)
Definition: trackingPlots.py:133
trackingPlots.TrackingSummaryTable.GeneralTracksPt09
Definition: trackingPlots.py:956
trackingPlots._trackingRefFileFallbackSLHC_Phase1PU140
def _trackingRefFileFallbackSLHC_Phase1PU140(path)
Definition: trackingPlots.py:580
pileupCalc.upper
upper
Definition: pileupCalc.py:214
trackingPlots.TrackingSeedingLayerTable
Definition: trackingPlots.py:1051
trackingPlots.TrackingTimingTable.create
def create(self, tdirectory)
Definition: trackingPlots.py:1825
trackingPlots.TimePerTrackPlot._getDirectory
def _getDirectory(self, tfile)
Definition: trackingPlots.py:1677
trackingPlots.TrackingTimingTable._getValues
def _getValues(self, tdirectory, histo)
Definition: trackingPlots.py:1801
plotting._th1ToOrderedDict
def _th1ToOrderedDict(th1, renameBin=None)
Definition: plotting.py:101
trackingPlots.TrackingTimingTable.getPage
def getPage(self)
Definition: trackingPlots.py:1795
trackingPlots.TimePerEventPlot
Definition: trackingPlots.py:1632
trackingPlots.fallback
fallback
Definition: trackingPlots.py:364
trackingPlots.TrackingSummaryTable._section
_section
Definition: trackingPlots.py:967
plotting.PlotEmpty
Definition: plotting.py:1674
list
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*", "!HLTx*" if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL. It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of "!*" before the partial wildcard feature was incorporated). Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
trackingPlots.TimePerTrackPlot.__str__
def __str__(self)
Definition: trackingPlots.py:1674
genParticles_cff.map
map
Definition: genParticles_cff.py:11
trackingPlots._constructSummary
def _constructSummary(mapping=None, highPurity=False, byOriginalAlgo=False, byAlgoMask=False, ptCut=False, seeds=False, midfix="")
Definition: trackingPlots.py:707
trackingPlots.TimePerTrackPlot
Definition: trackingPlots.py:1668
trackingPlots.TrackingIterationOrder._cache
_cache
Definition: trackingPlots.py:1734
trackingPlots.TrackingSeedingLayerTable.onlyForPileup
def onlyForPileup(self)
Definition: trackingPlots.py:1066
trackingPlots.TrackingSummaryTable.__init__
def __init__(self, section, collection=GeneralTracks)
Definition: trackingPlots.py:963
trackingPlots._makeFakeDupPileupPlots
def _makeFakeDupPileupPlots(postfix, quantity, unit="", xquantity="", xtitle=None, common={})
Definition: trackingPlots.py:86
trackingPlots.Iteration
Definition: trackingPlots.py:1403
trackingPlots.TimePerEventPlot._cache
_cache
Definition: trackingPlots.py:1637
trackingPlots.TrackingSummaryTable.AK4PFJets
Definition: trackingPlots.py:960
plotting.PlotGroup
Definition: plotting.py:2246
trackingPlots._makeEffFakeDupPlots
def _makeEffFakeDupPlots(postfix, quantity, unit="", common={}, effopts={}, fakeopts={})
Definition: trackingPlots.py:67
trackingPlots.TrackingSummaryTable.getPurpose
def getPurpose(self)
Definition: trackingPlots.py:969
python.rootplot.root2matplotlib.replace
def replace(string, replacements)
Definition: root2matplotlib.py:444
trackingPlots.TrackingTimingTable.headers
def headers(self)
Definition: trackingPlots.py:1831