24 minEta_(pset.getParameter<double>(
"minEta")),
25 maxEta_(pset.getParameter<double>(
"maxEta")),
26 nintEta_(pset.getParameter<int>(
"nintEta")),
27 useFabsEta_(pset.getParameter<bool>(
"useFabsEta")),
30 minEne_(pset.getParameter<double>(
"minEne")),
31 maxEne_(pset.getParameter<double>(
"maxEne")),
32 nintEne_(pset.getParameter<int>(
"nintEne")),
35 minPt_(pset.getParameter<double>(
"minPt")),
36 maxPt_(pset.getParameter<double>(
"maxPt")),
37 nintPt_(pset.getParameter<int>(
"nintPt")),
40 minPhi_(pset.getParameter<double>(
"minPhi")),
41 maxPhi_(pset.getParameter<double>(
"maxPhi")),
42 nintPhi_(pset.getParameter<int>(
"nintPhi")),
45 minMixedHitsSimCluster_(pset.getParameter<double>(
"minMixedHitsSimCluster")),
46 maxMixedHitsSimCluster_(pset.getParameter<double>(
"maxMixedHitsSimCluster")),
47 nintMixedHitsSimCluster_(pset.getParameter<int>(
"nintMixedHitsSimCluster")),
50 minMixedHitsCluster_(pset.getParameter<double>(
"minMixedHitsCluster")),
51 maxMixedHitsCluster_(pset.getParameter<double>(
"maxMixedHitsCluster")),
52 nintMixedHitsCluster_(pset.getParameter<int>(
"nintMixedHitsCluster")),
55 minEneCl_(pset.getParameter<double>(
"minEneCl")),
56 maxEneCl_(pset.getParameter<double>(
"maxEneCl")),
57 nintEneCl_(pset.getParameter<int>(
"nintEneCl")),
60 minLongDepBary_(pset.getParameter<double>(
"minLongDepBary")),
61 maxLongDepBary_(pset.getParameter<double>(
"maxLongDepBary")),
62 nintLongDepBary_(pset.getParameter<int>(
"nintLongDepBary")),
65 minZpos_(pset.getParameter<double>(
"minZpos")),
66 maxZpos_(pset.getParameter<double>(
"maxZpos")),
67 nintZpos_(pset.getParameter<int>(
"nintZpos")),
70 minTotNsimClsperlay_(pset.getParameter<double>(
"minTotNsimClsperlay")),
71 maxTotNsimClsperlay_(pset.getParameter<double>(
"maxTotNsimClsperlay")),
72 nintTotNsimClsperlay_(pset.getParameter<int>(
"nintTotNsimClsperlay")),
75 minTotNClsperlay_(pset.getParameter<double>(
"minTotNClsperlay")),
76 maxTotNClsperlay_(pset.getParameter<double>(
"maxTotNClsperlay")),
77 nintTotNClsperlay_(pset.getParameter<int>(
"nintTotNClsperlay")),
80 minEneClperlay_(pset.getParameter<double>(
"minEneClperlay")),
81 maxEneClperlay_(pset.getParameter<double>(
"maxEneClperlay")),
82 nintEneClperlay_(pset.getParameter<int>(
"nintEneClperlay")),
87 minScore_(pset.getParameter<double>(
"minScore")),
88 maxScore_(pset.getParameter<double>(
"maxScore")),
89 nintScore_(pset.getParameter<int>(
"nintScore")),
96 minSharedEneFrac_(pset.getParameter<double>(
"minSharedEneFrac")),
97 maxSharedEneFrac_(pset.getParameter<double>(
"maxSharedEneFrac")),
98 nintSharedEneFrac_(pset.getParameter<int>(
"nintSharedEneFrac")),
99 minTSTSharedEneFracEfficiency_(pset.getParameter<double>(
"minTSTSharedEneFracEfficiency")),
102 minTSTSharedEneFrac_(pset.getParameter<double>(
"minTSTSharedEneFrac")),
103 maxTSTSharedEneFrac_(pset.getParameter<double>(
"maxTSTSharedEneFrac")),
104 nintTSTSharedEneFrac_(pset.getParameter<int>(
"nintTSTSharedEneFrac")),
107 minTotNsimClsperthick_(pset.getParameter<double>(
"minTotNsimClsperthick")),
108 maxTotNsimClsperthick_(pset.getParameter<double>(
"maxTotNsimClsperthick")),
109 nintTotNsimClsperthick_(pset.getParameter<int>(
"nintTotNsimClsperthick")),
112 minTotNClsperthick_(pset.getParameter<double>(
"minTotNClsperthick")),
113 maxTotNClsperthick_(pset.getParameter<double>(
"maxTotNClsperthick")),
114 nintTotNClsperthick_(pset.getParameter<int>(
"nintTotNClsperthick")),
117 minTotNcellsperthickperlayer_(pset.getParameter<double>(
"minTotNcellsperthickperlayer")),
118 maxTotNcellsperthickperlayer_(pset.getParameter<double>(
"maxTotNcellsperthickperlayer")),
119 nintTotNcellsperthickperlayer_(pset.getParameter<int>(
"nintTotNcellsperthickperlayer")),
122 minDisToSeedperthickperlayer_(pset.getParameter<double>(
"minDisToSeedperthickperlayer")),
123 maxDisToSeedperthickperlayer_(pset.getParameter<double>(
"maxDisToSeedperthickperlayer")),
124 nintDisToSeedperthickperlayer_(pset.getParameter<int>(
"nintDisToSeedperthickperlayer")),
127 minDisToSeedperthickperlayerenewei_(pset.getParameter<double>(
"minDisToSeedperthickperlayerenewei")),
128 maxDisToSeedperthickperlayerenewei_(pset.getParameter<double>(
"maxDisToSeedperthickperlayerenewei")),
129 nintDisToSeedperthickperlayerenewei_(pset.getParameter<int>(
"nintDisToSeedperthickperlayerenewei")),
132 minDisToMaxperthickperlayer_(pset.getParameter<double>(
"minDisToMaxperthickperlayer")),
133 maxDisToMaxperthickperlayer_(pset.getParameter<double>(
"maxDisToMaxperthickperlayer")),
134 nintDisToMaxperthickperlayer_(pset.getParameter<int>(
"nintDisToMaxperthickperlayer")),
137 minDisToMaxperthickperlayerenewei_(pset.getParameter<double>(
"minDisToMaxperthickperlayerenewei")),
138 maxDisToMaxperthickperlayerenewei_(pset.getParameter<double>(
"maxDisToMaxperthickperlayerenewei")),
139 nintDisToMaxperthickperlayerenewei_(pset.getParameter<int>(
"nintDisToMaxperthickperlayerenewei")),
142 minDisSeedToMaxperthickperlayer_(pset.getParameter<double>(
"minDisSeedToMaxperthickperlayer")),
143 maxDisSeedToMaxperthickperlayer_(pset.getParameter<double>(
"maxDisSeedToMaxperthickperlayer")),
144 nintDisSeedToMaxperthickperlayer_(pset.getParameter<int>(
"nintDisSeedToMaxperthickperlayer")),
147 minClEneperthickperlayer_(pset.getParameter<double>(
"minClEneperthickperlayer")),
148 maxClEneperthickperlayer_(pset.getParameter<double>(
"maxClEneperthickperlayer")),
149 nintClEneperthickperlayer_(pset.getParameter<int>(
"nintClEneperthickperlayer")),
152 minCellsEneDensperthick_(pset.getParameter<double>(
"minCellsEneDensperthick")),
153 maxCellsEneDensperthick_(pset.getParameter<double>(
"maxCellsEneDensperthick")),
154 nintCellsEneDensperthick_(pset.getParameter<int>(
"nintCellsEneDensperthick")),
158 minTotNTSTs_(pset.getParameter<double>(
"minTotNTSTs")),
159 maxTotNTSTs_(pset.getParameter<double>(
"maxTotNTSTs")),
160 nintTotNTSTs_(pset.getParameter<int>(
"nintTotNTSTs")),
163 minTotNClsinTSTs_(pset.getParameter<double>(
"minTotNClsinTSTs")),
164 maxTotNClsinTSTs_(pset.getParameter<double>(
"maxTotNClsinTSTs")),
165 nintTotNClsinTSTs_(pset.getParameter<int>(
"nintTotNClsinTSTs")),
168 minTotNClsinTSTsperlayer_(pset.getParameter<double>(
"minTotNClsinTSTsperlayer")),
169 maxTotNClsinTSTsperlayer_(pset.getParameter<double>(
"maxTotNClsinTSTsperlayer")),
170 nintTotNClsinTSTsperlayer_(pset.getParameter<int>(
"nintTotNClsinTSTsperlayer")),
173 minMplofLCs_(pset.getParameter<double>(
"minMplofLCs")),
174 maxMplofLCs_(pset.getParameter<double>(
"maxMplofLCs")),
175 nintMplofLCs_(pset.getParameter<int>(
"nintMplofLCs")),
178 minSizeCLsinTSTs_(pset.getParameter<double>(
"minSizeCLsinTSTs")),
179 maxSizeCLsinTSTs_(pset.getParameter<double>(
"maxSizeCLsinTSTs")),
180 nintSizeCLsinTSTs_(pset.getParameter<int>(
"nintSizeCLsinTSTs")),
183 minClEnepermultiplicity_(pset.getParameter<double>(
"minClEnepermultiplicity")),
184 maxClEnepermultiplicity_(pset.getParameter<double>(
"maxClEnepermultiplicity")),
185 nintClEnepermultiplicity_(pset.getParameter<int>(
"nintClEnepermultiplicity")),
188 minX_(pset.getParameter<double>(
"minX")),
189 maxX_(pset.getParameter<double>(
"maxX")),
190 nintX_(pset.getParameter<int>(
"nintX")),
193 minY_(pset.getParameter<double>(
"minY")),
194 maxY_(pset.getParameter<double>(
"maxY")),
195 nintY_(pset.getParameter<int>(
"nintY")),
198 minZ_(pset.getParameter<double>(
"minZ")),
199 maxZ_(pset.getParameter<double>(
"maxZ")),
200 nintZ_(pset.getParameter<int>(
"nintZ")) {}
229 ibook.
book1D(
"EnergyDifference",
"(Energy-SelfEnergy)/Energy", 300., -5., 1.);
232 ibook.
book1D(
"Num Sim Clusters",
"Num Sim Clusters in CaloParticles", 100, 0., 100.);
234 ibook.
book1D(
"Num Hits in Sim Clusters",
"Num Hits in Sim Clusters in CaloParticles", 1000, 0., 1000.);
236 "Num Rec-matched Hits in Sim Clusters",
"Num Hits in Sim Clusters (matched) in CaloParticles", 1000, 0., 1000.);
239 ibook.
book1D(
"Energy of Rec-matched Hits",
"Energy of Hits in Sim Clusters (matched)", 100, 0., 10.);
241 ibook.
book2D(
"Energy of Rec-matched Hits vs layer",
242 "Energy of Hits in Sim Clusters (matched) vs layer",
250 ibook.
book2D(
"Energy of Rec-matched Hits vs layer (1SC)",
251 "Energy of Hits only 1 Sim Clusters (matched) vs layer",
259 ibook.
book2D(
"Rec-matched Hits Sum Energy vs layer",
260 "Rescaled Sum Energy of Hits in Sim Clusters (matched) vs layer",
269 ibook.
book1D(
"First Layer",
"First layer of the CaloParticles", 2 * layers, 0., (
float)2 * layers);
271 ibook.
book1D(
"Last Layer",
"Last layer of the CaloParticles", 2 * layers, 0., (
float)2 * layers);
273 ibook.
book1D(
"Number of Layers",
"Number of layers of the CaloParticles", 2 * layers, 0., (
float)2 * layers);
275 "First Layer (rec-matched hit)",
"First layer of the CaloParticles (matched)", 2 * layers, 0., (
float)2 * layers);
277 "Last Layer (rec-matched hit)",
"Last layer of the CaloParticles (matched)", 2 * layers, 0., (
float)2 * layers);
279 ibook.
book1D(
"Number of Layers (rec-matched hit)",
280 "Number of layers of the CaloParticles (matched)",
289 std::vector<int> thicknesses) {
291 for (
unsigned ilayer = 0; ilayer < 2 *
layers; ++ilayer) {
292 auto istr1 = std::to_string(ilayer);
293 while (istr1.size() < 2) {
294 istr1.insert(0,
"0");
299 if (ilayer < layers) {
300 istr2 = std::to_string(ilayer + 1) +
" in z-";
302 istr2 = std::to_string(ilayer - (layers - 1)) +
" in z+";
305 "total number of SimClusters for layer " + istr2,
312 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
313 auto istr = std::to_string(*it);
315 "total number of simclusters for thickness " + istr,
324 ibook.
book1D(
"mixedhitssimcluster_zminus",
325 "N of simclusters that contain hits of more than one kind in z-",
331 ibook.
book1D(
"mixedhitssimcluster_zplus",
332 "N of simclusters that contain hits of more than one kind in z+",
341 std::vector<int> thicknesses) {
342 std::unordered_map<int, dqm::reco::MonitorElement*> denom_layercl_in_simcl_eta_perlayer;
343 denom_layercl_in_simcl_eta_perlayer.clear();
344 std::unordered_map<int, dqm::reco::MonitorElement*> denom_layercl_in_simcl_phi_perlayer;
345 denom_layercl_in_simcl_phi_perlayer.clear();
346 std::unordered_map<int, dqm::reco::MonitorElement*> score_layercl2simcluster_perlayer;
347 score_layercl2simcluster_perlayer.clear();
348 std::unordered_map<int, dqm::reco::MonitorElement*> sharedenergy_layercl2simcluster_perlayer;
349 sharedenergy_layercl2simcluster_perlayer.clear();
350 std::unordered_map<int, dqm::reco::MonitorElement*> energy_vs_score_layercl2simcluster_perlayer;
351 energy_vs_score_layercl2simcluster_perlayer.clear();
352 std::unordered_map<int, dqm::reco::MonitorElement*> num_layercl_in_simcl_eta_perlayer;
353 num_layercl_in_simcl_eta_perlayer.clear();
354 std::unordered_map<int, dqm::reco::MonitorElement*> num_layercl_in_simcl_phi_perlayer;
355 num_layercl_in_simcl_phi_perlayer.clear();
356 std::unordered_map<int, dqm::reco::MonitorElement*> numMerge_layercl_in_simcl_eta_perlayer;
357 numMerge_layercl_in_simcl_eta_perlayer.clear();
358 std::unordered_map<int, dqm::reco::MonitorElement*> numMerge_layercl_in_simcl_phi_perlayer;
359 numMerge_layercl_in_simcl_phi_perlayer.clear();
360 std::unordered_map<int, dqm::reco::MonitorElement*> sharedenergy_layercl2simcluster_vs_eta_perlayer;
361 sharedenergy_layercl2simcluster_vs_eta_perlayer.clear();
362 std::unordered_map<int, dqm::reco::MonitorElement*> sharedenergy_layercl2simcluster_vs_phi_perlayer;
363 sharedenergy_layercl2simcluster_vs_phi_perlayer.clear();
364 std::unordered_map<int, dqm::reco::MonitorElement*> denom_simcluster_eta_perlayer;
365 denom_simcluster_eta_perlayer.clear();
366 std::unordered_map<int, dqm::reco::MonitorElement*> denom_simcluster_phi_perlayer;
367 denom_simcluster_phi_perlayer.clear();
368 std::unordered_map<int, dqm::reco::MonitorElement*> score_simcluster2layercl_perlayer;
369 score_simcluster2layercl_perlayer.clear();
370 std::unordered_map<int, dqm::reco::MonitorElement*> sharedenergy_simcluster2layercl_perlayer;
371 sharedenergy_simcluster2layercl_perlayer.clear();
372 std::unordered_map<int, dqm::reco::MonitorElement*> energy_vs_score_simcluster2layercl_perlayer;
373 energy_vs_score_simcluster2layercl_perlayer.clear();
374 std::unordered_map<int, dqm::reco::MonitorElement*> num_simcluster_eta_perlayer;
375 num_simcluster_eta_perlayer.clear();
376 std::unordered_map<int, dqm::reco::MonitorElement*> num_simcluster_phi_perlayer;
377 num_simcluster_phi_perlayer.clear();
378 std::unordered_map<int, dqm::reco::MonitorElement*> numDup_simcluster_eta_perlayer;
379 numDup_simcluster_eta_perlayer.clear();
380 std::unordered_map<int, dqm::reco::MonitorElement*> numDup_simcluster_phi_perlayer;
381 numDup_simcluster_phi_perlayer.clear();
382 std::unordered_map<int, dqm::reco::MonitorElement*> sharedenergy_simcluster2layercl_vs_eta_perlayer;
383 sharedenergy_simcluster2layercl_vs_eta_perlayer.clear();
384 std::unordered_map<int, dqm::reco::MonitorElement*> sharedenergy_simcluster2layercl_vs_phi_perlayer;
385 sharedenergy_simcluster2layercl_vs_phi_perlayer.clear();
388 for (
unsigned ilayer = 0; ilayer < 2 *
layers; ++ilayer) {
389 auto istr1 = std::to_string(ilayer);
390 while (istr1.size() < 2) {
391 istr1.insert(0,
"0");
396 if (ilayer < layers) {
397 istr2 = std::to_string(ilayer + 1) +
" in z-";
399 istr2 = std::to_string(ilayer - (layers - 1)) +
" in z+";
402 denom_layercl_in_simcl_eta_perlayer[ilayer] =
403 ibook.
book1D(
"Denom_LayerCluster_in_SimCluster_Eta_perlayer" + istr1,
404 "Denom LayerCluster in SimCluster Eta per Layer Cluster for layer " + istr2,
409 denom_layercl_in_simcl_phi_perlayer[ilayer] =
410 ibook.
book1D(
"Denom_LayerCluster_in_SimCluster_Phi_perlayer" + istr1,
411 "Denom LayerCluster in SimCluster Phi per Layer Cluster for layer " + istr2,
416 score_layercl2simcluster_perlayer[ilayer] = ibook.
book1D(
"Score_layercl2simcluster_perlayer" + istr1,
417 "Score of Layer Cluster per SimCluster for layer " + istr2,
422 score_simcluster2layercl_perlayer[ilayer] = ibook.
book1D(
"Score_simcluster2layercl_perlayer" + istr1,
423 "Score of SimCluster per Layer Cluster for layer " + istr2,
428 energy_vs_score_simcluster2layercl_perlayer[ilayer] =
429 ibook.
book2D(
"Energy_vs_Score_simcluster2layer_perlayer" + istr1,
430 "Energy vs Score of SimCluster per Layer Cluster for layer " + istr2,
438 energy_vs_score_layercl2simcluster_perlayer[ilayer] =
439 ibook.
book2D(
"Energy_vs_Score_layer2simcluster_perlayer" + istr1,
440 "Energy vs Score of Layer Cluster per SimCluster for layer " + istr2,
448 sharedenergy_simcluster2layercl_perlayer[ilayer] =
449 ibook.
book1D(
"SharedEnergy_simcluster2layercl_perlayer" + istr1,
450 "Shared Energy of SimCluster per Layer Cluster for layer " + istr2,
455 sharedenergy_simcluster2layercl_vs_eta_perlayer[ilayer] =
456 ibook.
bookProfile(
"SharedEnergy_simcluster2layercl_vs_eta_perlayer" + istr1,
457 "Shared Energy of SimCluster vs #eta per best Layer Cluster for layer " + istr2,
464 sharedenergy_simcluster2layercl_vs_phi_perlayer[ilayer] =
465 ibook.
bookProfile(
"SharedEnergy_simcluster2layercl_vs_phi_perlayer" + istr1,
466 "Shared Energy of SimCluster vs #phi per best Layer Cluster for layer " + istr2,
473 sharedenergy_layercl2simcluster_perlayer[ilayer] =
474 ibook.
book1D(
"SharedEnergy_layercluster2simcluster_perlayer" + istr1,
475 "Shared Energy of Layer Cluster per SimCluster for layer " + istr2,
480 sharedenergy_layercl2simcluster_vs_eta_perlayer[ilayer] =
481 ibook.
bookProfile(
"SharedEnergy_layercl2simcluster_vs_eta_perlayer" + istr1,
482 "Shared Energy of LayerCluster vs #eta per best SimCluster for layer " + istr2,
489 sharedenergy_layercl2simcluster_vs_phi_perlayer[ilayer] =
490 ibook.
bookProfile(
"SharedEnergy_layercl2simcluster_vs_phi_perlayer" + istr1,
491 "Shared Energy of LayerCluster vs #phi per best SimCluster for layer " + istr2,
498 num_simcluster_eta_perlayer[ilayer] = ibook.
book1D(
"Num_SimCluster_Eta_perlayer" + istr1,
499 "Num SimCluster Eta per Layer Cluster for layer " + istr2,
504 numDup_simcluster_eta_perlayer[ilayer] =
505 ibook.
book1D(
"NumDup_SimCluster_Eta_perlayer" + istr1,
506 "Num Duplicate SimCluster Eta per Layer Cluster for layer " + istr2,
511 denom_simcluster_eta_perlayer[ilayer] = ibook.
book1D(
"Denom_SimCluster_Eta_perlayer" + istr1,
512 "Denom SimCluster Eta per Layer Cluster for layer " + istr2,
517 num_simcluster_phi_perlayer[ilayer] = ibook.
book1D(
"Num_SimCluster_Phi_perlayer" + istr1,
518 "Num SimCluster Phi per Layer Cluster for layer " + istr2,
523 numDup_simcluster_phi_perlayer[ilayer] =
524 ibook.
book1D(
"NumDup_SimCluster_Phi_perlayer" + istr1,
525 "Num Duplicate SimCluster Phi per Layer Cluster for layer " + istr2,
530 denom_simcluster_phi_perlayer[ilayer] = ibook.
book1D(
"Denom_SimCluster_Phi_perlayer" + istr1,
531 "Denom SimCluster Phi per Layer Cluster for layer " + istr2,
536 num_layercl_in_simcl_eta_perlayer[ilayer] =
537 ibook.
book1D(
"Num_LayerCluster_in_SimCluster_Eta_perlayer" + istr1,
538 "Num LayerCluster Eta per Layer Cluster in SimCluster for layer " + istr2,
543 numMerge_layercl_in_simcl_eta_perlayer[ilayer] =
544 ibook.
book1D(
"NumMerge_LayerCluster_in_SimCluster_Eta_perlayer" + istr1,
545 "Num Merge LayerCluster Eta per Layer Cluster in SimCluster for layer " + istr2,
550 num_layercl_in_simcl_phi_perlayer[ilayer] =
551 ibook.
book1D(
"Num_LayerCluster_in_SimCluster_Phi_perlayer" + istr1,
552 "Num LayerCluster Phi per Layer Cluster in SimCluster for layer " + istr2,
557 numMerge_layercl_in_simcl_phi_perlayer[ilayer] =
558 ibook.
book1D(
"NumMerge_LayerCluster_in_SimCluster_Phi_perlayer" + istr1,
559 "Num Merge LayerCluster Phi per Layer Cluster in SimCluster for layer " + istr2,
571 std::move(energy_vs_score_layercl2simcluster_perlayer));
577 std::move(sharedenergy_layercl2simcluster_vs_eta_perlayer));
579 std::move(sharedenergy_layercl2simcluster_vs_phi_perlayer));
585 std::move(energy_vs_score_simcluster2layercl_perlayer));
591 std::move(sharedenergy_simcluster2layercl_vs_eta_perlayer));
593 std::move(sharedenergy_simcluster2layercl_vs_phi_perlayer));
598 std::vector<int> thicknesses,
607 ibook.
book1D(
"mixedhitscluster_zminus",
608 "N of reco clusters that contain hits of more than one kind in z-",
614 ibook.
book1D(
"mixedhitscluster_zplus",
615 "N of reco clusters that contain hits of more than one kind in z+",
623 ibook.
book1D(
"energyclustered_zminus",
624 "percent of total energy clustered by all layer clusters over CaloParticless energy in z-",
630 ibook.
book1D(
"energyclustered_zplus",
631 "percent of total energy clustered by all layer clusters over CaloParticless energy in z+",
638 std::string subpathtomat = pathtomatbudfile.substr(pathtomatbudfile.find(
"Validation"));
640 ibook.
book1D(
"longdepthbarycentre_zminus",
641 "The longitudinal depth barycentre in z- for " + subpathtomat,
647 ibook.
book1D(
"longdepthbarycentre_zplus",
648 "The longitudinal depth barycentre in z+ for " + subpathtomat,
654 for (
unsigned ilayer = 0; ilayer < 2 *
layers; ++ilayer) {
655 auto istr1 = std::to_string(ilayer);
656 while (istr1.size() < 2) {
657 istr1.insert(0,
"0");
662 if (ilayer < layers) {
663 istr2 = std::to_string(ilayer + 1) +
" in z-";
665 istr2 = std::to_string(ilayer - (layers - 1)) +
" in z+";
668 "total number of layer clusters for layer " + istr2,
673 "energyclustered_perlayer" + istr1,
674 "percent of total energy clustered by layer clusters over CaloParticless energy for layer " + istr2,
681 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
682 auto istr = std::to_string(*it);
684 "total number of layer clusters for thickness " + istr,
696 for (
unsigned ilayer = 0; ilayer < 2 *
layers; ++ilayer) {
697 auto istr1 = std::to_string(ilayer);
698 while (istr1.size() < 2) {
699 istr1.insert(0,
"0");
704 if (ilayer < layers) {
705 istr2 = std::to_string(ilayer + 1) +
" in z-";
707 istr2 = std::to_string(ilayer - (layers - 1)) +
" in z+";
710 ibook.
book1D(
"Score_layercl2caloparticle_perlayer" + istr1,
711 "Score of Layer Cluster per CaloParticle for layer " + istr2,
716 ibook.
book1D(
"Score_caloparticle2layercl_perlayer" + istr1,
717 "Score of CaloParticle per Layer Cluster for layer " + istr2,
722 ibook.
book2D(
"Energy_vs_Score_caloparticle2layer_perlayer" + istr1,
723 "Energy vs Score of CaloParticle per Layer Cluster for layer " + istr2,
731 ibook.
book2D(
"Energy_vs_Score_layer2caloparticle_perlayer" + istr1,
732 "Energy vs Score of Layer Cluster per CaloParticle Layer for layer " + istr2,
740 ibook.
book1D(
"SharedEnergy_caloparticle2layercl_perlayer" + istr1,
741 "Shared Energy of CaloParticle per Layer Cluster for layer " + istr2,
746 ibook.
bookProfile(
"SharedEnergy_caloparticle2layercl_vs_eta_perlayer" + istr1,
747 "Shared Energy of CaloParticle vs #eta per best Layer Cluster for layer " + istr2,
754 ibook.
bookProfile(
"SharedEnergy_caloparticle2layercl_vs_phi_perlayer" + istr1,
755 "Shared Energy of CaloParticle vs #phi per best Layer Cluster for layer " + istr2,
762 ibook.
book1D(
"SharedEnergy_layercluster2caloparticle_perlayer" + istr1,
763 "Shared Energy of Layer Cluster per Layer Calo Particle for layer " + istr2,
768 ibook.
bookProfile(
"SharedEnergy_layercl2caloparticle_vs_eta_perlayer" + istr1,
769 "Shared Energy of LayerCluster vs #eta per best Calo Particle for layer " + istr2,
776 ibook.
bookProfile(
"SharedEnergy_layercl2caloparticle_vs_phi_perlayer" + istr1,
777 "Shared Energy of LayerCluster vs #phi per best Calo Particle for layer " + istr2,
784 ibook.
book1D(
"Num_CaloParticle_Eta_perlayer" + istr1,
785 "Num CaloParticle Eta per Layer Cluster for layer " + istr2,
790 ibook.
book1D(
"NumDup_CaloParticle_Eta_perlayer" + istr1,
791 "Num Duplicate CaloParticle Eta per Layer Cluster for layer " + istr2,
796 ibook.
book1D(
"Denom_CaloParticle_Eta_perlayer" + istr1,
797 "Denom CaloParticle Eta per Layer Cluster for layer " + istr2,
802 ibook.
book1D(
"Num_CaloParticle_Phi_perlayer" + istr1,
803 "Num CaloParticle Phi per Layer Cluster for layer " + istr2,
808 ibook.
book1D(
"NumDup_CaloParticle_Phi_perlayer" + istr1,
809 "Num Duplicate CaloParticle Phi per Layer Cluster for layer " + istr2,
814 ibook.
book1D(
"Denom_CaloParticle_Phi_perlayer" + istr1,
815 "Denom CaloParticle Phi per Layer Cluster for layer " + istr2,
820 ibook.
book1D(
"Num_LayerCluster_Eta_perlayer" + istr1,
821 "Num LayerCluster Eta per Layer Cluster for layer " + istr2,
826 ibook.
book1D(
"NumMerge_LayerCluster_Eta_perlayer" + istr1,
827 "Num Merge LayerCluster Eta per Layer Cluster for layer " + istr2,
832 ibook.
book1D(
"Denom_LayerCluster_Eta_perlayer" + istr1,
833 "Denom LayerCluster Eta per Layer Cluster for layer " + istr2,
838 ibook.
book1D(
"Num_LayerCluster_Phi_perlayer" + istr1,
839 "Num LayerCluster Phi per Layer Cluster for layer " + istr2,
844 ibook.
book1D(
"NumMerge_LayerCluster_Phi_perlayer" + istr1,
845 "Num Merge LayerCluster Phi per Layer Cluster for layer " + istr2,
850 ibook.
book1D(
"Denom_LayerCluster_Phi_perlayer" + istr1,
851 "Denom LayerCluster Phi per Layer Cluster for layer " + istr2,
862 std::vector<int> thicknesses) {
864 for (
unsigned ilayer = 0; ilayer < 2 *
layers; ++ilayer) {
865 auto istr1 = std::to_string(ilayer);
866 while (istr1.size() < 2) {
867 istr1.insert(0,
"0");
872 if (ilayer < layers) {
873 istr2 = std::to_string(ilayer + 1) +
" in z-";
875 istr2 = std::to_string(ilayer - (layers - 1)) +
" in z+";
878 ibook.
book1D(
"cellAssociation_perlayer" + istr1,
"Cell Association for layer " + istr2, 5, -4., 1.);
885 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
886 auto istr = std::to_string(*it);
888 "energy density of cluster cells for thickness " + istr,
895 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
896 for (
unsigned ilayer = 0; ilayer < 2 *
layers; ++ilayer) {
897 auto istr1 = std::to_string(*it);
898 auto istr2 = std::to_string(ilayer);
899 while (istr2.size() < 2)
900 istr2.insert(0,
"0");
901 auto istr = istr1 +
"_" + istr2;
905 if (ilayer < layers) {
906 istr3 = std::to_string(ilayer + 1) +
" in z- ";
908 istr3 = std::to_string(ilayer - (layers - 1)) +
" in z+ ";
912 ibook.
book1D(
"cellsnum_perthick_perlayer_" + istr,
913 "total number of cells for layer " + istr3 +
" for thickness " + istr1,
919 ibook.
book1D(
"distancetoseedcell_perthickperlayer_" + istr,
920 "distance of cluster cells to seed cell for layer " + istr3 +
" for thickness " + istr1,
926 "distancetoseedcell_perthickperlayer_eneweighted_" + istr,
927 "energy weighted distance of cluster cells to seed cell for layer " + istr3 +
" for thickness " + istr1,
933 ibook.
book1D(
"distancetomaxcell_perthickperlayer_" + istr,
934 "distance of cluster cells to max cell for layer " + istr3 +
" for thickness " + istr1,
940 "distancetomaxcell_perthickperlayer_eneweighted_" + istr,
941 "energy weighted distance of cluster cells to max cell for layer " + istr3 +
" for thickness " + istr1,
947 ibook.
book1D(
"distancebetseedandmaxcell_perthickperlayer_" + istr,
948 "distance of seed cell to max cell for layer " + istr3 +
" for thickness " + istr1,
954 "distancebetseedandmaxcellvsclusterenergy_perthickperlayer_" + istr,
955 "distance of seed cell to max cell vs cluster energy for layer " + istr3 +
" for thickness " + istr1,
968 std::unordered_map<int, dqm::reco::MonitorElement*> clusternum_in_trackster_perlayer;
969 clusternum_in_trackster_perlayer.clear();
971 for (
unsigned ilayer = 0; ilayer < 2 *
layers; ++ilayer) {
972 auto istr1 = std::to_string(ilayer);
973 while (istr1.size() < 2) {
974 istr1.insert(0,
"0");
979 if (ilayer < layers) {
980 istr2 = std::to_string(ilayer + 1) +
" in z-";
982 istr2 = std::to_string(ilayer - (layers - 1)) +
" in z+";
985 clusternum_in_trackster_perlayer[ilayer] = ibook.
book1D(
"clusternum_in_trackster_perlayer" + istr1,
986 "Number of layer clusters in Trackster for layer " + istr2,
1001 "number of Tracksters without 3 contiguous layers",
1007 "total number of layer clusters in Trackster",
1013 ibook.
bookProfile(
"clusternum_in_trackster_vs_layer",
1014 "Profile of 2d layer clusters in Trackster vs layer number",
1022 "Multiplicity vs Layer cluster size in Tracksters",
1031 "multiplicity numberOfEventsHistogram",
1037 ibook.
book1D(
"multiplicity_zminus_numberOfEventsHistogram",
1038 "multiplicity numberOfEventsHistogram in z-",
1044 ibook.
book1D(
"multiplicity_zplus_numberOfEventsHistogram",
1045 "multiplicity numberOfEventsHistogram in z+",
1051 ibook.
book2D(
"multiplicityOfLCinTST_vs_layercluster_zminus",
1052 "Multiplicity vs Layer number in z-",
1061 ibook.
book2D(
"multiplicityOfLCinTST_vs_layercluster_zplus",
1062 "Multiplicity vs Layer number in z+",
1071 ibook.
book2D(
"multiplicityOfLCinTST_vs_layerclusterenergy",
1072 "Multiplicity vs Layer cluster energy",
1091 ibook.
book1D(
"trackster_firstlayer",
"First layer of the Trackster", 2 * layers, 0., (
float)2 * layers));
1093 ibook.
book1D(
"trackster_lastlayer",
"Last layer of the Trackster", 2 * layers, 0., (
float)2 * layers));
1095 ibook.
book1D(
"trackster_layersnum",
"Number of layers of the Trackster", 2 * layers, 0., (
float)2 * layers));
1104 ibook.
book2D(
"Energy_vs_Score_trackster2caloparticle",
1105 "Energy vs Score of Trackster per CaloParticle",
1113 ibook.
book2D(
"Energy_vs_Score_caloparticle2trackster",
1114 "Energy vs Score of CaloParticle per Trackster",
1137 ibook.
book1D(
"SharedEnergy_trackster2caloparticle",
1138 "Shared Energy of Trackster per Calo Particle in each layer",
1143 ibook.
bookProfile(
"SharedEnergy_trackster2caloparticle_vs_eta",
1144 "Shared Energy of Trackster vs #eta per best Calo Particle in each layer",
1151 ibook.
bookProfile(
"SharedEnergy_trackster2caloparticle_vs_phi",
1152 "Shared Energy of Trackster vs #phi per best Calo Particle in each layer",
1160 "Shared Energy of CaloParticle per Trackster",
1165 ibook.
book1D(
"SharedEnergy_caloparticle2trackster_assoc",
1166 "Shared Energy of Associated CaloParticle per Trackster",
1171 ibook.
bookProfile(
"SharedEnergy_caloparticle2trackster_vs_eta",
1172 "Shared Energy of CaloParticle vs #eta per best Trackster",
1179 ibook.
bookProfile(
"SharedEnergy_caloparticle2trackster_vs_phi",
1180 "Shared Energy of CaloParticle vs #phi per best Trackster",
1188 "NumEff_CaloParticle_Eta",
"Num Efficiency CaloParticle Eta per Trackster",
nintEta_,
minEta_,
maxEta_));
1196 "NumEff_CaloParticle_Phi",
"Num Efficiency CaloParticle Phi per Trackster",
nintPhi_,
minPhi_,
maxPhi_));
1221 std::vector<SimVertex>
const& simVertices,
1223 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap)
const {
1247 int minLayerId = 999;
1250 int simHits_matched = 0;
1251 int minLayerId_matched = 999;
1252 int maxLayerId_matched = 0;
1255 std::map<int, double> totenergy_layer;
1257 for (
auto const& sc : caloParticle.
simClusters()) {
1258 LogDebug(
"HGCalValidator") <<
" This sim cluster has " << sc->hits_and_fractions().size() <<
" simHits and "
1259 << sc->energy() <<
" energy. " << std::endl;
1260 simHits += sc->hits_and_fractions().size();
1261 for (
auto const& h_and_f : sc->hits_and_fractions()) {
1262 const auto hitDetId = h_and_f.first;
1266 int layerId_matched_min = 999;
1267 int layerId_matched_max = 0;
1268 std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(hitDetId);
1269 if (itcheck != hitMap.end()) {
1270 layerId_matched_min = layerId;
1271 layerId_matched_max = layerId;
1275 energy += hit->
energy() * h_and_f.second;
1279 if (totenergy_layer.find(layerId) != totenergy_layer.end()) {
1280 totenergy_layer[layerId] = totenergy_layer.at(layerId) + hit->
energy();
1282 totenergy_layer.emplace(layerId, hit->
energy());
1286 hit->
energy() * h_and_f.second);
1288 LogDebug(
"HGCalValidator") <<
" matched to RecHit NOT found !" << std::endl;
1291 minLayerId =
std::min(minLayerId, layerId);
1292 maxLayerId =
std::max(maxLayerId, layerId);
1293 minLayerId_matched =
std::min(minLayerId_matched, layerId_matched_min);
1294 maxLayerId_matched =
std::max(maxLayerId_matched, layerId_matched_max);
1296 LogDebug(
"HGCalValidator") << std::endl;
1312 auto i = totenergy_layer.begin();
1313 double sum_energy = 0.0;
1314 while (
i != totenergy_layer.end()) {
1315 sum_energy +=
i->second;
1322 void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simCluster_histos(
const Histograms&
histograms,
1323 std::vector<SimCluster>
const& simClusters,
1325 std::vector<int> thicknesses)
const {
1334 std::vector<int> tnscpl(1000, 0);
1337 std::map<std::string, int> tnscpthplus;
1338 tnscpthplus.clear();
1339 std::map<std::string, int> tnscpthminus;
1340 tnscpthminus.clear();
1342 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
1343 tnscpthplus.insert(std::pair<std::string, int>(std::to_string(*it), 0));
1344 tnscpthminus.insert(std::pair<std::string, int>(std::to_string(*it), 0));
1347 tnscpthplus.insert(std::pair<std::string, int>(
"mixed", 0));
1348 tnscpthminus.insert(std::pair<std::string, int>(
"mixed", 0));
1351 for (
unsigned int ic = 0; ic < simClusters.size(); ++ic) {
1352 const auto& sc = simClusters[ic];
1353 const auto& hitsAndFractions = sc.hits_and_fractions();
1356 int nthhits120p = 0;
1357 int nthhits200p = 0;
1358 int nthhits300p = 0;
1359 int nthhitsscintp = 0;
1360 int nthhits120m = 0;
1361 int nthhits200m = 0;
1362 int nthhits300m = 0;
1363 int nthhitsscintm = 0;
1367 std::vector<int> occurenceSCinlayer(1000, 0);
1370 for (
const auto& hAndF : hitsAndFractions) {
1371 const DetId sh_detid = hAndF.first;
1375 recHitTools_->getLayerWithOffset(sh_detid) + layers * ((recHitTools_->zside(sh_detid) + 1) >> 1) - 1;
1377 int zside = recHitTools_->zside(sh_detid);
1380 if (occurenceSCinlayer[layerid] == 0) {
1383 occurenceSCinlayer[layerid]++;
1386 thickness = recHitTools_->getSiThickness(sh_detid);
1390 LogDebug(
"HGCalValidator") <<
"These are HGCal simClusters, you shouldn't be here !!! " << layerid <<
"\n";
1394 if ((thickness == 120.) && (zside > 0.)) {
1396 }
else if ((thickness == 120.) && (zside < 0.)) {
1398 }
else if ((thickness == 200.) && (zside > 0.)) {
1400 }
else if ((thickness == 200.) && (zside < 0.)) {
1402 }
else if ((thickness == 300.) && (zside > 0.)) {
1404 }
else if ((thickness == 300.) && (zside < 0.)) {
1406 }
else if ((thickness == -1) && (zside > 0.)) {
1408 }
else if ((thickness == -1) && (zside < 0.)) {
1412 <<
" You are running a geometry that contains thicknesses different than the normal ones. "
1419 if ((nthhits120p != 0 && nthhits200p != 0) || (nthhits120p != 0 && nthhits300p != 0) ||
1420 (nthhits120p != 0 && nthhitsscintp != 0) || (nthhits200p != 0 && nthhits300p != 0) ||
1421 (nthhits200p != 0 && nthhitsscintp != 0) || (nthhits300p != 0 && nthhitsscintp != 0)) {
1422 tnscpthplus[
"mixed"]++;
1423 }
else if ((nthhits120p != 0 || nthhits200p != 0 || nthhits300p != 0 || nthhitsscintp != 0)) {
1425 tnscpthplus[std::to_string((
int)thickness)]++;
1427 if ((nthhits120m != 0 && nthhits200m != 0) || (nthhits120m != 0 && nthhits300m != 0) ||
1428 (nthhits120m != 0 && nthhitsscintm != 0) || (nthhits200m != 0 && nthhits300m != 0) ||
1429 (nthhits200m != 0 && nthhitsscintm != 0) || (nthhits300m != 0 && nthhitsscintm != 0)) {
1430 tnscpthminus[
"mixed"]++;
1431 }
else if ((nthhits120m != 0 || nthhits200m != 0 || nthhits300m != 0 || nthhitsscintm != 0)) {
1433 tnscpthminus[std::to_string((
int)thickness)]++;
1439 for (
unsigned ilayer = 0; ilayer < layers * 2; ++ilayer) {
1440 if (histograms.h_simclusternum_perlayer.count(ilayer)) {
1441 histograms.h_simclusternum_perlayer.at(ilayer)->
Fill(tnscpl[ilayer]);
1446 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
1447 if (histograms.h_simclusternum_perthick.count(*it)) {
1448 histograms.h_simclusternum_perthick.at(*it)->
Fill(tnscpthplus[std::to_string(*it)]);
1449 histograms.h_simclusternum_perthick.at(*it)->
Fill(tnscpthminus[std::to_string(*it)]);
1453 histograms.h_mixedhitssimcluster_zplus->
Fill(tnscpthplus[
"mixed"]);
1454 histograms.h_mixedhitssimcluster_zminus->
Fill(tnscpthminus[
"mixed"]);
1457 void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simClusterAssociation_histos(
1462 edm::Handle<std::vector<SimCluster>> simClusterHandle,
1463 std::vector<SimCluster>
const& simClusters,
1464 std::vector<size_t>
const& sCIndices,
1465 const std::vector<float>& mask,
1466 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap,
1467 unsigned int layers,
1478 layerClusters_to_SimClusters(histograms,
1488 scsInLayerClusterMap,
1489 lcsInSimClusterMap);
1502 edm::Handle<std::vector<CaloParticle>> caloParticleHandle,
1503 std::vector<CaloParticle>
const& cP,
1504 std::vector<size_t>
const& cPIndices,
1505 std::vector<size_t>
const& cPSelectedIndices,
1506 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap,
1507 unsigned int layers,
1510 auto nLayerClusters = clusters.size();
1512 std::unordered_map<DetId, std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>> detIdToCaloParticleId_Map;
1513 std::unordered_map<DetId, std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>> detIdToLayerClusterId_Map;
1517 for (
const auto& cpId : cPIndices) {
1519 for (
const auto& it_sc : simClusterRefVector) {
1522 for (
const auto& it_haf : hits_and_fractions) {
1523 DetId hitid = (it_haf.first);
1524 std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(hitid);
1525 if (itcheck != hitMap.end()) {
1526 auto hit_find_it = detIdToCaloParticleId_Map.find(hitid);
1527 if (hit_find_it == detIdToCaloParticleId_Map.end()) {
1528 detIdToCaloParticleId_Map[hitid] = std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>();
1529 detIdToCaloParticleId_Map[hitid].emplace_back(
1532 auto findHitIt =
std::find(detIdToCaloParticleId_Map[hitid].
begin(),
1533 detIdToCaloParticleId_Map[hitid].
end(),
1535 if (findHitIt != detIdToCaloParticleId_Map[hitid].
end()) {
1536 findHitIt->fraction += it_haf.second;
1538 detIdToCaloParticleId_Map[hitid].emplace_back(
1547 for (
unsigned int lcId = 0; lcId < nLayerClusters; ++lcId) {
1548 const std::vector<std::pair<DetId, float>>& hits_and_fractions = clusters[lcId].hitsAndFractions();
1549 unsigned int numberOfHitsInLC = hits_and_fractions.size();
1559 std::vector<int> hitsToCaloParticleId(numberOfHitsInLC);
1560 const auto firstHitDetId = hits_and_fractions[0].first;
1565 std::unordered_map<unsigned, float> CPEnergyInLC;
1567 for (
unsigned int hitId = 0; hitId < numberOfHitsInLC; hitId++) {
1568 DetId rh_detid = hits_and_fractions[hitId].first;
1569 const auto rhFraction = hits_and_fractions[hitId].second;
1571 std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(rh_detid);
1574 auto hit_find_in_LC = detIdToLayerClusterId_Map.find(rh_detid);
1575 if (hit_find_in_LC == detIdToLayerClusterId_Map.end()) {
1576 detIdToLayerClusterId_Map[rh_detid] = std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>();
1580 auto hit_find_in_CP = detIdToCaloParticleId_Map.find(rh_detid);
1588 if (rhFraction == 0.) {
1589 hitsToCaloParticleId[hitId] = -2;
1591 if (hit_find_in_CP == detIdToCaloParticleId_Map.end()) {
1592 hitsToCaloParticleId[hitId] -= 1;
1594 auto maxCPEnergyInLC = 0.f;
1596 for (
auto&
h : hit_find_in_CP->second) {
1597 CPEnergyInLC[
h.clusterId] +=
h.fraction * hit->
energy();
1600 if (CPEnergyInLC[
h.clusterId] > maxCPEnergyInLC) {
1601 maxCPEnergyInLC = CPEnergyInLC[
h.clusterId];
1602 maxCPId =
h.clusterId;
1605 hitsToCaloParticleId[hitId] = maxCPId;
1608 hitsToCaloParticleId[hitId] > 0. ? 0. : hitsToCaloParticleId[hitId]);
1616 for (
unsigned int lcId = 0; lcId < nLayerClusters; ++lcId) {
1617 const std::vector<std::pair<DetId, float>>& hits_and_fractions = clusters[lcId].hitsAndFractions();
1618 const auto firstHitDetId = hits_and_fractions[0].first;
1619 const int lcLayerId =
1625 const auto& cpsIt = cpsInLayerClusterMap.
find(lcRef);
1626 if (cpsIt == cpsInLayerClusterMap.
end())
1629 const auto& cps = cpsIt->
val;
1630 if (clusters[lcId].
energy() == 0. && !cps.empty()) {
1631 for (
const auto& cpPair : cps) {
1636 for (
const auto& cpPair : cps) {
1637 LogDebug(
"HGCalValidator") <<
"layerCluster Id: \t" << lcId <<
"\t CP id: \t" << cpPair.first.index()
1638 <<
"\t score \t" << cpPair.second << std::endl;
1640 auto const& cp_linked =
1641 std::find_if(
std::begin(cPOnLayerMap[cpPair.first]),
1642 std::end(cPOnLayerMap[cpPair.first]),
1644 return p.first == lcRef;
1647 cPOnLayerMap[cpPair.first].
end())
1650 cp_linked->second.first / clusters[lcId].energy(), clusters[lcId].energy());
1652 cpPair.second, cp_linked->second.first / clusters[lcId].energy());
1663 const auto& best = std::min_element(
1664 std::begin(cps),
std::end(cps), [](
const auto& obj1,
const auto& obj2) {
return obj1.second < obj2.second; });
1665 const auto& best_cp_linked =
1666 std::find_if(
std::begin(cPOnLayerMap[best->first]),
1667 std::end(cPOnLayerMap[best->first]),
1669 return p.first == lcRef;
1671 if (best_cp_linked ==
1672 cPOnLayerMap[best->first].
end())
1675 clusters[lcId].
eta(), best_cp_linked->second.first / clusters[lcId].energy());
1677 clusters[lcId].
phi(), best_cp_linked->second.first / clusters[lcId].energy());
1684 for (
const auto& cpId : cPSelectedIndices) {
1686 const auto& lcsIt = cPOnLayerMap.find(cpRef);
1688 std::map<unsigned int, float> cPEnergyOnLayer;
1689 for (
unsigned int layerId = 0; layerId < layers * 2; ++layerId)
1690 cPEnergyOnLayer[layerId] = 0;
1693 for (
const auto& it_sc : simClusterRefVector) {
1696 for (
const auto& it_haf : hits_and_fractions) {
1697 const DetId hitid = (it_haf.first);
1698 const int cpLayerId =
1699 recHitTools_->getLayerWithOffset(hitid) + layers * ((recHitTools_->zside(hitid) + 1) >> 1) - 1;
1700 std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(hitid);
1701 if (itcheck != hitMap.end()) {
1703 cPEnergyOnLayer[cpLayerId] += it_haf.second * hit->
energy();
1708 for (
unsigned int layerId = 0; layerId < layers * 2; ++layerId) {
1709 if (!cPEnergyOnLayer[layerId])
1712 histograms.h_denom_caloparticle_eta_perlayer.at(layerId)->
Fill(cP[cpId].g4Tracks()[0].momentum().
eta());
1713 histograms.h_denom_caloparticle_phi_perlayer.at(layerId)->
Fill(cP[cpId].g4Tracks()[0].momentum().
phi());
1715 if (lcsIt == cPOnLayerMap.end())
1717 const auto& lcs = lcsIt->val;
1719 auto getLCLayerId = [&](
const unsigned int lcId) {
1720 const std::vector<std::pair<DetId, float>>& hits_and_fractions =
clusters[lcId].hitsAndFractions();
1721 const auto firstHitDetId = hits_and_fractions[0].first;
1722 const unsigned int lcLayerId = recHitTools_->getLayerWithOffset(firstHitDetId) +
1723 layers * ((recHitTools_->zside(firstHitDetId) + 1) >> 1) - 1;
1727 for (
const auto& lcPair : lcs) {
1728 if (getLCLayerId(lcPair.first.index()) != layerId)
1730 histograms.h_score_caloparticle2layercl_perlayer.at(layerId)->
Fill(lcPair.second.second);
1731 histograms.h_sharedenergy_caloparticle2layercl_perlayer.at(layerId)->
Fill(
1732 lcPair.second.first / cPEnergyOnLayer[layerId], cPEnergyOnLayer[layerId]);
1733 histograms.h_energy_vs_score_caloparticle2layercl_perlayer.at(layerId)->
Fill(
1734 lcPair.second.second, lcPair.second.first / cPEnergyOnLayer[layerId]);
1737 if (getLCLayerId(
obj.first.index()) != layerId)
1743 histograms.h_num_caloparticle_eta_perlayer.at(layerId)->
Fill(cP[cpId].g4Tracks()[0].momentum().
eta());
1744 histograms.h_num_caloparticle_phi_perlayer.at(layerId)->
Fill(cP[cpId].g4Tracks()[0].momentum().
phi());
1746 histograms.h_numDup_caloparticle_eta_perlayer.at(layerId)->
Fill(cP[cpId].g4Tracks()[0].momentum().
eta());
1747 histograms.h_numDup_caloparticle_phi_perlayer.at(layerId)->
Fill(cP[cpId].g4Tracks()[0].momentum().
phi());
1749 const auto best = std::min_element(
std::begin(lcs),
std::end(lcs), [&](
const auto& obj1,
const auto& obj2) {
1750 if (getLCLayerId(obj1.first.index()) != layerId)
1752 else if (getLCLayerId(obj2.first.index()) == layerId)
1753 return obj1.second.second < obj2.second.second;
1757 histograms.h_sharedenergy_caloparticle2layercl_vs_eta_perlayer.at(layerId)->
Fill(
1758 cP[cpId].g4Tracks()[0].momentum().
eta(), best->second.first / cPEnergyOnLayer[layerId]);
1759 histograms.h_sharedenergy_caloparticle2layercl_vs_phi_perlayer.at(layerId)->
Fill(
1760 cP[cpId].g4Tracks()[0].momentum().
phi(), best->second.first / cPEnergyOnLayer[layerId]);
1771 edm::Handle<std::vector<SimCluster>> simClusterHandle,
1772 std::vector<SimCluster>
const& sC,
1773 std::vector<size_t>
const& sCIndices,
1774 const std::vector<float>& mask,
1775 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap,
1776 unsigned int layers,
1779 auto nLayerClusters = clusters.size();
1784 for (
unsigned int lcId = 0; lcId < nLayerClusters; ++lcId) {
1785 if (mask[lcId] != 0.) {
1786 LogDebug(
"HGCalValidator") <<
"Skipping layer cluster " << lcId <<
" not belonging to mask" << std::endl;
1789 const std::vector<std::pair<DetId, float>>& hits_and_fractions = clusters[lcId].hitsAndFractions();
1790 const auto firstHitDetId = hits_and_fractions[0].first;
1791 const int lcLayerId =
1799 const auto& scsIt = scsInLayerClusterMap.
find(lcRef);
1800 if (scsIt == scsInLayerClusterMap.
end())
1803 const auto& scs = scsIt->
val;
1806 if (clusters[lcId].
energy() == 0. && !scs.empty()) {
1807 for (
const auto& scPair : scs) {
1813 for (
const auto& scPair : scs) {
1814 LogDebug(
"HGCalValidator") <<
"layerCluster Id: \t" << lcId <<
"\t SC id: \t" << scPair.first.index()
1815 <<
"\t score \t" << scPair.second << std::endl;
1818 auto const& sc_linked =
1819 std::find_if(
std::begin(lcsInSimClusterMap[scPair.first]),
1820 std::end(lcsInSimClusterMap[scPair.first]),
1822 return p.first == lcRef;
1825 lcsInSimClusterMap[scPair.first].
end())
1828 sc_linked->second.first / clusters[lcId].energy(), clusters[lcId].energy());
1830 scPair.second, sc_linked->second.first / clusters[lcId].energy());
1842 const auto& best = std::min_element(
1843 std::begin(scs),
std::end(scs), [](
const auto& obj1,
const auto& obj2) {
return obj1.second < obj2.second; });
1845 const auto& best_sc_linked =
1846 std::find_if(
std::begin(lcsInSimClusterMap[best->first]),
1847 std::end(lcsInSimClusterMap[best->first]),
1849 return p.first == lcRef;
1851 if (best_sc_linked ==
1852 lcsInSimClusterMap[best->first].
end())
1855 clusters[lcId].
eta(), best_sc_linked->second.first / clusters[lcId].energy());
1857 clusters[lcId].
phi(), best_sc_linked->second.first / clusters[lcId].energy());
1864 for (
const auto& scId : sCIndices) {
1866 const auto& lcsIt = lcsInSimClusterMap.find(scRef);
1868 std::map<unsigned int, float> sCEnergyOnLayer;
1869 for (
unsigned int layerId = 0; layerId < layers * 2; ++layerId)
1870 sCEnergyOnLayer[layerId] = 0;
1872 const auto& hits_and_fractions = sC[scId].hits_and_fractions();
1873 for (
const auto& it_haf : hits_and_fractions) {
1874 const DetId hitid = (it_haf.first);
1875 const int scLayerId =
1876 recHitTools_->getLayerWithOffset(hitid) + layers * ((recHitTools_->zside(hitid) + 1) >> 1) - 1;
1877 std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(hitid);
1878 if (itcheck != hitMap.end()) {
1880 sCEnergyOnLayer[scLayerId] += it_haf.second * hit->
energy();
1884 for (
unsigned int layerId = 0; layerId < layers * 2; ++layerId) {
1885 if (!sCEnergyOnLayer[layerId])
1888 histograms.h_denom_simcluster_eta_perlayer[
count].at(layerId)->
Fill(sC[scId].
eta());
1889 histograms.h_denom_simcluster_phi_perlayer[
count].at(layerId)->
Fill(sC[scId].
phi());
1891 if (lcsIt == lcsInSimClusterMap.end())
1893 const auto& lcs = lcsIt->val;
1895 auto getLCLayerId = [&](
const unsigned int lcId) {
1896 const std::vector<std::pair<DetId, float>>& hits_and_fractions =
clusters[lcId].hitsAndFractions();
1897 const auto firstHitDetId = hits_and_fractions[0].first;
1898 const unsigned int lcLayerId = recHitTools_->getLayerWithOffset(firstHitDetId) +
1899 layers * ((recHitTools_->zside(firstHitDetId) + 1) >> 1) - 1;
1904 for (
const auto& lcPair : lcs) {
1905 auto lcId = lcPair.first.index();
1906 if (mask[lcId] != 0.) {
1907 LogDebug(
"HGCalValidator") <<
"Skipping layer cluster " << lcId <<
" not belonging to mask" << std::endl;
1911 if (getLCLayerId(lcId) != layerId)
1913 histograms.h_score_simcluster2layercl_perlayer[
count].at(layerId)->
Fill(lcPair.second.second);
1914 histograms.h_sharedenergy_simcluster2layercl_perlayer[
count].at(layerId)->
Fill(
1915 lcPair.second.first / sCEnergyOnLayer[layerId], sCEnergyOnLayer[layerId]);
1916 histograms.h_energy_vs_score_simcluster2layercl_perlayer[
count].at(layerId)->
Fill(
1917 lcPair.second.second, lcPair.second.first / sCEnergyOnLayer[layerId]);
1920 if (getLCLayerId(
obj.first.index()) != layerId)
1926 histograms.h_num_simcluster_eta_perlayer[
count].at(layerId)->
Fill(sC[scId].
eta());
1927 histograms.h_num_simcluster_phi_perlayer[
count].at(layerId)->
Fill(sC[scId].
phi());
1929 histograms.h_numDup_simcluster_eta_perlayer[
count].at(layerId)->
Fill(sC[scId].
eta());
1930 histograms.h_numDup_simcluster_phi_perlayer[
count].at(layerId)->
Fill(sC[scId].
phi());
1932 const auto best = std::min_element(
std::begin(lcs),
std::end(lcs), [&](
const auto& obj1,
const auto& obj2) {
1933 if (getLCLayerId(obj1.first.index()) != layerId)
1935 else if (getLCLayerId(obj2.first.index()) == layerId)
1936 return obj1.second.second < obj2.second.second;
1940 histograms.h_sharedenergy_simcluster2layercl_vs_eta_perlayer[
count].at(layerId)->
Fill(
1941 sC[scId].
eta(), best->second.first / sCEnergyOnLayer[layerId]);
1942 histograms.h_sharedenergy_simcluster2layercl_vs_phi_perlayer[
count].at(layerId)->
Fill(
1943 sC[scId].
phi(), best->second.first / sCEnergyOnLayer[layerId]);
1954 edm::Handle<std::vector<CaloParticle>> caloParticleHandle,
1955 std::vector<CaloParticle>
const& cP,
1956 std::vector<size_t>
const& cPIndices,
1957 std::vector<size_t>
const& cPSelectedIndices,
1958 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap,
1959 std::map<double, double> cummatbudg,
1960 unsigned int layers,
1961 std::vector<int> thicknesses,
1972 std::vector<int> tnlcpl(1000, 0);
1975 std::map<std::string, int> tnlcpthplus;
1976 tnlcpthplus.clear();
1977 std::map<std::string, int> tnlcpthminus;
1978 tnlcpthminus.clear();
1980 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
1981 tnlcpthplus.insert(std::pair<std::string, int>(std::to_string(*it), 0));
1982 tnlcpthminus.insert(std::pair<std::string, int>(std::to_string(*it), 0));
1985 tnlcpthplus.insert(std::pair<std::string, int>(
"mixed", 0));
1986 tnlcpthminus.insert(std::pair<std::string, int>(
"mixed", 0));
1997 cpsInLayerClusterMap,
2002 std::vector<double> tecpl(1000, 0.0);
2004 std::vector<double> ldbar(1000, 0.0);
2007 double caloparteneplus = 0.;
2008 double caloparteneminus = 0.;
2009 for (
const auto& cpId : cPIndices) {
2010 if (cP[cpId].
eta() >= 0.) {
2011 caloparteneplus = caloparteneplus + cP[cpId].energy();
2012 }
else if (cP[cpId].
eta() < 0.) {
2013 caloparteneminus = caloparteneminus + cP[cpId].energy();
2018 for (
unsigned int lcId = 0; lcId < clusters.size(); lcId++) {
2019 const std::vector<std::pair<DetId, float>> hits_and_fractions = clusters[lcId].hitsAndFractions();
2021 const DetId seedid = clusters[lcId].seed();
2022 const double seedx =
recHitTools_->getPosition(seedid).x();
2023 const double seedy =
recHitTools_->getPosition(seedid).y();
2031 int nthhits120p = 0;
2032 int nthhits200p = 0;
2033 int nthhits300p = 0;
2034 int nthhitsscintp = 0;
2035 int nthhits120m = 0;
2036 int nthhits200m = 0;
2037 int nthhits300m = 0;
2038 int nthhitsscintm = 0;
2040 double thickness = 0.;
2049 bool cluslay =
true;
2053 for (
std::vector<std::pair<DetId, float>>::const_iterator it_haf = hits_and_fractions.begin();
2054 it_haf != hits_and_fractions.end();
2056 const DetId rh_detid = it_haf->first;
2066 LogDebug(
"HGCalValidator") <<
"These are HGCal layer clusters, you shouldn't be here !!! " << layerid <<
"\n";
2071 std::string curistr = std::to_string((
int)thickness);
2073 while (lay_string.size() < 2)
2074 lay_string.insert(0,
"0");
2075 curistr +=
"_" + lay_string;
2082 if ((thickness == 120.) && (
recHitTools_->zside(rh_detid) > 0.)) {
2084 }
else if ((thickness == 120.) && (
recHitTools_->zside(rh_detid) < 0.)) {
2086 }
else if ((thickness == 200.) && (
recHitTools_->zside(rh_detid) > 0.)) {
2088 }
else if ((thickness == 200.) && (
recHitTools_->zside(rh_detid) < 0.)) {
2090 }
else if ((thickness == 300.) && (
recHitTools_->zside(rh_detid) > 0.)) {
2092 }
else if ((thickness == 300.) && (
recHitTools_->zside(rh_detid) < 0.)) {
2094 }
else if ((thickness == -1) && (
recHitTools_->zside(rh_detid) > 0.)) {
2096 }
else if ((thickness == -1) && (
recHitTools_->zside(rh_detid) < 0.)) {
2100 <<
" You are running a geometry that contains thicknesses different than the normal ones. "
2104 std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(rh_detid);
2105 if (itcheck == hitMap.end()) {
2106 LogDebug(
"HGCalValidator") <<
" You shouldn't be here - Unable to find a hit " << rh_detid.
rawId() <<
" "
2115 const double hit_x =
recHitTools_->getPosition(rh_detid).x();
2116 const double hit_y =
recHitTools_->getPosition(rh_detid).y();
2117 double distancetoseed =
distance(seedx, seedy, hit_x, hit_y);
2118 double distancetomax =
distance(maxx, maxy, hit_x, hit_y);
2136 std::map<DetId, float>::const_iterator dit = densities.find(rh_detid);
2137 if (dit == densities.end()) {
2138 LogDebug(
"HGCalValidator") <<
" You shouldn't be here - Unable to find a density " << rh_detid.
rawId() <<
" "
2150 if ((nthhits120p != 0 && nthhits200p != 0) || (nthhits120p != 0 && nthhits300p != 0) ||
2151 (nthhits120p != 0 && nthhitsscintp != 0) || (nthhits200p != 0 && nthhits300p != 0) ||
2152 (nthhits200p != 0 && nthhitsscintp != 0) || (nthhits300p != 0 && nthhitsscintp != 0)) {
2153 tnlcpthplus[
"mixed"]++;
2154 }
else if ((nthhits120p != 0 || nthhits200p != 0 || nthhits300p != 0 || nthhitsscintp != 0)) {
2156 tnlcpthplus[std::to_string((
int)thickness)]++;
2158 if ((nthhits120m != 0 && nthhits200m != 0) || (nthhits120m != 0 && nthhits300m != 0) ||
2159 (nthhits120m != 0 && nthhitsscintm != 0) || (nthhits200m != 0 && nthhits300m != 0) ||
2160 (nthhits200m != 0 && nthhitsscintm != 0) || (nthhits300m != 0 && nthhitsscintm != 0)) {
2161 tnlcpthminus[
"mixed"]++;
2162 }
else if ((nthhits120m != 0 || nthhits200m != 0 || nthhits300m != 0 || nthhitsscintm != 0)) {
2164 tnlcpthminus[std::to_string((
int)thickness)]++;
2168 std::vector<int> bigamoth;
2171 bigamoth.push_back(nthhits120p);
2172 bigamoth.push_back(nthhits200p);
2173 bigamoth.push_back(nthhits300p);
2174 bigamoth.push_back(nthhitsscintp);
2175 }
else if (zside < 0) {
2176 bigamoth.push_back(nthhits120m);
2177 bigamoth.push_back(nthhits200m);
2178 bigamoth.push_back(nthhits300m);
2179 bigamoth.push_back(nthhitsscintm);
2181 auto bgth = std::max_element(bigamoth.begin(), bigamoth.end());
2182 istr = std::to_string(thicknesses[
std::distance(bigamoth.begin(), bgth)]);
2184 while (lay_string.size() < 2)
2185 lay_string.insert(0,
"0");
2186 istr +=
"_" + lay_string;
2194 double distancebetseedandmax =
distance(seedx, seedy, maxx, maxy);
2196 std::string seedstr = std::to_string((
int)
recHitTools_->getSiThickness(seedid)) +
"_" + std::to_string(layerid);
2197 seedstr +=
"_" + lay_string;
2203 clusters[lcId].
energy());
2207 tecpl[layerid] = tecpl[layerid] + clusters[lcId].energy();
2208 ldbar[layerid] = ldbar[layerid] + clusters[lcId].energy() * cummatbudg[(double)lay];
2214 double sumeneallcluspl = 0.;
2215 double sumeneallclusmi = 0.;
2217 double sumldbarpl = 0.;
2218 double sumldbarmi = 0.;
2220 for (
unsigned ilayer = 0; ilayer < layers * 2; ++ilayer) {
2226 if (ilayer < layers) {
2228 if (caloparteneminus != 0.) {
2233 sumeneallclusmi = sumeneallclusmi + tecpl[ilayer];
2235 sumldbarmi = sumldbarmi + ldbar[ilayer];
2238 if (caloparteneplus != 0.) {
2243 sumeneallcluspl = sumeneallcluspl + tecpl[ilayer];
2245 sumldbarpl = sumldbarpl + ldbar[ilayer];
2251 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
2262 if (caloparteneplus != 0.) {
2265 if (caloparteneminus != 0.) {
2279 std::vector<CaloParticle>
const& cP,
2280 std::vector<size_t>
const& cPIndices,
2281 std::vector<size_t>
const& cPSelectedIndices,
2282 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap,
2283 unsigned int layers)
const {
2284 auto nTracksters = tracksters.size();
2285 auto nSimTracksters = simTSFromCP.size();
2287 auto nCaloParticles = cPIndices.size();
2289 std::unordered_map<DetId, std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>> detIdSimTSId_Map;
2290 std::unordered_map<DetId, std::vector<HGVHistoProducerAlgo::detIdInfoInTrackster>> detIdToTracksterId_Map;
2291 std::vector<int> tracksters_fakemerge(nTracksters, 0);
2292 std::vector<int> tracksters_duplicate(nTracksters, 0);
2297 std::vector<std::vector<std::pair<unsigned int, float>>> stsInTrackster;
2298 stsInTrackster.resize(nTracksters);
2307 std::unordered_map<int, std::vector<caloParticleOnLayer>> cPOnLayer;
2308 for (
unsigned int i = 0;
i < nCaloParticles; ++
i) {
2309 auto cpIndex = cPIndices[
i];
2310 cPOnLayer[cpIndex].resize(layers * 2);
2311 for (
unsigned int j = 0;
j < layers * 2; ++
j) {
2312 cPOnLayer[cpIndex][
j].caloParticleId = cpIndex;
2313 cPOnLayer[cpIndex][
j].energy = 0.f;
2314 cPOnLayer[cpIndex][
j].hits_and_fractions.clear();
2318 for (
unsigned int iSTS = 0; iSTS < nSimTracksters; ++iSTS) {
2319 const auto& cpId = simTSFromCP[iSTS].seedIndex();
2320 if (
std::find(cPIndices.begin(), cPIndices.end(), cpId) == cPIndices.end())
2326 for (
const auto& it_sc : simClusterRefVector) {
2329 for (
const auto& it_haf : hits_and_fractions) {
2330 DetId hitid = (it_haf.first);
2334 std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(hitid);
2336 if (itcheck != hitMap.end()) {
2345 auto hit_find_it = detIdSimTSId_Map.find(hitid);
2346 if (hit_find_it == detIdSimTSId_Map.end()) {
2347 detIdSimTSId_Map[hitid] = std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>();
2351 detIdSimTSId_Map[hitid].
end(),
2353 if (findHitIt != detIdSimTSId_Map[hitid].
end()) {
2354 findHitIt->fraction += it_haf.second;
2362 cPOnLayer[cpId][cpLayerId].energy += it_haf.second * hit->
energy();
2369 auto& haf = cPOnLayer[cpId][cpLayerId].hits_and_fractions;
2370 auto found = std::find_if(
2371 std::begin(haf),
std::end(haf), [&hitid](
const std::pair<DetId, float>&
v) {
return v.first == hitid; });
2372 if (
found != haf.end()) {
2373 found->second += it_haf.second;
2375 cPOnLayer[cpId][cpLayerId].hits_and_fractions.emplace_back(hitid, it_haf.second);
2383 std::vector<std::pair<DetId, float>> hits_and_fractions_norm;
2385 std::for_each(
std::begin(trackster.vertices()),
std::end(trackster.vertices()), [&](
unsigned int idx) {
2386 const auto fraction = 1.f / trackster.vertex_multiplicity(lcInTst++);
2387 for (
const auto& cell : layerClusters[idx].hitsAndFractions()) {
2388 hits_and_fractions_norm.emplace_back(cell.first, cell.second *
fraction);
2391 return hits_and_fractions_norm;
2395 for (
unsigned int tstId = 0; tstId < nTracksters; ++tstId) {
2396 if (tracksters[tstId].
vertices().empty())
2399 std::unordered_map<unsigned, float> CPEnergyInTS;
2400 int maxCPId_byNumberOfHits = -1;
2401 unsigned int maxCPNumberOfHitsInTS = 0;
2402 int maxCPId_byEnergy = -1;
2403 float maxEnergySharedTSandCP = 0.f;
2404 float energyFractionOfTSinCP = 0.f;
2405 float energyFractionOfCPinTS = 0.f;
2412 std::unordered_map<unsigned, unsigned> occurrencesCPinTS;
2413 unsigned int numberOfNoiseHitsInTS = 0;
2414 unsigned int numberOfHaloHitsInTS = 0;
2416 const auto tst_hitsAndFractions = apply_LCMultiplicity(tracksters[tstId], layerClusters);
2417 const auto numberOfHitsInTS = tst_hitsAndFractions.size();
2436 std::vector<int> hitsToCaloParticleId(numberOfHitsInTS);
2441 for (
unsigned int hitId = 0; hitId < numberOfHitsInTS; hitId++) {
2442 const auto rh_detid = tst_hitsAndFractions[hitId].first;
2443 const auto rhFraction = tst_hitsAndFractions[hitId].second;
2445 const int lcLayerId =
2448 std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(rh_detid);
2458 auto hit_find_in_LC = detIdToTracksterId_Map.find(rh_detid);
2459 if (hit_find_in_LC == detIdToTracksterId_Map.end()) {
2460 detIdToTracksterId_Map[rh_detid] = std::vector<HGVHistoProducerAlgo::detIdInfoInTrackster>();
2462 detIdToTracksterId_Map[rh_detid].emplace_back(
2466 auto hit_find_in_STS = detIdSimTSId_Map.find(rh_detid);
2474 if (rhFraction == 0.) {
2475 hitsToCaloParticleId[hitId] = -2;
2476 numberOfHaloHitsInTS++;
2478 if (hit_find_in_STS == detIdSimTSId_Map.end()) {
2479 hitsToCaloParticleId[hitId] -= 1;
2481 auto maxCPEnergyInTS = 0.f;
2483 for (
const auto&
h : hit_find_in_STS->second) {
2484 auto shared_fraction =
std::min(rhFraction,
h.fraction);
2489 const auto cpId = simTSFromCP[
h.clusterId].seedIndex();
2490 CPEnergyInTS[cpId] += shared_fraction * hit->
energy();
2493 cPOnLayer[cpId][lcLayerId].layerClusterIdToEnergyAndScore[tstId].first += shared_fraction * hit->
energy();
2494 cPOnLayer[cpId][lcLayerId].layerClusterIdToEnergyAndScore[tstId].second = FLT_MAX;
2497 stsInTrackster[tstId].emplace_back(
h.clusterId, FLT_MAX);
2500 if (shared_fraction > maxCPEnergyInTS) {
2502 maxCPEnergyInTS = CPEnergyInTS[cpId];
2507 hitsToCaloParticleId[hitId] = maxCPId;
2514 for (
auto c : hitsToCaloParticleId) {
2516 numberOfNoiseHitsInTS++;
2518 occurrencesCPinTS[
c]++;
2524 for (
auto&
c : occurrencesCPinTS) {
2525 if (
c.second > maxCPNumberOfHitsInTS) {
2526 maxCPId_byNumberOfHits =
c.first;
2527 maxCPNumberOfHitsInTS =
c.second;
2532 for (
auto&
c : CPEnergyInTS) {
2533 if (
c.second > maxEnergySharedTSandCP) {
2534 maxCPId_byEnergy =
c.first;
2535 maxEnergySharedTSandCP =
c.second;
2539 float totalCPEnergyFromLayerCP = 0.f;
2540 if (maxCPId_byEnergy >= 0) {
2542 for (
unsigned int j = 0;
j < layers * 2; ++
j) {
2543 totalCPEnergyFromLayerCP = totalCPEnergyFromLayerCP + cPOnLayer[maxCPId_byEnergy][
j].energy;
2545 energyFractionOfCPinTS = maxEnergySharedTSandCP / totalCPEnergyFromLayerCP;
2546 if (tracksters[tstId].raw_energy() > 0.
f) {
2547 energyFractionOfTSinCP = maxEnergySharedTSandCP / tracksters[tstId].raw_energy();
2551 LogDebug(
"HGCalValidator") << std::setw(12) <<
"Trackster"
2553 << std::setw(10) <<
"energy"
2554 <<
"\t" << std::setw(5) <<
"nhits"
2555 <<
"\t" << std::setw(12) <<
"noise hits"
2556 <<
"\t" << std::setw(22) <<
"maxCPId_byNumberOfHits"
2557 <<
"\t" << std::setw(8) <<
"nhitsCP"
2558 <<
"\t" << std::setw(16) <<
"maxCPId_byEnergy"
2559 <<
"\t" << std::setw(23) <<
"maxEnergySharedTSandCP"
2560 <<
"\t" << std::setw(22) <<
"totalCPEnergyFromAllLayerCP"
2561 <<
"\t" << std::setw(22) <<
"energyFractionOfTSinCP"
2562 <<
"\t" << std::setw(25) <<
"energyFractionOfCPinTS"
2563 <<
"\t" << std::endl;
2564 LogDebug(
"HGCalValidator") << std::setw(12) << tstId <<
"\t"
2565 << std::setw(10) << tracksters[tstId].raw_energy() <<
"\t" << std::setw(5)
2566 << numberOfHitsInTS <<
"\t" << std::setw(12) << numberOfNoiseHitsInTS <<
"\t"
2567 << std::setw(22) << maxCPId_byNumberOfHits <<
"\t" << std::setw(8)
2568 << maxCPNumberOfHitsInTS <<
"\t" << std::setw(16) << maxCPId_byEnergy <<
"\t"
2569 << std::setw(23) << maxEnergySharedTSandCP <<
"\t" << std::setw(22)
2570 << totalCPEnergyFromLayerCP <<
"\t" << std::setw(22) << energyFractionOfTSinCP <<
"\t"
2571 << std::setw(25) << energyFractionOfCPinTS << std::endl;
2576 for (
unsigned int tstId = 0; tstId < nTracksters; ++tstId) {
2582 std::sort(stsInTrackster[tstId].
begin(), stsInTrackster[tstId].
end());
2584 stsInTrackster[tstId].erase(
last, stsInTrackster[tstId].
end());
2586 if (tracksters[tstId].raw_energy() == 0. && !stsInTrackster[tstId].
empty()) {
2588 for (
auto& stsPair : stsInTrackster[tstId]) {
2590 stsPair.second = 1.;
2591 LogDebug(
"HGCalValidator") <<
"Trackster Id: \t" << tstId <<
"\t SimTrackster id: \t" << stsPair.first
2592 <<
"\t score \t" << stsPair.second << std::endl;
2598 const auto tst_hitsAndFractions = apply_LCMultiplicity(tracksters[tstId], layerClusters);
2601 float invTracksterEnergyWeight = 0.f;
2602 for (
const auto& haf : tst_hitsAndFractions) {
2603 invTracksterEnergyWeight +=
2604 (haf.second * hitMap.at(haf.first)->energy()) * (haf.second * hitMap.at(haf.first)->energy());
2606 invTracksterEnergyWeight = 1.f / invTracksterEnergyWeight;
2608 for (
unsigned int i = 0;
i < tst_hitsAndFractions.size(); ++
i) {
2609 const auto rh_detid = tst_hitsAndFractions[
i].first;
2610 const auto rhFraction = tst_hitsAndFractions[
i].second;
2611 bool hitWithNoSTS =
false;
2613 auto hit_find_in_STS = detIdSimTSId_Map.find(rh_detid);
2614 if (hit_find_in_STS == detIdSimTSId_Map.end())
2615 hitWithNoSTS =
true;
2616 auto itcheck = hitMap.find(rh_detid);
2620 for (
auto& stsPair : stsInTrackster[tstId]) {
2621 float cpFraction = 0.f;
2622 if (!hitWithNoSTS) {
2624 detIdSimTSId_Map[rh_detid].
end(),
2626 if (findHitIt != detIdSimTSId_Map[rh_detid].
end()) {
2627 cpFraction = findHitIt->fraction;
2630 if (stsPair.second == FLT_MAX) {
2631 stsPair.second = 0.f;
2634 (rhFraction - cpFraction) * (rhFraction - cpFraction) * hitEnergyWeight * invTracksterEnergyWeight;
2639 if (stsInTrackster[tstId].
empty())
2640 LogDebug(
"HGCalValidator") <<
"Trackster Id: \t" << tstId <<
"\tCP id:\t-1 "
2644 const auto score = std::min_element(
std::begin(stsInTrackster[tstId]),
2646 [](
const auto& obj1,
const auto& obj2) {
return obj1.second < obj2.second; });
2647 for (
auto& stsPair : stsInTrackster[tstId]) {
2648 const auto& cpId = simTSFromCP[stsPair.first].seedIndex();
2649 LogDebug(
"HGCalValidator") <<
"Trackster Id: \t" << tstId <<
"\t CP id: \t" << cpId <<
"\t score \t"
2650 << stsPair.second << std::endl;
2651 float sharedeneCPallLayers = 0.;
2652 for (
unsigned int j = 0;
j < layers * 2; ++
j) {
2653 auto const& cp_linked = cPOnLayer[cpId][
j].layerClusterIdToEnergyAndScore[tstId];
2654 sharedeneCPallLayers += cp_linked.first;
2656 LogDebug(
"HGCalValidator") <<
"sharedeneCPallLayers " << sharedeneCPallLayers << std::endl;
2657 if (stsPair.first == score->first) {
2660 tracksters[tstId].raw_energy());
2662 score->second, sharedeneCPallLayers / tracksters[tstId].raw_energy());
2665 auto assocFakeMerge = std::count_if(
std::begin(stsInTrackster[tstId]),
2668 tracksters_fakemerge[tstId] = assocFakeMerge;
2671 std::unordered_map<int, std::vector<float>> score3d;
2672 std::unordered_map<int, std::vector<float>> tstSharedEnergy;
2673 std::unordered_map<int, std::vector<float>> tstSharedEnergyFrac;
2675 for (
unsigned int i = 0;
i < nCaloParticles; ++
i) {
2676 auto cpIndex = cPIndices[
i];
2677 score3d[cpIndex].resize(nTracksters);
2678 tstSharedEnergy[cpIndex].resize(nTracksters);
2679 tstSharedEnergyFrac[cpIndex].resize(nTracksters);
2680 for (
unsigned int j = 0;
j < nTracksters; ++
j) {
2681 score3d[cpIndex][
j] = FLT_MAX;
2682 tstSharedEnergy[cpIndex][
j] = 0.f;
2683 tstSharedEnergyFrac[cpIndex][
j] = 0.f;
2690 for (
unsigned int iSTS = 0; iSTS < nSimTracksters; ++iSTS) {
2691 const auto& cpId = simTSFromCP[iSTS].seedIndex();
2692 if (
std::find(cPSelectedIndices.begin(), cPSelectedIndices.end(), cpId) == cPSelectedIndices.end())
2697 std::vector<unsigned int> cpId_tstId_related;
2698 cpId_tstId_related.clear();
2700 float CPenergy = 0.f;
2701 for (
unsigned int layerId = 0; layerId < layers * 2; ++layerId) {
2702 unsigned int CPNumberOfHits = cPOnLayer[cpId][layerId].hits_and_fractions.size();
2704 CPenergy += cPOnLayer[cpId][layerId].energy;
2705 if (CPNumberOfHits == 0)
2707 int tstWithMaxEnergyInCP = -1;
2709 float maxEnergyTSperlayerinCP = 0.f;
2710 float CPEnergyFractionInTSperlayer = 0.f;
2712 for (
const auto& tst : cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore) {
2713 if (tst.second.first > maxEnergyTSperlayerinCP) {
2714 maxEnergyTSperlayerinCP = tst.second.first;
2715 tstWithMaxEnergyInCP = tst.first;
2719 CPEnergyFractionInTSperlayer = maxEnergyTSperlayerinCP / CPenergy;
2721 LogDebug(
"HGCalValidator") << std::setw(8) <<
"LayerId:\t" << std::setw(12) <<
"caloparticle\t" << std::setw(15)
2722 <<
"cp total energy\t" << std::setw(15) <<
"cpEnergyOnLayer\t" << std::setw(14)
2723 <<
"CPNhitsOnLayer\t" << std::setw(18) <<
"tstWithMaxEnergyInCP\t" << std::setw(15)
2724 <<
"maxEnergyTSinCP\t" << std::setw(20) <<
"CPEnergyFractionInTS"
2726 LogDebug(
"HGCalValidator") << std::setw(8) << layerId <<
"\t" << std::setw(12) << cpId <<
"\t" << std::setw(15)
2727 << simTSFromCP[iSTS].raw_energy() <<
"\t" << std::setw(15) << CPenergy <<
"\t"
2728 << std::setw(14) << CPNumberOfHits <<
"\t" << std::setw(18) << tstWithMaxEnergyInCP
2729 <<
"\t" << std::setw(15) << maxEnergyTSperlayerinCP <<
"\t" << std::setw(20)
2730 << CPEnergyFractionInTSperlayer <<
"\n";
2732 for (
unsigned int i = 0;
i < CPNumberOfHits; ++
i) {
2733 auto& cp_hitDetId = cPOnLayer[cpId][layerId].hits_and_fractions[
i].first;
2734 auto& cpFraction = cPOnLayer[cpId][layerId].hits_and_fractions[
i].second;
2736 bool hitWithNoTS =
false;
2737 if (cpFraction == 0.
f)
2739 auto hit_find_in_TS = detIdToTracksterId_Map.find(cp_hitDetId);
2740 if (hit_find_in_TS == detIdToTracksterId_Map.end())
2742 auto itcheck = hitMap.find(cp_hitDetId);
2745 for (
auto& lcPair : cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore) {
2746 unsigned int tracksterId = lcPair.first;
2749 cpId_tstId_related.push_back(tracksterId);
2751 float tstFraction = 0.f;
2754 auto findHitIt =
std::find(detIdToTracksterId_Map[cp_hitDetId].
begin(),
2755 detIdToTracksterId_Map[cp_hitDetId].
end(),
2757 if (findHitIt != detIdToTracksterId_Map[cp_hitDetId].
end())
2758 tstFraction = findHitIt->fraction;
2762 if (lcPair.second.second == FLT_MAX) {
2763 lcPair.second.second = 0.f;
2765 lcPair.second.second += (tstFraction - cpFraction) * (tstFraction - cpFraction) * hitEnergyWeight;
2766 LogDebug(
"HGCalValidator") <<
"TracksterId:\t" << tracksterId <<
"\t"
2767 <<
"cpId:\t" << cpId <<
"\t"
2768 <<
"Layer: " << layerId <<
'\t' <<
"tstfraction,cpfraction:\t" << tstFraction
2769 <<
", " << cpFraction <<
"\t"
2770 <<
"hitEnergyWeight:\t" << hitEnergyWeight <<
"\t"
2772 << (tstFraction - cpFraction) * (tstFraction - cpFraction) * hitEnergyWeight
2774 <<
"currect score numerator:\t" << lcPair.second.second <<
"\t"
2775 <<
"shared Energy:\t" << lcPair.second.first <<
'\n';
2779 if (cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore.empty())
2780 LogDebug(
"HGCalValidator") <<
"CP Id: \t" << cpId <<
"\t TS id:\t-1 "
2781 <<
"\t layer \t " << layerId <<
" Sub score in \t -1"
2784 for (
const auto& lcPair : cPOnLayer[cpId][layerId].layerClusterIdToEnergyAndScore) {
2786 if (score3d[cpId][lcPair.first] == FLT_MAX) {
2787 score3d[cpId][lcPair.first] = 0.f;
2789 score3d[cpId][lcPair.first] += lcPair.second.second;
2790 tstSharedEnergy[cpId][lcPair.first] += lcPair.second.first;
2798 float invCPEnergyWeight = 0.f;
2799 for (
const auto&
layer : cPOnLayer[cpId]) {
2800 for (
const auto& haf :
layer.hits_and_fractions) {
2801 invCPEnergyWeight +=
2802 (haf.second * hitMap.at(haf.first)->energy()) * (haf.second * hitMap.at(haf.first)->energy());
2805 invCPEnergyWeight = 1.f / invCPEnergyWeight;
2809 std::vector<int> cpId_tstId_related_vec(cpId_tstId_related.begin(), cpId_tstId_related.end());
2814 bool cp_considered_efficient =
false;
2815 for (
unsigned int i = 0;
i < cpId_tstId_related_vec.size(); ++
i) {
2816 auto tstId = cpId_tstId_related_vec[
i];
2818 score3d[cpId][tstId] = score3d[cpId][tstId] * invCPEnergyWeight;
2819 tstSharedEnergyFrac[cpId][tstId] = (tstSharedEnergy[cpId][tstId] / CPenergy);
2821 LogDebug(
"HGCalValidator") <<
"CP Id: \t" << cpId <<
"\t TS id: \t" << tstId <<
"\t score \t"
2822 << score3d[cpId][tstId] <<
"\t"
2823 <<
"invCPEnergyWeight \t" << invCPEnergyWeight <<
"\t"
2824 <<
"Trackste energy: \t" << tracksters[tstId].raw_energy() <<
"\t"
2825 <<
"shared energy:\t" << tstSharedEnergy[cpId][tstId] <<
"\t"
2826 <<
"shared energy fraction:\t" << tstSharedEnergyFrac[cpId][tstId] <<
"\n";
2832 tstSharedEnergyFrac[cpId][tstId]);
2835 cp_considered_efficient =
true;
2843 auto assocDup = std::count_if(
std::begin(score3d[cpId]),
std::end(score3d[cpId]), is_assoc);
2852 simTSFromCP[iSTS].barycenter().
eta(), tracksters[bestTstId].raw_energy() / CPenergy);
2854 simTSFromCP[iSTS].barycenter().
phi(), tracksters[bestTstId].raw_energy() / CPenergy);
2855 LogDebug(
"HGCalValidator") << count <<
" " << simTSFromCP[iSTS].barycenter().eta() <<
" "
2856 << simTSFromCP[iSTS].barycenter().phi() <<
" " << tracksters[bestTstId].raw_energy()
2857 <<
" " << CPenergy <<
" " << (tracksters[bestTstId].raw_energy() / CPenergy) <<
" "
2858 << tstSharedEnergyFrac[cpId][bestTstId] <<
'\n';
2861 if (assocDup >= 2) {
2863 while (
match != score3d[cpId].
end()) {
2877 for (
unsigned int tstId = 0; tstId < nTracksters; ++tstId) {
2880 auto assocFakeMerge = tracksters_fakemerge[tstId];
2881 auto assocDuplicate = tracksters_duplicate[tstId];
2882 if (assocDuplicate) {
2886 if (assocFakeMerge > 0) {
2889 auto best = std::min_element(
std::begin(stsInTrackster[tstId]),
2891 [](
const auto& obj1,
const auto& obj2) {
return obj1.second < obj2.second; });
2894 float sharedeneCPallLayers = 0.;
2896 for (
unsigned int j = 0;
j < layers * 2; ++
j) {
2897 auto const& best_cp_linked =
2898 cPOnLayer[simTSFromCP[best->first].seedIndex()][
j].layerClusterIdToEnergyAndScore[tstId];
2899 sharedeneCPallLayers += best_cp_linked.first;
2902 tracksters[tstId].barycenter().
eta(), sharedeneCPallLayers / tracksters[tstId].raw_energy());
2904 tracksters[tstId].barycenter().
phi(), sharedeneCPallLayers / tracksters[tstId].raw_energy());
2906 if (assocFakeMerge >= 2) {
2921 std::vector<CaloParticle>
const& cP,
2922 std::vector<size_t>
const& cPIndices,
2923 std::vector<size_t>
const& cPSelectedIndices,
2924 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap,
2925 unsigned int layers)
const {
2933 int totNContTstZp = 0;
2934 int totNContTstZm = 0;
2936 int totNNotContTstZp = 0;
2937 int totNNotContTstZm = 0;
2939 std::vector<bool> contTracksters;
2940 contTracksters.clear();
2943 std::unordered_map<unsigned int, std::vector<unsigned int>> multiplicity;
2945 std::unordered_map<unsigned int, std::vector<unsigned int>> multiplicity_vs_layer;
2952 auto nTracksters = tracksters.size();
2954 for (
unsigned int tstId = 0; tstId < nTracksters; ++tstId) {
2955 auto nLayerClusters = tracksters[tstId].vertices().size();
2957 if (nLayerClusters == 0)
2960 if (tracksters[tstId].barycenter().
z() < 0.) {
2963 if (tracksters[tstId].barycenter().
z() > 0.) {
2972 std::vector<int> tnLcInTstperlay(1000, 0);
2976 std::set<int> trackster_layers;
2978 bool tracksterInZplus =
false;
2979 bool tracksterInZminus =
false;
2982 for (
const auto lcId : tracksters[tstId].
vertices()) {
2984 const std::vector<std::pair<DetId, float>>& hits_and_fractions = layerClusters[lcId].hitsAndFractions();
2987 multiplicity[tstId].emplace_back(hits_and_fractions.size());
2989 const auto firstHitDetId = hits_and_fractions[0].first;
2991 int layerid =
recHitTools_->getLayerWithOffset(firstHitDetId) +
2992 layers * ((
recHitTools_->zside(firstHitDetId) + 1) >> 1) - 1;
2993 trackster_layers.insert(layerid);
2994 multiplicity_vs_layer[tstId].emplace_back(layerid);
2996 tnLcInTstperlay[layerid]++;
3000 tracksterInZplus =
true;
3003 tracksterInZminus =
true;
3009 for (
unsigned ilayer = 0; ilayer < layers * 2; ++ilayer) {
3014 if (tnLcInTstperlay[ilayer] != 0) {
3020 std::vector<int> trackster_layers_vec(trackster_layers.begin(), trackster_layers.end());
3022 bool contiTrackster =
false;
3024 if (trackster_layers_vec.size() >= 3) {
3025 for (
unsigned int i = 1;
i < trackster_layers_vec.size() - 1; ++
i) {
3026 if ((trackster_layers_vec[
i - 1] + 1 == trackster_layers_vec[
i]) &&
3027 (trackster_layers_vec[i + 1] - 1 == trackster_layers_vec[
i])) {
3029 if (tracksterInZplus) {
3032 if (tracksterInZminus) {
3035 contiTrackster =
true;
3041 if (!contiTrackster) {
3042 if (tracksterInZplus) {
3045 if (tracksterInZminus) {
3051 contTracksters.push_back(contiTrackster);
3055 for (
unsigned int lc = 0; lc < multiplicity[tstId].size(); ++lc) {
3066 if (multiplicity_vs_layer[tstId][lc] < layers) {
3071 mlp, multiplicity_vs_layer[tstId][lc] - layers);
3079 if (!trackster_layers.empty()) {
3102 histograms, count, tracksters, layerClusters, simTSFromCP, cP, cPIndices, cPSelectedIndices, hitMap, layers);
3108 const double y2)
const {
3109 const double dx = x1 - x2;
3110 const double dy = y1 - y2;
3111 return (dx * dx + dy * dy);
3116 const double y2)
const {
3125 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap)
const {
3127 const std::vector<std::pair<DetId, float>>& hits_and_fractions = cluster.
hitsAndFractions();
3130 for (
std::vector<std::pair<DetId, float>>::const_iterator it_haf = hits_and_fractions.begin();
3131 it_haf != hits_and_fractions.end();
3133 DetId rh_detid = it_haf->first;
3135 std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(rh_detid);
3138 if (maxene < hit->
energy()) {
3140 themaxid = rh_detid;
constexpr float energy() const
std::vector< std::unordered_map< int, dqm::reco::MonitorElement * > > h_numDup_simcluster_eta_perlayer
std::vector< std::unordered_map< int, dqm::reco::MonitorElement * > > h_numMerge_layercl_in_simcl_eta_perlayer
std::vector< std::unordered_map< int, dqm::reco::MonitorElement * > > h_sharedenergy_layercl2simcluster_vs_eta_perlayer
std::vector< dqm::reco::MonitorElement * > h_longdepthbarycentre_zplus
std::vector< dqm::reco::MonitorElement * > h_numEff_caloparticle_phi
std::unordered_map< int, dqm::reco::MonitorElement * > h_caloparticle_firstlayer
std::vector< dqm::reco::MonitorElement * > h_energyclustered_zminus
dqm::reco::MonitorElement * lastLayerEEzm
std::vector< std::unordered_map< int, dqm::reco::MonitorElement * > > h_numDup_simcluster_phi_perlayer
std::vector< dqm::reco::MonitorElement * > h_multiplicityOfLCinTST_vs_layerclusterenergy
std::unordered_map< int, dqm::reco::MonitorElement * > h_clusternum_perlayer
void tracksters_to_SimTracksters(const Histograms &histograms, int count, const ticl::TracksterCollection &Tracksters, const reco::CaloClusterCollection &layerClusters, const ticl::TracksterCollection &simTSFromCP, 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
std::vector< std::unordered_map< int, dqm::reco::MonitorElement * > > h_sharedenergy_simcluster2layercl_vs_eta_perlayer
const edm::EventSetup & c
std::vector< dqm::reco::MonitorElement * > h_tracksternum
std::unordered_map< int, dqm::reco::MonitorElement * > h_denom_caloparticle_eta_perlayer
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
double minTSTSharedEneFracEfficiency_
std::vector< dqm::reco::MonitorElement * > h_trackster_x
std::vector< dqm::reco::MonitorElement * > h_trackster_eta
std::vector< dqm::reco::MonitorElement * > h_trackster_phi
const double ScoreCutSCtoLC_
double maxMixedHitsSimCluster_
double minDisToSeedperthickperlayerenewei_
std::vector< dqm::reco::MonitorElement * > h_sharedenergy_trackster2caloparticle_vs_eta
const_iterator end() const
last iterator over the map (read only)
std::unordered_map< int, dqm::reco::MonitorElement * > h_energy_vs_score_layercl2caloparticle_perlayer
double maxTotNsimClsperlay_
std::unordered_map< int, dqm::reco::MonitorElement * > h_simclusternum_perlayer
void bookTracksterHistos(DQMStore::IBooker &ibook, Histograms &histograms, unsigned int layers)
std::unordered_map< std::string, dqm::reco::MonitorElement * > h_distancetomaxcell_perthickperlayer_eneweighted
int nintCellsEneDensperthick_
int nintClEneperthickperlayer_
std::vector< dqm::reco::MonitorElement * > h_multiplicity_zplus_numberOfEventsHistogram
std::unordered_map< int, dqm::reco::MonitorElement * > h_caloparticle_energy
dqm::reco::MonitorElement * maxlayerzp
std::vector< dqm::reco::MonitorElement * > h_score_caloparticle2trackster
void setRecHitTools(std::shared_ptr< hgcal::RecHitTools > recHitTools)
std::vector< dqm::reco::MonitorElement * > h_multiplicity_numberOfEventsHistogram
std::vector< dqm::reco::MonitorElement * > h_clusternum_in_trackster
std::unordered_map< int, dqm::reco::MonitorElement * > h_denom_layercl_eta_perlayer
std::vector< dqm::reco::MonitorElement * > h_denom_caloparticle_phi
const_iterator find(const key_type &k) const
find element with specified reference key
std::vector< dqm::reco::MonitorElement * > h_mixedhitscluster_zplus
constexpr uint32_t rawId() const
get the raw id
std::unordered_map< int, dqm::reco::MonitorElement * > h_num_caloparticle_eta_perlayer
std::vector< dqm::reco::MonitorElement * > h_sharedenergy_caloparticle2trackster
std::unordered_map< int, dqm::reco::MonitorElement * > h_sharedenergy_layercl2caloparticle_perlayer
const double ScoreCutCPtoTSEffDup_
std::vector< dqm::reco::MonitorElement * > h_multiplicity_zminus_numberOfEventsHistogram
double maxTotNClsinTSTsperlayer_
const double ScoreCutLCtoSC_
std::unordered_map< int, dqm::reco::MonitorElement * > h_sharedenergy_layercl2caloparticle_vs_eta_perlayer
std::unordered_map< int, dqm::reco::MonitorElement * > h_energy_vs_score_caloparticle2layercl_perlayer
std::vector< dqm::reco::MonitorElement * > h_denom_trackster_eta
std::vector< std::unordered_map< int, dqm::reco::MonitorElement * > > h_denom_layercl_in_simcl_eta_perlayer
int nintDisToMaxperthickperlayerenewei_
std::vector< dqm::reco::MonitorElement * > h_multiplicityOfLCinTST
dqm::reco::MonitorElement * h_mixedhitssimcluster_zminus
void bookClusterHistos_LCtoCP_association(DQMStore::IBooker &ibook, Histograms &histograms, unsigned int layers)
std::unordered_map< int, dqm::reco::MonitorElement * > h_sharedenergy_caloparticle2layercl_vs_phi_perlayer
std::unordered_map< int, dqm::reco::MonitorElement * > h_simclusternum_perthick
std::unordered_map< int, dqm::reco::MonitorElement * > h_caloparticle_pt
const std::vector< SimTrack > & g4Tracks() const
float eta() const
Momentum pseudorapidity. Note this is taken from the simtrack before the calorimeter.
std::unordered_map< int, dqm::reco::MonitorElement * > h_numDup_caloparticle_eta_perlayer
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::unordered_map< int, dqm::reco::MonitorElement * > h_cellsenedens_perthick
std::vector< dqm::reco::MonitorElement * > h_energy_vs_score_trackster2caloparticle
std::unordered_map< int, dqm::reco::MonitorElement * > h_caloparticle_nHits_matched_energy_layer_1SimCl
std::unordered_map< int, dqm::reco::MonitorElement * > h_sharedenergy_layercl2caloparticle_vs_phi_perlayer
dqm::reco::MonitorElement * h_mixedhitssimcluster_zplus
std::vector< std::unordered_map< int, dqm::reco::MonitorElement * > > h_score_simcluster2layercl_perlayer
int nintDisToMaxperthickperlayer_
std::vector< dqm::reco::MonitorElement * > h_cluster_eta
std::vector< dqm::reco::MonitorElement * > h_numDup_trackster_eta
void bookInfo(DQMStore::IBooker &ibook, Histograms &histograms)
double eta() const
pseudorapidity of cluster centroid
std::vector< dqm::reco::MonitorElement * > h_energyclustered_zplus
std::vector< std::unordered_map< int, dqm::reco::MonitorElement * > > h_denom_simcluster_eta_perlayer
constexpr std::array< uint8_t, layerIndexSize > layer
std::unordered_map< std::string, dqm::reco::MonitorElement * > h_cellsnum_perthickperlayer
std::unordered_map< int, dqm::reco::MonitorElement * > h_caloparticle_nHits_matched_energy_layer
void fill_info_histos(const Histograms &histograms, unsigned int layers) const
double distance(const double x1, const double y1, const double x2, const double y2) const
std::vector< std::unordered_map< int, dqm::reco::MonitorElement * > > h_sharedenergy_layercl2simcluster_vs_phi_perlayer
std::unordered_map< std::string, dqm::reco::MonitorElement * > h_distancebetseedandmaxcell_perthickperlayer
std::unordered_map< int, dqm::reco::MonitorElement * > h_caloparticle_lastlayer_matchedtoRecHit
std::vector< dqm::reco::MonitorElement * > h_nonconttracksternum
void bookSimClusterAssociationHistos(DQMStore::IBooker &ibook, Histograms &histograms, unsigned int layers, std::vector< int > thicknesses)
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
std::vector< dqm::reco::MonitorElement * > h_sharedenergy_trackster2caloparticle_vs_phi
std::vector< dqm::reco::MonitorElement * > h_longdepthbarycentre_zminus
std::unordered_map< std::string, dqm::reco::MonitorElement * > h_distancebetseedandmaxcellvsclusterenergy_perthickperlayer
void bookSimClusterHistos(DQMStore::IBooker &ibook, Histograms &histograms, unsigned int layers, std::vector< int > thicknesses)
std::unordered_map< int, dqm::reco::MonitorElement * > h_energyclustered_perlayer
std::unordered_map< int, dqm::reco::MonitorElement * > h_caloparticle_layersnum
std::vector< dqm::reco::MonitorElement * > h_mixedhitscluster_zminus
std::vector< std::unordered_map< int, dqm::reco::MonitorElement * > > h_energy_vs_score_simcluster2layercl_perlayer
std::vector< std::unordered_map< int, dqm::reco::MonitorElement * > > h_energy_vs_score_layercl2simcluster_perlayer
const SimClusterRefVector & simClusters() const
Monte Carlo truth information used for tracking validation.
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())
std::unordered_map< int, dqm::reco::MonitorElement * > h_clusternum_perthick
std::unordered_map< int, dqm::reco::MonitorElement * > h_sharedenergy_caloparticle2layercl_perlayer
double minClEnepermultiplicity_
std::vector< std::unordered_map< int, dqm::reco::MonitorElement * > > h_num_layercl_in_simcl_phi_perlayer
std::vector< dqm::reco::MonitorElement * > h_numMerge_trackster_phi
std::vector< dqm::reco::MonitorElement * > h_score_trackster2caloparticle
double maxMixedHitsCluster_
double minTotNsimClsperlay_
std::unordered_map< int, dqm::reco::MonitorElement * > h_caloparticle_phi
float energy() const
Energy. Note this is taken from the first SimTrack only.
std::vector< dqm::reco::MonitorElement * > h_clusternum_in_trackster_vs_layer
double minDisSeedToMaxperthickperlayer_
std::vector< std::unordered_map< int, dqm::reco::MonitorElement * > > h_num_layercl_in_simcl_eta_perlayer
std::vector< dqm::reco::MonitorElement * > h_num_trackster_eta
int nintDisToSeedperthickperlayerenewei_
virtual void Fill(const reco::Particle::LorentzVector &p1, const reco::Particle::LorentzVector &p2)
dqm::reco::MonitorElement * maxlayerzm
std::vector< std::unordered_map< int, dqm::reco::MonitorElement * > > h_denom_layercl_in_simcl_phi_perlayer
double minTSTSharedEneFrac_
std::vector< CaloCluster > CaloClusterCollection
collection of CaloCluster objects
double minDisToMaxperthickperlayer_
void bookCaloParticleHistos(DQMStore::IBooker &ibook, Histograms &histograms, int pdgid, unsigned int layers)
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
std::vector< dqm::reco::MonitorElement * > h_sharedenergy_caloparticle2trackster_assoc
std::vector< dqm::reco::MonitorElement * > h_num_caloparticle_phi
double getEta(double eta) const
std::vector< dqm::reco::MonitorElement * > h_numMerge_trackster_eta
int nintTotNClsinTSTsperlayer_
dqm::reco::MonitorElement * lastLayerEEzp
double maxDisToMaxperthickperlayer_
std::vector< dqm::reco::MonitorElement * > h_trackster_lastlayer
const double ScoreCutLCtoCP_
std::unordered_map< std::string, dqm::reco::MonitorElement * > h_distancetomaxcell_perthickperlayer
double maxDisToSeedperthickperlayer_
std::unordered_map< int, dqm::reco::MonitorElement * > h_num_layercl_eta_perlayer
std::vector< dqm::reco::MonitorElement * > h_multiplicityOfLCinTST_vs_layercluster_zplus
std::vector< dqm::reco::MonitorElement * > h_sharedenergy_caloparticle2trackster_vs_phi
double distance2(const double x1, const double y1, const double x2, const double y2) const
std::vector< dqm::reco::MonitorElement * > h_numEff_caloparticle_eta
std::vector< dqm::reco::MonitorElement * > h_multiplicityOfLCinTST_vs_layercluster_zminus
std::vector< dqm::reco::MonitorElement * > h_trackster_z
double maxTotNcellsperthickperlayer_
std::unordered_map< int, dqm::reco::MonitorElement * > h_caloparticle_energyDifference
double maxDisSeedToMaxperthickperlayer_
double minDisToSeedperthickperlayer_
std::unordered_map< int, dqm::reco::MonitorElement * > h_numDup_caloparticle_phi_perlayer
std::vector< std::unordered_map< int, dqm::reco::MonitorElement * > > h_denom_simcluster_phi_perlayer
std::vector< dqm::reco::MonitorElement * > h_denom_caloparticle_eta
std::unordered_map< int, dqm::reco::MonitorElement * > h_num_layercl_phi_perlayer
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 minTotNClsinTSTsperlayer_
double maxDisToSeedperthickperlayerenewei_
std::shared_ptr< hgcal::RecHitTools > recHitTools_
std::unordered_map< int, dqm::reco::MonitorElement * > h_num_caloparticle_phi_perlayer
double maxTotNsimClsperthick_
double minTotNClsperthick_
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
std::unordered_map< int, dqm::reco::MonitorElement * > h_caloparticle_nHitsInSimClusters_matchedtoRecHit
void fill_trackster_histos(const Histograms &histograms, int count, const ticl::TracksterCollection &Tracksters, const reco::CaloClusterCollection &layerClusters, const ticl::TracksterCollection &simTSFromCP, 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
double minTotNsimClsperthick_
MonitorElement * bookInt(TString const &name, FUNC onbooking=NOOP())
std::unordered_map< int, dqm::reco::MonitorElement * > h_caloparticle_eta_Zorigin
std::vector< dqm::reco::MonitorElement * > h_conttracksternum
void fill_cluster_histos(const Histograms &histograms, int count, const reco::CaloCluster &cluster) const
void bookClusterHistos_ClusterLevel(DQMStore::IBooker &ibook, Histograms &histograms, unsigned int layers, std::vector< int > thicknesses, std::string pathtomatbudfile)
float pt() const
Transverse momentum. Note this is taken from the first SimTrack only.
dqm::reco::MonitorElement * lastLayerFHzm
int nintTotNsimClsperlay_
dqm::reco::MonitorElement * lastLayerFHzp
std::unordered_map< int, dqm::reco::MonitorElement * > h_caloparticle_firstlayer_matchedtoRecHit
std::vector< dqm::reco::MonitorElement * > h_sharedenergy_caloparticle2trackster_vs_eta
int nintMixedHitsSimCluster_
std::unordered_map< std::string, dqm::reco::MonitorElement * > h_distancetoseedcell_perthickperlayer_eneweighted
std::unordered_map< int, dqm::reco::MonitorElement * > h_caloparticle_selfenergy
float phi() const
Momentum azimuthal angle. Note this is taken from the first SimTrack only.
std::vector< dqm::reco::MonitorElement * > h_trackster_energy
std::vector< std::unordered_map< int, dqm::reco::MonitorElement * > > h_numMerge_layercl_in_simcl_phi_perlayer
int nintDisSeedToMaxperthickperlayer_
void fill_generic_cluster_histos(const Histograms &histograms, 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
std::unordered_map< int, dqm::reco::MonitorElement * > h_denom_caloparticle_phi_perlayer
const double ScoreCutTStoCPFakeMerge_
std::vector< dqm::reco::MonitorElement * > h_sharedenergy_trackster2caloparticle
std::vector< dqm::reco::MonitorElement * > h_numDup_trackster_phi
double minTotNcellsperthickperlayer_
std::unordered_map< int, dqm::reco::MonitorElement * > h_sharedenergy_caloparticle2layercl_vs_eta_perlayer
double minClEneperthickperlayer_
std::vector< std::unordered_map< int, dqm::reco::MonitorElement * > > h_sharedenergy_simcluster2layercl_vs_phi_perlayer
std::vector< dqm::reco::MonitorElement * > h_trackster_firstlayer
std::unordered_map< int, dqm::reco::MonitorElement * > h_caloparticle_nSimClusters
void bookTracksterCPLinkingHistos(DQMStore::IBooker &ibook, Histograms &histograms)
static int position[264][3]
double minMixedHitsSimCluster_
std::vector< dqm::reco::MonitorElement * > h_trackster_layersnum
double minDisToMaxperthickperlayerenewei_
int nintClEnepermultiplicity_
int nintTotNsimClsperthick_
std::vector< Trackster > TracksterCollection
std::vector< dqm::reco::MonitorElement * > h_energy_vs_score_caloparticle2trackster
size_type size() const
Size of the RefVector.
double maxTotNClsperthick_
std::vector< dqm::reco::MonitorElement * > h_num_trackster_phi
std::unordered_map< int, dqm::reco::MonitorElement * > h_caloparticle_lastlayer
double maxClEnepermultiplicity_
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
std::unordered_map< int, dqm::reco::MonitorElement * > h_cellAssociation_perlayer
std::unordered_map< int, dqm::reco::MonitorElement * > h_caloparticle_nHitsInSimClusters
std::unordered_map< std::string, dqm::reco::MonitorElement * > h_distancetoseedcell_perthickperlayer
void bookClusterHistos_CellLevel(DQMStore::IBooker &ibook, Histograms &histograms, unsigned int layers, std::vector< int > thicknesses)
std::unordered_map< int, dqm::reco::MonitorElement * > h_caloparticle_layersnum_matchedtoRecHit
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
std::vector< dqm::reco::MonitorElement * > h_trackster_y
std::unordered_map< int, dqm::reco::MonitorElement * > h_denom_layercl_phi_perlayer
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
std::unordered_map< int, dqm::reco::MonitorElement * > h_caloparticle_eta
double maxCellsEneDensperthick_
double maxDisToMaxperthickperlayerenewei_
hgcal_clustering::Density Density
const double ScoreCutCPtoLC_
int nintMixedHitsCluster_
double minMixedHitsCluster_
std::unordered_map< int, dqm::reco::MonitorElement * > h_caloparticle_sum_energy_layer
std::vector< std::unordered_map< int, dqm::reco::MonitorElement * > > h_clusternum_in_trackster_perlayer
std::unordered_map< int, dqm::reco::MonitorElement * > h_caloparticle_nHits_matched_energy
double maxClEneperthickperlayer_
std::vector< std::unordered_map< int, dqm::reco::MonitorElement * > > h_sharedenergy_simcluster2layercl_perlayer
DetId findmaxhit(const reco::CaloCluster &cluster, std::unordered_map< DetId, const HGCRecHit * > const &) const
int nintDisToSeedperthickperlayer_
std::unordered_map< int, dqm::reco::MonitorElement * > h_score_layercl2caloparticle_perlayer
std::vector< std::unordered_map< int, dqm::reco::MonitorElement * > > h_sharedenergy_layercl2simcluster_perlayer
std::vector< dqm::reco::MonitorElement * > h_denom_trackster_phi
std::unordered_map< int, dqm::reco::MonitorElement * > h_score_caloparticle2layercl_perlayer
int nintTotNcellsperthickperlayer_
void layerClusters_to_SimClusters(const Histograms &histograms, 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
std::vector< std::unordered_map< int, dqm::reco::MonitorElement * > > h_score_layercl2simcluster_perlayer
std::vector< std::unordered_map< int, dqm::reco::MonitorElement * > > h_num_simcluster_eta_perlayer
HGVHistoProducerAlgo(const edm::ParameterSet &pset)
std::vector< std::unordered_map< int, dqm::reco::MonitorElement * > > h_num_simcluster_phi_perlayer
std::unordered_map< int, dqm::reco::MonitorElement * > h_numMerge_layercl_eta_perlayer
std::vector< std::pair< uint32_t, float > > hits_and_fractions() const
Returns list of rechit IDs and fractions for this SimCluster.
double maxTSTSharedEneFrac_
std::unordered_map< int, dqm::reco::MonitorElement * > h_numMerge_layercl_phi_perlayer
std::vector< dqm::reco::MonitorElement * > h_num_caloparticle_eta
constexpr Detector det() const
get the detector field from this detid
std::vector< dqm::reco::MonitorElement * > h_trackster_pt
double minCellsEneDensperthick_