CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalDigisValidation.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: HcalDigisValidation
4 // Class: HcalDigisValidation
5 //
13 //
14 // Original Author: Ali Fahim,22 R-013,+41227672649,
15 // Created: Wed Mar 23 11:42:34 CET 2011
16 //
17 //
18 
21 
23 
24  using namespace std;
25 
26  subdet_ = iConfig.getUntrackedParameter<std::string > ("subdetector", "all");
27  outputFile_ = iConfig.getUntrackedParameter<std::string > ("outputFile", "");
28  inputTag_ = iConfig.getParameter<edm::InputTag > ("digiLabel");
29  mc_ = iConfig.getUntrackedParameter<std::string > ("mc", "no");
30  mode_ = iConfig.getUntrackedParameter<std::string > ("mode", "multi");
31  dirName_ = iConfig.getUntrackedParameter<std::string > ("dirName", "HcalDigisV/HcalDigiTask");
32 
33  // register for data access
34  tok_mc_ = consumes<edm::PCaloHitContainer>(edm::InputTag("g4SimHits", "HcalHits"));
35  tok_hbhe_ = consumes<edm::SortedCollection<HBHEDataFrame> >(inputTag_);
36  tok_ho_ = consumes<edm::SortedCollection<HODataFrame> >(inputTag_);
37  tok_hf_ = consumes<edm::SortedCollection<HFDataFrame> >(inputTag_);
38  tok_emulTPs_ = consumes<HcalTrigPrimDigiCollection>(edm::InputTag("emulDigis"));
39  tok_dataTPs_ = consumes<HcalTrigPrimDigiCollection>(edm::InputTag("simHcalTriggerPrimitiveDigis"));
40 
41  nevent1 = 0;
42  nevent2 = 0;
43  nevent3 = 0;
44  nevent4 = 0;
45  nevtot = 0;
46 
47  msm_ = new std::map<std::string, MonitorElement*>();
48 
49  if (outputFile_.size() != 0) edm::LogInfo("OutputInfo") << " Hcal Digi Task histograms will be saved to '" << outputFile_.c_str() << "'";
50  else edm::LogInfo("OutputInfo") << " Hcal Digi Task histograms will NOT be saved";
51 
52 }
53 
54 
56  delete msm_;
57 }
58 
59 
61 {
62 
64 
65  // book
66  book1D(ib,"nevtot", 1, 0, 1);
67  int bnoise = 0;
68  int bmc = 0;
69  if (subdet_ == "noise") bnoise = 1;
70  if (mc_ == "yes") bmc = 1;
71  if (subdet_ == "noise" || subdet_ == "all") {
72  booking(ib,"HB", bnoise, bmc);
73  booking(ib,"HO", bnoise, bmc);
74  booking(ib,"HF", bnoise, bmc);
75  booking(ib,"HE", bnoise, bmc);
76  } else {
77  booking(ib,subdet_, 0, bmc);
78  }
79 
80 
81  HistLim tp_hl_et(260, -10, 250);
82  HistLim tp_hl_ntp(640, -20, 3180);
83  HistLim tp_hl_ntp_sub(404, -20, 2000);
84  HistLim tp_hl_ieta(85, -42.5, 42.5);
85 
86 
87  book1D(ib,"HcalDigiTask_tp_et", tp_hl_et);
88  book1D(ib,"HcalDigiTask_tp_et_HB", tp_hl_et);
89  book1D(ib,"HcalDigiTask_tp_et_HE", tp_hl_et);
90  book1D(ib,"HcalDigiTask_tp_et_HF", tp_hl_et);
91  book1D(ib,"HcalDigiTask_tp_ntp", tp_hl_ntp);
92  book1D(ib,"HcalDigiTask_tp_ntp_HB", tp_hl_ntp_sub);
93  book1D(ib,"HcalDigiTask_tp_ntp_HE", tp_hl_ntp_sub);
94  book1D(ib,"HcalDigiTask_tp_ntp_HF", tp_hl_ntp_sub);
95  book1D(ib,"HcalDigiTask_tp_ntp_ieta", tp_hl_ieta);
96  book1D(ib,"HcalDigiTask_tp_ntp_10_ieta", tp_hl_ieta);
97  book2D(ib,"HcalDigiTask_tp_et_ieta", tp_hl_ieta, tp_hl_et);
98  bookPf(ib,"HcalDigiTask_tp_ave_et_ieta", tp_hl_ieta, tp_hl_et, " ");
99 
100 }
101 
102 void HcalDigisValidation::booking(DQMStore::IBooker &ib, const std::string bsubdet, int bnoise, int bmc) {
103 
104  // Adjust/Optimize binning (JR Dittmann, 16-JUL-2015)
105 
106  HistLim Ndigis(2600, 0., 2600.);
107  HistLim ndigis(520, -20., 1020.);
108  HistLim sime(200, 0., 1.0);
109 
110  HistLim digiAmp(360, -100., 7100.);
111  HistLim ratio(2000, -100., 3900.);
112  HistLim sumAmp(100, -500., 1500.);
113 
114  HistLim nbin(10, 0., 10.);
115 
116  HistLim pedestal(80, -1.0, 15.);
117  HistLim pedestalfC(400, -10., 30.);
118 
119  HistLim frac(80, -0.20, 1.40);
120 
121  HistLim pedLim(80, 0., 8.);
122  HistLim pedWidthLim(100, 0., 2.);
123 
124  HistLim gainLim(120, 0., 0.6);
125  HistLim gainWidthLim(160, 0., 0.32);
126 
127  HistLim ietaLim(85, -42.5, 42.5);
128  HistLim iphiLim(74, -0.5, 73.5);
129 
130  if (bsubdet == "HE") {
131  sime = HistLim(200, 0., 1.0);
132  } else if (bsubdet == "HF") {
133  sime = HistLim(100, 0., 100.);
134  pedLim = HistLim(100, 0., 20.);
135  pedWidthLim = HistLim(100, 0., 5.);
136  frac = HistLim(400, -4.00, 4.00);
137  } else if (bsubdet == "HO") {
138  sime = HistLim(200, 0., 1.0);
139  gainLim = HistLim(160, 0., 1.6);
140  }
141 
142  Char_t histo[100];
143  const char * sub = bsubdet.c_str();
144  if (bnoise == 0) {
145  // number of digis in each subdetector
146  sprintf(histo, "HcalDigiTask_Ndigis_%s", sub);
147  book1D(ib, histo, Ndigis);
148 
149  // maps of occupancies
150  sprintf(histo, "HcalDigiTask_ieta_iphi_occupancy_map_depth1_%s", sub);
151  book2D(ib, histo, ietaLim, iphiLim);
152 
153  sprintf(histo, "HcalDigiTask_ieta_iphi_occupancy_map_depth2_%s", sub);
154  book2D(ib, histo, ietaLim, iphiLim);
155 
156  sprintf(histo, "HcalDigiTask_ieta_iphi_occupancy_map_depth3_%s", sub);
157  book2D(ib, histo, ietaLim, iphiLim);
158 
159  sprintf(histo, "HcalDigiTask_ieta_iphi_occupancy_map_depth4_%s", sub);
160  book2D(ib, histo, ietaLim, iphiLim);
161 
162  // occupancies vs ieta
163  sprintf(histo, "HcalDigiTask_occupancy_vs_ieta_depth1_%s", sub);
164  book1D(ib, histo, ietaLim);
165 
166  sprintf(histo, "HcalDigiTask_occupancy_vs_ieta_depth2_%s", sub);
167  book1D(ib, histo, ietaLim);
168 
169  sprintf(histo, "HcalDigiTask_occupancy_vs_ieta_depth3_%s", sub);
170  book1D(ib, histo, ietaLim);
171 
172  sprintf(histo, "HcalDigiTask_occupancy_vs_ieta_depth4_%s", sub);
173  book1D(ib, histo, ietaLim);
174 
175 
176  // maps of sum of amplitudes (sum lin.digis(4,5,6,7) - ped) all depths
177 /*
178  sprintf(histo, "HcalDigiTask_ieta_iphi_map_of_amplitudes_fC_depth1_%s", sub);
179  book2D(ib, histo, ietaLim, iphiLim);
180  sprintf(histo, "HcalDigiTask_ieta_iphi_map_of_amplitudes_fC_depth2_%s", sub);
181  book2D(ib, histo, ietaLim, iphiLim);
182  sprintf(histo, "HcalDigiTask_ieta_iphi_map_of_amplitudes_fC_depth3_%s", sub);
183  book2D(ib, histo, ietaLim, iphiLim);
184  sprintf(histo, "HcalDigiTask_ieta_iphi_map_of_amplitudes_fC_depth4_%s", sub);
185  book2D(ib, histo, ietaLim, iphiLim);
186 */
187  // just 1D of all cells' amplitudes
188  sprintf(histo, "HcalDigiTask_sum_all_amplitudes_%s", sub);
189  book1D(ib, histo, sumAmp);
190 
191  sprintf(histo, "HcalDigiTask_number_of_amplitudes_above_10fC_%s", sub);
192  book1D(ib, histo, ndigis);
193 
194  sprintf(histo, "HcalDigiTask_ADC0_adc_depth1_%s", sub);
195  book1D(ib, histo, pedestal);
196  sprintf(histo, "HcalDigiTask_ADC0_adc_depth2_%s", sub);
197  book1D(ib, histo, pedestal);
198  sprintf(histo, "HcalDigiTask_ADC0_adc_depth3_%s", sub);
199  book1D(ib, histo, pedestal);
200  sprintf(histo, "HcalDigiTask_ADC0_adc_depth4_%s", sub);
201  book1D(ib, histo, pedestal);
202 
203  sprintf(histo, "HcalDigiTask_ADC0_fC_depth1_%s", sub);
204  book1D(ib, histo, pedestalfC);
205  sprintf(histo, "HcalDigiTask_ADC0_fC_depth2_%s", sub);
206  book1D(ib, histo, pedestalfC);
207  sprintf(histo, "HcalDigiTask_ADC0_fC_depth3_%s", sub);
208  book1D(ib, histo, pedestalfC);
209  sprintf(histo, "HcalDigiTask_ADC0_fC_depth4_%s", sub);
210  book1D(ib, histo, pedestalfC);
211 
212  sprintf(histo, "HcalDigiTask_signal_amplitude_%s", sub);
213  book1D(ib, histo, digiAmp);
214  sprintf(histo, "HcalDigiTask_signal_amplitude_depth1_%s", sub);
215  book1D(ib, histo, digiAmp);
216  sprintf(histo, "HcalDigiTask_signal_amplitude_depth2_%s", sub);
217  book1D(ib, histo, digiAmp);
218  sprintf(histo, "HcalDigiTask_signal_amplitude_depth3_%s", sub);
219  book1D(ib, histo, digiAmp);
220  sprintf(histo, "HcalDigiTask_signal_amplitude_depth4_%s", sub);
221  book1D(ib, histo, digiAmp);
222 
223  sprintf(histo, "HcalDigiTask_signal_amplitude_vs_bin_all_depths_%s", sub);
224  book2D(ib, histo, nbin, digiAmp);
225 
226 /*
227  sprintf(histo, "HcalDigiTask_all_amplitudes_vs_bin_depth1_%s", sub);
228  book2D(ib, histo, nbin, digiAmp);
229  sprintf(histo, "HcalDigiTask_all_amplitudes_vs_bin_depth2_%s", sub);
230  book2D(ib, histo, nbin, digiAmp);
231 */
232  sprintf(histo, "HcalDigiTask_all_amplitudes_vs_bin_1D_depth1_%s", sub);
233  book1D(ib, histo, nbin);
234  sprintf(histo, "HcalDigiTask_all_amplitudes_vs_bin_1D_depth2_%s", sub);
235  book1D(ib, histo, nbin);
236 
237  sprintf(histo, "HcalDigiTask_bin_5_frac_%s", sub);
238  book1D(ib, histo, frac);
239  sprintf(histo, "HcalDigiTask_bin_6_7_frac_%s", sub);
240  book1D(ib, histo, frac);
241 
242  if (bmc == 1) {
243  sprintf(histo, "HcalDigiTask_amplitude_vs_simhits_%s", sub);
244  book2D(ib, histo, sime, digiAmp);
245  sprintf(histo, "HcalDigiTask_amplitude_vs_simhits_depth1_%s", sub);
246  book2D(ib, histo, sime, digiAmp);
247  sprintf(histo, "HcalDigiTask_amplitude_vs_simhits_depth2_%s", sub);
248  book2D(ib, histo, sime, digiAmp);
249  sprintf(histo, "HcalDigiTask_amplitude_vs_simhits_depth3_%s", sub);
250  book2D(ib, histo, sime, digiAmp);
251  sprintf(histo, "HcalDigiTask_amplitude_vs_simhits_depth4_%s", sub);
252  book2D(ib, histo, sime, digiAmp);
253 
254  sprintf(histo, "HcalDigiTask_amplitude_vs_simhits_profile_%s", sub);
255  bookPf(ib, histo, sime, digiAmp);
256  sprintf(histo, "HcalDigiTask_amplitude_vs_simhits_profile_depth1_%s", sub);
257  bookPf(ib, histo, sime, digiAmp);
258  sprintf(histo, "HcalDigiTask_amplitude_vs_simhits_profile_depth2_%s", sub);
259  bookPf(ib, histo, sime, digiAmp);
260  sprintf(histo, "HcalDigiTask_amplitude_vs_simhits_profile_depth3_%s", sub);
261  bookPf(ib, histo, sime, digiAmp);
262  sprintf(histo, "HcalDigiTask_amplitude_vs_simhits_profile_depth4_%s", sub);
263  bookPf(ib, histo, sime, digiAmp);
264 
265  sprintf(histo, "HcalDigiTask_ratio_amplitude_vs_simhits_%s", sub);
266  book1D(ib, histo, ratio);
267  sprintf(histo, "HcalDigiTask_ratio_amplitude_vs_simhits_depth1_%s", sub);
268  book1D(ib, histo, ratio);
269  sprintf(histo, "HcalDigiTask_ratio_amplitude_vs_simhits_depth2_%s", sub);
270  book1D(ib, histo, ratio);
271  sprintf(histo, "HcalDigiTask_ratio_amplitude_vs_simhits_depth3_%s", sub);
272  book1D(ib, histo, ratio);
273  sprintf(histo, "HcalDigiTask_ratio_amplitude_vs_simhits_depth4_%s", sub);
274  book1D(ib, histo, ratio);
275  }//mc only
276 
277  } else { // noise only
278 
279  // EVENT "1" distributions of all cells properties
280 
281 
282  if (subdet_ == "HB" || subdet_ == "HE" || subdet_ == "HF") {
283  sprintf(histo, "HcalDigiTask_gain_capId0_Depth1_%s", sub);
284  book1D(ib, histo, gainLim);
285  sprintf(histo, "HcalDigiTask_gain_capId1_Depth1_%s", sub);
286  book1D(ib, histo, gainLim);
287  sprintf(histo, "HcalDigiTask_gain_capId2_Depth1_%s", sub);
288  book1D(ib, histo, gainLim);
289  sprintf(histo, "HcalDigiTask_gain_capId3_Depth1_%s", sub);
290  book1D(ib, histo, gainLim);
291 
292  sprintf(histo, "HcalDigiTask_gain_capId0_Depth2_%s", sub);
293  book1D(ib, histo, gainLim);
294  sprintf(histo, "HcalDigiTask_gain_capId1_Depth2_%s", sub);
295  book1D(ib, histo, gainLim);
296  sprintf(histo, "HcalDigiTask_gain_capId2_Depth2_%s", sub);
297  book1D(ib, histo, gainLim);
298  sprintf(histo, "HcalDigiTask_gain_capId3_Depth2_%s", sub);
299  book1D(ib, histo, gainLim);
300 
301  sprintf(histo, "HcalDigiTask_gainWidth_capId0_Depth1_%s", sub);
302  book1D(ib, histo, gainWidthLim);
303  sprintf(histo, "HcalDigiTask_gainWidth_capId1_Depth1_%s", sub);
304  book1D(ib, histo, gainWidthLim);
305  sprintf(histo, "HcalDigiTask_gainWidth_capId2_Depth1_%s", sub);
306  book1D(ib, histo, gainWidthLim);
307  sprintf(histo, "HcalDigiTask_gainWidth_capId3_Depth1_%s", sub);
308  book1D(ib, histo, gainWidthLim);
309 
310  sprintf(histo, "HcalDigiTask_gainWidth_capId0_Depth2_%s", sub);
311  book1D(ib, histo, gainWidthLim);
312  sprintf(histo, "HcalDigiTask_gainWidth_capId1_Depth2_%s", sub);
313  book1D(ib, histo, gainWidthLim);
314  sprintf(histo, "HcalDigiTask_gainWidth_capId2_Depth2_%s", sub);
315  book1D(ib, histo, gainWidthLim);
316  sprintf(histo, "HcalDigiTask_gainWidth_capId3_Depth2_%s", sub);
317  book1D(ib, histo, gainWidthLim);
318 
319  sprintf(histo, "HcalDigiTask_pedestal_capId0_Depth1_%s", sub);
320  book1D(ib, histo, pedLim);
321  sprintf(histo, "HcalDigiTask_pedestal_capId1_Depth1_%s", sub);
322  book1D(ib, histo, pedLim);
323  sprintf(histo, "HcalDigiTask_pedestal_capId2_Depth1_%s", sub);
324  book1D(ib, histo, pedLim);
325  sprintf(histo, "HcalDigiTask_pedestal_capId3_Depth1_%s", sub);
326  book1D(ib, histo, pedLim);
327 
328  sprintf(histo, "HcalDigiTask_pedestal_capId0_Depth2_%s", sub);
329  book1D(ib, histo, pedLim);
330  sprintf(histo, "HcalDigiTask_pedestal_capId1_Depth2_%s", sub);
331  book1D(ib, histo, pedLim);
332  sprintf(histo, "HcalDigiTask_pedestal_capId2_Depth2_%s", sub);
333  book1D(ib, histo, pedLim);
334  sprintf(histo, "HcalDigiTask_pedestal_capId3_Depth2_%s", sub);
335  book1D(ib, histo, pedLim);
336 
337  sprintf(histo, "HcalDigiTask_pedestal_width_capId0_Depth1_%s", sub);
338  book1D(ib, histo, pedWidthLim);
339  sprintf(histo, "HcalDigiTask_pedestal_width_capId1_Depth1_%s", sub);
340  book1D(ib, histo, pedWidthLim);
341  sprintf(histo, "HcalDigiTask_pedestal_width_capId2_Depth1_%s", sub);
342  book1D(ib, histo, pedWidthLim);
343  sprintf(histo, "HcalDigiTask_pedestal_width_capId3_Depth1_%s", sub);
344  book1D(ib, histo, pedWidthLim);
345 
346  sprintf(histo, "HcalDigiTask_pedestal_width_capId0_Depth2_%s", sub);
347  book1D(ib, histo, pedWidthLim);
348  sprintf(histo, "HcalDigiTask_pedestal_width_capId1_Depth2_%s", sub);
349  book1D(ib, histo, pedWidthLim);
350  sprintf(histo, "HcalDigiTask_pedestal_width_capId2_Depth2_%s", sub);
351  book1D(ib, histo, pedWidthLim);
352  sprintf(histo, "HcalDigiTask_pedestal_width_capId3_Depth2_%s", sub);
353  book1D(ib, histo, pedWidthLim);
354 
355  }
356 
357  if (subdet_ == "HE") {
358  sprintf(histo, "HcalDigiTask_gain_capId0_Depth3_%s", sub);
359  book1D(ib, histo, gainLim);
360  sprintf(histo, "HcalDigiTask_gain_capId1_Depth3_%s", sub);
361  book1D(ib, histo, gainLim);
362  sprintf(histo, "HcalDigiTask_gain_capId2_Depth3_%s", sub);
363  book1D(ib, histo, gainLim);
364  sprintf(histo, "HcalDigiTask_gain_capId3_Depth3_%s", sub);
365  book1D(ib, histo, gainLim);
366 
367  sprintf(histo, "HcalDigiTask_gainWidth_capId0_Depth3_%s", sub);
368  book1D(ib, histo, gainWidthLim);
369  sprintf(histo, "HcalDigiTask_gainWidth_capId1_Depth3_%s", sub);
370  book1D(ib, histo, gainWidthLim);
371  sprintf(histo, "HcalDigiTask_gainWidth_capId2_Depth3_%s", sub);
372  book1D(ib, histo, gainWidthLim);
373  sprintf(histo, "HcalDigiTask_gainWidth_capId3_Depth3_%s", sub);
374  book1D(ib, histo, gainWidthLim);
375 
376  sprintf(histo, "HcalDigiTask_pedestal_capId0_Depth3_%s", sub);
377  book1D(ib, histo, pedLim);
378  sprintf(histo, "HcalDigiTask_pedestal_capId1_Depth3_%s", sub);
379  book1D(ib, histo, pedLim);
380  sprintf(histo, "HcalDigiTask_pedestal_capId2_Depth3_%s", sub);
381  book1D(ib, histo, pedLim);
382  sprintf(histo, "HcalDigiTask_pedestal_capId3_Depth3_%s", sub);
383  book1D(ib, histo, pedLim);
384 
385  sprintf(histo, "HcalDigiTask_pedestal_width_capId0_Depth3_%s", sub);
386  book1D(ib, histo, pedWidthLim);
387  sprintf(histo, "HcalDigiTask_pedestal_width_capId1_Depth3_%s", sub);
388  book1D(ib, histo, pedWidthLim);
389  sprintf(histo, "HcalDigiTask_pedestal_width_capId2_Depth3_%s", sub);
390  book1D(ib, histo, pedWidthLim);
391  sprintf(histo, "HcalDigiTask_pedestal_width_capId3_Depth3_%s", sub);
392  book1D(ib, histo, pedWidthLim);
393 
394  }
395 
396  if (subdet_ == "HO") {
397  sprintf(histo, "HcalDigiTask_gain_capId0_Depth4_%s", sub);
398  book1D(ib, histo, gainLim);
399  sprintf(histo, "HcalDigiTask_gain_capId1_Depth4_%s", sub);
400  book1D(ib, histo, gainLim);
401  sprintf(histo, "HcalDigiTask_gain_capId2_Depth4_%s", sub);
402  book1D(ib, histo, gainLim);
403  sprintf(histo, "HcalDigiTask_gain_capId3_Depth4_%s", sub);
404  book1D(ib, histo, gainLim);
405 
406  sprintf(histo, "HcalDigiTask_gainWidth_capId0_Depth4_%s", sub);
407  book1D(ib, histo, gainWidthLim);
408  sprintf(histo, "HcalDigiTask_gainWidth_capId1_Depth4_%s", sub);
409  book1D(ib, histo, gainWidthLim);
410  sprintf(histo, "HcalDigiTask_gainWidth_capId2_Depth4_%s", sub);
411  book1D(ib, histo, gainWidthLim);
412  sprintf(histo, "HcalDigiTask_gainWidth_capId3_Depth4_%s", sub);
413  book1D(ib, histo, gainWidthLim);
414 
415 
416  sprintf(histo, "HcalDigiTask_pedestal_capId0_Depth4_%s", sub);
417  book1D(ib, histo, pedLim);
418  sprintf(histo, "HcalDigiTask_pedestal_capId1_Depth4_%s", sub);
419  book1D(ib, histo, pedLim);
420  sprintf(histo, "HcalDigiTask_pedestal_capId2_Depth4_%s", sub);
421  book1D(ib, histo, pedLim);
422  sprintf(histo, "HcalDigiTask_pedestal_capId3_Depth4_%s", sub);
423  book1D(ib, histo, pedLim);
424 
425  sprintf(histo, "HcalDigiTask_pedestal_width_capId0_Depth4_%s", sub);
426  book1D(ib, histo, pedWidthLim);
427  sprintf(histo, "HcalDigiTask_pedestal_width_capId1_Depth4_%s", sub);
428  book1D(ib, histo, pedWidthLim);
429  sprintf(histo, "HcalDigiTask_pedestal_width_capId2_Depth4_%s", sub);
430  book1D(ib, histo, pedWidthLim);
431  sprintf(histo, "HcalDigiTask_pedestal_width_capId3_Depth4_%s", sub);
432  book1D(ib, histo, pedWidthLim);
433 
434  }
435 
436  sprintf(histo, "HcalDigiTask_gainMap_Depth1_%s", sub);
437  book2D(ib, histo, ietaLim, iphiLim);
438  sprintf(histo, "HcalDigiTask_gainMap_Depth2_%s", sub);
439  book2D(ib, histo, ietaLim, iphiLim);
440  sprintf(histo, "HcalDigiTask_gainMap_Depth3_%s", sub);
441  book2D(ib, histo, ietaLim, iphiLim);
442  sprintf(histo, "HcalDigiTask_gainMap_Depth4_%s", sub);
443  book2D(ib, histo, ietaLim, iphiLim);
444 
445  sprintf(histo, "HcalDigiTask_pwidthMap_Depth1_%s", sub);
446  book2D(ib, histo, ietaLim, iphiLim);
447  sprintf(histo, "HcalDigiTask_pwidthMap_Depth2_%s", sub);
448  book2D(ib, histo, ietaLim, iphiLim);
449  sprintf(histo, "HcalDigiTask_pwidthMap_Depth3_%s", sub);
450  book2D(ib, histo, ietaLim, iphiLim);
451  sprintf(histo, "HcalDigiTask_pwidthMap_Depth4_%s", sub);
452  book2D(ib, histo, ietaLim, iphiLim);
453 
454  } //end of noise-only
455 }//book
456 
458  using namespace edm;
459  using namespace std;
460 
461  iSetup.get<CaloGeometryRecord > ().get(geometry);
462  iSetup.get<HcalDbRecord > ().get(conditions);
463 
464  //TP Code
466  iSetup.get<CaloTPGRecord>().get(decoder);
467 
468  iSetup.get<HcalRecNumberingRecord>().get(htopo);
469 
470  //Get all handles
472  iEvent.getByToken(tok_emulTPs_, emulTPs);
473 
475  iEvent.getByToken(tok_dataTPs_, dataTPs);
476  //iEvent.getByLabel("hcalDigis", dataTPs);
477 
478  //~TP Code
479 
480  // std::cout << " >>>>> HcalDigiTester::analyze hcalselector = "
481  // << subdet_ << std::endl;
482 
483  if (subdet_ != "all") {
484  noise_ = 0;
485  if (subdet_ == "HB") reco<HBHEDataFrame > (iEvent, iSetup, tok_hbhe_);
486  if (subdet_ == "HE") reco<HBHEDataFrame > (iEvent, iSetup, tok_hbhe_);
487  if (subdet_ == "HO") reco<HODataFrame > (iEvent, iSetup, tok_ho_);
488  if (subdet_ == "HF") reco<HFDataFrame > (iEvent, iSetup, tok_hf_);
489 
490  if (subdet_ == "noise") {
491  noise_ = 1;
492  // std::cout << " >>>>> HcalDigiTester::analyze entering noise "
493  // << std::endl;
494  subdet_ = "HB";
495  reco<HBHEDataFrame > (iEvent, iSetup, tok_hbhe_);
496  subdet_ = "HE";
497  reco<HBHEDataFrame > (iEvent, iSetup, tok_hbhe_);
498  subdet_ = "HO";
499  reco<HODataFrame > (iEvent, iSetup, tok_ho_);
500  subdet_ = "HF";
501  reco<HFDataFrame > (iEvent, iSetup, tok_hf_);
502  subdet_ = "noise";
503  }
504  }// all subdetectors
505  else {
506  noise_ = 0;
507 
508  subdet_ = "HB";
509  reco<HBHEDataFrame > (iEvent, iSetup, tok_hbhe_);
510  subdet_ = "HE";
511  reco<HBHEDataFrame > (iEvent, iSetup, tok_hbhe_);
512  subdet_ = "HO";
513  reco<HODataFrame > (iEvent, iSetup, tok_ho_);
514  subdet_ = "HF";
515  reco<HFDataFrame > (iEvent, iSetup, tok_hf_);
516  subdet_ = "all";
517  }
518 
519  fill1D("nevtot", 0);
520  nevtot++;
521 
522  //TP Code
523  //Counters
524  int c = 0, chb = 0, che = 0, chf = 0;
525 
526  for (HcalTrigPrimDigiCollection::const_iterator itr = dataTPs->begin(); itr != dataTPs->end(); ++itr) {
527  int ieta = itr->id().ieta();
528  int iphi = itr->id().iphi();
529 
530  HcalSubdetector subdet = (HcalSubdetector) 0;
531  if ( abs(ieta) <= 16 ) subdet = HcalSubdetector::HcalBarrel ;
532  else if ( abs(ieta) <= 28 ) subdet = HcalSubdetector::HcalEndcap ;
533  else if ( abs(ieta) <= 40 ) subdet = HcalSubdetector::HcalForward;
534 
535  /* HcalSubdetector subdet = (HcalSubdetector) itr->id().subdet(); */
536 
537  float cen = itr->SOI_compressedEt();
538  float en = decoder->hcaletValue(ieta,iphi,cen);
539 
540  if (en < 0.00001) continue;
541 
542  //Plot the variables
543 
544  fill1D("HcalDigiTask_tp_et",en);
545  fill2D("HcalDigiTask_tp_et_ieta",ieta,en);
546  fillPf("HcalDigiTask_tp_ave_et_ieta",ieta,en);
547 
548  ++c;
549  if ( subdet == HcalSubdetector::HcalBarrel ) {
550  fill1D("HcalDigiTask_tp_et_HB",en);
551  ++chb;
552  }
553  if ( subdet == HcalSubdetector::HcalEndcap ) {
554  fill1D("HcalDigiTask_tp_et_HE",en);
555  ++che;
556  }
557  if ( subdet == HcalSubdetector::HcalForward ) {
558  fill1D("HcalDigiTask_tp_et_HF",en);
559  ++chf;
560  }
561 
562  fill1D("HcalDigiTask_tp_ntp_ieta",ieta);
563  if ( en > 10. ) fill1D("HcalDigiTask_tp_ntp_10_ieta",ieta);
564 
565  }//end data TP collection
566 
567  fill1D("HcalDigiTask_tp_ntp",c);
568  fill1D("HcalDigiTask_tp_ntp_HB",chb);
569  fill1D("HcalDigiTask_tp_ntp_HE",che);
570  fill1D("HcalDigiTask_tp_ntp_HF",chf);
571 
572  //~TP Code
573 }
574 
576 
577 
578  // HistLim =============================================================
579 
580  std::string strtmp;
581 
582  // ======================================================================
583  using namespace edm;
586 
587  // ADC2fC
588  HcalCalibrations calibrations;
589  CaloSamples tool;
590  iEvent.getByToken(tok, digiCollection);
591 // std::cout << "***************RECO*****************" << std::endl;
592  int isubdet = 0;
593  if (subdet_ == "HB") isubdet = 1;
594  if (subdet_ == "HE") isubdet = 2;
595  if (subdet_ == "HO") isubdet = 3;
596  if (subdet_ == "HF") isubdet = 4;
597 
598  if (isubdet == 1) nevent1++;
599  if (isubdet == 2) nevent2++;
600  if (isubdet == 3) nevent3++;
601  if (isubdet == 4) nevent4++;
602 
603  int indigis = 0;
604  // amplitude for signal cell at diff. depths
605  double ampl1_c = 0.;
606  double ampl2_c = 0.;
607  double ampl3_c = 0.;
608  double ampl4_c = 0.;
609  double ampl_c = 0.;
610 
611  // is set to 1 if "seed" SimHit is found
612  int seedSimHit = 0;
613 
614  // std::cout << " HcalDigiTester::reco : "
615  // << "subdet=" << subdet << " noise="<< noise_ << std::endl;
616 
617  int ieta_Sim = 9999;
618  int iphi_Sim = 9999;
619  double emax_Sim = -9999.;
620 
621 
622  // SimHits MC only
623  if (mc_ == "yes") {
625  iEvent.getByToken(tok_mc_, hcalHits);
626  const edm::PCaloHitContainer * simhitResult = hcalHits.product();
627 
628  if (isubdet != 0 && noise_ == 0) { // signal only SimHits
629 
630  for (std::vector<PCaloHit>::const_iterator simhits = simhitResult->begin(); simhits != simhitResult->end(); ++simhits) {
631 
632  HcalDetId cell(simhits->id());
633  double en = simhits->energy();
634  int sub = cell.subdet();
635  int ieta = cell.ieta();
636  //REMOVED (JRD) if (ieta > 0) ieta--;
637  //REMOVED (JRD) int iphi = cell.iphi() - 1;
638  int iphi = cell.iphi();
639 
640  if (en > emax_Sim && sub == isubdet) {
641  emax_Sim = en;
642  ieta_Sim = ieta;
643  iphi_Sim = iphi;
644  // to limit "seed" SimHit energy in case of "multi" event
645  if (mode_ == "multi" &&
646  ((sub == 4 && en < 100. && en > 1.)
647  || ((sub != 4) && en < 1. && en > 0.02))) {
648  seedSimHit = 1;
649  break;
650  }
651  }
652 
653  } // end of SimHits cycle
654 
655 
656  // found highest-energy SimHit for single-particle
657  if (mode_ != "multi" && emax_Sim > 0.) seedSimHit = 1;
658  } // end of SimHits
659  }// end of mc_ == "yes"
660 
661  // CYCLE OVER CELLS ========================================================
662  int Ndig = 0;
663 
664  /*
665  std::cout << " HcalDigiTester::reco : nevent 1,2,3,4 = "
666  << nevent1 << " " << nevent2 << " " << nevent3 << " "
667  << nevent4 << std::endl;
668  */
669 
670  for (digiItr = digiCollection->begin(); digiItr != digiCollection->end(); digiItr++) {
671 
672  HcalDetId cell(digiItr->id());
673  int depth = cell.depth();
674  //REMOVED (JRD) int iphi = cell.iphi() - 1;
675  int iphi = cell.iphi();
676  int ieta = cell.ieta();
677  //REMOVED (JRD) if (ieta > 0) ieta--;
678  int sub = cell.subdet();
679 
680 
681  // amplitude for signal cell at diff. depths
682  double ampl = 0.;
683  double ampl1 = 0.;
684  double ampl2 = 0.;
685  double ampl3 = 0.;
686  double ampl4 = 0.;
687 
688 
689  // Gains, pedestals (once !) and only for "noise" case
690  if (((nevent1 == 1 && isubdet == 1) ||
691  (nevent2 == 1 && isubdet == 2) ||
692  (nevent3 == 1 && isubdet == 3) ||
693  (nevent4 == 1 && isubdet == 4)) && noise_ == 1 && sub == isubdet) {
694 
695  HcalGenericDetId hcalGenDetId(digiItr->id());
696  const HcalPedestal* pedestal = conditions->getPedestal(hcalGenDetId);
697  const HcalGain* gain = conditions->getGain(hcalGenDetId);
698  const HcalGainWidth* gainWidth = conditions->getGainWidth(hcalGenDetId);
699  const HcalPedestalWidth* pedWidth = conditions-> getPedestalWidth(hcalGenDetId);
700 
701  for (int i = 0; i < 4; i++) {
702  fill1D("HcalDigiTask_gain_capId" + str(i) + "_Depth" + str(depth) + "_" + subdet_, gain->getValue(i));
703  fill1D("HcalDigiTask_gainWidth_capId" + str(i) + "_Depth" + str(depth) + "_" + subdet_, gainWidth->getValue(i));
704  fill1D("HcalDigiTask_pedestal_capId" + str(i) + "_Depth" + str(depth) + "_" + subdet_, pedestal->getValue(i));
705  fill1D("HcalDigiTask_pedestal_width_capId" + str(i) + "_Depth" + str(depth) + "_" + subdet_, pedWidth->getWidth(i));
706  }
707 
708  fill2D("HcalDigiTask_gainMap_Depth" + str(depth) + "_" + subdet_, double(ieta), double(iphi), gain->getValue(0));
709  fill2D("HcalDigiTask_pwidthMap_Depth" + str(depth) + "_" + subdet_, double(ieta), double(iphi), pedWidth->getWidth(0));
710 
711  }// end of event #1
712  //std::cout << "==== End of event noise block in cell cycle" << std::endl;
713 
714  if (sub == isubdet) Ndig++; // subdet number of digi
715 
716  // No-noise case, only single subdet selected ===========================
717 
718  if (sub == isubdet && noise_ == 0) {
719 
720 
721  HcalCalibrations calibrations = conditions->getHcalCalibrations(cell);
722 
723  const HcalQIECoder* channelCoder = conditions->getHcalCoder(cell);
724  const HcalQIEShape* shape = conditions->getHcalShape(channelCoder);
725  HcalCoderDb coder(*channelCoder, *shape);
726  coder.adc2fC(*digiItr, tool);
727 
728  double noiseADC = (*digiItr)[0].adc();
729  double noisefC = tool[0];
730  // noise evaluations from "pre-samples"
731  fill1D("HcalDigiTask_ADC0_adc_depth" + str(depth) + "_" + subdet_, noiseADC);
732  fill1D("HcalDigiTask_ADC0_fC_depth" + str(depth) + "_" + subdet_, noisefC);
733 
734 
735  // OCCUPANCY maps fill
736  fill2D("HcalDigiTask_ieta_iphi_occupancy_map_depth" + str(depth) + "_" + subdet_, double(ieta), double(iphi));
737 
738  // Cycle on time slices
739  // - for each Digi
740  // - for one Digi with max SimHits E in subdet
741 
742 
743  int closen = 0; // =1 if 1) seedSimHit = 1 and 2) the cell is the same
744  if (ieta == ieta_Sim && iphi == iphi_Sim) closen = seedSimHit;
745 
746  for (int ii = 0; ii < tool.size(); ii++) {
747  int capid = (*digiItr)[ii].capid();
748  // single ts amplitude
749  double val = (tool[ii] - calibrations.pedestal(capid));
750 /*
751  if (val > 10.) {
752  if (depth == 1) strtmp = "HcalDigiTask_all_amplitudes_vs_bin_depth1_" + subdet_;
753  else strtmp = "HcalDigiTask_all_amplitudes_vs_bin_depth2_" + subdet_;
754  fill2D(strtmp, double(ii), val);
755  }
756 */
757  if (val > 100.) {
758  if (depth == 1) strtmp = "HcalDigiTask_all_amplitudes_vs_bin_1D_depth1_" + subdet_;
759  else strtmp = "HcalDigiTask_all_amplitudes_vs_bin_1D_depth2_" + subdet_;
760  fill1D(strtmp, double(ii), val);
761  }
762 
763  if (closen == 1) {
764  strtmp = "HcalDigiTask_signal_amplitude_vs_bin_all_depths_" + subdet_;
765  fill2D(strtmp, double(ii), val);
766  }
767 
768 
769  // HB/HE/HO
770  if (isubdet != 4 && ii >= 4 && ii <= 7) {
771  ampl += val;
772  if (depth == 1) ampl1 += val;
773  if (depth == 2) ampl2 += val;
774  if (depth == 3) ampl3 += val;
775  if (depth == 4) ampl4 += val;
776 
777  if (closen == 1) {
778  ampl_c += val;
779  if (depth == 1) ampl1_c += val;
780  if (depth == 2) ampl2_c += val;
781  if (depth == 3) ampl3_c += val;
782  if (depth == 4) ampl4_c += val;
783  }
784  }
785 
786  // HF
787  if (isubdet == 4 && ii >= 2 && ii <= 4) {
788  ampl += val;
789  if (depth == 1) ampl1 += val;
790  if (depth == 2) ampl2 += val;
791  if (depth == 3) ampl3 += val;
792  if (depth == 4) ampl4 += val;
793  if (closen == 1) {
794  ampl_c += val;
795  if (depth == 1) ampl1_c += val;
796  if (depth == 2) ampl2_c += val;
797  if (depth == 3) ampl3_c += val;
798  if (depth == 4) ampl4_c += val;
799 
800  }
801  }
802  }
803  // end of time bucket sample
804 
805 
806  // maps of sum of amplitudes (sum lin.digis(4,5,6,7) - ped) all depths
807 /*
808  strtmp = "HcalDigiTask_ieta_iphi_map_of_amplitudes_fC_depth1_" + subdet_;
809  fill2D(strtmp, double(ieta), double(iphi), ampl1);
810  strtmp = "HcalDigiTask_ieta_iphi_map_of_amplitudes_fC_depth2_" + subdet_;
811  fill2D(strtmp, double(ieta), double(iphi), ampl2);
812  strtmp = "HcalDigiTask_ieta_iphi_map_of_amplitudes_fC_depth3_" + subdet_;
813  fill2D(strtmp, double(ieta), double(iphi), ampl3);
814  strtmp = "HcalDigiTask_ieta_iphi_map_of_amplitudes_fC_depth4_" + subdet_;
815  fill2D(strtmp, double(ieta), double(iphi), ampl4);
816 */
817  // just 1D of all cells' amplitudes
818  strtmp = "HcalDigiTask_sum_all_amplitudes_" + subdet_;
819  fill1D(strtmp, ampl);
820 
821 
822  if (ampl1 > 10. || ampl2 > 10. || ampl3 > 10. || ampl4 > 10.) indigis++;
823 
824  // fraction 5,6 bins if ampl. is big.
825  if (ampl1 > 30. && depth == 1 && closen == 1 && isubdet != 4) {
826  double fBin5 = tool[4] - calibrations.pedestal((*digiItr)[4].capid());
827  double fBin67 = tool[5] + tool[6]
828  - calibrations.pedestal((*digiItr)[5].capid())
829  - calibrations.pedestal((*digiItr)[6].capid());
830 
831  fBin5 /= ampl1;
832  fBin67 /= ampl1;
833 
834  strtmp = "HcalDigiTask_bin_5_frac_" + subdet_;
835  fill1D(strtmp, fBin5);
836  strtmp = "HcalDigiTask_bin_6_7_frac_" + subdet_;
837  fill1D(strtmp, fBin67);
838 
839  }
840 
841  //Special for HF
842  if (isubdet == 4 && ampl1 > 30. && depth == 1) {
843  double fBin5 = tool[2] - calibrations.pedestal((*digiItr)[2].capid());
844  double fBin67 = tool[3] + tool[4]
845  - calibrations.pedestal((*digiItr)[3].capid())
846  - calibrations.pedestal((*digiItr)[4].capid());
847  fBin5 /= ampl1;
848  fBin67 /= ampl1;
849  strtmp = "HcalDigiTask_bin_5_frac_" + subdet_;
850  fill1D(strtmp, fBin5);
851  strtmp = "HcalDigiTask_bin_6_7_frac_" + subdet_;
852  fill1D(strtmp, fBin67);
853  }
854 
855 
856  strtmp = "HcalDigiTask_signal_amplitude_" + subdet_;
857  fill1D(strtmp, ampl);
858  strtmp = "HcalDigiTask_signal_amplitude_depth1_" + subdet_;
859  fill1D(strtmp, ampl1);
860  strtmp = "HcalDigiTask_signal_amplitude_depth2_" + subdet_;
861  fill1D(strtmp, ampl2);
862  strtmp = "HcalDigiTask_signal_amplitude_depth3_" + subdet_;
863  fill1D(strtmp, ampl3);
864  strtmp = "HcalDigiTask_signal_amplitude_depth4_" + subdet_;
865  fill1D(strtmp, ampl4);
866  }
867  } // End of CYCLE OVER CELLS =============================================
868 
869  if (isubdet != 0 && noise_ == 0) { // signal only, once per event
870  strtmp = "HcalDigiTask_number_of_amplitudes_above_10fC_" + subdet_;
871  fill1D(strtmp, indigis);
872 
873  // SimHits once again !!!
874  double eps = 1.e-3;
875  double ehits = 0.;
876  double ehits1 = 0.;
877  double ehits2 = 0.;
878  double ehits3 = 0.;
879  double ehits4 = 0.;
880 
881  if (mc_ == "yes") {
883  iEvent.getByToken(tok_mc_, hcalHits);
884  const edm::PCaloHitContainer * simhitResult = hcalHits.product();
885  for (std::vector<PCaloHit>::const_iterator simhits = simhitResult->begin(); simhits != simhitResult->end(); ++simhits) {
886 
887  HcalDetId cell(simhits->id());
888  int ieta = cell.ieta();
889  //REMOVED (JRD) if (ieta > 0) ieta--;
890  //REMOVED (JRD) int iphi = cell.iphi() - 1;
891  int iphi = cell.iphi();
892  int sub = cell.subdet();
893 
894  // take cell already found to be max energy in a particular subdet
895  if (sub == isubdet && ieta == ieta_Sim && iphi == iphi_Sim) {
896  int depth = cell.depth();
897  double en = simhits->energy();
898 
899  ehits += en;
900  if (depth == 1) ehits1 += en;
901  if (depth == 2) ehits2 += en;
902  if (depth == 3) ehits3 += en;
903  if (depth == 4) ehits4 += en;
904  }
905  }
906 
907  strtmp = "HcalDigiTask_amplitude_vs_simhits_" + subdet_;
908  if (ehits > eps) fill2D(strtmp, ehits, ampl_c);
909  strtmp = "HcalDigiTask_amplitude_vs_simhits_depth1_" + subdet_;
910  if (ehits1 > eps) fill2D(strtmp, ehits1, ampl1_c);
911  strtmp = "HcalDigiTask_amplitude_vs_simhits_depth2_" + subdet_;
912  if (ehits2 > eps) fill2D(strtmp, ehits2, ampl2_c);
913  strtmp = "HcalDigiTask_amplitude_vs_simhits_depth3_" + subdet_;
914  if (ehits3 > eps) fill2D(strtmp, ehits3, ampl3_c);
915  strtmp = "HcalDigiTask_amplitude_vs_simhits_depth4_" + subdet_;
916  if (ehits4 > eps) fill2D(strtmp, ehits4, ampl4_c);
917 
918  strtmp = "HcalDigiTask_amplitude_vs_simhits_profile_" + subdet_;
919  if (ehits > eps) fillPf(strtmp, ehits, ampl_c);
920  strtmp = "HcalDigiTask_amplitude_vs_simhits_profile_depth1_" + subdet_;
921  if (ehits1 > eps) fillPf(strtmp, ehits1, ampl1_c);
922  strtmp = "HcalDigiTask_amplitude_vs_simhits_profile_depth2_" + subdet_;
923  if (ehits2 > eps) fillPf(strtmp, ehits2, ampl2_c);
924  strtmp = "HcalDigiTask_amplitude_vs_simhits_profile_depth3_" + subdet_;
925  if (ehits3 > eps) fillPf(strtmp, ehits3, ampl3_c);
926  strtmp = "HcalDigiTask_amplitude_vs_simhits_profile_depth4_" + subdet_;
927  if (ehits4 > eps) fillPf(strtmp, ehits4, ampl4_c);
928 
929  strtmp = "HcalDigiTask_ratio_amplitude_vs_simhits_" + subdet_;
930  if (ehits > eps) fill1D(strtmp, ampl_c / ehits);
931  strtmp = "HcalDigiTask_ratio_amplitude_vs_simhits_depth1_" + subdet_;
932  if (ehits1 > eps) fill1D(strtmp, ampl1_c / ehits1);
933  strtmp = "HcalDigiTask_ratio_amplitude_vs_simhits_depth2_" + subdet_;
934  if (ehits2 > eps) fill1D(strtmp, ampl2_c / ehits2);
935  strtmp = "HcalDigiTask_ratio_amplitude_vs_simhits_depth3_" + subdet_;
936  if (ehits3 > eps) fill1D(strtmp, ampl3_c / ehits3);
937  strtmp = "HcalDigiTask_ratio_amplitude_vs_simhits_depth4_" + subdet_;
938  if (ehits4 > eps) fill1D(strtmp, ampl4_c / ehits4);
939 
940  } // end of if(mc_ == "yes")
941 
942  strtmp = "HcalDigiTask_Ndigis_" + subdet_;
943  fill1D(strtmp, double(Ndig));
944 
945  } // end of if( subdet != 0 && noise_ == 0) { // signal only
946 }
947 
949 
950  std::string strtmp;
951 
952  float fev = float (nevtot);
953  // std::cout << "*** nevtot " << nevtot << std::endl;
954 
955  float sumphi_1, sumphi_2, sumphi_3, sumphi_4;
956  float phi_factor;
957  float cnorm;
958 
959  strtmp = "HcalDigiTask_ieta_iphi_occupancy_map_depth1_" + subdet_;
960  int nx = monitor(strtmp)->getNbinsX();
961  int ny = monitor(strtmp)->getNbinsY();
962 
963  for (int i = 1; i <= nx; i++) {
964  for (int j = 1; j <= ny; j++) {
965 
966  // occupancies
967 
968  strtmp = "HcalDigiTask_ieta_iphi_occupancy_map_depth1_" + subdet_;
969  cnorm = monitor(strtmp)->getBinContent(i, j) / fev;
970  monitor(strtmp)->setBinContent(i, j, cnorm);
971 
972  strtmp = "HcalDigiTask_ieta_iphi_occupancy_map_depth2_" + subdet_;
973  cnorm = monitor(strtmp)->getBinContent(i, j) / fev;
974  monitor(strtmp)->setBinContent(i, j, cnorm);
975 
976  strtmp = "HcalDigiTask_ieta_iphi_occupancy_map_depth3_" + subdet_;
977  cnorm = monitor(strtmp)->getBinContent(i, j) / fev;
978  monitor(strtmp)->setBinContent(i, j, cnorm);
979 
980  strtmp = "HcalDigiTask_ieta_iphi_occupancy_map_depth4_" + subdet_;
981  cnorm = monitor(strtmp)->getBinContent(i, j) / fev;
982  monitor(strtmp)->setBinContent(i, j, cnorm);
983 
984  }
985  }
986 
987  for (int i = 1; i <= 82; i++) {
988 
989  int ieta = i - 42; // -41 -1, 0 40
990  if (ieta >= 0) ieta += 1; // -41 -1, 1 41 - to make it detector-like
991 
992  if (ieta >= -20 && ieta <= 20) {
993  phi_factor = 72.;
994  } else {
995  if (ieta >= 40 || ieta <= -40) {
996  phi_factor = 18.;
997  } else
998  phi_factor = 36.;
999  }
1000 
1001  sumphi_1 = 0.;
1002  sumphi_2 = 0.;
1003  sumphi_3 = 0.;
1004  sumphi_4 = 0.;
1005 
1006  for (int iphi = 1; iphi <= 72; iphi++) {
1007  strtmp = "HcalDigiTask_ieta_iphi_occupancy_map_depth1_" + subdet_;
1008  sumphi_1 += monitor(strtmp)->getTH1()->GetBinContent(monitor(strtmp)->getTH1()->FindFixBin(double(ieta),double(iphi)));
1009  strtmp = "HcalDigiTask_ieta_iphi_occupancy_map_depth2_" + subdet_;
1010  sumphi_2 += monitor(strtmp)->getTH1()->GetBinContent(monitor(strtmp)->getTH1()->FindFixBin(double(ieta),double(iphi)));
1011  strtmp = "HcalDigiTask_ieta_iphi_occupancy_map_depth3_" + subdet_;
1012  sumphi_3 += monitor(strtmp)->getTH1()->GetBinContent(monitor(strtmp)->getTH1()->FindFixBin(double(ieta),double(iphi)));
1013  strtmp = "HcalDigiTask_ieta_iphi_occupancy_map_depth4_" + subdet_;
1014  sumphi_4 += monitor(strtmp)->getTH1()->GetBinContent(monitor(strtmp)->getTH1()->FindFixBin(double(ieta),double(iphi)));
1015  }
1016 
1017  //REMOVED (JRD) if (ieta >= 0) ieta -= 1; // -41 -1, 0 40 - to bring back to strtmp num !!!
1018  double deta = double(ieta);
1019 
1020  // occupancies vs ieta
1021  cnorm = sumphi_1 / phi_factor;
1022  strtmp = "HcalDigiTask_occupancy_vs_ieta_depth1_" + subdet_;
1023  fill1D(strtmp, deta, cnorm);
1024 
1025  cnorm = sumphi_2 / phi_factor;
1026  strtmp = "HcalDigiTask_occupancy_vs_ieta_depth2_" + subdet_;
1027  fill1D(strtmp, deta, cnorm);
1028 
1029  cnorm = sumphi_3 / phi_factor;
1030  strtmp = "HcalDigiTask_occupancy_vs_ieta_depth3_" + subdet_;
1031  fill1D(strtmp, deta, cnorm);
1032 
1033  cnorm = sumphi_4 / phi_factor;
1034  strtmp = "HcalDigiTask_occupancy_vs_ieta_depth4_" + subdet_;
1035  fill1D(strtmp, deta, cnorm);
1036 
1037  } // end of i-loop
1038 
1039 }
1040 
1042  if (!msm_->count(name)) (*msm_)[name] = ib.book1D(name.c_str(), name.c_str(), n, min, max);
1043 }
1044 
1046  if (!msm_->count(name)) (*msm_)[name] = ib.book1D(name.c_str(), name.c_str(), limX.n, limX.min, limX.max);
1047 }
1048 
1050  msm_->find(name)->second->Fill(X, weight);
1051 }
1052 
1054  if (!msm_->count(name)) (*msm_)[name] = ib.book2D(name.c_str(), name.c_str(), limX.n, limX.min, limX.max, limY.n, limY.min, limY.max);
1055 }
1056 
1057 void HcalDigisValidation::fill2D(std::string name, double X, double Y, double weight) {
1058  msm_->find(name)->second->Fill(X, Y, weight);
1059 }
1060 
1062  if (!msm_->count(name)) (*msm_)[name] = ib.bookProfile(name.c_str(), name.c_str(), limX.n, limX.min, limX.max, limY.n, limY.min, limY.max);
1063 }
1064 
1065 void HcalDigisValidation::bookPf(DQMStore::IBooker &ib, std::string name, const HistLim& limX, const HistLim& limY, const char *option) {
1066  if (!msm_->count(name)) (*msm_)[name] = ib.bookProfile(name.c_str(), name.c_str(), limX.n, limX.min, limX.max, limY.n, limY.min, limY.max, option);
1067 }
1068 
1070  msm_->find(name)->second->Fill(X, Y);
1071 }
1072 
1074  if (!msm_->count(name)) return NULL;
1075  else return msm_->find(name)->second;
1076 }
1077 
1079  std::stringstream out;
1080  out << x;
1081  return out.str();
1082 }
1083 
1084 
1085 //define this as a plug-in
1087 
1088 
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
edm::ESHandle< CaloGeometry > geometry
void setBinContent(int binx, double content)
set content of bin (1-D)
std::vector< PCaloHit > PCaloHitContainer
int ib
Definition: cuy.py:660
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:45
edm::EDGetTokenT< edm::SortedCollection< HBHEDataFrame > > tok_hbhe_
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:157
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
edm::EDGetTokenT< edm::SortedCollection< HODataFrame > > tok_ho_
std::vector< HcalTriggerPrimitiveDigi >::const_iterator const_iterator
#define X(str)
Definition: MuonsGrabber.cc:48
#define NULL
Definition: scimark2.h:8
void reco(const edm::Event &iEvent, const edm::EventSetup &iSetup, const edm::EDGetTokenT< edm::SortedCollection< Digi > > &tok)
double pedestal(int fCapId) const
get pedestal for capid=0..3
float getValue(int fCapId) const
get value for capId = 0..3
Definition: HcalGain.h:22
int ii
Definition: cuy.py:588
virtual void analyze(const edm::Event &, const edm::EventSetup &)
float getValue(int fCapId) const
get value for capId = 0..3
Definition: HcalGainWidth.h:21
int getNbinsY(void) const
get # of bins in Y-axis
std::map< std::string, MonitorElement * > * msm_
int iEvent
Definition: GenABIO.cc:230
MonitorElement * monitor(std::string name)
virtual void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const
Definition: HcalCoderDb.cc:44
void fillPf(std::string name, double X, double Y)
void fill2D(std::string name, double X, double Y, double weight=1)
edm::ESHandle< HcalTopology > htopo
int ieta() const
get the cell ieta
Definition: HcalDetId.h:51
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
HcalSubdetector
Definition: HcalAssistant.h:31
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
TH1 * getTH1(void) const
HcalDigisValidation(const edm::ParameterSet &)
void bookPf(DQMStore::IBooker &ib, std::string name, const HistLim &limX, const HistLim &limY)
T min(T a, T b)
Definition: MathUtil.h:58
void book2D(DQMStore::IBooker &ib, std::string name, const HistLim &limX, const HistLim &limY)
tuple out
Definition: dbtoconf.py:99
edm::EDGetTokenT< edm::SortedCollection< HFDataFrame > > tok_hf_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
T const * product() const
Definition: Handle.h:81
void fill1D(std::string name, double X, double weight=1)
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
edm::EDGetTokenT< edm::PCaloHitContainer > tok_mc_
const T & get() const
Definition: EventSetup.h:56
void booking(DQMStore::IBooker &ib, std::string subdetopt, int bnoise, int bmc)
float getWidth(int fCapId) const
get width (sqrt(sigma_i_i)) for capId = 0..3
edm::EDGetTokenT< HcalTrigPrimDigiCollection > tok_emulTPs_
std::string str(int x)
double getBinContent(int binx) const
get content of bin (1-D)
edm::EDGetTokenT< HcalTrigPrimDigiCollection > tok_dataTPs_
edm::ESHandle< HcalDbService > conditions
int getNbinsX(void) const
get # of bins in X-axis
void book1D(DQMStore::IBooker &ib, std::string name, int n, double min, double max)
Definition: Run.h:43