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