CMS 3D CMS Logo

HcalDigiTester.cc
Go to the documentation of this file.
4 
11 
15 
19 
20 #include <vector>
21 #include <utility>
22 #include <ostream>
23 #include <string>
24 #include <algorithm>
25 #include <cmath>
26 
31 
32 template<class Digi >
33 
35 
36 
39 
40  // ADC2fC
42  CaloSamples tool;
43 
44 
45  iEvent.getByToken (tok, digiCollection);
46 
47  int subdet = 0;
48  if (hcalselector_ == "HB" ) subdet = 1;
49  if (hcalselector_ == "HE" ) subdet = 2;
50  if (hcalselector_ == "HO" ) subdet = 3;
51  if (hcalselector_ == "HF" ) subdet = 4;
52 
53  if(subdet == 1) nevent1++;
54  if(subdet == 2) nevent2++;
55  if(subdet == 3) nevent3++;
56  if(subdet == 4) nevent4++;
57 
58  int zsign = 0;
59  if (zside_ == "+") zsign = 1;
60  if (zside_ == "-") zsign = -1;
61 
62  int ndigis = 0;
63  // amplitude for signal cell at diff. depths
64  double ampl1_c = 0.;
65  double ampl2_c = 0.;
66  double ampl3_c = 0.;
67  double ampl4_c = 0.;
68  double ampl_c = 0.;
69 
70  // is set to 1 if "seed" SimHit is found
71  int seedSimHit = 0;
72 
73  // std::cout << " HcalDigiTester::reco : "
74  // << "subdet=" << subdet << " noise="<< noise_ << std::endl;
75 
76  int ieta_Sim = 9999;
77  int iphi_Sim = 9999;
78  double emax_Sim = -9999.;
79 
80 
81  // SimHits MC only
82  if( mc_ == "yes") {
84  iEvent.getByToken(tok_mc_,hcalHits);
85  const edm::PCaloHitContainer * simhitResult = hcalHits.product () ;
86 
87 
88  if ( subdet != 0 && noise_ == 0) { // signal only SimHits
89 
90  for (std::vector<PCaloHit>::const_iterator simhits = simhitResult->begin (); simhits != simhitResult->end () ; ++simhits) {
91 
92  HcalDetId cell(simhits->id());
93  double en = simhits->energy();
94  int sub = cell.subdet();
95  int ieta = cell.ieta();
96  if(ieta > 0) ieta--;
97  int iphi = cell.iphi()-1;
98 
99 
100  if(en > emax_Sim && sub == subdet) {
101  emax_Sim = en;
102  ieta_Sim = ieta;
103  iphi_Sim = iphi;
104  // to limit "seed" SimHit energy in case of "multi" event
105  if (mode_ == "multi" &&
106  ((sub == 4 && en < 100. && en > 1.)
107  || ((sub !=4) && en < 1. && en > 0.02)))
108  {
109  seedSimHit = 1;
110  break;
111  }
112  }
113 
114  } // end of SimHits cycle
115 
116 
117  // found highest-energy SimHit for single-particle
118  if(mode_ != "multi" && emax_Sim > 0.) seedSimHit = 1;
119  } // end of SimHits
120 
121  } // end of mc_ == "yes"
122 
123  // CYCLE OVER CELLS ========================================================
124  int Ndig = 0;
125 
126  /*
127  std::cout << " HcalDigiTester::reco : nevent 1,2,3,4 = "
128  << nevent1 << " " << nevent2 << " " << nevent3 << " "
129  << nevent4 << std::endl;
130  */
131 
132  for (digiItr=digiCollection->begin();digiItr!=digiCollection->end();digiItr++) {
133 
134  HcalDetId cell(digiItr->id());
135  int depth = cell.depth();
136  int iphi = cell.iphi()-1;
137  int ieta = cell.ieta();
138  if(ieta > 0) ieta--;
139  int sub = cell.subdet();
140 
141 
142  // amplitude for signal cell at diff. depths
143  double ampl = 0.;
144  double ampl1 = 0.;
145  double ampl2 = 0.;
146  double ampl3 = 0.;
147  double ampl4 = 0.;
148 
149  // Gains, pedestals (once !) and only for "noise" case
150  if ( ((nevent1 == 1 && subdet == 1) ||
151  (nevent2 == 1 && subdet == 2) ||
152  (nevent3 == 1 && subdet == 3) ||
153  (nevent4 == 1 && subdet == 4)) && noise_ == 1 && sub == subdet) {
154 
155  HcalGenericDetId hcalGenDetId(digiItr->id());
156  const HcalPedestal* pedestal = conditions->getPedestal(hcalGenDetId);
157  const HcalGain* gain = conditions->getGain(hcalGenDetId);
158  const HcalGainWidth* gainWidth =
159  conditions->getGainWidth(hcalGenDetId);
160  const HcalPedestalWidth* pedWidth =
161  conditions-> getPedestalWidth(hcalGenDetId);
162 
163  double gainValue0 = gain->getValue(0);
164  double gainValue1 = gain->getValue(1);
165  double gainValue2 = gain->getValue(2);
166  double gainValue3 = gain->getValue(3);
167 
168  double gainWidthValue0 = gainWidth->getValue(0);
169  double gainWidthValue1 = gainWidth->getValue(1);
170  double gainWidthValue2 = gainWidth->getValue(2);
171  double gainWidthValue3 = gainWidth->getValue(3);
172 
173 
174 
175  // some printout
176  /*
177  std::cout << " subdet = " << sub << " ieta, iphi, depth : "
178  << ieta << " " << iphi << " " << depth
179  << " gain0 " << gainValue0 << " gainWidth0 "
180  << gainWidthValue0
181  << std::endl;
182  */
183 
184  double pedValue0 = pedestal->getValue(0);
185  double pedValue1 = pedestal->getValue(1);
186  double pedValue2 = pedestal->getValue(2);
187  double pedValue3 = pedestal->getValue(3);
188 
189  double pedWidth0 = pedWidth->getWidth(0);
190  double pedWidth1 = pedWidth->getWidth(1);
191  double pedWidth2 = pedWidth->getWidth(2);
192  double pedWidth3 = pedWidth->getWidth(3);
193 
194  if (depth == 1) {
195 
196  // std::cout << " depth = " << depth << std::endl;
197 
198  monitor()->fillmeGain0Depth1(gainValue0);
199  monitor()->fillmeGain1Depth1(gainValue1);
200  monitor()->fillmeGain2Depth1(gainValue2);
201  monitor()->fillmeGain3Depth1(gainValue3);
202 
203  monitor()->fillmeGainWidth0Depth1(gainWidthValue0);
204  monitor()->fillmeGainWidth1Depth1(gainWidthValue1);
205  monitor()->fillmeGainWidth2Depth1(gainWidthValue2);
206  monitor()->fillmeGainWidth3Depth1(gainWidthValue3);
207 
208  monitor()->fillmePed0Depth1(pedValue0);
209  monitor()->fillmePed1Depth1(pedValue1);
210  monitor()->fillmePed2Depth1(pedValue2);
211  monitor()->fillmePed3Depth1(pedValue3);
212 
213  monitor()->fillmePedWidth0Depth1(pedWidth0);
214  monitor()->fillmePedWidth1Depth1(pedWidth1);
215  monitor()->fillmePedWidth2Depth1(pedWidth2);
216  monitor()->fillmePedWidth3Depth1(pedWidth3);
217 
218  monitor()->fillmeGainMap1 (double(ieta), double(iphi), gainValue0);
219  monitor()->fillmePwidthMap1(double(ieta), double(iphi), pedWidth0) ;
220  }
221 
222  if (depth == 2) {
223 
224  // std::cout << " depth = " << depth << std::endl;
225 
226  monitor()->fillmeGain0Depth2(gainValue0);
227  monitor()->fillmeGain1Depth2(gainValue1);
228  monitor()->fillmeGain2Depth2(gainValue2);
229  monitor()->fillmeGain3Depth2(gainValue3);
230 
231  monitor()->fillmeGainWidth0Depth2(gainWidthValue0);
232  monitor()->fillmeGainWidth1Depth2(gainWidthValue1);
233  monitor()->fillmeGainWidth2Depth2(gainWidthValue2);
234  monitor()->fillmeGainWidth3Depth2(gainWidthValue3);
235 
236  monitor()->fillmePed0Depth2(pedValue0);
237  monitor()->fillmePed1Depth2(pedValue1);
238  monitor()->fillmePed2Depth2(pedValue2);
239  monitor()->fillmePed3Depth2(pedValue3);
240 
241  monitor()->fillmePedWidth0Depth2(pedWidth0);
242  monitor()->fillmePedWidth1Depth2(pedWidth1);
243  monitor()->fillmePedWidth2Depth2(pedWidth2);
244  monitor()->fillmePedWidth3Depth2(pedWidth3);
245 
246  monitor()->fillmeGainMap2 (double(ieta), double(iphi), gainValue0);
247  monitor()->fillmePwidthMap2(double(ieta), double(iphi), pedWidth0) ;
248  }
249 
250  if (depth == 3) {
251 
252  // std::cout << " depth = " << depth << std::endl;
253 
254  monitor()->fillmeGain0Depth3(gainValue0);
255  monitor()->fillmeGain1Depth3(gainValue1);
256  monitor()->fillmeGain2Depth3(gainValue2);
257  monitor()->fillmeGain3Depth3(gainValue3);
258 
259  monitor()->fillmeGainWidth0Depth3(gainWidthValue0);
260  monitor()->fillmeGainWidth1Depth3(gainWidthValue1);
261  monitor()->fillmeGainWidth2Depth3(gainWidthValue2);
262  monitor()->fillmeGainWidth3Depth3(gainWidthValue3);
263 
264  monitor()->fillmePed0Depth3(pedValue0);
265  monitor()->fillmePed1Depth3(pedValue1);
266  monitor()->fillmePed2Depth3(pedValue2);
267  monitor()->fillmePed3Depth3(pedValue3);
268 
269  monitor()->fillmePedWidth0Depth3(pedWidth0);
270  monitor()->fillmePedWidth1Depth3(pedWidth1);
271  monitor()->fillmePedWidth2Depth3(pedWidth2);
272  monitor()->fillmePedWidth3Depth3(pedWidth3);
273 
274  monitor()->fillmeGainMap3 (double(ieta), double(iphi), gainValue0);
275  monitor()->fillmePwidthMap3(double(ieta), double(iphi), pedWidth0) ;
276  }
277 
278  if (depth == 4) {
279 
280  // std::cout << " depth = " << depth << std::endl;
281 
282  monitor()->fillmeGain0Depth4(gainValue0);
283  monitor()->fillmeGain1Depth4(gainValue1);
284  monitor()->fillmeGain2Depth4(gainValue2);
285  monitor()->fillmeGain3Depth4(gainValue3);
286 
287  monitor()->fillmeGainWidth0Depth4(gainWidthValue0);
288  monitor()->fillmeGainWidth1Depth4(gainWidthValue1);
289  monitor()->fillmeGainWidth2Depth4(gainWidthValue2);
290  monitor()->fillmeGainWidth3Depth4(gainWidthValue3);
291 
292  monitor()->fillmePed0Depth4(pedValue0);
293  monitor()->fillmePed1Depth4(pedValue1);
294  monitor()->fillmePed2Depth4(pedValue2);
295  monitor()->fillmePed3Depth4(pedValue3);
296 
297  monitor()->fillmePedWidth0Depth4(pedWidth0);
298  monitor()->fillmePedWidth1Depth4(pedWidth1);
299  monitor()->fillmePedWidth2Depth4(pedWidth2);
300  monitor()->fillmePedWidth3Depth4(pedWidth3);
301 
302  monitor()->fillmeGainMap4 (double(ieta), double(iphi), gainValue0);
303  monitor()->fillmePwidthMap4(double(ieta), double(iphi), pedWidth0) ;
304 
305  }
306 
307  } // end of event #1
308  //std::cout << "==== End of event noise block in cell cycle" << std::endl;
309 
310 
311 
312  if ( sub == subdet) Ndig++; // subdet number of digi
313 
314 // No-noise case, only single subdet selected ===========================
315 
316  if ( sub == subdet && noise_ == 0 ) {
317 
318 
319  HcalCalibrations calibrations = conditions->getHcalCalibrations(cell);
320 
321  const HcalQIECoder* channelCoder = conditions->getHcalCoder(cell);
322  const HcalQIEShape* shape = conditions->getHcalShape(channelCoder);
323  HcalCoderDb coder (*channelCoder, *shape);
324  coder.adc2fC(*digiItr,tool);
325 
326  double noiseADC = (*digiItr)[0].adc();
327  double noisefC = tool[0];
328 
329  // noise evaluations from "pre-samples"
330  if(depth == 1) {
331  monitor()->fillmeADC0_depth1 (noiseADC);
332  monitor()->fillmeADC0fC_depth1(noisefC);
333  }
334  if(depth == 2) {
335  monitor()->fillmeADC0_depth2 (noiseADC);
336  monitor()->fillmeADC0fC_depth2(noisefC);
337  }
338  if(depth == 3) {
339  monitor()->fillmeADC0_depth3 (noiseADC);
340  monitor()->fillmeADC0fC_depth3(noisefC);
341  }
342  if(depth == 4) {
343  monitor()->fillmeADC0_depth4 (noiseADC);
344  monitor()->fillmeADC0fC_depth4(noisefC);
345  }
346 
347  // OCCUPANCY maps filling
348  double deta = double(ieta);
349  double dphi = double(iphi);
350  if(depth == 1)
351  monitor()->fillmeOccupancy_map_depth1(deta, dphi);
352  if(depth == 2)
353  monitor()->fillmeOccupancy_map_depth2(deta, dphi);
354  if(depth == 3)
355  monitor()->fillmeOccupancy_map_depth3(deta, dphi);
356  if(depth == 4)
357  monitor()->fillmeOccupancy_map_depth4(deta, dphi);
358 
359  // Cycle on time slices
360  // - for each Digi
361  // - for one Digi with max SimHits E in subdet
362 
363  int closen = 0; // =1 if 1) seedSimHit = 1 and 2) the cell is the same
364  if(ieta == ieta_Sim && iphi == iphi_Sim ) closen = seedSimHit;
365 
366  for (int ii=0;ii<tool.size();ii++) {
367  int capid = (*digiItr)[ii].capid();
368  // single ts amplitude
369  double val = (tool[ii]-calibrations.pedestal(capid));
370 
371  if (val > 10.) {
372  if (depth == 1)
373  monitor()->fillmeAll10slices_depth1(double(ii), val);
374  else
375  monitor()->fillmeAll10slices_depth2(double(ii), val);
376  }
377  if (val > 100.) {
378  if (depth == 1)
379  monitor()->fillmeAll10slices1D_depth1(double(ii), val);
380  else
381  monitor()->fillmeAll10slices1D_depth2(double(ii), val);
382  }
383 
384  if( closen == 1 &&( ieta * zsign >= 0 )) {
385  monitor()->fillmeSignalTimeSlice(double(ii), val);
386  }
387 
388 
389  // HB/HE/HO
390  if (subdet != 4 && ii>=4 && ii<=7) {
391  ampl += val;
392  if(depth == 1) ampl1 += val;
393  if(depth == 2) ampl2 += val;
394  if(depth == 3) ampl3 += val;
395  if(depth == 4) ampl4 += val;
396 
397  if( closen == 1 && ( ieta * zsign >= 0 )) {
398  ampl_c += val;
399  if(depth == 1) ampl1_c += val;
400  if(depth == 2) ampl2_c += val;
401  if(depth == 3) ampl3_c += val;
402  if(depth == 4) ampl4_c += val;
403 
404  }
405  }
406 
407  // HF
408  if (subdet == 4 && ii==3 ) {
409  ampl += val;
410  if(depth == 1) ampl1 += val;
411  if(depth == 2) ampl2 += val;
412  if(depth == 3) ampl3 += val;
413  if(depth == 4) ampl4 += val;
414  if( closen == 1 && ( ieta * zsign >= 0 )) {
415  ampl_c += val;
416  if(depth == 1) ampl1_c += val;
417  if(depth == 2) ampl2_c += val;
418  if(depth == 3) ampl3_c += val;
419  if(depth == 4) ampl4_c += val;
420 
421  }
422  }
423  }
424  // end of time bucket sample
425 
426  monitor()->fillmeAmplIetaIphi1(double(ieta),double(iphi), ampl1);
427  monitor()->fillmeAmplIetaIphi2(double(ieta),double(iphi), ampl2);
428  monitor()->fillmeAmplIetaIphi3(double(ieta),double(iphi), ampl3);
429  monitor()->fillmeAmplIetaIphi4(double(ieta),double(iphi), ampl4);
430  monitor()->fillmeSumAmp (ampl);
431 
432 
433  if(ampl1 > 10. || ampl2 > 10. || ampl3 > 10. || ampl4 > 10. ) ndigis++;
434 
435  // fraction 5,6 bins if ampl. is big.
436  if(ampl1 > 30. && depth == 1 && closen == 1 ) {
437  double fBin5 = tool[4] - calibrations.pedestal((*digiItr)[4].capid());
438  double fBin67 = tool[5] + tool[6]
439  - calibrations.pedestal((*digiItr)[5].capid())
440  - calibrations.pedestal((*digiItr)[6].capid());
441  fBin5 /= ampl1;
442  fBin67 /= ampl1;
443  monitor()->fillmeBin5Frac (fBin5);
444  monitor()->fillmeBin67Frac(fBin67);
445  }
446 
447  monitor()->fillmeSignalAmp (ampl);
448  monitor()->fillmeSignalAmp1(ampl1);
449  monitor()->fillmeSignalAmp2(ampl2);
450  monitor()->fillmeSignalAmp3(ampl3);
451  monitor()->fillmeSignalAmp4(ampl4);
452 
453 
454  }
455  } // End of CYCLE OVER CELLS =============================================
456 
457 
458  if ( subdet != 0 && noise_ == 0) { // signal only, once per event
459 
460  monitor()->fillmenDigis(ndigis);
461 
462  // SimHits once again !!!
463  double eps = 1.e-3;
464  double ehits = 0.;
465  double ehits1 = 0.;
466  double ehits2 = 0.;
467  double ehits3 = 0.;
468  double ehits4 = 0.;
469 
470  if(mc_ == "yes") {
472  iEvent.getByToken(tok_mc_,hcalHits);
473  const edm::PCaloHitContainer * simhitResult = hcalHits.product () ;
474  for (std::vector<PCaloHit>::const_iterator simhits = simhitResult->begin (); simhits != simhitResult->end () ; ++simhits) {
475 
476  HcalDetId cell(simhits->id());
477  int ieta = cell.ieta();
478  if(ieta > 0) ieta--;
479  int iphi = cell.iphi()-1;
480  int sub = cell.subdet();
481 
482  // take cell already found to be max energy in a particular subdet
483  if (sub == subdet && ieta == ieta_Sim && iphi == iphi_Sim){
484  int depth = cell.depth();
485  double en = simhits->energy();
486 
487  ehits += en;
488  if(depth == 1) ehits1 += en;
489  if(depth == 2) ehits2 += en;
490  if(depth == 3) ehits3 += en;
491  if(depth == 4) ehits4 += en;
492  }
493  }
494 
495  if(ehits > eps) monitor()->fillmeDigiSimhit (ehits, ampl_c );
496  if(ehits1 > eps) monitor()->fillmeDigiSimhit1(ehits1, ampl1_c);
497  if(ehits2 > eps) monitor()->fillmeDigiSimhit2(ehits2, ampl2_c);
498  if(ehits3 > eps) monitor()->fillmeDigiSimhit3(ehits3, ampl3_c);
499  if(ehits4 > eps) monitor()->fillmeDigiSimhit4(ehits4, ampl4_c);
500 
501  if(ehits > eps) monitor()->fillmeDigiSimhitProfile (ehits, ampl_c );
502  if(ehits1 > eps) monitor()->fillmeDigiSimhitProfile1(ehits1, ampl1_c);
503  if(ehits2 > eps) monitor()->fillmeDigiSimhitProfile2(ehits2, ampl2_c);
504  if(ehits3 > eps) monitor()->fillmeDigiSimhitProfile3(ehits3, ampl3_c);
505  if(ehits4 > eps) monitor()->fillmeDigiSimhitProfile4(ehits4, ampl4_c);
506 
507  if(ehits > eps) monitor()->fillmeRatioDigiSimhit (ampl_c / ehits);
508  if(ehits1 > eps) monitor()->fillmeRatioDigiSimhit1(ampl1_c / ehits1);
509  if(ehits2 > eps) monitor()->fillmeRatioDigiSimhit2(ampl2_c / ehits2);
510  if(ehits3 > eps) monitor()->fillmeRatioDigiSimhit3(ampl3_c / ehits3);
511  if(ehits4 > eps) monitor()->fillmeRatioDigiSimhit4(ampl4_c / ehits4);
512  } // end of if(mc_ == "yes")
513 
514  monitor()->fillmeNdigis(double(Ndig));
515 
516  } // end of if( subdet != 0 && noise_ == 0) // signal only
517 
518 } // end reco method
519 
520 
522  inputTag_(iConfig.getParameter<edm::InputTag>("digiLabel")),
523  outputFile_(iConfig.getUntrackedParameter<std::string>("outputFile", "")),
524  hcalselector_(iConfig.getUntrackedParameter<std::string>("hcalselector", "all")),
525  zside_(iConfig.getUntrackedParameter<std::string>("zside", "*")),
526  mode_(iConfig.getUntrackedParameter<std::string>("mode", "multi")),
527  mc_(iConfig.getUntrackedParameter<std::string>("mc", "no")),
528  monitors_()
529 {
530 
531  // register for data access
532  tok_mc_ = consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits","HcalHits"));
533  tok_hbhe_ = consumes<edm::SortedCollection<HBHEDataFrame> >(edm::InputTag(inputTag_));
534  tok_ho_ = consumes<edm::SortedCollection<HODataFrame> >(edm::InputTag(inputTag_));
535  tok_hf_ = consumes<edm::SortedCollection<HFDataFrame> >(edm::InputTag(inputTag_));
536 
537  nevent1 = 0;
538  nevent2 = 0;
539  nevent3 = 0;
540  nevent4 = 0;
541 
542  nevtot = 0;
543 
544  if ( outputFile_.size() != 0 ) {
545  edm::LogInfo("OutputInfo") << " Hcal Digi Task histograms will be saved to '" << outputFile_.c_str() << "'";
546  } else {
547  edm::LogInfo("OutputInfo") << " Hcal Digi Task histograms will NOT be saved";
548  }
549 
550 
551 }
552 
553 
555 {
556  std::map<std::string, HcalSubdetDigiMonitor*>::iterator itr = monitors_.begin();
557  std::map<std::string, HcalSubdetDigiMonitor*>::iterator itrEnd = monitors_.end();
558 
559  while ( itr != itrEnd ) {
560  delete (*itr).second;
561  itr++;
562  }
563 
564 
565 }
566 
568 {
569 
570  // This is the only opportunity to call the constructors for HcalSubdetDigiMonitor
571  //
572  if( hcalselector_ != "all") {
573  noise_ = 0;
574  if (hcalselector_ == "noise") {
575  noise_ = 1;
576 
577  hcalselector_ = "HB";
578  constructMonitor(ibooker);
579  hcalselector_ = "HE";
580  constructMonitor(ibooker);
581  hcalselector_ = "HO";
582  constructMonitor(ibooker);
583  hcalselector_ = "HF";
584  constructMonitor(ibooker);
585  hcalselector_ = "noise";
586  } else {
587  noise_ = 0;
588  constructMonitor(ibooker);
589  }
590  }
591  // all subdetectors
592  else {
593  noise_ = 0;
594 
595  hcalselector_ = "HB";
596  constructMonitor(ibooker);
597  hcalselector_ = "HE";
598  constructMonitor(ibooker);
599  hcalselector_ = "HO";
600  constructMonitor(ibooker);
601  hcalselector_ = "HF";
602  constructMonitor(ibooker);
603  hcalselector_ = "all";
604  }
605 
606 }
607 
608 
610 
611  if(noise_ != 1) {
612 
613  if( hcalselector_ == "all") {
614  hcalselector_ = "HB";
615  eval_occupancy();
616  hcalselector_ = "HE";
617  eval_occupancy();
618  hcalselector_ = "HO";
619  eval_occupancy();
620  hcalselector_ = "HF";
621  eval_occupancy();
622  }
623  else // one of subsystem only
624  eval_occupancy();
625  }
626 
627 }
628 
629 
630 
631 
632  //occupancies evaluation
634 
635  int nx = 82;
636  int ny = 72;
637  float cnorm;
638  float fev = float (nevtot);
639  // std::cout << "*** nevtot " << nevtot << std::endl;
640 
641  float sumphi_1, sumphi_2, sumphi_3, sumphi_4;
642  float phi_factor;
643 
644  for (int i = 1; i <= nx; i++) {
645  sumphi_1 = 0.;
646  sumphi_2 = 0.;
647  sumphi_3 = 0.;
648  sumphi_4 = 0.;
649 
650  for (int j = 1; j <= ny; j++) {
651 
652  // occupancies
653  cnorm = monitor()->getBinContent_depth1(i,j) / fev;
654  monitor()->setBinContent_depth1(i,j,cnorm);
655  cnorm = monitor()->getBinContent_depth2(i,j) / fev;
656  monitor()->setBinContent_depth2(i,j,cnorm);
657  cnorm = monitor()->getBinContent_depth3(i,j) / fev;
658  monitor()->setBinContent_depth3(i,j,cnorm);
659  cnorm = monitor()->getBinContent_depth4(i,j) / fev;
660  monitor()->setBinContent_depth4(i,j,cnorm);
661 
662  sumphi_1 += monitor()->getBinContent_depth1(i,j);
663  sumphi_2 += monitor()->getBinContent_depth2(i,j);
664  sumphi_3 += monitor()->getBinContent_depth3(i,j);
665  sumphi_4 += monitor()->getBinContent_depth4(i,j);
666 
667  }
668 
669  int ieta = i - 42; // -41 -1, 0 40
670  if(ieta >=0 ) ieta +=1; // -41 -1, 1 41 - to make it detector-like
671 
672  if(ieta >= -20 && ieta <= 20 )
673  {phi_factor = 72.;}
674  else {
675  if(ieta >= 40 || ieta <= -40 ) {phi_factor = 18.;}
676  else
677  phi_factor = 36.;
678  }
679 
680 
681  if(ieta >= 0) ieta -= 1; // -41 -1, 0 40 - to bring back to histo num !!!
682  double deta = double(ieta);
683 
684  cnorm = sumphi_1 / phi_factor;
685  monitor() -> fillmeOccupancy_vs_ieta_depth1(deta, cnorm);
686  cnorm = sumphi_2 / phi_factor;
687  monitor() -> fillmeOccupancy_vs_ieta_depth2(deta, cnorm);
688  cnorm = sumphi_3 / phi_factor;
689  monitor() -> fillmeOccupancy_vs_ieta_depth3(deta, cnorm);
690  cnorm = sumphi_4 / phi_factor;
691  monitor() -> fillmeOccupancy_vs_ieta_depth4(deta, cnorm);
692 
693 
694  } // end of i-loop
695 
696 }
697 
698 
700 {
701  std::map<std::string, HcalSubdetDigiMonitor*>::iterator monitorItr
702  = monitors_.find(hcalselector_);
703 
704  /*if(monitorItr == monitors_.end())
705  {
706  HcalSubdetDigiMonitor* m = new HcalSubdetDigiMonitor(dbe_, hcalselector_, noise_);
707  std::pair<std::string, HcalSubdetDigiMonitor*> mapElement(
708  hcalselector_, m);
709  monitorItr = monitors_.insert(mapElement).first;
710  }*/
711 
712  return monitorItr->second;
713 }
714 
716 {
717 
718  std::map<std::string, HcalSubdetDigiMonitor*>::iterator monitorItr
719  = monitors_.find(hcalselector_);
720 
721  if(monitorItr == monitors_.end())
722  {
724  std::pair<std::string, HcalSubdetDigiMonitor*> mapElement(
725  hcalselector_, m);
726  monitorItr = monitors_.insert(mapElement).first;
727  }
728 
729 }
730 
731 void
733 {
734 
735 
736  iSetup.get<CaloGeometryRecord>().get (geometry);
737  iSetup.get<HcalDbRecord>().get(conditions);
738 
739 
740  // std::cout << " >>>>> HcalDigiTester::analyze hcalselector = "
741  // << hcalselector_ << std::endl;
742 
743  if( hcalselector_ != "all") {
744  noise_ = 0;
745 
746 
747 
748  if (hcalselector_ == "HB" ) reco<HBHEDataFrame>(iEvent,iSetup,tok_hbhe_);
749  if (hcalselector_ == "HE" ) reco<HBHEDataFrame>(iEvent,iSetup,tok_hbhe_);
750  if (hcalselector_ == "HO" ) reco<HODataFrame>(iEvent,iSetup,tok_ho_);
751  if (hcalselector_ == "HF" ) reco<HFDataFrame>(iEvent,iSetup,tok_hf_);
752 
753  if (hcalselector_ == "noise") {
754  noise_ = 1;
755 
756  // std::cout << " >>>>> HcalDigiTester::analyze entering noise "
757  // << std::endl;
758 
759 
760  hcalselector_ = "HB";
761  reco<HBHEDataFrame>(iEvent,iSetup,tok_hbhe_);
762  hcalselector_ = "HE";
763  reco<HBHEDataFrame>(iEvent,iSetup,tok_hbhe_);
764  hcalselector_ = "HO";
765  reco<HODataFrame>(iEvent,iSetup,tok_ho_);
766  hcalselector_ = "HF";
767  reco<HFDataFrame>(iEvent,iSetup,tok_hf_);
768  hcalselector_ = "noise";
769  }
770  }
771  // all subdetectors
772  else {
773  noise_ = 0;
774 
775  hcalselector_ = "HB";
776  reco<HBHEDataFrame>(iEvent,iSetup,tok_hbhe_);
777  hcalselector_ = "HE";
778  reco<HBHEDataFrame>(iEvent,iSetup,tok_hbhe_);
779  hcalselector_ = "HO";
780  reco<HODataFrame>(iEvent,iSetup,tok_ho_);
781  hcalselector_ = "HF";
782  reco<HFDataFrame>(iEvent,iSetup,tok_hf_);
783  hcalselector_ = "all";
784  }
785 
786  nevtot++;
787 
788 }
789 
790 double HcalDigiTester::dR(double eta1, double phi1, double eta2, double phi2) {
791  double PI = 3.1415926535898;
792  double deltaphi= phi1 - phi2;
793  if( phi2 > phi1 ) { deltaphi= phi2 - phi1;}
794  if(deltaphi > PI) { deltaphi = 2.*PI - deltaphi;}
795  double deltaeta = eta2 - eta1;
796  double tmp = sqrt(deltaeta* deltaeta + deltaphi*deltaphi);
797  return tmp;
798 }
799 
800 
void fillmePed0Depth1(double v1)
void fillmeGain0Depth4(double v1)
void fillmeGainWidth0Depth2(double v1)
const HcalGainWidth * getGainWidth(const HcalGenericDetId &fId) const
void setBinContent_depth2(int i, int j, double v)
void fillmePedWidth2Depth1(double v1)
void fillmeGain2Depth2(double v1)
void fillmeGain1Depth1(double v1)
void fillmePedWidth1Depth3(double v1)
void fillmeGainWidth2Depth1(double v1)
virtual void analyze(const edm::Event &, const edm::EventSetup &)
void fillmeAmplIetaIphi4(double v1, double v2, double v3)
void fillmeADC0_depth1(double v1)
void fillmeDigiSimhitProfile3(double v1, double v2)
std::vector< PCaloHit > PCaloHitContainer
edm::EDGetTokenT< edm::SortedCollection< HODataFrame > > tok_ho_
void fillmeGainWidth0Depth4(double v1)
HcalSubdetDigiMonitor * monitor()
void fillmePed2Depth4(double v1)
void fillmePedWidth1Depth1(double v1)
void fillmeGainWidth2Depth4(double v1)
edm::EDGetTokenT< edm::SortedCollection< HBHEDataFrame > > tok_hbhe_
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:49
void fillmeGainMap2(double v1, double v2, double v3)
void fillmePwidthMap3(double v1, double v2, double v3)
void fillmeDigiSimhit4(double v1, double v2)
void fillmePed1Depth4(double v1)
std::string hcalselector_
void fillmeOccupancy_map_depth2(double v1, double v2)
void fillmeGainWidth3Depth4(double v1)
void fillmeGain2Depth4(double v1)
void fillmeDigiSimhit3(double v1, double v2)
double getBinContent_depth4(int i, int j)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
void reco(const edm::Event &, const edm::EventSetup &, const edm::EDGetTokenT< edm::SortedCollection< Digi > > &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void fillmeADC0fC_depth2(double v1)
void fillmeGainWidth1Depth1(double v1)
void fillmeRatioDigiSimhit4(double v1)
edm::EDGetTokenT< edm::PCaloHitContainer > tok_mc_
void constructMonitor(DQMStore::IBooker &)
void fillmeDigiSimhit2(double v1, double v2)
void fillmeRatioDigiSimhit(double v1)
void fillmePedWidth1Depth4(double v1)
std::vector< T >::const_iterator const_iterator
void fillmeGainWidth1Depth4(double v1)
void setBinContent_depth3(int i, int j, double v)
void fillmeAll10slices1D_depth1(double v1, double v2)
void fillmeGain3Depth2(double v1)
std::string mode_
void fillmePed1Depth2(double v1)
void fillmeAll10slices_depth2(double v1, double v2)
double pedestal(int fCapId) const
get pedestal for capid=0..3
void fillmeRatioDigiSimhit2(double v1)
std::string mc_
void fillmeAmplIetaIphi2(double v1, double v2, double v3)
void fillmePwidthMap1(double v1, double v2, double v3)
HcalDigiTester(const edm::ParameterSet &)
std::map< std::string, HcalSubdetDigiMonitor * > monitors_
float getValue(int fCapId) const
get value for capId = 0..3
Definition: HcalGain.h:22
void fillmeGainWidth1Depth2(double v1)
double getBinContent_depth2(int i, int j)
void fillmeGainWidth2Depth2(double v1)
edm::ESHandle< HcalDbService > conditions
float getValue(int fCapId) const
get value for capId = 0..3
Definition: HcalGainWidth.h:21
double dR(double eta1, double phi1, double eta2, double phi2)
void fillmeGainWidth3Depth2(double v1)
void fillmeSignalAmp4(double v1)
void fillmeAll10slices1D_depth2(double v1, double v2)
void fillmeDigiSimhitProfile2(double v1, double v2)
void fillmePed0Depth4(double v1)
virtual void endRun()
void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const override
Definition: HcalCoderDb.cc:68
void fillmeGain3Depth3(double v1)
void fillmePed0Depth3(double v1)
void fillmeGainMap4(double v1, double v2, double v3)
int iEvent
Definition: GenABIO.cc:230
void fillmePed3Depth3(double v1)
void fillmeDigiSimhit(double v1, double v2)
void fillmeRatioDigiSimhit1(double v1)
void fillmeOccupancy_map_depth1(double v1, double v2)
void fillmeGain1Depth2(double v1)
void fillmeGain1Depth3(double v1)
void fillmeGainWidth0Depth1(double v1)
void fillmeGainWidth2Depth3(double v1)
void fillmeSignalAmp1(double v1)
edm::InputTag inputTag_
void fillmeGain3Depth4(double v1)
double getBinContent_depth1(int i, int j)
void fillmeADC0_depth2(double v1)
T sqrt(T t)
Definition: SSEVec.h:18
void fillmeGain3Depth1(double v1)
void fillmeDigiSimhitProfile4(double v1, double v2)
void fillmeAmplIetaIphi3(double v1, double v2, double v3)
int ieta() const
get the cell ieta
Definition: HcalDetId.h:56
void fillmeADC0_depth4(double v1)
void fillmePedWidth2Depth2(double v1)
void fillmeGainMap1(double v1, double v2, double v3)
void fillmeGainWidth0Depth3(double v1)
void fillmePedWidth2Depth4(double v1)
void fillmePedWidth1Depth2(double v1)
edm::EDGetTokenT< edm::SortedCollection< HFDataFrame > > tok_hf_
void fillmePedWidth2Depth3(double v1)
void fillmeSignalTimeSlice(double v1, double v2)
void fillmePedWidth0Depth1(double v1)
#define PI
Definition: QcdUeDQM.h:36
ii
Definition: cuy.py:588
void fillmePedWidth3Depth2(double v1)
void setBinContent_depth4(int i, int j, double v)
void fillmePedWidth3Depth4(double v1)
void fillmeADC0fC_depth4(double v1)
void setBinContent_depth1(int i, int j, double v)
void fillmeSignalAmp(double v1)
std::string zside_
T const * product() const
Definition: Handle.h:81
void fillmeGainMap3(double v1, double v2, double v3)
void fillmePedWidth3Depth1(double v1)
int size() const
get the size
Definition: CaloSamples.h:24
void fillmeDigiSimhitProfile(double v1, double v2)
double getBinContent_depth3(int i, int j)
const T & get() const
Definition: EventSetup.h:55
void fillmePed3Depth2(double v1)
const HcalGain * getGain(const HcalGenericDetId &fId) const
void fillmeGain2Depth1(double v1)
float getWidth(int fCapId) const
get width (sqrt(sigma_i_i)) for capId = 0..3
const HcalQIECoder * getHcalCoder(const HcalGenericDetId &fId) const
void fillmeOccupancy_map_depth4(double v1, double v2)
void fillmePed2Depth2(double v1)
void fillmePed3Depth4(double v1)
const HcalQIEShape * getHcalShape(const HcalGenericDetId &fId) const
void fillmePedWidth0Depth4(double v1)
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
void fillmeSignalAmp3(double v1)
void fillmePed0Depth2(double v1)
void fillmePwidthMap4(double v1, double v2, double v3)
HLT enums.
void fillmeDigiSimhit1(double v1, double v2)
void fillmeADC0fC_depth1(double v1)
void fillmeGain0Depth2(double v1)
void fillmeADC0_depth3(double v1)
void fillmePed2Depth3(double v1)
void fillmeGainWidth3Depth1(double v1)
void fillmePed2Depth1(double v1)
void fillmeRatioDigiSimhit3(double v1)
void fillmeGain2Depth3(double v1)
void fillmePedWidth3Depth3(double v1)
void fillmeGain0Depth1(double v1)
void fillmeDigiSimhitProfile1(double v1, double v2)
void fillmeOccupancy_map_depth3(double v1, double v2)
void fillmePed1Depth1(double v1)
const HcalCalibrations & getHcalCalibrations(const HcalGenericDetId &fId) const
void fillmePedWidth0Depth2(double v1)
void fillmeSignalAmp2(double v1)
void fillmeGainWidth1Depth3(double v1)
const HcalPedestal * getPedestal(const HcalGenericDetId &fId) const
void fillmePwidthMap2(double v1, double v2, double v3)
void fillmePedWidth0Depth3(double v1)
void fillmeAll10slices_depth1(double v1, double v2)
std::string outputFile_
void fillmeADC0fC_depth3(double v1)
void fillmeGain1Depth4(double v1)
void fillmeAmplIetaIphi1(double v1, double v2, double v3)
Definition: Run.h:43
void fillmePed3Depth1(double v1)
void fillmePed1Depth3(double v1)
void fillmeGain0Depth3(double v1)
void fillmeGainWidth3Depth3(double v1)