30 : verbose_(iConfig.getUntrackedParameter<bool>(
"verbose",
false)),
31 use_only_charged_tracks_(iConfig.getUntrackedParameter<bool>(
32 "use_only_charged_tracks",
true)),
34 iConfig.getUntrackedParameter<double>(
"sigma_z_match", 3.0)),
36 iConfig.getUntrackedParameter<double>(
"abs_z_match", 0.1)),
38 iConfig.getUntrackedParameter<std::
string>(
"root_folder",
39 "Validation/Vertices")),
43 iConfig.getUntrackedParameter<edm::
InputTag>(
"recoTrackProducer"))),
44 edmView_recoTrack_Token_(consumes<edm::
View<
reco::Track> >(
45 iConfig.getUntrackedParameter<edm::
InputTag>(
"recoTrackProducer"))),
47 iConfig.getUntrackedParameter<edm::
InputTag>(
"trackingParticleCollection"))),
49 iConfig.getUntrackedParameter<edm::
InputTag>(
"trackingVertexCollection"))),
51 iConfig.getUntrackedParameter<edm::
InputTag>(
"trackAssociatorMap"))),
53 iConfig.getUntrackedParameter<edm::
InputTag>(
"trackAssociatorMap"))),
54 vertexAssociatorToken_(consumes<
reco::VertexToTrackingVertexAssociator>(
55 iConfig.getUntrackedParameter<edm::
InputTag>(
"vertexAssociator"))) {
57 "vertexRecoCollections");
75 float log_bins[31] = {
76 0.0, 0.0002, 0.0004, 0.0006, 0.0008, 0.001, 0.002,
77 0.004, 0.006, 0.008, 0.01, 0.02,
78 0.04, 0.06, 0.08, 0.1, 0.2,
79 0.4, 0.6, 0.8, 1.0, 2.0,
80 4.0, 6.0, 8.0, 10.0, 20.0,
81 40.0, 60.0, 80.0, 100.0
83 float log_mergez_bins[18] = {
84 0.0, 0.0025, 0.005, 0.0075, 0.01, 0.025, 0.05, 0.075, 0.1,
85 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0
87 float log_pt2_bins[16] = {
92 1000.0, 2000.0, 5000.0,10000.0
94 float log_ntrk_bins[25] = {
95 0., 2.0, 4.0, 6.0, 8.0, 10.,
96 12.0, 14.0, 16.0, 18.0, 22.0,
97 26.0, 30.0, 35.0, 40.0,
98 45.0, 50.0, 55.0, 60.0, 70.0,
99 80.0, 90.0, 100.0, 150.0, 200.0
105 double log_pt2_bins_double[16] = {
110 1000.0, 2000.0, 5000.0,10000.0
114 mes_[
"root_folder"][
"GenVtx_vs_BX"] =
115 i.
book2D(
"GenVtx_vs_BX",
"GenVtx_vs_BX", 16, -12.5, 3.5, 200, 0., 200.);
117 mes_[
"root_folder"][
"GenPV_X"] =
118 i.
book1D(
"GenPV_X",
"GeneratedPV_X", 120, -0.6, 0.6);
119 mes_[
"root_folder"][
"GenPV_Y"] =
120 i.
book1D(
"GenPV_Y",
"GeneratedPV_Y", 120, -0.6, 0.6);
121 mes_[
"root_folder"][
"GenPV_Z"] =
122 i.
book1D(
"GenPV_Z",
"GeneratedPV_Z", 120, -60., 60.);
123 mes_[
"root_folder"][
"GenPV_R"] =
124 i.
book1D(
"GenPV_R",
"GeneratedPV_R", 120, 0, 0.6);
125 mes_[
"root_folder"][
"GenPV_Pt2"] =
126 i.
book1D(
"GenPV_Pt2",
"GeneratedPV_Sum-pt2", 15, &log_pt2_bins[0]);
127 mes_[
"root_folder"][
"GenPV_NumTracks"] =
128 i.
book1D(
"GenPV_NumTracks",
"GeneratedPV_NumTracks", 24, &log_ntrk_bins[0]);
129 mes_[
"root_folder"][
"GenPV_ClosestDistanceZ"] =
130 i.
book1D(
"GenPV_ClosestDistanceZ",
"GeneratedPV_ClosestDistanceZ", 30,
134 mes_[
"root_folder"][
"GenAllV_NumVertices"] = i.
book1D(
135 "GenAllV_NumVertices",
"GeneratedAllV_NumVertices", 100, 0., 200.);
136 mes_[
"root_folder"][
"GenAllV_X"] =
137 i.
book1D(
"GenAllV_X",
"GeneratedAllV_X", 120, -0.6, 0.6);
138 mes_[
"root_folder"][
"GenAllV_Y"] =
139 i.
book1D(
"GenAllV_Y",
"GeneratedAllV_Y", 120, -0.6, 0.6);
140 mes_[
"root_folder"][
"GenAllV_Z"] =
141 i.
book1D(
"GenAllV_Z",
"GeneratedAllV_Z", 120, -60, 60);
142 mes_[
"root_folder"][
"GenAllV_R"] =
143 i.
book1D(
"GenAllV_R",
"GeneratedAllV_R", 120, 0, 0.6);
144 mes_[
"root_folder"][
"GenAllV_Pt2"] =
145 i.
book1D(
"GenAllV_Pt2",
"GeneratedAllV_Sum-pt2", 15, &log_pt2_bins[0]);
146 mes_[
"root_folder"][
"GenAllV_NumTracks"] =
147 i.
book1D(
"GenAllV_NumTracks",
"GeneratedAllV_NumTracks", 24, &log_ntrk_bins[0]);
148 mes_[
"root_folder"][
"GenAllV_ClosestDistanceZ"] =
149 i.
book1D(
"GenAllV_ClosestDistanceZ",
"GeneratedAllV_ClosestDistanceZ", 30,
151 mes_[
"root_folder"][
"GenAllV_PairDistanceZ"] =
152 i.
book1D(
"GenAllV_PairDistanceZ",
"GeneratedAllV_PairDistanceZ",
154 mes_[
"root_folder"][
"SignalIsHighestPt2"] =
155 i.
book1D(
"SignalIsHighestPt2",
"SignalIsHighestPt2", 2, -0.5, 1.5);
163 "RecoVtx_vs_GenVtx",
"RecoVtx_vs_GenVtx", 125, 0., 250., 250, 0., 250.);
164 mes_[
label][
"MatchedRecoVtx_vs_GenVtx"] =
165 i.
bookProfile(
"MatchedRecoVtx_vs_GenVtx",
"MatchedRecoVtx_vs_GenVtx",
166 125, 0., 250., 250, 0., 250.);
168 i.
book1D(
"KindOfSignalPV",
"KindOfSignalPV", 9, -0.5, 8.5);
169 mes_[
label][
"KindOfSignalPV"]->getTH1()->GetXaxis()->SetBinLabel(1,
"!Highest!Assoc2Any");
170 mes_[
label][
"KindOfSignalPV"]->getTH1()->GetXaxis()->SetBinLabel(2,
"Highest!Assoc2Any");
171 mes_[
label][
"KindOfSignalPV"]->getTH1()->GetXaxis()->SetBinLabel(3,
"!HighestAssoc2First");
172 mes_[
label][
"KindOfSignalPV"]->getTH1()->GetXaxis()->SetBinLabel(4,
"HighestAssoc2First");
173 mes_[
label][
"KindOfSignalPV"]->getTH1()->GetXaxis()->SetBinLabel(5,
"!HighestAssoc2!First");
174 mes_[
label][
"KindOfSignalPV"]->getTH1()->GetXaxis()->SetBinLabel(6,
"HighestAssoc2!First");
175 mes_[
label][
"KindOfSignalPV"]->getTH1()->GetXaxis()->SetBinLabel(7,
"!HighestAssoc2First");
176 mes_[
label][
"KindOfSignalPV"]->getTH1()->GetXaxis()->SetBinLabel(8,
"HighestAssoc2First");
178 i.
book1D(
"MisTagRate",
"MisTagRate", 2, -0.5, 1.5);
180 i.
bookProfile(
"MisTagRate_vs_PU",
"MisTagRate_vs_PU", 125, 0., 250.,
183 i.
bookProfile(
"MisTagRate_vs_sum-pt2",
"MisTagRate_vs_sum-pt2",
184 15, &log_pt2_bins_double[0], 2, 0., 1.);
186 i.
bookProfile(
"MisTagRate_vs_Z",
"MisTagRate_vs_Z",
187 120, -60., 60., 2, 0., 1.);
189 i.
bookProfile(
"MisTagRate_vs_R",
"MisTagRate_vs_R",
190 120, 0., 0.6, 2, 0., 1.);
192 i.
bookProfile(
"MisTagRate_vs_NumTracks",
"MisTagRate_vs_NumTracks",
193 100, 0., 200, 2, 0., 1.);
194 mes_[
label][
"MisTagRateSignalIsHighest"] =
195 i.
book1D(
"MisTagRateSignalIsHighest",
196 "MisTagRateSignalIsHighest", 2, -0.5, 1.5);
197 mes_[
label][
"MisTagRateSignalIsHighest_vs_PU"] =
199 "MisTagRateSignalIsHighest_vs_PU", 125, 0., 250.,
201 mes_[
label][
"MisTagRateSignalIsHighest_vs_sum-pt2"] =
202 i.
bookProfile(
"MisTagRateSignalIsHighest_vs_sum-pt2",
203 "MisTagRateSignalIsHighest_vs_sum-pt2",
204 15, &log_pt2_bins_double[0], 2, 0., 1.);
205 mes_[
label][
"MisTagRateSignalIsHighest_vs_Z"] =
207 "MisTagRateSignalIsHighest_vs_Z",
208 120, -60., 60., 2, 0., 1.);
209 mes_[
label][
"MisTagRateSignalIsHighest_vs_R"] =
211 "MisTagRateSignalIsHighest_vs_R",
212 120, 0., 0.6, 2, 0., 1.);
213 mes_[
label][
"MisTagRateSignalIsHighest_vs_NumTracks"] =
214 i.
bookProfile(
"MisTagRateSignalIsHighest_vs_NumTracks",
215 "MisTagRateSignalIsHighest_vs_NumTracks",
216 100, 0., 200, 2, 0., 1.);
217 mes_[
label][
"MisTagRateSignalIsNotHighest"] =
218 i.
book1D(
"MisTagRateSignalIsNotHighest",
219 "MisTagRateSignalIsNotHighest", 2, -0.5, 1.5);
220 mes_[
label][
"MisTagRateSignalIsNotHighest_vs_PU"] =
221 i.
bookProfile(
"MisTagRateSignalIsNotHighest_vs_PU",
222 "MisTagRateSignalIsNotHighest_vs_PU", 125, 0., 250.,
224 mes_[
label][
"MisTagRateSignalIsNotHighest_vs_sum-pt2"] =
225 i.
bookProfile(
"MisTagRateSignalIsNotHighest_vs_sum-pt2",
226 "MisTagRateSignalIsNotHighest_vs_sum-pt2",
227 15, &log_pt2_bins_double[0], 2, 0., 1.);
228 mes_[
label][
"MisTagRateSignalIsNotHighest_vs_Z"] =
230 "MisTagRateSignalIsNotHighest_vs_Z",
231 120, -60., 60., 2, 0., 1.);
232 mes_[
label][
"MisTagRateSignalIsNotHighest_vs_R"] =
234 "MisTagRateSignalIsNotHighest_vs_R",
235 120, 0., 0.6, 2, 0., 1.);
236 mes_[
label][
"MisTagRateSignalIsNotHighest_vs_NumTracks"] =
237 i.
bookProfile(
"MisTagRateSignalIsNotHighest_vs_NumTracks",
238 "MisTagRateSignalIsNotHighest_vs_NumTracks",
239 100, 0., 200, 2, 0., 1.);
241 i.
book1D(
"TruePVLocationIndex",
242 "TruePVLocationIndexInRecoVertexCollection", 12, -1.5, 10.5);
243 mes_[
label][
"TruePVLocationIndexCumulative"] =
244 i.
book1D(
"TruePVLocationIndexCumulative",
245 "TruePVLocationIndexInRecoVertexCollectionCumulative",
247 mes_[
label][
"TruePVLocationIndexSignalIsHighest"] =
248 i.
book1D(
"TruePVLocationIndexSignalIsHighest",
249 "TruePVLocationIndexSignalIsHighestInRecoVertexCollection",
251 mes_[
label][
"TruePVLocationIndexSignalIsNotHighest"] =
252 i.
book1D(
"TruePVLocationIndexSignalIsNotHighest",
253 "TruePVLocationIndexSignalIsNotHighestInRecoVertexCollection",
258 mes_[
label][
"GenAllAssoc2Reco_NumVertices"] =
259 i.
book1D(
"GenAllAssoc2Reco_NumVertices",
260 "GeneratedAllAssoc2Reco_NumVertices", 100, 0., 200.);
262 "GenAllAssoc2Reco_X",
"GeneratedAllAssoc2Reco_X", 120, -0.6, 0.6);
264 "GenAllAssoc2Reco_Y",
"GeneratedAllAssoc2Reco_Y", 120, -0.6, 0.6);
266 "GenAllAssoc2Reco_Z",
"GeneratedAllAssoc2Reco_Z", 120, -60, 60);
268 i.
book1D(
"GenAllAssoc2Reco_R",
"GeneratedAllAssoc2Reco_R", 120, 0, 0.6);
270 i.
book1D(
"GenAllAssoc2Reco_Pt2",
"GeneratedAllAssoc2Reco_Sum-pt2", 15,
272 mes_[
label][
"GenAllAssoc2Reco_NumTracks"] =
273 i.
book1D(
"GenAllAssoc2Reco_NumTracks",
274 "GeneratedAllAssoc2Reco_NumTracks", 24, &log_ntrk_bins[0]);
275 mes_[
label][
"GenAllAssoc2Reco_ClosestDistanceZ"] =
276 i.
book1D(
"GenAllAssoc2Reco_ClosestDistanceZ",
277 "GeneratedAllAssoc2Reco_ClosestDistanceZ", 30, &log_bins[0]);
281 mes_[
label][
"GenAllAssoc2RecoMatched_NumVertices"] =
282 i.
book1D(
"GenAllAssoc2RecoMatched_NumVertices",
283 "GeneratedAllAssoc2RecoMatched_NumVertices", 100, 0., 200.);
284 mes_[
label][
"GenAllAssoc2RecoMatched_X"] =
285 i.
book1D(
"GenAllAssoc2RecoMatched_X",
"GeneratedAllAssoc2RecoMatched_X",
287 mes_[
label][
"GenAllAssoc2RecoMatched_Y"] =
288 i.
book1D(
"GenAllAssoc2RecoMatched_Y",
"GeneratedAllAssoc2RecoMatched_Y",
290 mes_[
label][
"GenAllAssoc2RecoMatched_Z"] =
291 i.
book1D(
"GenAllAssoc2RecoMatched_Z",
"GeneratedAllAssoc2RecoMatched_Z",
293 mes_[
label][
"GenAllAssoc2RecoMatched_R"] =
294 i.
book1D(
"GenAllAssoc2RecoMatched_R",
"GeneratedAllAssoc2RecoMatched_R",
296 mes_[
label][
"GenAllAssoc2RecoMatched_Pt2"] =
297 i.
book1D(
"GenAllAssoc2RecoMatched_Pt2",
298 "GeneratedAllAssoc2RecoMatched_Sum-pt2", 15, &log_pt2_bins[0]);
299 mes_[
label][
"GenAllAssoc2RecoMatched_NumTracks"] =
300 i.
book1D(
"GenAllAssoc2RecoMatched_NumTracks",
301 "GeneratedAllAssoc2RecoMatched_NumTracks", 24, &log_ntrk_bins[0]);
303 "GenAllAssoc2RecoMatched_ClosestDistanceZ",
304 "GeneratedAllAssoc2RecoMatched_ClosestDistanceZ", 30, &log_bins[0]);
309 "GenAllAssoc2RecoMultiMatched_NumVertices",
310 "GeneratedAllAssoc2RecoMultiMatched_NumVertices", 100, 0., 200.);
311 mes_[
label][
"GenAllAssoc2RecoMultiMatched_X"] =
312 i.
book1D(
"GenAllAssoc2RecoMultiMatched_X",
313 "GeneratedAllAssoc2RecoMultiMatched_X", 120, -0.6, 0.6);
314 mes_[
label][
"GenAllAssoc2RecoMultiMatched_Y"] =
315 i.
book1D(
"GenAllAssoc2RecoMultiMatched_Y",
316 "GeneratedAllAssoc2RecoMultiMatched_Y", 120, -0.6, 0.6);
317 mes_[
label][
"GenAllAssoc2RecoMultiMatched_Z"] =
318 i.
book1D(
"GenAllAssoc2RecoMultiMatched_Z",
319 "GeneratedAllAssoc2RecoMultiMatched_Z", 120, -60, 60);
320 mes_[
label][
"GenAllAssoc2RecoMultiMatched_R"] =
321 i.
book1D(
"GenAllAssoc2RecoMultiMatched_R",
322 "GeneratedAllAssoc2RecoMultiMatched_R", 120, 0, 0.6);
323 mes_[
label][
"GenAllAssoc2RecoMultiMatched_Pt2"] =
324 i.
book1D(
"GenAllAssoc2RecoMultiMatched_Pt2",
325 "GeneratedAllAssoc2RecoMultiMatched_Sum-pt2",
326 15, &log_pt2_bins[0]);
327 mes_[
label][
"GenAllAssoc2RecoMultiMatched_NumTracks"] =
328 i.
book1D(
"GenAllAssoc2RecoMultiMatched_NumTracks",
329 "GeneratedAllAssoc2RecoMultiMatched_NumTracks", 24, &log_ntrk_bins[0]);
330 mes_[
label][
"GenAllAssoc2RecoMultiMatched_ClosestDistanceZ"] = i.
book1D(
331 "GenAllAssoc2RecoMultiMatched_ClosestDistanceZ",
332 "GeneratedAllAssoc2RecoMultiMatched_ClosestDistanceZ",
336 mes_[
label][
"RecoAllAssoc2Gen_NumVertices"] =
337 i.
book1D(
"RecoAllAssoc2Gen_NumVertices",
338 "ReconstructedAllAssoc2Gen_NumVertices", 100, 0., 200.);
340 "RecoAllAssoc2Gen_X",
"ReconstructedAllAssoc2Gen_X", 120, -0.6, 0.6);
342 "RecoAllAssoc2Gen_Y",
"ReconstructedAllAssoc2Gen_Y", 120, -0.6, 0.6);
344 "RecoAllAssoc2Gen_Z",
"ReconstructedAllAssoc2Gen_Z", 120, -60, 60);
346 "RecoAllAssoc2Gen_R",
"ReconstructedAllAssoc2Gen_R", 120, 0, 0.6);
348 i.
book1D(
"RecoAllAssoc2Gen_Pt2",
"ReconstructedAllAssoc2Gen_Sum-pt2",
349 15, &log_pt2_bins[0]);
351 i.
book1D(
"RecoAllAssoc2Gen_Ndof",
352 "ReconstructedAllAssoc2Gen_Ndof", 120, 0., 240.);
353 mes_[
label][
"RecoAllAssoc2Gen_NumTracks"] =
354 i.
book1D(
"RecoAllAssoc2Gen_NumTracks",
355 "ReconstructedAllAssoc2Gen_NumTracks", 24, &log_ntrk_bins[0]);
357 i.
book1D(
"RecoAllAssoc2Gen_PU",
358 "ReconstructedAllAssoc2Gen_PU", 125, 0., 250.);
359 mes_[
label][
"RecoAllAssoc2Gen_ClosestDistanceZ"] =
360 i.
book1D(
"RecoAllAssoc2Gen_ClosestDistanceZ",
361 "ReconstructedAllAssoc2Gen_ClosestDistanceZ",
363 mes_[
label][
"RecoAllAssoc2GenProperties"] =
364 i.
book1D(
"RecoAllAssoc2GenProperties",
365 "ReconstructedAllAssoc2Gen_Properties", 8, -0.5, 7.5);
366 mes_[
label][
"RecoAllAssoc2Gen_PairDistanceZ"] =
367 i.
book1D(
"RecoAllAssoc2Gen_PairDistanceZ",
368 "RecoAllAssoc2Gen_PairDistanceZ", 1000, 0, 20);
372 mes_[
label][
"RecoAllAssoc2GenMatched_NumVertices"] =
373 i.
book1D(
"RecoAllAssoc2GenMatched_NumVertices",
374 "ReconstructedAllAssoc2GenMatched_NumVertices", 100, 0., 200.);
375 mes_[
label][
"RecoAllAssoc2GenMatched_X"] =
376 i.
book1D(
"RecoAllAssoc2GenMatched_X",
377 "ReconstructedAllAssoc2GenMatched_X", 120, -0.6, 0.6);
378 mes_[
label][
"RecoAllAssoc2GenMatched_Y"] =
379 i.
book1D(
"RecoAllAssoc2GenMatched_Y",
380 "ReconstructedAllAssoc2GenMatched_Y", 120, -0.6, 0.6);
381 mes_[
label][
"RecoAllAssoc2GenMatched_Z"] =
382 i.
book1D(
"RecoAllAssoc2GenMatched_Z",
383 "ReconstructedAllAssoc2GenMatched_Z", 120, -60, 60);
384 mes_[
label][
"RecoAllAssoc2GenMatched_R"] =
385 i.
book1D(
"RecoAllAssoc2GenMatched_R",
386 "ReconstructedAllAssoc2GenMatched_R", 120, 0, 0.6);
387 mes_[
label][
"RecoAllAssoc2GenMatched_Pt2"] =
388 i.
book1D(
"RecoAllAssoc2GenMatched_Pt2",
389 "ReconstructedAllAssoc2GenMatched_Sum-pt2",
390 15, &log_pt2_bins[0]);
391 mes_[
label][
"RecoAllAssoc2GenMatched_Ndof"] =
392 i.
book1D(
"RecoAllAssoc2GenMatched_Ndof",
393 "ReconstructedAllAssoc2GenMatched_Ndof", 120, 0., 240.);
394 mes_[
label][
"RecoAllAssoc2GenMatched_NumTracks"] =
395 i.
book1D(
"RecoAllAssoc2GenMatched_NumTracks",
396 "ReconstructedAllAssoc2GenMatched_NumTracks", 24, &log_ntrk_bins[0]);
397 mes_[
label][
"RecoAllAssoc2GenMatched_PU"] =
398 i.
book1D(
"RecoAllAssoc2GenMatched_PU",
399 "ReconstructedAllAssoc2GenMatched_PU", 125, 0., 250.);
401 "RecoAllAssoc2GenMatched_ClosestDistanceZ",
402 "ReconstructedAllAssoc2GenMatched_ClosestDistanceZ", 30, &log_bins[0]);
407 "RecoAllAssoc2GenMultiMatched_NumVertices",
408 "ReconstructedAllAssoc2GenMultiMatched_NumVertices", 100, 0., 200.);
409 mes_[
label][
"RecoAllAssoc2GenMultiMatched_X"] =
410 i.
book1D(
"RecoAllAssoc2GenMultiMatched_X",
411 "ReconstructedAllAssoc2GenMultiMatched_X", 120, -0.6, 0.6);
412 mes_[
label][
"RecoAllAssoc2GenMultiMatched_Y"] =
413 i.
book1D(
"RecoAllAssoc2GenMultiMatched_Y",
414 "ReconstructedAllAssoc2GenMultiMatched_Y", 120, -0.6, 0.6);
415 mes_[
label][
"RecoAllAssoc2GenMultiMatched_Z"] =
416 i.
book1D(
"RecoAllAssoc2GenMultiMatched_Z",
417 "ReconstructedAllAssoc2GenMultiMatched_Z", 120, -60, 60);
418 mes_[
label][
"RecoAllAssoc2GenMultiMatched_R"] =
419 i.
book1D(
"RecoAllAssoc2GenMultiMatched_R",
420 "ReconstructedAllAssoc2GenMultiMatched_R", 120, 0, 0.6);
422 "RecoAllAssoc2GenMultiMatched_Pt2",
423 "ReconstructedAllAssoc2GenMultiMatched_Sum-pt2", 15, &log_pt2_bins[0]);
425 "RecoAllAssoc2GenMultiMatched_NumTracks",
426 "ReconstructedAllAssoc2GenMultiMatched_NumTracks", 24, &log_ntrk_bins[0]);
427 mes_[
label][
"RecoAllAssoc2GenMultiMatched_PU"] =
428 i.
book1D(
"RecoAllAssoc2GenMultiMatched_PU",
429 "ReconstructedAllAssoc2GenMultiMatched_PU", 125, 0., 250.);
430 mes_[
label][
"RecoAllAssoc2GenMultiMatched_ClosestDistanceZ"] =
431 i.
book1D(
"RecoAllAssoc2GenMultiMatched_ClosestDistanceZ",
432 "ReconstructedAllAssoc2GenMultiMatched_ClosestDistanceZ",
433 17, &log_mergez_bins[0]);
442 "RecoAllAssoc2MultiMatchedGen_NumVertices",
443 "RecoAllAssoc2MultiMatchedGen_NumVertices", 100, 0., 200.);
444 mes_[
label][
"RecoAllAssoc2MultiMatchedGen_X"] =
445 i.
book1D(
"RecoAllAssoc2MultiMatchedGen_X",
446 "RecoAllAssoc2MultiMatchedGen_X", 120, -0.6, 0.6);
447 mes_[
label][
"RecoAllAssoc2MultiMatchedGen_Y"] =
448 i.
book1D(
"RecoAllAssoc2MultiMatchedGen_Y",
449 "RecoAllAssoc2MultiMatchedGen_Y", 120, -0.6, 0.6);
450 mes_[
label][
"RecoAllAssoc2MultiMatchedGen_Z"] =
451 i.
book1D(
"RecoAllAssoc2MultiMatchedGen_Z",
452 "RecoAllAssoc2MultiMatchedGen_Z", 120, -60, 60);
453 mes_[
label][
"RecoAllAssoc2MultiMatchedGen_R"] =
454 i.
book1D(
"RecoAllAssoc2MultiMatchedGen_R",
455 "RecoAllAssoc2MultiMatchedGen_R", 120, 0, 0.6);
456 mes_[
label][
"RecoAllAssoc2MultiMatchedGen_Pt2"] =
457 i.
book1D(
"RecoAllAssoc2MultiMatchedGen_Pt2",
458 "RecoAllAssoc2MultiMatchedGen_Sum-pt2", 15, &log_pt2_bins[0]);
459 mes_[
label][
"RecoAllAssoc2MultiMatchedGen_NumTracks"] =
460 i.
book1D(
"RecoAllAssoc2MultiMatchedGen_NumTracks",
461 "RecoAllAssoc2MultiMatchedGen_NumTracks", 24, &log_ntrk_bins[0]);
462 mes_[
label][
"RecoAllAssoc2MultiMatchedGen_PU"] =
463 i.
book1D(
"RecoAllAssoc2MultiMatchedGen_PU",
464 "RecoAllAssoc2MultiMatchedGen_PU", 125, 0., 250.);
465 mes_[
label][
"RecoAllAssoc2MultiMatchedGen_ClosestDistanceZ"] = i.
book1D(
466 "RecoAllAssoc2MultiMatchedGen_ClosestDistanceZ",
467 "RecoAllAssoc2MultiMatchedGen_ClosestDistanceZ", 30, &log_bins[0]);
468 mes_[
label][
"RecoAllAssoc2GenSimForMerge_ClosestDistanceZ"] = i.
book1D(
469 "RecoAllAssoc2GenSimForMerge_ClosestDistanceZ",
470 "RecoAllAssoc2GenSimForMerge_ClosestDistanceZ",
471 17, &log_mergez_bins[0]);
475 auto book1d = [&](
const char *
name,
int bins,
double min,
double max) {
478 auto book1dlogx = [&](
const char *
name,
int bins,
float *xbinedges) {
481 auto book2d = [&](
const char *
name,
483 int ybins,
double ymin,
double ymax) {
486 auto book2dlogx = [&](
const char *
name,
487 int xbins,
float *xbinedges,
488 int ybins,
double ymin,
double ymax) {
489 auto me = i.
book2D(name, name, xbins,xbinedges[0],xbinedges[xbins], ybins,ymin,
ymax);
490 me->
getTH2F()->GetXaxis()->Set(xbins, xbinedges);
494 const double resolx = 0.1;
495 const double resoly = 0.1;
496 const double resolz = 0.1;
497 const double resolpt2 = 10;
500 book1d(
"RecoAllAssoc2GenMatched_ResolX", 100,-resolx,resolx);
501 book1d(
"RecoAllAssoc2GenMatched_ResolY", 100,-resoly,resoly);
502 book1d(
"RecoAllAssoc2GenMatched_ResolZ", 100,-resolz,resolz);
503 book1d(
"RecoAllAssoc2GenMatched_ResolPt2", 100,-resolpt2,resolpt2);
505 book2d(
"RecoAllAssoc2GenMatched_ResolX_vs_PU", 125,0.,250., 100,-resolx,resolx);
506 book2d(
"RecoAllAssoc2GenMatched_ResolY_vs_PU", 125,0.,250., 100,-resoly,resoly);
507 book2d(
"RecoAllAssoc2GenMatched_ResolZ_vs_PU", 125,0.,250., 100,-resolz,resolz);
508 book2d(
"RecoAllAssoc2GenMatched_ResolPt2_vs_PU", 125,0.,250., 100,-resolpt2,resolpt2);
510 book2dlogx(
"RecoAllAssoc2GenMatched_ResolX_vs_NumTracks", 24,&log_ntrk_bins[0], 100,-resolx,resolx);
511 book2dlogx(
"RecoAllAssoc2GenMatched_ResolY_vs_NumTracks", 24,&log_ntrk_bins[0], 100,-resoly,resoly);
512 book2dlogx(
"RecoAllAssoc2GenMatched_ResolZ_vs_NumTracks", 24,&log_ntrk_bins[0], 100,-resolz,resolz);
513 book2dlogx(
"RecoAllAssoc2GenMatched_ResolPt2_vs_NumTracks", 24,&log_ntrk_bins[0], 100,-resolpt2,resolpt2);
515 book1d(
"RecoAllAssoc2GenMatched_PullX", 250,-25,25);
516 book1d(
"RecoAllAssoc2GenMatched_PullY", 250,-25,25);
517 book1d(
"RecoAllAssoc2GenMatched_PullZ", 250,-25,25);
520 book1d(
"RecoAllAssoc2GenMatchedMerged_ResolX", 100,-resolx,resolx);
521 book1d(
"RecoAllAssoc2GenMatchedMerged_ResolY", 100,-resoly,resoly);
522 book1d(
"RecoAllAssoc2GenMatchedMerged_ResolZ", 100,-resolz,resolz);
523 book1d(
"RecoAllAssoc2GenMatchedMerged_ResolPt2", 100,-resolpt2,resolpt2);
525 book2d(
"RecoAllAssoc2GenMatchedMerged_ResolX_vs_PU", 125,0.,250., 100,-resolx,resolx);
526 book2d(
"RecoAllAssoc2GenMatchedMerged_ResolY_vs_PU", 125,0.,250., 100,-resoly,resoly);
527 book2d(
"RecoAllAssoc2GenMatchedMerged_ResolZ_vs_PU", 125,0.,250., 100,-resolz,resolz);
528 book2d(
"RecoAllAssoc2GenMatchedMerged_ResolPt2_vs_PU", 125,0.,250., 100,-resolpt2,resolpt2);
530 book2dlogx(
"RecoAllAssoc2GenMatchedMerged_ResolX_vs_NumTracks", 24,&log_ntrk_bins[0], 100,-resolx,resolx);
531 book2dlogx(
"RecoAllAssoc2GenMatchedMerged_ResolY_vs_NumTracks", 24,&log_ntrk_bins[0], 100,-resoly,resoly);
532 book2dlogx(
"RecoAllAssoc2GenMatchedMerged_ResolZ_vs_NumTracks", 24,&log_ntrk_bins[0], 100,-resolz,resolz);
533 book2dlogx(
"RecoAllAssoc2GenMatchedMerged_ResolPt2_vs_NumTracks", 24,&log_ntrk_bins[0], 100,-resolpt2,resolpt2);
535 book1d(
"RecoAllAssoc2GenMatchedMerged_PullX", 250,-25,25);
536 book1d(
"RecoAllAssoc2GenMatchedMerged_PullY", 250,-25,25);
537 book1d(
"RecoAllAssoc2GenMatchedMerged_PullZ", 250,-25,25);
542 book1d(
"RecoPVAssoc2GenPVMatched_Purity", 50, 0, 1);
543 book1d(
"RecoPVAssoc2GenPVMatched_Missing", 50, 0, 1);
544 book2d(
"RecoPVAssoc2GenPVMatched_Purity_vs_Index", 100,0,100, 50,0,1);
547 book1d(
"RecoPVAssoc2GenPVNotMatched_Purity", 50, 0, 1);
548 book1d(
"RecoPVAssoc2GenPVNotMatched_Missing", 50, 0, 1);
549 book2d(
"RecoPVAssoc2GenPVNotMatched_Purity_vs_Index", 100,0,100, 50,0,1);
552 book1d(
"RecoAllAssoc2Gen_Purity", 50, 0, 1);
553 book1d(
"RecoAllAssoc2GenMatched_Purity", 50, 0, 1);
557 book1dlogx(
"RecoAssoc2GenPVMatched_Pt2", 15, &log_pt2_bins[0]);
558 book1dlogx(
"RecoAssoc2GenPVNotMatched_Pt2", 15, &log_pt2_bins[0]);
560 book1dlogx(
"RecoAssoc2GenPVMatchedNotHighest_Pt2", 15, &log_pt2_bins[0]);
561 book1dlogx(
"RecoAssoc2GenPVNotMatched_GenPVTracksRemoved_Pt2", 15, &log_pt2_bins[0]);
564 book1d(
"RecoAllAssoc2GenSingleMatched_SharedTrackFractionReco", 50, 0, 1);
565 book1d(
"RecoAllAssoc2GenMultiMatched_SharedTrackFractionReco", 50, 0, 1);
566 book1d(
"RecoAllAssoc2GenSingleMatched_SharedTrackFractionRecoMatched", 50, 0, 1);
567 book1d(
"RecoAllAssoc2GenMultiMatched_SharedTrackFractionRecoMatched", 50, 0, 1);
569 book1d(
"RecoAllAssoc2GenSingleMatched_SharedTrackFractionSim", 50, 0, 1);
570 book1d(
"RecoAllAssoc2GenMultiMatched_SharedTrackFractionSim", 50, 0, 1);
571 book1d(
"RecoAllAssoc2GenSingleMatched_SharedTrackFractionSimMatched", 50, 0, 1);
572 book1d(
"RecoAllAssoc2GenMultiMatched_SharedTrackFractionSimMatched", 50, 0, 1);
579 mes_[
"root_folder"][
"GenPV_X"]->Fill(v.
x);
580 mes_[
"root_folder"][
"GenPV_Y"]->Fill(v.
y);
581 mes_[
"root_folder"][
"GenPV_Z"]->Fill(v.
z);
582 mes_[
"root_folder"][
"GenPV_R"]->Fill(v.
r);
583 mes_[
"root_folder"][
"GenPV_Pt2"]->Fill(v.
ptsq);
584 mes_[
"root_folder"][
"GenPV_NumTracks"]->Fill(v.
nGenTrk);
586 mes_[
"root_folder"][
"GenPV_ClosestDistanceZ"]
589 mes_[
"root_folder"][
"GenAllV_X"]->Fill(v.
x);
590 mes_[
"root_folder"][
"GenAllV_Y"]->Fill(v.
y);
591 mes_[
"root_folder"][
"GenAllV_Z"]->Fill(v.
z);
592 mes_[
"root_folder"][
"GenAllV_R"]->Fill(v.
r);
593 mes_[
"root_folder"][
"GenAllV_Pt2"]->Fill(v.
ptsq);
594 mes_[
"root_folder"][
"GenAllV_NumTracks"]->Fill(v.
nGenTrk);
596 mes_[
"root_folder"][
"GenAllV_ClosestDistanceZ"]
610 mes_[
label][
"GenAllAssoc2Reco_ClosestDistanceZ"]
613 mes_[
label][
"GenAllAssoc2RecoMatched_X"]->Fill(v.
x);
614 mes_[
label][
"GenAllAssoc2RecoMatched_Y"]->Fill(v.
y);
615 mes_[
label][
"GenAllAssoc2RecoMatched_Z"]->Fill(v.
z);
616 mes_[
label][
"GenAllAssoc2RecoMatched_R"]->Fill(v.
r);
620 mes_[
label][
"GenAllAssoc2RecoMatched_ClosestDistanceZ"]
624 mes_[
label][
"GenAllAssoc2RecoMultiMatched_X"]->Fill(v.
x);
625 mes_[
label][
"GenAllAssoc2RecoMultiMatched_Y"]->Fill(v.
y);
626 mes_[
label][
"GenAllAssoc2RecoMultiMatched_Z"]->Fill(v.
z);
627 mes_[
label][
"GenAllAssoc2RecoMultiMatched_R"]->Fill(v.
r);
628 mes_[
label][
"GenAllAssoc2RecoMultiMatched_Pt2"]->Fill(v.
ptsq);
631 mes_[
label][
"GenAllAssoc2RecoMultiMatched_ClosestDistanceZ"]
638 int num_pileup_vertices,
647 mes_[
label][
"RecoAllAssoc2Gen_PU"]->Fill(num_pileup_vertices);
650 mes_[
label][
"RecoAllAssoc2Gen_ClosestDistanceZ"]
654 mes_[
label][
"RecoAllAssoc2GenMatched_X"]->Fill(v.
x);
655 mes_[
label][
"RecoAllAssoc2GenMatched_Y"]->Fill(v.
y);
656 mes_[
label][
"RecoAllAssoc2GenMatched_Z"]->Fill(v.
z);
657 mes_[
label][
"RecoAllAssoc2GenMatched_R"]->Fill(v.
r);
661 mes_[
label][
"RecoAllAssoc2GenMatched_PU"]->Fill(num_pileup_vertices);
664 mes_[
label][
"RecoAllAssoc2GenMatched_ClosestDistanceZ"]
675 mes_[
label][
"RecoAllAssoc2MultiMatchedGen_X"]->Fill(v.
x);
676 mes_[
label][
"RecoAllAssoc2MultiMatchedGen_Y"]->Fill(v.
y);
677 mes_[
label][
"RecoAllAssoc2MultiMatchedGen_Z"]->Fill(v.
z);
678 mes_[
label][
"RecoAllAssoc2MultiMatchedGen_R"]->Fill(v.
r);
679 mes_[
label][
"RecoAllAssoc2MultiMatchedGen_Pt2"]->Fill(v.
ptsq);
681 mes_[
label][
"RecoAllAssoc2MultiMatchedGen_PU"]->Fill(num_pileup_vertices);
683 mes_[
label][
"RecoAllAssoc2MultiMatchedGen_ClosestDistanceZ"]
693 mes_[
label][
"RecoAllAssoc2GenSimForMerge_ClosestDistanceZ"]
699 mes_[
label][
"RecoAllAssoc2GenMultiMatched_X"]->Fill(v.
x);
700 mes_[
label][
"RecoAllAssoc2GenMultiMatched_Y"]->Fill(v.
y);
701 mes_[
label][
"RecoAllAssoc2GenMultiMatched_Z"]->Fill(v.
z);
702 mes_[
label][
"RecoAllAssoc2GenMultiMatched_R"]->Fill(v.
r);
703 mes_[
label][
"RecoAllAssoc2GenMultiMatched_Pt2"]->Fill(v.
ptsq);
705 mes_[
label][
"RecoAllAssoc2GenMultiMatched_PU"]->Fill(num_pileup_vertices);
707 mes_[
label][
"RecoAllAssoc2GenMultiMatched_ClosestDistanceZ"]
715 prefix =
"RecoAllAssoc2GenSingleMatched_SharedTrackFraction";
718 prefix =
"RecoAllAssoc2GenMultiMatched_SharedTrackFraction";
733 int num_pileup_vertices,
744 const double xres = v.
x - bestMatch.
x;
745 const double yres = v.
y - bestMatch.
y;
746 const double zres = v.
z - bestMatch.
z;
747 const double pt2res = v.
ptsq - bestMatch.
ptsq;
749 const double xresol = xres;
750 const double yresol = yres;
751 const double zresol = zres;
752 const double pt2resol = pt2res/v.
ptsq;
754 mes_[
label][prefix+
"_ResolX"]->Fill(xresol);
755 mes_[
label][prefix+
"_ResolY"]->Fill(yresol);
756 mes_[
label][prefix+
"_ResolZ"]->Fill(zresol);
757 mes_[
label][prefix+
"_ResolPt2"]->Fill(pt2resol);
759 mes_[
label][prefix+
"_ResolX_vs_PU"]->Fill(num_pileup_vertices, xresol);
760 mes_[
label][prefix+
"_ResolY_vs_PU"]->Fill(num_pileup_vertices, yresol);
761 mes_[
label][prefix+
"_ResolZ_vs_PU"]->Fill(num_pileup_vertices, zresol);
762 mes_[
label][prefix+
"_ResolPt2_vs_PU"]->Fill(num_pileup_vertices, pt2resol);
782 for(
const auto& tp:
found->val) {
783 if(tp.first->eventId().bunchCrossing() == 0 && tp.first->eventId().event() == 0)
793 std::vector<recoPrimaryVertex>& recopvs,
794 int genpv_position_in_reco_collection,
795 bool signal_is_highest_pt) {
796 if(recopvs.empty())
return;
798 std::vector<double> vtx_sumpt_sigmatched;
799 std::vector<double> vtx_sumpt2_sigmatched;
801 vtx_sumpt_sigmatched.reserve(recopvs.size());
802 vtx_sumpt2_sigmatched.reserve(recopvs.size());
805 for(
auto&
v: recopvs) {
806 double sumpt_all = 0;
807 double sumpt_sigmatched = 0;
808 double sumpt2_sigmatched = 0;
811 double pt = (*iTrack)->pt();
814 sumpt_sigmatched +=
pt;
815 sumpt2_sigmatched += pt*
pt;
818 v.purity = sumpt_sigmatched / sumpt_all;
820 vtx_sumpt_sigmatched.push_back(sumpt_sigmatched);
821 vtx_sumpt2_sigmatched.push_back(sumpt2_sigmatched);
824 const double vtxAll_sumpt_sigmatched = std::accumulate(vtx_sumpt_sigmatched.begin(), vtx_sumpt_sigmatched.end(), 0.0);
825 const double vtxNot0_sumpt_sigmatched = vtxAll_sumpt_sigmatched - vtx_sumpt_sigmatched[0];
826 const double missing = vtxNot0_sumpt_sigmatched / vtxAll_sumpt_sigmatched;
830 if(genpv_position_in_reco_collection == 0)
831 prefix =
"RecoPVAssoc2GenPVMatched_";
833 mes_[
label][prefix+
"Purity"]->Fill(recopvs[0].purity);
834 mes_[
label][prefix+
"Missing"]->Fill(missing);
835 auto hpurity =
mes_[
label][prefix+
"Purity_vs_Index"];
836 for(
size_t i=0;
i<recopvs.size(); ++
i) {
837 hpurity->Fill(
i, recopvs[
i].purity);
841 for(
size_t i=0;
i<recopvs.size(); ++
i) {
842 if(static_cast<int>(
i) == genpv_position_in_reco_collection) {
843 mes_[
label][
"RecoAssoc2GenPVMatched_Pt2"]->Fill(recopvs[
i].ptsq);
846 double pt2 = recopvs[
i].ptsq;
847 mes_[
label][
"RecoAssoc2GenPVNotMatched_Pt2"]->Fill(pt2);
849 double pt2_pu = pt2-vtx_sumpt2_sigmatched[
i];
850 mes_[
label][
"RecoAssoc2GenPVNotMatched_GenPVTracksRemoved_Pt2"]->Fill(pt2_pu);
853 if(!signal_is_highest_pt && genpv_position_in_reco_collection >= 0)
854 mes_[
label][
"RecoAssoc2GenPVMatchedNotHighest_Pt2"]->Fill(recopvs[genpv_position_in_reco_collection].ptsq);
860 std::vector<PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex>
863 std::vector<PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex> simpv;
864 int current_event = -1;
867 std::cout <<
"getSimPVs TrackingVertexCollection " << std::endl;
870 for (TrackingVertexCollection::const_iterator
v = tVC->begin();
871 v != tVC->end(); ++
v) {
873 std::cout <<
"BunchX.EventId: " <<
v->eventId().bunchCrossing() <<
"."
874 << (
v->eventId()).
event() <<
" Position: " <<
v->position()
875 <<
" G4/HepMC Vertices: " <<
v->g4Vertices().size() <<
"/"
876 <<
v->genVertices().size()
877 <<
" t = " <<
v->position().t() * 1.e12
878 <<
" == 0:" << (
v->position().t() > 0) << std::endl;
880 gv !=
v->g4Vertices_end(); gv++) {
889 if (
v->eventId().bunchCrossing() != 0)
continue;
890 if (
v->eventId().event() != current_event) {
891 current_event =
v->eventId().event();
896 if (fabs(
v->position().z()) > 1000)
continue;
906 iTrack !=
v->daughterTracks_end(); ++iTrack) {
910 assert((**iTrack).eventId().bunchCrossing() == 0);
915 for (std::vector<simPrimaryVertex>::iterator v0 = simpv.begin();
916 v0 != simpv.end(); v0++) {
917 if ((sv.eventId == v0->eventId) && (fabs(sv.x - v0->x) < 1
e-5) &&
918 (fabs(sv.y - v0->y) < 1
e-5) && (fabs(sv.z - v0->z) < 1
e-5)) {
928 std::cout <<
"this is a new vertex " << sv.eventId.event() <<
" "
929 << sv.x <<
" " << sv.y <<
" " << sv.z << std::endl;
933 std::cout <<
"this is not a new vertex" << sv.x <<
" " << sv.y <<
" "
934 << sv.z << std::endl;
940 iTP !=
v->daughterTracks_end(); ++iTP) {
941 auto momentum = (*(*iTP)).momentum();
942 const reco::Track* matched_best_reco_track =
nullptr;
943 double match_quality = -1;
947 matched_best_reco_track = (*s2r_)[*iTP][0].first.get();
948 match_quality = (*s2r_)[*iTP][0].second;
951 std::cout <<
" Daughter momentum: " << momentum;
953 std::cout <<
" matched: " << (matched_best_reco_track !=
nullptr);
954 std::cout <<
" match-quality: " << match_quality;
957 vp->
ptot.setPx(vp->
ptot.x() + momentum.x());
958 vp->
ptot.setPy(vp->
ptot.y() + momentum.y());
959 vp->
ptot.setPz(vp->
ptot.z() + momentum.z());
960 vp->
ptot.setE(vp->
ptot.e() + (**iTP).energy());
961 vp->
ptsq += ((**iTP).pt() * (**iTP).pt());
964 if (matched_best_reco_track) {
972 if (((**iTP).pt() > 0.2) && (fabs((**iTP).eta()) < 2.5) &&
973 (**iTP).charge() != 0) {
981 std::cout <<
"average number of associated tracks: "
989 std::cout <<
"------- PrimaryVertexAnalyzer4PUSlimmed simPVs from "
991 "-------" << std::endl;
992 for (std::vector<simPrimaryVertex>::iterator v0 = simpv.begin();
993 v0 != simpv.end(); v0++) {
994 std::cout <<
"z=" << v0->z <<
" event=" << v0->eventId.event()
997 std::cout <<
"-----------------------------------------------" << std::endl;
1006 auto prev_z = simpv.back().z;
1008 vsim.closest_vertex_distance_z =
std::abs(vsim.z - prev_z);
1012 for (std::vector<simPrimaryVertex>::iterator vsim = simpv.begin();
1013 vsim != simpv.end(); vsim++) {
1014 std::vector<simPrimaryVertex>::iterator vsim2 = vsim;
1016 for (; vsim2 != simpv.end(); vsim2++) {
1019 vsim->closest_vertex_distance_z =
std::min(vsim->closest_vertex_distance_z, distance);
1020 vsim2->closest_vertex_distance_z =
std::min(vsim2->closest_vertex_distance_z, distance);
1028 std::vector<PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex>
1031 std::vector<PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex> recopv;
1034 std::cout <<
"getRecoPVs TrackingVertexCollection " << std::endl;
1037 for (
auto v = tVC->begin();
v != tVC->end(); ++
v) {
1039 std::cout <<
" Position: " <<
v->position() << std::endl;
1043 if (fabs(
v->z()) > 1000)
continue;
1044 if (
v->isFake() || !
v->isValid())
continue;
1051 recopv.push_back(sv);
1055 for (
auto iTrack =
v->tracks_begin(); iTrack !=
v->tracks_end(); ++iTrack) {
1056 auto momentum = (*(*iTrack)).innerMomentum();
1060 if (momentum.mag2() == 0)
1061 momentum = (*(*iTrack)).momentum();
1063 std::cout <<
" Daughter momentum: " << momentum;
1066 vp->
ptsq += (momentum.perp2());
1069 auto matched =
r2s_->
find(*iTrack);
1078 std::cout <<
"------- PrimaryVertexAnalyzer4PUSlimmed recoPVs from "
1080 "-------" << std::endl;
1081 for (std::vector<recoPrimaryVertex>::iterator v0 = recopv.begin();
1082 v0 != recopv.end(); v0++) {
1083 std::cout <<
"z=" << v0->z << std::endl;
1085 std::cout <<
"-----------------------------------------------" << std::endl;
1094 auto prev_z = recopv.back().z;
1096 vreco.closest_vertex_distance_z =
std::abs(vreco.z - prev_z);
1099 for (std::vector<recoPrimaryVertex>::iterator vreco = recopv.begin();
1100 vreco != recopv.end(); vreco++) {
1101 std::vector<recoPrimaryVertex>::iterator vreco2 = vreco;
1103 for (; vreco2 != recopv.end(); vreco2++) {
1106 vreco->closest_vertex_distance_z =
std::min(vreco->closest_vertex_distance_z, distance);
1107 vreco2->closest_vertex_distance_z =
std::min(vreco2->closest_vertex_distance_z, distance);
1114 std::vector<simPrimaryVertex> & simpv) {
1115 for (
auto &
v : simpv) {
1116 v.rec_vertices.clear();
1122 std::vector<simPrimaryVertex>& simpv,
1125 std::cout <<
"PrimaryVertexAnalyzer4PUSlimmed::matchSim2RecoVertices " << std::endl;
1127 for (std::vector<simPrimaryVertex>::iterator vsim = simpv.begin();
1128 vsim != simpv.end(); vsim++) {
1130 auto matched = vertex_s2r.
find(vsim->sim_vertex);
1131 if(matched != vertex_s2r.
end()) {
1132 for(
const auto vertexRefQuality: matched->val) {
1133 vsim->rec_vertices.push_back(&(*(vertexRefQuality.first)));
1138 if (vsim->rec_vertices.size()) {
1139 for (
auto const&
v : vsim->rec_vertices) {
1140 std::cout <<
"Found a matching vertex for genVtx "
1141 << vsim->z <<
" at " <<
v->z()
1142 <<
" with sign: " << fabs(
v->z() - vsim->z) /
v->zError()
1146 std::cout <<
"No matching vertex for " << vsim->z << std::endl;
1151 std::cout <<
"Done with matching sim vertices" << std::endl;
1156 std::vector<recoPrimaryVertex>& recopv,
1158 const std::vector<simPrimaryVertex>& simpv) {
1159 for (std::vector<recoPrimaryVertex>::iterator vrec = recopv.begin();
1160 vrec != recopv.end(); vrec++) {
1162 auto matched = vertex_r2s.
find(vrec->recVtxRef);
1163 if(matched != vertex_r2s.
end()) {
1164 for(
const auto vertexRefQuality: matched->val) {
1165 const auto tvPtr = &(*(vertexRefQuality.first));
1166 vrec->sim_vertices.push_back(tvPtr);
1171 for(
const auto& vv: simpv) {
1172 if (&(*(vv.sim_vertex)) == tv) {
1173 vrec->sim_vertices_internal.push_back(&vv);
1184 for (
auto v : vrec->sim_vertices) {
1185 std::cout <<
"Found a matching vertex for reco: " << vrec->z
1186 <<
" at gen:" <<
v->position().z() <<
" with sign: "
1187 << fabs(vrec->z -
v->position().z()) / vrec->recVtx->zError()
1202 using namespace reco;
1204 std::vector<float> pileUpInfo_z;
1209 for (
auto const& pu_info : *puinfoH.product()) {
1210 mes_[
"root_folder"][
"GenVtx_vs_BX"]
1211 ->Fill(pu_info.getBunchCrossing(), pu_info.getPU_NumInteractions());
1212 if (pu_info.getBunchCrossing() == 0) {
1213 pileUpInfo_z = pu_info.getPU_zpositions();
1215 for (
auto const&
p : pileUpInfo_z) {
1216 std::cout <<
"PileUpInfo on Z vertex: " <<
p << std::endl;
1224 Handle<reco::TrackCollection> recTrks;
1228 Handle<View<Track> > trackCollectionH;
1248 s2r_ = simToRecoH.product();
1249 r2s_ = recoToSimH.product();
1256 std::vector<simPrimaryVertex> simpv;
1262 int kind_of_signal_vertex = 0;
1263 int num_pileup_vertices = simpv.size();
1264 mes_[
"root_folder"][
"GenAllV_NumVertices"]->Fill(simpv.size());
1265 bool signal_is_highest_pt = std::max_element(simpv.begin(), simpv.end(),
1268 return lhs.ptsq < rhs.ptsq;
1269 }) == simpv.begin();
1270 kind_of_signal_vertex |= (signal_is_highest_pt <<
HIGHEST_PT);
1271 mes_[
"root_folder"][
"SignalIsHighestPt2"]->Fill(
1272 signal_is_highest_pt ? 1. : 0.);
1274 mes_[
"root_folder"][
"GenAllV_PairDistanceZ"]);
1276 int label_index = -1;
1278 std::vector<recoPrimaryVertex> recopv;
1282 if (!iEvent.
getByToken(vertex_token, recVtxs)) {
1283 LogInfo(
"PrimaryVertexAnalyzer4PUSlimmed")
1284 <<
"Skipping vertex collection: " << label <<
" since it is missing."
1296 mes_[label][
"RecoAllAssoc2Gen_PairDistanceZ"]);
1299 int num_total_gen_vertices_assoc2reco = 0;
1300 int num_total_reco_vertices_assoc2gen = 0;
1301 int num_total_gen_vertices_multiassoc2reco = 0;
1302 int num_total_reco_vertices_multiassoc2gen = 0;
1303 int num_total_reco_vertices_duplicate = 0;
1304 int genpv_position_in_reco_collection = -1;
1305 for (
auto const&
v : simpv) {
1308 if (
v.eventId.event() == 0) {
1309 if (!recVtxs->empty() &&
1310 std::find(
v.rec_vertices.begin(),
v.rec_vertices.end(),
1311 &((*recVtxs.
product())[0])) !=
v.rec_vertices.end()) {
1315 if (
v.rec_vertices.size()) {
1319 mes_[
label][
"KindOfSignalPV"]->Fill(kind_of_signal_vertex);
1320 mes_[
label][
"MisTagRate"]->Fill(mistag);
1321 mes_[
label][
"MisTagRate_vs_PU"]->Fill(simpv.size(), mistag);
1322 mes_[
label][
"MisTagRate_vs_sum-pt2"]->Fill(
v.ptsq, mistag);
1323 mes_[
label][
"MisTagRate_vs_Z"]->Fill(
v.z, mistag);
1324 mes_[
label][
"MisTagRate_vs_R"]->Fill(
v.r, mistag);
1325 mes_[
label][
"MisTagRate_vs_NumTracks"]->Fill(
v.nGenTrk, mistag);
1326 if (signal_is_highest_pt) {
1327 mes_[
label][
"MisTagRateSignalIsHighest"]->Fill(mistag);
1328 mes_[
label][
"MisTagRateSignalIsHighest_vs_PU"]->Fill(simpv.size(),
1330 mes_[
label][
"MisTagRateSignalIsHighest_vs_sum-pt2"]->Fill(
v.ptsq,
1332 mes_[
label][
"MisTagRateSignalIsHighest_vs_Z"]->Fill(
v.z, mistag);
1333 mes_[
label][
"MisTagRateSignalIsHighest_vs_R"]->Fill(
v.r, mistag);
1334 mes_[
label][
"MisTagRateSignalIsHighest_vs_NumTracks"]->Fill(
v.nGenTrk,
1337 mes_[
label][
"MisTagRateSignalIsNotHighest"]->Fill(mistag);
1338 mes_[
label][
"MisTagRateSignalIsNotHighest_vs_PU"]->Fill(simpv.size(),
1340 mes_[
label][
"MisTagRateSignalIsNotHighest_vs_sum-pt2"]->Fill(
v.ptsq,
1342 mes_[
label][
"MisTagRateSignalIsNotHighest_vs_Z"]->Fill(
v.z, mistag);
1343 mes_[
label][
"MisTagRateSignalIsNotHighest_vs_R"]->Fill(
v.r, mistag);
1344 mes_[
label][
"MisTagRateSignalIsNotHighest_vs_NumTracks"]->
1345 Fill(
v.nGenTrk, mistag);
1353 for (
int pv_position_in_reco_collection = 0;
1355 ++pv_position_in_reco_collection, ++iv) {
1356 if (
std::find(
v.rec_vertices.begin(),
v.rec_vertices.end(),
1357 &(*iv)) !=
v.rec_vertices.end()) {
1359 ->Fill(pv_position_in_reco_collection);
1360 mes_[
label][
"TruePVLocationIndexCumulative"]
1361 ->Fill(pv_position_in_reco_collection > 0 ? 1 : 0);
1363 if (signal_is_highest_pt) {
1364 mes_[
label][
"TruePVLocationIndexSignalIsHighest"]
1365 ->Fill(pv_position_in_reco_collection);
1367 mes_[
label][
"TruePVLocationIndexSignalIsNotHighest"]
1368 ->Fill(pv_position_in_reco_collection);
1371 genpv_position_in_reco_collection = pv_position_in_reco_collection;
1381 mes_[
label][
"TruePVLocationIndex"]->Fill(-1.);
1382 mes_[
label][
"TruePVLocationIndexCumulative"]->Fill(-1.);
1383 if (signal_is_highest_pt)
1384 mes_[
label][
"TruePVLocationIndexSignalIsHighest"]->Fill(-1.);
1386 mes_[
label][
"TruePVLocationIndexSignalIsNotHighest"]->Fill(-1.);
1390 if (
v.rec_vertices.size()) num_total_gen_vertices_assoc2reco++;
1391 if (
v.rec_vertices.size() > 1) num_total_gen_vertices_multiassoc2reco++;
1399 mes_[
label][
"GenAllAssoc2Reco_NumVertices"]
1400 ->Fill(simpv.size(), simpv.size());
1401 mes_[
label][
"GenAllAssoc2RecoMatched_NumVertices"]
1402 ->Fill(simpv.size(), num_total_gen_vertices_assoc2reco);
1403 mes_[
label][
"GenAllAssoc2RecoMultiMatched_NumVertices"]
1404 ->Fill(simpv.size(), num_total_gen_vertices_multiassoc2reco);
1405 for (
auto &
v : recopv) {
1407 if (
v.sim_vertices.size()) {
1408 num_total_reco_vertices_assoc2gen++;
1409 if (
v.sim_vertices_internal[0]->rec_vertices.size() > 1) {
1410 num_total_reco_vertices_duplicate++;
1413 if (
v.sim_vertices.size() > 1) num_total_reco_vertices_multiassoc2gen++;
1415 mes_[
label][
"RecoAllAssoc2Gen_NumVertices"]
1416 ->Fill(recopv.size(), recopv.size());
1417 mes_[
label][
"RecoAllAssoc2GenMatched_NumVertices"]
1418 ->Fill(recopv.size(), num_total_reco_vertices_assoc2gen);
1419 mes_[
label][
"RecoAllAssoc2GenMultiMatched_NumVertices"]
1420 ->Fill(recopv.size(), num_total_reco_vertices_multiassoc2gen);
1421 mes_[
label][
"RecoAllAssoc2MultiMatchedGen_NumVertices"]
1422 ->Fill(recopv.size(), num_total_reco_vertices_duplicate);
1423 mes_[
label][
"RecoVtx_vs_GenVtx"]->Fill(simpv.size(), recopv.size());
1425 ->Fill(simpv.size(), num_total_reco_vertices_assoc2gen);
1433 for (
unsigned int i = 0;
i < collection.size(); ++
i) {
1434 for (
unsigned int j =
i+1;
j < collection.size(); ++
j) {
T getParameter(std::string const &) const
void matchSim2RecoVertices(std::vector< simPrimaryVertex > &, const reco::VertexSimToRecoCollection &)
void fillGenAssociatedRecoVertexHistograms(const std::string &, int, recoPrimaryVertex &v)
std::vector< PrimaryVertexAnalyzer4PUSlimmed::recoPrimaryVertex > getRecoPVs(const edm::Handle< edm::View< reco::Vertex >> &)
double closest_vertex_distance_z
edm::EDGetTokenT< edm::View< reco::Track > > edmView_recoTrack_Token_
int event() const
get the contents of the subdetector field (should be protected?)
bool matchRecoTrack2SimSignal(const reco::TrackBaseRef &)
void resetSimPVAssociation(std::vector< simPrimaryVertex > &)
std::vector< const simPrimaryVertex * > sim_vertices_internal
edm::EDGetTokenT< reco::SimToRecoCollection > simToRecoAssociationToken_
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > vecPileupSummaryInfoToken_
std::vector< TrackingParticle > TrackingParticleCollection
trackRef_iterator tracks_end() const
last iterator over tracks
void computePairDistance(const T &collection, MonitorElement *me)
const_iterator end() const
last iterator over the map (read only)
MonitorElement * bookProfile(Args &&...args)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
double zError() const
error on z
std::vector< SimVertex >::const_iterator g4v_iterator
std::vector< const TrackingVertex * > sim_vertices
bool use_only_charged_tracks_
edm::RefToBase< reco::Vertex > VertexBaseRef
persistent reference to a Vertex, using views
const_iterator find(const key_type &k) const
find element with specified reference key
virtual void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
std::vector< Track > TrackCollection
collection of Tracks
int num_matched_sim_tracks
PrimaryVertexAnalyzer4PUSlimmed(const edm::ParameterSet &)
edm::EDGetTokenT< reco::TrackCollection > recoTrackCollectionToken_
edm::EDGetTokenT< TrackingVertexCollection > trackingVertexCollectionToken_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
virtual void analyze(const edm::Event &, const edm::EventSetup &) override
std::vector< PrimaryVertexAnalyzer4PUSlimmed::simPrimaryVertex > getSimPVs(const edm::Handle< TrackingVertexCollection > &)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
MonitorElement * book1D(Args &&...args)
Abs< T >::type abs(const T &t)
void calculatePurityAndFillHistograms(const std::string &, std::vector< recoPrimaryVertex > &, int, bool)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
double closest_vertex_distance_z
const reco::SimToRecoCollection * s2r_
std::vector< edm::EDGetTokenT< edm::View< reco::Vertex > > > reco_vertex_collection_tokens_
void fillGenericGenVertexHistograms(const simPrimaryVertex &v)
edm::Ref< TrackingVertexCollection > TrackingVertexRef
double xError() const
error on x
void setCurrentFolder(const std::string &fullpath)
T const * product() const
MonitorElement * book2D(Args &&...args)
std::vector< TrackingVertex > TrackingVertexCollection
~PrimaryVertexAnalyzer4PUSlimmed()
edm::AssociationMap< edm::OneToManyWithQualityGeneric< edm::View< reco::Track >, TrackingParticleCollection, double > > RecoToSimCollection
void fillRecoAssociatedGenVertexHistograms(const std::string &, const simPrimaryVertex &v)
void matchReco2SimVertices(std::vector< recoPrimaryVertex > &, const reco::VertexRecoToSimCollection &, const std::vector< simPrimaryVertex > &)
edm::EDGetTokenT< reco::VertexToTrackingVertexAssociator > vertexAssociatorToken_
edm::EDGetTokenT< reco::RecoToSimCollection > recoToSimAssociationToken_
std::vector< edm::InputTag > reco_vertex_collections_
std::map< std::string, std::map< std::string, MonitorElement * > > mes_
const reco::Vertex * recVtx
edm::AssociationMap< edm::OneToManyWithQualityGeneric< TrackingParticleCollection, edm::View< reco::Track >, double > > SimToRecoCollection
unsigned int calculateVertexSharedTracks(const reco::Vertex &recoV, const TrackingVertex &simV, const reco::RecoToSimCollection &trackRecoToSimAssociation)
float average_match_quality
volatile std::atomic< bool > shutdown_flag false
trackRef_iterator tracks_begin() const
first iterator over tracks
int num_matched_reco_tracks
TH2F * getTH2F(void) const
std::vector< const reco::Vertex * > rec_vertices
std::vector< unsigned int > sim_vertices_num_shared_tracks
double yError() const
error on y
const reco::RecoToSimCollection * r2s_
edm::EDGetTokenT< TrackingParticleCollection > trackingParticleCollectionToken_
void fillResolutionAndPullHistograms(const std::string &, int, recoPrimaryVertex &v)