37 EBuncalibrechitCollection_Token_ =
39 EEuncalibrechitCollection_Token_ =
41 EBHits_Token_ = consumes<CrossingFrame<PCaloHit>>(
43 EEHits_Token_ = consumes<CrossingFrame<PCaloHit>>(
45 ESHits_Token_ = consumes<CrossingFrame<PCaloHit>>(
52 if (!outputFile_.empty()) {
53 LogInfo(
"OutputInfo") <<
" Ecal RecHits Task histograms will be saved to '" << outputFile_.c_str() <<
"'";
55 LogInfo(
"OutputInfo") <<
" Ecal RecHits Task histograms will NOT be saved";
63 meGunEnergy_ =
nullptr;
66 meEBRecHitSimHitRatio_ =
nullptr;
67 meEERecHitSimHitRatio_ =
nullptr;
68 meESRecHitSimHitRatio_ =
nullptr;
69 meEBRecHitSimHitRatio1011_ =
nullptr;
70 meEERecHitSimHitRatio1011_ =
nullptr;
71 meEBRecHitSimHitRatio12_ =
nullptr;
72 meEERecHitSimHitRatio12_ =
nullptr;
73 meEBRecHitSimHitRatio13_ =
nullptr;
74 meEERecHitSimHitRatio13_ =
nullptr;
75 meEBRecHitSimHitRatioGt35_ =
nullptr;
76 meEERecHitSimHitRatioGt35_ =
nullptr;
77 meEBUnRecHitSimHitRatio_ =
nullptr;
78 meEEUnRecHitSimHitRatio_ =
nullptr;
79 meEBUnRecHitSimHitRatioGt35_ =
nullptr;
80 meEEUnRecHitSimHitRatioGt35_ =
nullptr;
82 meEBe5x5OverSimHits_ =
nullptr;
83 meEBe5x5OverGun_ =
nullptr;
85 meEEe5x5OverSimHits_ =
nullptr;
86 meEEe5x5OverGun_ =
nullptr;
88 meEBRecHitLog10Energy_ =
nullptr;
89 meEERecHitLog10Energy_ =
nullptr;
90 meESRecHitLog10Energy_ =
nullptr;
91 meEBRecHitLog10EnergyContr_ =
nullptr;
92 meEERecHitLog10EnergyContr_ =
nullptr;
93 meESRecHitLog10EnergyContr_ =
nullptr;
94 meEBRecHitLog10Energy5x5Contr_ =
nullptr;
95 meEERecHitLog10Energy5x5Contr_ =
nullptr;
97 meEBRecHitsOccupancyFlag5_6_ =
nullptr;
98 meEBRecHitsOccupancyFlag8_9_ =
nullptr;
99 meEERecHitsOccupancyPlusFlag5_6_ =
nullptr;
100 meEERecHitsOccupancyMinusFlag5_6_ =
nullptr;
101 meEERecHitsOccupancyPlusFlag8_9_ =
nullptr;
102 meEERecHitsOccupancyMinusFlag8_9_ =
nullptr;
104 meEBRecHitFlags_ =
nullptr;
105 meEBRecHitSimHitvsSimHitFlag5_6_ =
nullptr;
106 meEBRecHitSimHitFlag6_ =
nullptr;
107 meEBRecHitSimHitFlag7_ =
nullptr;
108 meEB5x5RecHitSimHitvsSimHitFlag8_ =
nullptr;
110 meEERecHitFlags_ =
nullptr;
111 meEERecHitSimHitvsSimHitFlag5_6_ =
nullptr;
112 meEERecHitSimHitFlag6_ =
nullptr;
113 meEERecHitSimHitFlag7_ =
nullptr;
123 histo =
"EcalRecHitsTask Gun Momentum";
124 meGunEnergy_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 100, 0., 1000.);
126 histo =
"EcalRecHitsTask Gun Eta";
127 meGunEta_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 700, -3.5, 3.5);
129 histo =
"EcalRecHitsTask Gun Phi";
130 meGunPhi_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 360, 0., 360.);
132 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio";
133 meEBRecHitSimHitRatio_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0., 2.);
135 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio";
136 meEERecHitSimHitRatio_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0., 2.);
138 histo =
"EcalRecHitsTask Preshower RecSimHit Ratio";
139 meESRecHitSimHitRatio_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0., 2.);
141 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio gt 3p5 GeV";
142 meEBRecHitSimHitRatioGt35_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0.9, 1.1);
144 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio gt 3p5 GeV";
145 meEERecHitSimHitRatioGt35_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0.9, 1.1);
147 histo =
"EcalRecHitsTask Barrel Unc RecSimHit Ratio";
148 meEBUnRecHitSimHitRatio_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0., 2.);
150 histo =
"EcalRecHitsTask Endcap Unc RecSimHit Ratio";
151 meEEUnRecHitSimHitRatio_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0., 2.);
153 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio Channel Status=10 11";
154 meEBRecHitSimHitRatio1011_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0., 2.);
156 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio Channel Status=10 11";
157 meEERecHitSimHitRatio1011_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0., 2.);
159 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio Channel Status=12";
160 meEBRecHitSimHitRatio12_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0., 2.);
162 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio Channel Status=12";
163 meEERecHitSimHitRatio12_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0., 2.);
165 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio Channel Status=13";
166 meEBRecHitSimHitRatio13_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0., 2.);
168 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio Channel Status=13";
169 meEERecHitSimHitRatio13_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0., 2.);
171 histo =
"EcalRecHitsTask Barrel Unc RecSimHit Ratio gt 3p5 GeV";
172 meEBUnRecHitSimHitRatioGt35_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0.9, 1.1);
174 histo =
"EcalRecHitsTask Endcap Unc RecSimHit Ratio gt 3p5 GeV";
175 meEEUnRecHitSimHitRatioGt35_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0.9, 1.1);
177 histo =
"EcalRecHitsTask Barrel Rec E5x5";
178 meEBe5x5_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 4000, 0., 400.);
180 histo =
"EcalRecHitsTask Barrel Rec E5x5 over Sim E5x5";
181 meEBe5x5OverSimHits_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0.9, 1.1);
183 histo =
"EcalRecHitsTask Barrel Rec E5x5 over gun energy";
184 meEBe5x5OverGun_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0.9, 1.1);
186 histo =
"EcalRecHitsTask Endcap Rec E5x5";
187 meEEe5x5_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 4000, 0., 400.);
189 histo =
"EcalRecHitsTask Endcap Rec E5x5 over Sim E5x5";
190 meEEe5x5OverSimHits_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0.9, 1.1);
192 histo =
"EcalRecHitsTask Endcap Rec E5x5 over gun energy";
193 meEEe5x5OverGun_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0.9, 1.1);
195 meEBRecHitLog10Energy_ =
196 ibooker.
book1D(
"EcalRecHitsTask Barrel Log10 Energy",
"EcalRecHitsTask Barrel Log10 Energy", 90, -5., 4.);
197 meEERecHitLog10Energy_ =
198 ibooker.
book1D(
"EcalRecHitsTask Endcap Log10 Energy",
"EcalRecHitsTask Endcap Log10 Energy", 90, -5., 4.);
199 meESRecHitLog10Energy_ =
200 ibooker.
book1D(
"EcalRecHitsTask Preshower Log10 Energy",
"EcalRecHitsTask Preshower Log10 Energy", 90, -5., 4.);
201 meEBRecHitLog10EnergyContr_ = ibooker.
bookProfile(
"EcalRecHits Barrel Log10En vs Hit Contribution",
202 "EcalRecHits Barrel Log10En vs Hit Contribution",
209 meEERecHitLog10EnergyContr_ = ibooker.
bookProfile(
"EcalRecHits Endcap Log10En vs Hit Contribution",
210 "EcalRecHits Endcap Log10En vs Hit Contribution",
217 meESRecHitLog10EnergyContr_ = ibooker.
bookProfile(
"EcalRecHits Preshower Log10En vs Hit Contribution",
218 "EcalRecHits Preshower Log10En vs Hit Contribution",
225 meEBRecHitLog10Energy5x5Contr_ = ibooker.
bookProfile(
"EcalRecHits Barrel Log10En5x5 vs Hit Contribution",
226 "EcalRecHits Barrel Log10En5x5 vs Hit Contribution",
233 meEERecHitLog10Energy5x5Contr_ = ibooker.
bookProfile(
"EcalRecHits Endcap Log10En5x5 vs Hit Contribution",
234 "EcalRecHits Endcap Log10En5x5 vs Hit Contribution",
242 histo =
"EB Occupancy Flag=5 6";
243 meEBRecHitsOccupancyFlag5_6_ = ibooker.
book2D(histo, histo, 170, -85., 85., 360, 0., 360.);
244 histo =
"EB Occupancy Flag=8 9";
245 meEBRecHitsOccupancyFlag8_9_ = ibooker.
book2D(histo, histo, 170, -85., 85., 360, 0., 360.);
247 histo =
"EE+ Occupancy Flag=5 6";
248 meEERecHitsOccupancyPlusFlag5_6_ = ibooker.
book2D(histo, histo, 100, 0., 100., 100, 0., 100.);
249 histo =
"EE- Occupancy Flag=5 6";
250 meEERecHitsOccupancyMinusFlag5_6_ = ibooker.
book2D(histo, histo, 100, 0., 100., 100, 0., 100.);
251 histo =
"EE+ Occupancy Flag=8 9";
252 meEERecHitsOccupancyPlusFlag8_9_ = ibooker.
book2D(histo, histo, 100, 0., 100., 100, 0., 100.);
253 histo =
"EE- Occupancy Flag=8 9";
254 meEERecHitsOccupancyMinusFlag8_9_ = ibooker.
book2D(histo, histo, 100, 0., 100., 100, 0., 100.);
256 histo =
"EcalRecHitsTask Barrel Reco Flags";
257 meEBRecHitFlags_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 10, 0., 10.);
258 histo =
"EcalRecHitsTask Endcap Reco Flags";
259 meEERecHitFlags_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 10, 0., 10.);
260 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio vs SimHit Flag=5 6";
261 meEBRecHitSimHitvsSimHitFlag5_6_ = ibooker.
book2D(histo.c_str(), histo.c_str(), 80, 0., 2., 4000, 0., 400.);
262 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio vs SimHit Flag=5 6";
263 meEERecHitSimHitvsSimHitFlag5_6_ = ibooker.
book2D(histo.c_str(), histo.c_str(), 80, 0., 2., 4000, 0., 400.);
264 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio Flag=6";
265 meEBRecHitSimHitFlag6_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0., 2.);
266 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio Flag=6";
267 meEERecHitSimHitFlag6_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0., 2.);
268 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio Flag=7";
269 meEBRecHitSimHitFlag7_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0., 2.);
270 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio Flag=7";
271 meEERecHitSimHitFlag7_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0., 2.);
272 histo =
"EcalRecHitsTask Barrel 5x5 RecSimHit Ratio vs SimHit Flag=8";
273 meEB5x5RecHitSimHitvsSimHitFlag8_ = ibooker.
book2D(histo.c_str(), histo.c_str(), 80, 0., 2., 4000, 0., 400.);
279 LogInfo(
"EcalRecHitsTask, EventInfo: ") <<
" Run = " << e.
id().
run() <<
" Event = " << e.
id().
event();
285 const double barrelADCtoGeV_ = agc->
getEBValue();
286 const double endcapADCtoGeV_ = agc->
getEEValue();
297 bool skipBarrel =
false;
300 e.
getByToken(EBuncalibrechitCollection_Token_, EcalUncalibRecHitEB);
301 if (EcalUncalibRecHitEB.
isValid()) {
302 EBUncalibRecHit = EcalUncalibRecHitEB.
product();
307 bool skipEndcap =
false;
310 e.
getByToken(EEuncalibrechitCollection_Token_, EcalUncalibRecHitEE);
311 if (EcalUncalibRecHitEE.
isValid()) {
312 EEUncalibRecHit = EcalUncalibRecHitEE.
product();
319 e.
getByToken(EBrechitCollection_Token_, EcalRecHitEB);
321 EBRecHit = EcalRecHitEB.
product();
328 e.
getByToken(EErechitCollection_Token_, EcalRecHitEE);
330 EERecHit = EcalRecHitEE.
product();
335 bool skipPreshower =
false;
338 e.
getByToken(ESrechitCollection_Token_, EcalRecHitES);
340 ESRecHit = EcalRecHitES.
product();
342 skipPreshower =
true;
349 for (HepMC::GenEvent::particle_const_iterator
p = MCEvt->
GetEvent()->particles_begin();
352 double htheta = (*p)->momentum().theta();
353 double heta = -99999.;
354 if (
tan(htheta * 0.5) > 0) {
355 heta = -
log(
tan(htheta * 0.5));
357 double hphi = (*p)->momentum().phi();
358 hphi = (hphi >= 0) ? hphi : hphi + 2 *
M_PI;
359 hphi = hphi /
M_PI * 180.;
361 LogDebug(
"EventInfo") <<
"EcalRecHitsTask: Particle gun type form MC = " <<
abs((*p)->pdg_id()) <<
"\n" 362 <<
"Energy = " << (*p)->momentum().e() <<
"\n" 363 <<
"Eta = " << heta <<
"\n" 366 if ((*p)->momentum().e() > eGun)
367 eGun = (*p)->momentum().e();
370 meGunEnergy_->Fill((*p)->momentum().e());
372 meGunEta_->Fill(heta);
374 meGunPhi_->Fill(hphi);
388 const int ebcSize = 90;
389 double ebcontr[ebcSize];
390 double ebcontr25[ebcSize];
391 for (
int i = 0;
i < ebcSize;
i++) {
400 LogDebug(
"SimHitInfo, barrel") <<
"CaloHit " << iHit.getName() <<
" DetID = " << iHit.id() <<
"\n" 401 <<
"Energy = " << iHit.energy() <<
" Time = " << iHit.time() <<
"\n" 402 <<
"EBDetId = " << ebid.
ieta() <<
" " << ebid.
iphi();
404 uint32_t crystid = ebid.
rawId();
405 ebSimMap[crystid] += iHit.energy();
410 uncalibRecHit != EBUncalibRecHit->
end();
416 if (myRecHit == EBRecHit->
end())
418 ebRecMap[EBid.
rawId()] += myRecHit->energy();
421 ebtotal += myRecHit->energy();
422 if (myRecHit->energy() > 0) {
423 if (meEBRecHitLog10Energy_)
424 meEBRecHitLog10Energy_->Fill(log10(myRecHit->energy()));
425 int log10i =
int((log10(myRecHit->energy()) + 5.) * 10.);
426 if (log10i >= 0 and log10i < ebcSize)
427 ebcontr[log10i] += myRecHit->energy();
431 if (ebSimMap[EBid.
rawId()] != 0.) {
432 double uncEnergy = uncalibRecHit->amplitude() * barrelADCtoGeV_;
433 if (meEBUnRecHitSimHitRatio_) {
434 meEBUnRecHitSimHitRatio_->Fill(uncEnergy / ebSimMap[EBid.
rawId()]);
436 if (meEBUnRecHitSimHitRatioGt35_ && (myRecHit->energy() > 3.5)) {
437 meEBUnRecHitSimHitRatioGt35_->Fill(uncEnergy / ebSimMap[EBid.
rawId()]);
441 if (myRecHit != EBRecHit->
end()) {
442 if (ebSimMap[EBid.
rawId()] != 0.) {
443 if (meEBRecHitSimHitRatio_) {
444 meEBRecHitSimHitRatio_->Fill(myRecHit->energy() / ebSimMap[EBid.
rawId()]);
446 if (meEBRecHitSimHitRatioGt35_ && (myRecHit->energy() > 3.5)) {
447 meEBRecHitSimHitRatioGt35_->Fill(myRecHit->energy() / ebSimMap[EBid.
rawId()]);
455 if (ecs !=
nullptr) {
458 if (csmi != ecs->
end())
463 if (meEBRecHitSimHitRatio1011_ !=
nullptr && (sc == 10 || sc == 11)) {
464 meEBRecHitSimHitRatio1011_->Fill(myRecHit->energy() / ebSimMap[EBid.
rawId()]);
466 if (meEBRecHitSimHitRatio12_ !=
nullptr && sc == 12) {
467 meEBRecHitSimHitRatio12_->Fill(myRecHit->energy() / ebSimMap[EBid.
rawId()]);
475 double ttSimEnergy = 0;
476 if (ttMap !=
nullptr) {
479 for (std::vector<DetId>::const_iterator dit = vid.begin(); dit != vid.end(); dit++) {
481 ttSimEnergy += ebSimMap[ttEBid.
rawId()];
484 ttSimEnergy = ttSimEnergy / vid.
size();
486 if (meEBRecHitSimHitRatio13_ !=
nullptr && sc == 13 && ttSimEnergy != 0)
487 meEBRecHitSimHitRatio13_->Fill(myRecHit->energy() / ttSimEnergy);
489 int flag = myRecHit->recoFlag();
490 if (meEBRecHitFlags_ !=
nullptr)
491 meEBRecHitFlags_->Fill(flag);
492 if (meEBRecHitSimHitvsSimHitFlag5_6_ &&
494 meEBRecHitSimHitvsSimHitFlag5_6_->Fill(myRecHit->energy() / ebSimMap[EBid.
rawId()], ebSimMap[EBid.
rawId()]);
496 meEBRecHitSimHitFlag6_->Fill(myRecHit->energy() / ebSimMap[EBid.
rawId()]);
498 meEBRecHitSimHitFlag6_->Fill(myRecHit->energy() / ebSimMap[EBid.
rawId()]);
500 meEB5x5RecHitSimHitvsSimHitFlag8_->Fill(myRecHit->energy() / ttSimEnergy, ttSimEnergy);
502 if (meEBRecHitsOccupancyFlag5_6_ &&
504 meEBRecHitsOccupancyFlag5_6_->Fill(EBid.
ieta(), EBid.
iphi());
506 meEBRecHitsOccupancyFlag8_9_->Fill(EBid.
ieta(), EBid.
iphi());
513 uint32_t ebcenterid = getUnitWithMaxEnergy(ebRecMap);
516 int by = myEBid.
iphi();
517 int bz = myEBid.
zside();
518 findBarrelMatrix(5, 5, bx, by, bz, ebRecMap);
521 for (
unsigned int i = 0;
i < crystalMatrix.size();
i++) {
522 e5x5rec += ebRecMap[crystalMatrix[
i]];
523 e5x5sim += ebSimMap[crystalMatrix[
i]];
524 if (ebRecMap[crystalMatrix[
i]] > 0) {
525 int log10i25 =
int((log10(ebRecMap[crystalMatrix[
i]]) + 5.) * 10.);
526 if (log10i25 >= 0 && log10i25 < ebcSize)
527 ebcontr25[log10i25] += ebRecMap[crystalMatrix[
i]];
532 meEBe5x5_->Fill(e5x5rec);
533 if (e5x5sim > 0. && meEBe5x5OverSimHits_)
534 meEBe5x5OverSimHits_->Fill(e5x5rec / e5x5sim);
535 if (eGun > 0. && meEBe5x5OverGun_)
536 meEBe5x5OverGun_->Fill(e5x5rec / eGun);
538 if (meEBRecHitLog10EnergyContr_ && ebtotal != 0) {
539 for (
int i = 0;
i < ebcSize;
i++) {
540 meEBRecHitLog10EnergyContr_->Fill(-5. + (
float(
i) + 0.5) / 10., ebcontr[
i] / ebtotal);
544 if (meEBRecHitLog10Energy5x5Contr_ && e5x5rec != 0) {
545 for (
int i = 0;
i < ebcSize;
i++) {
546 meEBRecHitLog10Energy5x5Contr_->Fill(-5. + (
float(
i) + 0.5) / 10., ebcontr25[
i] / e5x5rec);
561 const int eecSize = 90;
562 double eecontr[eecSize];
563 double eecontr25[eecSize];
564 for (
int i = 0;
i < eecSize;
i++) {
573 LogDebug(
"Endcap, HitInfo") <<
" CaloHit " << iHit.getName() <<
" DetID = " << iHit.id() <<
"\n" 574 <<
"Energy = " << iHit.energy() <<
" Time = " << iHit.time() <<
"\n" 575 <<
"EEDetId side " << eeid.zside() <<
" = " << eeid.ix() <<
" " << eeid.iy();
577 uint32_t crystid = eeid.rawId();
578 eeSimMap[crystid] += iHit.energy();
583 uncalibRecHit != EEUncalibRecHit->
end();
589 if (myRecHit == EERecHit->
end())
591 eeRecMap[EEid.
rawId()] += myRecHit->energy();
594 eetotal += myRecHit->energy();
595 if (myRecHit->energy() > 0) {
596 if (meEERecHitLog10Energy_)
597 meEERecHitLog10Energy_->Fill(log10(myRecHit->energy()));
598 int log10i =
int((log10(myRecHit->energy()) + 5.) * 10.);
599 if (log10i >= 0 and log10i < eecSize)
600 eecontr[log10i] += myRecHit->energy();
604 if (eeSimMap[EEid.
rawId()] != 0.) {
605 double uncEnergy = uncalibRecHit->amplitude() * endcapADCtoGeV_;
606 if (meEEUnRecHitSimHitRatio_) {
607 meEEUnRecHitSimHitRatio_->Fill(uncEnergy / eeSimMap[EEid.
rawId()]);
609 if (meEEUnRecHitSimHitRatioGt35_ && (myRecHit->energy() > 3.5)) {
610 meEEUnRecHitSimHitRatioGt35_->Fill(uncEnergy / eeSimMap[EEid.
rawId()]);
614 if (myRecHit != EERecHit->
end()) {
615 if (eeSimMap[EEid.
rawId()] != 0.) {
616 if (meEERecHitSimHitRatio_) {
617 meEERecHitSimHitRatio_->Fill(myRecHit->energy() / eeSimMap[EEid.
rawId()]);
619 if (meEERecHitSimHitRatioGt35_ && (myRecHit->energy() > 3.5)) {
620 meEERecHitSimHitRatioGt35_->Fill(myRecHit->energy() / eeSimMap[EEid.
rawId()]);
628 if (ecs !=
nullptr) {
631 if (csmi != ecs->
end())
634 if (meEERecHitSimHitRatio1011_ !=
nullptr && (sc == 10 || sc == 11)) {
635 meEERecHitSimHitRatio1011_->Fill(myRecHit->energy() / eeSimMap[EEid.
rawId()]);
637 if (meEERecHitSimHitRatio12_ !=
nullptr && sc == 12) {
638 meEERecHitSimHitRatio12_->Fill(myRecHit->energy() / eeSimMap[EEid.
rawId()]);
640 if (meEERecHitSimHitRatio13_ !=
nullptr && sc == 13) {
641 meEERecHitSimHitRatio13_->Fill(myRecHit->energy() / eeSimMap[EEid.
rawId()]);
645 int flag = myRecHit->recoFlag();
646 if (meEERecHitFlags_ !=
nullptr)
647 meEERecHitFlags_->Fill(flag);
648 if (meEERecHitSimHitvsSimHitFlag5_6_ &&
650 meEERecHitSimHitvsSimHitFlag5_6_->Fill(myRecHit->energy() / eeSimMap[EEid.
rawId()], eeSimMap[EEid.
rawId()]);
652 meEERecHitSimHitFlag6_->Fill(myRecHit->energy() / eeSimMap[EEid.
rawId()]);
654 meEERecHitSimHitFlag6_->Fill(myRecHit->energy() / eeSimMap[EEid.
rawId()]);
656 if (EEid.
zside() > 0) {
657 if (meEERecHitsOccupancyPlusFlag5_6_ &&
659 meEERecHitsOccupancyPlusFlag5_6_->Fill(EEid.
ix(), EEid.
iy());
660 if (meEERecHitsOccupancyPlusFlag8_9_ &&
662 meEERecHitsOccupancyPlusFlag8_9_->Fill(EEid.
ix(), EEid.
iy());
664 if (EEid.
zside() < 0) {
665 if (meEERecHitsOccupancyMinusFlag5_6_ &&
667 meEERecHitsOccupancyMinusFlag5_6_->Fill(EEid.
ix(), EEid.
iy());
668 if (meEERecHitsOccupancyMinusFlag8_9_ &&
670 meEERecHitsOccupancyMinusFlag8_9_->Fill(EEid.
ix(), EEid.
iy());
678 uint32_t eecenterid = getUnitWithMaxEnergy(eeRecMap);
680 int bx = myEEid.
ix();
681 int by = myEEid.
iy();
682 int bz = myEEid.
zside();
683 findEndcapMatrix(5, 5, bx, by, bz, eeRecMap);
686 for (
unsigned int i = 0;
i < crystalMatrix.size();
i++) {
687 e5x5rec += eeRecMap[crystalMatrix[
i]];
688 e5x5sim += eeSimMap[crystalMatrix[
i]];
689 if (eeRecMap[crystalMatrix[
i]] > 0) {
690 int log10i25 =
int((log10(eeRecMap[crystalMatrix[
i]]) + 5.) * 10.);
691 if (log10i25 >= 0 && log10i25 < eecSize)
692 eecontr25[log10i25] += eeRecMap[crystalMatrix[
i]];
697 meEEe5x5_->Fill(e5x5rec);
698 if (e5x5sim > 0. && meEEe5x5OverSimHits_)
699 meEEe5x5OverSimHits_->Fill(e5x5rec / e5x5sim);
700 if (eGun > 0. && meEEe5x5OverGun_)
701 meEEe5x5OverGun_->Fill(e5x5rec / eGun);
703 if (meEERecHitLog10EnergyContr_ && eetotal != 0) {
704 for (
int i = 0;
i < eecSize;
i++) {
705 meEERecHitLog10EnergyContr_->Fill(-5. + (
float(
i) + 0.5) / 10., eecontr[
i] / eetotal);
709 if (meEERecHitLog10Energy5x5Contr_ && e5x5rec != 0) {
710 for (
int i = 0;
i < eecSize;
i++) {
711 meEERecHitLog10Energy5x5Contr_->Fill(-5. + (
float(
i) + 0.5) / 10., eecontr25[
i] / e5x5rec);
719 if (!skipPreshower) {
725 const int escSize = 90;
726 double escontr[escSize];
727 for (
int i = 0;
i < escSize;
i++) {
734 LogDebug(
"Preshower, HitInfo") <<
" CaloHit " << iHit.getName() <<
" DetID = " << iHit.id() <<
"\n" 735 <<
"Energy = " << iHit.energy() <<
" Time = " << iHit.time() <<
"\n" 736 <<
"ESDetId strip " << esid.strip() <<
" = " << esid.six() <<
" " << esid.siy();
738 uint32_t crystid = esid.rawId();
739 esSimMap[crystid] += iHit.energy();
745 if (esSimMap[ESid.
rawId()] != 0.) {
747 estotal +=
recHit->energy();
748 if (
recHit->energy() > 0) {
749 if (meESRecHitLog10Energy_)
750 meESRecHitLog10Energy_->Fill(log10(
recHit->energy()));
751 int log10i =
int((log10(
recHit->energy()) + 5.) * 10.);
752 if (log10i >= 0 and log10i < escSize)
753 escontr[log10i] +=
recHit->energy();
756 if (meESRecHitSimHitRatio_) {
757 meESRecHitSimHitRatio_->Fill(
recHit->energy() / esSimMap[ESid.
rawId()]);
763 if (meESRecHitLog10EnergyContr_ && estotal != 0) {
764 for (
int i = 0;
i < escSize;
i++) {
765 meESRecHitLog10EnergyContr_->Fill(-5. + (
float(
i) + 0.5) / 10., escontr[
i] / estotal);
773 uint32_t unitWithMaxEnergy = 0;
776 MapType::iterator iter;
777 for (iter = themap.begin(); iter != themap.end(); iter++) {
778 if (maxEnergy < (*iter).second) {
779 maxEnergy = (*iter).second;
780 unitWithMaxEnergy = (*iter).first;
784 return unitWithMaxEnergy;
788 int nCellInEta,
int nCellInPhi,
int CentralEta,
int CentralPhi,
int CentralZ,
MapType &themap) {
789 int goBackInEta = nCellInEta / 2;
790 int goBackInPhi = nCellInPhi / 2;
791 int matrixSize = nCellInEta * nCellInPhi;
792 crystalMatrix.clear();
793 crystalMatrix.resize(matrixSize);
795 int startEta = CentralZ * CentralEta - goBackInEta;
796 int startPhi = CentralPhi - goBackInPhi;
799 for (
int ieta = startEta; ieta < startEta + nCellInEta; ieta++) {
800 for (
int iphi = startPhi; iphi < startPhi + nCellInPhi; iphi++) {
802 if (
abs(ieta) > 85 ||
abs(ieta) < 1) {
807 }
else if (iphi > 360) {
812 crystalMatrix[i++] =
index;
818 int nCellInX,
int nCellInY,
int CentralX,
int CentralY,
int CentralZ,
MapType &themap) {
819 int goBackInX = nCellInX / 2;
820 int goBackInY = nCellInY / 2;
821 crystalMatrix.clear();
823 int startX = CentralX - goBackInX;
824 int startY = CentralY - goBackInY;
826 for (
int ix = startX; ix < startX + nCellInX; ix++) {
827 for (
int iy = startY; iy < startY + nCellInY; iy++) {
835 crystalMatrix.push_back(index);
T getParameter(std::string const &) const
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
void analyze(const edm::Event &e, const edm::EventSetup &c) override
Analyze.
MonitorElement * bookProfile(Args &&...args)
EcalRecHitsValidation(const edm::ParameterSet &ps)
Constructor.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Code getStatusCode() const
return decoded status
constexpr uint32_t rawId() const
get the raw id
std::vector< T >::const_iterator const_iterator
uint32_t getUnitWithMaxEnergy(MapType &themap)
int iphi() const
get the crystal iphi
std::map< uint32_t, float, std::less< uint32_t > > MapType
~EcalRecHitsValidation() override
Destructor.
void findEndcapMatrix(int nCellInX, int nCellInY, int CentralX, int CentralY, int CentralZ, MapType &themap)
void setCurrentFolder(std::string const &fullpath)
MonitorElement * book1D(Args &&...args)
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
EcalTrigTowerDetId tower() const
get the HCAL/trigger iphi of this crystal
int ieta() const
get the crystal ieta
std::vector< DetId > constituentsOf(const EcalTrigTowerDetId &id) const
Get the constituent detids for this tower id.
void bookHistograms(DQMStore::IBooker &i, edm::Run const &, edm::EventSetup const &) override
Namespace of DDCMS conversion namespace.
const_iterator end() const
const HepMC::GenEvent * GetEvent() const
T const * product() const
MonitorElement * book2D(Args &&...args)
static bool validDetId(int crystal_ix, int crystal_iy, int iz)
std::vector< Item >::const_iterator const_iterator
iterator find(key_type k)
void findBarrelMatrix(int nCellInEta, int nCellInPhi, int CentralEta, int CentralPhi, int CentralZ, MapType &themap)
const_iterator find(uint32_t rawId) const
const_iterator end() const
int ietaAbs() const
get the absolute value of the crystal ieta
T const * product() const
const_iterator begin() const
int zside() const
get the z-side of the crystal (1/-1)