60 LogInfo(
"OutputInfo") <<
" Ecal RecHits Task histograms will be saved to '" <<
outputFile_.c_str() <<
"'";
62 LogInfo(
"OutputInfo") <<
" Ecal RecHits Task histograms will NOT be saved";
130 histo =
"EcalRecHitsTask Gun Momentum";
133 histo =
"EcalRecHitsTask Gun Eta";
136 histo =
"EcalRecHitsTask Gun Phi";
139 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio";
142 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio gt 3p5 GeV";
145 histo =
"EcalRecHitsTask Barrel Unc RecSimHit Ratio";
148 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio Channel Status=10 11";
151 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio Channel Status=12";
154 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio Channel Status=13";
157 histo =
"EcalRecHitsTask Barrel Unc RecSimHit Ratio gt 3p5 GeV";
160 histo =
"EcalRecHitsTask Barrel Rec E5x5";
163 histo =
"EcalRecHitsTask Barrel Rec E5x5 over Sim E5x5";
166 histo =
"EcalRecHitsTask Barrel Rec E5x5 over gun energy";
170 ibooker.
book1D(
"EcalRecHitsTask Barrel Log10 Energy",
"EcalRecHitsTask Barrel Log10 Energy", 90, -5., 4.);
172 "EcalRecHits Barrel Log10En vs Hit Contribution",
180 "EcalRecHits Barrel Log10En5x5 vs Hit Contribution",
188 histo =
"EB Occupancy Flag=5 6";
190 histo =
"EB Occupancy Flag=8 9";
193 histo =
"EcalRecHitsTask Barrel Reco Flags";
195 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio vs SimHit Flag=5 6";
197 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio Flag=6";
199 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio Flag=7";
201 histo =
"EcalRecHitsTask Barrel 5x5 RecSimHit Ratio vs SimHit Flag=8";
205 histo =
"EcalRecHitsTask Preshower RecSimHit Ratio";
208 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio";
211 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio gt 3p5 GeV";
214 histo =
"EcalRecHitsTask Endcap Unc RecSimHit Ratio";
217 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio Channel Status=10 11";
220 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio Channel Status=12";
223 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio Channel Status=13";
226 histo =
"EcalRecHitsTask Endcap Unc RecSimHit Ratio gt 3p5 GeV";
229 histo =
"EcalRecHitsTask Endcap Rec E5x5";
232 histo =
"EcalRecHitsTask Endcap Rec E5x5 over Sim E5x5";
235 histo =
"EcalRecHitsTask Endcap Rec E5x5 over gun energy";
239 ibooker.
book1D(
"EcalRecHitsTask Endcap Log10 Energy",
"EcalRecHitsTask Endcap Log10 Energy", 90, -5., 4.);
241 ibooker.
book1D(
"EcalRecHitsTask Preshower Log10 Energy",
"EcalRecHitsTask Preshower Log10 Energy", 90, -5., 4.);
244 "EcalRecHits Endcap Log10En vs Hit Contribution",
252 "EcalRecHits Preshower Log10En vs Hit Contribution",
261 "EcalRecHits Endcap Log10En5x5 vs Hit Contribution",
269 histo =
"EE+ Occupancy Flag=5 6";
271 histo =
"EE- Occupancy Flag=5 6";
273 histo =
"EE+ Occupancy Flag=8 9";
275 histo =
"EE- Occupancy Flag=8 9";
278 histo =
"EcalRecHitsTask Endcap Reco Flags";
281 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio vs SimHit Flag=5 6";
284 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio Flag=6";
287 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio Flag=7";
295 LogInfo(
"EcalRecHitsTask, EventInfo: ") <<
" Run = " <<
e.id().run() <<
" Event = " <<
e.id().event();
299 const double barrelADCtoGeV_ = agc->
getEBValue();
300 const double endcapADCtoGeV_ = agc->
getEEValue();
311 bool skipBarrel =
false;
315 if (EcalUncalibRecHitEB.
isValid()) {
321 bool skipEndcap =
false;
326 if (EcalUncalibRecHitEE.
isValid()) {
354 bool skipPreshower =
false;
360 ESRecHit = EcalRecHitES.
product();
362 skipPreshower =
true;
365 skipPreshower =
true;
371 for (HepMC::GenEvent::particle_const_iterator
p = MCEvt->
GetEvent()->particles_begin();
374 double htheta = (*p)->momentum().theta();
375 double heta = -99999.;
376 if (
tan(htheta * 0.5) > 0) {
377 heta = -
log(
tan(htheta * 0.5));
379 double hphi = (*p)->momentum().phi();
380 hphi = (hphi >= 0) ? hphi : hphi + 2 *
M_PI;
381 hphi = hphi /
M_PI * 180.;
383 LogDebug(
"EventInfo") <<
"EcalRecHitsTask: Particle gun type form MC = " <<
abs((*p)->pdg_id()) <<
"\n"
384 <<
"Energy = " << (*p)->momentum().e() <<
"\n"
385 <<
"Eta = " << heta <<
"\n"
388 if ((*p)->momentum().e() > eGun)
389 eGun = (*p)->momentum().e();
410 const int ebcSize = 90;
411 double ebcontr[ebcSize];
412 double ebcontr25[ebcSize];
413 for (
int i = 0;
i < ebcSize;
i++) {
422 LogDebug(
"SimHitInfo, barrel") <<
"CaloHit " << iHit.getName() <<
" DetID = " << iHit.id() <<
"\n"
423 <<
"Energy = " << iHit.energy() <<
" Time = " << iHit.time() <<
"\n"
424 <<
"EBDetId = " << ebid.
ieta() <<
" " << ebid.
iphi();
426 uint32_t crystid = ebid.
rawId();
427 ebSimMap[crystid] += iHit.energy();
440 ebRecMap[EBid.
rawId()] += myRecHit->energy();
443 ebtotal += myRecHit->energy();
444 if (myRecHit->energy() > 0) {
447 int log10i =
int((log10(myRecHit->energy()) + 5.) * 10.);
448 if (log10i >= 0 and log10i < ebcSize)
449 ebcontr[log10i] += myRecHit->energy();
453 if (ebSimMap[EBid.
rawId()] != 0.) {
454 double uncEnergy = uncalibRecHit->amplitude() * barrelADCtoGeV_;
464 if (ebSimMap[EBid.
rawId()] != 0.) {
479 if (ecs !=
nullptr) {
482 if (csmi != ecs->
end())
484 sc =
csc.getStatusCode();
496 if (pttMap.isValid())
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();
512 int flag = myRecHit->recoFlag();
539 int by = myEBid.
iphi();
540 int bz = myEBid.
zside();
549 if (log10i25 >= 0 && log10i25 < ebcSize)
562 for (
int i = 0;
i < ebcSize;
i++) {
568 for (
int i = 0;
i < ebcSize;
i++) {
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) {
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_;
638 if (eeSimMap[EEid.
rawId()] != 0.) {
650 if (ecs !=
nullptr) {
653 if (csmi != ecs->
end())
655 uint16_t sc =
csc.getStatusCode();
667 int flag = myRecHit->recoFlag();
678 if (EEid.
zside() > 0) {
686 if (EEid.
zside() < 0) {
702 int bx = myEEid.
ix();
703 int by = myEEid.
iy();
704 int bz = myEEid.
zside();
713 if (log10i25 >= 0 && log10i25 < eecSize)
726 for (
int i = 0;
i < eecSize;
i++) {
732 for (
int i = 0;
i < eecSize;
i++) {
741 if (!skipPreshower) {
747 const int escSize = 90;
748 double escontr[escSize];
749 for (
int i = 0;
i < escSize;
i++) {
756 LogDebug(
"Preshower, HitInfo") <<
" CaloHit " << iHit.getName() <<
" DetID = " << iHit.id() <<
"\n"
757 <<
"Energy = " << iHit.energy() <<
" Time = " << iHit.time() <<
"\n"
758 <<
"ESDetId strip " << esid.strip() <<
" = " << esid.six() <<
" " << esid.siy();
760 uint32_t crystid = esid.rawId();
761 esSimMap[crystid] += iHit.energy();
767 if (esSimMap[ESid.
rawId()] != 0.) {
769 estotal +=
recHit->energy();
770 if (
recHit->energy() > 0) {
773 int log10i =
int((log10(
recHit->energy()) + 5.) * 10.);
774 if (log10i >= 0 and log10i < escSize)
775 escontr[log10i] +=
recHit->energy();
786 for (
int i = 0;
i < escSize;
i++) {
795 uint32_t unitWithMaxEnergy = 0;
798 MapType::iterator iter;
799 for (iter = themap.begin(); iter != themap.end(); iter++) {
802 unitWithMaxEnergy = (*iter).first;
806 return unitWithMaxEnergy;
810 int nCellInEta,
int nCellInPhi,
int CentralEta,
int CentralPhi,
int CentralZ,
MapType &themap) {
811 int goBackInEta = nCellInEta / 2;
812 int goBackInPhi = nCellInPhi / 2;
813 int matrixSize = nCellInEta * nCellInPhi;
817 int startEta = CentralZ * CentralEta - goBackInEta;
818 int startPhi = CentralPhi - goBackInPhi;
821 for (
int ieta = startEta;
ieta < startEta + nCellInEta;
ieta++) {
822 for (
int iphi = startPhi;
iphi < startPhi + nCellInPhi;
iphi++) {
829 }
else if (
iphi > 360) {
840 int nCellInX,
int nCellInY,
int CentralX,
int CentralY,
int CentralZ,
MapType &themap) {
841 int goBackInX = nCellInX / 2;
842 int goBackInY = nCellInY / 2;
845 int startX = CentralX - goBackInX;
846 int startY = CentralY - goBackInY;
848 for (
int ix = startX; ix < startX + nCellInX; ix++) {
849 for (
int iy = startY; iy < startY + nCellInY; iy++) {