38 EBuncalibrechitCollection_Token_ =
41 EBHits_Token_ = consumes<CrossingFrame<PCaloHit>>(
46 EEuncalibrechitCollection_Token_ =
48 EEHits_Token_ = consumes<CrossingFrame<PCaloHit>>(
50 ESHits_Token_ = consumes<CrossingFrame<PCaloHit>>(
58 if (!outputFile_.empty()) {
59 LogInfo(
"OutputInfo") <<
" Ecal RecHits Task histograms will be saved to '" << outputFile_.c_str() <<
"'";
61 LogInfo(
"OutputInfo") <<
" Ecal RecHits Task histograms will NOT be saved";
69 meGunEnergy_ =
nullptr;
72 meEBRecHitSimHitRatio_ =
nullptr;
73 meEERecHitSimHitRatio_ =
nullptr;
74 meESRecHitSimHitRatio_ =
nullptr;
75 meEBRecHitSimHitRatio1011_ =
nullptr;
76 meEERecHitSimHitRatio1011_ =
nullptr;
77 meEBRecHitSimHitRatio12_ =
nullptr;
78 meEERecHitSimHitRatio12_ =
nullptr;
79 meEBRecHitSimHitRatio13_ =
nullptr;
80 meEERecHitSimHitRatio13_ =
nullptr;
81 meEBRecHitSimHitRatioGt35_ =
nullptr;
82 meEERecHitSimHitRatioGt35_ =
nullptr;
83 meEBUnRecHitSimHitRatio_ =
nullptr;
84 meEEUnRecHitSimHitRatio_ =
nullptr;
85 meEBUnRecHitSimHitRatioGt35_ =
nullptr;
86 meEEUnRecHitSimHitRatioGt35_ =
nullptr;
88 meEBe5x5OverSimHits_ =
nullptr;
89 meEBe5x5OverGun_ =
nullptr;
91 meEEe5x5OverSimHits_ =
nullptr;
92 meEEe5x5OverGun_ =
nullptr;
94 meEBRecHitLog10Energy_ =
nullptr;
95 meEERecHitLog10Energy_ =
nullptr;
96 meESRecHitLog10Energy_ =
nullptr;
97 meEBRecHitLog10EnergyContr_ =
nullptr;
98 meEERecHitLog10EnergyContr_ =
nullptr;
99 meESRecHitLog10EnergyContr_ =
nullptr;
100 meEBRecHitLog10Energy5x5Contr_ =
nullptr;
101 meEERecHitLog10Energy5x5Contr_ =
nullptr;
103 meEBRecHitsOccupancyFlag5_6_ =
nullptr;
104 meEBRecHitsOccupancyFlag8_9_ =
nullptr;
105 meEERecHitsOccupancyPlusFlag5_6_ =
nullptr;
106 meEERecHitsOccupancyMinusFlag5_6_ =
nullptr;
107 meEERecHitsOccupancyPlusFlag8_9_ =
nullptr;
108 meEERecHitsOccupancyMinusFlag8_9_ =
nullptr;
110 meEBRecHitFlags_ =
nullptr;
111 meEBRecHitSimHitvsSimHitFlag5_6_ =
nullptr;
112 meEBRecHitSimHitFlag6_ =
nullptr;
113 meEBRecHitSimHitFlag7_ =
nullptr;
114 meEB5x5RecHitSimHitvsSimHitFlag8_ =
nullptr;
116 meEERecHitFlags_ =
nullptr;
117 meEERecHitSimHitvsSimHitFlag5_6_ =
nullptr;
118 meEERecHitSimHitFlag6_ =
nullptr;
119 meEERecHitSimHitFlag7_ =
nullptr;
129 histo =
"EcalRecHitsTask Gun Momentum";
130 meGunEnergy_ = ibooker.
book1D(
histo.c_str(),
histo.c_str(), 100, 0., 1000.);
132 histo =
"EcalRecHitsTask Gun Eta";
135 histo =
"EcalRecHitsTask Gun Phi";
138 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio";
139 meEBRecHitSimHitRatio_ = 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 Barrel Unc RecSimHit Ratio";
145 meEBUnRecHitSimHitRatio_ = ibooker.
book1D(
histo.c_str(),
histo.c_str(), 80, 0., 2.);
147 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio Channel Status=10 11";
148 meEBRecHitSimHitRatio1011_ = ibooker.
book1D(
histo.c_str(),
histo.c_str(), 80, 0., 2.);
150 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio Channel Status=12";
151 meEBRecHitSimHitRatio12_ = ibooker.
book1D(
histo.c_str(),
histo.c_str(), 80, 0., 2.);
153 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio Channel Status=13";
154 meEBRecHitSimHitRatio13_ = ibooker.
book1D(
histo.c_str(),
histo.c_str(), 80, 0., 2.);
156 histo =
"EcalRecHitsTask Barrel Unc RecSimHit Ratio gt 3p5 GeV";
157 meEBUnRecHitSimHitRatioGt35_ = ibooker.
book1D(
histo.c_str(),
histo.c_str(), 80, 0.9, 1.1);
159 histo =
"EcalRecHitsTask Barrel Rec E5x5";
162 histo =
"EcalRecHitsTask Barrel Rec E5x5 over Sim E5x5";
163 meEBe5x5OverSimHits_ = ibooker.
book1D(
histo.c_str(),
histo.c_str(), 80, 0.9, 1.1);
165 histo =
"EcalRecHitsTask Barrel Rec E5x5 over gun energy";
166 meEBe5x5OverGun_ = ibooker.
book1D(
histo.c_str(),
histo.c_str(), 80, 0.9, 1.1);
168 meEBRecHitLog10Energy_ =
169 ibooker.
book1D(
"EcalRecHitsTask Barrel Log10 Energy",
"EcalRecHitsTask Barrel Log10 Energy", 90, -5., 4.);
170 meEBRecHitLog10EnergyContr_ = ibooker.
bookProfile(
"EcalRecHits Barrel Log10En vs Hit Contribution",
171 "EcalRecHits Barrel Log10En vs Hit Contribution",
178 meEBRecHitLog10Energy5x5Contr_ = ibooker.
bookProfile(
"EcalRecHits Barrel Log10En5x5 vs Hit Contribution",
179 "EcalRecHits Barrel Log10En5x5 vs Hit Contribution",
187 histo =
"EB Occupancy Flag=5 6";
188 meEBRecHitsOccupancyFlag5_6_ = ibooker.
book2D(
histo,
histo, 170, -85., 85., 360, 0., 360.);
189 histo =
"EB Occupancy Flag=8 9";
190 meEBRecHitsOccupancyFlag8_9_ = ibooker.
book2D(
histo,
histo, 170, -85., 85., 360, 0., 360.);
192 histo =
"EcalRecHitsTask Barrel Reco Flags";
193 meEBRecHitFlags_ = ibooker.
book1D(
histo.c_str(),
histo.c_str(), 10, 0., 10.);
194 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio vs SimHit Flag=5 6";
195 meEBRecHitSimHitvsSimHitFlag5_6_ = ibooker.
book2D(
histo.c_str(),
histo.c_str(), 80, 0., 2., 4000, 0., 400.);
196 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio Flag=6";
197 meEBRecHitSimHitFlag6_ = ibooker.
book1D(
histo.c_str(),
histo.c_str(), 80, 0., 2.);
198 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio Flag=7";
199 meEBRecHitSimHitFlag7_ = ibooker.
book1D(
histo.c_str(),
histo.c_str(), 80, 0., 2.);
200 histo =
"EcalRecHitsTask Barrel 5x5 RecSimHit Ratio vs SimHit Flag=8";
201 meEB5x5RecHitSimHitvsSimHitFlag8_ = ibooker.
book2D(
histo.c_str(),
histo.c_str(), 80, 0., 2., 4000, 0., 400.);
203 if (enableEndcaps_) {
204 histo =
"EcalRecHitsTask Preshower RecSimHit Ratio";
205 meESRecHitSimHitRatio_ = ibooker.
book1D(
histo.c_str(),
histo.c_str(), 80, 0., 2.);
207 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio";
208 meEERecHitSimHitRatio_ = ibooker.
book1D(
histo.c_str(),
histo.c_str(), 80, 0., 2.);
210 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio gt 3p5 GeV";
211 meEERecHitSimHitRatioGt35_ = ibooker.
book1D(
histo.c_str(),
histo.c_str(), 80, 0.9, 1.1);
213 histo =
"EcalRecHitsTask Endcap Unc RecSimHit Ratio";
214 meEEUnRecHitSimHitRatio_ = ibooker.
book1D(
histo.c_str(),
histo.c_str(), 80, 0., 2.);
216 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio Channel Status=10 11";
217 meEERecHitSimHitRatio1011_ = ibooker.
book1D(
histo.c_str(),
histo.c_str(), 80, 0., 2.);
219 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio Channel Status=12";
220 meEERecHitSimHitRatio12_ = ibooker.
book1D(
histo.c_str(),
histo.c_str(), 80, 0., 2.);
222 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio Channel Status=13";
223 meEERecHitSimHitRatio13_ = ibooker.
book1D(
histo.c_str(),
histo.c_str(), 80, 0., 2.);
225 histo =
"EcalRecHitsTask Endcap Unc RecSimHit Ratio gt 3p5 GeV";
226 meEEUnRecHitSimHitRatioGt35_ = ibooker.
book1D(
histo.c_str(),
histo.c_str(), 80, 0.9, 1.1);
228 histo =
"EcalRecHitsTask Endcap Rec E5x5";
231 histo =
"EcalRecHitsTask Endcap Rec E5x5 over Sim E5x5";
232 meEEe5x5OverSimHits_ = ibooker.
book1D(
histo.c_str(),
histo.c_str(), 80, 0.9, 1.1);
234 histo =
"EcalRecHitsTask Endcap Rec E5x5 over gun energy";
235 meEEe5x5OverGun_ = ibooker.
book1D(
histo.c_str(),
histo.c_str(), 80, 0.9, 1.1);
237 meEERecHitLog10Energy_ =
238 ibooker.
book1D(
"EcalRecHitsTask Endcap Log10 Energy",
"EcalRecHitsTask Endcap Log10 Energy", 90, -5., 4.);
239 meESRecHitLog10Energy_ =
240 ibooker.
book1D(
"EcalRecHitsTask Preshower Log10 Energy",
"EcalRecHitsTask Preshower Log10 Energy", 90, -5., 4.);
242 meEERecHitLog10EnergyContr_ = ibooker.
bookProfile(
"EcalRecHits Endcap Log10En vs Hit Contribution",
243 "EcalRecHits Endcap Log10En vs Hit Contribution",
250 meESRecHitLog10EnergyContr_ = ibooker.
bookProfile(
"EcalRecHits Preshower Log10En vs Hit Contribution",
251 "EcalRecHits Preshower Log10En vs Hit Contribution",
259 meEERecHitLog10Energy5x5Contr_ = ibooker.
bookProfile(
"EcalRecHits Endcap Log10En5x5 vs Hit Contribution",
260 "EcalRecHits Endcap Log10En5x5 vs Hit Contribution",
268 histo =
"EE+ Occupancy Flag=5 6";
269 meEERecHitsOccupancyPlusFlag5_6_ = ibooker.
book2D(
histo,
histo, 100, 0., 100., 100, 0., 100.);
270 histo =
"EE- Occupancy Flag=5 6";
271 meEERecHitsOccupancyMinusFlag5_6_ = ibooker.
book2D(
histo,
histo, 100, 0., 100., 100, 0., 100.);
272 histo =
"EE+ Occupancy Flag=8 9";
273 meEERecHitsOccupancyPlusFlag8_9_ = ibooker.
book2D(
histo,
histo, 100, 0., 100., 100, 0., 100.);
274 histo =
"EE- Occupancy Flag=8 9";
275 meEERecHitsOccupancyMinusFlag8_9_ = ibooker.
book2D(
histo,
histo, 100, 0., 100., 100, 0., 100.);
277 histo =
"EcalRecHitsTask Endcap Reco Flags";
278 meEERecHitFlags_ = ibooker.
book1D(
histo.c_str(),
histo.c_str(), 10, 0., 10.);
280 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio vs SimHit Flag=5 6";
281 meEERecHitSimHitvsSimHitFlag5_6_ = ibooker.
book2D(
histo.c_str(),
histo.c_str(), 80, 0., 2., 4000, 0., 400.);
283 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio Flag=6";
284 meEERecHitSimHitFlag6_ = ibooker.
book1D(
histo.c_str(),
histo.c_str(), 80, 0., 2.);
286 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio Flag=7";
287 meEERecHitSimHitFlag7_ = ibooker.
book1D(
histo.c_str(),
histo.c_str(), 80, 0., 2.);
294 LogInfo(
"EcalRecHitsTask, EventInfo: ") <<
" Run = " <<
e.id().run() <<
" Event = " <<
e.id().event();
300 const double barrelADCtoGeV_ = agc->
getEBValue();
301 const double endcapADCtoGeV_ = agc->
getEEValue();
305 e.getByToken(HepMCLabel_Token_, MCEvt);
312 bool skipBarrel =
false;
315 e.getByToken(EBuncalibrechitCollection_Token_, EcalUncalibRecHitEB);
316 if (EcalUncalibRecHitEB.
isValid()) {
322 bool skipEndcap =
false;
325 if (enableEndcaps_) {
326 e.getByToken(EEuncalibrechitCollection_Token_, EcalUncalibRecHitEE);
327 if (EcalUncalibRecHitEE.
isValid()) {
337 e.getByToken(EBrechitCollection_Token_, EcalRecHitEB);
346 if (enableEndcaps_) {
347 e.getByToken(EErechitCollection_Token_, EcalRecHitEE);
355 bool skipPreshower =
false;
358 if (enableEndcaps_) {
359 e.getByToken(ESrechitCollection_Token_, EcalRecHitES);
361 ESRecHit = EcalRecHitES.
product();
363 skipPreshower =
true;
366 skipPreshower =
true;
372 for (HepMC::GenEvent::particle_const_iterator
p = MCEvt->
GetEvent()->particles_begin();
375 double htheta = (*p)->momentum().theta();
376 double heta = -99999.;
377 if (
tan(htheta * 0.5) > 0) {
378 heta = -
log(
tan(htheta * 0.5));
380 double hphi = (*p)->momentum().phi();
381 hphi = (hphi >= 0) ? hphi : hphi + 2 *
M_PI;
382 hphi = hphi /
M_PI * 180.;
384 LogDebug(
"EventInfo") <<
"EcalRecHitsTask: Particle gun type form MC = " <<
abs((*p)->pdg_id()) <<
"\n"
385 <<
"Energy = " << (*p)->momentum().e() <<
"\n"
386 <<
"Eta = " << heta <<
"\n"
389 if ((*p)->momentum().e() > eGun)
390 eGun = (*p)->momentum().e();
393 meGunEnergy_->Fill((*p)->momentum().e());
395 meGunEta_->Fill(heta);
397 meGunPhi_->Fill(hphi);
406 e.getByToken(EBHits_Token_, crossingFrame);
411 const int ebcSize = 90;
412 double ebcontr[ebcSize];
413 double ebcontr25[ebcSize];
414 for (
int i = 0;
i < ebcSize;
i++) {
423 LogDebug(
"SimHitInfo, barrel") <<
"CaloHit " << iHit.getName() <<
" DetID = " << iHit.id() <<
"\n"
424 <<
"Energy = " << iHit.energy() <<
" Time = " << iHit.time() <<
"\n"
425 <<
"EBDetId = " << ebid.
ieta() <<
" " << ebid.
iphi();
427 uint32_t crystid = ebid.
rawId();
428 ebSimMap[crystid] += iHit.energy();
441 ebRecMap[EBid.
rawId()] += myRecHit->energy();
444 ebtotal += myRecHit->energy();
445 if (myRecHit->energy() > 0) {
446 if (meEBRecHitLog10Energy_)
447 meEBRecHitLog10Energy_->Fill(log10(myRecHit->energy()));
448 int log10i =
int((log10(myRecHit->energy()) + 5.) * 10.);
449 if (log10i >= 0 and log10i < ebcSize)
450 ebcontr[log10i] += myRecHit->energy();
454 if (ebSimMap[EBid.
rawId()] != 0.) {
455 double uncEnergy = uncalibRecHit->amplitude() * barrelADCtoGeV_;
456 if (meEBUnRecHitSimHitRatio_) {
457 meEBUnRecHitSimHitRatio_->Fill(uncEnergy / ebSimMap[EBid.
rawId()]);
459 if (meEBUnRecHitSimHitRatioGt35_ && (myRecHit->energy() > 3.5)) {
460 meEBUnRecHitSimHitRatioGt35_->Fill(uncEnergy / ebSimMap[EBid.
rawId()]);
465 if (ebSimMap[EBid.
rawId()] != 0.) {
466 if (meEBRecHitSimHitRatio_) {
467 meEBRecHitSimHitRatio_->Fill(myRecHit->energy() / ebSimMap[EBid.
rawId()]);
469 if (meEBRecHitSimHitRatioGt35_ && (myRecHit->energy() > 3.5)) {
470 meEBRecHitSimHitRatioGt35_->Fill(myRecHit->energy() / ebSimMap[EBid.
rawId()]);
478 if (ecs !=
nullptr) {
481 if (csmi != ecs->
end())
483 sc =
csc.getStatusCode();
486 if (meEBRecHitSimHitRatio1011_ !=
nullptr && (sc == 10 || sc == 11)) {
487 meEBRecHitSimHitRatio1011_->Fill(myRecHit->energy() / ebSimMap[EBid.
rawId()]);
489 if (meEBRecHitSimHitRatio12_ !=
nullptr && sc == 12) {
490 meEBRecHitSimHitRatio12_->Fill(myRecHit->energy() / ebSimMap[EBid.
rawId()]);
498 double ttSimEnergy = 0;
499 if (ttMap !=
nullptr) {
502 for (std::vector<DetId>::const_iterator dit =
vid.begin(); dit !=
vid.end(); dit++) {
504 ttSimEnergy += ebSimMap[ttEBid.
rawId()];
507 ttSimEnergy = ttSimEnergy /
vid.size();
509 if (meEBRecHitSimHitRatio13_ !=
nullptr && sc == 13 && ttSimEnergy != 0)
510 meEBRecHitSimHitRatio13_->Fill(myRecHit->energy() / ttSimEnergy);
512 int flag = myRecHit->recoFlag();
513 if (meEBRecHitFlags_ !=
nullptr)
514 meEBRecHitFlags_->Fill(
flag);
515 if (meEBRecHitSimHitvsSimHitFlag5_6_ &&
517 meEBRecHitSimHitvsSimHitFlag5_6_->Fill(myRecHit->energy() / ebSimMap[EBid.
rawId()], ebSimMap[EBid.
rawId()]);
519 meEBRecHitSimHitFlag6_->Fill(myRecHit->energy() / ebSimMap[EBid.
rawId()]);
521 meEBRecHitSimHitFlag6_->Fill(myRecHit->energy() / ebSimMap[EBid.
rawId()]);
523 meEB5x5RecHitSimHitvsSimHitFlag8_->Fill(myRecHit->energy() / ttSimEnergy, ttSimEnergy);
525 if (meEBRecHitsOccupancyFlag5_6_ &&
527 meEBRecHitsOccupancyFlag5_6_->Fill(EBid.
ieta(), EBid.
iphi());
529 meEBRecHitsOccupancyFlag8_9_->Fill(EBid.
ieta(), EBid.
iphi());
536 uint32_t ebcenterid = getUnitWithMaxEnergy(ebRecMap);
539 int by = myEBid.
iphi();
540 int bz = myEBid.
zside();
541 findBarrelMatrix(5, 5,
bx, by, bz, ebRecMap);
544 for (
unsigned int i = 0;
i < crystalMatrix.size();
i++) {
545 e5x5rec += ebRecMap[crystalMatrix[
i]];
546 e5x5sim += ebSimMap[crystalMatrix[
i]];
547 if (ebRecMap[crystalMatrix[
i]] > 0) {
548 int log10i25 =
int((log10(ebRecMap[crystalMatrix[
i]]) + 5.) * 10.);
549 if (log10i25 >= 0 && log10i25 < ebcSize)
550 ebcontr25[log10i25] += ebRecMap[crystalMatrix[
i]];
555 meEBe5x5_->Fill(e5x5rec);
556 if (e5x5sim > 0. && meEBe5x5OverSimHits_)
557 meEBe5x5OverSimHits_->Fill(e5x5rec / e5x5sim);
558 if (eGun > 0. && meEBe5x5OverGun_)
559 meEBe5x5OverGun_->Fill(e5x5rec / eGun);
561 if (meEBRecHitLog10EnergyContr_ && ebtotal != 0) {
562 for (
int i = 0;
i < ebcSize;
i++) {
563 meEBRecHitLog10EnergyContr_->Fill(-5. + (
float(
i) + 0.5) / 10., ebcontr[
i] / ebtotal);
567 if (meEBRecHitLog10Energy5x5Contr_ && e5x5rec != 0) {
568 for (
int i = 0;
i < ebcSize;
i++) {
569 meEBRecHitLog10Energy5x5Contr_->Fill(-5. + (
float(
i) + 0.5) / 10., ebcontr25[
i] / e5x5rec);
579 e.getByToken(EEHits_Token_, crossingFrame);
584 const int eecSize = 90;
585 double eecontr[eecSize];
586 double eecontr25[eecSize];
587 for (
int i = 0;
i < eecSize;
i++) {
596 LogDebug(
"Endcap, HitInfo") <<
" CaloHit " << iHit.getName() <<
" DetID = " << iHit.id() <<
"\n"
597 <<
"Energy = " << iHit.energy() <<
" Time = " << iHit.time() <<
"\n"
598 <<
"EEDetId side " << eeid.zside() <<
" = " << eeid.ix() <<
" " << eeid.iy();
600 uint32_t crystid = eeid.rawId();
601 eeSimMap[crystid] += iHit.energy();
614 eeRecMap[EEid.
rawId()] += myRecHit->energy();
617 eetotal += myRecHit->energy();
618 if (myRecHit->energy() > 0) {
619 if (meEERecHitLog10Energy_)
620 meEERecHitLog10Energy_->Fill(log10(myRecHit->energy()));
621 int log10i =
int((log10(myRecHit->energy()) + 5.) * 10.);
622 if (log10i >= 0 and log10i < eecSize)
623 eecontr[log10i] += myRecHit->energy();
627 if (eeSimMap[EEid.
rawId()] != 0.) {
628 double uncEnergy = uncalibRecHit->amplitude() * endcapADCtoGeV_;
629 if (meEEUnRecHitSimHitRatio_) {
630 meEEUnRecHitSimHitRatio_->Fill(uncEnergy / eeSimMap[EEid.
rawId()]);
632 if (meEEUnRecHitSimHitRatioGt35_ && (myRecHit->energy() > 3.5)) {
633 meEEUnRecHitSimHitRatioGt35_->Fill(uncEnergy / eeSimMap[EEid.
rawId()]);
638 if (eeSimMap[EEid.
rawId()] != 0.) {
639 if (meEERecHitSimHitRatio_) {
640 meEERecHitSimHitRatio_->Fill(myRecHit->energy() / eeSimMap[EEid.
rawId()]);
642 if (meEERecHitSimHitRatioGt35_ && (myRecHit->energy() > 3.5)) {
643 meEERecHitSimHitRatioGt35_->Fill(myRecHit->energy() / eeSimMap[EEid.
rawId()]);
651 if (ecs !=
nullptr) {
654 if (csmi != ecs->
end())
656 uint16_t sc =
csc.getStatusCode();
657 if (meEERecHitSimHitRatio1011_ !=
nullptr && (sc == 10 || sc == 11)) {
658 meEERecHitSimHitRatio1011_->Fill(myRecHit->energy() / eeSimMap[EEid.
rawId()]);
660 if (meEERecHitSimHitRatio12_ !=
nullptr && sc == 12) {
661 meEERecHitSimHitRatio12_->Fill(myRecHit->energy() / eeSimMap[EEid.
rawId()]);
663 if (meEERecHitSimHitRatio13_ !=
nullptr && sc == 13) {
664 meEERecHitSimHitRatio13_->Fill(myRecHit->energy() / eeSimMap[EEid.
rawId()]);
668 int flag = myRecHit->recoFlag();
669 if (meEERecHitFlags_ !=
nullptr)
670 meEERecHitFlags_->Fill(
flag);
671 if (meEERecHitSimHitvsSimHitFlag5_6_ &&
673 meEERecHitSimHitvsSimHitFlag5_6_->Fill(myRecHit->energy() / eeSimMap[EEid.
rawId()], eeSimMap[EEid.
rawId()]);
675 meEERecHitSimHitFlag6_->Fill(myRecHit->energy() / eeSimMap[EEid.
rawId()]);
677 meEERecHitSimHitFlag6_->Fill(myRecHit->energy() / eeSimMap[EEid.
rawId()]);
679 if (EEid.
zside() > 0) {
680 if (meEERecHitsOccupancyPlusFlag5_6_ &&
682 meEERecHitsOccupancyPlusFlag5_6_->Fill(EEid.
ix(), EEid.
iy());
683 if (meEERecHitsOccupancyPlusFlag8_9_ &&
685 meEERecHitsOccupancyPlusFlag8_9_->Fill(EEid.
ix(), EEid.
iy());
687 if (EEid.
zside() < 0) {
688 if (meEERecHitsOccupancyMinusFlag5_6_ &&
690 meEERecHitsOccupancyMinusFlag5_6_->Fill(EEid.
ix(), EEid.
iy());
691 if (meEERecHitsOccupancyMinusFlag8_9_ &&
693 meEERecHitsOccupancyMinusFlag8_9_->Fill(EEid.
ix(), EEid.
iy());
701 uint32_t eecenterid = getUnitWithMaxEnergy(eeRecMap);
703 int bx = myEEid.
ix();
704 int by = myEEid.
iy();
705 int bz = myEEid.
zside();
706 findEndcapMatrix(5, 5,
bx, by, bz, eeRecMap);
709 for (
unsigned int i = 0;
i < crystalMatrix.size();
i++) {
710 e5x5rec += eeRecMap[crystalMatrix[
i]];
711 e5x5sim += eeSimMap[crystalMatrix[
i]];
712 if (eeRecMap[crystalMatrix[
i]] > 0) {
713 int log10i25 =
int((log10(eeRecMap[crystalMatrix[
i]]) + 5.) * 10.);
714 if (log10i25 >= 0 && log10i25 < eecSize)
715 eecontr25[log10i25] += eeRecMap[crystalMatrix[
i]];
720 meEEe5x5_->Fill(e5x5rec);
721 if (e5x5sim > 0. && meEEe5x5OverSimHits_)
722 meEEe5x5OverSimHits_->Fill(e5x5rec / e5x5sim);
723 if (eGun > 0. && meEEe5x5OverGun_)
724 meEEe5x5OverGun_->Fill(e5x5rec / eGun);
726 if (meEERecHitLog10EnergyContr_ && eetotal != 0) {
727 for (
int i = 0;
i < eecSize;
i++) {
728 meEERecHitLog10EnergyContr_->Fill(-5. + (
float(
i) + 0.5) / 10., eecontr[
i] / eetotal);
732 if (meEERecHitLog10Energy5x5Contr_ && e5x5rec != 0) {
733 for (
int i = 0;
i < eecSize;
i++) {
734 meEERecHitLog10Energy5x5Contr_->Fill(-5. + (
float(
i) + 0.5) / 10., eecontr25[
i] / e5x5rec);
742 if (!skipPreshower) {
744 e.getByToken(ESHits_Token_, crossingFrame);
748 const int escSize = 90;
749 double escontr[escSize];
750 for (
int i = 0;
i < escSize;
i++) {
757 LogDebug(
"Preshower, HitInfo") <<
" CaloHit " << iHit.getName() <<
" DetID = " << iHit.id() <<
"\n"
758 <<
"Energy = " << iHit.energy() <<
" Time = " << iHit.time() <<
"\n"
759 <<
"ESDetId strip " << esid.strip() <<
" = " << esid.six() <<
" " << esid.siy();
761 uint32_t crystid = esid.rawId();
762 esSimMap[crystid] += iHit.energy();
768 if (esSimMap[ESid.
rawId()] != 0.) {
770 estotal +=
recHit->energy();
771 if (
recHit->energy() > 0) {
772 if (meESRecHitLog10Energy_)
773 meESRecHitLog10Energy_->Fill(log10(
recHit->energy()));
774 int log10i =
int((log10(
recHit->energy()) + 5.) * 10.);
775 if (log10i >= 0 and log10i < escSize)
776 escontr[log10i] +=
recHit->energy();
779 if (meESRecHitSimHitRatio_) {
780 meESRecHitSimHitRatio_->Fill(
recHit->energy() / esSimMap[ESid.
rawId()]);
786 if (meESRecHitLog10EnergyContr_ && estotal != 0) {
787 for (
int i = 0;
i < escSize;
i++) {
788 meESRecHitLog10EnergyContr_->Fill(-5. + (
float(
i) + 0.5) / 10., escontr[
i] / estotal);
796 uint32_t unitWithMaxEnergy = 0;
799 MapType::iterator iter;
800 for (iter = themap.begin(); iter != themap.end(); iter++) {
803 unitWithMaxEnergy = (*iter).first;
807 return unitWithMaxEnergy;
811 int nCellInEta,
int nCellInPhi,
int CentralEta,
int CentralPhi,
int CentralZ,
MapType &themap) {
812 int goBackInEta = nCellInEta / 2;
813 int goBackInPhi = nCellInPhi / 2;
814 int matrixSize = nCellInEta * nCellInPhi;
815 crystalMatrix.clear();
816 crystalMatrix.resize(matrixSize);
818 int startEta = CentralZ * CentralEta - goBackInEta;
819 int startPhi = CentralPhi - goBackInPhi;
822 for (
int ieta = startEta;
ieta < startEta + nCellInEta;
ieta++) {
823 for (
int iphi = startPhi;
iphi < startPhi + nCellInPhi;
iphi++) {
830 }
else if (
iphi > 360) {
835 crystalMatrix[
i++] =
index;
841 int nCellInX,
int nCellInY,
int CentralX,
int CentralY,
int CentralZ,
MapType &themap) {
842 int goBackInX = nCellInX / 2;
843 int goBackInY = nCellInY / 2;
844 crystalMatrix.clear();
846 int startX = CentralX - goBackInX;
847 int startY = CentralY - goBackInY;
849 for (
int ix = startX; ix < startX + nCellInX; ix++) {
850 for (
int iy = startY; iy < startY + nCellInY; iy++) {
858 crystalMatrix.push_back(
index);