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")),
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",
268 ibook.
book2D(
"HitFractions",
"Hit fractions;Hit fraction;E_{hit}^{2} fraction", 101, 0, 1.01, 100, 0, 1);
270 "HitFractions_weighted",
"Hit fractions weighted;Hit fraction;E_{hit}^{2} fraction", 101, 0, 1.01, 100, 0, 1);
273 ibook.
book1D(
"First Layer",
"First layer of the CaloParticles", 2 *
layers, 0., (
float)2 *
layers);
275 ibook.
book1D(
"Last Layer",
"Last layer of the CaloParticles", 2 *
layers, 0., (
float)2 *
layers);
277 ibook.
book1D(
"Number of Layers",
"Number of layers of the CaloParticles", 2 *
layers, 0., (
float)2 *
layers);
279 "First Layer (rec-matched hit)",
"First layer of the CaloParticles (matched)", 2 *
layers, 0., (
float)2 *
layers);
281 "Last Layer (rec-matched hit)",
"Last layer of the CaloParticles (matched)", 2 *
layers, 0., (
float)2 *
layers);
283 ibook.
book1D(
"Number of Layers (rec-matched hit)",
284 "Number of layers of the CaloParticles (matched)",
293 std::vector<int> thicknesses) {
295 for (
unsigned ilayer = 0; ilayer < 2 *
layers; ++ilayer) {
297 while (istr1.size() < 2) {
298 istr1.insert(0,
"0");
308 histograms.h_simclusternum_perlayer[ilayer] = ibook.
book1D(
"totsimclusternum_layer_" + istr1,
309 "total number of SimClusters for layer " + istr2,
316 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
318 histograms.h_simclusternum_perthick[(*it)] = ibook.
book1D(
"totsimclusternum_thick_" + istr,
319 "total number of simclusters for thickness " + istr,
328 ibook.
book1D(
"mixedhitssimcluster_zminus",
329 "N of simclusters that contain hits of more than one kind in z-",
335 ibook.
book1D(
"mixedhitssimcluster_zplus",
336 "N of simclusters that contain hits of more than one kind in z+",
345 std::vector<int> thicknesses) {
346 std::unordered_map<int, dqm::reco::MonitorElement*> denom_layercl_in_simcl_eta_perlayer;
347 denom_layercl_in_simcl_eta_perlayer.clear();
348 std::unordered_map<int, dqm::reco::MonitorElement*> denom_layercl_in_simcl_phi_perlayer;
349 denom_layercl_in_simcl_phi_perlayer.clear();
350 std::unordered_map<int, dqm::reco::MonitorElement*> score_layercl2simcluster_perlayer;
351 score_layercl2simcluster_perlayer.clear();
352 std::unordered_map<int, dqm::reco::MonitorElement*> sharedenergy_layercl2simcluster_perlayer;
353 sharedenergy_layercl2simcluster_perlayer.clear();
354 std::unordered_map<int, dqm::reco::MonitorElement*> energy_vs_score_layercl2simcluster_perlayer;
355 energy_vs_score_layercl2simcluster_perlayer.clear();
356 std::unordered_map<int, dqm::reco::MonitorElement*> num_layercl_in_simcl_eta_perlayer;
357 num_layercl_in_simcl_eta_perlayer.clear();
358 std::unordered_map<int, dqm::reco::MonitorElement*> num_layercl_in_simcl_phi_perlayer;
359 num_layercl_in_simcl_phi_perlayer.clear();
360 std::unordered_map<int, dqm::reco::MonitorElement*> numMerge_layercl_in_simcl_eta_perlayer;
361 numMerge_layercl_in_simcl_eta_perlayer.clear();
362 std::unordered_map<int, dqm::reco::MonitorElement*> numMerge_layercl_in_simcl_phi_perlayer;
363 numMerge_layercl_in_simcl_phi_perlayer.clear();
364 std::unordered_map<int, dqm::reco::MonitorElement*> sharedenergy_layercl2simcluster_vs_eta_perlayer;
365 sharedenergy_layercl2simcluster_vs_eta_perlayer.clear();
366 std::unordered_map<int, dqm::reco::MonitorElement*> sharedenergy_layercl2simcluster_vs_phi_perlayer;
367 sharedenergy_layercl2simcluster_vs_phi_perlayer.clear();
368 std::unordered_map<int, dqm::reco::MonitorElement*> denom_simcluster_eta_perlayer;
369 denom_simcluster_eta_perlayer.clear();
370 std::unordered_map<int, dqm::reco::MonitorElement*> denom_simcluster_phi_perlayer;
371 denom_simcluster_phi_perlayer.clear();
372 std::unordered_map<int, dqm::reco::MonitorElement*> score_simcluster2layercl_perlayer;
373 score_simcluster2layercl_perlayer.clear();
374 std::unordered_map<int, dqm::reco::MonitorElement*> sharedenergy_simcluster2layercl_perlayer;
375 sharedenergy_simcluster2layercl_perlayer.clear();
376 std::unordered_map<int, dqm::reco::MonitorElement*> energy_vs_score_simcluster2layercl_perlayer;
377 energy_vs_score_simcluster2layercl_perlayer.clear();
378 std::unordered_map<int, dqm::reco::MonitorElement*> num_simcluster_eta_perlayer;
379 num_simcluster_eta_perlayer.clear();
380 std::unordered_map<int, dqm::reco::MonitorElement*> num_simcluster_phi_perlayer;
381 num_simcluster_phi_perlayer.clear();
382 std::unordered_map<int, dqm::reco::MonitorElement*> numDup_simcluster_eta_perlayer;
383 numDup_simcluster_eta_perlayer.clear();
384 std::unordered_map<int, dqm::reco::MonitorElement*> numDup_simcluster_phi_perlayer;
385 numDup_simcluster_phi_perlayer.clear();
386 std::unordered_map<int, dqm::reco::MonitorElement*> sharedenergy_simcluster2layercl_vs_eta_perlayer;
387 sharedenergy_simcluster2layercl_vs_eta_perlayer.clear();
388 std::unordered_map<int, dqm::reco::MonitorElement*> sharedenergy_simcluster2layercl_vs_phi_perlayer;
389 sharedenergy_simcluster2layercl_vs_phi_perlayer.clear();
392 for (
unsigned ilayer = 0; ilayer < 2 *
layers; ++ilayer) {
394 while (istr1.size() < 2) {
395 istr1.insert(0,
"0");
406 denom_layercl_in_simcl_eta_perlayer[ilayer] =
407 ibook.
book1D(
"Denom_LayerCluster_in_SimCluster_Eta_perlayer" + istr1,
408 "Denom LayerCluster in SimCluster Eta per Layer Cluster for layer " + istr2,
413 denom_layercl_in_simcl_phi_perlayer[ilayer] =
414 ibook.
book1D(
"Denom_LayerCluster_in_SimCluster_Phi_perlayer" + istr1,
415 "Denom LayerCluster in SimCluster Phi per Layer Cluster for layer " + istr2,
420 score_layercl2simcluster_perlayer[ilayer] = ibook.
book1D(
"Score_layercl2simcluster_perlayer" + istr1,
421 "Score of Layer Cluster per SimCluster for layer " + istr2,
426 score_simcluster2layercl_perlayer[ilayer] = ibook.
book1D(
"Score_simcluster2layercl_perlayer" + istr1,
427 "Score of SimCluster per Layer Cluster for layer " + istr2,
432 energy_vs_score_simcluster2layercl_perlayer[ilayer] =
433 ibook.
book2D(
"Energy_vs_Score_simcluster2layer_perlayer" + istr1,
434 "Energy vs Score of SimCluster per Layer Cluster for layer " + istr2,
442 energy_vs_score_layercl2simcluster_perlayer[ilayer] =
443 ibook.
book2D(
"Energy_vs_Score_layer2simcluster_perlayer" + istr1,
444 "Energy vs Score of Layer Cluster per SimCluster for layer " + istr2,
452 sharedenergy_simcluster2layercl_perlayer[ilayer] =
453 ibook.
book1D(
"SharedEnergy_simcluster2layercl_perlayer" + istr1,
454 "Shared Energy of SimCluster per Layer Cluster for layer " + istr2,
459 sharedenergy_simcluster2layercl_vs_eta_perlayer[ilayer] =
460 ibook.
bookProfile(
"SharedEnergy_simcluster2layercl_vs_eta_perlayer" + istr1,
461 "Shared Energy of SimCluster vs #eta per best Layer Cluster for layer " + istr2,
468 sharedenergy_simcluster2layercl_vs_phi_perlayer[ilayer] =
469 ibook.
bookProfile(
"SharedEnergy_simcluster2layercl_vs_phi_perlayer" + istr1,
470 "Shared Energy of SimCluster vs #phi per best Layer Cluster for layer " + istr2,
477 sharedenergy_layercl2simcluster_perlayer[ilayer] =
478 ibook.
book1D(
"SharedEnergy_layercluster2simcluster_perlayer" + istr1,
479 "Shared Energy of Layer Cluster per SimCluster for layer " + istr2,
484 sharedenergy_layercl2simcluster_vs_eta_perlayer[ilayer] =
485 ibook.
bookProfile(
"SharedEnergy_layercl2simcluster_vs_eta_perlayer" + istr1,
486 "Shared Energy of LayerCluster vs #eta per best SimCluster for layer " + istr2,
493 sharedenergy_layercl2simcluster_vs_phi_perlayer[ilayer] =
494 ibook.
bookProfile(
"SharedEnergy_layercl2simcluster_vs_phi_perlayer" + istr1,
495 "Shared Energy of LayerCluster vs #phi per best SimCluster for layer " + istr2,
502 num_simcluster_eta_perlayer[ilayer] = ibook.
book1D(
"Num_SimCluster_Eta_perlayer" + istr1,
503 "Num SimCluster Eta per Layer Cluster for layer " + istr2,
508 numDup_simcluster_eta_perlayer[ilayer] =
509 ibook.
book1D(
"NumDup_SimCluster_Eta_perlayer" + istr1,
510 "Num Duplicate SimCluster Eta per Layer Cluster for layer " + istr2,
515 denom_simcluster_eta_perlayer[ilayer] = ibook.
book1D(
"Denom_SimCluster_Eta_perlayer" + istr1,
516 "Denom SimCluster Eta per Layer Cluster for layer " + istr2,
521 num_simcluster_phi_perlayer[ilayer] = ibook.
book1D(
"Num_SimCluster_Phi_perlayer" + istr1,
522 "Num SimCluster Phi per Layer Cluster for layer " + istr2,
527 numDup_simcluster_phi_perlayer[ilayer] =
528 ibook.
book1D(
"NumDup_SimCluster_Phi_perlayer" + istr1,
529 "Num Duplicate SimCluster Phi per Layer Cluster for layer " + istr2,
534 denom_simcluster_phi_perlayer[ilayer] = ibook.
book1D(
"Denom_SimCluster_Phi_perlayer" + istr1,
535 "Denom SimCluster Phi per Layer Cluster for layer " + istr2,
540 num_layercl_in_simcl_eta_perlayer[ilayer] =
541 ibook.
book1D(
"Num_LayerCluster_in_SimCluster_Eta_perlayer" + istr1,
542 "Num LayerCluster Eta per Layer Cluster in SimCluster for layer " + istr2,
547 numMerge_layercl_in_simcl_eta_perlayer[ilayer] =
548 ibook.
book1D(
"NumMerge_LayerCluster_in_SimCluster_Eta_perlayer" + istr1,
549 "Num Merge LayerCluster Eta per Layer Cluster in SimCluster for layer " + istr2,
554 num_layercl_in_simcl_phi_perlayer[ilayer] =
555 ibook.
book1D(
"Num_LayerCluster_in_SimCluster_Phi_perlayer" + istr1,
556 "Num LayerCluster Phi per Layer Cluster in SimCluster for layer " + istr2,
561 numMerge_layercl_in_simcl_phi_perlayer[ilayer] =
562 ibook.
book1D(
"NumMerge_LayerCluster_in_SimCluster_Phi_perlayer" + istr1,
563 "Num Merge LayerCluster Phi per Layer Cluster in SimCluster for layer " + istr2,
570 histograms.h_denom_layercl_in_simcl_eta_perlayer.push_back(
std::move(denom_layercl_in_simcl_eta_perlayer));
571 histograms.h_denom_layercl_in_simcl_phi_perlayer.push_back(
std::move(denom_layercl_in_simcl_phi_perlayer));
572 histograms.h_score_layercl2simcluster_perlayer.push_back(
std::move(score_layercl2simcluster_perlayer));
573 histograms.h_sharedenergy_layercl2simcluster_perlayer.push_back(
std::move(sharedenergy_layercl2simcluster_perlayer));
574 histograms.h_energy_vs_score_layercl2simcluster_perlayer.push_back(
575 std::move(energy_vs_score_layercl2simcluster_perlayer));
576 histograms.h_num_layercl_in_simcl_eta_perlayer.push_back(
std::move(num_layercl_in_simcl_eta_perlayer));
577 histograms.h_num_layercl_in_simcl_phi_perlayer.push_back(
std::move(num_layercl_in_simcl_phi_perlayer));
578 histograms.h_numMerge_layercl_in_simcl_eta_perlayer.push_back(
std::move(numMerge_layercl_in_simcl_eta_perlayer));
579 histograms.h_numMerge_layercl_in_simcl_phi_perlayer.push_back(
std::move(numMerge_layercl_in_simcl_phi_perlayer));
580 histograms.h_sharedenergy_layercl2simcluster_vs_eta_perlayer.push_back(
581 std::move(sharedenergy_layercl2simcluster_vs_eta_perlayer));
582 histograms.h_sharedenergy_layercl2simcluster_vs_phi_perlayer.push_back(
583 std::move(sharedenergy_layercl2simcluster_vs_phi_perlayer));
584 histograms.h_denom_simcluster_eta_perlayer.push_back(
std::move(denom_simcluster_eta_perlayer));
585 histograms.h_denom_simcluster_phi_perlayer.push_back(
std::move(denom_simcluster_phi_perlayer));
586 histograms.h_score_simcluster2layercl_perlayer.push_back(
std::move(score_simcluster2layercl_perlayer));
587 histograms.h_sharedenergy_simcluster2layercl_perlayer.push_back(
std::move(sharedenergy_simcluster2layercl_perlayer));
588 histograms.h_energy_vs_score_simcluster2layercl_perlayer.push_back(
589 std::move(energy_vs_score_simcluster2layercl_perlayer));
590 histograms.h_num_simcluster_eta_perlayer.push_back(
std::move(num_simcluster_eta_perlayer));
591 histograms.h_num_simcluster_phi_perlayer.push_back(
std::move(num_simcluster_phi_perlayer));
592 histograms.h_numDup_simcluster_eta_perlayer.push_back(
std::move(numDup_simcluster_eta_perlayer));
593 histograms.h_numDup_simcluster_phi_perlayer.push_back(
std::move(numDup_simcluster_phi_perlayer));
594 histograms.h_sharedenergy_simcluster2layercl_vs_eta_perlayer.push_back(
595 std::move(sharedenergy_simcluster2layercl_vs_eta_perlayer));
596 histograms.h_sharedenergy_simcluster2layercl_vs_phi_perlayer.push_back(
597 std::move(sharedenergy_simcluster2layercl_vs_phi_perlayer));
602 std::vector<int> thicknesses,
610 histograms.h_mixedhitscluster_zminus.push_back(
611 ibook.
book1D(
"mixedhitscluster_zminus",
612 "N of reco clusters that contain hits of more than one kind in z-",
617 histograms.h_mixedhitscluster_zplus.push_back(
618 ibook.
book1D(
"mixedhitscluster_zplus",
619 "N of reco clusters that contain hits of more than one kind in z+",
626 histograms.h_energyclustered_zminus.push_back(
627 ibook.
book1D(
"energyclustered_zminus",
628 "percent of total energy clustered by all layer clusters over CaloParticless energy in z-",
634 ibook.
book1D(
"energyclustered_zplus",
635 "percent of total energy clustered by all layer clusters over CaloParticless energy in z+",
642 std::string subpathtomat = pathtomatbudfile.substr(pathtomatbudfile.find(
"Validation"));
643 histograms.h_longdepthbarycentre_zminus.push_back(
644 ibook.
book1D(
"longdepthbarycentre_zminus",
645 "The longitudinal depth barycentre in z- for " + subpathtomat,
650 histograms.h_longdepthbarycentre_zplus.push_back(
651 ibook.
book1D(
"longdepthbarycentre_zplus",
652 "The longitudinal depth barycentre in z+ for " + subpathtomat,
658 for (
unsigned ilayer = 0; ilayer < 2 *
layers; ++ilayer) {
660 while (istr1.size() < 2) {
661 istr1.insert(0,
"0");
671 histograms.h_clusternum_perlayer[ilayer] = ibook.
book1D(
"totclusternum_layer_" + istr1,
672 "total number of layer clusters for layer " + istr2,
677 "energyclustered_perlayer" + istr1,
678 "percent of total energy clustered by layer clusters over CaloParticless energy for layer " + istr2,
685 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
687 histograms.h_clusternum_perthick[(*it)] = ibook.
book1D(
"totclusternum_thick_" + istr,
688 "total number of layer clusters for thickness " + istr,
700 for (
unsigned ilayer = 0; ilayer < 2 *
layers; ++ilayer) {
702 while (istr1.size() < 2) {
703 istr1.insert(0,
"0");
713 histograms.h_score_layercl2caloparticle_perlayer[ilayer] =
714 ibook.
book1D(
"Score_layercl2caloparticle_perlayer" + istr1,
715 "Score of Layer Cluster per CaloParticle for layer " + istr2,
719 histograms.h_score_caloparticle2layercl_perlayer[ilayer] =
720 ibook.
book1D(
"Score_caloparticle2layercl_perlayer" + istr1,
721 "Score of CaloParticle per Layer Cluster for layer " + istr2,
725 histograms.h_energy_vs_score_caloparticle2layercl_perlayer[ilayer] =
726 ibook.
book2D(
"Energy_vs_Score_caloparticle2layer_perlayer" + istr1,
727 "Energy vs Score of CaloParticle per Layer Cluster for layer " + istr2,
734 histograms.h_energy_vs_score_layercl2caloparticle_perlayer[ilayer] =
735 ibook.
book2D(
"Energy_vs_Score_layer2caloparticle_perlayer" + istr1,
736 "Energy vs Score of Layer Cluster per CaloParticle Layer for layer " + istr2,
743 histograms.h_sharedenergy_caloparticle2layercl_perlayer[ilayer] =
744 ibook.
book1D(
"SharedEnergy_caloparticle2layercl_perlayer" + istr1,
745 "Shared Energy of CaloParticle per Layer Cluster for layer " + istr2,
749 histograms.h_sharedenergy_caloparticle2layercl_vs_eta_perlayer[ilayer] =
750 ibook.
bookProfile(
"SharedEnergy_caloparticle2layercl_vs_eta_perlayer" + istr1,
751 "Shared Energy of CaloParticle vs #eta per best Layer Cluster for layer " + istr2,
757 histograms.h_sharedenergy_caloparticle2layercl_vs_phi_perlayer[ilayer] =
758 ibook.
bookProfile(
"SharedEnergy_caloparticle2layercl_vs_phi_perlayer" + istr1,
759 "Shared Energy of CaloParticle vs #phi per best Layer Cluster for layer " + istr2,
765 histograms.h_sharedenergy_layercl2caloparticle_perlayer[ilayer] =
766 ibook.
book1D(
"SharedEnergy_layercluster2caloparticle_perlayer" + istr1,
767 "Shared Energy of Layer Cluster per Layer Calo Particle for layer " + istr2,
771 histograms.h_sharedenergy_layercl2caloparticle_vs_eta_perlayer[ilayer] =
772 ibook.
bookProfile(
"SharedEnergy_layercl2caloparticle_vs_eta_perlayer" + istr1,
773 "Shared Energy of LayerCluster vs #eta per best Calo Particle for layer " + istr2,
779 histograms.h_sharedenergy_layercl2caloparticle_vs_phi_perlayer[ilayer] =
780 ibook.
bookProfile(
"SharedEnergy_layercl2caloparticle_vs_phi_perlayer" + istr1,
781 "Shared Energy of LayerCluster vs #phi per best Calo Particle for layer " + istr2,
787 histograms.h_num_caloparticle_eta_perlayer[ilayer] =
788 ibook.
book1D(
"Num_CaloParticle_Eta_perlayer" + istr1,
789 "Num CaloParticle Eta per Layer Cluster for layer " + istr2,
793 histograms.h_numDup_caloparticle_eta_perlayer[ilayer] =
794 ibook.
book1D(
"NumDup_CaloParticle_Eta_perlayer" + istr1,
795 "Num Duplicate CaloParticle Eta per Layer Cluster for layer " + istr2,
799 histograms.h_denom_caloparticle_eta_perlayer[ilayer] =
800 ibook.
book1D(
"Denom_CaloParticle_Eta_perlayer" + istr1,
801 "Denom CaloParticle Eta per Layer Cluster for layer " + istr2,
805 histograms.h_num_caloparticle_phi_perlayer[ilayer] =
806 ibook.
book1D(
"Num_CaloParticle_Phi_perlayer" + istr1,
807 "Num CaloParticle Phi per Layer Cluster for layer " + istr2,
811 histograms.h_numDup_caloparticle_phi_perlayer[ilayer] =
812 ibook.
book1D(
"NumDup_CaloParticle_Phi_perlayer" + istr1,
813 "Num Duplicate CaloParticle Phi per Layer Cluster for layer " + istr2,
817 histograms.h_denom_caloparticle_phi_perlayer[ilayer] =
818 ibook.
book1D(
"Denom_CaloParticle_Phi_perlayer" + istr1,
819 "Denom CaloParticle Phi per Layer Cluster for layer " + istr2,
823 histograms.h_num_layercl_eta_perlayer[ilayer] =
824 ibook.
book1D(
"Num_LayerCluster_Eta_perlayer" + istr1,
825 "Num LayerCluster Eta per Layer Cluster for layer " + istr2,
829 histograms.h_numMerge_layercl_eta_perlayer[ilayer] =
830 ibook.
book1D(
"NumMerge_LayerCluster_Eta_perlayer" + istr1,
831 "Num Merge LayerCluster Eta per Layer Cluster for layer " + istr2,
835 histograms.h_denom_layercl_eta_perlayer[ilayer] =
836 ibook.
book1D(
"Denom_LayerCluster_Eta_perlayer" + istr1,
837 "Denom LayerCluster Eta per Layer Cluster for layer " + istr2,
841 histograms.h_num_layercl_phi_perlayer[ilayer] =
842 ibook.
book1D(
"Num_LayerCluster_Phi_perlayer" + istr1,
843 "Num LayerCluster Phi per Layer Cluster for layer " + istr2,
847 histograms.h_numMerge_layercl_phi_perlayer[ilayer] =
848 ibook.
book1D(
"NumMerge_LayerCluster_Phi_perlayer" + istr1,
849 "Num Merge LayerCluster Phi per Layer Cluster for layer " + istr2,
853 histograms.h_denom_layercl_phi_perlayer[ilayer] =
854 ibook.
book1D(
"Denom_LayerCluster_Phi_perlayer" + istr1,
855 "Denom LayerCluster Phi per Layer Cluster for layer " + istr2,
866 std::vector<int> thicknesses) {
868 for (
unsigned ilayer = 0; ilayer < 2 *
layers; ++ilayer) {
870 while (istr1.size() < 2) {
871 istr1.insert(0,
"0");
881 histograms.h_cellAssociation_perlayer[ilayer] =
882 ibook.
book1D(
"cellAssociation_perlayer" + istr1,
"Cell Association for layer " + istr2, 5, -4., 1.);
883 histograms.h_cellAssociation_perlayer[ilayer]->setBinLabel(2,
"TN(purity)");
884 histograms.h_cellAssociation_perlayer[ilayer]->setBinLabel(3,
"FN(ineff.)");
885 histograms.h_cellAssociation_perlayer[ilayer]->setBinLabel(4,
"FP(fake)");
886 histograms.h_cellAssociation_perlayer[ilayer]->setBinLabel(5,
"TP(eff.)");
889 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
891 histograms.h_cellsenedens_perthick[(*it)] = ibook.
book1D(
"cellsenedens_thick_" + istr,
892 "energy density of cluster cells for thickness " + istr,
899 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
900 for (
unsigned ilayer = 0; ilayer < 2 *
layers; ++ilayer) {
903 while (istr2.size() < 2)
904 istr2.insert(0,
"0");
905 auto istr = istr1 +
"_" + istr2;
915 histograms.h_cellsnum_perthickperlayer[istr] =
916 ibook.
book1D(
"cellsnum_perthick_perlayer_" + istr,
917 "total number of cells for layer " + istr3 +
" for thickness " + istr1,
922 histograms.h_distancetoseedcell_perthickperlayer[istr] =
923 ibook.
book1D(
"distancetoseedcell_perthickperlayer_" + istr,
924 "distance of cluster cells to seed cell for layer " + istr3 +
" for thickness " + istr1,
929 histograms.h_distancetoseedcell_perthickperlayer_eneweighted[istr] = ibook.
book1D(
930 "distancetoseedcell_perthickperlayer_eneweighted_" + istr,
931 "energy weighted distance of cluster cells to seed cell for layer " + istr3 +
" for thickness " + istr1,
936 histograms.h_distancetomaxcell_perthickperlayer[istr] =
937 ibook.
book1D(
"distancetomaxcell_perthickperlayer_" + istr,
938 "distance of cluster cells to max cell for layer " + istr3 +
" for thickness " + istr1,
943 histograms.h_distancetomaxcell_perthickperlayer_eneweighted[istr] = ibook.
book1D(
944 "distancetomaxcell_perthickperlayer_eneweighted_" + istr,
945 "energy weighted distance of cluster cells to max cell for layer " + istr3 +
" for thickness " + istr1,
950 histograms.h_distancebetseedandmaxcell_perthickperlayer[istr] =
951 ibook.
book1D(
"distancebetseedandmaxcell_perthickperlayer_" + istr,
952 "distance of seed cell to max cell for layer " + istr3 +
" for thickness " + istr1,
957 histograms.h_distancebetseedandmaxcellvsclusterenergy_perthickperlayer[istr] = ibook.
book2D(
958 "distancebetseedandmaxcellvsclusterenergy_perthickperlayer_" + istr,
959 "distance of seed cell to max cell vs cluster energy for layer " + istr3 +
" for thickness " + istr1,
972 std::unordered_map<int, dqm::reco::MonitorElement*> clusternum_in_trackster_perlayer;
973 clusternum_in_trackster_perlayer.clear();
975 for (
unsigned ilayer = 0; ilayer < 2 *
layers; ++ilayer) {
977 while (istr1.size() < 2) {
978 istr1.insert(0,
"0");
989 clusternum_in_trackster_perlayer[ilayer] = ibook.
book1D(
"clusternum_in_trackster_perlayer" + istr1,
990 "Number of layer clusters in Trackster for layer " + istr2,
996 histograms.h_clusternum_in_trackster_perlayer.push_back(
std::move(clusternum_in_trackster_perlayer));
1004 histograms.h_nonconttracksternum.push_back(ibook.
book1D(
"nonconttracksternum",
1005 "number of Tracksters without 3 contiguous layers",
1010 histograms.h_clusternum_in_trackster.push_back(
1011 ibook.
book1D(
"clusternum_in_trackster",
1012 "total number of layer clusters in Trackster;# of LayerClusters",
1018 "clusternum_in_trackster_vs_layer",
1019 "Profile of 2d layer clusters in Trackster vs layer number;layer number;<2D LayerClusters in Trackster>",
1026 histograms.h_multiplicityOfLCinTST.push_back(
1027 ibook.
book2D(
"multiplicityOfLCinTST",
1028 "Multiplicity vs Layer cluster size in Tracksters;LayerCluster multiplicity in Tracksters;Cluster " 1037 histograms.h_multiplicity_numberOfEventsHistogram.push_back(ibook.
book1D(
"multiplicity_numberOfEventsHistogram",
1038 "multiplicity numberOfEventsHistogram",
1043 histograms.h_multiplicity_zminus_numberOfEventsHistogram.push_back(
1044 ibook.
book1D(
"multiplicity_zminus_numberOfEventsHistogram",
1045 "multiplicity numberOfEventsHistogram in z-",
1050 histograms.h_multiplicity_zplus_numberOfEventsHistogram.push_back(
1051 ibook.
book1D(
"multiplicity_zplus_numberOfEventsHistogram",
1052 "multiplicity numberOfEventsHistogram in z+",
1057 histograms.h_multiplicityOfLCinTST_vs_layercluster_zminus.push_back(
1058 ibook.
book2D(
"multiplicityOfLCinTST_vs_layercluster_zminus",
1059 "Multiplicity vs Layer number in z-;LayerCluster multiplicity in Tracksters;layer number",
1067 histograms.h_multiplicityOfLCinTST_vs_layercluster_zplus.push_back(
1068 ibook.
book2D(
"multiplicityOfLCinTST_vs_layercluster_zplus",
1069 "Multiplicity vs Layer number in z+;LayerCluster multiplicity in Tracksters;layer number",
1077 histograms.h_multiplicityOfLCinTST_vs_layerclusterenergy.push_back(
1078 ibook.
book2D(
"multiplicityOfLCinTST_vs_layerclusterenergy",
1079 "Multiplicity vs Layer cluster energy;LayerCluster multiplicity in Tracksters;Cluster energy [GeV]",
1102 "trackster_firstlayer",
"First layer of the Trackster;Trackster First Layer", 2 *
layers, 0., (
float)2 *
layers));
1104 "trackster_lastlayer",
"Last layer of the Trackster;Trackster Last Layer", 2 *
layers, 0., (
float)2 *
layers));
1106 ibook.
book1D(
"trackster_layersnum",
1107 "Number of layers of the Trackster;Trackster Number of Layers",
1116 const string ref[] = {
"caloparticle",
"simtrackster",
"simtrackster_fromCP"};
1117 const string refT[] = {
"CaloParticle",
"SimTrackster",
"SimTrackster_fromCP"};
1119 const string val[] = {
"_Link",
"_PR"};
1121 const string rtos =
";score Reco-to-Sim";
1122 const string stor =
";score Sim-to-Reco";
1123 const string shREnFr =
";shared Reco energy fraction";
1124 const string shSEnFr =
";shared Sim energy fraction";
1126 histograms.h_score_trackster2caloparticle[valType].push_back(
1127 ibook.
book1D(
"Score_trackster2" + ref[valType],
1128 "Score of Trackster per " + refT[valType] + rtos,
1132 histograms.h_score_trackster2bestCaloparticle[valType].push_back(
1133 ibook.
book1D(
"ScoreFake_trackster2" + ref[valType],
1134 "Score of Trackster per best " + refT[valType] + rtos,
1138 histograms.h_score_trackster2bestCaloparticle2[valType].push_back(
1139 ibook.
book1D(
"ScoreMerge_trackster2" + ref[valType],
1140 "Score of Trackster per 2^{nd} best " + refT[valType] + rtos,
1144 histograms.h_score_caloparticle2trackster[valType].push_back(
1145 ibook.
book1D(
"Score_" + ref[valType] +
"2trackster",
1146 "Score of " + refT[valType] +
" per Trackster" + stor,
1150 histograms.h_scorePur_caloparticle2trackster[valType].push_back(
1151 ibook.
book1D(
"ScorePur_" + ref[valType] +
"2trackster",
1152 "Score of " + refT[valType] +
" per best Trackster" + stor,
1156 histograms.h_scoreDupl_caloparticle2trackster[valType].push_back(
1157 ibook.
book1D(
"ScoreDupl_" + ref[valType] +
"2trackster",
1158 "Score of " + refT[valType] +
" per 2^{nd} best Trackster" + stor,
1162 histograms.h_energy_vs_score_trackster2caloparticle[valType].push_back(
1163 ibook.
book2D(
"Energy_vs_Score_trackster2" + refT[valType],
1164 "Energy vs Score of Trackster per " + refT[valType] + rtos + shREnFr,
1171 histograms.h_energy_vs_score_trackster2bestCaloparticle[valType].push_back(
1172 ibook.
book2D(
"Energy_vs_Score_trackster2best" + refT[valType],
1173 "Energy vs Score of Trackster per best " + refT[valType] + rtos + shREnFr,
1180 histograms.h_energy_vs_score_trackster2bestCaloparticle2[valType].push_back(
1181 ibook.
book2D(
"Energy_vs_Score_trackster2secBest" + refT[valType],
1182 "Energy vs Score of Trackster per 2^{nd} best " + refT[valType] + rtos + shREnFr,
1189 histograms.h_energy_vs_score_caloparticle2trackster[valType].push_back(
1190 ibook.
book2D(
"Energy_vs_Score_" + ref[valType] +
"2Trackster",
1191 "Energy vs Score of " + refT[valType] +
" per Trackster" + stor + shSEnFr,
1198 histograms.h_energy_vs_score_caloparticle2bestTrackster[valType].push_back(
1199 ibook.
book2D(
"Energy_vs_Score_" + ref[valType] +
"2bestTrackster",
1200 "Energy vs Score of " + refT[valType] +
" per best Trackster" + stor + shSEnFr,
1207 histograms.h_energy_vs_score_caloparticle2bestTrackster2[valType].push_back(
1208 ibook.
book2D(
"Energy_vs_Score_" + ref[valType] +
"2secBestTrackster",
1209 "Energy vs Score of " + refT[valType] +
" per 2^{nd} best Trackster" + stor + shSEnFr,
1221 histograms.h_numMerge_trackster_eta[valType].push_back(ibook.
book1D(
"NumMerge_Trackster_Eta" +
val[valType],
1222 "Num Merge Trackster Eta per Trackster;#eta",
1231 histograms.h_numMerge_trackster_phi[valType].push_back(ibook.
book1D(
"NumMerge_Trackster_Phi" +
val[valType],
1232 "Num Merge Trackster Phi per Trackster;#phi",
1239 histograms.h_num_trackster_en[valType].push_back(ibook.
book1D(
"Num_Trackster_Energy" +
val[valType],
1240 "Num Trackster Energy per Trackster;energy [GeV]",
1244 histograms.h_numMerge_trackster_en[valType].push_back(
1245 ibook.
book1D(
"NumMerge_Trackster_Energy" +
val[valType],
1246 "Num Merge Trackster Energy per Trackster;energy [GeV]",
1250 histograms.h_denom_trackster_en[valType].push_back(ibook.
book1D(
"Denom_Trackster_Energy" +
val[valType],
1251 "Denom Trackster Energy per Trackster;energy [GeV]",
1257 "Num_Trackster_Pt" +
val[valType],
"Num Trackster p_{T} per Trackster;p_{T} [GeV]",
nintPt_,
minPt_,
maxPt_));
1258 histograms.h_numMerge_trackster_pt[valType].push_back(
1259 ibook.
book1D(
"NumMerge_Trackster_Pt" +
val[valType],
1260 "Num Merge Trackster p_{T} per Trackster;p_{T} [GeV]",
1265 "Denom_Trackster_Pt" +
val[valType],
"Denom Trackster p_{T} per Trackster;p_{T} [GeV]",
nintPt_,
minPt_,
maxPt_));
1267 histograms.h_sharedenergy_trackster2caloparticle[valType].push_back(
1268 ibook.
book1D(
"SharedEnergy_trackster2" + ref[valType],
1269 "Shared Energy of Trackster per " + refT[valType] + shREnFr,
1273 histograms.h_sharedenergy_trackster2bestCaloparticle[valType].push_back(
1274 ibook.
book1D(
"SharedEnergy_trackster2" + ref[valType] +
"_assoc",
1275 "Shared Energy of Trackster per best " + refT[valType] + shREnFr,
1279 histograms.h_sharedenergy_trackster2bestCaloparticle_vs_eta[valType].push_back(
1280 ibook.
bookProfile(
"SharedEnergy_trackster2" + ref[valType] +
"_assoc_vs_eta",
1281 "Shared Energy of Trackster vs #eta per best " + refT[valType] +
";Trackster #eta" + shREnFr,
1287 histograms.h_sharedenergy_trackster2bestCaloparticle_vs_phi[valType].push_back(
1288 ibook.
bookProfile(
"SharedEnergy_trackster2" + ref[valType] +
"_assoc_vs_phi",
1289 "Shared Energy of Trackster vs #phi per best " + refT[valType] +
";Trackster #phi" + shREnFr,
1295 histograms.h_sharedenergy_trackster2bestCaloparticle2[valType].push_back(
1296 ibook.
book1D(
"SharedEnergy_trackster2" + ref[valType] +
"_assoc2",
1297 "Shared Energy of Trackster per 2^{nd} best " + refT[valType] + shREnFr,
1302 histograms.h_sharedenergy_caloparticle2trackster[valType].push_back(
1303 ibook.
book1D(
"SharedEnergy_" + ref[valType] +
"2trackster",
1304 "Shared Energy of " + refT[valType] +
" per Trackster" + shSEnFr,
1308 histograms.h_sharedenergy_caloparticle2trackster_assoc[valType].push_back(
1309 ibook.
book1D(
"SharedEnergy_" + ref[valType] +
"2trackster_assoc",
1310 "Shared Energy of " + refT[valType] +
" per best Trackster" + shSEnFr,
1315 "SharedEnergy_" + ref[valType] +
"2trackster_assoc_vs_eta",
1316 "Shared Energy of " + refT[valType] +
" vs #eta per best Trackster;" + refT[valType] +
" #eta" + shSEnFr,
1323 "SharedEnergy_" + ref[valType] +
"2trackster_assoc_vs_phi",
1324 "Shared Energy of " + refT[valType] +
" vs #phi per best Trackster;" + refT[valType] +
" #phi" + shSEnFr,
1330 histograms.h_sharedenergy_caloparticle2trackster_assoc2[valType].push_back(
1331 ibook.
book1D(
"SharedEnergy_" + ref[valType] +
"2trackster_assoc2",
1332 "Shared Energy of " + refT[valType] +
" per 2^{nd} best Trackster;" + shSEnFr,
1338 histograms.h_numEff_caloparticle_eta[valType].push_back(
1339 ibook.
book1D(
"NumEff_" + refT[valType] +
"_Eta",
1340 "Num Efficiency " + refT[valType] +
" Eta per Trackster;#eta",
1344 histograms.h_num_caloparticle_eta[valType].push_back(
1345 ibook.
book1D(
"Num_" + refT[valType] +
"_Eta",
1346 "Num Purity " + refT[valType] +
" Eta per Trackster;#eta",
1352 histograms.h_denom_caloparticle_eta[valType].push_back(
1353 ibook.
book1D(
"Denom_" + refT[valType] +
"_Eta",
1354 "Denom " + refT[valType] +
" Eta per Trackster;#eta",
1359 histograms.h_numEff_caloparticle_phi[valType].push_back(
1360 ibook.
book1D(
"NumEff_" + refT[valType] +
"_Phi",
1361 "Num Efficiency " + refT[valType] +
" Phi per Trackster;#phi",
1365 histograms.h_num_caloparticle_phi[valType].push_back(
1366 ibook.
book1D(
"Num_" + refT[valType] +
"_Phi",
1367 "Num Purity " + refT[valType] +
" Phi per Trackster;#phi",
1373 histograms.h_denom_caloparticle_phi[valType].push_back(
1374 ibook.
book1D(
"Denom_" + refT[valType] +
"_Phi",
1375 "Denom " + refT[valType] +
" Phi per Trackster;#phi",
1380 histograms.h_numEff_caloparticle_en[valType].push_back(
1381 ibook.
book1D(
"NumEff_" + refT[valType] +
"_Energy",
1382 "Num Efficiency " + refT[valType] +
" Energy per Trackster;energy [GeV]",
1386 histograms.h_num_caloparticle_en[valType].push_back(
1387 ibook.
book1D(
"Num_" + refT[valType] +
"_Energy",
1388 "Num Purity " + refT[valType] +
" Energy per Trackster;energy [GeV]",
1392 histograms.h_numDup_trackster_en[valType].push_back(ibook.
book1D(
"NumDup_Trackster_Energy" +
val[valType],
1393 "Num Duplicate Trackster vs Energy;energy [GeV]",
1397 histograms.h_denom_caloparticle_en[valType].push_back(
1398 ibook.
book1D(
"Denom_" + refT[valType] +
"_Energy",
1399 "Denom " + refT[valType] +
" Energy per Trackster;energy [GeV]",
1404 histograms.h_numEff_caloparticle_pt[valType].push_back(
1405 ibook.
book1D(
"NumEff_" + refT[valType] +
"_Pt",
1406 "Num Efficiency " + refT[valType] +
" p_{T} per Trackster;p_{T} [GeV]",
1410 histograms.h_num_caloparticle_pt[valType].push_back(
1411 ibook.
book1D(
"Num_" + refT[valType] +
"_Pt",
1412 "Num Purity " + refT[valType] +
" p_{T} per Trackster;p_{T} [GeV]",
1417 "NumDup_Trackster_Pt" +
val[valType],
"Num Duplicate Trackster vs p_{T};p_{T} [GeV]",
nintPt_,
minPt_,
maxPt_));
1418 histograms.h_denom_caloparticle_pt[valType].push_back(
1419 ibook.
book1D(
"Denom_" + refT[valType] +
"_Pt",
1420 "Denom " + refT[valType] +
" p_{T} per Trackster;p_{T} [GeV]",
1444 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap)
const {
1468 int minLayerId = 999;
1471 int simHits_matched = 0;
1472 int minLayerId_matched = 999;
1473 int maxLayerId_matched = 0;
1476 std::map<int, double> totenergy_layer;
1478 float hitEnergyWeight_invSum = 0;
1479 std::vector<std::pair<DetId, float>> haf_cp;
1480 for (
const auto& sc : caloParticle.
simClusters()) {
1481 LogDebug(
"HGCalValidator") <<
" This sim cluster has " << sc->hits_and_fractions().size() <<
" simHits and " 1482 << sc->energy() <<
" energy. " << std::endl;
1483 simHits += sc->hits_and_fractions().size();
1484 for (
auto const& h_and_f : sc->hits_and_fractions()) {
1485 const auto hitDetId = h_and_f.first;
1489 int layerId_matched_min = 999;
1490 int layerId_matched_max = 0;
1491 std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(hitDetId);
1492 if (itcheck != hitMap.end()) {
1493 layerId_matched_min = layerId;
1494 layerId_matched_max = layerId;
1497 const auto hitEn = itcheck->second->energy();
1498 hitEnergyWeight_invSum +=
pow(hitEn, 2);
1499 const auto hitFr = h_and_f.second;
1500 const auto hitEnFr = hitEn * hitFr;
1502 histograms.h_caloparticle_nHits_matched_energy.at(
pdgid)->Fill(hitEnFr);
1503 histograms.h_caloparticle_nHits_matched_energy_layer.at(
pdgid)->Fill(layerId, hitEnFr);
1505 if (totenergy_layer.find(layerId) != totenergy_layer.end()) {
1506 totenergy_layer[layerId] = totenergy_layer.at(layerId) + hitEn;
1508 totenergy_layer.emplace(layerId, hitEn);
1511 histograms.h_caloparticle_nHits_matched_energy_layer_1SimCl.at(
pdgid)->Fill(layerId, hitEnFr);
1513 auto found = std::find_if(std::begin(haf_cp),
1515 [&hitDetId](
const std::pair<DetId, float>&
v) {
return v.first == hitDetId; });
1516 if (
found != haf_cp.end())
1517 found->second += hitFr;
1519 haf_cp.emplace_back(hitDetId, hitFr);
1522 LogDebug(
"HGCalValidator") <<
" matched to RecHit NOT found !" << std::endl;
1525 minLayerId =
std::min(minLayerId, layerId);
1526 maxLayerId =
std::max(maxLayerId, layerId);
1527 minLayerId_matched =
std::min(minLayerId_matched, layerId_matched_min);
1528 maxLayerId_matched =
std::max(maxLayerId_matched, layerId_matched_max);
1530 LogDebug(
"HGCalValidator") << std::endl;
1532 if (hitEnergyWeight_invSum)
1533 hitEnergyWeight_invSum = 1 / hitEnergyWeight_invSum;
1537 histograms.h_caloparticle_layersnum.at(
pdgid)->Fill(
int(maxLayerId - minLayerId));
1539 histograms.h_caloparticle_firstlayer_matchedtoRecHit.at(
pdgid)->Fill(minLayerId_matched);
1540 histograms.h_caloparticle_lastlayer_matchedtoRecHit.at(
pdgid)->Fill(maxLayerId_matched);
1541 histograms.h_caloparticle_layersnum_matchedtoRecHit.at(
pdgid)->Fill(
int(maxLayerId_matched - minLayerId_matched));
1544 histograms.h_caloparticle_nHitsInSimClusters_matchedtoRecHit.at(
pdgid)->Fill((
float)simHits_matched);
1549 auto i = totenergy_layer.begin();
1550 double sum_energy = 0.0;
1551 while (
i != totenergy_layer.end()) {
1552 sum_energy +=
i->second;
1553 histograms.h_caloparticle_sum_energy_layer.at(
pdgid)->Fill(
i->first, sum_energy / caloParticle.
energy() * 100.);
1557 for (
auto const& haf : haf_cp) {
1558 const auto hitEn = hitMap.find(haf.first)->second->energy();
1566 void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simCluster_histos(
const Histograms&
histograms,
1567 std::vector<SimCluster>
const& simClusters,
1569 std::vector<int> thicknesses)
const {
1578 std::vector<int> tnscpl(1000, 0);
1581 std::map<std::string, int> tnscpthplus;
1582 tnscpthplus.clear();
1583 std::map<std::string, int> tnscpthminus;
1584 tnscpthminus.clear();
1586 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
1587 tnscpthplus.insert(std::pair<std::string, int>(
std::to_string(*it), 0));
1588 tnscpthminus.insert(std::pair<std::string, int>(
std::to_string(*it), 0));
1591 tnscpthplus.insert(std::pair<std::string, int>(
"mixed", 0));
1592 tnscpthminus.insert(std::pair<std::string, int>(
"mixed", 0));
1595 for (
const auto& sc : simClusters) {
1597 int nthhits120p = 0;
1598 int nthhits200p = 0;
1599 int nthhits300p = 0;
1600 int nthhitsscintp = 0;
1601 int nthhits120m = 0;
1602 int nthhits200m = 0;
1603 int nthhits300m = 0;
1604 int nthhitsscintm = 0;
1608 std::vector<int> occurenceSCinlayer(1000, 0);
1611 for (
const auto& hAndF : sc.hits_and_fractions()) {
1612 const DetId sh_detid = hAndF.first;
1616 recHitTools_->getLayerWithOffset(sh_detid) +
layers * ((recHitTools_->zside(sh_detid) + 1) >> 1) - 1;
1618 int zside = recHitTools_->zside(sh_detid);
1621 if (occurenceSCinlayer[layerid] == 0) {
1624 occurenceSCinlayer[layerid]++;
1627 thickness = recHitTools_->getSiThickness(sh_detid);
1631 LogDebug(
"HGCalValidator") <<
"These are HGCal simClusters, you shouldn't be here !!! " << layerid <<
"\n";
1653 <<
" You are running a geometry that contains thicknesses different than the normal ones. " 1660 if ((nthhits120p != 0 && nthhits200p != 0) || (nthhits120p != 0 && nthhits300p != 0) ||
1661 (nthhits120p != 0 && nthhitsscintp != 0) || (nthhits200p != 0 && nthhits300p != 0) ||
1662 (nthhits200p != 0 && nthhitsscintp != 0) || (nthhits300p != 0 && nthhitsscintp != 0)) {
1663 tnscpthplus[
"mixed"]++;
1664 }
else if ((nthhits120p != 0 || nthhits200p != 0 || nthhits300p != 0 || nthhitsscintp != 0)) {
1668 if ((nthhits120m != 0 && nthhits200m != 0) || (nthhits120m != 0 && nthhits300m != 0) ||
1669 (nthhits120m != 0 && nthhitsscintm != 0) || (nthhits200m != 0 && nthhits300m != 0) ||
1670 (nthhits200m != 0 && nthhitsscintm != 0) || (nthhits300m != 0 && nthhitsscintm != 0)) {
1671 tnscpthminus[
"mixed"]++;
1672 }
else if ((nthhits120m != 0 || nthhits200m != 0 || nthhits300m != 0 || nthhitsscintm != 0)) {
1680 for (
unsigned ilayer = 0; ilayer <
layers * 2; ++ilayer)
1681 if (
histograms.h_simclusternum_perlayer.count(ilayer))
1682 histograms.h_simclusternum_perlayer.at(ilayer)->Fill(tnscpl[ilayer]);
1685 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
1686 if (
histograms.h_simclusternum_perthick.count(*it)) {
1692 histograms.h_mixedhitssimcluster_zplus->Fill(tnscpthplus[
"mixed"]);
1693 histograms.h_mixedhitssimcluster_zminus->Fill(tnscpthminus[
"mixed"]);
1696 void HGVHistoProducerAlgo::HGVHistoProducerAlgo::fill_simClusterAssociation_histos(
1701 edm::Handle<std::vector<SimCluster>> simClusterHandle,
1702 std::vector<SimCluster>
const& simClusters,
1703 std::vector<size_t>
const& sCIndices,
1704 const std::vector<float>&
mask,
1705 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap,
1727 scsInLayerClusterMap,
1728 lcsInSimClusterMap);
1741 edm::Handle<std::vector<CaloParticle>> caloParticleHandle,
1742 std::vector<CaloParticle>
const& cP,
1743 std::vector<size_t>
const& cPIndices,
1744 std::vector<size_t>
const& cPSelectedIndices,
1745 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap,
1749 const auto nLayerClusters =
clusters.size();
1751 std::unordered_map<DetId, std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>> detIdToCaloParticleId_Map;
1752 std::unordered_map<DetId, std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>> detIdToLayerClusterId_Map;
1756 for (
const auto& cpId : cPIndices) {
1757 for (
const auto& simCluster : cP[cpId].simClusters()) {
1758 for (
const auto& it_haf : simCluster->hits_and_fractions()) {
1759 const DetId hitid = (it_haf.first);
1760 if (hitMap.find(hitid) != hitMap.end()) {
1761 if (detIdToCaloParticleId_Map.find(hitid) == detIdToCaloParticleId_Map.end()) {
1762 detIdToCaloParticleId_Map[hitid] = std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>();
1763 detIdToCaloParticleId_Map[hitid].emplace_back(
1767 std::find(detIdToCaloParticleId_Map[hitid].begin(),
1768 detIdToCaloParticleId_Map[hitid].
end(),
1771 if (findHitIt != detIdToCaloParticleId_Map[hitid].
end())
1772 findHitIt->fraction += it_haf.second;
1774 detIdToCaloParticleId_Map[hitid].emplace_back(
1782 for (
unsigned int lcId = 0; lcId < nLayerClusters; ++lcId) {
1783 const auto& hits_and_fractions =
clusters[lcId].hitsAndFractions();
1784 const auto numberOfHitsInLC = hits_and_fractions.size();
1794 std::vector<int> hitsToCaloParticleId(numberOfHitsInLC);
1795 const auto firstHitDetId = hits_and_fractions[0].first;
1800 std::unordered_map<unsigned, float> CPEnergyInLC;
1802 for (
unsigned int iHit = 0; iHit < numberOfHitsInLC; iHit++) {
1803 const DetId rh_detid = hits_and_fractions[iHit].first;
1804 const auto rhFraction = hits_and_fractions[iHit].second;
1806 std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(rh_detid);
1809 if (detIdToLayerClusterId_Map.find(rh_detid) == detIdToLayerClusterId_Map.end()) {
1810 detIdToLayerClusterId_Map[rh_detid] = std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>();
1814 const auto& hit_find_in_CP = detIdToCaloParticleId_Map.find(rh_detid);
1822 if (rhFraction == 0.) {
1823 hitsToCaloParticleId[iHit] = -2;
1825 if (hit_find_in_CP == detIdToCaloParticleId_Map.end()) {
1826 hitsToCaloParticleId[iHit] -= 1;
1828 auto maxCPEnergyInLC = 0.f;
1830 for (
auto&
h : hit_find_in_CP->second) {
1831 const auto iCP =
h.clusterId;
1832 CPEnergyInLC[iCP] +=
h.fraction *
hit->energy();
1835 if (CPEnergyInLC[iCP] > maxCPEnergyInLC) {
1836 maxCPEnergyInLC = CPEnergyInLC[iCP];
1840 hitsToCaloParticleId[iHit] = maxCPId;
1842 histograms.h_cellAssociation_perlayer.at(lcLayerId)->Fill(
1843 hitsToCaloParticleId[iHit] > 0. ? 0. : hitsToCaloParticleId[iHit]);
1851 for (
unsigned int lcId = 0; lcId < nLayerClusters; ++lcId) {
1852 const auto firstHitDetId = (
clusters[lcId].hitsAndFractions())[0].
first;
1853 const int lcLayerId =
1859 const auto& cpsIt = cpsInLayerClusterMap.
find(lcRef);
1860 if (cpsIt == cpsInLayerClusterMap.
end())
1863 const auto lc_en =
clusters[lcId].energy();
1864 const auto& cps = cpsIt->val;
1865 if (lc_en == 0. && !cps.empty()) {
1866 for (
const auto& cpPair : cps)
1867 histograms.h_score_layercl2caloparticle_perlayer.at(lcLayerId)->Fill(cpPair.second);
1870 for (
const auto& cpPair : cps) {
1871 LogDebug(
"HGCalValidator") <<
"layerCluster Id: \t" << lcId <<
"\t CP id: \t" << cpPair.first.index()
1872 <<
"\t score \t" << cpPair.second << std::endl;
1873 histograms.h_score_layercl2caloparticle_perlayer.at(lcLayerId)->Fill(cpPair.second);
1874 auto const& cp_linked =
1875 std::find_if(std::begin(cPOnLayerMap[cpPair.first]),
1876 std::end(cPOnLayerMap[cpPair.first]),
1878 return p.first == lcRef;
1881 cPOnLayerMap[cpPair.first].
end())
1883 histograms.h_sharedenergy_layercl2caloparticle_perlayer.at(lcLayerId)->Fill(cp_linked->second.first / lc_en,
1885 histograms.h_energy_vs_score_layercl2caloparticle_perlayer.at(lcLayerId)->Fill(cpPair.second,
1886 cp_linked->second.first / lc_en);
1897 const auto& best = std::min_element(
1898 std::begin(cps),
std::end(cps), [](
const auto& obj1,
const auto& obj2) {
return obj1.second < obj2.second; });
1899 const auto& best_cp_linked =
1900 std::find_if(std::begin(cPOnLayerMap[best->first]),
1901 std::end(cPOnLayerMap[best->first]),
1903 return p.first == lcRef;
1905 if (best_cp_linked ==
1906 cPOnLayerMap[best->first].
end())
1908 histograms.h_sharedenergy_layercl2caloparticle_vs_eta_perlayer.at(lcLayerId)->Fill(
1909 clusters[lcId].
eta(), best_cp_linked->second.first / lc_en);
1910 histograms.h_sharedenergy_layercl2caloparticle_vs_phi_perlayer.at(lcLayerId)->Fill(
1911 clusters[lcId].
phi(), best_cp_linked->second.first / lc_en);
1918 for (
const auto& cpId : cPSelectedIndices) {
1920 const auto& lcsIt = cPOnLayerMap.
find(cpRef);
1922 std::map<unsigned int, float> cPEnergyOnLayer;
1923 for (
unsigned int layerId = 0; layerId <
layers * 2; ++layerId)
1924 cPEnergyOnLayer[layerId] = 0;
1926 for (
const auto& simCluster : cP[cpId].simClusters()) {
1927 for (
const auto& it_haf : simCluster->hits_and_fractions()) {
1928 const DetId hitid = (it_haf.first);
1929 const auto hitLayerId =
1931 std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(hitid);
1932 if (itcheck != hitMap.end()) {
1934 cPEnergyOnLayer[hitLayerId] += it_haf.second *
hit->energy();
1939 for (
unsigned int layerId = 0; layerId <
layers * 2; ++layerId) {
1940 if (!cPEnergyOnLayer[layerId])
1943 histograms.h_denom_caloparticle_eta_perlayer.at(layerId)->Fill(cP[cpId].g4Tracks()[0].momentum().
eta());
1944 histograms.h_denom_caloparticle_phi_perlayer.at(layerId)->Fill(cP[cpId].g4Tracks()[0].momentum().
phi());
1946 if (lcsIt == cPOnLayerMap.
end())
1948 const auto& lcs = lcsIt->val;
1950 auto getLCLayerId = [&](
const unsigned int lcId) {
1951 const auto firstHitDetId = (
clusters[lcId].hitsAndFractions())[0].
first;
1952 const auto lcLayerId =
recHitTools_->getLayerWithOffset(firstHitDetId) +
1957 for (
const auto& lcPair : lcs) {
1958 if (getLCLayerId(lcPair.first.index()) != layerId)
1960 histograms.h_score_caloparticle2layercl_perlayer.at(layerId)->Fill(lcPair.second.second);
1961 histograms.h_sharedenergy_caloparticle2layercl_perlayer.at(layerId)->Fill(
1962 lcPair.second.first / cPEnergyOnLayer[layerId], cPEnergyOnLayer[layerId]);
1963 histograms.h_energy_vs_score_caloparticle2layercl_perlayer.at(layerId)->Fill(
1964 lcPair.second.second, lcPair.second.first / cPEnergyOnLayer[layerId]);
1966 const auto assoc = std::count_if(std::begin(lcs),
std::end(lcs), [&](
const auto&
obj) {
1967 if (getLCLayerId(
obj.first.index()) != layerId)
1973 histograms.h_num_caloparticle_eta_perlayer.at(layerId)->Fill(cP[cpId].g4Tracks()[0].momentum().
eta());
1974 histograms.h_num_caloparticle_phi_perlayer.at(layerId)->Fill(cP[cpId].g4Tracks()[0].momentum().
phi());
1976 histograms.h_numDup_caloparticle_eta_perlayer.at(layerId)->Fill(cP[cpId].g4Tracks()[0].momentum().
eta());
1977 histograms.h_numDup_caloparticle_phi_perlayer.at(layerId)->Fill(cP[cpId].g4Tracks()[0].momentum().
phi());
1979 const auto best = std::min_element(std::begin(lcs),
std::end(lcs), [&](
const auto& obj1,
const auto& obj2) {
1980 if (getLCLayerId(obj1.first.index()) != layerId)
1982 else if (getLCLayerId(obj2.first.index()) == layerId)
1983 return obj1.second.second < obj2.second.second;
1987 histograms.h_sharedenergy_caloparticle2layercl_vs_eta_perlayer.at(layerId)->Fill(
1988 cP[cpId].g4Tracks()[0].momentum().
eta(), best->second.first / cPEnergyOnLayer[layerId]);
1989 histograms.h_sharedenergy_caloparticle2layercl_vs_phi_perlayer.at(layerId)->Fill(
1990 cP[cpId].g4Tracks()[0].momentum().
phi(), best->second.first / cPEnergyOnLayer[layerId]);
2001 edm::Handle<std::vector<SimCluster>> simClusterHandle,
2002 std::vector<SimCluster>
const& sC,
2003 std::vector<size_t>
const& sCIndices,
2004 const std::vector<float>&
mask,
2005 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap,
2012 for (
unsigned int lcId = 0; lcId <
clusters.size(); ++lcId) {
2013 if (
mask[lcId] != 0.) {
2014 LogDebug(
"HGCalValidator") <<
"Skipping layer cluster " << lcId <<
" not belonging to mask" << std::endl;
2017 const auto firstHitDetId = (
clusters[lcId].hitsAndFractions())[0].
first;
2018 const auto lcLayerId =
2026 const auto& scsIt = scsInLayerClusterMap.
find(lcRef);
2027 if (scsIt == scsInLayerClusterMap.
end())
2030 const auto lc_en =
clusters[lcId].energy();
2031 const auto& scs = scsIt->val;
2034 if (lc_en == 0. && !scs.empty()) {
2035 for (
const auto& scPair : scs) {
2036 histograms.h_score_layercl2simcluster_perlayer[
count].at(lcLayerId)->Fill(scPair.second);
2041 for (
const auto& scPair : scs) {
2042 LogDebug(
"HGCalValidator") <<
"layerCluster Id: \t" << lcId <<
"\t SC id: \t" << scPair.first.index()
2043 <<
"\t score \t" << scPair.second << std::endl;
2045 histograms.h_score_layercl2simcluster_perlayer[
count].at(lcLayerId)->Fill(scPair.second);
2046 auto const& sc_linked =
2047 std::find_if(std::begin(lcsInSimClusterMap[scPair.first]),
2048 std::end(lcsInSimClusterMap[scPair.first]),
2050 return p.first == lcRef;
2053 lcsInSimClusterMap[scPair.first].
end())
2055 histograms.h_sharedenergy_layercl2simcluster_perlayer[
count].at(lcLayerId)->Fill(sc_linked->second.first / lc_en,
2057 histograms.h_energy_vs_score_layercl2simcluster_perlayer[
count].at(lcLayerId)->Fill(
2058 scPair.second, sc_linked->second.first / lc_en);
2070 const auto& best = std::min_element(
2071 std::begin(scs),
std::end(scs), [](
const auto& obj1,
const auto& obj2) {
return obj1.second < obj2.second; });
2073 const auto& best_sc_linked =
2074 std::find_if(std::begin(lcsInSimClusterMap[best->first]),
2075 std::end(lcsInSimClusterMap[best->first]),
2077 return p.first == lcRef;
2079 if (best_sc_linked ==
2080 lcsInSimClusterMap[best->first].
end())
2082 histograms.h_sharedenergy_layercl2simcluster_vs_eta_perlayer[
count].at(lcLayerId)->Fill(
2083 clusters[lcId].
eta(), best_sc_linked->second.first / lc_en);
2084 histograms.h_sharedenergy_layercl2simcluster_vs_phi_perlayer[
count].at(lcLayerId)->Fill(
2085 clusters[lcId].
phi(), best_sc_linked->second.first / lc_en);
2092 for (
const auto& scId : sCIndices) {
2094 const auto& lcsIt = lcsInSimClusterMap.
find(scRef);
2096 std::map<unsigned int, float> sCEnergyOnLayer;
2097 for (
unsigned int layerId = 0; layerId <
layers * 2; ++layerId)
2098 sCEnergyOnLayer[layerId] = 0;
2100 for (
const auto& it_haf : sC[scId].hits_and_fractions()) {
2101 const DetId hitid = (it_haf.first);
2102 const auto scLayerId =
2104 std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(hitid);
2105 if (itcheck != hitMap.end()) {
2107 sCEnergyOnLayer[scLayerId] += it_haf.second *
hit->energy();
2111 for (
unsigned int layerId = 0; layerId <
layers * 2; ++layerId) {
2112 if (!sCEnergyOnLayer[layerId])
2118 if (lcsIt == lcsInSimClusterMap.
end())
2120 const auto& lcs = lcsIt->val;
2122 auto getLCLayerId = [&](
const unsigned int lcId) {
2123 const auto firstHitDetId = (
clusters[lcId].hitsAndFractions())[0].
first;
2124 const unsigned int lcLayerId =
recHitTools_->getLayerWithOffset(firstHitDetId) +
2130 for (
const auto& lcPair : lcs) {
2131 auto lcId = lcPair.first.index();
2132 if (
mask[lcId] != 0.) {
2133 LogDebug(
"HGCalValidator") <<
"Skipping layer cluster " << lcId <<
" not belonging to mask" << std::endl;
2137 if (getLCLayerId(lcId) != layerId)
2139 histograms.h_score_simcluster2layercl_perlayer[
count].at(layerId)->Fill(lcPair.second.second);
2140 histograms.h_sharedenergy_simcluster2layercl_perlayer[
count].at(layerId)->Fill(
2141 lcPair.second.first / sCEnergyOnLayer[layerId], sCEnergyOnLayer[layerId]);
2142 histograms.h_energy_vs_score_simcluster2layercl_perlayer[
count].at(layerId)->Fill(
2143 lcPair.second.second, lcPair.second.first / sCEnergyOnLayer[layerId]);
2145 const auto assoc = std::count_if(std::begin(lcs),
std::end(lcs), [&](
const auto&
obj) {
2146 if (getLCLayerId(
obj.first.index()) != layerId)
2155 histograms.h_numDup_simcluster_eta_perlayer[
count].at(layerId)->Fill(sC[scId].
eta());
2156 histograms.h_numDup_simcluster_phi_perlayer[
count].at(layerId)->Fill(sC[scId].
phi());
2158 const auto best = std::min_element(std::begin(lcs),
std::end(lcs), [&](
const auto& obj1,
const auto& obj2) {
2159 if (getLCLayerId(obj1.first.index()) != layerId)
2161 else if (getLCLayerId(obj2.first.index()) == layerId)
2162 return obj1.second.second < obj2.second.second;
2166 histograms.h_sharedenergy_simcluster2layercl_vs_eta_perlayer[
count].at(layerId)->Fill(
2167 sC[scId].
eta(), best->second.first / sCEnergyOnLayer[layerId]);
2168 histograms.h_sharedenergy_simcluster2layercl_vs_phi_perlayer[
count].at(layerId)->Fill(
2169 sC[scId].
phi(), best->second.first / sCEnergyOnLayer[layerId]);
2180 edm::Handle<std::vector<CaloParticle>> caloParticleHandle,
2181 std::vector<CaloParticle>
const& cP,
2182 std::vector<size_t>
const& cPIndices,
2183 std::vector<size_t>
const& cPSelectedIndices,
2184 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap,
2185 std::map<double, double> cummatbudg,
2187 std::vector<int> thicknesses,
2198 std::vector<int> tnlcpl(1000, 0);
2201 std::map<std::string, int> tnlcpthplus;
2202 tnlcpthplus.clear();
2203 std::map<std::string, int> tnlcpthminus;
2204 tnlcpthminus.clear();
2206 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
2207 tnlcpthplus.insert(std::pair<std::string, int>(
std::to_string(*it), 0));
2208 tnlcpthminus.insert(std::pair<std::string, int>(
std::to_string(*it), 0));
2211 tnlcpthplus.insert(std::pair<std::string, int>(
"mixed", 0));
2212 tnlcpthminus.insert(std::pair<std::string, int>(
"mixed", 0));
2223 cpsInLayerClusterMap,
2228 std::vector<double> tecpl(1000, 0.0);
2230 std::vector<double> ldbar(1000, 0.0);
2233 double caloparteneplus = 0.;
2234 double caloparteneminus = 0.;
2235 for (
const auto& cpId : cPIndices) {
2236 if (cP[cpId].
eta() >= 0.) {
2237 caloparteneplus = caloparteneplus + cP[cpId].energy();
2238 }
else if (cP[cpId].
eta() < 0.) {
2239 caloparteneminus = caloparteneminus + cP[cpId].energy();
2244 for (
const auto& lcId :
clusters) {
2245 const auto seedid = lcId.seed();
2246 const double seedx =
recHitTools_->getPosition(seedid).x();
2247 const double seedy =
recHitTools_->getPosition(seedid).y();
2255 int nthhits120p = 0;
2256 int nthhits200p = 0;
2257 int nthhits300p = 0;
2258 int nthhitsscintp = 0;
2259 int nthhits120m = 0;
2260 int nthhits200m = 0;
2261 int nthhits300m = 0;
2262 int nthhitsscintm = 0;
2273 bool cluslay =
true;
2277 const auto& hits_and_fractions = lcId.hitsAndFractions();
2278 for (
std::vector<std::pair<DetId, float>>::const_iterator it_haf = hits_and_fractions.begin();
2279 it_haf != hits_and_fractions.end();
2281 const DetId rh_detid = it_haf->first;
2291 LogDebug(
"HGCalValidator") <<
"These are HGCal layer clusters, you shouldn't be here !!! " << layerid <<
"\n";
2298 while (lay_string.size() < 2)
2299 lay_string.insert(0,
"0");
2300 curistr +=
"_" + lay_string;
2325 <<
" You are running a geometry that contains thicknesses different than the normal ones. " 2329 std::unordered_map<DetId, const HGCRecHit*>::const_iterator itcheck = hitMap.find(rh_detid);
2330 if (itcheck == hitMap.end()) {
2331 LogDebug(
"HGCalValidator") <<
" You shouldn't be here - Unable to find a hit " << rh_detid.
rawId() <<
" " 2340 const double hit_x =
recHitTools_->getPosition(rh_detid).x();
2341 const double hit_y =
recHitTools_->getPosition(rh_detid).y();
2342 double distancetoseed =
distance(seedx, seedy, hit_x, hit_y);
2343 double distancetomax =
distance(maxx, maxy, hit_x, hit_y);
2344 if (distancetoseed != 0. &&
histograms.h_distancetoseedcell_perthickperlayer.count(curistr)) {
2345 histograms.h_distancetoseedcell_perthickperlayer.at(curistr)->Fill(distancetoseed);
2348 if (distancetoseed != 0. &&
histograms.h_distancetoseedcell_perthickperlayer_eneweighted.count(curistr)) {
2349 histograms.h_distancetoseedcell_perthickperlayer_eneweighted.at(curistr)->Fill(distancetoseed,
hit->energy());
2352 if (distancetomax != 0. &&
histograms.h_distancetomaxcell_perthickperlayer.count(curistr)) {
2353 histograms.h_distancetomaxcell_perthickperlayer.at(curistr)->Fill(distancetomax);
2356 if (distancetomax != 0. &&
histograms.h_distancetomaxcell_perthickperlayer_eneweighted.count(curistr)) {
2357 histograms.h_distancetomaxcell_perthickperlayer_eneweighted.at(curistr)->Fill(distancetomax,
hit->energy());
2361 std::map<DetId, float>::const_iterator dit = densities.find(rh_detid);
2362 if (dit == densities.end()) {
2363 LogDebug(
"HGCalValidator") <<
" You shouldn't be here - Unable to find a density " << rh_detid.
rawId() <<
" " 2375 if ((nthhits120p != 0 && nthhits200p != 0) || (nthhits120p != 0 && nthhits300p != 0) ||
2376 (nthhits120p != 0 && nthhitsscintp != 0) || (nthhits200p != 0 && nthhits300p != 0) ||
2377 (nthhits200p != 0 && nthhitsscintp != 0) || (nthhits300p != 0 && nthhitsscintp != 0)) {
2378 tnlcpthplus[
"mixed"]++;
2379 }
else if ((nthhits120p != 0 || nthhits200p != 0 || nthhits300p != 0 || nthhitsscintp != 0)) {
2383 if ((nthhits120m != 0 && nthhits200m != 0) || (nthhits120m != 0 && nthhits300m != 0) ||
2384 (nthhits120m != 0 && nthhitsscintm != 0) || (nthhits200m != 0 && nthhits300m != 0) ||
2385 (nthhits200m != 0 && nthhitsscintm != 0) || (nthhits300m != 0 && nthhitsscintm != 0)) {
2386 tnlcpthminus[
"mixed"]++;
2387 }
else if ((nthhits120m != 0 || nthhits200m != 0 || nthhits300m != 0 || nthhitsscintm != 0)) {
2393 std::vector<int> bigamoth;
2396 bigamoth.push_back(nthhits120p);
2397 bigamoth.push_back(nthhits200p);
2398 bigamoth.push_back(nthhits300p);
2399 bigamoth.push_back(nthhitsscintp);
2400 }
else if (
zside < 0) {
2401 bigamoth.push_back(nthhits120m);
2402 bigamoth.push_back(nthhits200m);
2403 bigamoth.push_back(nthhits300m);
2404 bigamoth.push_back(nthhitsscintm);
2406 auto bgth = std::max_element(bigamoth.begin(), bigamoth.end());
2409 while (lay_string.size() < 2)
2410 lay_string.insert(0,
"0");
2411 istr +=
"_" + lay_string;
2414 if (
histograms.h_cellsnum_perthickperlayer.count(istr)) {
2415 histograms.h_cellsnum_perthickperlayer.at(istr)->Fill(hits_and_fractions.size());
2419 double distancebetseedandmax =
distance(seedx, seedy, maxx, maxy);
2422 seedstr +=
"_" + lay_string;
2423 if (
histograms.h_distancebetseedandmaxcell_perthickperlayer.count(seedstr)) {
2424 histograms.h_distancebetseedandmaxcell_perthickperlayer.at(seedstr)->Fill(distancebetseedandmax);
2426 const auto lc_en = lcId.energy();
2427 if (
histograms.h_distancebetseedandmaxcellvsclusterenergy_perthickperlayer.count(seedstr)) {
2428 histograms.h_distancebetseedandmaxcellvsclusterenergy_perthickperlayer.at(seedstr)->Fill(distancebetseedandmax,
2433 tecpl[layerid] = tecpl[layerid] + lc_en;
2434 ldbar[layerid] = ldbar[layerid] + lc_en * cummatbudg[(double)lay];
2439 double sumeneallcluspl = 0.;
2440 double sumeneallclusmi = 0.;
2442 double sumldbarpl = 0.;
2443 double sumldbarmi = 0.;
2445 for (
unsigned ilayer = 0; ilayer <
layers * 2; ++ilayer) {
2446 if (
histograms.h_clusternum_perlayer.count(ilayer)) {
2447 histograms.h_clusternum_perlayer.at(ilayer)->Fill(tnlcpl[ilayer]);
2452 if (
histograms.h_energyclustered_perlayer.count(ilayer)) {
2453 if (caloparteneminus != 0.) {
2454 histograms.h_energyclustered_perlayer.at(ilayer)->Fill(100. * tecpl[ilayer] / caloparteneminus);
2458 sumeneallclusmi = sumeneallclusmi + tecpl[ilayer];
2460 sumldbarmi = sumldbarmi + ldbar[ilayer];
2462 if (
histograms.h_energyclustered_perlayer.count(ilayer)) {
2463 if (caloparteneplus != 0.) {
2464 histograms.h_energyclustered_perlayer.at(ilayer)->Fill(100. * tecpl[ilayer] / caloparteneplus);
2468 sumeneallcluspl = sumeneallcluspl + tecpl[ilayer];
2470 sumldbarpl = sumldbarpl + ldbar[ilayer];
2476 for (std::vector<int>::iterator it = thicknesses.begin(); it != thicknesses.end(); ++it) {
2477 if (
histograms.h_clusternum_perthick.count(*it)) {
2483 histograms.h_mixedhitscluster_zplus[
count]->Fill(tnlcpthplus[
"mixed"]);
2484 histograms.h_mixedhitscluster_zminus[
count]->Fill(tnlcpthminus[
"mixed"]);
2487 if (caloparteneplus != 0.) {
2488 histograms.h_energyclustered_zplus[
count]->Fill(100. * sumeneallcluspl / caloparteneplus);
2490 if (caloparteneminus != 0.) {
2491 histograms.h_energyclustered_zminus[
count]->Fill(100. * sumeneallclusmi / caloparteneminus);
2495 histograms.h_longdepthbarycentre_zplus[
count]->Fill(sumldbarpl / sumeneallcluspl);
2496 histograms.h_longdepthbarycentre_zminus[
count]->Fill(sumldbarmi / sumeneallclusmi);
2507 const std::map<
unsigned int, std::vector<unsigned int>>& cpToSc_SimTrackstersMap,
2508 std::vector<SimCluster>
const& sC,
2510 std::vector<CaloParticle>
const& cP,
2511 std::vector<size_t>
const& cPIndices,
2512 std::vector<size_t>
const& cPSelectedIndices,
2513 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap,
2514 unsigned int layers)
const {
2515 const auto nTracksters = tracksters.size();
2516 const auto nSimTracksters = simTSs.size();
2518 std::unordered_map<DetId, std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>> detIdSimTSId_Map;
2519 std::unordered_map<DetId, std::vector<HGVHistoProducerAlgo::detIdInfoInTrackster>> detIdToTracksterId_Map;
2520 std::vector<int> tracksters_FakeMerge(nTracksters, 0);
2521 std::vector<int> tracksters_PurityDuplicate(nTracksters, 0);
2526 std::vector<std::vector<std::pair<unsigned int, float>>> stsInTrackster;
2527 stsInTrackster.resize(nTracksters);
2533 std::unordered_map<int, caloParticleOnLayer> cPOnLayer;
2534 std::unordered_map<int, std::vector<caloParticleOnLayer>> sCOnLayer;
2536 for (
const auto cpIndex : cPIndices) {
2537 cPOnLayer[cpIndex].caloParticleId = cpIndex;
2538 cPOnLayer[cpIndex].energy = 0.f;
2539 cPOnLayer[cpIndex].hits_and_fractions.clear();
2540 const auto nSC_inCP = sC.size();
2541 sCOnLayer[cpIndex].resize(nSC_inCP);
2542 for (
unsigned int iSC = 0; iSC < nSC_inCP; iSC++) {
2543 sCOnLayer[cpIndex][iSC].caloParticleId = cpIndex;
2544 sCOnLayer[cpIndex][iSC].energy = 0.f;
2545 sCOnLayer[cpIndex][iSC].hits_and_fractions.clear();
2550 const unsigned int iSTS,
2552 const std::map<unsigned int, std::vector<unsigned int>>& cpToSc_SimTrackstersMap,
2554 unsigned int cpId = -1;
2556 const auto productID = simTS.
seedID();
2557 if (productID == cPHandle_id) {
2560 const auto findSimTSFromCP = std::find_if(
2561 std::begin(cpToSc_SimTrackstersMap),
2563 [&](
const std::pair<
unsigned int, std::vector<unsigned int>>& cpToScs) {
2566 if (findSimTSFromCP !=
std::end(cpToSc_SimTrackstersMap)) {
2567 cpId = simTSs_fromCP[findSimTSFromCP->first].seedIndex();
2574 auto getLCId = [](
const std::vector<unsigned int>& tst_vertices,
2576 const DetId& hitid) {
2577 unsigned int lcId = -1;
2578 std::for_each(std::begin(tst_vertices),
std::end(tst_vertices), [&](
unsigned int idx) {
2580 const auto& hitFound = std::find_if(std::begin(lc_haf),
2582 [&hitid](
const std::pair<DetId, float>&
v) {
return v.first == hitid; });
2583 if (hitFound != lc_haf.end())
2589 for (
unsigned int iSTS = 0; iSTS < nSimTracksters; ++iSTS) {
2590 const auto cpId = getCPId(simTSs[iSTS], iSTS, cPHandle_id, cpToSc_SimTrackstersMap, simTSs_fromCP);
2591 if (
std::find(cPIndices.begin(), cPIndices.end(), cpId) == cPIndices.end())
2595 for (
const auto& simCluster : cP[cpId].simClusters()) {
2596 auto iSim = simTSs[iSTS].seedIndex();
2597 if (simTSs[iSTS].seedID() != cPHandle_id) {
2598 if (iSim != (&(*simCluster) - &(sC[0])))
2603 for (
const auto& it_haf : simCluster->hits_and_fractions()) {
2604 const auto hitid = (it_haf.first);
2608 const auto itcheck = hitMap.find(hitid);
2610 if ((valType == 0 && itcheck != hitMap.end()) || (valType > 0 &&
int(lcId) >= 0)) {
2611 float lcFraction = 0;
2617 const auto elemId = (valType == 0) ? hitid : lcId;
2618 const auto elemFr = (valType == 0) ? it_haf.second : lcFraction;
2626 if (detIdSimTSId_Map.find(elemId) == detIdSimTSId_Map.end()) {
2627 detIdSimTSId_Map[elemId] = std::vector<HGVHistoProducerAlgo::detIdInfoInCluster>();
2631 std::find(detIdSimTSId_Map[elemId].begin(),
2632 detIdSimTSId_Map[elemId].
end(),
2635 if (findSTSIt != detIdSimTSId_Map[elemId].
end()) {
2637 findSTSIt->fraction += elemFr;
2642 const auto hitEn = itcheck->second->energy();
2646 cPOnLayer[cpId].energy += it_haf.second * hitEn;
2647 sCOnLayer[cpId][iSim].energy += elemFr * hitEn;
2654 auto& haf = cPOnLayer[cpId].hits_and_fractions;
2655 auto found = std::find_if(
2656 std::begin(haf),
std::end(haf), [&hitid](
const std::pair<DetId, float>&
v) {
return v.first == hitid; });
2657 if (
found != haf.end())
2658 found->second += it_haf.second;
2660 haf.emplace_back(hitid, it_haf.second);
2662 auto& haf_sc = sCOnLayer[cpId][iSim].hits_and_fractions;
2663 auto found_sc = std::find_if(std::begin(haf_sc),
2665 [&hitid](
const std::pair<DetId, float>&
v) {
return v.first == hitid; });
2666 if (found_sc != haf_sc.end())
2667 found_sc->second += it_haf.second;
2669 haf_sc.emplace_back(hitid, it_haf.second);
2676 std::vector<std::pair<DetId, float>> hits_and_fractions_norm;
2681 hits_and_fractions_norm.emplace_back(
2682 cell.first, cell.second *
fraction);
2685 return hits_and_fractions_norm;
2691 for (
unsigned int tstId = 0; tstId < nTracksters; ++tstId) {
2692 const auto& tst = tracksters[tstId];
2699 if (tst.vertices().empty())
2702 std::unordered_map<unsigned, float> CPEnergyInTS;
2703 int maxCPId_byNumberOfHits = -1;
2704 unsigned int maxCPNumberOfHitsInTS = 0;
2705 int maxCPId_byEnergy = -1;
2706 float maxEnergySharedTSandCP = 0.f;
2707 float energyFractionOfTSinCP = 0.f;
2708 float energyFractionOfCPinTS = 0.f;
2715 std::unordered_map<unsigned, unsigned> occurrencesCPinTS;
2716 unsigned int numberOfNoiseHitsInTS = 0;
2717 unsigned int numberOfHaloHitsInTS = 0;
2719 const auto tst_hitsAndFractions = apply_LCMultiplicity(tst,
layerClusters);
2720 const auto numberOfHitsInTS = tst_hitsAndFractions.size();
2738 std::vector<int> hitsToCaloParticleId(numberOfHitsInTS);
2741 for (
unsigned int iHit = 0; iHit < numberOfHitsInTS; iHit++) {
2742 const auto rh_detid = tst_hitsAndFractions[iHit].first;
2743 const auto rhFraction = tst_hitsAndFractions[iHit].second;
2745 const auto lcId_r = getLCId(tst.vertices(),
layerClusters, rh_detid);
2746 const auto iLC_r =
std::find(tst.vertices().begin(), tst.vertices().end(), lcId_r);
2747 const auto lcFraction_r = 1.f / tst.vertex_multiplicity(
std::distance(std::begin(tst.vertices()), iLC_r));
2756 if (detIdToTracksterId_Map.find(rh_detid) == detIdToTracksterId_Map.end()) {
2757 detIdToTracksterId_Map[rh_detid] = std::vector<HGVHistoProducerAlgo::detIdInfoInTrackster>();
2758 detIdToTracksterId_Map[rh_detid].emplace_back(
2762 std::find(detIdToTracksterId_Map[rh_detid].begin(),
2763 detIdToTracksterId_Map[rh_detid].
end(),
2766 if (findTSIt != detIdToTracksterId_Map[rh_detid].
end()) {
2768 findTSIt->fraction += rhFraction;
2770 detIdToTracksterId_Map[rh_detid].emplace_back(
2780 if (rhFraction == 0.) {
2781 hitsToCaloParticleId[iHit] = -2;
2782 numberOfHaloHitsInTS++;
2786 const auto elemId = (valType == 0) ? rh_detid.rawId() : lcId_r;
2787 const auto recoFr = (valType == 0) ? rhFraction : lcFraction_r;
2788 const auto& hit_find_in_STS = detIdSimTSId_Map.find(elemId);
2789 if (hit_find_in_STS == detIdSimTSId_Map.end()) {
2790 hitsToCaloParticleId[iHit] -= 1;
2793 const auto hitEn = hitMap.find(rh_detid)->second->energy();
2798 auto maxCPEnergyInTS = 0.f;
2800 for (
const auto&
h : hit_find_in_STS->second) {
2801 const auto shared_fraction =
std::min(recoFr,
h.fraction);
2802 const auto iSTS =
h.clusterId;
2803 const auto& simTS = simTSs[iSTS];
2805 if (simTSs[iSTS].seedID() == cPHandle_id)
2812 const auto cpId = getCPId(simTS, iSTS, cPHandle_id, cpToSc_SimTrackstersMap, simTSs_fromCP);
2813 if (
std::find(cPIndices.begin(), cPIndices.end(), cpId) == cPIndices.end())
2816 CPEnergyInTS[cpId] += shared_fraction * hitEn;
2819 cPOnLayer[cpId].layerClusterIdToEnergyAndScore[tstId].first += shared_fraction * hitEn;
2820 sCOnLayer[cpId][iSim].layerClusterIdToEnergyAndScore[tstId].first += shared_fraction * hitEn;
2821 cPOnLayer[cpId].layerClusterIdToEnergyAndScore[tstId].second = FLT_MAX;
2822 sCOnLayer[cpId][iSim].layerClusterIdToEnergyAndScore[tstId].second = FLT_MAX;
2825 stsInTrackster[tstId].emplace_back(iSTS, FLT_MAX);
2828 if (shared_fraction > maxCPEnergyInTS) {
2830 maxCPEnergyInTS = CPEnergyInTS[cpId];
2835 hitsToCaloParticleId[iHit] = maxCPId;
2842 for (
auto c : hitsToCaloParticleId) {
2844 numberOfNoiseHitsInTS++;
2846 occurrencesCPinTS[
c]++;
2851 for (
auto&
c : occurrencesCPinTS) {
2852 if (
c.second > maxCPNumberOfHitsInTS) {
2853 maxCPId_byNumberOfHits =
c.first;
2854 maxCPNumberOfHitsInTS =
c.second;
2859 for (
auto&
c : CPEnergyInTS) {
2860 if (
c.second > maxEnergySharedTSandCP) {
2861 maxCPId_byEnergy =
c.first;
2862 maxEnergySharedTSandCP =
c.second;
2866 float totalCPEnergyFromLayerCP = 0.f;
2867 if (maxCPId_byEnergy >= 0) {
2868 totalCPEnergyFromLayerCP += cPOnLayer[maxCPId_byEnergy].energy;
2869 energyFractionOfCPinTS = maxEnergySharedTSandCP / totalCPEnergyFromLayerCP;
2870 if (tst.raw_energy() > 0.f) {
2871 energyFractionOfTSinCP = maxEnergySharedTSandCP / tst.raw_energy();
2875 LogDebug(
"HGCalValidator") << std::setw(12) <<
"Trackster\t" << std::setw(10) <<
"energy\t" << std::setw(5)
2876 <<
"nhits\t" << std::setw(12) <<
"noise hits\t" << std::setw(22)
2877 <<
"maxCPId_byNumberOfHits\t" << std::setw(8) <<
"nhitsCP\t" << std::setw(16)
2878 <<
"maxCPId_byEnergy\t" << std::setw(23) <<
"maxEnergySharedTSandCP\t" << std::setw(22)
2879 <<
"totalCPEnergyFromAllLayerCP\t" << std::setw(22) <<
"energyFractionOfTSinCP\t" 2880 << std::setw(25) <<
"energyFractionOfCPinTS\t" << std::endl;
2881 LogDebug(
"HGCalValidator") << std::setw(12) << tstId <<
"\t" 2882 << std::setw(10) << tst.raw_energy() <<
"\t" << std::setw(5) << numberOfHitsInTS <<
"\t" 2883 << std::setw(12) << numberOfNoiseHitsInTS <<
"\t" << std::setw(22)
2884 << maxCPId_byNumberOfHits <<
"\t" << std::setw(8) << maxCPNumberOfHitsInTS <<
"\t" 2885 << std::setw(16) << maxCPId_byEnergy <<
"\t" << std::setw(23) << maxEnergySharedTSandCP
2886 <<
"\t" << std::setw(22) << totalCPEnergyFromLayerCP <<
"\t" << std::setw(22)
2887 << energyFractionOfTSinCP <<
"\t" << std::setw(25) << energyFractionOfCPinTS
2893 for (
unsigned int tstId = 0; tstId < nTracksters; ++tstId) {
2894 const auto& tst = tracksters[tstId];
2895 if (tst.vertices().empty())
2900 std::sort(stsInTrackster[tstId].begin(), stsInTrackster[tstId].
end());
2901 const auto last =
std::unique(stsInTrackster[tstId].begin(), stsInTrackster[tstId].
end());
2902 stsInTrackster[tstId].erase(
last, stsInTrackster[tstId].
end());
2904 if (tst.raw_energy() == 0. && !stsInTrackster[tstId].empty()) {
2906 for (
auto& stsPair : stsInTrackster[tstId]) {
2908 stsPair.second = 1.;
2909 LogDebug(
"HGCalValidator") <<
"Trackster Id:\t" << tstId <<
"\tSimTrackster id:\t" << stsPair.first
2910 <<
"\tscore\t" << stsPair.second << std::endl;
2911 histograms.h_score_trackster2caloparticle[valType][
count]->Fill(stsPair.second);
2916 const auto tst_hitsAndFractions = apply_LCMultiplicity(tst,
layerClusters);
2919 float tracksterEnergy = 0.f, invTracksterEnergyWeight = 0.f;
2920 for (
const auto& haf : tst_hitsAndFractions) {
2925 const auto lcId = getLCId(tst.vertices(),
layerClusters, haf.first);
2926 const auto iLC =
std::find(tst.vertices().begin(), tst.vertices().end(), lcId);
2927 hitFr = 1.f / tst.vertex_multiplicity(
std::distance(std::begin(tst.vertices()), iLC));
2929 tracksterEnergy += hitFr * hitMap.at(haf.first)->energy();
2930 invTracksterEnergyWeight +=
pow(hitFr * hitMap.at(haf.first)->energy(), 2);
2932 if (invTracksterEnergyWeight)
2933 invTracksterEnergyWeight = 1.f / invTracksterEnergyWeight;
2935 for (
const auto& haf : tst_hitsAndFractions) {
2936 const auto rh_detid = haf.first;
2937 unsigned int elemId = 0;
2938 float rhFraction = 0.f;
2940 elemId = rh_detid.rawId();
2941 rhFraction = haf.second;
2943 const auto lcId = getLCId(tst.vertices(),
layerClusters, rh_detid);
2945 const auto iLC =
std::find(tst.vertices().begin(), tst.vertices().end(), lcId);
2946 rhFraction = 1.f / tst.vertex_multiplicity(
std::distance(std::begin(tst.vertices()), iLC));
2949 bool hitWithNoSTS =
false;
2950 if (detIdSimTSId_Map.find(elemId) == detIdSimTSId_Map.end())
2951 hitWithNoSTS =
true;
2953 const auto hitEnergyWeight =
pow(
hit->energy(), 2);
2955 for (
auto& stsPair : stsInTrackster[tstId]) {
2956 float cpFraction = 0.f;
2957 if (!hitWithNoSTS) {
2959 detIdSimTSId_Map[elemId].begin(),
2960 detIdSimTSId_Map[elemId].
end(),
2962 stsPair.first, 0.f});
2963 if (findSTSIt != detIdSimTSId_Map[elemId].
end())
2964 cpFraction = findSTSIt->fraction;
2966 if (stsPair.second == FLT_MAX) {
2967 stsPair.second = 0.f;
2970 min(
pow(rhFraction - cpFraction, 2),
pow(rhFraction, 2)) * hitEnergyWeight * invTracksterEnergyWeight;
2975 if (stsInTrackster[tstId].
empty())
2976 LogDebug(
"HGCalValidator") <<
"Trackster Id: " << tstId <<
"\tSimTrackster id: -1" 2979 tracksters_FakeMerge[tstId] =
2980 std::count_if(std::begin(stsInTrackster[tstId]),
2982 [ScoreCutTStoSTSFakeMerge](
const auto&
obj) {
return obj.second < ScoreCutTStoSTSFakeMerge; });
2984 const auto score = std::min_element(std::begin(stsInTrackster[tstId]),
2986 [](
const auto& obj1,
const auto& obj2) {
return obj1.second < obj2.second; });
2988 float sharedEneFrac2 = 0;
2989 for (
const auto& stsPair : stsInTrackster[tstId]) {
2990 const auto iSTS = stsPair.first;
2991 const auto iScore = stsPair.second;
2992 const auto cpId = getCPId(simTSs[iSTS], iSTS, cPHandle_id, cpToSc_SimTrackstersMap, simTSs_fromCP);
2993 auto iSim = simTSs[iSTS].seedIndex();
2994 if (simTSs[iSTS].seedID() == cPHandle_id)
2996 const auto& simOnLayer = (valType == 0) ? cPOnLayer[cpId] : sCOnLayer[cpId][iSim];
2998 float sharedeneCPallLayers = 0.;
2999 sharedeneCPallLayers += simOnLayer.layerClusterIdToEnergyAndScore.count(tstId)
3000 ? simOnLayer.layerClusterIdToEnergyAndScore.at(tstId).first
3002 if (tracksterEnergy == 0)
3004 const auto sharedEneFrac = sharedeneCPallLayers / tracksterEnergy;
3005 LogDebug(
"HGCalValidator") <<
"\nTrackster id: " << tstId <<
" (" << tst.vertices().size() <<
" vertices)" 3006 <<
"\tSimTrackster Id: " << iSTS <<
" (" << simTSs[iSTS].vertices().size()
3008 <<
" (CP id: " << cpId <<
")\tscore: " << iScore
3009 <<
"\tsharedeneCPallLayers: " << sharedeneCPallLayers << std::endl;
3011 histograms.h_score_trackster2caloparticle[valType][
count]->Fill(iScore);
3012 histograms.h_sharedenergy_trackster2caloparticle[valType][
count]->Fill(sharedEneFrac);
3013 histograms.h_energy_vs_score_trackster2caloparticle[valType][
count]->Fill(iScore, sharedEneFrac);
3014 if (iSTS ==
score->first) {
3015 histograms.h_score_trackster2bestCaloparticle[valType][
count]->Fill(iScore);
3016 histograms.h_sharedenergy_trackster2bestCaloparticle[valType][
count]->Fill(sharedEneFrac);
3017 histograms.h_sharedenergy_trackster2bestCaloparticle_vs_eta[valType][
count]->Fill(tst.barycenter().eta(),
3019 histograms.h_sharedenergy_trackster2bestCaloparticle_vs_phi[valType][
count]->Fill(tst.barycenter().phi(),
3021 histograms.h_energy_vs_score_trackster2bestCaloparticle[valType][
count]->Fill(iScore, sharedEneFrac);
3022 }
else if (score2 < 0 || iScore < score2) {
3024 sharedEneFrac2 = sharedEneFrac;
3028 histograms.h_score_trackster2bestCaloparticle2[valType][
count]->Fill(score2);
3029 histograms.h_sharedenergy_trackster2bestCaloparticle2[valType][
count]->Fill(sharedEneFrac2);
3030 histograms.h_energy_vs_score_trackster2bestCaloparticle2[valType][
count]->Fill(score2, sharedEneFrac2);
3034 std::unordered_map<unsigned int, std::vector<float>> score3d;
3035 std::unordered_map<unsigned int, std::vector<float>> tstSharedEnergy;
3037 for (
unsigned int iSTS = 0; iSTS < nSimTracksters; ++iSTS) {
3038 score3d[iSTS].resize(nTracksters);
3039 tstSharedEnergy[iSTS].resize(nTracksters);
3040 for (
unsigned int j = 0;
j < nTracksters; ++
j) {
3041 score3d[iSTS][
j] = FLT_MAX;
3042 tstSharedEnergy[iSTS][
j] = 0.f;
3049 for (
unsigned int iSTS = 0; iSTS < nSimTracksters; ++iSTS) {
3050 const auto& sts = simTSs[iSTS];
3051 const auto& cpId = getCPId(sts, iSTS, cPHandle_id, cpToSc_SimTrackstersMap, simTSs_fromCP);
3052 if (valType == 0 &&
std::find(cPSelectedIndices.begin(), cPSelectedIndices.end(), cpId) == cPSelectedIndices.end())
3055 const auto& hafLC = apply_LCMultiplicity(sts,
layerClusters);
3056 float SimEnergy_LC = 0.f;
3057 for (
const auto& haf : hafLC) {
3058 const auto lcId = getLCId(sts.vertices(),
layerClusters, haf.first);
3059 const auto iLC =
std::find(sts.vertices().begin(), sts.vertices().end(), lcId);
3061 hitMap.at(haf.first)->energy() / sts.vertex_multiplicity(
std::distance(std::begin(sts.vertices()), iLC));
3064 auto iSim = sts.seedIndex();
3065 if (sts.seedID() == cPHandle_id)
3067 auto& simOnLayer = (valType == 0) ? cPOnLayer[cpId] : sCOnLayer[cpId][iSim];
3071 std::set<unsigned int> stsId_tstId_related;
3072 auto& score3d_iSTS = score3d[iSTS];
3074 float SimEnergy = 0.f;
3075 float SimEnergyWeight = 0.f, hitsEnergyWeight = 0.f;
3077 const auto SimNumberOfHits = simOnLayer.hits_and_fractions.size();
3078 if (SimNumberOfHits == 0)
3080 SimEnergy += simOnLayer.energy;
3081 int tstWithMaxEnergyInCP = -1;
3083 float maxEnergyTSperlayerinSim = 0.f;
3084 float SimEnergyFractionInTSperlayer = 0.f;
3086 for (
const auto& tst : simOnLayer.layerClusterIdToEnergyAndScore) {
3087 if (tst.second.first > maxEnergyTSperlayerinSim) {
3088 maxEnergyTSperlayerinSim = tst.second.first;
3089 tstWithMaxEnergyInCP = tst.first;
3092 if (SimEnergy > 0.
f)
3093 SimEnergyFractionInTSperlayer = maxEnergyTSperlayerinSim / SimEnergy;
3095 LogDebug(
"HGCalValidator") << std::setw(12) <<
"caloparticle\t" << std::setw(15) <<
"cp total energy\t" 3096 << std::setw(15) <<
"cpEnergyOnLayer\t" << std::setw(14) <<
"CPNhitsOnLayer\t" 3097 << std::setw(18) <<
"tstWithMaxEnergyInCP\t" << std::setw(15) <<
"maxEnergyTSinCP\t" 3098 << std::setw(20) <<
"CPEnergyFractionInTS" 3100 LogDebug(
"HGCalValidator") << std::setw(12) << cpId <<
"\t" << std::setw(15) << sts.raw_energy() <<
"\t" 3101 << std::setw(15) << SimEnergy <<
"\t" << std::setw(14) << SimNumberOfHits <<
"\t" 3102 << std::setw(18) << tstWithMaxEnergyInCP <<
"\t" << std::setw(15)
3103 << maxEnergyTSperlayerinSim <<
"\t" << std::setw(20) << SimEnergyFractionInTSperlayer
3106 for (
const auto& haf : ((valType == 0) ? simOnLayer.hits_and_fractions : hafLC)) {
3107 const auto& hitDetId = haf.first;
3112 SimEnergyWeight +=
pow(haf.second * hitMap.at(hitDetId)->energy(), 2);
3114 const auto lcId = getLCId(sts.vertices(),
layerClusters, hitDetId);
3115 float cpFraction = 0.f;
3117 cpFraction = haf.second;
3119 const auto iLC =
std::find(sts.vertices().begin(), sts.vertices().end(), lcId);
3120 cpFraction = 1.f / sts.vertex_multiplicity(
std::distance(std::begin(sts.vertices()), iLC));
3122 if (cpFraction == 0.
f)
3125 bool hitWithNoTS =
false;
3126 if (detIdToTracksterId_Map.find(hitDetId) == detIdToTracksterId_Map.end())
3129 const auto hitEnergyWeight =
pow(
hit->energy(), 2);
3130 hitsEnergyWeight +=
pow(cpFraction, 2) * hitEnergyWeight;
3132 for (
auto& tsPair : simOnLayer.layerClusterIdToEnergyAndScore) {
3133 const auto tstId = tsPair.first;
3134 stsId_tstId_related.insert(tstId);
3136 float tstFraction = 0.f;
3138 const auto findTSIt =
3139 std::find(detIdToTracksterId_Map[hitDetId].begin(),
3140 detIdToTracksterId_Map[hitDetId].
end(),
3143 if (findTSIt != detIdToTracksterId_Map[hitDetId].
end()) {
3145 tstFraction = findTSIt->fraction;
3148 tracksters[tstId].
vertices().begin(), tracksters[tstId].
vertices().
end(), findTSIt->clusterId);
3150 tstFraction = 1.f / tracksters[tstId].vertex_multiplicity(
3158 if (tsPair.second.second == FLT_MAX) {
3159 tsPair.second.second = 0.f;
3161 tsPair.second.second +=
min(
pow(tstFraction - cpFraction, 2),
pow(cpFraction, 2)) * hitEnergyWeight;
3163 LogDebug(
"HGCalValidator") <<
"\nTracksterId:\t" << tstId <<
"\tSimTracksterId:\t" << iSTS <<
"\tcpId:\t" 3164 << cpId <<
"\ttstfraction, cpfraction:\t" << tstFraction <<
", " << cpFraction
3165 <<
"\thitEnergyWeight:\t" << hitEnergyWeight <<
"\tadded delta:\t" 3166 <<
pow((tstFraction - cpFraction), 2) * hitEnergyWeight
3167 <<
"\tcurrent Sim-score numerator:\t" << tsPair.second.second
3168 <<
"\tshared Sim energy:\t" << tsPair.second.first <<
'\n';
3172 if (simOnLayer.layerClusterIdToEnergyAndScore.empty())
3173 LogDebug(
"HGCalValidator") <<
"CP Id:\t" << cpId <<
"\tTS id:\t-1" 3174 <<
" Sub score in \t -1\n";
3176 for (
const auto& tsPair : simOnLayer.layerClusterIdToEnergyAndScore) {
3177 const auto tstId = tsPair.first;
3179 if (score3d_iSTS[tstId] == FLT_MAX) {
3180 score3d_iSTS[tstId] = 0.f;
3182 score3d_iSTS[tstId] += tsPair.second.second;
3183 tstSharedEnergy[iSTS][tstId] += tsPair.second.first;
3187 const auto scoreDenom = (valType == 0) ? SimEnergyWeight : hitsEnergyWeight;
3188 const auto energyDenom = (valType == 0) ? SimEnergy : SimEnergy_LC;
3190 const auto sts_eta = sts.barycenter().eta();
3191 const auto sts_phi = sts.barycenter().phi();
3192 const auto sts_en = sts.raw_energy();
3193 const auto sts_pt = sts.raw_pt();
3204 bool sts_considered_efficient =
false;
3205 bool sts_considered_pure =
false;
3206 for (
const auto tstId : stsId_tstId_related) {
3208 score3d_iSTS[tstId] /= scoreDenom;
3209 const auto tstSharedEnergyFrac = tstSharedEnergy[iSTS][tstId] / energyDenom;
3210 LogDebug(
"HGCalValidator") <<
"STS id: " << iSTS <<
"\t(CP id: " << cpId <<
")\tTS id: " << tstId
3211 <<
"\nSimEnergy: " << energyDenom <<
"\tSimEnergyWeight: " << SimEnergyWeight
3212 <<
"\tTrackste energy: " << tracksters[tstId].raw_energy()
3213 <<
"\nscore: " << score3d_iSTS[tstId]
3214 <<
"\tshared energy: " << tstSharedEnergy[iSTS][tstId]
3215 <<
"\tshared energy fraction: " << tstSharedEnergyFrac <<
"\n";
3217 histograms.h_score_caloparticle2trackster[valType][
count]->Fill(score3d_iSTS[tstId]);
3218 histograms.h_sharedenergy_caloparticle2trackster[valType][
count]->Fill(tstSharedEnergyFrac);
3219 histograms.h_energy_vs_score_caloparticle2trackster[valType][
count]->Fill(score3d_iSTS[tstId],
3220 tstSharedEnergyFrac);
3223 sts_considered_efficient =
true;
3230 if (score3d_iSTS[tstId] < ScoreCutSTStoTSPurDup) {
3231 if (tracksters_PurityDuplicate[tstId] < 1)
3232 tracksters_PurityDuplicate[tstId]++;
3233 if (sts_considered_pure)
3234 tracksters_PurityDuplicate[tstId]++;
3235 sts_considered_pure =
true;
3239 const auto best = std::min_element(std::begin(score3d_iSTS),
std::end(score3d_iSTS));
3240 if (best != score3d_iSTS.end()) {
3241 const auto bestTstId =
std::distance(std::begin(score3d_iSTS), best);
3242 const auto bestTstSharedEnergyFrac = tstSharedEnergy[iSTS][bestTstId] / energyDenom;
3243 histograms.h_scorePur_caloparticle2trackster[valType][
count]->Fill(*best);
3244 histograms.h_sharedenergy_caloparticle2trackster_assoc[valType][
count]->Fill(bestTstSharedEnergyFrac);
3245 histograms.h_sharedenergy_caloparticle2trackster_assoc_vs_eta[valType][
count]->Fill(sts_eta,
3246 bestTstSharedEnergyFrac);
3247 histograms.h_sharedenergy_caloparticle2trackster_assoc_vs_phi[valType][
count]->Fill(sts_phi,
3248 bestTstSharedEnergyFrac);
3249 histograms.h_energy_vs_score_caloparticle2bestTrackster[valType][
count]->Fill(*best, bestTstSharedEnergyFrac);
3250 LogDebug(
"HGCalValidator") <<
count <<
" " << sts_eta <<
" " << sts_phi <<
" " 3251 << tracksters[bestTstId].raw_energy() <<
" " << sts.raw_energy() <<
" " 3252 << bestTstSharedEnergyFrac <<
"\n";
3254 if (score3d_iSTS.size() > 1) {
3255 auto best2 = (best == score3d_iSTS.begin()) ?
std::next(best, 1) : score3d_iSTS.begin();
3256 for (
auto tstId = score3d_iSTS.begin(); tstId != score3d_iSTS.end() && tstId != best; tstId++)
3257 if (*tstId < *best2)
3259 const auto best2TstId =
std::distance(std::begin(score3d_iSTS), best2);
3260 const auto best2TstSharedEnergyFrac = tstSharedEnergy[iSTS][best2TstId] / energyDenom;
3261 histograms.h_scoreDupl_caloparticle2trackster[valType][
count]->Fill(*best2);
3262 histograms.h_sharedenergy_caloparticle2trackster_assoc2[valType][
count]->Fill(best2TstSharedEnergyFrac);
3263 histograms.h_energy_vs_score_caloparticle2bestTrackster2[valType][
count]->Fill(*best2,
3264 best2TstSharedEnergyFrac);
3272 for (
unsigned int tstId = 0; tstId < nTracksters; ++tstId) {
3273 const auto& tst = tracksters[tstId];
3274 if (tst.vertices().empty())
3276 const auto iTS_eta = tst.barycenter().eta();
3277 const auto iTS_phi = tst.barycenter().phi();
3278 const auto iTS_en = tst.raw_energy();
3279 const auto iTS_pt = tst.raw_pt();
3285 if (tracksters_PurityDuplicate[tstId] > 0) {
3291 if (tracksters_PurityDuplicate[tstId] > 1) {
3299 if (tracksters_FakeMerge[tstId] > 0) {
3305 if (tracksters_FakeMerge[tstId] > 1) {
3322 const std::map<
unsigned int, std::vector<unsigned int>>& cpToSc_SimTrackstersMap,
3323 std::vector<SimCluster>
const& sC,
3325 std::vector<CaloParticle>
const& cP,
3326 std::vector<size_t>
const& cPIndices,
3327 std::vector<size_t>
const& cPSelectedIndices,
3328 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap,
3329 unsigned int layers)
const {
3337 int totNContTstZp = 0;
3338 int totNContTstZm = 0;
3340 int totNNotContTstZp = 0;
3341 int totNNotContTstZm = 0;
3343 std::vector<bool> contTracksters;
3344 contTracksters.clear();
3347 std::unordered_map<unsigned int, std::vector<unsigned int>> multiplicity;
3349 std::unordered_map<unsigned int, std::vector<unsigned int>> multiplicity_vs_layer;
3356 const auto nTracksters = tracksters.size();
3358 for (
unsigned int tstId = 0; tstId < nTracksters; ++tstId) {
3359 const auto& tst = tracksters[tstId];
3360 if (tst.vertices().empty())
3363 if (tst.barycenter().z() < 0.)
3365 else if (tst.barycenter().z() > 0.)
3373 std::vector<int> tnLcInTstperlay(1000, 0);
3377 std::set<unsigned int> trackster_layers;
3379 bool tracksterInZplus =
false;
3380 bool tracksterInZminus =
false;
3383 for (
const auto lcId : tst.vertices()) {
3385 const auto& hits_and_fractions =
layerClusters[lcId].hitsAndFractions();
3388 multiplicity[tstId].emplace_back(hits_and_fractions.size());
3390 const auto firstHitDetId = hits_and_fractions[0].first;
3392 const auto layerid =
recHitTools_->getLayerWithOffset(firstHitDetId) +
3394 trackster_layers.insert(layerid);
3395 multiplicity_vs_layer[tstId].emplace_back(layerid);
3397 tnLcInTstperlay[layerid]++;
3401 tracksterInZplus =
true;
3403 tracksterInZminus =
true;
3407 for (
unsigned ilayer = 0; ilayer <
layers * 2; ++ilayer) {
3408 if (
histograms.h_clusternum_in_trackster_perlayer[
count].count(ilayer) && tnLcInTstperlay[ilayer] != 0) {
3409 histograms.h_clusternum_in_trackster_perlayer[
count].at(ilayer)->Fill((
float)tnLcInTstperlay[ilayer]);
3412 if (tnLcInTstperlay[ilayer] != 0) {
3413 histograms.h_clusternum_in_trackster_vs_layer[
count]->Fill((
float)ilayer, (
float)tnLcInTstperlay[ilayer]);
3418 std::vector<int> trackster_layers_vec(trackster_layers.begin(), trackster_layers.end());
3420 bool contiTrackster =
false;
3422 if (trackster_layers_vec.size() >= 3) {
3423 for (
unsigned int iLayer = 1; iLayer < trackster_layers_vec.size() - 1; ++iLayer) {
3424 if ((trackster_layers_vec[iLayer - 1] + 1 == trackster_layers_vec[iLayer]) &&
3425 (trackster_layers_vec[iLayer + 1] - 1 == trackster_layers_vec[iLayer])) {
3427 if (tracksterInZplus)
3429 else if (tracksterInZminus)
3432 contiTrackster =
true;
3438 if (!contiTrackster) {
3439 if (tracksterInZplus)
3441 else if (tracksterInZminus)
3446 contTracksters.push_back(contiTrackster);
3450 for (
unsigned int lc = 0; lc < multiplicity[tstId].size(); ++lc) {
3452 float mlp =
std::count(std::begin(multiplicity[tstId]),
std::end(multiplicity[tstId]), multiplicity[tstId][lc]);
3455 histograms.h_multiplicityOfLCinTST[
count]->Fill(mlp, multiplicity[tstId][lc]);
3461 if (multiplicity_vs_layer[tstId][lc] <
layers) {
3462 histograms.h_multiplicityOfLCinTST_vs_layercluster_zminus[
count]->Fill(mlp, multiplicity_vs_layer[tstId][lc]);
3463 histograms.h_multiplicity_zminus_numberOfEventsHistogram[
count]->Fill(mlp);
3465 histograms.h_multiplicityOfLCinTST_vs_layercluster_zplus[
count]->Fill(
3466 mlp, multiplicity_vs_layer[tstId][lc] -
layers);
3467 histograms.h_multiplicity_zplus_numberOfEventsHistogram[
count]->Fill(mlp);
3470 histograms.h_multiplicityOfLCinTST_vs_layerclusterenergy[
count]->Fill(mlp,
3474 if (!trackster_layers.empty()) {
3481 histograms.h_trackster_firstlayer[
count]->Fill((
float)*trackster_layers.begin());
3482 histograms.h_trackster_lastlayer[
count]->Fill((
float)*trackster_layers.rbegin());
3483 histograms.h_trackster_layersnum[
count]->Fill((
float)trackster_layers.size());
3492 histograms.h_conttracksternum[
count]->Fill(totNContTstZp + totNContTstZm);
3493 histograms.h_nonconttracksternum[
count]->Fill(totNNotContTstZp + totNNotContTstZm);
3503 cpToSc_SimTrackstersMap,
3520 cpToSc_SimTrackstersMap,
3533 const double y2)
const {
3534 const double dx =
x1 -
x2;
3535 const double dy =
y1 -
y2;
3541 const double y2)
const {
3550 std::unordered_map<DetId, const HGCRecHit*>
const& hitMap)
const {
3555 for (
std::vector<std::pair<DetId, float>>::const_iterator it_haf = hits_and_fractions.begin();
3556 it_haf != hits_and_fractions.end();
3558 const DetId rh_detid = it_haf->first;
3559 const auto hitEn = hitMap.find(rh_detid)->second->energy();
3561 if (maxene < hitEn) {
3563 themaxid = rh_detid;
const std::vector< SimTrack > & g4Tracks() const
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
double minTSTSharedEneFracEfficiency_
const double ScoreCutSCtoLC_
double maxMixedHitsSimCluster_
double minDisToSeedperthickperlayerenewei_
const SimClusterRefVector & simClusters() const
double maxTotNsimClsperlay_
void bookTracksterHistos(DQMStore::IBooker &ibook, Histograms &histograms, unsigned int layers)
int nintCellsEneDensperthick_
int nintClEneperthickperlayer_
void setRecHitTools(std::shared_ptr< hgcal::RecHitTools > recHitTools)
double maxTotNClsinTSTsperlayer_
const double ScoreCutLCtoSC_
std::string to_string(const V &value)
void fill_info_histos(const Histograms &histograms, unsigned int layers) const
int nintDisToMaxperthickperlayerenewei_
void bookClusterHistos_LCtoCP_association(DQMStore::IBooker &ibook, Histograms &histograms, unsigned int layers)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
constexpr Detector det() const
get the detector field from this detid
int nintDisToMaxperthickperlayer_
const_iterator find(const key_type &k) const
find element with specified reference key
void bookInfo(DQMStore::IBooker &ibook, Histograms &histograms)
const_iterator end() const
last iterator over the map (read only)
float energy() const
Energy. Note this is taken from the first SimTrack only.
void bookSimClusterAssociationHistos(DQMStore::IBooker &ibook, Histograms &histograms, unsigned int layers, std::vector< int > thicknesses)
DetId findmaxhit(const reco::CaloCluster &cluster, std::unordered_map< DetId, const HGCRecHit *> const &) const
void fill_caloparticle_histos(const Histograms &histograms, int pdgid, const CaloParticle &caloparticle, std::vector< SimVertex > const &simVertices, unsigned int layers, std::unordered_map< DetId, const HGCRecHit *> const &) const
void bookSimClusterHistos(DQMStore::IBooker &ibook, Histograms &histograms, unsigned int layers, std::vector< int > thicknesses)
void fill_cluster_histos(const Histograms &histograms, const int count, const reco::CaloCluster &cluster) const
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
double minClEnepermultiplicity_
float pt() const
Transverse momentum. Note this is taken from the first SimTrack only.
def unique(seq, keepstr=True)
double maxMixedHitsCluster_
double minTotNsimClsperlay_
double minDisSeedToMaxperthickperlayer_
double distance2(const double x1, const double y1, const double x2, const double y2) const
int nintDisToSeedperthickperlayerenewei_
void layerClusters_to_SimClusters(const Histograms &histograms, const int count, edm::Handle< reco::CaloClusterCollection > clusterHandle, const reco::CaloClusterCollection &clusters, edm::Handle< std::vector< SimCluster >> simClusterHandle, std::vector< SimCluster > const &simClusters, std::vector< size_t > const &sCIndices, const std::vector< float > &mask, std::unordered_map< DetId, const HGCRecHit *> const &, unsigned int layers, const hgcal::RecoToSimCollectionWithSimClusters &recSimColl, const hgcal::SimToRecoCollectionWithSimClusters &simRecColl) const
double minTSTSharedEneFrac_
std::vector< CaloCluster > CaloClusterCollection
collection of CaloCluster objects
double minDisToMaxperthickperlayer_
void bookCaloParticleHistos(DQMStore::IBooker &ibook, Histograms &histograms, int pdgid, unsigned int layers)
int nintTotNClsinTSTsperlayer_
void bookTracksterSTSHistos(DQMStore::IBooker &ibook, Histograms &histograms, const validationType valType)
const double ScoreCutTStoSTSFakeMerge_[]
double maxDisToMaxperthickperlayer_
const double ScoreCutLCtoCP_
double maxDisToSeedperthickperlayer_
float phi() const
Momentum azimuthal angle. Note this is taken from the first SimTrack only.
void fill_generic_cluster_histos(const Histograms &histograms, const int count, edm::Handle< reco::CaloClusterCollection > clusterHandle, const reco::CaloClusterCollection &clusters, const Density &densities, edm::Handle< std::vector< CaloParticle >> caloParticleHandle, std::vector< CaloParticle > const &cP, std::vector< size_t > const &cPIndices, std::vector< size_t > const &cPSelectedIndices, std::unordered_map< DetId, const HGCRecHit *> const &, std::map< double, double > cummatbudg, unsigned int layers, std::vector< int > thicknesses, const hgcal::RecoToSimCollection &recSimColl, const hgcal::SimToRecoCollection &simRecColl) const
double getEta(double eta) const
std::vector< unsigned int > & vertices()
double maxTotNcellsperthickperlayer_
double maxDisSeedToMaxperthickperlayer_
double minDisToSeedperthickperlayer_
size_type size() const
Size of the RefVector.
void fill_trackster_histos(const Histograms &histograms, const int count, const ticl::TracksterCollection &Tracksters, const reco::CaloClusterCollection &layerClusters, const ticl::TracksterCollection &simTS, const ticl::TracksterCollection &simTS_fromCP, std::map< uint, std::vector< uint >> const &simTrackstersMap, std::vector< SimCluster > const &sC, const edm::ProductID &cPHandle_id, std::vector< CaloParticle > const &cP, std::vector< size_t > const &cPIndices, std::vector< size_t > const &cPSelectedIndices, std::unordered_map< DetId, const HGCRecHit *> const &, unsigned int layers) const
const edm::ProductID & seedID() const
double minTotNClsinTSTsperlayer_
double maxDisToSeedperthickperlayerenewei_
std::shared_ptr< hgcal::RecHitTools > recHitTools_
constexpr uint32_t rawId() const
get the raw id
double maxTotNsimClsperthick_
std::vector< float > & vertex_multiplicity()
double minTotNClsperthick_
void tracksters_to_SimTracksters(const Histograms &histograms, const int count, const ticl::TracksterCollection &Tracksters, const reco::CaloClusterCollection &layerClusters, const ticl::TracksterCollection &simTS, const validationType valType, const ticl::TracksterCollection &simTS_fromCP, std::map< uint, std::vector< uint >> const &simTrackstersMap, std::vector< SimCluster > const &sC, const edm::ProductID &cPHandle_id, std::vector< CaloParticle > const &cP, std::vector< size_t > const &cPIndices, std::vector< size_t > const &cPSelectedIndices, std::unordered_map< DetId, const HGCRecHit *> const &, unsigned int layers) const
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
double minTotNsimClsperthick_
MonitorElement * bookInt(TString const &name, FUNC onbooking=NOOP())
const double ScoreCutSTStoTSPurDup_[]
void bookClusterHistos_ClusterLevel(DQMStore::IBooker &ibook, Histograms &histograms, unsigned int layers, std::vector< int > thicknesses, std::string pathtomatbudfile)
int nintTotNsimClsperlay_
int nintMixedHitsSimCluster_
int nintDisSeedToMaxperthickperlayer_
const int seedIndex() const
double minTotNcellsperthickperlayer_
double minClEneperthickperlayer_
static int position[264][3]
double minMixedHitsSimCluster_
double minDisToMaxperthickperlayerenewei_
int nintClEnepermultiplicity_
int nintTotNsimClsperthick_
std::vector< Trackster > TracksterCollection
double maxTotNClsperthick_
double maxClEnepermultiplicity_
double eta() const
pseudorapidity of cluster centroid
void bookClusterHistos_CellLevel(DQMStore::IBooker &ibook, Histograms &histograms, unsigned int layers, std::vector< int > thicknesses)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
void layerClusters_to_CaloParticles(const Histograms &histograms, edm::Handle< reco::CaloClusterCollection > clusterHandle, const reco::CaloClusterCollection &clusters, edm::Handle< std::vector< CaloParticle >> caloParticleHandle, std::vector< CaloParticle > const &cP, std::vector< size_t > const &cPIndices, std::vector< size_t > const &cPSelectedIndices, std::unordered_map< DetId, const HGCRecHit *> const &, unsigned int layers, const hgcal::RecoToSimCollection &recSimColl, const hgcal::SimToRecoCollection &simRecColl) const
double distance(const double x1, const double y1, const double x2, const double y2) const
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
double maxCellsEneDensperthick_
double maxDisToMaxperthickperlayerenewei_
hgcal_clustering::Density Density
const double ScoreCutCPtoLC_
int nintMixedHitsCluster_
double minMixedHitsCluster_
float eta() const
Momentum pseudorapidity. Note this is taken from the simtrack before the calorimeter.
double maxClEneperthickperlayer_
int nintDisToSeedperthickperlayer_
int nintTotNcellsperthickperlayer_
Power< A, B >::type pow(const A &a, const B &b)
HGVHistoProducerAlgo(const edm::ParameterSet &pset)
double maxTSTSharedEneFrac_
double minCellsEneDensperthick_