CMS 3D CMS Logo

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