1 from Validation.RecoTrack.plotting.plotting
import Plot, PlotGroup, PlotFolder, Plotter
2 import Validation.RecoTrack.plotting.validation
as validation
3 from Validation.RecoTrack.plotting.html
import PlotPurpose
6 _minPU = [0, 10, 20, 40, 80, 120]
7 _maxPU = [60, 80, 100, 150, 200, 250]
9 _maxVtx = [60, 100, 150, 200, 250]
11 _maxFake = [0.05, 0.1, 0.2, 0.5, 0.7, 1.025]
12 _minMaxRes = [5, 10, 50, 100, 200, 500, 1000, 2000, 5000]
13 _minMaxPt = [5e-1, 1, 5, 1e1, 5e1, 1e2, 5e2, 1e3, 5e3, 1e4]
15 _vertexNumberOfEventsHistogram =
"DQMData/Run 1/Vertexing/Run summary/PrimaryVertexV/GenPV_Z" 17 _common = {
"xtitle":
"Simulated interactions",
"xmin": _minPU,
"xmax": _maxPU,
"ymin": _minVtx,
"ymax": _maxVtx}
18 _recovsgen = PlotGroup(
"recovsgen", [
19 Plot(
"RecoVtx_vs_GenVtx", ytitle=
"Reco vertices", **_common),
20 Plot(
"MatchedRecoVtx_vs_GenVtx", ytitle=
"Matched reco vertices", **_common),
21 Plot(
"merged_vs_ClosestVertexInZ", xtitle=
"Closest distance in Z (cm)", ytitle=
"Merge rate", xlog=
True, ymax=_maxFake),
22 Plot(
"merged_vs_Z", xtitle=
"Z (cm)", ytitle=
"Merge rate", xmin=-20, xmax=20, ymax=_maxFake),
26 _pvtagging = PlotGroup(
"pvtagging", [
27 Plot(
"TruePVLocationIndexCumulative", xtitle=
"Signal PV status in reco collection", ytitle=
"Fraction of events", drawStyle=
"hist", normalizeToUnitArea=
True, xbinlabels=[
"Not reconstructed",
"Reco and identified",
"Reco, not identified"], xbinlabelsize=15, xbinlabeloption=
"h", xgrid=
False, ylog=
True, ymin=1e-3, ratioCoverageXrange=[-0.5, 0.5]),
28 Plot(
"TruePVLocationIndex", xtitle=
"Index of signal PV in reco collection", ytitle=
"Fraction of events", drawStyle=
"hist", normalizeToUnitArea=
True, ylog=
True, ymin=1e-5),
29 Plot(
"MisTagRate_vs_PU", xtitle=
"PU", ytitle=
"Mistag rate vs. PU", title=
"", xmax=_maxPU, ymax=_maxFake),
30 Plot(
"MisTagRate_vs_sum-pt2", xtitle=
"#Sigmap_{T}^{2}", ytitle=
"Mistag rate vs. #Sigmap_{T}^{2}", title=
"", xlog=
True, ymax=_maxFake),
34 _effandfake = PlotGroup(
"effandfake", [
35 Plot(
"effic_vs_NumVertices", xtitle=
"Simulated interactions", ytitle=
"Efficiency vs. N sim vertices", xmin=_minPU, xmax=_maxPU, ymax=_maxEff),
36 Plot(
"fakerate_vs_PU", xtitle=
"Simulated interactions", ytitle=
"Fake rate vs. N sim vertices", xmin=_minPU, xmax=_maxPU, ymax=_maxFake),
37 Plot(
"effic_vs_NumTracks", xtitle=
"Tracks", ytitle=
"Efficiency vs. N tracks", title=
"", ymax=_maxEff),
38 Plot(
"fakerate_vs_NumTracks", xtitle=
"Tracks", ytitle=
"Fake rate vs. N tracks", title=
"", ymax=_maxFake),
39 Plot(
"effic_vs_Pt2", xtitle=
"Sum p_{T}^{2} ", ytitle=
"Efficiency vs. sum p_{T}^{2}", xlog=
True, ymax=_maxEff),
40 Plot(
"fakerate_vs_Pt2", xtitle=
"Sum p_{T}^{2} ", ytitle=
"Fake rate vs. sum p_{T}^{2}", xlog=
True, ymax=_maxFake),
42 _common = {
"title":
"",
"stat":
True,
"fit":
True,
"normalizeToUnitArea":
True,
"drawStyle":
"hist",
"drawCommand":
"",
"ylog":
True,
"ymin": [5e-7, 5e-6, 5e-5, 5e-4]}
43 _resolution = PlotGroup(
"resolution", [
44 Plot(
"RecoAllAssoc2GenMatched_ResolX", xtitle=
"Resolution in x (#mum)", **_common),
45 Plot(
"RecoAllAssoc2GenMatchedMerged_ResolX", xtitle=
"Resolution in x for merged vertices (#mum)", **_common),
46 Plot(
"RecoAllAssoc2GenMatched_ResolY", xtitle=
"Resolution in y (#mum)", **_common),
47 Plot(
"RecoAllAssoc2GenMatchedMerged_ResolY", xtitle=
"Resolution in y for merged vertices (#mum)", **_common),
48 Plot(
"RecoAllAssoc2GenMatched_ResolZ", xtitle=
"Resolution in z (#mum)", **_common),
49 Plot(
"RecoAllAssoc2GenMatchedMerged_ResolZ", xtitle=
"Resolution in z for merged vertices (#mum)", **_common),
51 _common =
dict(title=
"", xtitle=
"Number of tracks", scale=1e4, ylog=
True, ymin=_minMaxRes , ymax=_minMaxRes)
52 _resolutionNumTracks = PlotGroup(
"resolutionNumTracks", [
53 Plot(
"RecoAllAssoc2GenMatched_ResolX_vs_NumTracks_Sigma", ytitle=
"Resolution in x (#mum)", **_common),
54 Plot(
"RecoAllAssoc2GenMatchedMerged_ResolX_vs_NumTracks_Sigma", ytitle=
"Resolution in x for merged vertices (#mum)", **_common),
55 Plot(
"RecoAllAssoc2GenMatched_ResolY_vs_NumTracks_Sigma", ytitle=
"Resolution in y (#mum)", **_common),
56 Plot(
"RecoAllAssoc2GenMatchedMerged_ResolY_vs_NumTracks_Sigma", ytitle=
"Resolution in y for merged vertices (#mum)", **_common),
57 Plot(
"RecoAllAssoc2GenMatched_ResolZ_vs_NumTracks_Sigma", ytitle=
"Resolution in z (#mum)", **_common),
58 Plot(
"RecoAllAssoc2GenMatchedMerged_ResolZ_vs_NumTracks_Sigma", ytitle=
"Resolution in z for merged vertices (#mum)", **_common),
60 _common.update(
dict(xtitle=
"Sum of track p_{T} (GeV)", xlog=
True, xmin=_minMaxPt, xmax=_minMaxPt))
61 _resolutionPt = PlotGroup(
"resolutionPt", [
62 Plot(
"RecoAllAssoc2GenMatched_ResolX_vs_Pt_Sigma", ytitle=
"Resolution in x (#mum)", **_common),
63 Plot(
"RecoAllAssoc2GenMatchedMerged_ResolX_vs_Pt_Sigma", ytitle=
"Resolution in x for merged vertices (#mum)", **_common),
64 Plot(
"RecoAllAssoc2GenMatched_ResolY_vs_Pt_Sigma", ytitle=
"Resolution in y (#mum)", **_common),
65 Plot(
"RecoAllAssoc2GenMatchedMerged_ResolY_vs_Pt_Sigma", ytitle=
"Resolution in y for merged vertices (#mum)", **_common),
66 Plot(
"RecoAllAssoc2GenMatched_ResolZ_vs_Pt_Sigma", ytitle=
"Resolution in z (#mum)", **_common),
67 Plot(
"RecoAllAssoc2GenMatchedMerged_ResolZ_vs_Pt_Sigma", ytitle=
"Resolution in z for merged vertices (#mum)", **_common),
69 _common = {
"stat":
True,
"fit":
True,
"normalizeToUnitArea":
True,
"drawStyle":
"hist",
"drawCommand":
"",
"xmin": -6,
"xmax": 6,
"ylog":
True,
"ymin": 5e-5,
"ymax": [0.01, 0.05, 0.1, 0.2, 0.5, 0.8, 1.025]}
70 _pull = PlotGroup(
"pull", [
71 Plot(
"RecoAllAssoc2GenMatched_PullX", xtitle=
"x", ytitle=
"Pull vs. x", **_common),
72 Plot(
"RecoAllAssoc2GenMatched_PullY", xtitle=
"y", ytitle=
"Pull vs. y", **_common),
73 Plot(
"RecoAllAssoc2GenMatched_PullZ", xtitle=
"z", ytitle=
"Pull vs. z", **_common),
77 _common={
"drawStyle":
"HIST",
"normalizeToUnitArea":
True}
78 _puritymissing = PlotGroup(
"puritymissing", [
79 Plot(
"RecoPVAssoc2GenPVMatched_Purity", xtitle=
"Purity", ytitle=
"Number of reco PVs matched to gen PVs", ylog=
True, ymin=1e-4, **_common),
80 Plot(
"RecoPVAssoc2GenPVNotMatched_Purity", xtitle=
"Purity", ytitle=
"Number of reco PVs not matcched to gen PVs", ylog=
True, ymin=1e-3, **_common),
81 Plot(
"RecoPVAssoc2GenPVMatched_Missing", xtitle=
"Fraction of reco p_{T} associated to gen PV \"missing\" from reco PV", ytitle=
"Number of reco PVs matched to gen PVs", ylog=
True, ymin=1e-4, **_common),
82 Plot(
"RecoPVAssoc2GenPVNotMatched_Missing", xtitle=
"Fraction of reco p_{T} associated to gen PV \"missing\" from reco PV", ytitle=
"Number of reco PVs not matcched to gen PVs", ylog=
True, ymin=1e-3, **_common),
86 _common={
"drawStyle":
"HIST",
"xlog":
True,
"ylog":
True,
"ymin": 0.5}
87 _sumpt2 = PlotGroup(
"sumpt2", [
88 Plot(
"RecoAssoc2GenPVMatched_Pt2", xtitle=
"#sum^{}p_{T}^{2}", ytitle=
"Reco vertices matched to gen PV", **_common),
89 Plot(
"RecoAssoc2GenPVMatchedNotHighest_Pt2", xtitle=
"#sum^{}p_{T}^{2}", ytitle=
"Reco non-PV-vertices matched to gen PV", **_common),
90 Plot(
"RecoAssoc2GenPVNotMatched_Pt2", xtitle=
"#sum^{}p_{T}^{2}", ytitle=
"Reco vertices not matched to gen PV", **_common),
91 Plot(
"RecoAssoc2GenPVNotMatched_GenPVTracksRemoved_Pt2", xtitle=
"#sum^{}p_{T}^{2}, gen PV tracks removed", ytitle=
"Reco vertices not matched to gen PV", **_common),
96 _k0_effandfake = PlotGroup(
"effandfake", [
97 Plot(
"K0sEffVsPt", xtitle=
"p_{T} (GeV)", ytitle=
"Efficiency vs. p_{T}"),
98 Plot(
"K0sFakeVsPt", xtitle=
"p_{T} (GeV)", ytitle=
"Fake rate vs. p_{T}"),
99 Plot(
"K0sEffVsEta", xtitle=
"#eta", ytitle=
"Efficiency vs. #eta"),
100 Plot(
"K0sFakeVsEta", xtitle=
"#eta", ytitle=
"Fake rate vs. #eta"),
101 Plot(
"K0sEffVsR", xtitle=
"R (cm)", ytitle=
"Efficiency vs. R"),
102 Plot(
"K0sFakeVsR", xtitle=
"R (cm)", ytitle=
"Fake rate vs. R"),
104 _k0_effandfakeTk = PlotGroup(
"effandfakeTk", [
106 Plot(
"K0sTkFakeVsPt", xtitle=
"p_{T} (GeV)", ytitle=
"Fake rate vs. p_{T}"),
108 Plot(
"K0sTkFakeVsEta", xtitle=
"#eta", ytitle=
"Fake rate vs. #eta"),
110 Plot(
"K0sTkFakeVsR", xtitle=
"R (cm)", ytitle=
"Fake rate vs. R"),
114 _common =
dict(normalizeToUnitArea=
True, drawStyle=
"HIST", stat=
True)
115 _k0_mass = PlotGroup(
"mass", [
116 Plot(
"ksMassAll", xtitle=
"mass of all (GeV)", **_common),
117 Plot(
"ksMassGood", xtitle=
"mass of good (GeV)", **_common),
118 Plot(
"ksMassFake", xtitle=
"mass of fake (GeV)", **_common),
122 _lambda_effandfake = PlotGroup(
"effandfake", [
123 Plot(
"LamEffVsPt", xtitle=
"p_{T} (GeV)", ytitle=
"Efficiency vs. p_{T}"),
124 Plot(
"LamFakeVsPt", xtitle=
"p_{T} (GeV)", ytitle=
"Fake rate vs. p_{T}"),
125 Plot(
"LamEffVsEta", xtitle=
"#eta", ytitle=
"Efficiency vs. #eta"),
126 Plot(
"LamFakeVsEta", xtitle=
"#eta", ytitle=
"Fake rate vs. #eta"),
127 Plot(
"LamEffVsR", xtitle=
"R (cm)", ytitle=
"Efficiency vs. R"),
128 Plot(
"LamFakeVsR", xtitle=
"R (cm)", ytitle=
"Fake rate vs. R"),
130 _lambda_effandfakeTk = PlotGroup(
"effandfakeTk", [
132 Plot(
"LamTkFakeVsPt", xtitle=
"p_{T} (GeV)", ytitle=
"Fake rate vs. p_{T}"),
134 Plot(
"LamTkFakeVsEta", xtitle=
"#eta", ytitle=
"Fake rate vs. #eta"),
136 Plot(
"LamTkFakeVsR", xtitle=
"R (cm)", ytitle=
"Fake rate vs. R"),
140 _lambda_mass = PlotGroup(
"mass", [
141 Plot(
"lamMassAll", xtitle=
"mass of all (GeV)", **_common),
142 Plot(
"lamMassGood", xtitle=
"mass of good (GeV)", **_common),
143 Plot(
"lamMassFake", xtitle=
"mass of fake (GeV)", **_common),
149 _common =
dict(drawStyle =
"HIST", stat=
True)
150 _commonXY =
dict(xmin=[x*0.1
for x
in xrange(-6, 6, 1)], xmax=[x*0.1
for x
in xrange(-5, 7, 1)])
151 _commonZ =
dict(xmin=[-60,-30], xmax=[30,60])
152 _commonXY.update(_common)
153 _commonZ.update(_common)
154 _extGenpos = PlotGroup(
"genpos", [
155 Plot(
"GenAllV_X", xtitle=
"Gen AllV pos x (cm)", ytitle=
"N", **_commonXY),
156 Plot(
"GenPV_X", xtitle=
"Gen PV pos x (cm)", ytitle=
"N", **_commonXY),
157 Plot(
"GenAllV_Y", xtitle=
"Gen AllV pos y (cm)", ytitle=
"N", **_commonXY),
158 Plot(
"GenPV_Y", xtitle=
"Gen PV pos y (cm)", ytitle=
"N", **_commonXY),
159 Plot(
"GenAllV_Z", xtitle=
"Gen AllV pos z (cm)", ytitle=
"N", **_commonZ),
160 Plot(
"GenPV_Z", xtitle=
"Gen PV pos z (cm)", ytitle=
"N", **_commonZ),
162 _extDist = PlotGroup(
"dist", [
163 Plot(
"RecoAllAssoc2Gen_X", xtitle=
"Reco vertex pos x (cm)", ytitle=
"N", **_commonXY),
164 Plot(
"RecoAllAssoc2Gen_Y", xtitle=
"Reco vertex pos y (cm)", ytitle=
"N", **_commonXY),
165 Plot(
"RecoAllAssoc2Gen_R", xtitle=
"Reco vertex pos r (cm)", ytitle=
"N", **_commonXY),
166 Plot(
"RecoAllAssoc2Gen_Z", xtitle=
"Reco vertex pos z (cm)", ytitle=
"N", **_commonZ),
167 Plot(
"RecoAllAssoc2Gen_NumVertices", xtitle=
"Number of reco vertices", ytitle=
"A.u.", normalizeToUnitArea=
True, stat=
True, drawStyle=
"hist", min=_minVtx, xmax=_maxVtx),
168 Plot(
"RecoAllAssoc2Gen_NumTracks", xtitle=
"Number of tracks in vertex fit", ytitle=
"N", stat=
True, drawStyle=
"hist"),
170 _common =
dict(title=
"", xtitle=
"Vertex z (cm)", scale=1e4, ylog=
True, ymin=_minMaxRes , ymax=_minMaxRes, xmin=range(-60,-10,10), xmax=range(20,70,10))
171 _extResolutionZ = PlotGroup(
"resolutionZ", [
172 Plot(
"RecoAllAssoc2GenMatched_ResolX_vs_Z_Sigma", ytitle=
"Resolution in x (#mum)", **_common),
173 Plot(
"RecoAllAssoc2GenMatchedMerged_ResolX_vs_Z_Sigma", ytitle=
"Resolution in x for merged vertices (#mum)", **_common),
174 Plot(
"RecoAllAssoc2GenMatched_ResolY_vs_Z_Sigma", ytitle=
"Resolution in y (#mum)", **_common),
175 Plot(
"RecoAllAssoc2GenMatchedMerged_ResolY_vs_Z_Sigma", ytitle=
"Resolution in y for merged vertices (#mum)", **_common),
176 Plot(
"RecoAllAssoc2GenMatched_ResolZ_vs_Z_Sigma", ytitle=
"Resolution in z (#mum)", **_common),
177 Plot(
"RecoAllAssoc2GenMatchedMerged_ResolZ_vs_Z_Sigma", ytitle=
"Resolution in z for merged vertices (#mum)", **_common),
179 _extDqm = PlotGroup(
"dqm", [
180 Plot(
"tagVtxTrksVsZ", xtitle=
"z_{vertex} - z_{beamspot} (cm)", ytitle=
"Tracks / selected PV"),
181 Plot(
"otherVtxTrksVsZ", xtitle=
"z_{vertex} - z_{beamspot} (cm)", ytitle=
"Tracks / pileup vertex"),
182 Plot(
"vtxNbr", xtitle=
"Reconstructed vertices", ytitle=
"Events", stat=
True, drawStyle=
"hist", xmin=_minVtx, xmax=_maxVtx),
200 def _formatOrNone(num, func):
206 h = tdirectory.Get(
"TruePVLocationIndexCumulative")
208 n_events = h.GetEntries()
209 n_pvtagged = h.GetBinContent(2)
210 ret.extend([
int(n_events),
"%.4f"%(
float(n_pvtagged)/
float(n_events))])
212 ret.extend([
None,
None])
214 h = tdirectory.Get(
"globalEfficiencies")
217 for i
in xrange(1, h.GetNbinsX()+1):
218 d[h.GetXaxis().GetBinLabel(i)] = h.GetBinContent(i)
220 _formatOrNone(d.get(
"effic_vs_Z",
None),
lambda n:
"%.4f"%n),
221 _formatOrNone(d.get(
"fakerate_vs_Z",
None),
lambda n:
"%.4f"%n),
222 _formatOrNone(d.get(
"merged_vs_Z",
None),
lambda n:
"%.4f"%n),
223 _formatOrNone(d.get(
"duplicate_vs_Z",
None),
lambda n:
"%.4f"%n),
228 if ret.count(
None) == len(ret):
236 "PV reco+tag efficiency",
244 "DQMData/Run 1/Vertexing/Run summary/PrimaryVertex",
245 "DQMData/Vertexing/PrimaryVertex",
246 "DQMData/Run 1/Vertexing/Run summary/PrimaryVertexV",
247 "DQMData/Vertexing/PrimaryVertexV",
249 _vertexDqmFolders = [
250 "DQMData/Run 1/OfflinePV/Run summary/offlinePrimaryVertices",
251 "DQMData/OffinePV/offlinePrimaryVertices",
254 "DQMData/Run 1/Vertexing/Run summary/V0",
255 "DQMData/Vertexing/V0",
256 "DQMData/Run 1/Vertexing/Run summary/V0V",
257 "DQMData/Vertexing/V0V",
260 plotterExt = Plotter()
261 plotter.append(
"", _vertexFolders, PlotFolder(
266 _resolutionNumTracks,
271 purpose=PlotPurpose.Vertexing,
276 plotter.append(
"K0", [x+
"/K0" for x
in _v0Folders], PlotFolder(
280 loopSubFolders=
False,
281 purpose=PlotPurpose.Vertexing,
282 page=
"v0", section=
"k0" 284 plotter.append(
"Lambda", [x+
"/Lambda" for x
in _v0Folders], PlotFolder(
286 _lambda_effandfakeTk,
288 loopSubFolders=
False,
289 purpose=PlotPurpose.Vertexing,
290 page=
"v0", section=
"lambda" 292 plotterExt.append(
"", _vertexFolders, PlotFolder(
295 purpose=PlotPurpose.Vertexing,
298 numberOfEventsHistogram=_vertexNumberOfEventsHistogram
300 plotterExt.append(
"dqm", _vertexDqmFolders, PlotFolder(
302 loopSubFolders=
False,
303 purpose=PlotPurpose.Vertexing,
305 section=
"offlinePrimaryVertices",
308 plotterExt.append(
"gen", _vertexFolders, PlotFolder(
310 loopSubFolders=
False,
311 purpose=PlotPurpose.Vertexing,
319 super(TrackingValidation, self).
__init__(*args, **kwargs)
def getSection(self, dqmSubFolder)
def __init__(self, fullsimSamples, fastsimSamples, refRelease, refRepository, newRelease, newRepository, newFileModifier=None, selectionName="")
def _getSelectionName(self, quality, algo)
def _getDirectoryName(self, quality, algo)
def __init__(self, page="vertex")
def _init__(self, args, kwargs)
def create(self, tdirectory)