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
7 _maxPU = [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]
13 _common = {
"xtitle":
"Simulated interactions",
"xmin": _minPU,
"xmax": _maxPU,
"ymin": _minVtx,
"ymax": _maxVtx}
14 _recovsgen = PlotGroup(
"recovsgen", [
15 Plot(
"RecoVtx_vs_GenVtx", ytitle=
"Reco vertices", **_common),
16 Plot(
"MatchedRecoVtx_vs_GenVtx", ytitle=
"Matched reco vertices", **_common),
17 Plot(
"merged_vs_ClosestVertexInZ", xtitle=
"Closest distance in Z (cm)", ytitle=
"Merge rate", xlog=
True, ymax=_maxFake),
18 Plot(
"merged_vs_Z", xtitle=
"Z (cm)", ytitle=
"Merge rate", xmin=-20, xmax=20, ymax=_maxFake),
22 _pvtagging = PlotGroup(
"pvtagging", [
23 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),
24 Plot(
"TruePVLocationIndex", xtitle=
"Index of signal PV in reco collection", ytitle=
"Fraction of events", drawStyle=
"hist", normalizeToUnitArea=
True, ylog=
True, ymin=1e-5),
25 Plot(
"MisTagRate_vs_PU", xtitle=
"PU", ytitle=
"Mistag rate vs. PU", title=
"", xmax=_maxPU, ymax=_maxFake),
26 Plot(
"MisTagRate_vs_sum-pt2", xtitle=
"#Sigmap_{T}^{2}", ytitle=
"Mistag rate vs. #Sigmap_{T}^{2}", title=
"", xlog=
True, ymax=_maxFake),
30 _effandfake = PlotGroup(
"effandfake", [
31 Plot(
"effic_vs_NumVertices", xtitle=
"Simulated interactions", ytitle=
"Efficiency vs. N sim vertices", xmin=_minVtx, xmax=_maxVtx, ymax=_maxEff),
32 Plot(
"fakerate_vs_PU", xtitle=
"Simulated interactions", ytitle=
"Fake rate vs. N sim vertices", xmin=_minPU, xmax=_maxPU, ymax=_maxFake),
33 Plot(
"effic_vs_NumTracks", xtitle=
"Tracks", ytitle=
"Efficiency vs. N tracks", title=
"", ymax=_maxEff),
34 Plot(
"fakerate_vs_NumTracks", xtitle=
"Tracks", ytitle=
"Fake rate vs. N tracks", title=
"", ymax=_maxFake),
35 Plot(
"effic_vs_Pt2", xtitle=
"Sum p_{T}^{2} ", ytitle=
"Efficiency vs. sum p_{T}^{2}", xlog=
True, ymax=_maxEff),
36 Plot(
"fakerate_vs_Pt2", xtitle=
"Sum p_{T}^{2} ", ytitle=
"Fake rate vs. sum p_{T}^{2}", xlog=
True, ymax=_maxFake),
38 _common = {
"title":
"",
"stat":
True,
"fit":
True,
"normalizeToUnitArea":
True,
"drawStyle":
"hist",
"drawCommand":
"",
"ylog":
True,
"ymin": [5e-7, 5e-6, 5e-5, 5e-4]}
39 _resolution = PlotGroup(
"resolution", [
40 Plot(
"RecoAllAssoc2GenMatched_ResolX", xtitle=
"Resolution in x (#mum)", **_common),
41 Plot(
"RecoAllAssoc2GenMatchedMerged_ResolX", xtitle=
"Resolution in x for merged vertices (#mum)", **_common),
42 Plot(
"RecoAllAssoc2GenMatched_ResolY", xtitle=
"Resolution in y (#mum)", **_common),
43 Plot(
"RecoAllAssoc2GenMatchedMerged_ResolY", xtitle=
"Resolution in y for merged vertices (#mum)", **_common),
44 Plot(
"RecoAllAssoc2GenMatched_ResolZ", xtitle=
"Resolution in z (#mum)", **_common),
45 Plot(
"RecoAllAssoc2GenMatchedMerged_ResolZ", xtitle=
"Resolution in z for merged vertices (#mum)", **_common),
47 _common = {
"title":
"",
"xtitle":
"Number of tracks",
"scale": 1e4,
"ylog":
True,
"ymin": 5,
"ymax": 500}
48 _resolutionNumTracks = PlotGroup(
"resolutionNumTracks", [
49 Plot(
"RecoAllAssoc2GenMatched_ResolX_vs_NumTracks_Sigma", ytitle=
"Resolution in x (#mum)", **_common),
50 Plot(
"RecoAllAssoc2GenMatchedMerged_ResolX_vs_NumTracks_Sigma", ytitle=
"Resolution in x for merged vertices (#mum)", **_common),
51 Plot(
"RecoAllAssoc2GenMatched_ResolY_vs_NumTracks_Sigma", ytitle=
"Resolution in y (#mum)", **_common),
52 Plot(
"RecoAllAssoc2GenMatchedMerged_ResolY_vs_NumTracks_Sigma", ytitle=
"Resolution in y for merged vertices (#mum)", **_common),
53 Plot(
"RecoAllAssoc2GenMatched_ResolZ_vs_NumTracks_Sigma", ytitle=
"Resolution in z (#mum)", **_common),
54 Plot(
"RecoAllAssoc2GenMatchedMerged_ResolZ_vs_NumTracks_Sigma", ytitle=
"Resolution in z for merged vertices (#mum)", **_common),
56 _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]}
57 _pull = PlotGroup(
"pull", [
58 Plot(
"RecoAllAssoc2GenMatched_PullX", xtitle=
"x", ytitle=
"Pull vs. x", **_common),
59 Plot(
"RecoAllAssoc2GenMatched_PullY", xtitle=
"y", ytitle=
"Pull vs. y", **_common),
60 Plot(
"RecoAllAssoc2GenMatched_PullZ", xtitle=
"z", ytitle=
"Pull vs. z", **_common),
64 _common={
"drawStyle":
"HIST",
"normalizeToUnitArea":
True}
65 _puritymissing = PlotGroup(
"puritymissing", [
66 Plot(
"RecoPVAssoc2GenPVMatched_Purity", xtitle=
"Purity", ytitle=
"Number of reco PVs matched to gen PVs", ylog=
True, ymin=1e-4, **_common),
67 Plot(
"RecoPVAssoc2GenPVNotMatched_Purity", xtitle=
"Purity", ytitle=
"Number of reco PVs not matcched to gen PVs", ylog=
True, ymin=1e-3, **_common),
68 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),
69 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),
73 _common={
"drawStyle":
"HIST",
"xlog":
True,
"ylog":
True,
"ymin": 0.5}
74 _sumpt2 = PlotGroup(
"sumpt2", [
75 Plot(
"RecoAssoc2GenPVMatched_Pt2", xtitle=
"#sum^{}p_{T}^{2}", ytitle=
"Reco vertices matched to gen PV", **_common),
76 Plot(
"RecoAssoc2GenPVMatchedNotHighest_Pt2", xtitle=
"#sum^{}p_{T}^{2}", ytitle=
"Reco non-PV-vertices matched to gen PV", **_common),
77 Plot(
"RecoAssoc2GenPVNotMatched_Pt2", xtitle=
"#sum^{}p_{T}^{2}", ytitle=
"Reco vertices not matched to gen PV", **_common),
78 Plot(
"RecoAssoc2GenPVNotMatched_GenPVTracksRemoved_Pt2", xtitle=
"#sum^{}p_{T}^{2}, gen PV tracks removed", ytitle=
"Reco vertices not matched to gen PV", **_common),
83 _common = {
"drawStyle":
"HIST"}
84 _genpos = PlotGroup(
"genpos", [
85 Plot(
"GenAllV_X", xtitle=
"Gen AllV pos x", ytitle=
"N", **_common),
86 Plot(
"GenPV_X", xtitle=
"Gen PV pos x", ytitle=
"N", **_common),
87 Plot(
"GenAllV_Y", xtitle=
"Gen AllV pos y", ytitle=
"N", **_common),
88 Plot(
"GenPV_Y", xtitle=
"Gen PV pos y", ytitle=
"N", **_common),
89 Plot(
"GenAllV_Z", xtitle=
"Gen AllV pos z", ytitle=
"N", **_common),
90 Plot(
"GenPV_Z", xtitle=
"Gen PV pos z", ytitle=
"N", **_common),
93 _k0_effandfake = PlotGroup(
"effandfake", [
94 Plot(
"K0sEffVsPt", xtitle=
"p_{T} (GeV)", ytitle=
"Efficiency vs. p_{T}"),
95 Plot(
"K0sFakeVsPt", xtitle=
"p_{T} (GeV)", ytitle=
"Fake rate vs. p_{T}"),
96 Plot(
"K0sEffVsEta", xtitle=
"#eta", ytitle=
"Efficiency vs. #eta"),
97 Plot(
"K0sFakeVsEta", xtitle=
"#eta", ytitle=
"Fake rate vs. #eta"),
98 Plot(
"K0sEffVsR", xtitle=
"R (cm)", ytitle=
"Efficiency vs. R"),
99 Plot(
"K0sFakeVsR", xtitle=
"R (cm)", ytitle=
"Fake rate vs. R"),
101 _k0_effandfakeTk = PlotGroup(
"effandfakeTk", [
103 Plot(
"K0sTkFakeVsPt", xtitle=
"p_{T} (GeV)", ytitle=
"Fake rate vs. p_{T}"),
105 Plot(
"K0sTkFakeVsEta", xtitle=
"#eta", ytitle=
"Fake rate vs. #eta"),
107 Plot(
"K0sTkFakeVsR", xtitle=
"R (cm)", ytitle=
"Fake rate vs. R"),
111 _common = {
"normalizeToUnitArea":
True,
"drawStyle":
"HIST"}
112 _k0_mass = PlotGroup(
"mass", [
113 Plot(
"ksMassAll", xtitle=
"mass of all (GeV)", **_common),
114 Plot(
"ksMassGood", xtitle=
"mass of good (GeV)", **_common),
115 Plot(
"ksMassFake", xtitle=
"mass of fake (GeV)", **_common),
119 _lambda_effandfake = PlotGroup(
"effandfake", [
120 Plot(
"LamEffVsPt", xtitle=
"p_{T} (GeV)", ytitle=
"Efficiency vs. p_{T}"),
121 Plot(
"LamFakeVsPt", xtitle=
"p_{T} (GeV)", ytitle=
"Fake rate vs. p_{T}"),
122 Plot(
"LamEffVsEta", xtitle=
"#eta", ytitle=
"Efficiency vs. #eta"),
123 Plot(
"LamFakeVsEta", xtitle=
"#eta", ytitle=
"Fake rate vs. #eta"),
124 Plot(
"LamEffVsR", xtitle=
"R (cm)", ytitle=
"Efficiency vs. R"),
125 Plot(
"LamFakeVsR", xtitle=
"R (cm)", ytitle=
"Fake rate vs. R"),
127 _lambda_effandfakeTk = PlotGroup(
"effandfakeTk", [
129 Plot(
"LamTkFakeVsPt", xtitle=
"p_{T} (GeV)", ytitle=
"Fake rate vs. p_{T}"),
131 Plot(
"LamTkFakeVsEta", xtitle=
"#eta", ytitle=
"Fake rate vs. #eta"),
133 Plot(
"LamTkFakeVsR", xtitle=
"R (cm)", ytitle=
"Fake rate vs. R"),
137 _lambda_mass = PlotGroup(
"mass", [
138 Plot(
"lamMassAll", xtitle=
"mass of all (GeV)", **_common),
139 Plot(
"lamMassGood", xtitle=
"mass of good (GeV)", **_common),
140 Plot(
"lamMassFake", xtitle=
"mass of fake (GeV)", **_common),
161 def _formatOrNone(num, func):
167 h = tdirectory.Get(
"TruePVLocationIndexCumulative")
169 n_events = h.GetEntries()
170 n_pvtagged = h.GetBinContent(2)
171 ret.extend([int(n_events),
"%.4f"%(float(n_pvtagged)/float(n_events))])
173 ret.extend([
None,
None])
175 h = tdirectory.Get(
"globalEfficiencies")
178 for i
in xrange(1, h.GetNbinsX()+1):
179 d[h.GetXaxis().GetBinLabel(i)] = h.GetBinContent(i)
181 _formatOrNone(d.get(
"effic_vs_Z",
None),
lambda n:
"%.4f"%n),
182 _formatOrNone(d.get(
"fakerate_vs_Z",
None),
lambda n:
"%.4f"%n),
183 _formatOrNone(d.get(
"merged_vs_Z",
None),
lambda n:
"%.4f"%n),
184 _formatOrNone(d.get(
"duplicate_vs_Z",
None),
lambda n:
"%.4f"%n),
189 if ret.count(
None) == len(ret):
197 "PV reco+tag efficiency",
205 "DQMData/Run 1/Vertexing/Run summary/PrimaryVertex",
206 "DQMData/Vertexing/PrimaryVertex",
207 "DQMData/Run 1/Vertexing/Run summary/PrimaryVertexV",
208 "DQMData/Vertexing/PrimaryVertexV",
211 "DQMData/Run 1/Vertexing/Run summary/V0",
212 "DQMData/Vertexing/V0",
213 "DQMData/Run 1/Vertexing/Run summary/V0V",
214 "DQMData/Vertexing/V0V",
217 plotter.append(
"", _vertexFolders, PlotFolder(
222 _resolutionNumTracks,
226 purpose=PlotPurpose.Vertexing,
231 plotter.append(
"K0", [x+
"/K0" for x
in _v0Folders], PlotFolder(
235 loopSubFolders=
False,
236 purpose=PlotPurpose.Vertexing,
237 page=
"v0", section=
"k0"
239 plotter.append(
"Lambda", [x+
"/Lambda" for x
in _v0Folders], PlotFolder(
241 _lambda_effandfakeTk,
243 loopSubFolders=
False,
244 purpose=PlotPurpose.Vertexing,
245 page=
"v0", section=
"lambda"
251 super(TrackingValidation, self).
__init__(*args, **kwargs)