25 minEta_(
pset.getParameter<double>(
"minEta")),
26 maxEta_(
pset.getParameter<double>(
"maxEta")),
27 nintEta_(
pset.getParameter<
int>(
"nintEta")),
28 useFabsEta_(
pset.getParameter<
bool>(
"useFabsEta")),
31 minEne_(
pset.getParameter<double>(
"minEne")),
32 maxEne_(
pset.getParameter<double>(
"maxEne")),
33 nintEne_(
pset.getParameter<
int>(
"nintEne")),
36 minPt_(
pset.getParameter<double>(
"minPt")),
37 maxPt_(
pset.getParameter<double>(
"maxPt")),
38 nintPt_(
pset.getParameter<
int>(
"nintPt")),
41 minPhi_(
pset.getParameter<double>(
"minPhi")),
43 nintPhi_(
pset.getParameter<
int>(
"nintPhi")),
46 minMixedHitsSimCluster_(
pset.getParameter<double>(
"minMixedHitsSimCluster")),
47 maxMixedHitsSimCluster_(
pset.getParameter<double>(
"maxMixedHitsSimCluster")),
48 nintMixedHitsSimCluster_(
pset.getParameter<
int>(
"nintMixedHitsSimCluster")),
51 minMixedHitsCluster_(
pset.getParameter<double>(
"minMixedHitsCluster")),
52 maxMixedHitsCluster_(
pset.getParameter<double>(
"maxMixedHitsCluster")),
53 nintMixedHitsCluster_(
pset.getParameter<
int>(
"nintMixedHitsCluster")),
56 minEneCl_(
pset.getParameter<double>(
"minEneCl")),
57 maxEneCl_(
pset.getParameter<double>(
"maxEneCl")),
58 nintEneCl_(
pset.getParameter<
int>(
"nintEneCl")),
61 minLongDepBary_(
pset.getParameter<double>(
"minLongDepBary")),
62 maxLongDepBary_(
pset.getParameter<double>(
"maxLongDepBary")),
63 nintLongDepBary_(
pset.getParameter<
int>(
"nintLongDepBary")),
66 minZpos_(
pset.getParameter<double>(
"minZpos")),
67 maxZpos_(
pset.getParameter<double>(
"maxZpos")),
68 nintZpos_(
pset.getParameter<
int>(
"nintZpos")),
71 minTotNsimClsperlay_(
pset.getParameter<double>(
"minTotNsimClsperlay")),
72 maxTotNsimClsperlay_(
pset.getParameter<double>(
"maxTotNsimClsperlay")),
73 nintTotNsimClsperlay_(
pset.getParameter<
int>(
"nintTotNsimClsperlay")),
76 minTotNClsperlay_(
pset.getParameter<double>(
"minTotNClsperlay")),
77 maxTotNClsperlay_(
pset.getParameter<double>(
"maxTotNClsperlay")),
78 nintTotNClsperlay_(
pset.getParameter<
int>(
"nintTotNClsperlay")),
81 minEneClperlay_(
pset.getParameter<double>(
"minEneClperlay")),
82 maxEneClperlay_(
pset.getParameter<double>(
"maxEneClperlay")),
83 nintEneClperlay_(
pset.getParameter<
int>(
"nintEneClperlay")),
88 minScore_(
pset.getParameter<double>(
"minScore")),
89 maxScore_(
pset.getParameter<double>(
"maxScore")),
90 nintScore_(
pset.getParameter<
int>(
"nintScore")),
97 minSharedEneFrac_(
pset.getParameter<double>(
"minSharedEneFrac")),
98 maxSharedEneFrac_(
pset.getParameter<double>(
"maxSharedEneFrac")),
99 nintSharedEneFrac_(
pset.getParameter<
int>(
"nintSharedEneFrac")),
100 minTSTSharedEneFracEfficiency_(
pset.getParameter<double>(
"minTSTSharedEneFracEfficiency")),
103 minTSTSharedEneFrac_(
pset.getParameter<double>(
"minTSTSharedEneFrac")),
104 maxTSTSharedEneFrac_(
pset.getParameter<double>(
"maxTSTSharedEneFrac")),
105 nintTSTSharedEneFrac_(
pset.getParameter<
int>(
"nintTSTSharedEneFrac")),
108 minTotNsimClsperthick_(
pset.getParameter<double>(
"minTotNsimClsperthick")),
109 maxTotNsimClsperthick_(
pset.getParameter<double>(
"maxTotNsimClsperthick")),
110 nintTotNsimClsperthick_(
pset.getParameter<
int>(
"nintTotNsimClsperthick")),
113 minTotNClsperthick_(
pset.getParameter<double>(
"minTotNClsperthick")),
114 maxTotNClsperthick_(
pset.getParameter<double>(
"maxTotNClsperthick")),
115 nintTotNClsperthick_(
pset.getParameter<
int>(
"nintTotNClsperthick")),
118 minTotNcellsperthickperlayer_(
pset.getParameter<double>(
"minTotNcellsperthickperlayer")),
119 maxTotNcellsperthickperlayer_(
pset.getParameter<double>(
"maxTotNcellsperthickperlayer")),
120 nintTotNcellsperthickperlayer_(
pset.getParameter<
int>(
"nintTotNcellsperthickperlayer")),
123 minDisToSeedperthickperlayer_(
pset.getParameter<double>(
"minDisToSeedperthickperlayer")),
124 maxDisToSeedperthickperlayer_(
pset.getParameter<double>(
"maxDisToSeedperthickperlayer")),
125 nintDisToSeedperthickperlayer_(
pset.getParameter<
int>(
"nintDisToSeedperthickperlayer")),
128 minDisToSeedperthickperlayerenewei_(
pset.getParameter<double>(
"minDisToSeedperthickperlayerenewei")),
129 maxDisToSeedperthickperlayerenewei_(
pset.getParameter<double>(
"maxDisToSeedperthickperlayerenewei")),
130 nintDisToSeedperthickperlayerenewei_(
pset.getParameter<
int>(
"nintDisToSeedperthickperlayerenewei")),
133 minDisToMaxperthickperlayer_(
pset.getParameter<double>(
"minDisToMaxperthickperlayer")),
134 maxDisToMaxperthickperlayer_(
pset.getParameter<double>(
"maxDisToMaxperthickperlayer")),
135 nintDisToMaxperthickperlayer_(
pset.getParameter<
int>(
"nintDisToMaxperthickperlayer")),
138 minDisToMaxperthickperlayerenewei_(
pset.getParameter<double>(
"minDisToMaxperthickperlayerenewei")),
139 maxDisToMaxperthickperlayerenewei_(
pset.getParameter<double>(
"maxDisToMaxperthickperlayerenewei")),
140 nintDisToMaxperthickperlayerenewei_(
pset.getParameter<
int>(
"nintDisToMaxperthickperlayerenewei")),
143 minDisSeedToMaxperthickperlayer_(
pset.getParameter<double>(
"minDisSeedToMaxperthickperlayer")),
144 maxDisSeedToMaxperthickperlayer_(
pset.getParameter<double>(
"maxDisSeedToMaxperthickperlayer")),
145 nintDisSeedToMaxperthickperlayer_(
pset.getParameter<
int>(
"nintDisSeedToMaxperthickperlayer")),
148 minClEneperthickperlayer_(
pset.getParameter<double>(
"minClEneperthickperlayer")),
149 maxClEneperthickperlayer_(
pset.getParameter<double>(
"maxClEneperthickperlayer")),
150 nintClEneperthickperlayer_(
pset.getParameter<
int>(
"nintClEneperthickperlayer")),
153 minCellsEneDensperthick_(
pset.getParameter<double>(
"minCellsEneDensperthick")),
154 maxCellsEneDensperthick_(
pset.getParameter<double>(
"maxCellsEneDensperthick")),
155 nintCellsEneDensperthick_(
pset.getParameter<
int>(
"nintCellsEneDensperthick")),
159 minTotNTSTs_(
pset.getParameter<double>(
"minTotNTSTs")),
160 maxTotNTSTs_(
pset.getParameter<double>(
"maxTotNTSTs")),
161 nintTotNTSTs_(
pset.getParameter<
int>(
"nintTotNTSTs")),
164 minTotNClsinTSTs_(
pset.getParameter<double>(
"minTotNClsinTSTs")),
165 maxTotNClsinTSTs_(
pset.getParameter<double>(
"maxTotNClsinTSTs")),
166 nintTotNClsinTSTs_(
pset.getParameter<
int>(
"nintTotNClsinTSTs")),
169 minTotNClsinTSTsperlayer_(
pset.getParameter<double>(
"minTotNClsinTSTsperlayer")),
170 maxTotNClsinTSTsperlayer_(
pset.getParameter<double>(
"maxTotNClsinTSTsperlayer")),
171 nintTotNClsinTSTsperlayer_(
pset.getParameter<
int>(
"nintTotNClsinTSTsperlayer")),
174 minMplofLCs_(
pset.getParameter<double>(
"minMplofLCs")),
175 maxMplofLCs_(
pset.getParameter<double>(
"maxMplofLCs")),
176 nintMplofLCs_(
pset.getParameter<
int>(
"nintMplofLCs")),
179 minSizeCLsinTSTs_(
pset.getParameter<double>(
"minSizeCLsinTSTs")),
180 maxSizeCLsinTSTs_(
pset.getParameter<double>(
"maxSizeCLsinTSTs")),
181 nintSizeCLsinTSTs_(
pset.getParameter<
int>(
"nintSizeCLsinTSTs")),
184 minClEnepermultiplicity_(
pset.getParameter<double>(
"minClEnepermultiplicity")),
185 maxClEnepermultiplicity_(
pset.getParameter<double>(
"maxClEnepermultiplicity")),
186 nintClEnepermultiplicity_(
pset.getParameter<
int>(
"nintClEnepermultiplicity")),
189 minX_(
pset.getParameter<double>(
"minX")),
190 maxX_(
pset.getParameter<double>(
"maxX")),
191 nintX_(
pset.getParameter<
int>(
"nintX")),
194 minY_(
pset.getParameter<double>(
"minY")),
195 maxY_(
pset.getParameter<double>(
"maxY")),
196 nintY_(
pset.getParameter<
int>(
"nintY")),
199 minZ_(
pset.getParameter<double>(
"minZ")),
200 maxZ_(
pset.getParameter<double>(
"maxZ")),
201 nintZ_(
pset.getParameter<
int>(
"nintZ")) {}
230 ibook.
book1D(
"EnergyDifference",
"(Energy-SelfEnergy)/Energy", 300., -5., 1.);
233 ibook.
book1D(
"Num Sim Clusters",
"Num Sim Clusters in CaloParticles", 100, 0., 100.);
235 ibook.
book1D(
"Num Hits in Sim Clusters",
"Num Hits in Sim Clusters in CaloParticles", 1000, 0., 1000.);
237 "Num Rec-matched Hits in Sim Clusters",
"Num Hits in Sim Clusters (matched) in CaloParticles", 1000, 0., 1000.);
240 ibook.
book1D(
"Energy of Rec-matched Hits",
"Energy of Hits in Sim Clusters (matched)", 100, 0., 10.);
242 ibook.
book2D(
"Energy of Rec-matched Hits vs layer",
243 "Energy of Hits in Sim Clusters (matched) vs layer",
251 ibook.
book2D(
"Energy of Rec-matched Hits vs layer (1SC)",
252 "Energy of Hits only 1 Sim Clusters (matched) vs layer",
260 ibook.
book2D(
"Rec-matched Hits Sum Energy vs layer",
261 "Rescaled Sum Energy of Hits in Sim Clusters (matched) vs layer",
269 ibook.
book2D(
"HitFractions",
"Hit fractions;Hit fraction;E_{hit}^{2} fraction", 101, 0, 1.01, 100, 0, 1);
271 "HitFractions_weighted",
"Hit fractions weighted;Hit fraction;E_{hit}^{2} fraction", 101, 0, 1.01, 100, 0, 1);
274 ibook.
book1D(
"First Layer",
"First layer of the CaloParticles", 2 *
layers, 0., (
float)2 *
layers);
276 ibook.
book1D(
"Last Layer",
"Last layer of the CaloParticles", 2 *
layers, 0., (
float)2 *
layers);
278 ibook.
book1D(
"Number of Layers",
"Number of layers of the CaloParticles", 2 *
layers, 0., (
float)2 *
layers);
280 "First Layer (rec-matched hit)",
"First layer of the CaloParticles (matched)", 2 *
layers, 0., (
float)2 *
layers);
282 "Last Layer (rec-matched hit)",
"Last layer of the CaloParticles (matched)", 2 *
layers, 0., (
float)2 *
layers);
284 ibook.
book1D(
"Number of Layers (rec-matched hit)",
285 "Number of layers of the CaloParticles (matched)",
294 std::vector<int> thicknesses) {
296 for (
unsigned ilayer = 0; ilayer < 2 *
layers; ++ilayer) {
298 while (istr1.size() < 2) {
299 istr1.insert(0,
"0");
309 histograms.h_simclusternum_perlayer[ilayer] = ibook.
book1D(
"totsimclusternum_layer_" + istr1,
310 "total number of SimClusters for layer " + istr2,
317 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
319 histograms.h_simclusternum_perthick[(*it)] = ibook.
book1D(
"totsimclusternum_thick_" + istr,
320 "total number of simclusters for thickness " + istr,
329 ibook.
book1D(
"mixedhitssimcluster_zminus",
330 "N of simclusters that contain hits of more than one kind in z-",
336 ibook.
book1D(
"mixedhitssimcluster_zplus",
337 "N of simclusters that contain hits of more than one kind in z+",
346 std::vector<int> thicknesses) {
347 std::unordered_map<int, dqm::reco::MonitorElement*> denom_layercl_in_simcl_eta_perlayer;
348 denom_layercl_in_simcl_eta_perlayer.clear();
349 std::unordered_map<int, dqm::reco::MonitorElement*> denom_layercl_in_simcl_phi_perlayer;
350 denom_layercl_in_simcl_phi_perlayer.clear();
351 std::unordered_map<int, dqm::reco::MonitorElement*> score_layercl2simcluster_perlayer;
352 score_layercl2simcluster_perlayer.clear();
353 std::unordered_map<int, dqm::reco::MonitorElement*> sharedenergy_layercl2simcluster_perlayer;
354 sharedenergy_layercl2simcluster_perlayer.clear();
355 std::unordered_map<int, dqm::reco::MonitorElement*> energy_vs_score_layercl2simcluster_perlayer;
356 energy_vs_score_layercl2simcluster_perlayer.clear();
357 std::unordered_map<int, dqm::reco::MonitorElement*> num_layercl_in_simcl_eta_perlayer;
358 num_layercl_in_simcl_eta_perlayer.clear();
359 std::unordered_map<int, dqm::reco::MonitorElement*> num_layercl_in_simcl_phi_perlayer;
360 num_layercl_in_simcl_phi_perlayer.clear();
361 std::unordered_map<int, dqm::reco::MonitorElement*> numMerge_layercl_in_simcl_eta_perlayer;
362 numMerge_layercl_in_simcl_eta_perlayer.clear();
363 std::unordered_map<int, dqm::reco::MonitorElement*> numMerge_layercl_in_simcl_phi_perlayer;
364 numMerge_layercl_in_simcl_phi_perlayer.clear();
365 std::unordered_map<int, dqm::reco::MonitorElement*> sharedenergy_layercl2simcluster_vs_eta_perlayer;
366 sharedenergy_layercl2simcluster_vs_eta_perlayer.clear();
367 std::unordered_map<int, dqm::reco::MonitorElement*> sharedenergy_layercl2simcluster_vs_phi_perlayer;
368 sharedenergy_layercl2simcluster_vs_phi_perlayer.clear();
369 std::unordered_map<int, dqm::reco::MonitorElement*> denom_simcluster_eta_perlayer;
370 denom_simcluster_eta_perlayer.clear();
371 std::unordered_map<int, dqm::reco::MonitorElement*> denom_simcluster_phi_perlayer;
372 denom_simcluster_phi_perlayer.clear();
373 std::unordered_map<int, dqm::reco::MonitorElement*> score_simcluster2layercl_perlayer;
374 score_simcluster2layercl_perlayer.clear();
375 std::unordered_map<int, dqm::reco::MonitorElement*> sharedenergy_simcluster2layercl_perlayer;
376 sharedenergy_simcluster2layercl_perlayer.clear();
377 std::unordered_map<int, dqm::reco::MonitorElement*> energy_vs_score_simcluster2layercl_perlayer;
378 energy_vs_score_simcluster2layercl_perlayer.clear();
379 std::unordered_map<int, dqm::reco::MonitorElement*> num_simcluster_eta_perlayer;
380 num_simcluster_eta_perlayer.clear();
381 std::unordered_map<int, dqm::reco::MonitorElement*> num_simcluster_phi_perlayer;
382 num_simcluster_phi_perlayer.clear();
383 std::unordered_map<int, dqm::reco::MonitorElement*> numDup_simcluster_eta_perlayer;
384 numDup_simcluster_eta_perlayer.clear();
385 std::unordered_map<int, dqm::reco::MonitorElement*> numDup_simcluster_phi_perlayer;
386 numDup_simcluster_phi_perlayer.clear();
387 std::unordered_map<int, dqm::reco::MonitorElement*> sharedenergy_simcluster2layercl_vs_eta_perlayer;
388 sharedenergy_simcluster2layercl_vs_eta_perlayer.clear();
389 std::unordered_map<int, dqm::reco::MonitorElement*> sharedenergy_simcluster2layercl_vs_phi_perlayer;
390 sharedenergy_simcluster2layercl_vs_phi_perlayer.clear();
393 for (
unsigned ilayer = 0; ilayer < 2 *
layers; ++ilayer) {
395 while (istr1.size() < 2) {
396 istr1.insert(0,
"0");
407 denom_layercl_in_simcl_eta_perlayer[ilayer] =
408 ibook.
book1D(
"Denom_LayerCluster_in_SimCluster_Eta_perlayer" + istr1,
409 "Denom LayerCluster in SimCluster Eta per Layer Cluster for layer " + istr2,
414 denom_layercl_in_simcl_phi_perlayer[ilayer] =
415 ibook.
book1D(
"Denom_LayerCluster_in_SimCluster_Phi_perlayer" + istr1,
416 "Denom LayerCluster in SimCluster Phi per Layer Cluster for layer " + istr2,
421 score_layercl2simcluster_perlayer[ilayer] = ibook.
book1D(
"Score_layercl2simcluster_perlayer" + istr1,
422 "Score of Layer Cluster per SimCluster for layer " + istr2,
427 score_simcluster2layercl_perlayer[ilayer] = ibook.
book1D(
"Score_simcluster2layercl_perlayer" + istr1,
428 "Score of SimCluster per Layer Cluster for layer " + istr2,
433 energy_vs_score_simcluster2layercl_perlayer[ilayer] =
434 ibook.
book2D(
"Energy_vs_Score_simcluster2layer_perlayer" + istr1,
435 "Energy vs Score of SimCluster per Layer Cluster for layer " + istr2,
443 energy_vs_score_layercl2simcluster_perlayer[ilayer] =
444 ibook.
book2D(
"Energy_vs_Score_layer2simcluster_perlayer" + istr1,
445 "Energy vs Score of Layer Cluster per SimCluster for layer " + istr2,
453 sharedenergy_simcluster2layercl_perlayer[ilayer] =
454 ibook.
book1D(
"SharedEnergy_simcluster2layercl_perlayer" + istr1,
455 "Shared Energy of SimCluster per Layer Cluster for layer " + istr2,
460 sharedenergy_simcluster2layercl_vs_eta_perlayer[ilayer] =
461 ibook.
bookProfile(
"SharedEnergy_simcluster2layercl_vs_eta_perlayer" + istr1,
462 "Shared Energy of SimCluster vs #eta per best Layer Cluster for layer " + istr2,
469 sharedenergy_simcluster2layercl_vs_phi_perlayer[ilayer] =
470 ibook.
bookProfile(
"SharedEnergy_simcluster2layercl_vs_phi_perlayer" + istr1,
471 "Shared Energy of SimCluster vs #phi per best Layer Cluster for layer " + istr2,
478 sharedenergy_layercl2simcluster_perlayer[ilayer] =
479 ibook.
book1D(
"SharedEnergy_layercluster2simcluster_perlayer" + istr1,
480 "Shared Energy of Layer Cluster per SimCluster for layer " + istr2,
485 sharedenergy_layercl2simcluster_vs_eta_perlayer[ilayer] =
486 ibook.
bookProfile(
"SharedEnergy_layercl2simcluster_vs_eta_perlayer" + istr1,
487 "Shared Energy of LayerCluster vs #eta per best SimCluster for layer " + istr2,
494 sharedenergy_layercl2simcluster_vs_phi_perlayer[ilayer] =
495 ibook.
bookProfile(
"SharedEnergy_layercl2simcluster_vs_phi_perlayer" + istr1,
496 "Shared Energy of LayerCluster vs #phi per best SimCluster for layer " + istr2,
503 num_simcluster_eta_perlayer[ilayer] = ibook.
book1D(
"Num_SimCluster_Eta_perlayer" + istr1,
504 "Num SimCluster Eta per Layer Cluster for layer " + istr2,
509 numDup_simcluster_eta_perlayer[ilayer] =
510 ibook.
book1D(
"NumDup_SimCluster_Eta_perlayer" + istr1,
511 "Num Duplicate SimCluster Eta per Layer Cluster for layer " + istr2,
516 denom_simcluster_eta_perlayer[ilayer] = ibook.
book1D(
"Denom_SimCluster_Eta_perlayer" + istr1,
517 "Denom SimCluster Eta per Layer Cluster for layer " + istr2,
522 num_simcluster_phi_perlayer[ilayer] = ibook.
book1D(
"Num_SimCluster_Phi_perlayer" + istr1,
523 "Num SimCluster Phi per Layer Cluster for layer " + istr2,
528 numDup_simcluster_phi_perlayer[ilayer] =
529 ibook.
book1D(
"NumDup_SimCluster_Phi_perlayer" + istr1,
530 "Num Duplicate SimCluster Phi per Layer Cluster for layer " + istr2,
535 denom_simcluster_phi_perlayer[ilayer] = ibook.
book1D(
"Denom_SimCluster_Phi_perlayer" + istr1,
536 "Denom SimCluster Phi per Layer Cluster for layer " + istr2,
541 num_layercl_in_simcl_eta_perlayer[ilayer] =
542 ibook.
book1D(
"Num_LayerCluster_in_SimCluster_Eta_perlayer" + istr1,
543 "Num LayerCluster Eta per Layer Cluster in SimCluster for layer " + istr2,
548 numMerge_layercl_in_simcl_eta_perlayer[ilayer] =
549 ibook.
book1D(
"NumMerge_LayerCluster_in_SimCluster_Eta_perlayer" + istr1,
550 "Num Merge LayerCluster Eta per Layer Cluster in SimCluster for layer " + istr2,
555 num_layercl_in_simcl_phi_perlayer[ilayer] =
556 ibook.
book1D(
"Num_LayerCluster_in_SimCluster_Phi_perlayer" + istr1,
557 "Num LayerCluster Phi per Layer Cluster in SimCluster for layer " + istr2,
562 numMerge_layercl_in_simcl_phi_perlayer[ilayer] =
563 ibook.
book1D(
"NumMerge_LayerCluster_in_SimCluster_Phi_perlayer" + istr1,
564 "Num Merge LayerCluster Phi per Layer Cluster in SimCluster for layer " + istr2,
571 histograms.h_denom_layercl_in_simcl_eta_perlayer.push_back(
std::move(denom_layercl_in_simcl_eta_perlayer));
572 histograms.h_denom_layercl_in_simcl_phi_perlayer.push_back(
std::move(denom_layercl_in_simcl_phi_perlayer));
573 histograms.h_score_layercl2simcluster_perlayer.push_back(
std::move(score_layercl2simcluster_perlayer));
574 histograms.h_sharedenergy_layercl2simcluster_perlayer.push_back(
std::move(sharedenergy_layercl2simcluster_perlayer));
575 histograms.h_energy_vs_score_layercl2simcluster_perlayer.push_back(
576 std::move(energy_vs_score_layercl2simcluster_perlayer));
577 histograms.h_num_layercl_in_simcl_eta_perlayer.push_back(
std::move(num_layercl_in_simcl_eta_perlayer));
578 histograms.h_num_layercl_in_simcl_phi_perlayer.push_back(
std::move(num_layercl_in_simcl_phi_perlayer));
579 histograms.h_numMerge_layercl_in_simcl_eta_perlayer.push_back(
std::move(numMerge_layercl_in_simcl_eta_perlayer));
580 histograms.h_numMerge_layercl_in_simcl_phi_perlayer.push_back(
std::move(numMerge_layercl_in_simcl_phi_perlayer));
581 histograms.h_sharedenergy_layercl2simcluster_vs_eta_perlayer.push_back(
582 std::move(sharedenergy_layercl2simcluster_vs_eta_perlayer));
583 histograms.h_sharedenergy_layercl2simcluster_vs_phi_perlayer.push_back(
584 std::move(sharedenergy_layercl2simcluster_vs_phi_perlayer));
585 histograms.h_denom_simcluster_eta_perlayer.push_back(
std::move(denom_simcluster_eta_perlayer));
586 histograms.h_denom_simcluster_phi_perlayer.push_back(
std::move(denom_simcluster_phi_perlayer));
587 histograms.h_score_simcluster2layercl_perlayer.push_back(
std::move(score_simcluster2layercl_perlayer));
588 histograms.h_sharedenergy_simcluster2layercl_perlayer.push_back(
std::move(sharedenergy_simcluster2layercl_perlayer));
589 histograms.h_energy_vs_score_simcluster2layercl_perlayer.push_back(
590 std::move(energy_vs_score_simcluster2layercl_perlayer));
591 histograms.h_num_simcluster_eta_perlayer.push_back(
std::move(num_simcluster_eta_perlayer));
592 histograms.h_num_simcluster_phi_perlayer.push_back(
std::move(num_simcluster_phi_perlayer));
593 histograms.h_numDup_simcluster_eta_perlayer.push_back(
std::move(numDup_simcluster_eta_perlayer));
594 histograms.h_numDup_simcluster_phi_perlayer.push_back(
std::move(numDup_simcluster_phi_perlayer));
595 histograms.h_sharedenergy_simcluster2layercl_vs_eta_perlayer.push_back(
596 std::move(sharedenergy_simcluster2layercl_vs_eta_perlayer));
597 histograms.h_sharedenergy_simcluster2layercl_vs_phi_perlayer.push_back(
598 std::move(sharedenergy_simcluster2layercl_vs_phi_perlayer));
603 std::vector<int> thicknesses,
611 histograms.h_mixedhitscluster_zminus.push_back(
612 ibook.
book1D(
"mixedhitscluster_zminus",
613 "N of reco clusters that contain hits of more than one kind in z-",
618 histograms.h_mixedhitscluster_zplus.push_back(
619 ibook.
book1D(
"mixedhitscluster_zplus",
620 "N of reco clusters that contain hits of more than one kind in z+",
627 histograms.h_energyclustered_zminus.push_back(
628 ibook.
book1D(
"energyclustered_zminus",
629 "percent of total energy clustered by all layer clusters over CaloParticless energy in z-",
635 ibook.
book1D(
"energyclustered_zplus",
636 "percent of total energy clustered by all layer clusters over CaloParticless energy in z+",
643 std::string subpathtomat = pathtomatbudfile.substr(pathtomatbudfile.find(
"Validation"));
644 histograms.h_longdepthbarycentre_zminus.push_back(
645 ibook.
book1D(
"longdepthbarycentre_zminus",
646 "The longitudinal depth barycentre in z- for " + subpathtomat,
651 histograms.h_longdepthbarycentre_zplus.push_back(
652 ibook.
book1D(
"longdepthbarycentre_zplus",
653 "The longitudinal depth barycentre in z+ for " + subpathtomat,
659 for (
unsigned ilayer = 0; ilayer < 2 *
layers; ++ilayer) {
661 while (istr1.size() < 2) {
662 istr1.insert(0,
"0");
672 histograms.h_clusternum_perlayer[ilayer] = ibook.
book1D(
"totclusternum_layer_" + istr1,
673 "total number of layer clusters for layer " + istr2,
678 "energyclustered_perlayer" + istr1,
679 "percent of total energy clustered by layer clusters over CaloParticless energy for layer " + istr2,
686 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
688 histograms.h_clusternum_perthick[(*it)] = ibook.
book1D(
"totclusternum_thick_" + istr,
689 "total number of layer clusters for thickness " + istr,
701 for (
unsigned ilayer = 0; ilayer < 2 *
layers; ++ilayer) {
703 while (istr1.size() < 2) {
704 istr1.insert(0,
"0");
714 histograms.h_score_layercl2caloparticle_perlayer[ilayer] =
715 ibook.
book1D(
"Score_layercl2caloparticle_perlayer" + istr1,
716 "Score of Layer Cluster per CaloParticle for layer " + istr2,
720 histograms.h_score_caloparticle2layercl_perlayer[ilayer] =
721 ibook.
book1D(
"Score_caloparticle2layercl_perlayer" + istr1,
722 "Score of CaloParticle per Layer Cluster for layer " + istr2,
726 histograms.h_energy_vs_score_caloparticle2layercl_perlayer[ilayer] =
727 ibook.
book2D(
"Energy_vs_Score_caloparticle2layer_perlayer" + istr1,
728 "Energy vs Score of CaloParticle per Layer Cluster for layer " + istr2,
735 histograms.h_energy_vs_score_layercl2caloparticle_perlayer[ilayer] =
736 ibook.
book2D(
"Energy_vs_Score_layer2caloparticle_perlayer" + istr1,
737 "Energy vs Score of Layer Cluster per CaloParticle Layer for layer " + istr2,
744 histograms.h_sharedenergy_caloparticle2layercl_perlayer[ilayer] =
745 ibook.
book1D(
"SharedEnergy_caloparticle2layercl_perlayer" + istr1,
746 "Shared Energy of CaloParticle per Layer Cluster for layer " + istr2,
750 histograms.h_sharedenergy_caloparticle2layercl_vs_eta_perlayer[ilayer] =
751 ibook.
bookProfile(
"SharedEnergy_caloparticle2layercl_vs_eta_perlayer" + istr1,
752 "Shared Energy of CaloParticle vs #eta per best Layer Cluster for layer " + istr2,
758 histograms.h_sharedenergy_caloparticle2layercl_vs_phi_perlayer[ilayer] =
759 ibook.
bookProfile(
"SharedEnergy_caloparticle2layercl_vs_phi_perlayer" + istr1,
760 "Shared Energy of CaloParticle vs #phi per best Layer Cluster for layer " + istr2,
766 histograms.h_sharedenergy_layercl2caloparticle_perlayer[ilayer] =
767 ibook.
book1D(
"SharedEnergy_layercluster2caloparticle_perlayer" + istr1,
768 "Shared Energy of Layer Cluster per Layer Calo Particle for layer " + istr2,
772 histograms.h_sharedenergy_layercl2caloparticle_vs_eta_perlayer[ilayer] =
773 ibook.
bookProfile(
"SharedEnergy_layercl2caloparticle_vs_eta_perlayer" + istr1,
774 "Shared Energy of LayerCluster vs #eta per best Calo Particle for layer " + istr2,
780 histograms.h_sharedenergy_layercl2caloparticle_vs_phi_perlayer[ilayer] =
781 ibook.
bookProfile(
"SharedEnergy_layercl2caloparticle_vs_phi_perlayer" + istr1,
782 "Shared Energy of LayerCluster vs #phi per best Calo Particle for layer " + istr2,
788 histograms.h_num_caloparticle_eta_perlayer[ilayer] =
789 ibook.
book1D(
"Num_CaloParticle_Eta_perlayer" + istr1,
790 "Num CaloParticle Eta per Layer Cluster for layer " + istr2,
794 histograms.h_numDup_caloparticle_eta_perlayer[ilayer] =
795 ibook.
book1D(
"NumDup_CaloParticle_Eta_perlayer" + istr1,
796 "Num Duplicate CaloParticle Eta per Layer Cluster for layer " + istr2,
800 histograms.h_denom_caloparticle_eta_perlayer[ilayer] =
801 ibook.
book1D(
"Denom_CaloParticle_Eta_perlayer" + istr1,
802 "Denom CaloParticle Eta per Layer Cluster for layer " + istr2,
806 histograms.h_num_caloparticle_phi_perlayer[ilayer] =
807 ibook.
book1D(
"Num_CaloParticle_Phi_perlayer" + istr1,
808 "Num CaloParticle Phi per Layer Cluster for layer " + istr2,
812 histograms.h_numDup_caloparticle_phi_perlayer[ilayer] =
813 ibook.
book1D(
"NumDup_CaloParticle_Phi_perlayer" + istr1,
814 "Num Duplicate CaloParticle Phi per Layer Cluster for layer " + istr2,
818 histograms.h_denom_caloparticle_phi_perlayer[ilayer] =
819 ibook.
book1D(
"Denom_CaloParticle_Phi_perlayer" + istr1,
820 "Denom CaloParticle Phi per Layer Cluster for layer " + istr2,
824 histograms.h_num_layercl_eta_perlayer[ilayer] =
825 ibook.
book1D(
"Num_LayerCluster_Eta_perlayer" + istr1,
826 "Num LayerCluster Eta per Layer Cluster for layer " + istr2,
830 histograms.h_numMerge_layercl_eta_perlayer[ilayer] =
831 ibook.
book1D(
"NumMerge_LayerCluster_Eta_perlayer" + istr1,
832 "Num Merge LayerCluster Eta per Layer Cluster for layer " + istr2,
836 histograms.h_denom_layercl_eta_perlayer[ilayer] =
837 ibook.
book1D(
"Denom_LayerCluster_Eta_perlayer" + istr1,
838 "Denom LayerCluster Eta per Layer Cluster for layer " + istr2,
842 histograms.h_num_layercl_phi_perlayer[ilayer] =
843 ibook.
book1D(
"Num_LayerCluster_Phi_perlayer" + istr1,
844 "Num LayerCluster Phi per Layer Cluster for layer " + istr2,
848 histograms.h_numMerge_layercl_phi_perlayer[ilayer] =
849 ibook.
book1D(
"NumMerge_LayerCluster_Phi_perlayer" + istr1,
850 "Num Merge LayerCluster Phi per Layer Cluster for layer " + istr2,
854 histograms.h_denom_layercl_phi_perlayer[ilayer] =
855 ibook.
book1D(
"Denom_LayerCluster_Phi_perlayer" + istr1,
856 "Denom LayerCluster Phi per Layer Cluster for layer " + istr2,
867 std::vector<int> thicknesses) {
869 for (
unsigned ilayer = 0; ilayer < 2 *
layers; ++ilayer) {
871 while (istr1.size() < 2) {
872 istr1.insert(0,
"0");
882 histograms.h_cellAssociation_perlayer[ilayer] =
883 ibook.
book1D(
"cellAssociation_perlayer" + istr1,
"Cell Association for layer " + istr2, 5, -4., 1.);
884 histograms.h_cellAssociation_perlayer[ilayer]->setBinLabel(2,
"TN(purity)");
885 histograms.h_cellAssociation_perlayer[ilayer]->setBinLabel(3,
"FN(ineff.)");
886 histograms.h_cellAssociation_perlayer[ilayer]->setBinLabel(4,
"FP(fake)");
887 histograms.h_cellAssociation_perlayer[ilayer]->setBinLabel(5,
"TP(eff.)");
890 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
892 histograms.h_cellsenedens_perthick[(*it)] = ibook.
book1D(
"cellsenedens_thick_" + istr,
893 "energy density of cluster cells for thickness " + istr,
900 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
901 for (
unsigned ilayer = 0; ilayer < 2 *
layers; ++ilayer) {
904 while (istr2.size() < 2)
905 istr2.insert(0,
"0");
906 auto istr = istr1 +
"_" + istr2;
916 histograms.h_cellsnum_perthickperlayer[istr] =
917 ibook.
book1D(
"cellsnum_perthick_perlayer_" + istr,
918 "total number of cells for layer " + istr3 +
" for thickness " + istr1,
923 histograms.h_distancetoseedcell_perthickperlayer[istr] =
924 ibook.
book1D(
"distancetoseedcell_perthickperlayer_" + istr,
925 "distance of cluster cells to seed cell for layer " + istr3 +
" for thickness " + istr1,
930 histograms.h_distancetoseedcell_perthickperlayer_eneweighted[istr] = ibook.
book1D(
931 "distancetoseedcell_perthickperlayer_eneweighted_" + istr,
932 "energy weighted distance of cluster cells to seed cell for layer " + istr3 +
" for thickness " + istr1,
937 histograms.h_distancetomaxcell_perthickperlayer[istr] =
938 ibook.
book1D(
"distancetomaxcell_perthickperlayer_" + istr,
939 "distance of cluster cells to max cell for layer " + istr3 +
" for thickness " + istr1,
944 histograms.h_distancetomaxcell_perthickperlayer_eneweighted[istr] = ibook.
book1D(
945 "distancetomaxcell_perthickperlayer_eneweighted_" + istr,
946 "energy weighted distance of cluster cells to max cell for layer " + istr3 +
" for thickness " + istr1,
951 histograms.h_distancebetseedandmaxcell_perthickperlayer[istr] =
952 ibook.
book1D(
"distancebetseedandmaxcell_perthickperlayer_" + istr,
953 "distance of seed cell to max cell for layer " + istr3 +
" for thickness " + istr1,
958 histograms.h_distancebetseedandmaxcellvsclusterenergy_perthickperlayer[istr] = ibook.
book2D(
959 "distancebetseedandmaxcellvsclusterenergy_perthickperlayer_" + istr,
960 "distance of seed cell to max cell vs cluster energy for layer " + istr3 +
" for thickness " + istr1,
973 std::unordered_map<int, dqm::reco::MonitorElement*> clusternum_in_trackster_perlayer;
974 clusternum_in_trackster_perlayer.clear();
976 for (
unsigned ilayer = 0; ilayer < 2 *
layers; ++ilayer) {
978 while (istr1.size() < 2) {
979 istr1.insert(0,
"0");
990 clusternum_in_trackster_perlayer[ilayer] = ibook.
book1D(
"clusternum_in_trackster_perlayer" + istr1,
991 "Number of layer clusters in Trackster for layer " + istr2,
997 histograms.h_clusternum_in_trackster_perlayer.push_back(
std::move(clusternum_in_trackster_perlayer));
1005 histograms.h_nonconttracksternum.push_back(ibook.
book1D(
"nonconttracksternum",
1006 "number of Tracksters without 3 contiguous layers",
1011 histograms.h_clusternum_in_trackster.push_back(
1012 ibook.
book1D(
"clusternum_in_trackster",
1013 "total number of layer clusters in Trackster;# of LayerClusters",
1019 "clusternum_in_trackster_vs_layer",
1020 "Profile of 2d layer clusters in Trackster vs layer number;layer number;<2D LayerClusters in Trackster>",
1027 histograms.h_multiplicityOfLCinTST.push_back(
1028 ibook.
book2D(
"multiplicityOfLCinTST",
1029 "Multiplicity vs Layer cluster size in Tracksters;LayerCluster multiplicity in Tracksters;Cluster " 1038 histograms.h_multiplicity_numberOfEventsHistogram.push_back(ibook.
book1D(
"multiplicity_numberOfEventsHistogram",
1039 "multiplicity numberOfEventsHistogram",
1044 histograms.h_multiplicity_zminus_numberOfEventsHistogram.push_back(
1045 ibook.
book1D(
"multiplicity_zminus_numberOfEventsHistogram",
1046 "multiplicity numberOfEventsHistogram in z-",
1051 histograms.h_multiplicity_zplus_numberOfEventsHistogram.push_back(
1052 ibook.
book1D(
"multiplicity_zplus_numberOfEventsHistogram",
1053 "multiplicity numberOfEventsHistogram in z+",
1058 histograms.h_multiplicityOfLCinTST_vs_layercluster_zminus.push_back(
1059 ibook.
book2D(
"multiplicityOfLCinTST_vs_layercluster_zminus",
1060 "Multiplicity vs Layer number in z-;LayerCluster multiplicity in Tracksters;layer number",
1068 histograms.h_multiplicityOfLCinTST_vs_layercluster_zplus.push_back(
1069 ibook.
book2D(
"multiplicityOfLCinTST_vs_layercluster_zplus",
1070 "Multiplicity vs Layer number in z+;LayerCluster multiplicity in Tracksters;layer number",
1078 histograms.h_multiplicityOfLCinTST_vs_layerclusterenergy.push_back(
1079 ibook.
book2D(
"multiplicityOfLCinTST_vs_layerclusterenergy",
1080 "Multiplicity vs Layer cluster energy;LayerCluster multiplicity in Tracksters;Cluster energy [GeV]",
1103 "trackster_firstlayer",
"First layer of the Trackster;Trackster First Layer", 2 *
layers, 0., (
float)2 *
layers));
1105 "trackster_lastlayer",
"Last layer of the Trackster;Trackster Last Layer", 2 *
layers, 0., (
float)2 *
layers));
1107 ibook.
book1D(
"trackster_layersnum",
1108 "Number of layers of the Trackster;Trackster Number of Layers",
1117 const string ref[] = {
"caloparticle",
"simtrackster",
"simtrackster_fromCP"};
1118 const string refT[] = {
"CaloParticle",
"SimTrackster",
"SimTrackster_fromCP"};
1120 const string val[] = {
"_Link",
"_PR"};
1122 const string rtos =
";score Reco-to-Sim";
1123 const string stor =
";score Sim-to-Reco";
1124 const string shREnFr =
";shared Reco energy fraction";
1125 const string shSEnFr =
";shared Sim energy fraction";
1127 histograms.h_score_trackster2caloparticle[valType].push_back(
1128 ibook.
book1D(
"Score_trackster2" + ref[valType],
1129 "Score of Trackster per " + refT[valType] + rtos,
1133 histograms.h_score_trackster2bestCaloparticle[valType].push_back(
1134 ibook.
book1D(
"ScoreFake_trackster2" + ref[valType],
1135 "Score of Trackster per best " + refT[valType] + rtos,
1139 histograms.h_score_trackster2bestCaloparticle2[valType].push_back(
1140 ibook.
book1D(
"ScoreMerge_trackster2" + ref[valType],
1141 "Score of Trackster per 2^{nd} best " + refT[valType] + rtos,
1145 histograms.h_score_caloparticle2trackster[valType].push_back(
1146 ibook.
book1D(
"Score_" + ref[valType] +
"2trackster",
1147 "Score of " + refT[valType] +
" per Trackster" + stor,
1151 histograms.h_scorePur_caloparticle2trackster[valType].push_back(
1152 ibook.
book1D(
"ScorePur_" + ref[valType] +
"2trackster",
1153 "Score of " + refT[valType] +
" per best Trackster" + stor,
1157 histograms.h_scoreDupl_caloparticle2trackster[valType].push_back(
1158 ibook.
book1D(
"ScoreDupl_" + ref[valType] +
"2trackster",
1159 "Score of " + refT[valType] +
" per 2^{nd} best Trackster" + stor,
1163 histograms.h_energy_vs_score_trackster2caloparticle[valType].push_back(
1164 ibook.
book2D(
"Energy_vs_Score_trackster2" + refT[valType],
1165 "Energy vs Score of Trackster per " + refT[valType] + rtos + shREnFr,
1172 histograms.h_energy_vs_score_trackster2bestCaloparticle[valType].push_back(
1173 ibook.
book2D(
"Energy_vs_Score_trackster2best" + refT[valType],
1174 "Energy vs Score of Trackster per best " + refT[valType] + rtos + shREnFr,
1181 histograms.h_energy_vs_score_trackster2bestCaloparticle2[valType].push_back(
1182 ibook.
book2D(
"Energy_vs_Score_trackster2secBest" + refT[valType],
1183 "Energy vs Score of Trackster per 2^{nd} best " + refT[valType] + rtos + shREnFr,
1190 histograms.h_energy_vs_score_caloparticle2trackster[valType].push_back(
1191 ibook.
book2D(
"Energy_vs_Score_" + ref[valType] +
"2Trackster",
1192 "Energy vs Score of " + refT[valType] +
" per Trackster" + stor + shSEnFr,
1199 histograms.h_energy_vs_score_caloparticle2bestTrackster[valType].push_back(
1200 ibook.
book2D(
"Energy_vs_Score_" + ref[valType] +
"2bestTrackster",
1201 "Energy vs Score of " + refT[valType] +
" per best Trackster" + stor + shSEnFr,
1208 histograms.h_energy_vs_score_caloparticle2bestTrackster2[valType].push_back(
1209 ibook.
book2D(
"Energy_vs_Score_" + ref[valType] +
"2secBestTrackster",
1210 "Energy vs Score of " + refT[valType] +
" per 2^{nd} best Trackster" + stor + shSEnFr,
1222 histograms.h_numMerge_trackster_eta[valType].push_back(ibook.
book1D(
"NumMerge_Trackster_Eta" +
val[valType],
1223 "Num Merge Trackster Eta per Trackster;#eta",
1232 histograms.h_numMerge_trackster_phi[valType].push_back(ibook.
book1D(
"NumMerge_Trackster_Phi" +
val[valType],
1233 "Num Merge Trackster Phi per Trackster;#phi",
1240 histograms.h_num_trackster_en[valType].push_back(ibook.
book1D(
"Num_Trackster_Energy" +
val[valType],
1241 "Num Trackster Energy per Trackster;energy [GeV]",
1245 histograms.h_numMerge_trackster_en[valType].push_back(
1246 ibook.
book1D(
"NumMerge_Trackster_Energy" +
val[valType],
1247 "Num Merge Trackster Energy per Trackster;energy [GeV]",
1251 histograms.h_denom_trackster_en[valType].push_back(ibook.
book1D(
"Denom_Trackster_Energy" +
val[valType],
1252 "Denom Trackster Energy per Trackster;energy [GeV]",
1258 "Num_Trackster_Pt" +
val[valType],
"Num Trackster p_{T} per Trackster;p_{T} [GeV]",
nintPt_,
minPt_,
maxPt_));
1259 histograms.h_numMerge_trackster_pt[valType].push_back(
1260 ibook.
book1D(
"NumMerge_Trackster_Pt" +
val[valType],
1261 "Num Merge Trackster p_{T} per Trackster;p_{T} [GeV]",
1266 "Denom_Trackster_Pt" +
val[valType],
"Denom Trackster p_{T} per Trackster;p_{T} [GeV]",
nintPt_,
minPt_,
maxPt_));
1268 histograms.h_sharedenergy_trackster2caloparticle[valType].push_back(
1269 ibook.
book1D(
"SharedEnergy_trackster2" + ref[valType],
1270 "Shared Energy of Trackster per " + refT[valType] + shREnFr,
1274 histograms.h_sharedenergy_trackster2bestCaloparticle[valType].push_back(
1275 ibook.
book1D(
"SharedEnergy_trackster2" + ref[valType] +
"_assoc",
1276 "Shared Energy of Trackster per best " + refT[valType] + shREnFr,
1280 histograms.h_sharedenergy_trackster2bestCaloparticle_vs_eta[valType].push_back(
1281 ibook.
bookProfile(
"SharedEnergy_trackster2" + ref[valType] +
"_assoc_vs_eta",
1282 "Shared Energy of Trackster vs #eta per best " + refT[valType] +
";Trackster #eta" + shREnFr,
1288 histograms.h_sharedenergy_trackster2bestCaloparticle_vs_phi[valType].push_back(
1289 ibook.
bookProfile(
"SharedEnergy_trackster2" + ref[valType] +
"_assoc_vs_phi",
1290 "Shared Energy of Trackster vs #phi per best " + refT[valType] +
";Trackster #phi" + shREnFr,
1296 histograms.h_sharedenergy_trackster2bestCaloparticle2[valType].push_back(
1297 ibook.
book1D(
"SharedEnergy_trackster2" + ref[valType] +
"_assoc2",
1298 "Shared Energy of Trackster per 2^{nd} best " + refT[valType] + shREnFr,
1303 histograms.h_sharedenergy_caloparticle2trackster[valType].push_back(
1304 ibook.
book1D(
"SharedEnergy_" + ref[valType] +
"2trackster",
1305 "Shared Energy of " + refT[valType] +
" per Trackster" + shSEnFr,
1309 histograms.h_sharedenergy_caloparticle2trackster_assoc[valType].push_back(
1310 ibook.
book1D(
"SharedEnergy_" + ref[valType] +
"2trackster_assoc",
1311 "Shared Energy of " + refT[valType] +
" per best Trackster" + shSEnFr,
1316 "SharedEnergy_" + ref[valType] +
"2trackster_assoc_vs_eta",
1317 "Shared Energy of " + refT[valType] +
" vs #eta per best Trackster;" + refT[valType] +
" #eta" + shSEnFr,
1324 "SharedEnergy_" + ref[valType] +
"2trackster_assoc_vs_phi",
1325 "Shared Energy of " + refT[valType] +
" vs #phi per best Trackster;" + refT[valType] +
" #phi" + shSEnFr,
1331 histograms.h_sharedenergy_caloparticle2trackster_assoc2[valType].push_back(
1332 ibook.
book1D(
"SharedEnergy_" + ref[valType] +
"2trackster_assoc2",
1333 "Shared Energy of " + refT[valType] +
" per 2^{nd} best Trackster;" + shSEnFr,
1339 histograms.h_numEff_caloparticle_eta[valType].push_back(
1340 ibook.
book1D(
"NumEff_" + refT[valType] +
"_Eta",
1341 "Num Efficiency " + refT[valType] +
" Eta per Trackster;#eta",
1345 histograms.h_num_caloparticle_eta[valType].push_back(
1346 ibook.
book1D(
"Num_" + refT[valType] +
"_Eta",
1347 "Num Purity " + refT[valType] +
" Eta per Trackster;#eta",
1353 histograms.h_denom_caloparticle_eta[valType].push_back(
1354 ibook.
book1D(
"Denom_" + refT[valType] +
"_Eta",
1355 "Denom " + refT[valType] +
" Eta per Trackster;#eta",
1360 histograms.h_numEff_caloparticle_phi[valType].push_back(
1361 ibook.
book1D(
"NumEff_" + refT[valType] +
"_Phi",
1362 "Num Efficiency " + refT[valType] +
" Phi per Trackster;#phi",
1366 histograms.h_num_caloparticle_phi[valType].push_back(
1367 ibook.
book1D(
"Num_" + refT[valType] +
"_Phi",
1368 "Num Purity " + refT[valType] +
" Phi per Trackster;#phi",
1374 histograms.h_denom_caloparticle_phi[valType].push_back(
1375 ibook.
book1D(
"Denom_" + refT[valType] +
"_Phi",
1376 "Denom " + refT[valType] +
" Phi per Trackster;#phi",
1381 histograms.h_numEff_caloparticle_en[valType].push_back(
1382 ibook.
book1D(
"NumEff_" + refT[valType] +
"_Energy",
1383 "Num Efficiency " + refT[valType] +
" Energy per Trackster;energy [GeV]",
1387 histograms.h_num_caloparticle_en[valType].push_back(
1388 ibook.
book1D(
"Num_" + refT[valType] +
"_Energy",
1389 "Num Purity " + refT[valType] +
" Energy per Trackster;energy [GeV]",
1393 histograms.h_numDup_trackster_en[valType].push_back(ibook.
book1D(
"NumDup_Trackster_Energy" +
val[valType],
1394 "Num Duplicate Trackster vs Energy;energy [GeV]",
1398 histograms.h_denom_caloparticle_en[valType].push_back(
1399 ibook.
book1D(
"Denom_" + refT[valType] +
"_Energy",
1400 "Denom " + refT[valType] +
" Energy per Trackster;energy [GeV]",
1405 histograms.h_numEff_caloparticle_pt[valType].push_back(
1406 ibook.
book1D(
"NumEff_" + refT[valType] +
"_Pt",
1407 "Num Efficiency " + refT[valType] +
" p_{T} per Trackster;p_{T} [GeV]",
1411 histograms.h_num_caloparticle_pt[valType].push_back(
1412 ibook.
book1D(
"Num_" + refT[valType] +
"_Pt",
1413 "Num Purity " + refT[valType] +
" p_{T} per Trackster;p_{T} [GeV]",
1418 "NumDup_Trackster_Pt" +
val[valType],
"Num Duplicate Trackster vs p_{T};p_{T} [GeV]",
nintPt_,
minPt_,
maxPt_));
1419 histograms.h_denom_caloparticle_pt[valType].push_back(
1420 ibook.
book1D(
"Denom_" + refT[valType] +
"_Pt",
1421 "Denom " + refT[valType] +
" p_{T} per Trackster;p_{T} [GeV]",
1445 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap)
const {
1469 int minLayerId = 999;
1472 int simHits_matched = 0;
1473 int minLayerId_matched = 999;
1474 int maxLayerId_matched = 0;
1477 std::map<int, double> totenergy_layer;
1479 float hitEnergyWeight_invSum = 0;
1480 std::vector<std::pair<DetId, float>> haf_cp;
1481 for (
const auto& sc : caloParticle.
simClusters()) {
1482 LogDebug(
"HGCalValidator") <<
" This sim cluster has " << sc->hits_and_fractions().size() <<
" simHits and " 1483 << sc->energy() <<
" energy. " << std::endl;
1484 simHits += sc->hits_and_fractions().size();
1485 for (
auto const& h_and_f : sc->hits_and_fractions()) {
1486 const auto hitDetId = h_and_f.first;
1490 int layerId_matched_min = 999;
1491 int layerId_matched_max = 0;
1492 std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(hitDetId);
1493 if (itcheck != hitMap.end()) {
1494 layerId_matched_min = layerId;
1495 layerId_matched_max = layerId;
1498 const auto hitEn = itcheck->second->energy();
1499 hitEnergyWeight_invSum +=
pow(hitEn, 2);
1500 const auto hitFr = h_and_f.second;
1501 const auto hitEnFr = hitEn * hitFr;
1503 histograms.h_caloparticle_nHits_matched_energy.at(
pdgid)->Fill(hitEnFr);
1504 histograms.h_caloparticle_nHits_matched_energy_layer.at(
pdgid)->Fill(layerId, hitEnFr);
1506 if (totenergy_layer.find(layerId) != totenergy_layer.end()) {
1507 totenergy_layer[layerId] = totenergy_layer.at(layerId) + hitEn;
1509 totenergy_layer.emplace(layerId, hitEn);
1512 histograms.h_caloparticle_nHits_matched_energy_layer_1SimCl.at(
pdgid)->Fill(layerId, hitEnFr);
1514 auto found = std::find_if(std::begin(haf_cp),
1516 [&hitDetId](
const std::pair<DetId, float>&
v) {
return v.first == hitDetId; });
1517 if (
found != haf_cp.end())
1518 found->second += hitFr;
1520 haf_cp.emplace_back(hitDetId, hitFr);
1523 LogDebug(
"HGCalValidator") <<
" matched to RecHit NOT found !" << std::endl;
1526 minLayerId =
std::min(minLayerId, layerId);
1527 maxLayerId =
std::max(maxLayerId, layerId);
1528 minLayerId_matched =
std::min(minLayerId_matched, layerId_matched_min);
1529 maxLayerId_matched =
std::max(maxLayerId_matched, layerId_matched_max);
1531 LogDebug(
"HGCalValidator") << std::endl;
1533 if (hitEnergyWeight_invSum)
1534 hitEnergyWeight_invSum = 1 / hitEnergyWeight_invSum;
1538 histograms.h_caloparticle_layersnum.at(
pdgid)->Fill(
int(maxLayerId - minLayerId));
1540 histograms.h_caloparticle_firstlayer_matchedtoRecHit.at(
pdgid)->Fill(minLayerId_matched);
1541 histograms.h_caloparticle_lastlayer_matchedtoRecHit.at(
pdgid)->Fill(maxLayerId_matched);
1542 histograms.h_caloparticle_layersnum_matchedtoRecHit.at(
pdgid)->Fill(
int(maxLayerId_matched - minLayerId_matched));
1545 histograms.h_caloparticle_nHitsInSimClusters_matchedtoRecHit.at(
pdgid)->Fill((
float)simHits_matched);
1550 auto i = totenergy_layer.begin();
1551 double sum_energy = 0.0;
1552 while (
i != totenergy_layer.end()) {
1553 sum_energy +=
i->second;
1554 histograms.h_caloparticle_sum_energy_layer.at(
pdgid)->Fill(
i->first, sum_energy / caloParticle.
energy() * 100.);
1558 for (
auto const& haf : haf_cp) {
1559 const auto hitEn = hitMap.find(haf.first)->second->energy();
1567 void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simCluster_histos(
const Histograms&
histograms,
1568 std::vector<SimCluster>
const& simClusters,
1570 std::vector<int> thicknesses)
const {
1579 std::vector<int> tnscpl(1000, 0);
1582 std::map<std::string, int> tnscpthplus;
1583 tnscpthplus.clear();
1584 std::map<std::string, int> tnscpthminus;
1585 tnscpthminus.clear();
1587 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
1588 tnscpthplus.insert(std::pair<std::string, int>(
std::to_string(*it), 0));
1589 tnscpthminus.insert(std::pair<std::string, int>(
std::to_string(*it), 0));
1592 tnscpthplus.insert(std::pair<std::string, int>(
"mixed", 0));
1593 tnscpthminus.insert(std::pair<std::string, int>(
"mixed", 0));
1596 for (
const auto& sc : simClusters) {
1598 int nthhits120p = 0;
1599 int nthhits200p = 0;
1600 int nthhits300p = 0;
1601 int nthhitsscintp = 0;
1602 int nthhits120m = 0;
1603 int nthhits200m = 0;
1604 int nthhits300m = 0;
1605 int nthhitsscintm = 0;
1609 std::vector<int> occurenceSCinlayer(1000, 0);
1612 for (
const auto& hAndF : sc.hits_and_fractions()) {
1613 const DetId sh_detid = hAndF.first;
1617 recHitTools_->getLayerWithOffset(sh_detid) +
layers * ((recHitTools_->zside(sh_detid) + 1) >> 1) - 1;
1619 int zside = recHitTools_->zside(sh_detid);
1622 if (occurenceSCinlayer[layerid] == 0) {
1625 occurenceSCinlayer[layerid]++;
1628 thickness = recHitTools_->getSiThickness(sh_detid);
1632 LogDebug(
"HGCalValidator") <<
"These are HGCal simClusters, you shouldn't be here !!! " << layerid <<
"\n";
1654 <<
" You are running a geometry that contains thicknesses different than the normal ones. " 1661 if ((nthhits120p != 0 && nthhits200p != 0) || (nthhits120p != 0 && nthhits300p != 0) ||
1662 (nthhits120p != 0 && nthhitsscintp != 0) || (nthhits200p != 0 && nthhits300p != 0) ||
1663 (nthhits200p != 0 && nthhitsscintp != 0) || (nthhits300p != 0 && nthhitsscintp != 0)) {
1664 tnscpthplus[
"mixed"]++;
1665 }
else if ((nthhits120p != 0 || nthhits200p != 0 || nthhits300p != 0 || nthhitsscintp != 0)) {
1669 if ((nthhits120m != 0 && nthhits200m != 0) || (nthhits120m != 0 && nthhits300m != 0) ||
1670 (nthhits120m != 0 && nthhitsscintm != 0) || (nthhits200m != 0 && nthhits300m != 0) ||
1671 (nthhits200m != 0 && nthhitsscintm != 0) || (nthhits300m != 0 && nthhitsscintm != 0)) {
1672 tnscpthminus[
"mixed"]++;
1673 }
else if ((nthhits120m != 0 || nthhits200m != 0 || nthhits300m != 0 || nthhitsscintm != 0)) {
1681 for (
unsigned ilayer = 0; ilayer <
layers * 2; ++ilayer)
1682 if (
histograms.h_simclusternum_perlayer.count(ilayer))
1683 histograms.h_simclusternum_perlayer.at(ilayer)->Fill(tnscpl[ilayer]);
1686 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
1687 if (
histograms.h_simclusternum_perthick.count(*it)) {
1693 histograms.h_mixedhitssimcluster_zplus->Fill(tnscpthplus[
"mixed"]);
1694 histograms.h_mixedhitssimcluster_zminus->Fill(tnscpthminus[
"mixed"]);
1697 void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simClusterAssociation_histos(
1702 edm::Handle<std::vector<SimCluster>> simClusterHandle,
1703 std::vector<SimCluster>
const& simClusters,
1704 std::vector<size_t>
const& sCIndices,
1705 const std::vector<float>&
mask,
1706 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap,
1728 scsInLayerClusterMap,
1729 lcsInSimClusterMap);
1742 edm::Handle<std::vector<CaloParticle>> caloParticleHandle,
1743 std::vector<CaloParticle>
const& cP,
1744 std::vector<size_t>
const& cPIndices,
1745 std::vector<size_t>
const& cPSelectedIndices,
1746 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap,
1750 const auto nLayerClusters =
clusters.size();
1752 std::unordered_map<DetId, std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>> detIdToCaloParticleId_Map;
1753 std::unordered_map<DetId, std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>> detIdToLayerClusterId_Map;
1757 for (
const auto& cpId : cPIndices) {
1758 for (
const auto& simCluster : cP[cpId].simClusters()) {
1759 for (
const auto& it_haf : simCluster->hits_and_fractions()) {
1760 const DetId hitid = (it_haf.first);
1761 if (hitMap.find(hitid) != hitMap.end()) {
1762 if (detIdToCaloParticleId_Map.find(hitid) == detIdToCaloParticleId_Map.end()) {
1763 detIdToCaloParticleId_Map[hitid] = std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>();
1764 detIdToCaloParticleId_Map[hitid].emplace_back(
1768 std::find(detIdToCaloParticleId_Map[hitid].begin(),
1769 detIdToCaloParticleId_Map[hitid].
end(),
1772 if (findHitIt != detIdToCaloParticleId_Map[hitid].
end())
1773 findHitIt->fraction += it_haf.second;
1775 detIdToCaloParticleId_Map[hitid].emplace_back(
1783 for (
unsigned int lcId = 0; lcId < nLayerClusters; ++lcId) {
1784 const auto& hits_and_fractions =
clusters[lcId].hitsAndFractions();
1785 const auto numberOfHitsInLC = hits_and_fractions.size();
1795 std::vector<int> hitsToCaloParticleId(numberOfHitsInLC);
1796 const auto firstHitDetId = hits_and_fractions[0].first;
1801 std::unordered_map<unsigned, float> CPEnergyInLC;
1803 for (
unsigned int iHit = 0; iHit < numberOfHitsInLC; iHit++) {
1804 const DetId rh_detid = hits_and_fractions[iHit].first;
1805 const auto rhFraction = hits_and_fractions[iHit].second;
1807 std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(rh_detid);
1810 if (detIdToLayerClusterId_Map.find(rh_detid) == detIdToLayerClusterId_Map.end()) {
1811 detIdToLayerClusterId_Map[rh_detid] = std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>();
1815 const auto& hit_find_in_CP = detIdToCaloParticleId_Map.find(rh_detid);
1823 if (rhFraction == 0.) {
1824 hitsToCaloParticleId[iHit] = -2;
1826 if (hit_find_in_CP == detIdToCaloParticleId_Map.end()) {
1827 hitsToCaloParticleId[iHit] -= 1;
1829 auto maxCPEnergyInLC = 0.f;
1831 for (
auto&
h : hit_find_in_CP->second) {
1832 const auto iCP =
h.clusterId;
1833 CPEnergyInLC[iCP] +=
h.fraction *
hit->energy();
1836 if (CPEnergyInLC[iCP] > maxCPEnergyInLC) {
1837 maxCPEnergyInLC = CPEnergyInLC[iCP];
1841 hitsToCaloParticleId[iHit] = maxCPId;
1843 histograms.h_cellAssociation_perlayer.at(lcLayerId)->Fill(
1844 hitsToCaloParticleId[iHit] > 0. ? 0. : hitsToCaloParticleId[iHit]);
1852 for (
unsigned int lcId = 0; lcId < nLayerClusters; ++lcId) {
1853 const auto firstHitDetId = (
clusters[lcId].hitsAndFractions())[0].
first;
1854 const int lcLayerId =
1860 const auto& cpsIt = cpsInLayerClusterMap.
find(lcRef);
1861 if (cpsIt == cpsInLayerClusterMap.
end())
1864 const auto lc_en =
clusters[lcId].energy();
1865 const auto& cps = cpsIt->val;
1866 if (lc_en == 0. && !cps.empty()) {
1867 for (
const auto& cpPair : cps)
1868 histograms.h_score_layercl2caloparticle_perlayer.at(lcLayerId)->Fill(cpPair.second);
1871 for (
const auto& cpPair : cps) {
1872 LogDebug(
"HGCalValidator") <<
"layerCluster Id: \t" << lcId <<
"\t CP id: \t" << cpPair.first.index()
1873 <<
"\t score \t" << cpPair.second << std::endl;
1874 histograms.h_score_layercl2caloparticle_perlayer.at(lcLayerId)->Fill(cpPair.second);
1875 auto const& cp_linked =
1876 std::find_if(std::begin(cPOnLayerMap[cpPair.first]),
1877 std::end(cPOnLayerMap[cpPair.first]),
1879 return p.first == lcRef;
1882 cPOnLayerMap[cpPair.first].
end())
1884 histograms.h_sharedenergy_layercl2caloparticle_perlayer.at(lcLayerId)->Fill(cp_linked->second.first / lc_en,
1886 histograms.h_energy_vs_score_layercl2caloparticle_perlayer.at(lcLayerId)->Fill(cpPair.second,
1887 cp_linked->second.first / lc_en);
1890 std::count_if(std::begin(cps), std::end(cps), [](
const auto&
obj) {
return obj.second <
ScoreCutLCtoCP_; });
1898 const auto& best = std::min_element(
1899 std::begin(cps), std::end(cps), [](
const auto& obj1,
const auto& obj2) {
return obj1.second < obj2.second; });
1900 const auto& best_cp_linked =
1901 std::find_if(std::begin(cPOnLayerMap[best->first]),
1902 std::end(cPOnLayerMap[best->first]),
1904 return p.first == lcRef;
1906 if (best_cp_linked ==
1907 cPOnLayerMap[best->first].
end())
1909 histograms.h_sharedenergy_layercl2caloparticle_vs_eta_perlayer.at(lcLayerId)->Fill(
1910 clusters[lcId].
eta(), best_cp_linked->second.first / lc_en);
1911 histograms.h_sharedenergy_layercl2caloparticle_vs_phi_perlayer.at(lcLayerId)->Fill(
1912 clusters[lcId].
phi(), best_cp_linked->second.first / lc_en);
1919 for (
const auto& cpId : cPSelectedIndices) {
1921 const auto& lcsIt = cPOnLayerMap.
find(cpRef);
1923 std::map<unsigned int, float> cPEnergyOnLayer;
1924 for (
unsigned int layerId = 0; layerId <
layers * 2; ++layerId)
1925 cPEnergyOnLayer[layerId] = 0;
1927 for (
const auto& simCluster : cP[cpId].simClusters()) {
1928 for (
const auto& it_haf : simCluster->hits_and_fractions()) {
1929 const DetId hitid = (it_haf.first);
1930 const auto hitLayerId =
1932 std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(hitid);
1933 if (itcheck != hitMap.end()) {
1935 cPEnergyOnLayer[hitLayerId] += it_haf.second *
hit->energy();
1940 for (
unsigned int layerId = 0; layerId <
layers * 2; ++layerId) {
1941 if (!cPEnergyOnLayer[layerId])
1944 histograms.h_denom_caloparticle_eta_perlayer.at(layerId)->Fill(cP[cpId].g4Tracks()[0].momentum().
eta());
1945 histograms.h_denom_caloparticle_phi_perlayer.at(layerId)->Fill(cP[cpId].g4Tracks()[0].momentum().
phi());
1947 if (lcsIt == cPOnLayerMap.
end())
1949 const auto& lcs = lcsIt->val;
1951 auto getLCLayerId = [&](
const unsigned int lcId) {
1952 const auto firstHitDetId = (
clusters[lcId].hitsAndFractions())[0].
first;
1953 const auto lcLayerId =
recHitTools_->getLayerWithOffset(firstHitDetId) +
1958 for (
const auto& lcPair : lcs) {
1959 if (getLCLayerId(lcPair.first.index()) != layerId)
1961 histograms.h_score_caloparticle2layercl_perlayer.at(layerId)->Fill(lcPair.second.second);
1962 histograms.h_sharedenergy_caloparticle2layercl_perlayer.at(layerId)->Fill(
1963 lcPair.second.first / cPEnergyOnLayer[layerId], cPEnergyOnLayer[layerId]);
1964 histograms.h_energy_vs_score_caloparticle2layercl_perlayer.at(layerId)->Fill(
1965 lcPair.second.second, lcPair.second.first / cPEnergyOnLayer[layerId]);
1967 const auto assoc = std::count_if(std::begin(lcs), std::end(lcs), [&](
const auto&
obj) {
1968 if (getLCLayerId(
obj.first.index()) != layerId)
1974 histograms.h_num_caloparticle_eta_perlayer.at(layerId)->Fill(cP[cpId].g4Tracks()[0].momentum().
eta());
1975 histograms.h_num_caloparticle_phi_perlayer.at(layerId)->Fill(cP[cpId].g4Tracks()[0].momentum().
phi());
1977 histograms.h_numDup_caloparticle_eta_perlayer.at(layerId)->Fill(cP[cpId].g4Tracks()[0].momentum().
eta());
1978 histograms.h_numDup_caloparticle_phi_perlayer.at(layerId)->Fill(cP[cpId].g4Tracks()[0].momentum().
phi());
1980 const auto best = std::min_element(std::begin(lcs), std::end(lcs), [&](
const auto& obj1,
const auto& obj2) {
1981 if (getLCLayerId(obj1.first.index()) != layerId)
1983 else if (getLCLayerId(obj2.first.index()) == layerId)
1984 return obj1.second.second < obj2.second.second;
1988 histograms.h_sharedenergy_caloparticle2layercl_vs_eta_perlayer.at(layerId)->Fill(
1989 cP[cpId].g4Tracks()[0].momentum().
eta(), best->second.first / cPEnergyOnLayer[layerId]);
1990 histograms.h_sharedenergy_caloparticle2layercl_vs_phi_perlayer.at(layerId)->Fill(
1991 cP[cpId].g4Tracks()[0].momentum().
phi(), best->second.first / cPEnergyOnLayer[layerId]);
2002 edm::Handle<std::vector<SimCluster>> simClusterHandle,
2003 std::vector<SimCluster>
const& sC,
2004 std::vector<size_t>
const& sCIndices,
2005 const std::vector<float>&
mask,
2006 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap,
2013 for (
unsigned int lcId = 0; lcId <
clusters.size(); ++lcId) {
2014 if (
mask[lcId] != 0.) {
2015 LogDebug(
"HGCalValidator") <<
"Skipping layer cluster " << lcId <<
" not belonging to mask" << std::endl;
2018 const auto firstHitDetId = (
clusters[lcId].hitsAndFractions())[0].
first;
2019 const auto lcLayerId =
2027 const auto& scsIt = scsInLayerClusterMap.
find(lcRef);
2028 if (scsIt == scsInLayerClusterMap.
end())
2031 const auto lc_en =
clusters[lcId].energy();
2032 const auto& scs = scsIt->val;
2035 if (lc_en == 0. && !scs.empty()) {
2036 for (
const auto& scPair : scs) {
2037 histograms.h_score_layercl2simcluster_perlayer[
count].at(lcLayerId)->Fill(scPair.second);
2042 for (
const auto& scPair : scs) {
2043 LogDebug(
"HGCalValidator") <<
"layerCluster Id: \t" << lcId <<
"\t SC id: \t" << scPair.first.index()
2044 <<
"\t score \t" << scPair.second << std::endl;
2046 histograms.h_score_layercl2simcluster_perlayer[
count].at(lcLayerId)->Fill(scPair.second);
2047 auto const& sc_linked =
2048 std::find_if(std::begin(lcsInSimClusterMap[scPair.first]),
2049 std::end(lcsInSimClusterMap[scPair.first]),
2051 return p.first == lcRef;
2054 lcsInSimClusterMap[scPair.first].
end())
2056 histograms.h_sharedenergy_layercl2simcluster_perlayer[
count].at(lcLayerId)->Fill(sc_linked->second.first / lc_en,
2058 histograms.h_energy_vs_score_layercl2simcluster_perlayer[
count].at(lcLayerId)->Fill(
2059 scPair.second, sc_linked->second.first / lc_en);
2063 std::count_if(std::begin(scs), std::end(scs), [](
const auto&
obj) {
return obj.second <
ScoreCutLCtoSC_; });
2071 const auto& best = std::min_element(
2072 std::begin(scs), std::end(scs), [](
const auto& obj1,
const auto& obj2) {
return obj1.second < obj2.second; });
2074 const auto& best_sc_linked =
2075 std::find_if(std::begin(lcsInSimClusterMap[best->first]),
2076 std::end(lcsInSimClusterMap[best->first]),
2078 return p.first == lcRef;
2080 if (best_sc_linked ==
2081 lcsInSimClusterMap[best->first].
end())
2083 histograms.h_sharedenergy_layercl2simcluster_vs_eta_perlayer[
count].at(lcLayerId)->Fill(
2084 clusters[lcId].
eta(), best_sc_linked->second.first / lc_en);
2085 histograms.h_sharedenergy_layercl2simcluster_vs_phi_perlayer[
count].at(lcLayerId)->Fill(
2086 clusters[lcId].
phi(), best_sc_linked->second.first / lc_en);
2093 for (
const auto& scId : sCIndices) {
2095 const auto& lcsIt = lcsInSimClusterMap.
find(scRef);
2097 std::map<unsigned int, float> sCEnergyOnLayer;
2098 for (
unsigned int layerId = 0; layerId <
layers * 2; ++layerId)
2099 sCEnergyOnLayer[layerId] = 0;
2101 for (
const auto& it_haf : sC[scId].hits_and_fractions()) {
2102 const DetId hitid = (it_haf.first);
2103 const auto scLayerId =
2105 std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(hitid);
2106 if (itcheck != hitMap.end()) {
2108 sCEnergyOnLayer[scLayerId] += it_haf.second *
hit->energy();
2112 for (
unsigned int layerId = 0; layerId <
layers * 2; ++layerId) {
2113 if (!sCEnergyOnLayer[layerId])
2119 if (lcsIt == lcsInSimClusterMap.
end())
2121 const auto& lcs = lcsIt->val;
2123 auto getLCLayerId = [&](
const unsigned int lcId) {
2124 const auto firstHitDetId = (
clusters[lcId].hitsAndFractions())[0].
first;
2125 const unsigned int lcLayerId =
recHitTools_->getLayerWithOffset(firstHitDetId) +
2131 for (
const auto& lcPair : lcs) {
2132 auto lcId = lcPair.first.index();
2133 if (
mask[lcId] != 0.) {
2134 LogDebug(
"HGCalValidator") <<
"Skipping layer cluster " << lcId <<
" not belonging to mask" << std::endl;
2138 if (getLCLayerId(lcId) != layerId)
2140 histograms.h_score_simcluster2layercl_perlayer[
count].at(layerId)->Fill(lcPair.second.second);
2141 histograms.h_sharedenergy_simcluster2layercl_perlayer[
count].at(layerId)->Fill(
2142 lcPair.second.first / sCEnergyOnLayer[layerId], sCEnergyOnLayer[layerId]);
2143 histograms.h_energy_vs_score_simcluster2layercl_perlayer[
count].at(layerId)->Fill(
2144 lcPair.second.second, lcPair.second.first / sCEnergyOnLayer[layerId]);
2146 const auto assoc = std::count_if(std::begin(lcs), std::end(lcs), [&](
const auto&
obj) {
2147 if (getLCLayerId(
obj.first.index()) != layerId)
2156 histograms.h_numDup_simcluster_eta_perlayer[
count].at(layerId)->Fill(sC[scId].
eta());
2157 histograms.h_numDup_simcluster_phi_perlayer[
count].at(layerId)->Fill(sC[scId].
phi());
2159 const auto best = std::min_element(std::begin(lcs), std::end(lcs), [&](
const auto& obj1,
const auto& obj2) {
2160 if (getLCLayerId(obj1.first.index()) != layerId)
2162 else if (getLCLayerId(obj2.first.index()) == layerId)
2163 return obj1.second.second < obj2.second.second;
2167 histograms.h_sharedenergy_simcluster2layercl_vs_eta_perlayer[
count].at(layerId)->Fill(
2168 sC[scId].
eta(), best->second.first / sCEnergyOnLayer[layerId]);
2169 histograms.h_sharedenergy_simcluster2layercl_vs_phi_perlayer[
count].at(layerId)->Fill(
2170 sC[scId].
phi(), best->second.first / sCEnergyOnLayer[layerId]);
2181 edm::Handle<std::vector<CaloParticle>> caloParticleHandle,
2182 std::vector<CaloParticle>
const& cP,
2183 std::vector<size_t>
const& cPIndices,
2184 std::vector<size_t>
const& cPSelectedIndices,
2185 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap,
2186 std::map<double, double> cummatbudg,
2188 std::vector<int> thicknesses,
2199 std::vector<int> tnlcpl(1000, 0);
2202 std::map<std::string, int> tnlcpthplus;
2203 tnlcpthplus.clear();
2204 std::map<std::string, int> tnlcpthminus;
2205 tnlcpthminus.clear();
2207 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
2208 tnlcpthplus.insert(std::pair<std::string, int>(
std::to_string(*it), 0));
2209 tnlcpthminus.insert(std::pair<std::string, int>(
std::to_string(*it), 0));
2212 tnlcpthplus.insert(std::pair<std::string, int>(
"mixed", 0));
2213 tnlcpthminus.insert(std::pair<std::string, int>(
"mixed", 0));
2224 cpsInLayerClusterMap,
2229 std::vector<double> tecpl(1000, 0.0);
2231 std::vector<double> ldbar(1000, 0.0);
2234 double caloparteneplus = 0.;
2235 double caloparteneminus = 0.;
2236 for (
const auto& cpId : cPIndices) {
2237 if (cP[cpId].
eta() >= 0.) {
2238 caloparteneplus = caloparteneplus + cP[cpId].energy();
2239 }
else if (cP[cpId].
eta() < 0.) {
2240 caloparteneminus = caloparteneminus + cP[cpId].energy();
2245 for (
const auto& lcId :
clusters) {
2246 const auto seedid = lcId.seed();
2247 const double seedx =
recHitTools_->getPosition(seedid).x();
2248 const double seedy =
recHitTools_->getPosition(seedid).y();
2256 int nthhits120p = 0;
2257 int nthhits200p = 0;
2258 int nthhits300p = 0;
2259 int nthhitsscintp = 0;
2260 int nthhits120m = 0;
2261 int nthhits200m = 0;
2262 int nthhits300m = 0;
2263 int nthhitsscintm = 0;
2274 bool cluslay =
true;
2278 const auto& hits_and_fractions = lcId.hitsAndFractions();
2279 for (
std::vector<std::pair<DetId, float>>::const_iterator it_haf = hits_and_fractions.begin();
2280 it_haf != hits_and_fractions.end();
2282 const DetId rh_detid = it_haf->first;
2292 LogDebug(
"HGCalValidator") <<
"These are HGCal layer clusters, you shouldn't be here !!! " << layerid <<
"\n";
2299 while (lay_string.size() < 2)
2300 lay_string.insert(0,
"0");
2301 curistr +=
"_" + lay_string;
2326 <<
" You are running a geometry that contains thicknesses different than the normal ones. " 2330 std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(rh_detid);
2331 if (itcheck == hitMap.end()) {
2332 std::ostringstream st1;
2340 LogDebug(
"HGCalValidator") <<
" You shouldn't be here - Unable to find a hit " << rh_detid.
rawId() <<
" " 2341 << rh_detid.
det() <<
" " << st1.str() <<
"\n";
2349 const double hit_x =
recHitTools_->getPosition(rh_detid).x();
2350 const double hit_y =
recHitTools_->getPosition(rh_detid).y();
2351 double distancetoseed =
distance(seedx, seedy, hit_x, hit_y);
2352 double distancetomax =
distance(maxx, maxy, hit_x, hit_y);
2353 if (distancetoseed != 0. &&
histograms.h_distancetoseedcell_perthickperlayer.count(curistr)) {
2354 histograms.h_distancetoseedcell_perthickperlayer.at(curistr)->Fill(distancetoseed);
2357 if (distancetoseed != 0. &&
histograms.h_distancetoseedcell_perthickperlayer_eneweighted.count(curistr)) {
2358 histograms.h_distancetoseedcell_perthickperlayer_eneweighted.at(curistr)->Fill(distancetoseed,
hit->energy());
2361 if (distancetomax != 0. &&
histograms.h_distancetomaxcell_perthickperlayer.count(curistr)) {
2362 histograms.h_distancetomaxcell_perthickperlayer.at(curistr)->Fill(distancetomax);
2365 if (distancetomax != 0. &&
histograms.h_distancetomaxcell_perthickperlayer_eneweighted.count(curistr)) {
2366 histograms.h_distancetomaxcell_perthickperlayer_eneweighted.at(curistr)->Fill(distancetomax,
hit->energy());
2370 std::map<DetId, float>::const_iterator dit = densities.find(rh_detid);
2371 if (dit == densities.end()) {
2372 std::ostringstream st1;
2380 LogDebug(
"HGCalValidator") <<
" You shouldn't be here - Unable to find a density " << rh_detid.
rawId() <<
" " 2381 << rh_detid.
det() <<
" " << st1.str() <<
"\n";
2392 if ((nthhits120p != 0 && nthhits200p != 0) || (nthhits120p != 0 && nthhits300p != 0) ||
2393 (nthhits120p != 0 && nthhitsscintp != 0) || (nthhits200p != 0 && nthhits300p != 0) ||
2394 (nthhits200p != 0 && nthhitsscintp != 0) || (nthhits300p != 0 && nthhitsscintp != 0)) {
2395 tnlcpthplus[
"mixed"]++;
2396 }
else if ((nthhits120p != 0 || nthhits200p != 0 || nthhits300p != 0 || nthhitsscintp != 0)) {
2400 if ((nthhits120m != 0 && nthhits200m != 0) || (nthhits120m != 0 && nthhits300m != 0) ||
2401 (nthhits120m != 0 && nthhitsscintm != 0) || (nthhits200m != 0 && nthhits300m != 0) ||
2402 (nthhits200m != 0 && nthhitsscintm != 0) || (nthhits300m != 0 && nthhitsscintm != 0)) {
2403 tnlcpthminus[
"mixed"]++;
2404 }
else if ((nthhits120m != 0 || nthhits200m != 0 || nthhits300m != 0 || nthhitsscintm != 0)) {
2410 std::vector<int> bigamoth;
2413 bigamoth.push_back(nthhits120p);
2414 bigamoth.push_back(nthhits200p);
2415 bigamoth.push_back(nthhits300p);
2416 bigamoth.push_back(nthhitsscintp);
2417 }
else if (
zside < 0) {
2418 bigamoth.push_back(nthhits120m);
2419 bigamoth.push_back(nthhits200m);
2420 bigamoth.push_back(nthhits300m);
2421 bigamoth.push_back(nthhitsscintm);
2423 auto bgth = std::max_element(bigamoth.begin(), bigamoth.end());
2426 while (lay_string.size() < 2)
2427 lay_string.insert(0,
"0");
2428 istr +=
"_" + lay_string;
2431 if (
histograms.h_cellsnum_perthickperlayer.count(istr)) {
2432 histograms.h_cellsnum_perthickperlayer.at(istr)->Fill(hits_and_fractions.size());
2436 double distancebetseedandmax =
distance(seedx, seedy, maxx, maxy);
2439 seedstr +=
"_" + lay_string;
2440 if (
histograms.h_distancebetseedandmaxcell_perthickperlayer.count(seedstr)) {
2441 histograms.h_distancebetseedandmaxcell_perthickperlayer.at(seedstr)->Fill(distancebetseedandmax);
2443 const auto lc_en = lcId.energy();
2444 if (
histograms.h_distancebetseedandmaxcellvsclusterenergy_perthickperlayer.count(seedstr)) {
2445 histograms.h_distancebetseedandmaxcellvsclusterenergy_perthickperlayer.at(seedstr)->Fill(distancebetseedandmax,
2450 tecpl[layerid] = tecpl[layerid] + lc_en;
2451 ldbar[layerid] = ldbar[layerid] + lc_en * cummatbudg[(double)lay];
2456 double sumeneallcluspl = 0.;
2457 double sumeneallclusmi = 0.;
2459 double sumldbarpl = 0.;
2460 double sumldbarmi = 0.;
2462 for (
unsigned ilayer = 0; ilayer <
layers * 2; ++ilayer) {
2463 if (
histograms.h_clusternum_perlayer.count(ilayer)) {
2464 histograms.h_clusternum_perlayer.at(ilayer)->Fill(tnlcpl[ilayer]);
2469 if (
histograms.h_energyclustered_perlayer.count(ilayer)) {
2470 if (caloparteneminus != 0.) {
2471 histograms.h_energyclustered_perlayer.at(ilayer)->Fill(100. * tecpl[ilayer] / caloparteneminus);
2475 sumeneallclusmi = sumeneallclusmi + tecpl[ilayer];
2477 sumldbarmi = sumldbarmi + ldbar[ilayer];
2479 if (
histograms.h_energyclustered_perlayer.count(ilayer)) {
2480 if (caloparteneplus != 0.) {
2481 histograms.h_energyclustered_perlayer.at(ilayer)->Fill(100. * tecpl[ilayer] / caloparteneplus);
2485 sumeneallcluspl = sumeneallcluspl + tecpl[ilayer];
2487 sumldbarpl = sumldbarpl + ldbar[ilayer];
2493 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
2494 if (
histograms.h_clusternum_perthick.count(*it)) {
2500 histograms.h_mixedhitscluster_zplus[
count]->Fill(tnlcpthplus[
"mixed"]);
2501 histograms.h_mixedhitscluster_zminus[
count]->Fill(tnlcpthminus[
"mixed"]);
2504 if (caloparteneplus != 0.) {
2505 histograms.h_energyclustered_zplus[
count]->Fill(100. * sumeneallcluspl / caloparteneplus);
2507 if (caloparteneminus != 0.) {
2508 histograms.h_energyclustered_zminus[
count]->Fill(100. * sumeneallclusmi / caloparteneminus);
2512 histograms.h_longdepthbarycentre_zplus[
count]->Fill(sumldbarpl / sumeneallcluspl);
2513 histograms.h_longdepthbarycentre_zminus[
count]->Fill(sumldbarmi / sumeneallclusmi);
2524 const std::map<
unsigned int, std::vector<unsigned int>>& cpToSc_SimTrackstersMap,
2525 std::vector<SimCluster>
const& sC,
2527 std::vector<CaloParticle>
const& cP,
2528 std::vector<size_t>
const& cPIndices,
2529 std::vector<size_t>
const& cPSelectedIndices,
2530 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap,
2531 unsigned int layers)
const {
2532 const auto nTracksters = tracksters.size();
2533 const auto nSimTracksters = simTSs.size();
2535 std::unordered_map<DetId, std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>> detIdSimTSId_Map;
2536 std::unordered_map<DetId, std::vector<HGVHistoProducerAlgo::detIdInfoInTrackster>> detIdToTracksterId_Map;
2537 std::vector<int> tracksters_FakeMerge(nTracksters, 0);
2538 std::vector<int> tracksters_PurityDuplicate(nTracksters, 0);
2543 std::vector<std::vector<std::pair<unsigned int, float>>> stsInTrackster;
2544 stsInTrackster.resize(nTracksters);
2550 std::unordered_map<int, caloParticleOnLayer> cPOnLayer;
2551 std::unordered_map<int, std::vector<caloParticleOnLayer>> sCOnLayer;
2553 for (
const auto cpIndex : cPIndices) {
2554 cPOnLayer[cpIndex].caloParticleId = cpIndex;
2555 cPOnLayer[cpIndex].energy = 0.f;
2556 cPOnLayer[cpIndex].hits_and_fractions.clear();
2557 const auto nSC_inCP = sC.size();
2558 sCOnLayer[cpIndex].resize(nSC_inCP);
2559 for (
unsigned int iSC = 0; iSC < nSC_inCP; iSC++) {
2560 sCOnLayer[cpIndex][iSC].caloParticleId = cpIndex;
2561 sCOnLayer[cpIndex][iSC].energy = 0.f;
2562 sCOnLayer[cpIndex][iSC].hits_and_fractions.clear();
2567 const unsigned int iSTS,
2569 const std::map<unsigned int, std::vector<unsigned int>>& cpToSc_SimTrackstersMap,
2571 unsigned int cpId = -1;
2573 const auto productID = simTS.
seedID();
2574 if (productID == cPHandle_id) {
2577 const auto findSimTSFromCP = std::find_if(
2578 std::begin(cpToSc_SimTrackstersMap),
2579 std::end(cpToSc_SimTrackstersMap),
2580 [&](
const std::pair<
unsigned int, std::vector<unsigned int>>& cpToScs) {
2581 return std::find(std::begin(cpToScs.second), std::end(cpToScs.second), iSTS) != std::end(cpToScs.second);
2583 if (findSimTSFromCP != std::end(cpToSc_SimTrackstersMap)) {
2584 cpId = simTSs_fromCP[findSimTSFromCP->first].seedIndex();
2591 auto getLCId = [](
const std::vector<unsigned int>& tst_vertices,
2593 const DetId& hitid) {
2594 unsigned int lcId = -1;
2595 std::for_each(std::begin(tst_vertices), std::end(tst_vertices), [&](
unsigned int idx) {
2597 const auto& hitFound = std::find_if(std::begin(lc_haf),
2599 [&hitid](
const std::pair<DetId, float>&
v) {
return v.first == hitid; });
2600 if (hitFound != lc_haf.end())
2606 for (
unsigned int iSTS = 0; iSTS < nSimTracksters; ++iSTS) {
2607 const auto cpId = getCPId(simTSs[iSTS], iSTS, cPHandle_id, cpToSc_SimTrackstersMap, simTSs_fromCP);
2608 if (
std::find(cPIndices.begin(), cPIndices.end(), cpId) == cPIndices.end())
2612 for (
const auto& simCluster : cP[cpId].simClusters()) {
2613 auto iSim = simTSs[iSTS].seedIndex();
2614 if (simTSs[iSTS].seedID() != cPHandle_id) {
2615 if (iSim != (&(*simCluster) - &(sC[0])))
2620 for (
const auto& it_haf : simCluster->hits_and_fractions()) {
2621 const auto hitid = (it_haf.first);
2625 const auto itcheck = hitMap.find(hitid);
2627 if ((valType == 0 && itcheck != hitMap.end()) || (valType > 0 &&
int(lcId) >= 0)) {
2628 float lcFraction = 0;
2634 const auto elemId = (valType == 0) ? hitid : lcId;
2635 const auto elemFr = (valType == 0) ? it_haf.second : lcFraction;
2643 if (detIdSimTSId_Map.find(elemId) == detIdSimTSId_Map.end()) {
2644 detIdSimTSId_Map[elemId] = std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>();
2648 std::find(detIdSimTSId_Map[elemId].begin(),
2649 detIdSimTSId_Map[elemId].
end(),
2652 if (findSTSIt != detIdSimTSId_Map[elemId].
end()) {
2654 findSTSIt->fraction += elemFr;
2659 const auto hitEn = itcheck->second->energy();
2663 cPOnLayer[cpId].energy += it_haf.second * hitEn;
2664 sCOnLayer[cpId][iSim].energy += elemFr * hitEn;
2671 auto& haf = cPOnLayer[cpId].hits_and_fractions;
2672 auto found = std::find_if(
2673 std::begin(haf), std::end(haf), [&hitid](
const std::pair<DetId, float>&
v) {
return v.first == hitid; });
2674 if (
found != haf.end())
2675 found->second += it_haf.second;
2677 haf.emplace_back(hitid, it_haf.second);
2679 auto& haf_sc = sCOnLayer[cpId][iSim].hits_and_fractions;
2680 auto found_sc = std::find_if(std::begin(haf_sc),
2682 [&hitid](
const std::pair<DetId, float>&
v) {
return v.first == hitid; });
2683 if (found_sc != haf_sc.end())
2684 found_sc->second += it_haf.second;
2686 haf_sc.emplace_back(hitid, it_haf.second);
2693 std::vector<std::pair<DetId, float>> hits_and_fractions_norm;
2695 std::for_each(std::begin(trackster.
vertices()), std::end(trackster.
vertices()), [&](
unsigned int idx) {
2698 hits_and_fractions_norm.emplace_back(
2699 cell.first, cell.second *
fraction);
2702 return hits_and_fractions_norm;
2708 for (
unsigned int tstId = 0; tstId < nTracksters; ++tstId) {
2709 const auto& tst = tracksters[tstId];
2716 if (tst.vertices().empty())
2719 std::unordered_map<unsigned, float> CPEnergyInTS;
2720 int maxCPId_byNumberOfHits = -1;
2721 unsigned int maxCPNumberOfHitsInTS = 0;
2722 int maxCPId_byEnergy = -1;
2723 float maxEnergySharedTSandCP = 0.f;
2724 float energyFractionOfTSinCP = 0.f;
2725 float energyFractionOfCPinTS = 0.f;
2732 std::unordered_map<unsigned, unsigned> occurrencesCPinTS;
2733 unsigned int numberOfNoiseHitsInTS = 0;
2734 unsigned int numberOfHaloHitsInTS = 0;
2736 const auto tst_hitsAndFractions = apply_LCMultiplicity(tst,
layerClusters);
2737 const auto numberOfHitsInTS = tst_hitsAndFractions.size();
2755 std::vector<int> hitsToCaloParticleId(numberOfHitsInTS);
2758 for (
unsigned int iHit = 0; iHit < numberOfHitsInTS; iHit++) {
2759 const auto rh_detid = tst_hitsAndFractions[iHit].first;
2760 const auto rhFraction = tst_hitsAndFractions[iHit].second;
2762 const auto lcId_r = getLCId(tst.vertices(),
layerClusters, rh_detid);
2763 const auto iLC_r =
std::find(tst.vertices().begin(), tst.vertices().end(), lcId_r);
2764 const auto lcFraction_r = 1.f / tst.vertex_multiplicity(
std::distance(std::begin(tst.vertices()), iLC_r));
2773 if (detIdToTracksterId_Map.find(rh_detid) == detIdToTracksterId_Map.end()) {
2774 detIdToTracksterId_Map[rh_detid] = std::vector<HGVHistoProducerAlgo::detIdInfoInTrackster>();
2775 detIdToTracksterId_Map[rh_detid].emplace_back(
2779 std::find(detIdToTracksterId_Map[rh_detid].begin(),
2780 detIdToTracksterId_Map[rh_detid].
end(),
2783 if (findTSIt != detIdToTracksterId_Map[rh_detid].
end()) {
2785 findTSIt->fraction += rhFraction;
2787 detIdToTracksterId_Map[rh_detid].emplace_back(
2797 if (rhFraction == 0.) {
2798 hitsToCaloParticleId[iHit] = -2;
2799 numberOfHaloHitsInTS++;
2803 const auto elemId = (valType == 0) ? rh_detid.rawId() : lcId_r;
2804 const auto recoFr = (valType == 0) ? rhFraction : lcFraction_r;
2805 const auto& hit_find_in_STS = detIdSimTSId_Map.find(elemId);
2806 if (hit_find_in_STS == detIdSimTSId_Map.end()) {
2807 hitsToCaloParticleId[iHit] -= 1;
2810 const auto hitEn = hitMap.find(rh_detid)->second->energy();
2815 auto maxCPEnergyInTS = 0.f;
2817 for (
const auto&
h : hit_find_in_STS->second) {
2818 const auto shared_fraction =
std::min(recoFr,
h.fraction);
2819 const auto iSTS =
h.clusterId;
2820 const auto& simTS = simTSs[iSTS];
2822 if (simTSs[iSTS].seedID() == cPHandle_id)
2829 const auto cpId = getCPId(simTS, iSTS, cPHandle_id, cpToSc_SimTrackstersMap, simTSs_fromCP);
2830 if (
std::find(cPIndices.begin(), cPIndices.end(), cpId) == cPIndices.end())
2833 CPEnergyInTS[cpId] += shared_fraction * hitEn;
2836 cPOnLayer[cpId].layerClusterIdToEnergyAndScore[tstId].first += shared_fraction * hitEn;
2837 sCOnLayer[cpId][iSim].layerClusterIdToEnergyAndScore[tstId].first += shared_fraction * hitEn;
2838 cPOnLayer[cpId].layerClusterIdToEnergyAndScore[tstId].second = FLT_MAX;
2839 sCOnLayer[cpId][iSim].layerClusterIdToEnergyAndScore[tstId].second = FLT_MAX;
2842 stsInTrackster[tstId].emplace_back(iSTS, FLT_MAX);
2845 if (shared_fraction > maxCPEnergyInTS) {
2847 maxCPEnergyInTS = CPEnergyInTS[cpId];
2852 hitsToCaloParticleId[iHit] = maxCPId;
2859 for (
auto c : hitsToCaloParticleId) {
2861 numberOfNoiseHitsInTS++;
2863 occurrencesCPinTS[
c]++;
2868 for (
auto&
c : occurrencesCPinTS) {
2869 if (
c.second > maxCPNumberOfHitsInTS) {
2870 maxCPId_byNumberOfHits =
c.first;
2871 maxCPNumberOfHitsInTS =
c.second;
2876 for (
auto&
c : CPEnergyInTS) {
2877 if (
c.second > maxEnergySharedTSandCP) {
2878 maxCPId_byEnergy =
c.first;
2879 maxEnergySharedTSandCP =
c.second;
2883 float totalCPEnergyFromLayerCP = 0.f;
2884 if (maxCPId_byEnergy >= 0) {
2885 totalCPEnergyFromLayerCP += cPOnLayer[maxCPId_byEnergy].energy;
2886 energyFractionOfCPinTS = maxEnergySharedTSandCP / totalCPEnergyFromLayerCP;
2887 if (tst.raw_energy() > 0.f) {
2888 energyFractionOfTSinCP = maxEnergySharedTSandCP / tst.raw_energy();
2892 LogDebug(
"HGCalValidator") << std::setw(12) <<
"Trackster\t" << std::setw(10) <<
"energy\t" << std::setw(5)
2893 <<
"nhits\t" << std::setw(12) <<
"noise hits\t" << std::setw(22)
2894 <<
"maxCPId_byNumberOfHits\t" << std::setw(8) <<
"nhitsCP\t" << std::setw(16)
2895 <<
"maxCPId_byEnergy\t" << std::setw(23) <<
"maxEnergySharedTSandCP\t" << std::setw(22)
2896 <<
"totalCPEnergyFromAllLayerCP\t" << std::setw(22) <<
"energyFractionOfTSinCP\t" 2897 << std::setw(25) <<
"energyFractionOfCPinTS\t" << std::endl;
2898 LogDebug(
"HGCalValidator") << std::setw(12) << tstId <<
"\t" 2899 << std::setw(10) << tst.raw_energy() <<
"\t" << std::setw(5) << numberOfHitsInTS <<
"\t" 2900 << std::setw(12) << numberOfNoiseHitsInTS <<
"\t" << std::setw(22)
2901 << maxCPId_byNumberOfHits <<
"\t" << std::setw(8) << maxCPNumberOfHitsInTS <<
"\t" 2902 << std::setw(16) << maxCPId_byEnergy <<
"\t" << std::setw(23) << maxEnergySharedTSandCP
2903 <<
"\t" << std::setw(22) << totalCPEnergyFromLayerCP <<
"\t" << std::setw(22)
2904 << energyFractionOfTSinCP <<
"\t" << std::setw(25) << energyFractionOfCPinTS
2910 for (
unsigned int tstId = 0; tstId < nTracksters; ++tstId) {
2911 const auto& tst = tracksters[tstId];
2912 if (tst.vertices().empty())
2917 std::sort(stsInTrackster[tstId].begin(), stsInTrackster[tstId].
end());
2918 const auto last =
std::unique(stsInTrackster[tstId].begin(), stsInTrackster[tstId].
end());
2919 stsInTrackster[tstId].erase(
last, stsInTrackster[tstId].
end());
2921 if (tst.raw_energy() == 0. && !stsInTrackster[tstId].empty()) {
2923 for (
auto& stsPair : stsInTrackster[tstId]) {
2925 stsPair.second = 1.;
2926 LogDebug(
"HGCalValidator") <<
"Trackster Id:\t" << tstId <<
"\tSimTrackster id:\t" << stsPair.first
2927 <<
"\tscore\t" << stsPair.second << std::endl;
2928 histograms.h_score_trackster2caloparticle[valType][
count]->Fill(stsPair.second);
2933 const auto tst_hitsAndFractions = apply_LCMultiplicity(tst,
layerClusters);
2936 float tracksterEnergy = 0.f, invTracksterEnergyWeight = 0.f;
2937 for (
const auto& haf : tst_hitsAndFractions) {
2942 const auto lcId = getLCId(tst.vertices(),
layerClusters, haf.first);
2943 const auto iLC =
std::find(tst.vertices().begin(), tst.vertices().end(), lcId);
2944 hitFr = 1.f / tst.vertex_multiplicity(
std::distance(std::begin(tst.vertices()), iLC));
2946 tracksterEnergy += hitFr * hitMap.at(haf.first)->energy();
2947 invTracksterEnergyWeight +=
pow(hitFr * hitMap.at(haf.first)->energy(), 2);
2949 if (invTracksterEnergyWeight)
2950 invTracksterEnergyWeight = 1.f / invTracksterEnergyWeight;
2952 for (
const auto& haf : tst_hitsAndFractions) {
2953 const auto rh_detid = haf.first;
2954 unsigned int elemId = 0;
2955 float rhFraction = 0.f;
2957 elemId = rh_detid.rawId();
2958 rhFraction = haf.second;
2960 const auto lcId = getLCId(tst.vertices(),
layerClusters, rh_detid);
2962 const auto iLC =
std::find(tst.vertices().begin(), tst.vertices().end(), lcId);
2963 rhFraction = 1.f / tst.vertex_multiplicity(
std::distance(std::begin(tst.vertices()), iLC));
2966 bool hitWithNoSTS =
false;
2967 if (detIdSimTSId_Map.find(elemId) == detIdSimTSId_Map.end())
2968 hitWithNoSTS =
true;
2970 const auto hitEnergyWeight =
pow(
hit->energy(), 2);
2972 for (
auto& stsPair : stsInTrackster[tstId]) {
2973 float cpFraction = 0.f;
2974 if (!hitWithNoSTS) {
2976 detIdSimTSId_Map[elemId].begin(),
2977 detIdSimTSId_Map[elemId].
end(),
2979 stsPair.first, 0.f});
2980 if (findSTSIt != detIdSimTSId_Map[elemId].
end())
2981 cpFraction = findSTSIt->fraction;
2983 if (stsPair.second == FLT_MAX) {
2984 stsPair.second = 0.f;
2987 min(
pow(rhFraction - cpFraction, 2),
pow(rhFraction, 2)) * hitEnergyWeight * invTracksterEnergyWeight;
2992 if (stsInTrackster[tstId].
empty())
2993 LogDebug(
"HGCalValidator") <<
"Trackster Id: " << tstId <<
"\tSimTrackster id: -1" 2996 tracksters_FakeMerge[tstId] =
2997 std::count_if(std::begin(stsInTrackster[tstId]),
2998 std::end(stsInTrackster[tstId]),
2999 [ScoreCutTStoSTSFakeMerge](
const auto&
obj) {
return obj.second < ScoreCutTStoSTSFakeMerge; });
3001 const auto score = std::min_element(std::begin(stsInTrackster[tstId]),
3002 std::end(stsInTrackster[tstId]),
3003 [](
const auto& obj1,
const auto& obj2) {
return obj1.second < obj2.second; });
3005 float sharedEneFrac2 = 0;
3006 for (
const auto& stsPair : stsInTrackster[tstId]) {
3007 const auto iSTS = stsPair.first;
3008 const auto iScore = stsPair.second;
3009 const auto cpId = getCPId(simTSs[iSTS], iSTS, cPHandle_id, cpToSc_SimTrackstersMap, simTSs_fromCP);
3010 auto iSim = simTSs[iSTS].seedIndex();
3011 if (simTSs[iSTS].seedID() == cPHandle_id)
3013 const auto& simOnLayer = (valType == 0) ? cPOnLayer[cpId] : sCOnLayer[cpId][iSim];
3015 float sharedeneCPallLayers = 0.;
3016 sharedeneCPallLayers += simOnLayer.layerClusterIdToEnergyAndScore.count(tstId)
3017 ? simOnLayer.layerClusterIdToEnergyAndScore.at(tstId).first
3019 if (tracksterEnergy == 0)
3021 const auto sharedEneFrac = sharedeneCPallLayers / tracksterEnergy;
3022 LogDebug(
"HGCalValidator") <<
"\nTrackster id: " << tstId <<
" (" << tst.vertices().size() <<
" vertices)" 3023 <<
"\tSimTrackster Id: " << iSTS <<
" (" << simTSs[iSTS].vertices().size()
3025 <<
" (CP id: " << cpId <<
")\tscore: " << iScore
3026 <<
"\tsharedeneCPallLayers: " << sharedeneCPallLayers << std::endl;
3028 histograms.h_score_trackster2caloparticle[valType][
count]->Fill(iScore);
3029 histograms.h_sharedenergy_trackster2caloparticle[valType][
count]->Fill(sharedEneFrac);
3030 histograms.h_energy_vs_score_trackster2caloparticle[valType][
count]->Fill(iScore, sharedEneFrac);
3031 if (iSTS ==
score->first) {
3032 histograms.h_score_trackster2bestCaloparticle[valType][
count]->Fill(iScore);
3033 histograms.h_sharedenergy_trackster2bestCaloparticle[valType][
count]->Fill(sharedEneFrac);
3034 histograms.h_sharedenergy_trackster2bestCaloparticle_vs_eta[valType][
count]->Fill(tst.barycenter().eta(),
3036 histograms.h_sharedenergy_trackster2bestCaloparticle_vs_phi[valType][
count]->Fill(tst.barycenter().phi(),
3038 histograms.h_energy_vs_score_trackster2bestCaloparticle[valType][
count]->Fill(iScore, sharedEneFrac);
3039 }
else if (score2 < 0 || iScore < score2) {
3041 sharedEneFrac2 = sharedEneFrac;
3045 histograms.h_score_trackster2bestCaloparticle2[valType][
count]->Fill(score2);
3046 histograms.h_sharedenergy_trackster2bestCaloparticle2[valType][
count]->Fill(sharedEneFrac2);
3047 histograms.h_energy_vs_score_trackster2bestCaloparticle2[valType][
count]->Fill(score2, sharedEneFrac2);
3051 std::unordered_map<unsigned int, std::vector<float>> score3d;
3052 std::unordered_map<unsigned int, std::vector<float>> tstSharedEnergy;
3054 for (
unsigned int iSTS = 0; iSTS < nSimTracksters; ++iSTS) {
3055 score3d[iSTS].resize(nTracksters);
3056 tstSharedEnergy[iSTS].resize(nTracksters);
3057 for (
unsigned int j = 0;
j < nTracksters; ++
j) {
3058 score3d[iSTS][
j] = FLT_MAX;
3059 tstSharedEnergy[iSTS][
j] = 0.f;
3066 for (
unsigned int iSTS = 0; iSTS < nSimTracksters; ++iSTS) {
3067 const auto& sts = simTSs[iSTS];
3068 const auto& cpId = getCPId(sts, iSTS, cPHandle_id, cpToSc_SimTrackstersMap, simTSs_fromCP);
3069 if (valType == 0 &&
std::find(cPSelectedIndices.begin(), cPSelectedIndices.end(), cpId) == cPSelectedIndices.end())
3072 const auto& hafLC = apply_LCMultiplicity(sts,
layerClusters);
3073 float SimEnergy_LC = 0.f;
3074 for (
const auto& haf : hafLC) {
3075 const auto lcId = getLCId(sts.vertices(),
layerClusters, haf.first);
3076 const auto iLC =
std::find(sts.vertices().begin(), sts.vertices().end(), lcId);
3078 hitMap.at(haf.first)->energy() / sts.vertex_multiplicity(
std::distance(std::begin(sts.vertices()), iLC));
3081 auto iSim = sts.seedIndex();
3082 if (sts.seedID() == cPHandle_id)
3084 auto& simOnLayer = (valType == 0) ? cPOnLayer[cpId] : sCOnLayer[cpId][iSim];
3088 std::set<unsigned int> stsId_tstId_related;
3089 auto& score3d_iSTS = score3d[iSTS];
3091 float SimEnergy = 0.f;
3092 float SimEnergyWeight = 0.f, hitsEnergyWeight = 0.f;
3094 const auto SimNumberOfHits = simOnLayer.hits_and_fractions.size();
3095 if (SimNumberOfHits == 0)
3097 SimEnergy += simOnLayer.energy;
3098 int tstWithMaxEnergyInCP = -1;
3100 float maxEnergyTSperlayerinSim = 0.f;
3101 float SimEnergyFractionInTSperlayer = 0.f;
3103 for (
const auto& tst : simOnLayer.layerClusterIdToEnergyAndScore) {
3104 if (tst.second.first > maxEnergyTSperlayerinSim) {
3105 maxEnergyTSperlayerinSim = tst.second.first;
3106 tstWithMaxEnergyInCP = tst.first;
3109 if (SimEnergy > 0.
f)
3110 SimEnergyFractionInTSperlayer = maxEnergyTSperlayerinSim / SimEnergy;
3112 LogDebug(
"HGCalValidator") << std::setw(12) <<
"caloparticle\t" << std::setw(15) <<
"cp total energy\t" 3113 << std::setw(15) <<
"cpEnergyOnLayer\t" << std::setw(14) <<
"CPNhitsOnLayer\t" 3114 << std::setw(18) <<
"tstWithMaxEnergyInCP\t" << std::setw(15) <<
"maxEnergyTSinCP\t" 3115 << std::setw(20) <<
"CPEnergyFractionInTS" 3117 LogDebug(
"HGCalValidator") << std::setw(12) << cpId <<
"\t" << std::setw(15) << sts.raw_energy() <<
"\t" 3118 << std::setw(15) << SimEnergy <<
"\t" << std::setw(14) << SimNumberOfHits <<
"\t" 3119 << std::setw(18) << tstWithMaxEnergyInCP <<
"\t" << std::setw(15)
3120 << maxEnergyTSperlayerinSim <<
"\t" << std::setw(20) << SimEnergyFractionInTSperlayer
3123 for (
const auto& haf : ((valType == 0) ? simOnLayer.hits_and_fractions : hafLC)) {
3124 const auto& hitDetId = haf.first;
3129 SimEnergyWeight +=
pow(haf.second * hitMap.at(hitDetId)->energy(), 2);
3131 const auto lcId = getLCId(sts.vertices(),
layerClusters, hitDetId);
3132 float cpFraction = 0.f;
3134 cpFraction = haf.second;
3136 const auto iLC =
std::find(sts.vertices().begin(), sts.vertices().end(), lcId);
3137 cpFraction = 1.f / sts.vertex_multiplicity(
std::distance(std::begin(sts.vertices()), iLC));
3139 if (cpFraction == 0.
f)
3142 bool hitWithNoTS =
false;
3143 if (detIdToTracksterId_Map.find(hitDetId) == detIdToTracksterId_Map.end())
3146 const auto hitEnergyWeight =
pow(
hit->energy(), 2);
3147 hitsEnergyWeight +=
pow(cpFraction, 2) * hitEnergyWeight;
3149 for (
auto& tsPair : simOnLayer.layerClusterIdToEnergyAndScore) {
3150 const auto tstId = tsPair.first;
3151 stsId_tstId_related.insert(tstId);
3153 float tstFraction = 0.f;
3155 const auto findTSIt =
3156 std::find(detIdToTracksterId_Map[hitDetId].begin(),
3157 detIdToTracksterId_Map[hitDetId].
end(),
3160 if (findTSIt != detIdToTracksterId_Map[hitDetId].
end()) {
3162 tstFraction = findTSIt->fraction;
3165 tracksters[tstId].
vertices().begin(), tracksters[tstId].
vertices().
end(), findTSIt->clusterId);
3167 tstFraction = 1.f / tracksters[tstId].vertex_multiplicity(
3175 if (tsPair.second.second == FLT_MAX) {
3176 tsPair.second.second = 0.f;
3178 tsPair.second.second +=
min(
pow(tstFraction - cpFraction, 2),
pow(cpFraction, 2)) * hitEnergyWeight;
3180 LogDebug(
"HGCalValidator") <<
"\nTracksterId:\t" << tstId <<
"\tSimTracksterId:\t" << iSTS <<
"\tcpId:\t" 3181 << cpId <<
"\ttstfraction, cpfraction:\t" << tstFraction <<
", " << cpFraction
3182 <<
"\thitEnergyWeight:\t" << hitEnergyWeight <<
"\tadded delta:\t" 3183 <<
pow((tstFraction - cpFraction), 2) * hitEnergyWeight
3184 <<
"\tcurrent Sim-score numerator:\t" << tsPair.second.second
3185 <<
"\tshared Sim energy:\t" << tsPair.second.first <<
'\n';
3189 if (simOnLayer.layerClusterIdToEnergyAndScore.empty())
3190 LogDebug(
"HGCalValidator") <<
"CP Id:\t" << cpId <<
"\tTS id:\t-1" 3191 <<
" Sub score in \t -1\n";
3193 for (
const auto& tsPair : simOnLayer.layerClusterIdToEnergyAndScore) {
3194 const auto tstId = tsPair.first;
3196 if (score3d_iSTS[tstId] == FLT_MAX) {
3197 score3d_iSTS[tstId] = 0.f;
3199 score3d_iSTS[tstId] += tsPair.second.second;
3200 tstSharedEnergy[iSTS][tstId] += tsPair.second.first;
3204 const auto scoreDenom = (valType == 0) ? SimEnergyWeight : hitsEnergyWeight;
3205 const auto energyDenom = (valType == 0) ? SimEnergy : SimEnergy_LC;
3207 const auto sts_eta = sts.barycenter().eta();
3208 const auto sts_phi = sts.barycenter().phi();
3209 const auto sts_en = sts.raw_energy();
3210 const auto sts_pt = sts.raw_pt();
3221 bool sts_considered_efficient =
false;
3222 bool sts_considered_pure =
false;
3223 for (
const auto tstId : stsId_tstId_related) {
3225 score3d_iSTS[tstId] /= scoreDenom;
3226 const auto tstSharedEnergyFrac = tstSharedEnergy[iSTS][tstId] / energyDenom;
3227 LogDebug(
"HGCalValidator") <<
"STS id: " << iSTS <<
"\t(CP id: " << cpId <<
")\tTS id: " << tstId
3228 <<
"\nSimEnergy: " << energyDenom <<
"\tSimEnergyWeight: " << SimEnergyWeight
3229 <<
"\tTrackste energy: " << tracksters[tstId].raw_energy()
3230 <<
"\nscore: " << score3d_iSTS[tstId]
3231 <<
"\tshared energy: " << tstSharedEnergy[iSTS][tstId]
3232 <<
"\tshared energy fraction: " << tstSharedEnergyFrac <<
"\n";
3234 histograms.h_score_caloparticle2trackster[valType][
count]->Fill(score3d_iSTS[tstId]);
3235 histograms.h_sharedenergy_caloparticle2trackster[valType][
count]->Fill(tstSharedEnergyFrac);
3236 histograms.h_energy_vs_score_caloparticle2trackster[valType][
count]->Fill(score3d_iSTS[tstId],
3237 tstSharedEnergyFrac);
3240 sts_considered_efficient =
true;
3247 if (score3d_iSTS[tstId] < ScoreCutSTStoTSPurDup) {
3248 if (tracksters_PurityDuplicate[tstId] < 1)
3249 tracksters_PurityDuplicate[tstId]++;
3250 if (sts_considered_pure)
3251 tracksters_PurityDuplicate[tstId]++;
3252 sts_considered_pure =
true;
3256 const auto best = std::min_element(std::begin(score3d_iSTS), std::end(score3d_iSTS));
3257 if (best != score3d_iSTS.end()) {
3258 const auto bestTstId =
std::distance(std::begin(score3d_iSTS), best);
3259 const auto bestTstSharedEnergyFrac = tstSharedEnergy[iSTS][bestTstId] / energyDenom;
3260 histograms.h_scorePur_caloparticle2trackster[valType][
count]->Fill(*best);
3261 histograms.h_sharedenergy_caloparticle2trackster_assoc[valType][
count]->Fill(bestTstSharedEnergyFrac);
3262 histograms.h_sharedenergy_caloparticle2trackster_assoc_vs_eta[valType][
count]->Fill(sts_eta,
3263 bestTstSharedEnergyFrac);
3264 histograms.h_sharedenergy_caloparticle2trackster_assoc_vs_phi[valType][
count]->Fill(sts_phi,
3265 bestTstSharedEnergyFrac);
3266 histograms.h_energy_vs_score_caloparticle2bestTrackster[valType][
count]->Fill(*best, bestTstSharedEnergyFrac);
3267 LogDebug(
"HGCalValidator") <<
count <<
" " << sts_eta <<
" " << sts_phi <<
" " 3268 << tracksters[bestTstId].raw_energy() <<
" " << sts.raw_energy() <<
" " 3269 << bestTstSharedEnergyFrac <<
"\n";
3271 if (score3d_iSTS.size() > 1) {
3272 auto best2 = (best == score3d_iSTS.begin()) ?
std::next(best, 1) : score3d_iSTS.begin();
3273 for (
auto tstId = score3d_iSTS.begin(); tstId != score3d_iSTS.end() && tstId != best; tstId++)
3274 if (*tstId < *best2)
3276 const auto best2TstId =
std::distance(std::begin(score3d_iSTS), best2);
3277 const auto best2TstSharedEnergyFrac = tstSharedEnergy[iSTS][best2TstId] / energyDenom;
3278 histograms.h_scoreDupl_caloparticle2trackster[valType][
count]->Fill(*best2);
3279 histograms.h_sharedenergy_caloparticle2trackster_assoc2[valType][
count]->Fill(best2TstSharedEnergyFrac);
3280 histograms.h_energy_vs_score_caloparticle2bestTrackster2[valType][
count]->Fill(*best2,
3281 best2TstSharedEnergyFrac);
3289 for (
unsigned int tstId = 0; tstId < nTracksters; ++tstId) {
3290 const auto& tst = tracksters[tstId];
3291 if (tst.vertices().empty())
3293 const auto iTS_eta = tst.barycenter().eta();
3294 const auto iTS_phi = tst.barycenter().phi();
3295 const auto iTS_en = tst.raw_energy();
3296 const auto iTS_pt = tst.raw_pt();
3302 if (tracksters_PurityDuplicate[tstId] > 0) {
3308 if (tracksters_PurityDuplicate[tstId] > 1) {
3316 if (tracksters_FakeMerge[tstId] > 0) {
3322 if (tracksters_FakeMerge[tstId] > 1) {
3339 const std::map<
unsigned int, std::vector<unsigned int>>& cpToSc_SimTrackstersMap,
3340 std::vector<SimCluster>
const& sC,
3342 std::vector<CaloParticle>
const& cP,
3343 std::vector<size_t>
const& cPIndices,
3344 std::vector<size_t>
const& cPSelectedIndices,
3345 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap,
3346 unsigned int layers)
const {
3354 int totNContTstZp = 0;
3355 int totNContTstZm = 0;
3357 int totNNotContTstZp = 0;
3358 int totNNotContTstZm = 0;
3360 std::vector<bool> contTracksters;
3361 contTracksters.clear();
3364 std::unordered_map<unsigned int, std::vector<unsigned int>> multiplicity;
3366 std::unordered_map<unsigned int, std::vector<unsigned int>> multiplicity_vs_layer;
3373 const auto nTracksters = tracksters.size();
3375 for (
unsigned int tstId = 0; tstId < nTracksters; ++tstId) {
3376 const auto& tst = tracksters[tstId];
3377 if (tst.vertices().empty())
3380 if (tst.barycenter().z() < 0.)
3382 else if (tst.barycenter().z() > 0.)
3390 std::vector<int> tnLcInTstperlay(1000, 0);
3394 std::set<unsigned int> trackster_layers;
3396 bool tracksterInZplus =
false;
3397 bool tracksterInZminus =
false;
3400 for (
const auto lcId : tst.vertices()) {
3402 const auto& hits_and_fractions =
layerClusters[lcId].hitsAndFractions();
3405 multiplicity[tstId].emplace_back(hits_and_fractions.size());
3407 const auto firstHitDetId = hits_and_fractions[0].first;
3409 const auto layerid =
recHitTools_->getLayerWithOffset(firstHitDetId) +
3411 trackster_layers.insert(layerid);
3412 multiplicity_vs_layer[tstId].emplace_back(layerid);
3414 tnLcInTstperlay[layerid]++;
3418 tracksterInZplus =
true;
3420 tracksterInZminus =
true;
3424 for (
unsigned ilayer = 0; ilayer <
layers * 2; ++ilayer) {
3425 if (
histograms.h_clusternum_in_trackster_perlayer[
count].count(ilayer) && tnLcInTstperlay[ilayer] != 0) {
3426 histograms.h_clusternum_in_trackster_perlayer[
count].at(ilayer)->Fill((
float)tnLcInTstperlay[ilayer]);
3429 if (tnLcInTstperlay[ilayer] != 0) {
3430 histograms.h_clusternum_in_trackster_vs_layer[
count]->Fill((
float)ilayer, (
float)tnLcInTstperlay[ilayer]);
3435 std::vector<int> trackster_layers_vec(trackster_layers.begin(), trackster_layers.end());
3437 bool contiTrackster =
false;
3439 if (trackster_layers_vec.size() >= 3) {
3440 for (
unsigned int iLayer = 1; iLayer < trackster_layers_vec.size() - 1; ++iLayer) {
3441 if ((trackster_layers_vec[iLayer - 1] + 1 == trackster_layers_vec[iLayer]) &&
3442 (trackster_layers_vec[iLayer + 1] - 1 == trackster_layers_vec[iLayer])) {
3444 if (tracksterInZplus)
3446 else if (tracksterInZminus)
3449 contiTrackster =
true;
3455 if (!contiTrackster) {
3456 if (tracksterInZplus)
3458 else if (tracksterInZminus)
3463 contTracksters.push_back(contiTrackster);
3467 for (
unsigned int lc = 0; lc < multiplicity[tstId].size(); ++lc) {
3469 float mlp =
std::count(std::begin(multiplicity[tstId]), std::end(multiplicity[tstId]), multiplicity[tstId][lc]);
3472 histograms.h_multiplicityOfLCinTST[
count]->Fill(mlp, multiplicity[tstId][lc]);
3478 if (multiplicity_vs_layer[tstId][lc] <
layers) {
3479 histograms.h_multiplicityOfLCinTST_vs_layercluster_zminus[
count]->Fill(mlp, multiplicity_vs_layer[tstId][lc]);
3480 histograms.h_multiplicity_zminus_numberOfEventsHistogram[
count]->Fill(mlp);
3482 histograms.h_multiplicityOfLCinTST_vs_layercluster_zplus[
count]->Fill(
3483 mlp, multiplicity_vs_layer[tstId][lc] -
layers);
3484 histograms.h_multiplicity_zplus_numberOfEventsHistogram[
count]->Fill(mlp);
3487 histograms.h_multiplicityOfLCinTST_vs_layerclusterenergy[
count]->Fill(mlp,
3491 if (!trackster_layers.empty()) {
3498 histograms.h_trackster_firstlayer[
count]->Fill((
float)*trackster_layers.begin());
3499 histograms.h_trackster_lastlayer[
count]->Fill((
float)*trackster_layers.rbegin());
3500 histograms.h_trackster_layersnum[
count]->Fill((
float)trackster_layers.size());
3509 histograms.h_conttracksternum[
count]->Fill(totNContTstZp + totNContTstZm);
3510 histograms.h_nonconttracksternum[
count]->Fill(totNNotContTstZp + totNNotContTstZm);
3520 cpToSc_SimTrackstersMap,
3537 cpToSc_SimTrackstersMap,
3550 const double y2)
const {
3551 const double dx =
x1 -
x2;
3552 const double dy =
y1 -
y2;
3558 const double y2)
const {
3567 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap)
const {
3572 for (
std::vector<std::pair<DetId, float>>::const_iterator it_haf = hits_and_fractions.begin();
3573 it_haf != hits_and_fractions.end();
3575 const DetId rh_detid = it_haf->first;
3576 const auto hitEn = hitMap.find(rh_detid)->second->energy();
3578 if (maxene < hitEn) {
3580 themaxid = rh_detid;
const std::vector< SimTrack > & g4Tracks() const
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
double minTSTSharedEneFracEfficiency_
const double ScoreCutSCtoLC_
double maxMixedHitsSimCluster_
double minDisToSeedperthickperlayerenewei_
const SimClusterRefVector & simClusters() const
double maxTotNsimClsperlay_
void bookTracksterHistos(DQMStore::IBooker &ibook, Histograms &histograms, unsigned int layers)
int nintCellsEneDensperthick_
int nintClEneperthickperlayer_
void setRecHitTools(std::shared_ptr< hgcal::RecHitTools > recHitTools)
double maxTotNClsinTSTsperlayer_
const double ScoreCutLCtoSC_
void fill_info_histos(const Histograms &histograms, unsigned int layers) const
int nintDisToMaxperthickperlayerenewei_
void bookClusterHistos_LCtoCP_association(DQMStore::IBooker &ibook, Histograms &histograms, unsigned int layers)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
constexpr Detector det() const
get the detector field from this detid
int nintDisToMaxperthickperlayer_
const_iterator find(const key_type &k) const
find element with specified reference key
void bookInfo(DQMStore::IBooker &ibook, Histograms &histograms)
static std::string to_string(const XMLCh *ch)
const_iterator end() const
last iterator over the map (read only)
float energy() const
Energy. Note this is taken from the first SimTrack only.
void bookSimClusterAssociationHistos(DQMStore::IBooker &ibook, Histograms &histograms, unsigned int layers, std::vector< int > thicknesses)
DetId findmaxhit(const reco::CaloCluster &cluster, std::unordered_map< DetId, const HGCRecHit *> const &) const
void fill_caloparticle_histos(const Histograms &histograms, int pdgid, const CaloParticle &caloparticle, std::vector< SimVertex > const &simVertices, unsigned int layers, std::unordered_map< DetId, const HGCRecHit *> const &) const
void bookSimClusterHistos(DQMStore::IBooker &ibook, Histograms &histograms, unsigned int layers, std::vector< int > thicknesses)
void fill_cluster_histos(const Histograms &histograms, const int count, const reco::CaloCluster &cluster) const
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
double minClEnepermultiplicity_
float pt() const
Transverse momentum. Note this is taken from the first SimTrack only.
def unique(seq, keepstr=True)
double maxMixedHitsCluster_
double minTotNsimClsperlay_
double minDisSeedToMaxperthickperlayer_
double distance2(const double x1, const double y1, const double x2, const double y2) const
int nintDisToSeedperthickperlayerenewei_
void layerClusters_to_SimClusters(const Histograms &histograms, const int count, edm::Handle< reco::CaloClusterCollection > clusterHandle, const reco::CaloClusterCollection &clusters, edm::Handle< std::vector< SimCluster >> simClusterHandle, std::vector< SimCluster > const &simClusters, std::vector< size_t > const &sCIndices, const std::vector< float > &mask, std::unordered_map< DetId, const HGCRecHit *> const &, unsigned int layers, const hgcal::RecoToSimCollectionWithSimClusters &recSimColl, const hgcal::SimToRecoCollectionWithSimClusters &simRecColl) const
double minTSTSharedEneFrac_
std::vector< CaloCluster > CaloClusterCollection
collection of CaloCluster objects
double minDisToMaxperthickperlayer_
void bookCaloParticleHistos(DQMStore::IBooker &ibook, Histograms &histograms, int pdgid, unsigned int layers)
int nintTotNClsinTSTsperlayer_
void bookTracksterSTSHistos(DQMStore::IBooker &ibook, Histograms &histograms, const validationType valType)
const double ScoreCutTStoSTSFakeMerge_[]
double maxDisToMaxperthickperlayer_
const double ScoreCutLCtoCP_
double maxDisToSeedperthickperlayer_
float phi() const
Momentum azimuthal angle. Note this is taken from the first SimTrack only.
void fill_generic_cluster_histos(const Histograms &histograms, const int count, edm::Handle< reco::CaloClusterCollection > clusterHandle, const reco::CaloClusterCollection &clusters, const Density &densities, edm::Handle< std::vector< CaloParticle >> caloParticleHandle, std::vector< CaloParticle > const &cP, std::vector< size_t > const &cPIndices, std::vector< size_t > const &cPSelectedIndices, std::unordered_map< DetId, const HGCRecHit *> const &, std::map< double, double > cummatbudg, unsigned int layers, std::vector< int > thicknesses, const hgcal::RecoToSimCollection &recSimColl, const hgcal::SimToRecoCollection &simRecColl) const
double getEta(double eta) const
std::vector< unsigned int > & vertices()
double maxTotNcellsperthickperlayer_
double maxDisSeedToMaxperthickperlayer_
double minDisToSeedperthickperlayer_
size_type size() const
Size of the RefVector.
void fill_trackster_histos(const Histograms &histograms, const int count, const ticl::TracksterCollection &Tracksters, const reco::CaloClusterCollection &layerClusters, const ticl::TracksterCollection &simTS, const ticl::TracksterCollection &simTS_fromCP, std::map< uint, std::vector< uint >> const &simTrackstersMap, std::vector< SimCluster > const &sC, const edm::ProductID &cPHandle_id, std::vector< CaloParticle > const &cP, std::vector< size_t > const &cPIndices, std::vector< size_t > const &cPSelectedIndices, std::unordered_map< DetId, const HGCRecHit *> const &, unsigned int layers) const
const edm::ProductID & seedID() const
double minTotNClsinTSTsperlayer_
double maxDisToSeedperthickperlayerenewei_
std::shared_ptr< hgcal::RecHitTools > recHitTools_
constexpr uint32_t rawId() const
get the raw id
double maxTotNsimClsperthick_
std::vector< float > & vertex_multiplicity()
double minTotNClsperthick_
void tracksters_to_SimTracksters(const Histograms &histograms, const int count, const ticl::TracksterCollection &Tracksters, const reco::CaloClusterCollection &layerClusters, const ticl::TracksterCollection &simTS, const validationType valType, const ticl::TracksterCollection &simTS_fromCP, std::map< uint, std::vector< uint >> const &simTrackstersMap, std::vector< SimCluster > const &sC, const edm::ProductID &cPHandle_id, std::vector< CaloParticle > const &cP, std::vector< size_t > const &cPIndices, std::vector< size_t > const &cPSelectedIndices, std::unordered_map< DetId, const HGCRecHit *> const &, unsigned int layers) const
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
double minTotNsimClsperthick_
MonitorElement * bookInt(TString const &name, FUNC onbooking=NOOP())
const double ScoreCutSTStoTSPurDup_[]
void bookClusterHistos_ClusterLevel(DQMStore::IBooker &ibook, Histograms &histograms, unsigned int layers, std::vector< int > thicknesses, std::string pathtomatbudfile)
int nintTotNsimClsperlay_
int nintMixedHitsSimCluster_
int nintDisSeedToMaxperthickperlayer_
const int seedIndex() const
double minTotNcellsperthickperlayer_
double minClEneperthickperlayer_
static int position[264][3]
double minMixedHitsSimCluster_
double minDisToMaxperthickperlayerenewei_
int nintClEnepermultiplicity_
int nintTotNsimClsperthick_
std::vector< Trackster > TracksterCollection
double maxTotNClsperthick_
double maxClEnepermultiplicity_
double eta() const
pseudorapidity of cluster centroid
void bookClusterHistos_CellLevel(DQMStore::IBooker &ibook, Histograms &histograms, unsigned int layers, std::vector< int > thicknesses)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
void layerClusters_to_CaloParticles(const Histograms &histograms, edm::Handle< reco::CaloClusterCollection > clusterHandle, const reco::CaloClusterCollection &clusters, edm::Handle< std::vector< CaloParticle >> caloParticleHandle, std::vector< CaloParticle > const &cP, std::vector< size_t > const &cPIndices, std::vector< size_t > const &cPSelectedIndices, std::unordered_map< DetId, const HGCRecHit *> const &, unsigned int layers, const hgcal::RecoToSimCollection &recSimColl, const hgcal::SimToRecoCollection &simRecColl) const
double distance(const double x1, const double y1, const double x2, const double y2) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
double maxCellsEneDensperthick_
double maxDisToMaxperthickperlayerenewei_
hgcal_clustering::Density Density
const double ScoreCutCPtoLC_
int nintMixedHitsCluster_
double minMixedHitsCluster_
float eta() const
Momentum pseudorapidity. Note this is taken from the simtrack before the calorimeter.
double maxClEneperthickperlayer_
int nintDisToSeedperthickperlayer_
int nintTotNcellsperthickperlayer_
Power< A, B >::type pow(const A &a, const B &b)
HGVHistoProducerAlgo(const edm::ParameterSet &pset)
double maxTSTSharedEneFrac_
double minCellsEneDensperthick_