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