38 EBuncalibrechitCollection_Token_ = consumes<EBUncalibratedRecHitCollection>(ps.
getParameter<
edm::InputTag>(
"EBuncalibrechitCollection"));
39 EEuncalibrechitCollection_Token_ = consumes<EEUncalibratedRecHitCollection>(ps.
getParameter<
edm::InputTag>(
"EEuncalibrechitCollection"));
48 if ( !outputFile_.empty() ) {
49 LogInfo(
"OutputInfo") <<
" Ecal RecHits Task histograms will be saved to '" << outputFile_.c_str() <<
"'";
51 LogInfo(
"OutputInfo") <<
" Ecal RecHits Task histograms will NOT be saved";
59 meGunEnergy_ =
nullptr;
62 meEBRecHitSimHitRatio_ =
nullptr;
63 meEERecHitSimHitRatio_ =
nullptr;
64 meESRecHitSimHitRatio_ =
nullptr;
65 meEBRecHitSimHitRatio1011_ =
nullptr;
66 meEERecHitSimHitRatio1011_ =
nullptr;
67 meEBRecHitSimHitRatio12_ =
nullptr;
68 meEERecHitSimHitRatio12_ =
nullptr;
69 meEBRecHitSimHitRatio13_ =
nullptr;
70 meEERecHitSimHitRatio13_ =
nullptr;
71 meEBRecHitSimHitRatioGt35_ =
nullptr;
72 meEERecHitSimHitRatioGt35_ =
nullptr;
73 meEBUnRecHitSimHitRatio_ =
nullptr;
74 meEEUnRecHitSimHitRatio_ =
nullptr;
75 meEBUnRecHitSimHitRatioGt35_ =
nullptr;
76 meEEUnRecHitSimHitRatioGt35_ =
nullptr;
78 meEBe5x5OverSimHits_ =
nullptr;
79 meEBe5x5OverGun_ =
nullptr;
81 meEEe5x5OverSimHits_ =
nullptr;
82 meEEe5x5OverGun_ =
nullptr;
84 meEBRecHitLog10Energy_ =
nullptr;
85 meEERecHitLog10Energy_ =
nullptr;
86 meESRecHitLog10Energy_ =
nullptr;
87 meEBRecHitLog10EnergyContr_ =
nullptr;
88 meEERecHitLog10EnergyContr_ =
nullptr;
89 meESRecHitLog10EnergyContr_ =
nullptr;
90 meEBRecHitLog10Energy5x5Contr_ =
nullptr;
91 meEERecHitLog10Energy5x5Contr_ =
nullptr;
93 meEBRecHitsOccupancyFlag5_6_ =
nullptr;
94 meEBRecHitsOccupancyFlag8_9_ =
nullptr;
95 meEERecHitsOccupancyPlusFlag5_6_ =
nullptr;
96 meEERecHitsOccupancyMinusFlag5_6_ =
nullptr;
97 meEERecHitsOccupancyPlusFlag8_9_ =
nullptr;
98 meEERecHitsOccupancyMinusFlag8_9_ =
nullptr;
100 meEBRecHitFlags_ =
nullptr;
101 meEBRecHitSimHitvsSimHitFlag5_6_ =
nullptr;
102 meEBRecHitSimHitFlag6_ =
nullptr;
103 meEBRecHitSimHitFlag7_ =
nullptr;
104 meEB5x5RecHitSimHitvsSimHitFlag8_ =
nullptr;
106 meEERecHitFlags_ =
nullptr;
107 meEERecHitSimHitvsSimHitFlag5_6_ =
nullptr;
108 meEERecHitSimHitFlag6_ =
nullptr;
109 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_ = ibooker.
book1D(
"EcalRecHitsTask Barrel Log10 Energy",
"EcalRecHitsTask Barrel Log10 Energy", 90, -5., 4. );
196 meEERecHitLog10Energy_ = ibooker.
book1D(
"EcalRecHitsTask Endcap Log10 Energy",
"EcalRecHitsTask Endcap Log10 Energy", 90, -5., 4. );
197 meESRecHitLog10Energy_ = ibooker.
book1D(
"EcalRecHitsTask Preshower Log10 Energy",
"EcalRecHitsTask Preshower Log10 Energy", 90, -5., 4. );
198 meEBRecHitLog10EnergyContr_ = ibooker.
bookProfile(
"EcalRecHits Barrel Log10En vs Hit Contribution",
"EcalRecHits Barrel Log10En vs Hit Contribution", 90, -5., 4., 100, 0., 1. );
199 meEERecHitLog10EnergyContr_ = ibooker.
bookProfile(
"EcalRecHits Endcap Log10En vs Hit Contribution",
"EcalRecHits Endcap Log10En vs Hit Contribution", 90, -5., 4., 100, 0., 1. );
200 meESRecHitLog10EnergyContr_ = ibooker.
bookProfile(
"EcalRecHits Preshower Log10En vs Hit Contribution",
"EcalRecHits Preshower Log10En vs Hit Contribution", 90, -5., 4., 100, 0., 1. );
201 meEBRecHitLog10Energy5x5Contr_ = ibooker.
bookProfile(
"EcalRecHits Barrel Log10En5x5 vs Hit Contribution",
"EcalRecHits Barrel Log10En5x5 vs Hit Contribution", 90, -5., 4., 100, 0., 1. );
202 meEERecHitLog10Energy5x5Contr_ = ibooker.
bookProfile(
"EcalRecHits Endcap Log10En5x5 vs Hit Contribution",
"EcalRecHits Endcap Log10En5x5 vs Hit Contribution", 90, -5., 4., 100, 0., 1. );
205 histo =
"EB Occupancy Flag=5 6";
206 meEBRecHitsOccupancyFlag5_6_ = ibooker.
book2D(histo, histo, 170, -85., 85., 360, 0., 360.);
207 histo =
"EB Occupancy Flag=8 9";
208 meEBRecHitsOccupancyFlag8_9_ = ibooker.
book2D(histo, histo, 170, -85., 85., 360, 0., 360.);
210 histo =
"EE+ Occupancy Flag=5 6";
211 meEERecHitsOccupancyPlusFlag5_6_ = ibooker.
book2D(histo, histo, 100, 0., 100., 100, 0., 100.);
212 histo =
"EE- Occupancy Flag=5 6";
213 meEERecHitsOccupancyMinusFlag5_6_ = ibooker.
book2D(histo, histo, 100, 0., 100., 100, 0., 100.);
214 histo =
"EE+ Occupancy Flag=8 9";
215 meEERecHitsOccupancyPlusFlag8_9_ = ibooker.
book2D(histo, histo, 100, 0., 100., 100, 0., 100.);
216 histo =
"EE- Occupancy Flag=8 9";
217 meEERecHitsOccupancyMinusFlag8_9_ = ibooker.
book2D(histo, histo, 100, 0., 100., 100, 0., 100.);
220 histo =
"EcalRecHitsTask Barrel Reco Flags";
221 meEBRecHitFlags_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 10, 0., 10.);
222 histo =
"EcalRecHitsTask Endcap Reco Flags";
223 meEERecHitFlags_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 10, 0., 10.);
224 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio vs SimHit Flag=5 6";
225 meEBRecHitSimHitvsSimHitFlag5_6_ = ibooker.
book2D(histo.c_str(), histo.c_str(), 80, 0., 2., 4000, 0., 400. );
226 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio vs SimHit Flag=5 6";
227 meEERecHitSimHitvsSimHitFlag5_6_ = ibooker.
book2D(histo.c_str(), histo.c_str(), 80, 0., 2., 4000, 0., 400. );
228 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio Flag=6";
229 meEBRecHitSimHitFlag6_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0., 2.);
230 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio Flag=6";
231 meEERecHitSimHitFlag6_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0., 2.);
232 histo =
"EcalRecHitsTask Barrel RecSimHit Ratio Flag=7";
233 meEBRecHitSimHitFlag7_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0., 2.);
234 histo =
"EcalRecHitsTask Endcap RecSimHit Ratio Flag=7";
235 meEERecHitSimHitFlag7_ = ibooker.
book1D(histo.c_str(), histo.c_str(), 80, 0., 2.);
236 histo =
"EcalRecHitsTask Barrel 5x5 RecSimHit Ratio vs SimHit Flag=8";
237 meEB5x5RecHitSimHitvsSimHitFlag8_ = ibooker.
book2D(histo.c_str(), histo.c_str(), 80, 0., 2., 4000, 0., 400. );
248 LogInfo(
"EcalRecHitsTask, EventInfo: ") <<
" Run = " << e.
id().
run() <<
" Event = " << e.
id().
event();
254 const double barrelADCtoGeV_ = agc->
getEBValue();
255 const double endcapADCtoGeV_ = agc->
getEEValue();
260 if (!MCEvt.
isValid()) { skipMC =
true; }
264 bool skipBarrel =
false;
267 e.
getByToken( EBuncalibrechitCollection_Token_, EcalUncalibRecHitEB);
268 if (EcalUncalibRecHitEB.
isValid()) {
269 EBUncalibRecHit = EcalUncalibRecHitEB.
product() ;
274 bool skipEndcap =
false;
277 e.
getByToken( EEuncalibrechitCollection_Token_, EcalUncalibRecHitEE);
278 if (EcalUncalibRecHitEE.
isValid()){
279 EEUncalibRecHit = EcalUncalibRecHitEE.
product () ;
286 e.
getByToken( EBrechitCollection_Token_, EcalRecHitEB);
288 EBRecHit = EcalRecHitEB.
product();
295 e.
getByToken( EErechitCollection_Token_, EcalRecHitEE);
297 EERecHit = EcalRecHitEE.
product ();
302 bool skipPreshower =
false;
305 e.
getByToken( ESrechitCollection_Token_, EcalRecHitES);
307 ESRecHit = EcalRecHitES.
product ();
309 skipPreshower =
true;
317 for ( HepMC::GenEvent::particle_const_iterator
p = MCEvt->
GetEvent()->particles_begin();
p != MCEvt->
GetEvent()->particles_end(); ++
p ) {
318 double htheta = (*p)->momentum().theta();
319 double heta = -99999.;
320 if(
tan(htheta * 0.5) > 0 ) {
321 heta = -
log(
tan(htheta * 0.5));
323 double hphi = (*p)->momentum().phi();
324 hphi = (hphi>=0) ? hphi : hphi+2*
M_PI;
325 hphi = hphi /
M_PI * 180.;
327 LogDebug(
"EventInfo") <<
"EcalRecHitsTask: Particle gun type form MC = " <<
abs((*p)->pdg_id())
328 <<
"\n" <<
"Energy = "<< (*p)->momentum().e()
329 <<
"\n" <<
"Eta = " << heta
330 <<
"\n" <<
"Phi = " << hphi;
332 if ( (*p)->momentum().e() > eGun ) eGun = (*p)->momentum().e();
334 if (meGunEnergy_) meGunEnergy_->Fill((*p)->momentum().e());
335 if (meGunEta_) meGunEta_ ->Fill(heta);
336 if (meGunPhi_) meGunPhi_ ->Fill(hphi);
351 const int ebcSize = 90;
352 double ebcontr[ebcSize];
353 double ebcontr25[ebcSize];
354 for(
int i=0;
i<ebcSize;
i++ ) { ebcontr[
i] = 0.0; ebcontr25[
i] = 0.0; }
361 <<
"CaloHit " << iHit.getName() <<
" DetID = " << iHit.id() <<
"\n" 362 <<
"Energy = " << iHit.energy() <<
" Time = " << iHit.time() <<
"\n" 363 <<
"EBDetId = " << ebid.
ieta() <<
" " << ebid.
iphi();
365 uint32_t crystid = ebid.
rawId();
366 ebSimMap[crystid] += iHit.energy();
377 if( myRecHit == EBRecHit->
end() )
continue;
378 ebRecMap[EBid.
rawId()] += myRecHit->energy();
381 ebtotal += myRecHit->energy();
382 if( myRecHit->energy() > 0 ) {
383 if( meEBRecHitLog10Energy_ ) meEBRecHitLog10Energy_->Fill( log10( myRecHit->energy() ) );
384 int log10i =
int( ( log10( myRecHit->energy() ) + 5. ) * 10. );
385 if( log10i >=0 and log10i < ebcSize ) ebcontr[ log10i ] += myRecHit->energy();
389 if ( ebSimMap[EBid.
rawId()] != 0. ) {
390 double uncEnergy = uncalibRecHit->amplitude()*barrelADCtoGeV_;
391 if (meEBUnRecHitSimHitRatio_) {meEBUnRecHitSimHitRatio_ ->Fill(uncEnergy/ebSimMap[EBid.
rawId()]);}
392 if (meEBUnRecHitSimHitRatioGt35_ && (myRecHit->energy()>3.5)){meEBUnRecHitSimHitRatioGt35_->Fill(uncEnergy/ebSimMap[EBid.
rawId()]);}
395 if (myRecHit != EBRecHit->
end()) {
396 if ( ebSimMap[EBid.
rawId()] != 0. ) {
397 if (meEBRecHitSimHitRatio_) {meEBRecHitSimHitRatio_ ->Fill(myRecHit->energy()/ebSimMap[EBid.
rawId()]);}
398 if (meEBRecHitSimHitRatioGt35_ && (myRecHit->energy()>3.5)){meEBRecHitSimHitRatioGt35_->Fill(myRecHit->energy()/ebSimMap[EBid.
rawId()]);}
404 if( ecs !=
nullptr ) {
407 if( csmi != ecs->
end() ) csc = *csmi;
411 if( meEBRecHitSimHitRatio1011_ !=
nullptr &&
412 ( sc == 10 || sc == 11 ) ) { meEBRecHitSimHitRatio1011_->Fill(myRecHit->energy()/ebSimMap[EBid.
rawId()]); }
413 if( meEBRecHitSimHitRatio12_ !=
nullptr && sc == 12 ) { meEBRecHitSimHitRatio12_->Fill(myRecHit->energy()/ebSimMap[EBid.
rawId()]); }
419 double ttSimEnergy = 0;
420 if( ttMap !=
nullptr ) {
423 for( std::vector<DetId>::const_iterator dit = vid.begin(); dit != vid.end(); dit++ ) {
425 ttSimEnergy += ebSimMap[ttEBid.
rawId()];
427 if( !vid.empty() ) ttSimEnergy = ttSimEnergy / vid.
size();
429 if( meEBRecHitSimHitRatio13_ !=
nullptr && sc == 13 && ttSimEnergy != 0 )
430 meEBRecHitSimHitRatio13_->Fill(myRecHit->energy()/ttSimEnergy);
432 int flag = myRecHit->recoFlag();
433 if( meEBRecHitFlags_ !=
nullptr ) meEBRecHitFlags_->Fill( flag );
435 meEBRecHitSimHitvsSimHitFlag5_6_->Fill( myRecHit->energy()/ebSimMap[EBid.
rawId()], ebSimMap[EBid.
rawId()] );
437 meEBRecHitSimHitFlag6_->Fill( myRecHit->energy()/ebSimMap[EBid.
rawId()] );
439 meEBRecHitSimHitFlag6_->Fill( myRecHit->energy()/ebSimMap[EBid.
rawId()] );
441 meEB5x5RecHitSimHitvsSimHitFlag8_->Fill( myRecHit->energy()/ttSimEnergy, ttSimEnergy );
444 meEBRecHitsOccupancyFlag5_6_ ->
Fill(EBid.
ieta(), EBid.
iphi());
446 meEBRecHitsOccupancyFlag8_9_ ->
Fill(EBid.
ieta(), EBid.
iphi());
455 uint32_t ebcenterid = getUnitWithMaxEnergy(ebRecMap);
458 int by = myEBid.
iphi();
459 int bz = myEBid.
zside();
460 findBarrelMatrix(5,5,bx,by,bz,ebRecMap);
463 for (
unsigned int i = 0;
i < crystalMatrix.size();
i++ ) {
464 e5x5rec += ebRecMap[crystalMatrix[
i]];
465 e5x5sim += ebSimMap[crystalMatrix[
i]];
466 if( ebRecMap[crystalMatrix[
i]] > 0 ) {
467 int log10i25 =
int( ( log10( ebRecMap[crystalMatrix[
i]] ) + 5. ) * 10. );
468 if( log10i25 >=0 && log10i25 < ebcSize ) ebcontr25[ log10i25 ] += ebRecMap[crystalMatrix[
i]];
472 if( meEBe5x5_ ) meEBe5x5_->Fill(e5x5rec);
473 if ( e5x5sim > 0. && meEBe5x5OverSimHits_ ) meEBe5x5OverSimHits_->Fill(e5x5rec/e5x5sim);
474 if ( eGun > 0. && meEBe5x5OverGun_ ) meEBe5x5OverGun_->Fill(e5x5rec/eGun);
476 if( meEBRecHitLog10EnergyContr_ && ebtotal != 0 ) {
477 for(
int i=0;
i<ebcSize;
i++ ) {
478 meEBRecHitLog10EnergyContr_->Fill( -5.+(
float(
i)+0.5)/10., ebcontr[
i]/ebtotal );
482 if( meEBRecHitLog10Energy5x5Contr_ && e5x5rec != 0 ) {
483 for(
int i=0;
i<ebcSize;
i++ ) {
484 meEBRecHitLog10Energy5x5Contr_->Fill( -5.+(
float(
i)+0.5)/10., ebcontr25[
i]/e5x5rec );
492 if ( ! skipEndcap ) {
500 const int eecSize = 90;
501 double eecontr[eecSize];
502 double eecontr25[eecSize];
503 for(
int i=0;
i<eecSize;
i++ ) { eecontr[
i] = 0.0; eecontr25[
i] = 0.0; }
510 <<
" CaloHit " << iHit.getName() <<
" DetID = " << iHit.id() <<
"\n" 511 <<
"Energy = " << iHit.energy() <<
" Time = " << iHit.time() <<
"\n" 512 <<
"EEDetId side " << eeid.zside() <<
" = " << eeid.ix() <<
" " << eeid.iy();
514 uint32_t crystid = eeid.rawId();
515 eeSimMap[crystid] += iHit.energy();
526 if( myRecHit == EERecHit->
end() )
continue;
527 eeRecMap[EEid.
rawId()] += myRecHit->energy();
530 eetotal += myRecHit->energy();
531 if( myRecHit->energy() > 0 ) {
532 if( meEERecHitLog10Energy_ ) meEERecHitLog10Energy_->Fill( log10( myRecHit->energy() ) );
533 int log10i =
int( ( log10( myRecHit->energy() ) + 5. ) * 10. );
534 if( log10i >=0 and log10i < eecSize ) eecontr[ log10i ] += myRecHit->energy();
538 if ( eeSimMap[EEid.
rawId()] != 0. ) {
539 double uncEnergy = uncalibRecHit->amplitude()*endcapADCtoGeV_;
540 if (meEEUnRecHitSimHitRatio_) {meEEUnRecHitSimHitRatio_ ->Fill(uncEnergy/eeSimMap[EEid.
rawId()]);}
541 if (meEEUnRecHitSimHitRatioGt35_ && (myRecHit->energy()>3.5)){meEEUnRecHitSimHitRatioGt35_->Fill(uncEnergy/eeSimMap[EEid.
rawId()]);}
544 if (myRecHit != EERecHit->
end()) {
545 if ( eeSimMap[EEid.
rawId()] != 0. ) {
546 if (meEERecHitSimHitRatio_) {meEERecHitSimHitRatio_ ->Fill(myRecHit->energy()/eeSimMap[EEid.
rawId()]); }
547 if (meEERecHitSimHitRatioGt35_ && (myRecHit->energy()>3.5)){meEERecHitSimHitRatioGt35_->Fill(myRecHit->energy()/eeSimMap[EEid.
rawId()]); }
553 if( ecs !=
nullptr ) {
556 if( csmi != ecs->
end() ) csc = *csmi;
558 if( meEERecHitSimHitRatio1011_ !=
nullptr &&
559 ( sc == 10 || sc == 11 ) ) { meEERecHitSimHitRatio1011_->Fill(myRecHit->energy()/eeSimMap[EEid.
rawId()]); }
560 if( meEERecHitSimHitRatio12_ !=
nullptr && sc == 12 ) { meEERecHitSimHitRatio12_->Fill(myRecHit->energy()/eeSimMap[EEid.
rawId()]); }
561 if( meEERecHitSimHitRatio13_ !=
nullptr && sc == 13 ) { meEERecHitSimHitRatio13_->Fill(myRecHit->energy()/eeSimMap[EEid.
rawId()]); }
564 int flag = myRecHit->recoFlag();
565 if( meEERecHitFlags_ !=
nullptr ) meEERecHitFlags_->Fill( flag );
567 meEERecHitSimHitvsSimHitFlag5_6_->Fill( myRecHit->energy()/eeSimMap[EEid.
rawId()], eeSimMap[EEid.
rawId()] );
569 meEERecHitSimHitFlag6_->Fill( myRecHit->energy()/eeSimMap[EEid.
rawId()] );
571 meEERecHitSimHitFlag6_->Fill( myRecHit->energy()/eeSimMap[EEid.
rawId()] );
573 if (EEid.
zside() > 0) {
575 meEERecHitsOccupancyPlusFlag5_6_ ->
Fill(EEid.
ix(), EEid.
iy());
577 meEERecHitsOccupancyPlusFlag8_9_ ->
Fill(EEid.
ix(), EEid.
iy());
579 if (EEid.
zside() < 0) {
581 meEERecHitsOccupancyMinusFlag5_6_ ->
Fill(EEid.
ix(), EEid.
iy());
583 meEERecHitsOccupancyMinusFlag8_9_ ->
Fill(EEid.
ix(), EEid.
iy());
592 uint32_t eecenterid = getUnitWithMaxEnergy(eeRecMap);
594 int bx = myEEid.
ix();
595 int by = myEEid.
iy();
596 int bz = myEEid.
zside();
597 findEndcapMatrix(5,5,bx,by,bz,eeRecMap);
600 for (
unsigned int i = 0;
i < crystalMatrix.size();
i++ ) {
601 e5x5rec += eeRecMap[crystalMatrix[
i]];
602 e5x5sim += eeSimMap[crystalMatrix[
i]];
603 if( eeRecMap[crystalMatrix[
i]] > 0 ) {
604 int log10i25 =
int( ( log10( eeRecMap[crystalMatrix[
i]] ) + 5. ) * 10. );
605 if( log10i25 >=0 && log10i25 < eecSize ) eecontr25[ log10i25 ] += eeRecMap[crystalMatrix[
i]];
609 if( meEEe5x5_ ) meEEe5x5_->Fill(e5x5rec);
610 if ( e5x5sim > 0. && meEEe5x5OverSimHits_ ) meEEe5x5OverSimHits_->Fill(e5x5rec/e5x5sim);
611 if ( eGun > 0. && meEEe5x5OverGun_ ) meEEe5x5OverGun_->Fill(e5x5rec/eGun);
614 if( meEERecHitLog10EnergyContr_ && eetotal != 0 ) {
615 for(
int i=0;
i<eecSize;
i++ ) {
616 meEERecHitLog10EnergyContr_->Fill( -5.+(
float(
i)+0.5)/10., eecontr[
i]/eetotal );
620 if( meEERecHitLog10Energy5x5Contr_ && e5x5rec != 0 ) {
621 for(
int i=0;
i<eecSize;
i++ ) {
622 meEERecHitLog10Energy5x5Contr_->Fill( -5.+(
float(
i)+0.5)/10., eecontr25[
i]/e5x5rec );
630 if ( ! skipPreshower ) {
637 const int escSize = 90;
638 double escontr[escSize];
639 for(
int i=0;
i<escSize;
i++ ) { escontr[
i] = 0.0; }
645 <<
" CaloHit " << iHit.getName() <<
" DetID = " << iHit.id() <<
"\n" 646 <<
"Energy = " << iHit.energy() <<
" Time = " << iHit.time() <<
"\n" 647 <<
"ESDetId strip " << esid.strip() <<
" = " << esid.six() <<
" " << esid.siy();
649 uint32_t crystid = esid.rawId();
650 esSimMap[crystid] += iHit.energy();
657 if ( esSimMap[ESid.
rawId()] != 0. ) {
660 estotal +=
recHit->energy();
661 if(
recHit->energy() > 0 ) {
662 if( meESRecHitLog10Energy_ ) meESRecHitLog10Energy_->Fill( log10(
recHit->energy() ) );
663 int log10i =
int( ( log10(
recHit->energy() ) + 5. ) * 10. );
664 if( log10i >=0 and log10i < escSize ) escontr[ log10i ] +=
recHit->energy();
667 if (meESRecHitSimHitRatio_) {
668 meESRecHitSimHitRatio_ ->Fill(
recHit->energy()/esSimMap[ESid.
rawId()]);
675 if( meESRecHitLog10EnergyContr_ && estotal != 0 ) {
676 for(
int i=0;
i<escSize;
i++ ) {
677 meESRecHitLog10EnergyContr_->Fill( -5.+(
float(
i)+0.5)/10., escontr[
i]/estotal );
690 uint32_t unitWithMaxEnergy = 0;
693 MapType::iterator iter;
694 for (iter = themap.begin(); iter != themap.end(); iter++) {
696 if (maxEnergy < (*iter).second) {
697 maxEnergy = (*iter).second;
698 unitWithMaxEnergy = (*iter).first;
702 return unitWithMaxEnergy;
706 int CentralEta,
int CentralPhi,
int CentralZ,
709 int goBackInEta = nCellInEta/2;
710 int goBackInPhi = nCellInPhi/2;
711 int matrixSize = nCellInEta*nCellInPhi;
712 crystalMatrix.clear();
713 crystalMatrix.resize(matrixSize);
715 int startEta = CentralZ*CentralEta - goBackInEta;
716 int startPhi = CentralPhi - goBackInPhi;
719 for (
int ieta = startEta; ieta < startEta+nCellInEta; ieta ++ ) {
720 for(
int iphi = startPhi; iphi < startPhi + nCellInPhi; iphi++ ) {
722 if (
abs(ieta) > 85 ||
abs(ieta)<1 ) {
continue; }
723 if (iphi< 1) { index =
EBDetId(ieta,iphi+360).
rawId(); }
724 else if(iphi>360) { index =
EBDetId(ieta,iphi-360).
rawId(); }
726 crystalMatrix[i++] =
index;
733 int CentralX,
int CentralY,
int CentralZ,
735 int goBackInX = nCellInX/2;
736 int goBackInY = nCellInY/2;
737 crystalMatrix.clear();
739 int startX = CentralX - goBackInX;
740 int startY = CentralY - goBackInY;
742 for (
int ix = startX; ix < startX+nCellInX; ix ++ ) {
744 for(
int iy = startY; iy < startY + nCellInY; iy++ ) {
752 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< EcalUncalibratedRecHit >::const_iterator const_iterator
uint32_t getUnitWithMaxEnergy(MapType &themap)
int iphi() const
get the crystal iphi
~EcalRecHitsValidation() override
Destructor.
void findEndcapMatrix(int nCellInX, int nCellInY, int CentralX, int CentralY, int CentralZ, MapType &themap)
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
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
void setCurrentFolder(const std::string &fullpath)
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
std::map< uint32_t, float, std::less< uint32_t > > MapType
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)