22 minEta_(
pset.getParameter<double>(
"minEta")),
23 maxEta_(
pset.getParameter<double>(
"maxEta")),
24 nintEta_(
pset.getParameter<
int>(
"nintEta")),
25 useFabsEta_(
pset.getParameter<
bool>(
"useFabsEta")),
28 minEne_(
pset.getParameter<double>(
"minEne")),
29 maxEne_(
pset.getParameter<double>(
"maxEne")),
30 nintEne_(
pset.getParameter<
int>(
"nintEne")),
33 minPt_(
pset.getParameter<double>(
"minPt")),
34 maxPt_(
pset.getParameter<double>(
"maxPt")),
35 nintPt_(
pset.getParameter<
int>(
"nintPt")),
38 minPhi_(
pset.getParameter<double>(
"minPhi")),
39 maxPhi_(
pset.getParameter<double>(
"maxPhi")),
40 nintPhi_(
pset.getParameter<
int>(
"nintPhi")),
43 minMixedHitsCluster_(
pset.getParameter<double>(
"minMixedHitsCluster")),
44 maxMixedHitsCluster_(
pset.getParameter<double>(
"maxMixedHitsCluster")),
45 nintMixedHitsCluster_(
pset.getParameter<
int>(
"nintMixedHitsCluster")),
48 minEneCl_(
pset.getParameter<double>(
"minEneCl")),
49 maxEneCl_(
pset.getParameter<double>(
"maxEneCl")),
50 nintEneCl_(
pset.getParameter<
int>(
"nintEneCl")),
53 minLongDepBary_(
pset.getParameter<double>(
"minLongDepBary")),
54 maxLongDepBary_(
pset.getParameter<double>(
"maxLongDepBary")),
55 nintLongDepBary_(
pset.getParameter<
int>(
"nintLongDepBary")),
58 minZpos_(
pset.getParameter<double>(
"minZpos")),
59 maxZpos_(
pset.getParameter<double>(
"maxZpos")),
60 nintZpos_(
pset.getParameter<
int>(
"nintZpos")),
63 minTotNClsperlay_(
pset.getParameter<double>(
"minTotNClsperlay")),
64 maxTotNClsperlay_(
pset.getParameter<double>(
"maxTotNClsperlay")),
65 nintTotNClsperlay_(
pset.getParameter<
int>(
"nintTotNClsperlay")),
68 minEneClperlay_(
pset.getParameter<double>(
"minEneClperlay")),
69 maxEneClperlay_(
pset.getParameter<double>(
"maxEneClperlay")),
70 nintEneClperlay_(
pset.getParameter<
int>(
"nintEneClperlay")),
75 minScore_(
pset.getParameter<double>(
"minScore")),
76 maxScore_(
pset.getParameter<double>(
"maxScore")),
77 nintScore_(
pset.getParameter<
int>(
"nintScore")),
84 minSharedEneFrac_(
pset.getParameter<double>(
"minSharedEneFrac")),
85 maxSharedEneFrac_(
pset.getParameter<double>(
"maxSharedEneFrac")),
86 nintSharedEneFrac_(
pset.getParameter<
int>(
"nintSharedEneFrac")),
89 minMCLSharedEneFrac_(
pset.getParameter<double>(
"minMCLSharedEneFrac")),
90 maxMCLSharedEneFrac_(
pset.getParameter<double>(
"maxMCLSharedEneFrac")),
91 nintMCLSharedEneFrac_(
pset.getParameter<
int>(
"nintMCLSharedEneFrac")),
94 minTotNClsperthick_(
pset.getParameter<double>(
"minTotNClsperthick")),
95 maxTotNClsperthick_(
pset.getParameter<double>(
"maxTotNClsperthick")),
96 nintTotNClsperthick_(
pset.getParameter<
int>(
"nintTotNClsperthick")),
99 minTotNcellsperthickperlayer_(
pset.getParameter<double>(
"minTotNcellsperthickperlayer")),
100 maxTotNcellsperthickperlayer_(
pset.getParameter<double>(
"maxTotNcellsperthickperlayer")),
101 nintTotNcellsperthickperlayer_(
pset.getParameter<
int>(
"nintTotNcellsperthickperlayer")),
104 minDisToSeedperthickperlayer_(
pset.getParameter<double>(
"minDisToSeedperthickperlayer")),
105 maxDisToSeedperthickperlayer_(
pset.getParameter<double>(
"maxDisToSeedperthickperlayer")),
106 nintDisToSeedperthickperlayer_(
pset.getParameter<
int>(
"nintDisToSeedperthickperlayer")),
109 minDisToSeedperthickperlayerenewei_(
pset.getParameter<double>(
"minDisToSeedperthickperlayerenewei")),
110 maxDisToSeedperthickperlayerenewei_(
pset.getParameter<double>(
"maxDisToSeedperthickperlayerenewei")),
111 nintDisToSeedperthickperlayerenewei_(
pset.getParameter<
int>(
"nintDisToSeedperthickperlayerenewei")),
114 minDisToMaxperthickperlayer_(
pset.getParameter<double>(
"minDisToMaxperthickperlayer")),
115 maxDisToMaxperthickperlayer_(
pset.getParameter<double>(
"maxDisToMaxperthickperlayer")),
116 nintDisToMaxperthickperlayer_(
pset.getParameter<
int>(
"nintDisToMaxperthickperlayer")),
119 minDisToMaxperthickperlayerenewei_(
pset.getParameter<double>(
"minDisToMaxperthickperlayerenewei")),
120 maxDisToMaxperthickperlayerenewei_(
pset.getParameter<double>(
"maxDisToMaxperthickperlayerenewei")),
121 nintDisToMaxperthickperlayerenewei_(
pset.getParameter<
int>(
"nintDisToMaxperthickperlayerenewei")),
124 minDisSeedToMaxperthickperlayer_(
pset.getParameter<double>(
"minDisSeedToMaxperthickperlayer")),
125 maxDisSeedToMaxperthickperlayer_(
pset.getParameter<double>(
"maxDisSeedToMaxperthickperlayer")),
126 nintDisSeedToMaxperthickperlayer_(
pset.getParameter<
int>(
"nintDisSeedToMaxperthickperlayer")),
129 minClEneperthickperlayer_(
pset.getParameter<double>(
"minClEneperthickperlayer")),
130 maxClEneperthickperlayer_(
pset.getParameter<double>(
"maxClEneperthickperlayer")),
131 nintClEneperthickperlayer_(
pset.getParameter<
int>(
"nintClEneperthickperlayer")),
134 minCellsEneDensperthick_(
pset.getParameter<double>(
"minCellsEneDensperthick")),
135 maxCellsEneDensperthick_(
pset.getParameter<double>(
"maxCellsEneDensperthick")),
136 nintCellsEneDensperthick_(
pset.getParameter<
int>(
"nintCellsEneDensperthick")),
140 minTotNMCLs_(
pset.getParameter<double>(
"minTotNMCLs")),
141 maxTotNMCLs_(
pset.getParameter<double>(
"maxTotNMCLs")),
142 nintTotNMCLs_(
pset.getParameter<
int>(
"nintTotNMCLs")),
145 minTotNClsinMCLs_(
pset.getParameter<double>(
"minTotNClsinMCLs")),
146 maxTotNClsinMCLs_(
pset.getParameter<double>(
"maxTotNClsinMCLs")),
147 nintTotNClsinMCLs_(
pset.getParameter<
int>(
"nintTotNClsinMCLs")),
150 minTotNClsinMCLsperlayer_(
pset.getParameter<double>(
"minTotNClsinMCLsperlayer")),
151 maxTotNClsinMCLsperlayer_(
pset.getParameter<double>(
"maxTotNClsinMCLsperlayer")),
152 nintTotNClsinMCLsperlayer_(
pset.getParameter<
int>(
"nintTotNClsinMCLsperlayer")),
155 minMplofLCs_(
pset.getParameter<double>(
"minMplofLCs")),
156 maxMplofLCs_(
pset.getParameter<double>(
"maxMplofLCs")),
157 nintMplofLCs_(
pset.getParameter<
int>(
"nintMplofLCs")),
160 minSizeCLsinMCLs_(
pset.getParameter<double>(
"minSizeCLsinMCLs")),
161 maxSizeCLsinMCLs_(
pset.getParameter<double>(
"maxSizeCLsinMCLs")),
162 nintSizeCLsinMCLs_(
pset.getParameter<
int>(
"nintSizeCLsinMCLs")),
165 minClEnepermultiplicity_(
pset.getParameter<double>(
"minClEnepermultiplicity")),
166 maxClEnepermultiplicity_(
pset.getParameter<double>(
"maxClEnepermultiplicity")),
167 nintClEnepermultiplicity_(
pset.getParameter<
int>(
"nintClEnepermultiplicity")),
170 minX_(
pset.getParameter<double>(
"minX")),
171 maxX_(
pset.getParameter<double>(
"maxX")),
172 nintX_(
pset.getParameter<
int>(
"nintX")),
175 minY_(
pset.getParameter<double>(
"minY")),
176 maxY_(
pset.getParameter<double>(
"maxY")),
177 nintY_(
pset.getParameter<
int>(
"nintY")),
180 minZ_(
pset.getParameter<double>(
"minZ")),
181 maxZ_(
pset.getParameter<double>(
"maxZ")),
182 nintZ_(
pset.getParameter<
int>(
"nintZ")) {}
211 std::vector<int> thicknesses,
219 histograms.h_mixedhitscluster_zminus.push_back(
220 ibook.
book1D(
"mixedhitscluster_zminus",
221 "N of reco clusters that contain hits of more than one kind in z-",
226 histograms.h_mixedhitscluster_zplus.push_back(
227 ibook.
book1D(
"mixedhitscluster_zplus",
228 "N of reco clusters that contain hits of more than one kind in z+",
235 histograms.h_energyclustered_zminus.push_back(
236 ibook.
book1D(
"energyclustered_zminus",
237 "percent of total energy clustered by all layer clusters over caloparticles energy in z-",
243 ibook.
book1D(
"energyclustered_zplus",
244 "percent of total energy clustered by all layer clusters over caloparticles energy in z+",
251 std::string subpathtomat = pathtomatbudfile.substr(pathtomatbudfile.find(
"Validation"));
252 histograms.h_longdepthbarycentre_zminus.push_back(
253 ibook.
book1D(
"longdepthbarycentre_zminus",
254 "The longitudinal depth barycentre in z- for " + subpathtomat,
259 histograms.h_longdepthbarycentre_zplus.push_back(
260 ibook.
book1D(
"longdepthbarycentre_zplus",
261 "The longitudinal depth barycentre in z+ for " + subpathtomat,
267 for (
unsigned ilayer = 0; ilayer < 2 *
layers; ++ilayer) {
268 auto istr1 = std::to_string(ilayer);
269 while (istr1.size() < 2) {
270 istr1.insert(0,
"0");
276 istr2 = std::to_string(ilayer + 1) +
" in z-";
278 istr2 = std::to_string(ilayer - (
layers - 1)) +
" in z+";
280 histograms.h_clusternum_perlayer[ilayer] = ibook.
book1D(
"totclusternum_layer_" + istr1,
281 "total number of layer clusters for layer " + istr2,
285 histograms.h_energyclustered_perlayer[ilayer] =
286 ibook.
book1D(
"energyclustered_perlayer" + istr1,
287 "percent of total energy clustered by layer clusters over caloparticles energy for layer " + istr2,
291 histograms.h_score_layercl2caloparticle_perlayer[ilayer] =
292 ibook.
book1D(
"Score_layercl2caloparticle_perlayer" + istr1,
293 "Score of Layer Cluster per CaloParticle for layer " + istr2,
297 histograms.h_score_caloparticle2layercl_perlayer[ilayer] =
298 ibook.
book1D(
"Score_caloparticle2layercl_perlayer" + istr1,
299 "Score of CaloParticle per Layer Cluster for layer " + istr2,
303 histograms.h_energy_vs_score_caloparticle2layercl_perlayer[ilayer] =
304 ibook.
book2D(
"Energy_vs_Score_caloparticle2layer_perlayer" + istr1,
305 "Energy vs Score of CaloParticle per Layer Cluster for layer " + istr2,
312 histograms.h_energy_vs_score_layercl2caloparticle_perlayer[ilayer] =
313 ibook.
book2D(
"Energy_vs_Score_layer2caloparticle_perlayer" + istr1,
314 "Energy vs Score of Layer Cluster per CaloParticle Layer for layer " + istr2,
321 histograms.h_sharedenergy_caloparticle2layercl_perlayer[ilayer] =
322 ibook.
book1D(
"SharedEnergy_caloparticle2layercl_perlayer" + istr1,
323 "Shared Energy of CaloParticle per Layer Cluster for layer " + istr2,
327 histograms.h_sharedenergy_caloparticle2layercl_vs_eta_perlayer[ilayer] =
328 ibook.
bookProfile(
"SharedEnergy_caloparticle2layercl_vs_eta_perlayer" + istr1,
329 "Shared Energy of CaloParticle vs #eta per best Layer Cluster for layer " + istr2,
335 histograms.h_sharedenergy_caloparticle2layercl_vs_phi_perlayer[ilayer] =
336 ibook.
bookProfile(
"SharedEnergy_caloparticle2layercl_vs_phi_perlayer" + istr1,
337 "Shared Energy of CaloParticle vs #phi per best Layer Cluster for layer " + istr2,
343 histograms.h_sharedenergy_layercl2caloparticle_perlayer[ilayer] =
344 ibook.
book1D(
"SharedEnergy_layercluster2caloparticle_perlayer" + istr1,
345 "Shared Energy of Layer Cluster per Layer Calo Particle for layer " + istr2,
349 histograms.h_sharedenergy_layercl2caloparticle_vs_eta_perlayer[ilayer] =
350 ibook.
bookProfile(
"SharedEnergy_layercl2caloparticle_vs_eta_perlayer" + istr1,
351 "Shared Energy of LayerCluster vs #eta per best Calo Particle for layer " + istr2,
357 histograms.h_sharedenergy_layercl2caloparticle_vs_phi_perlayer[ilayer] =
358 ibook.
bookProfile(
"SharedEnergy_layercl2caloparticle_vs_phi_perlayer" + istr1,
359 "Shared Energy of LayerCluster vs #phi per best Calo Particle for layer " + istr2,
365 histograms.h_num_caloparticle_eta_perlayer[ilayer] =
366 ibook.
book1D(
"Num_CaloParticle_Eta_perlayer" + istr1,
367 "Num CaloParticle Eta per Layer Cluster for layer " + istr2,
371 histograms.h_numDup_caloparticle_eta_perlayer[ilayer] =
372 ibook.
book1D(
"NumDup_CaloParticle_Eta_perlayer" + istr1,
373 "Num Duplicate CaloParticle Eta per Layer Cluster for layer " + istr2,
377 histograms.h_denom_caloparticle_eta_perlayer[ilayer] =
378 ibook.
book1D(
"Denom_CaloParticle_Eta_perlayer" + istr1,
379 "Denom CaloParticle Eta per Layer Cluster for layer " + istr2,
383 histograms.h_num_caloparticle_phi_perlayer[ilayer] =
384 ibook.
book1D(
"Num_CaloParticle_Phi_perlayer" + istr1,
385 "Num CaloParticle Phi per Layer Cluster for layer " + istr2,
389 histograms.h_numDup_caloparticle_phi_perlayer[ilayer] =
390 ibook.
book1D(
"NumDup_CaloParticle_Phi_perlayer" + istr1,
391 "Num Duplicate CaloParticle Phi per Layer Cluster for layer " + istr2,
395 histograms.h_denom_caloparticle_phi_perlayer[ilayer] =
396 ibook.
book1D(
"Denom_CaloParticle_Phi_perlayer" + istr1,
397 "Denom CaloParticle Phi per Layer Cluster for layer " + istr2,
401 histograms.h_num_layercl_eta_perlayer[ilayer] =
402 ibook.
book1D(
"Num_LayerCluster_Eta_perlayer" + istr1,
403 "Num LayerCluster Eta per Layer Cluster for layer " + istr2,
407 histograms.h_numMerge_layercl_eta_perlayer[ilayer] =
408 ibook.
book1D(
"NumMerge_LayerCluster_Eta_perlayer" + istr1,
409 "Num Merge LayerCluster Eta per Layer Cluster for layer " + istr2,
413 histograms.h_denom_layercl_eta_perlayer[ilayer] =
414 ibook.
book1D(
"Denom_LayerCluster_Eta_perlayer" + istr1,
415 "Denom LayerCluster Eta per Layer Cluster for layer " + istr2,
419 histograms.h_num_layercl_phi_perlayer[ilayer] =
420 ibook.
book1D(
"Num_LayerCluster_Phi_perlayer" + istr1,
421 "Num LayerCluster Phi per Layer Cluster for layer " + istr2,
425 histograms.h_numMerge_layercl_phi_perlayer[ilayer] =
426 ibook.
book1D(
"NumMerge_LayerCluster_Phi_perlayer" + istr1,
427 "Num Merge LayerCluster Phi per Layer Cluster for layer " + istr2,
431 histograms.h_denom_layercl_phi_perlayer[ilayer] =
432 ibook.
book1D(
"Denom_LayerCluster_Phi_perlayer" + istr1,
433 "Denom LayerCluster Phi per Layer Cluster for layer " + istr2,
437 histograms.h_cellAssociation_perlayer[ilayer] =
438 ibook.
book1D(
"cellAssociation_perlayer" + istr1,
"Cell Association for layer " + istr2, 5, -4., 1.);
439 histograms.h_cellAssociation_perlayer[ilayer]->setBinLabel(2,
"TN(purity)");
440 histograms.h_cellAssociation_perlayer[ilayer]->setBinLabel(3,
"FN(ineff.)");
441 histograms.h_cellAssociation_perlayer[ilayer]->setBinLabel(4,
"FP(fake)");
442 histograms.h_cellAssociation_perlayer[ilayer]->setBinLabel(5,
"TP(eff.)");
446 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
447 auto istr = std::to_string(*it);
448 histograms.h_clusternum_perthick[(*it)] = ibook.
book1D(
"totclusternum_thick_" + istr,
449 "total number of layer clusters for thickness " + istr,
454 histograms.h_cellsenedens_perthick[(*it)] = ibook.
book1D(
"cellsenedens_thick_" + istr,
455 "energy density of cluster cells for thickness " + istr,
463 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
464 for (
unsigned ilayer = 0; ilayer < 2 *
layers; ++ilayer) {
465 auto istr1 = std::to_string(*it);
466 auto istr2 = std::to_string(ilayer);
467 while (istr2.size() < 2)
468 istr2.insert(0,
"0");
469 auto istr = istr1 +
"_" + istr2;
474 istr3 = std::to_string(ilayer + 1) +
" in z- ";
476 istr3 = std::to_string(ilayer - (
layers - 1)) +
" in z+ ";
479 histograms.h_cellsnum_perthickperlayer[istr] =
480 ibook.
book1D(
"cellsnum_perthick_perlayer_" + istr,
481 "total number of cells for layer " + istr3 +
" for thickness " + istr1,
486 histograms.h_distancetoseedcell_perthickperlayer[istr] =
487 ibook.
book1D(
"distancetoseedcell_perthickperlayer_" + istr,
488 "distance of cluster cells to seed cell for layer " + istr3 +
" for thickness " + istr1,
493 histograms.h_distancetoseedcell_perthickperlayer_eneweighted[istr] = ibook.
book1D(
494 "distancetoseedcell_perthickperlayer_eneweighted_" + istr,
495 "energy weighted distance of cluster cells to seed cell for layer " + istr3 +
" for thickness " + istr1,
500 histograms.h_distancetomaxcell_perthickperlayer[istr] =
501 ibook.
book1D(
"distancetomaxcell_perthickperlayer_" + istr,
502 "distance of cluster cells to max cell for layer " + istr3 +
" for thickness " + istr1,
507 histograms.h_distancetomaxcell_perthickperlayer_eneweighted[istr] = ibook.
book1D(
508 "distancetomaxcell_perthickperlayer_eneweighted_" + istr,
509 "energy weighted distance of cluster cells to max cell for layer " + istr3 +
" for thickness " + istr1,
514 histograms.h_distancebetseedandmaxcell_perthickperlayer[istr] =
515 ibook.
book1D(
"distancebetseedandmaxcell_perthickperlayer_" + istr,
516 "distance of seed cell to max cell for layer " + istr3 +
" for thickness " + istr1,
521 histograms.h_distancebetseedandmaxcellvsclusterenergy_perthickperlayer[istr] = ibook.
book2D(
522 "distancebetseedandmaxcellvsclusterenergy_perthickperlayer_" + istr,
523 "distance of seed cell to max cell vs cluster energy for layer " + istr3 +
" for thickness " + istr1,
540 histograms.h_energy_vs_score_multicl2caloparticle.push_back(
541 ibook.
book2D(
"Energy_vs_Score_multi2caloparticle",
542 "Energy vs Score of Multi Cluster per CaloParticle",
549 histograms.h_energy_vs_score_caloparticle2multicl.push_back(
550 ibook.
book2D(
"Energy_vs_Score_caloparticle2multi",
551 "Energy vs Score of CaloParticle per Multi Cluster",
563 "NumMerge_MultiCluster_Eta",
"Num Merge MultiCluster Eta per Multi Cluster ",
nintEta_,
minEta_,
maxEta_));
569 "NumMerge_MultiCluster_Phi",
"Num Merge MultiCluster Phi per Multi Cluster",
nintPhi_,
minPhi_,
maxPhi_));
572 histograms.h_sharedenergy_multicl2caloparticle.push_back(
573 ibook.
book1D(
"SharedEnergy_multicluster2caloparticle",
574 "Shared Energy of Multi Cluster per Calo Particle in each layer",
578 histograms.h_sharedenergy_multicl2caloparticle_vs_eta.push_back(
579 ibook.
bookProfile(
"SharedEnergy_multicl2caloparticle_vs_eta",
580 "Shared Energy of MultiCluster vs #eta per best Calo Particle in each layer",
586 histograms.h_sharedenergy_multicl2caloparticle_vs_phi.push_back(
587 ibook.
bookProfile(
"SharedEnergy_multicl2caloparticle_vs_phi",
588 "Shared Energy of MultiCluster vs #phi per best Calo Particle in each layer",
594 histograms.h_sharedenergy_caloparticle2multicl.push_back(
595 ibook.
book1D(
"SharedEnergy_caloparticle2multicl",
596 "Shared Energy of CaloParticle per Multi Cluster",
600 histograms.h_sharedenergy_caloparticle2multicl_vs_eta.push_back(
601 ibook.
bookProfile(
"SharedEnergy_caloparticle2multicl_vs_eta",
602 "Shared Energy of CaloParticle vs #eta per best Multi Cluster",
608 histograms.h_sharedenergy_caloparticle2multicl_vs_phi.push_back(
609 ibook.
bookProfile(
"SharedEnergy_caloparticle2multicl_vs_phi",
610 "Shared Energy of CaloParticle vs #phi per best Multi Cluster",
620 histograms.h_denom_caloparticle_eta.push_back(
626 histograms.h_denom_caloparticle_phi.push_back(
629 std::unordered_map<int, dqm::reco::MonitorElement*> clusternum_in_multicluster_perlayer;
630 clusternum_in_multicluster_perlayer.clear();
632 for (
unsigned ilayer = 0; ilayer < 2 *
layers; ++ilayer) {
633 auto istr1 = std::to_string(ilayer);
634 while (istr1.size() < 2) {
635 istr1.insert(0,
"0");
641 istr2 = std::to_string(ilayer + 1) +
" in z-";
643 istr2 = std::to_string(ilayer - (
layers - 1)) +
" in z+";
646 clusternum_in_multicluster_perlayer[ilayer] =
647 ibook.
book1D(
"clusternum_in_multicluster_perlayer" + istr1,
648 "Number of layer clusters in multicluster for layer " + istr2,
654 histograms.h_clusternum_in_multicluster_perlayer.push_back(
std::move(clusternum_in_multicluster_perlayer));
659 histograms.h_contmulticlusternum.push_back(ibook.
book1D(
"contmulticlusternum",
660 "number of multiclusters with 3 contiguous layers",
665 histograms.h_noncontmulticlusternum.push_back(ibook.
book1D(
"noncontmulticlusternum",
666 "number of multiclusters without 3 contiguous layers",
671 histograms.h_clusternum_in_multicluster.push_back(ibook.
book1D(
"clusternum_in_multicluster",
672 "total number of layer clusters in multicluster",
677 histograms.h_clusternum_in_multicluster_vs_layer.push_back(
678 ibook.
bookProfile(
"clusternum_in_multicluster_vs_layer",
679 "Profile of 2d layer clusters in multicluster vs layer number",
686 histograms.h_multiplicityOfLCinMCL.push_back(ibook.
book2D(
"multiplicityOfLCinMCL",
687 "Multiplicity vs Layer cluster size in Multiclusters",
695 histograms.h_multiplicity_numberOfEventsHistogram.push_back(ibook.
book1D(
"multiplicity_numberOfEventsHistogram",
696 "multiplicity numberOfEventsHistogram",
701 histograms.h_multiplicity_zminus_numberOfEventsHistogram.push_back(
702 ibook.
book1D(
"multiplicity_zminus_numberOfEventsHistogram",
703 "multiplicity numberOfEventsHistogram in z-",
708 histograms.h_multiplicity_zplus_numberOfEventsHistogram.push_back(
709 ibook.
book1D(
"multiplicity_zplus_numberOfEventsHistogram",
710 "multiplicity numberOfEventsHistogram in z+",
715 histograms.h_multiplicityOfLCinMCL_vs_layercluster_zminus.push_back(
716 ibook.
book2D(
"multiplicityOfLCinMCL_vs_layercluster_zminus",
717 "Multiplicity vs Layer number in z-",
725 histograms.h_multiplicityOfLCinMCL_vs_layercluster_zplus.push_back(
726 ibook.
book2D(
"multiplicityOfLCinMCL_vs_layercluster_zplus",
727 "Multiplicity vs Layer number in z+",
735 histograms.h_multiplicityOfLCinMCL_vs_layerclusterenergy.push_back(
736 ibook.
book2D(
"multiplicityOfLCinMCL_vs_layerclusterenergy",
737 "Multiplicity vs Layer cluster energy",
759 histograms.h_multicluster_firstlayer.push_back(
760 ibook.
book1D(
"multicluster_firstlayer",
"First layer of the multicluster", 2 *
layers, 0., (
float)2 *
layers));
761 histograms.h_multicluster_lastlayer.push_back(
762 ibook.
book1D(
"multicluster_lastlayer",
"Last layer of the multicluster", 2 *
layers, 0., (
float)2 *
layers));
764 "multicluster_layersnum",
"Number of layers of the multicluster", 2 *
layers, 0., (
float)2 *
layers));
815 edm::Handle<std::vector<CaloParticle>> caloParticleHandle,
816 std::vector<CaloParticle>
const& cP,
817 std::vector<size_t>
const& cPIndices,
818 std::vector<size_t>
const& cPSelectedIndices,
819 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap,
822 auto nLayerClusters =
clusters.size();
824 std::unordered_map<DetId, std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>> detIdToCaloParticleId_Map;
825 std::unordered_map<DetId, std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>> detIdToLayerClusterId_Map;
829 for (
const auto& cpId : cPIndices) {
831 for (
const auto& it_sc : simClusterRefVector) {
834 for (
const auto& it_haf : hits_and_fractions) {
835 DetId hitid = (it_haf.first);
836 std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(hitid);
837 if (itcheck != hitMap.end()) {
838 auto hit_find_it = detIdToCaloParticleId_Map.find(hitid);
839 if (hit_find_it == detIdToCaloParticleId_Map.end()) {
840 detIdToCaloParticleId_Map[hitid] = std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>();
841 detIdToCaloParticleId_Map[hitid].emplace_back(
844 auto findHitIt =
std::find(detIdToCaloParticleId_Map[hitid].begin(),
845 detIdToCaloParticleId_Map[hitid].
end(),
847 if (findHitIt != detIdToCaloParticleId_Map[hitid].
end()) {
848 findHitIt->fraction += it_haf.second;
850 detIdToCaloParticleId_Map[hitid].emplace_back(
859 for (
unsigned int lcId = 0; lcId < nLayerClusters; ++lcId) {
860 const std::vector<std::pair<DetId, float>>& hits_and_fractions =
clusters[lcId].hitsAndFractions();
861 unsigned int numberOfHitsInLC = hits_and_fractions.size();
871 std::vector<int> hitsToCaloParticleId(numberOfHitsInLC);
872 const auto firstHitDetId = hits_and_fractions[0].first;
877 std::unordered_map<unsigned, float> CPEnergyInLC;
879 for (
unsigned int hitId = 0; hitId < numberOfHitsInLC; hitId++) {
880 DetId rh_detid = hits_and_fractions[hitId].first;
881 auto rhFraction = hits_and_fractions[hitId].second;
883 std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(rh_detid);
886 auto hit_find_in_LC = detIdToLayerClusterId_Map.find(rh_detid);
887 if (hit_find_in_LC == detIdToLayerClusterId_Map.end()) {
888 detIdToLayerClusterId_Map[rh_detid] = std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>();
892 auto hit_find_in_CP = detIdToCaloParticleId_Map.find(rh_detid);
900 if (rhFraction == 0.) {
901 hitsToCaloParticleId[hitId] = -2;
903 if (hit_find_in_CP == detIdToCaloParticleId_Map.end()) {
904 hitsToCaloParticleId[hitId] -= 1;
906 auto maxCPEnergyInLC = 0.f;
908 for (
auto&
h : hit_find_in_CP->second) {
909 CPEnergyInLC[
h.clusterId] +=
h.fraction *
hit->energy();
912 if (CPEnergyInLC[
h.clusterId] > maxCPEnergyInLC) {
913 maxCPEnergyInLC = CPEnergyInLC[
h.clusterId];
914 maxCPId =
h.clusterId;
917 hitsToCaloParticleId[hitId] = maxCPId;
919 histograms.h_cellAssociation_perlayer.at(lcLayerId)->Fill(
920 hitsToCaloParticleId[hitId] > 0. ? 0. : hitsToCaloParticleId[hitId]);
932 for (
unsigned int lcId = 0; lcId < nLayerClusters; ++lcId) {
933 const std::vector<std::pair<DetId, float>>& hits_and_fractions =
clusters[lcId].hitsAndFractions();
934 const auto firstHitDetId = hits_and_fractions[0].first;
935 const int lcLayerId =
941 const auto& cpsIt = cpsInLayerClusterMap.
find(lcRef);
942 if (cpsIt == cpsInLayerClusterMap.
end())
945 const auto& cps = cpsIt->
val;
947 for (
const auto& cpPair : cps) {
948 histograms.h_score_layercl2caloparticle_perlayer.at(lcLayerId)->Fill(cpPair.second);
952 for (
const auto& cpPair : cps) {
953 LogDebug(
"HGCalValidator") <<
"layerCluster Id: \t" << lcId <<
"\t CP id: \t" << cpPair.first.index()
954 <<
"\t score \t" << cpPair.second << std::endl;
955 histograms.h_score_layercl2caloparticle_perlayer.at(lcLayerId)->Fill(cpPair.second);
956 auto const& cp_linked =
957 std::find_if(std::begin(cPOnLayerMap[cpPair.first]),
958 std::end(cPOnLayerMap[cpPair.first]),
960 return p.first == lcRef;
963 cPOnLayerMap[cpPair.first].
end())
965 histograms.h_sharedenergy_layercl2caloparticle_perlayer.at(lcLayerId)->Fill(
966 cp_linked->second.first /
clusters[lcId].energy(),
clusters[lcId].energy());
967 histograms.h_energy_vs_score_layercl2caloparticle_perlayer.at(lcLayerId)->Fill(
968 cpPair.second, cp_linked->second.first /
clusters[lcId].energy());
979 const auto& best = std::min_element(
980 std::begin(cps),
std::end(cps), [](
const auto& obj1,
const auto& obj2) {
return obj1.second < obj2.second; });
981 const auto& best_cp_linked =
982 std::find_if(std::begin(cPOnLayerMap[best->first]),
983 std::end(cPOnLayerMap[best->first]),
985 return p.first == lcRef;
987 if (best_cp_linked ==
988 cPOnLayerMap[best->first].
end())
990 histograms.h_sharedenergy_layercl2caloparticle_vs_eta_perlayer.at(lcLayerId)->Fill(
992 histograms.h_sharedenergy_layercl2caloparticle_vs_phi_perlayer.at(lcLayerId)->Fill(
1000 for (
const auto& cpId : cPSelectedIndices) {
1002 const auto& lcsIt = cPOnLayerMap.
find(cpRef);
1004 std::map<unsigned int, float> cPEnergyOnLayer;
1005 for (
unsigned int layerId = 0; layerId <
layers * 2; ++layerId)
1006 cPEnergyOnLayer[layerId] = 0;
1009 for (
const auto& it_sc : simClusterRefVector) {
1012 for (
const auto& it_haf : hits_and_fractions) {
1013 const DetId hitid = (it_haf.first);
1014 const int cpLayerId =
1016 std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(hitid);
1017 if (itcheck != hitMap.end()) {
1019 cPEnergyOnLayer[cpLayerId] += it_haf.second *
hit->energy();
1024 for (
unsigned int layerId = 0; layerId <
layers * 2; ++layerId) {
1025 if (!cPEnergyOnLayer[layerId])
1028 histograms.h_denom_caloparticle_eta_perlayer.at(layerId)->Fill(cP[cpId].g4Tracks()[0].momentum().
eta());
1029 histograms.h_denom_caloparticle_phi_perlayer.at(layerId)->Fill(cP[cpId].g4Tracks()[0].momentum().
phi());
1031 if (lcsIt == cPOnLayerMap.
end())
1033 const auto& lcs = lcsIt->val;
1035 auto getLCLayerId = [&](
const unsigned int lcId) {
1036 const std::vector<std::pair<DetId, float>>& hits_and_fractions =
clusters[lcId].hitsAndFractions();
1037 const auto firstHitDetId = hits_and_fractions[0].first;
1038 const unsigned int lcLayerId =
recHitTools_->getLayerWithOffset(firstHitDetId) +
1043 for (
const auto& lcPair : lcs) {
1044 if (getLCLayerId(lcPair.first.index()) != layerId)
1046 histograms.h_score_caloparticle2layercl_perlayer.at(layerId)->Fill(lcPair.second.second);
1047 histograms.h_sharedenergy_caloparticle2layercl_perlayer.at(layerId)->Fill(
1048 lcPair.second.first / cPEnergyOnLayer[layerId], cPEnergyOnLayer[layerId]);
1049 histograms.h_energy_vs_score_caloparticle2layercl_perlayer.at(layerId)->Fill(
1050 lcPair.second.second, lcPair.second.first / cPEnergyOnLayer[layerId]);
1052 const auto assoc = std::count_if(std::begin(lcs),
std::end(lcs), [&](
const auto&
obj) {
1053 if (getLCLayerId(
obj.first.index()) != layerId)
1059 histograms.h_num_caloparticle_eta_perlayer.at(layerId)->Fill(cP[cpId].g4Tracks()[0].momentum().
eta());
1060 histograms.h_num_caloparticle_phi_perlayer.at(layerId)->Fill(cP[cpId].g4Tracks()[0].momentum().
phi());
1062 histograms.h_numDup_caloparticle_eta_perlayer.at(layerId)->Fill(cP[cpId].g4Tracks()[0].momentum().
eta());
1063 histograms.h_numDup_caloparticle_phi_perlayer.at(layerId)->Fill(cP[cpId].g4Tracks()[0].momentum().
phi());
1065 const auto best = std::min_element(std::begin(lcs),
std::end(lcs), [&](
const auto& obj1,
const auto& obj2) {
1066 if (getLCLayerId(obj1.first.index()) != layerId)
1068 else if (getLCLayerId(obj2.first.index()) == layerId)
1069 return obj1.second.second < obj2.second.second;
1073 histograms.h_sharedenergy_caloparticle2layercl_vs_eta_perlayer.at(layerId)->Fill(
1074 cP[cpId].g4Tracks()[0].momentum().
eta(), best->second.first / cPEnergyOnLayer[layerId]);
1075 histograms.h_sharedenergy_caloparticle2layercl_vs_phi_perlayer.at(layerId)->Fill(
1076 cP[cpId].g4Tracks()[0].momentum().
phi(), best->second.first / cPEnergyOnLayer[layerId]);
1088 edm::Handle<std::vector<CaloParticle>> caloParticleHandle,
1089 std::vector<CaloParticle>
const& cP,
1090 std::vector<size_t>
const& cPIndices,
1091 std::vector<size_t>
const& cPSelectedIndices,
1092 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap,
1093 std::map<double, double> cummatbudg,
1095 std::vector<int> thicknesses,
1105 std::vector<int> tnlcpl(1000, 0);
1108 std::map<std::string, int> tnlcpthplus;
1109 tnlcpthplus.clear();
1110 std::map<std::string, int> tnlcpthminus;
1111 tnlcpthminus.clear();
1113 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
1114 tnlcpthplus.insert(std::pair<std::string, int>(std::to_string(*it), 0));
1115 tnlcpthminus.insert(std::pair<std::string, int>(std::to_string(*it), 0));
1118 tnlcpthplus.insert(std::pair<std::string, int>(
"mixed", 0));
1119 tnlcpthminus.insert(std::pair<std::string, int>(
"mixed", 0));
1130 LCAssocByEnergyScoreHandle);
1134 std::vector<double> tecpl(1000, 0.0);
1136 std::vector<double> ldbar(1000, 0.0);
1139 double caloparteneplus = 0.;
1140 double caloparteneminus = 0.;
1141 for (
const auto& cpId : cPIndices) {
1142 if (cP[cpId].
eta() >= 0.) {
1143 caloparteneplus = caloparteneplus + cP[cpId].energy();
1145 if (cP[cpId].
eta() < 0.) {
1146 caloparteneminus = caloparteneminus + cP[cpId].energy();
1151 for (
unsigned int layerclusterIndex = 0; layerclusterIndex <
clusters.size(); layerclusterIndex++) {
1152 const std::vector<std::pair<DetId, float>> hits_and_fractions =
clusters[layerclusterIndex].hitsAndFractions();
1155 const double seedx =
recHitTools_->getPosition(seedid).x();
1156 const double seedy =
recHitTools_->getPosition(seedid).y();
1164 int nthhits120p = 0;
1165 int nthhits200p = 0;
1166 int nthhits300p = 0;
1167 int nthhitsscintp = 0;
1168 int nthhits120m = 0;
1169 int nthhits200m = 0;
1170 int nthhits300m = 0;
1171 int nthhitsscintm = 0;
1182 bool cluslay =
true;
1186 for (
std::vector<std::pair<DetId, float>>::const_iterator it_haf = hits_and_fractions.begin();
1187 it_haf != hits_and_fractions.end();
1189 const DetId rh_detid = it_haf->first;
1199 LogDebug(
"HGCalValidator") <<
"These are HGCal layer clusters, you shouldn't be here !!! " << layerid <<
"\n";
1206 while (lay_string.size() < 2)
1207 lay_string.insert(0,
"0");
1208 curistr +=
"_" + lay_string;
1233 <<
" You are running a geometry that contains thicknesses different than the normal ones. "
1237 std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(rh_detid);
1238 if (itcheck == hitMap.end()) {
1239 LogDebug(
"HGCalValidator") <<
" You shouldn't be here - Unable to find a hit " << rh_detid.
rawId() <<
" "
1248 const double hit_x =
recHitTools_->getPosition(rh_detid).x();
1249 const double hit_y =
recHitTools_->getPosition(rh_detid).y();
1250 double distancetoseed =
distance(seedx, seedy, hit_x, hit_y);
1251 double distancetomax =
distance(maxx, maxy, hit_x, hit_y);
1252 if (distancetoseed != 0. &&
histograms.h_distancetoseedcell_perthickperlayer.count(curistr)) {
1253 histograms.h_distancetoseedcell_perthickperlayer.at(curistr)->Fill(distancetoseed);
1256 if (distancetoseed != 0. &&
histograms.h_distancetoseedcell_perthickperlayer_eneweighted.count(curistr)) {
1257 histograms.h_distancetoseedcell_perthickperlayer_eneweighted.at(curistr)->Fill(distancetoseed,
hit->energy());
1260 if (distancetomax != 0. &&
histograms.h_distancetomaxcell_perthickperlayer.count(curistr)) {
1261 histograms.h_distancetomaxcell_perthickperlayer.at(curistr)->Fill(distancetomax);
1264 if (distancetomax != 0. &&
histograms.h_distancetomaxcell_perthickperlayer_eneweighted.count(curistr)) {
1265 histograms.h_distancetomaxcell_perthickperlayer_eneweighted.at(curistr)->Fill(distancetomax,
hit->energy());
1269 std::map<DetId, float>::const_iterator dit = densities.find(rh_detid);
1270 if (dit == densities.end()) {
1271 LogDebug(
"HGCalValidator") <<
" You shouldn't be here - Unable to find a density " << rh_detid.
rawId() <<
" "
1283 if ((nthhits120p != 0 && nthhits200p != 0) || (nthhits120p != 0 && nthhits300p != 0) ||
1284 (nthhits120p != 0 && nthhitsscintp != 0) || (nthhits200p != 0 && nthhits300p != 0) ||
1285 (nthhits200p != 0 && nthhitsscintp != 0) || (nthhits300p != 0 && nthhitsscintp != 0)) {
1286 tnlcpthplus[
"mixed"]++;
1287 }
else if ((nthhits120p != 0 || nthhits200p != 0 || nthhits300p != 0 || nthhitsscintp != 0)) {
1289 tnlcpthplus[std::to_string((
int)
thickness)]++;
1291 if ((nthhits120m != 0 && nthhits200m != 0) || (nthhits120m != 0 && nthhits300m != 0) ||
1292 (nthhits120m != 0 && nthhitsscintm != 0) || (nthhits200m != 0 && nthhits300m != 0) ||
1293 (nthhits200m != 0 && nthhitsscintm != 0) || (nthhits300m != 0 && nthhitsscintm != 0)) {
1294 tnlcpthminus[
"mixed"]++;
1295 }
else if ((nthhits120m != 0 || nthhits200m != 0 || nthhits300m != 0 || nthhitsscintm != 0)) {
1297 tnlcpthminus[std::to_string((
int)
thickness)]++;
1301 std::vector<int> bigamoth;
1304 bigamoth.push_back(nthhits120p);
1305 bigamoth.push_back(nthhits200p);
1306 bigamoth.push_back(nthhits300p);
1307 bigamoth.push_back(nthhitsscintp);
1310 bigamoth.push_back(nthhits120m);
1311 bigamoth.push_back(nthhits200m);
1312 bigamoth.push_back(nthhits300m);
1313 bigamoth.push_back(nthhitsscintm);
1315 auto bgth = std::max_element(bigamoth.begin(), bigamoth.end());
1316 istr = std::to_string(thicknesses[
std::distance(bigamoth.begin(), bgth)]);
1318 while (lay_string.size() < 2)
1319 lay_string.insert(0,
"0");
1320 istr +=
"_" + lay_string;
1323 if (
histograms.h_cellsnum_perthickperlayer.count(istr)) {
1324 histograms.h_cellsnum_perthickperlayer.at(istr)->Fill(hits_and_fractions.size());
1328 double distancebetseedandmax =
distance(seedx, seedy, maxx, maxy);
1330 std::string seedstr = std::to_string((
int)
recHitTools_->getSiThickness(seedid)) +
"_" + std::to_string(layerid);
1331 seedstr +=
"_" + lay_string;
1332 if (
histograms.h_distancebetseedandmaxcell_perthickperlayer.count(seedstr)) {
1333 histograms.h_distancebetseedandmaxcell_perthickperlayer.at(seedstr)->Fill(distancebetseedandmax);
1335 if (
histograms.h_distancebetseedandmaxcellvsclusterenergy_perthickperlayer.count(seedstr)) {
1336 histograms.h_distancebetseedandmaxcellvsclusterenergy_perthickperlayer.at(seedstr)->Fill(
1341 tecpl[layerid] = tecpl[layerid] +
clusters[layerclusterIndex].energy();
1342 ldbar[layerid] = ldbar[layerid] +
clusters[layerclusterIndex].energy() * cummatbudg[(double)lay];
1348 double sumeneallcluspl = 0.;
1349 double sumeneallclusmi = 0.;
1351 double sumldbarpl = 0.;
1352 double sumldbarmi = 0.;
1354 for (
unsigned ilayer = 0; ilayer <
layers * 2; ++ilayer) {
1355 if (
histograms.h_clusternum_perlayer.count(ilayer)) {
1356 histograms.h_clusternum_perlayer.at(ilayer)->Fill(tnlcpl[ilayer]);
1361 if (
histograms.h_energyclustered_perlayer.count(ilayer)) {
1362 if (caloparteneminus != 0.) {
1363 histograms.h_energyclustered_perlayer.at(ilayer)->Fill(100. * tecpl[ilayer] / caloparteneminus);
1367 sumeneallclusmi = sumeneallclusmi + tecpl[ilayer];
1369 sumldbarmi = sumldbarmi + ldbar[ilayer];
1371 if (
histograms.h_energyclustered_perlayer.count(ilayer)) {
1372 if (caloparteneplus != 0.) {
1373 histograms.h_energyclustered_perlayer.at(ilayer)->Fill(100. * tecpl[ilayer] / caloparteneplus);
1377 sumeneallcluspl = sumeneallcluspl + tecpl[ilayer];
1379 sumldbarpl = sumldbarpl + ldbar[ilayer];
1385 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
1386 if (
histograms.h_clusternum_perthick.count(*it)) {
1387 histograms.h_clusternum_perthick.at(*it)->Fill(tnlcpthplus[std::to_string(*it)]);
1388 histograms.h_clusternum_perthick.at(*it)->Fill(tnlcpthminus[std::to_string(*it)]);
1392 histograms.h_mixedhitscluster_zplus[
count]->Fill(tnlcpthplus[
"mixed"]);
1393 histograms.h_mixedhitscluster_zminus[
count]->Fill(tnlcpthminus[
"mixed"]);
1396 if (caloparteneplus != 0.) {
1397 histograms.h_energyclustered_zplus[
count]->Fill(100. * sumeneallcluspl / caloparteneplus);
1399 if (caloparteneminus != 0.) {
1400 histograms.h_energyclustered_zminus[
count]->Fill(100. * sumeneallclusmi / caloparteneminus);
1404 histograms.h_longdepthbarycentre_zplus[
count]->Fill(sumldbarpl / sumeneallcluspl);
1405 histograms.h_longdepthbarycentre_zminus[
count]->Fill(sumldbarmi / sumeneallclusmi);
1410 const std::vector<reco::HGCalMultiCluster>& multiClusters,
1411 std::vector<CaloParticle>
const& cP,
1412 std::vector<size_t>
const& cPIndices,
1413 std::vector<size_t>
const& cPSelectedIndices,
1414 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap,
1416 auto nMultiClusters = multiClusters.size();
1418 auto nCaloParticles = cPIndices.size();
1420 std::unordered_map<DetId, std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>> detIdToCaloParticleId_Map;
1421 std::unordered_map<DetId, std::vector<HGVHistoProducerAlgo::detIdInfoInMultiCluster>> detIdToMultiClusterId_Map;
1422 std::vector<int> tracksters_fakemerge(nMultiClusters, 0);
1423 std::vector<int> tracksters_duplicate(nMultiClusters, 0);
1428 std::vector<std::vector<std::pair<unsigned int, float>>> cpsInMultiCluster;
1429 cpsInMultiCluster.resize(nMultiClusters);
1438 std::unordered_map<int, std::vector<caloParticleOnLayer>> cPOnLayer;
1439 for (
unsigned int i = 0;
i < nCaloParticles; ++
i) {
1440 auto cpIndex = cPIndices[
i];
1441 cPOnLayer[cpIndex].resize(
layers * 2);
1442 for (
unsigned int j = 0;
j <
layers * 2; ++
j) {
1443 cPOnLayer[cpIndex][
j].caloParticleId = cpIndex;
1444 cPOnLayer[cpIndex][
j].energy = 0.f;
1445 cPOnLayer[cpIndex][
j].hits_and_fractions.clear();
1449 for (
const auto& cpId : cPIndices) {
1453 for (
const auto& it_sc : simClusterRefVector) {
1456 for (
const auto& it_haf : hits_and_fractions) {
1457 DetId hitid = (it_haf.first);
1461 std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(hitid);
1463 if (itcheck != hitMap.end()) {
1472 auto hit_find_it = detIdToCaloParticleId_Map.find(hitid);
1473 if (hit_find_it == detIdToCaloParticleId_Map.end()) {
1474 detIdToCaloParticleId_Map[hitid] = std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>();
1475 detIdToCaloParticleId_Map[hitid].emplace_back(
1478 auto findHitIt =
std::find(detIdToCaloParticleId_Map[hitid].begin(),
1479 detIdToCaloParticleId_Map[hitid].
end(),
1481 if (findHitIt != detIdToCaloParticleId_Map[hitid].
end()) {
1482 findHitIt->fraction += it_haf.second;
1484 detIdToCaloParticleId_Map[hitid].emplace_back(
1491 cPOnLayer[cpId][cpLayerId].energy += it_haf.second *
hit->energy();
1498 auto& haf = cPOnLayer[cpId][cpLayerId].hits_and_fractions;
1499 auto found = std::find_if(
1500 std::begin(haf),
std::end(haf), [&hitid](
const std::pair<DetId, float>&
v) {
return v.first == hitid; });
1501 if (
found != haf.end()) {
1502 found->second += it_haf.second;
1504 cPOnLayer[cpId][cpLayerId].hits_and_fractions.emplace_back(hitid, it_haf.second);
1512 for (
unsigned int mclId = 0; mclId < nMultiClusters; ++mclId) {
1513 const auto& hits_and_fractions = multiClusters[mclId].hitsAndFractions();
1514 if (!hits_and_fractions.empty()) {
1515 std::unordered_map<unsigned, float> CPEnergyInMCL;
1516 int maxCPId_byNumberOfHits = -1;
1517 unsigned int maxCPNumberOfHitsInMCL = 0;
1518 int maxCPId_byEnergy = -1;
1519 float maxEnergySharedMCLandCP = 0.f;
1520 float energyFractionOfMCLinCP = 0.f;
1521 float energyFractionOfCPinMCL = 0.f;
1528 std::unordered_map<unsigned, unsigned> occurrencesCPinMCL;
1529 unsigned int numberOfNoiseHitsInMCL = 0;
1530 unsigned int numberOfHaloHitsInMCL = 0;
1531 unsigned int numberOfHitsInMCL = 0;
1534 unsigned int numberOfHitsInLC = hits_and_fractions.size();
1535 numberOfHitsInMCL += numberOfHitsInLC;
1536 std::unordered_map<unsigned, float> CPEnergyInLC;
1555 std::vector<int> hitsToCaloParticleId(numberOfHitsInLC);
1558 const auto firstHitDetId = hits_and_fractions[0].first;
1559 int lcLayerId =
recHitTools_->getLayerWithOffset(firstHitDetId) +
1563 for (
unsigned int hitId = 0; hitId < numberOfHitsInLC; hitId++) {
1564 DetId rh_detid = hits_and_fractions[hitId].first;
1565 auto rhFraction = hits_and_fractions[hitId].second;
1568 std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(rh_detid);
1578 auto hit_find_in_LC = detIdToMultiClusterId_Map.find(rh_detid);
1579 if (hit_find_in_LC == detIdToMultiClusterId_Map.end()) {
1580 detIdToMultiClusterId_Map[rh_detid] = std::vector<HGVHistoProducerAlgo::detIdInfoInMultiCluster>();
1582 detIdToMultiClusterId_Map[rh_detid].emplace_back(
1586 auto hit_find_in_CP = detIdToCaloParticleId_Map.find(rh_detid);
1594 if (rhFraction == 0.) {
1595 hitsToCaloParticleId[hitId] = -2;
1596 numberOfHaloHitsInMCL++;
1598 if (hit_find_in_CP == detIdToCaloParticleId_Map.end()) {
1599 hitsToCaloParticleId[hitId] -= 1;
1601 auto maxCPEnergyInLC = 0.f;
1603 for (
auto&
h : hit_find_in_CP->second) {
1604 auto shared_fraction =
std::min(rhFraction,
h.fraction);
1609 CPEnergyInMCL[
h.clusterId] += shared_fraction *
hit->energy();
1611 CPEnergyInLC[
h.clusterId] += shared_fraction *
hit->energy();
1614 cPOnLayer[
h.clusterId][lcLayerId].layerClusterIdToEnergyAndScore[mclId].first +=
1615 shared_fraction *
hit->energy();
1616 cPOnLayer[
h.clusterId][lcLayerId].layerClusterIdToEnergyAndScore[mclId].second = FLT_MAX;
1619 cpsInMultiCluster[mclId].emplace_back(
h.clusterId, FLT_MAX);
1622 if (shared_fraction > maxCPEnergyInLC) {
1624 maxCPEnergyInLC = CPEnergyInLC[
h.clusterId];
1625 maxCPId =
h.clusterId;
1629 hitsToCaloParticleId[hitId] = maxCPId;
1636 for (
auto c : hitsToCaloParticleId) {
1638 numberOfNoiseHitsInMCL++;
1640 occurrencesCPinMCL[
c]++;
1646 for (
auto&
c : occurrencesCPinMCL) {
1647 if (
c.second > maxCPNumberOfHitsInMCL) {
1648 maxCPId_byNumberOfHits =
c.first;
1649 maxCPNumberOfHitsInMCL =
c.second;
1654 for (
auto&
c : CPEnergyInMCL) {
1655 if (
c.second > maxEnergySharedMCLandCP) {
1656 maxCPId_byEnergy =
c.first;
1657 maxEnergySharedMCLandCP =
c.second;
1661 float totalCPEnergyFromLayerCP = 0.f;
1662 if (maxCPId_byEnergy >= 0) {
1664 for (
unsigned int j = 0;
j <
layers * 2; ++
j) {
1665 totalCPEnergyFromLayerCP = totalCPEnergyFromLayerCP + cPOnLayer[maxCPId_byEnergy][
j].energy;
1667 energyFractionOfCPinMCL = maxEnergySharedMCLandCP / totalCPEnergyFromLayerCP;
1668 if (multiClusters[mclId].
energy() > 0.
f) {
1669 energyFractionOfMCLinCP = maxEnergySharedMCLandCP / multiClusters[mclId].energy();
1673 LogDebug(
"HGCalValidator") << std::setw(12) <<
"multiCluster"
1675 << std::setw(10) <<
"mulcl energy"
1676 <<
"\t" << std::setw(5) <<
"nhits"
1677 <<
"\t" << std::setw(12) <<
"noise hits"
1678 <<
"\t" << std::setw(22) <<
"maxCPId_byNumberOfHits"
1679 <<
"\t" << std::setw(8) <<
"nhitsCP"
1680 <<
"\t" << std::setw(16) <<
"maxCPId_byEnergy"
1681 <<
"\t" << std::setw(23) <<
"maxEnergySharedMCLandCP"
1682 <<
"\t" << std::setw(22) <<
"totalCPEnergyFromAllLayerCP"
1683 <<
"\t" << std::setw(22) <<
"energyFractionOfMCLinCP"
1684 <<
"\t" << std::setw(25) <<
"energyFractionOfCPinMCL"
1685 <<
"\t" << std::endl;
1686 LogDebug(
"HGCalValidator") << std::setw(12) << mclId <<
"\t"
1687 << std::setw(10) << multiClusters[mclId].energy() <<
"\t" << std::setw(5)
1688 << numberOfHitsInMCL <<
"\t" << std::setw(12) << numberOfNoiseHitsInMCL <<
"\t"
1689 << std::setw(22) << maxCPId_byNumberOfHits <<
"\t" << std::setw(8)
1690 << maxCPNumberOfHitsInMCL <<
"\t" << std::setw(16) << maxCPId_byEnergy <<
"\t"
1691 << std::setw(23) << maxEnergySharedMCLandCP <<
"\t" << std::setw(22)
1692 << totalCPEnergyFromLayerCP <<
"\t" << std::setw(22) << energyFractionOfMCLinCP <<
"\t"
1693 << std::setw(25) << energyFractionOfCPinMCL << std::endl;
1698 for (
unsigned int mclId = 0; mclId < nMultiClusters; ++mclId) {
1699 const auto& hits_and_fractions = multiClusters[mclId].hitsAndFractions();
1700 if (!hits_and_fractions.empty()) {
1703 std::sort(cpsInMultiCluster[mclId].begin(), cpsInMultiCluster[mclId].
end());
1704 auto last =
std::unique(cpsInMultiCluster[mclId].begin(), cpsInMultiCluster[mclId].
end());
1705 cpsInMultiCluster[mclId].erase(
last, cpsInMultiCluster[mclId].
end());
1707 if (multiClusters[mclId].
energy() == 0. && !cpsInMultiCluster[mclId].
empty()) {
1709 for (
auto& cpPair : cpsInMultiCluster[mclId]) {
1712 LogDebug(
"HGCalValidator") <<
"multiCluster Id: \t" << mclId <<
"\t CP id: \t" << cpPair.first
1713 <<
"\t score \t" << cpPair.second << std::endl;
1720 float invMultiClusterEnergyWeight = 0.f;
1721 for (
auto const& haf : multiClusters[mclId].hitsAndFractions()) {
1722 invMultiClusterEnergyWeight +=
1723 (haf.second * hitMap.at(haf.first)->energy()) * (haf.second * hitMap.at(haf.first)->energy());
1725 invMultiClusterEnergyWeight = 1.f / invMultiClusterEnergyWeight;
1727 unsigned int numberOfHitsInLC = hits_and_fractions.size();
1728 for (
unsigned int i = 0;
i < numberOfHitsInLC; ++
i) {
1729 DetId rh_detid = hits_and_fractions[
i].first;
1730 float rhFraction = hits_and_fractions[
i].second;
1731 bool hitWithNoCP =
false;
1733 auto hit_find_in_CP = detIdToCaloParticleId_Map.find(rh_detid);
1734 if (hit_find_in_CP == detIdToCaloParticleId_Map.end())
1736 auto itcheck = hitMap.find(rh_detid);
1738 float hitEnergyWeight =
hit->energy() *
hit->energy();
1740 for (
auto& cpPair : cpsInMultiCluster[mclId]) {
1741 float cpFraction = 0.f;
1743 auto findHitIt =
std::find(detIdToCaloParticleId_Map[rh_detid].begin(),
1744 detIdToCaloParticleId_Map[rh_detid].
end(),
1746 if (findHitIt != detIdToCaloParticleId_Map[rh_detid].
end()) {
1747 cpFraction = findHitIt->fraction;
1750 if (cpPair.second == FLT_MAX) {
1751 cpPair.second = 0.f;
1754 (rhFraction - cpFraction) * (rhFraction - cpFraction) * hitEnergyWeight * invMultiClusterEnergyWeight;
1759 if (cpsInMultiCluster[mclId].
empty())
1760 LogDebug(
"HGCalValidator") <<
"multiCluster Id: \t" << mclId <<
"\tCP id:\t-1 "
1764 auto score = std::min_element(std::begin(cpsInMultiCluster[mclId]),
1765 std::end(cpsInMultiCluster[mclId]),
1766 [](
const auto& obj1,
const auto& obj2) {
return obj1.second < obj2.second; });
1767 for (
auto& cpPair : cpsInMultiCluster[mclId]) {
1772 LogDebug(
"HGCalValidator") <<
"multiCluster Id: \t" << mclId <<
"\t CP id: \t" << cpPair.first <<
"\t score \t"
1773 << cpPair.second << std::endl;
1774 if (cpPair.first ==
score->first) {
1777 float sharedeneCPallLayers = 0.;
1779 for (
unsigned int j = 0;
j <
layers * 2; ++
j) {
1780 auto const& cp_linked = cPOnLayer[cpPair.first][
j].layerClusterIdToEnergyAndScore[mclId];
1781 sharedeneCPallLayers += cp_linked.first;
1783 LogDebug(
"HGCalValidator") <<
"sharedeneCPallLayers " << sharedeneCPallLayers << std::endl;
1784 if (cpPair.first ==
score->first) {
1785 histograms.h_sharedenergy_multicl2caloparticle[
count]->Fill(sharedeneCPallLayers /
1786 multiClusters[mclId].
energy());
1788 score->second, sharedeneCPallLayers / multiClusters[mclId].energy());
1791 auto assocFakeMerge = std::count_if(std::begin(cpsInMultiCluster[mclId]),
1792 std::end(cpsInMultiCluster[mclId]),
1794 tracksters_fakemerge[mclId] = assocFakeMerge;
1798 std::unordered_map<int, std::vector<float>> score3d;
1799 std::unordered_map<int, std::vector<float>> mclsharedenergy;
1800 std::unordered_map<int, std::vector<float>> mclsharedenergyfrac;
1802 for (
unsigned int i = 0;
i < nCaloParticles; ++
i) {
1803 auto cpIndex = cPIndices[
i];
1804 score3d[cpIndex].resize(nMultiClusters);
1805 mclsharedenergy[cpIndex].resize(nMultiClusters);
1806 mclsharedenergyfrac[cpIndex].resize(nMultiClusters);
1807 for (
unsigned int j = 0;
j < nMultiClusters; ++
j) {
1808 score3d[cpIndex][
j] = FLT_MAX;
1809 mclsharedenergy[cpIndex][
j] = 0.f;
1810 mclsharedenergyfrac[cpIndex][
j] = 0.f;
1817 for (
const auto& cpId : cPSelectedIndices) {
1820 std::vector<unsigned int> cpId_mclId_related;
1821 cpId_mclId_related.clear();
1823 float CPenergy = 0.f;
1824 for (
unsigned int layerId = 0; layerId <
layers * 2; ++layerId) {
1825 unsigned int CPNumberOfHits = cPOnLayer[cpId][layerId].hits_and_fractions.size();
1827 CPenergy += cPOnLayer[cpId][layerId].energy;
1828 if (CPNumberOfHits == 0)
1830 int mclWithMaxEnergyInCP = -1;
1832 float maxEnergyMCLperlayerinCP = 0.f;
1833 float CPEnergyFractionInMCLperlayer = 0.f;
1835 for (
const auto& mcl : cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore) {
1836 if (mcl.second.first > maxEnergyMCLperlayerinCP) {
1837 maxEnergyMCLperlayerinCP = mcl.second.first;
1838 mclWithMaxEnergyInCP = mcl.first;
1842 CPEnergyFractionInMCLperlayer = maxEnergyMCLperlayerinCP / CPenergy;
1844 LogDebug(
"HGCalValidator") << std::setw(8) <<
"LayerId:\t" << std::setw(12) <<
"caloparticle\t" << std::setw(15)
1845 <<
"cp total energy\t" << std::setw(15) <<
"cpEnergyOnLayer\t" << std::setw(14)
1846 <<
"CPNhitsOnLayer\t" << std::setw(18) <<
"mclWithMaxEnergyInCP\t" << std::setw(15)
1847 <<
"maxEnergyMCLinCP\t" << std::setw(20) <<
"CPEnergyFractionInMCL"
1849 LogDebug(
"HGCalValidator") << std::setw(8) << layerId <<
"\t" << std::setw(12) << cpId <<
"\t" << std::setw(15)
1850 << cP[cpId].energy() <<
"\t" << std::setw(15) << CPenergy <<
"\t" << std::setw(14)
1851 << CPNumberOfHits <<
"\t" << std::setw(18) << mclWithMaxEnergyInCP <<
"\t"
1852 << std::setw(15) << maxEnergyMCLperlayerinCP <<
"\t" << std::setw(20)
1853 << CPEnergyFractionInMCLperlayer <<
"\n";
1855 for (
unsigned int i = 0;
i < CPNumberOfHits; ++
i) {
1856 auto& cp_hitDetId = cPOnLayer[cpId][layerId].hits_and_fractions[
i].first;
1857 auto& cpFraction = cPOnLayer[cpId][layerId].hits_and_fractions[
i].second;
1859 bool hitWithNoMCL =
false;
1860 if (cpFraction == 0.
f)
1862 auto hit_find_in_MCL = detIdToMultiClusterId_Map.find(cp_hitDetId);
1863 if (hit_find_in_MCL == detIdToMultiClusterId_Map.end())
1864 hitWithNoMCL =
true;
1865 auto itcheck = hitMap.find(cp_hitDetId);
1867 float hitEnergyWeight =
hit->energy() *
hit->energy();
1868 for (
auto& lcPair : cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore) {
1869 unsigned int multiClusterId = lcPair.first;
1870 if (
std::find(std::begin(cpId_mclId_related),
std::end(cpId_mclId_related), multiClusterId) ==
1872 cpId_mclId_related.push_back(multiClusterId);
1874 float mclFraction = 0.f;
1876 if (!hitWithNoMCL) {
1877 auto findHitIt =
std::find(detIdToMultiClusterId_Map[cp_hitDetId].begin(),
1878 detIdToMultiClusterId_Map[cp_hitDetId].
end(),
1880 if (findHitIt != detIdToMultiClusterId_Map[cp_hitDetId].
end())
1881 mclFraction = findHitIt->fraction;
1885 if (lcPair.second.second == FLT_MAX) {
1886 lcPair.second.second = 0.f;
1888 lcPair.second.second += (mclFraction - cpFraction) * (mclFraction - cpFraction) * hitEnergyWeight;
1889 LogDebug(
"HGCalValidator") <<
"multiClusterId:\t" << multiClusterId <<
"\t"
1890 <<
"mclfraction,cpfraction:\t" << mclFraction <<
", " << cpFraction <<
"\t"
1891 <<
"hitEnergyWeight:\t" << hitEnergyWeight <<
"\t"
1892 <<
"currect score numerator:\t" << lcPair.second.second <<
"\n";
1896 if (cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore.empty())
1897 LogDebug(
"HGCalValidator") <<
"CP Id: \t" << cpId <<
"\t MCL id:\t-1 "
1898 <<
"\t layer \t " << layerId <<
" Sub score in \t -1"
1901 for (
const auto& lcPair : cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore) {
1903 if (score3d[cpId][lcPair.first] == FLT_MAX) {
1904 score3d[cpId][lcPair.first] = 0.f;
1906 score3d[cpId][lcPair.first] += lcPair.second.second;
1907 mclsharedenergy[cpId][lcPair.first] += lcPair.second.first;
1915 float invCPEnergyWeight = 0.f;
1916 for (
const auto& layer : cPOnLayer[cpId]) {
1917 for (
const auto& haf : layer.hits_and_fractions) {
1918 invCPEnergyWeight +=
1919 (haf.second * hitMap.at(haf.first)->energy()) * (haf.second * hitMap.at(haf.first)->energy());
1922 invCPEnergyWeight = 1.f / invCPEnergyWeight;
1926 std::vector<int> cpId_mclId_related_vec(cpId_mclId_related.begin(), cpId_mclId_related.end());
1927 for (
unsigned int i = 0;
i < cpId_mclId_related_vec.size(); ++
i) {
1928 auto mclId = cpId_mclId_related_vec[
i];
1930 score3d[cpId][mclId] = score3d[cpId][mclId] * invCPEnergyWeight;
1931 mclsharedenergyfrac[cpId][mclId] = (mclsharedenergy[cpId][mclId] / CPenergy);
1933 LogDebug(
"HGCalValidator") <<
"CP Id: \t" << cpId <<
"\t MCL id: \t" << mclId <<
"\t score \t"
1934 << score3d[cpId][mclId] <<
"\t"
1935 <<
"invCPEnergyWeight \t" << invCPEnergyWeight <<
"\t"
1936 <<
"shared energy:\t" << mclsharedenergy[cpId][mclId] <<
"\t"
1937 <<
"shared energy fraction:\t" << mclsharedenergyfrac[cpId][mclId] <<
"\n";
1939 histograms.h_score_caloparticle2multicl[
count]->Fill(score3d[cpId][mclId]);
1941 histograms.h_sharedenergy_caloparticle2multicl[
count]->Fill(mclsharedenergyfrac[cpId][mclId]);
1942 histograms.h_energy_vs_score_caloparticle2multicl[
count]->Fill(score3d[cpId][mclId],
1943 mclsharedenergyfrac[cpId][mclId]);
1948 auto assocDup = std::count_if(std::begin(score3d[cpId]),
std::end(score3d[cpId]), is_assoc);
1951 histograms.h_num_caloparticle_eta[
count]->Fill(cP[cpId].g4Tracks()[0].momentum().
eta());
1952 histograms.h_num_caloparticle_phi[
count]->Fill(cP[cpId].g4Tracks()[0].momentum().
phi());
1953 auto best = std::min_element(std::begin(score3d[cpId]),
std::end(score3d[cpId]));
1954 auto bestmclId =
std::distance(std::begin(score3d[cpId]), best);
1956 histograms.h_sharedenergy_caloparticle2multicl_vs_eta[
count]->Fill(cP[cpId].g4Tracks()[0].momentum().
eta(),
1957 multiClusters[bestmclId].
energy() / CPenergy);
1958 histograms.h_sharedenergy_caloparticle2multicl_vs_phi[
count]->Fill(cP[cpId].g4Tracks()[0].momentum().
phi(),
1959 multiClusters[bestmclId].
energy() / CPenergy);
1961 if (assocDup >= 2) {
1962 auto match = std::find_if(std::begin(score3d[cpId]),
std::end(score3d[cpId]), is_assoc);
1963 while (
match != score3d[cpId].
end()) {
1968 histograms.h_denom_caloparticle_eta[
count]->Fill(cP[cpId].g4Tracks()[0].momentum().
eta());
1969 histograms.h_denom_caloparticle_phi[
count]->Fill(cP[cpId].g4Tracks()[0].momentum().
phi());
1976 for (
unsigned int mclId = 0; mclId < nMultiClusters; ++mclId) {
1977 const auto& hits_and_fractions = multiClusters[mclId].hitsAndFractions();
1978 if (!hits_and_fractions.empty()) {
1979 auto assocFakeMerge = tracksters_fakemerge[mclId];
1980 auto assocDuplicate = tracksters_duplicate[mclId];
1981 if (assocDuplicate) {
1985 if (assocFakeMerge > 0) {
1988 auto best = std::min_element(std::begin(cpsInMultiCluster[mclId]),
1989 std::end(cpsInMultiCluster[mclId]),
1990 [](
const auto& obj1,
const auto& obj2) {
return obj1.second < obj2.second; });
1993 float sharedeneCPallLayers = 0.;
1995 for (
unsigned int j = 0;
j <
layers * 2; ++
j) {
1996 auto const& best_cp_linked = cPOnLayer[best->first][
j].layerClusterIdToEnergyAndScore[mclId];
1997 sharedeneCPallLayers += best_cp_linked.first;
2000 multiClusters[mclId].
eta(), sharedeneCPallLayers / multiClusters[mclId].
energy());
2002 multiClusters[mclId].
phi(), sharedeneCPallLayers / multiClusters[mclId].
energy());
2004 if (assocFakeMerge >= 2) {
2016 const std::vector<reco::HGCalMultiCluster>& multiClusters,
2017 std::vector<CaloParticle>
const& cP,
2018 std::vector<size_t>
const& cPIndices,
2019 std::vector<size_t>
const& cPSelectedIndices,
2020 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap,
2029 int tncontmclpz = 0;
2030 int tncontmclmz = 0;
2032 int tnnoncontmclpz = 0;
2033 int tnnoncontmclmz = 0;
2035 std::vector<bool> contmulti;
2039 std::unordered_map<unsigned int, std::vector<unsigned int>> multiplicity;
2041 std::unordered_map<unsigned int, std::vector<unsigned int>> multiplicity_vs_layer;
2048 auto nMultiClusters = multiClusters.size();
2050 for (
unsigned int mclId = 0; mclId < nMultiClusters; ++mclId) {
2054 if (nLayerClusters == 0)
2057 if (multiClusters[mclId].
z() < 0.) {
2060 if (multiClusters[mclId].
z() > 0.) {
2069 std::vector<int> tnlcinmclperlay(1000, 0);
2073 std::set<int> multicluster_layers;
2075 bool multiclusterInZplus =
false;
2076 bool multiclusterInZminus =
false;
2079 for (
unsigned int lcId = 0; lcId < nLayerClusters; ++lcId) {
2081 const std::vector<std::pair<DetId, float>>& hits_and_fractions =
layerClusters[lcId]->hitsAndFractions();
2084 multiplicity[mclId].emplace_back(hits_and_fractions.size());
2086 const auto firstHitDetId = hits_and_fractions[0].first;
2088 int layerid =
recHitTools_->getLayerWithOffset(firstHitDetId) +
2090 multicluster_layers.insert(layerid);
2091 multiplicity_vs_layer[mclId].emplace_back(layerid);
2093 tnlcinmclperlay[layerid]++;
2097 multiclusterInZplus =
true;
2100 multiclusterInZminus =
true;
2106 for (
unsigned ilayer = 0; ilayer <
layers * 2; ++ilayer) {
2107 if (
histograms.h_clusternum_in_multicluster_perlayer[
count].count(ilayer) && tnlcinmclperlay[ilayer] != 0) {
2108 histograms.h_clusternum_in_multicluster_perlayer[
count].at(ilayer)->Fill((
float)tnlcinmclperlay[ilayer]);
2111 if (tnlcinmclperlay[ilayer] != 0) {
2112 histograms.h_clusternum_in_multicluster_vs_layer[
count]->Fill((
float)ilayer, (
float)tnlcinmclperlay[ilayer]);
2117 std::vector<int> multicluster_layers_vec(multicluster_layers.begin(), multicluster_layers.end());
2119 bool contimulti =
false;
2121 if (multicluster_layers_vec.size() >= 3) {
2122 for (
unsigned int i = 1;
i < multicluster_layers_vec.size() - 1; ++
i) {
2123 if ((multicluster_layers_vec[
i - 1] + 1 == multicluster_layers_vec[
i]) &&
2124 (multicluster_layers_vec[
i + 1] - 1 == multicluster_layers_vec[
i])) {
2126 if (multiclusterInZplus) {
2129 if (multiclusterInZminus) {
2139 if (multiclusterInZplus) {
2142 if (multiclusterInZminus) {
2148 contmulti.push_back(contimulti);
2152 for (
unsigned int lc = 0; lc < multiplicity[mclId].size(); ++lc) {
2154 float mlp =
std::count(std::begin(multiplicity[mclId]),
std::end(multiplicity[mclId]), multiplicity[mclId][lc]);
2157 histograms.h_multiplicityOfLCinMCL[
count]->Fill(mlp, multiplicity[mclId][lc]);
2163 if (multiplicity_vs_layer[mclId][lc] <
layers) {
2164 histograms.h_multiplicityOfLCinMCL_vs_layercluster_zminus[
count]->Fill(mlp, multiplicity_vs_layer[mclId][lc]);
2165 histograms.h_multiplicity_zminus_numberOfEventsHistogram[
count]->Fill(mlp);
2167 histograms.h_multiplicityOfLCinMCL_vs_layercluster_zplus[
count]->Fill(
2168 mlp, multiplicity_vs_layer[mclId][lc] -
layers);
2169 histograms.h_multiplicity_zplus_numberOfEventsHistogram[
count]->Fill(mlp);
2175 if (!multicluster_layers.empty()) {
2182 histograms.h_multicluster_firstlayer[
count]->Fill((
float)*multicluster_layers.begin());
2183 histograms.h_multicluster_lastlayer[
count]->Fill((
float)*multicluster_layers.rbegin());
2184 histograms.h_multicluster_layersnum[
count]->Fill((
float)multicluster_layers.size());
2194 histograms.h_contmulticlusternum[
count]->Fill(tncontmclpz + tncontmclmz);
2195 histograms.h_noncontmulticlusternum[
count]->Fill(tnnoncontmclpz + tnnoncontmclmz);
2203 const double y2)
const {
2204 const double dx =
x1 -
x2;
2205 const double dy =
y1 -
y2;
2211 const double y2)
const {
2220 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap)
const {
2222 const std::vector<std::pair<DetId, float>>& hits_and_fractions = cluster.
hitsAndFractions();
2225 for (
std::vector<std::pair<DetId, float>>::const_iterator it_haf = hits_and_fractions.begin();
2226 it_haf != hits_and_fractions.end();
2228 DetId rh_detid = it_haf->first;
2230 std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(rh_detid);
2233 if (maxene < hit->
energy()) {
2234 maxene =
hit->energy();
2235 themaxid = rh_detid;