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