CMS 3D CMS Logo

HcalRecHitsAnalyzer.cc
Go to the documentation of this file.
5 
7  : topFolderName_(conf.getParameter<std::string>("TopFolderName")) {
8  // DQM ROOT output
9  outputFile_ = conf.getUntrackedParameter<std::string>("outputFile", "myfile.root");
10 
11  if (!outputFile_.empty()) {
12  edm::LogInfo("OutputInfo") << " Hcal RecHit Task histograms will be saved to '" << outputFile_.c_str() << "'";
13  } else {
14  edm::LogInfo("OutputInfo") << " Hcal RecHit Task histograms will NOT be saved";
15  }
16 
17  nevtot = 0;
18 
19  hcalselector_ = conf.getUntrackedParameter<std::string>("hcalselector", "all");
20  ecalselector_ = conf.getUntrackedParameter<std::string>("ecalselector", "yes");
21  eventype_ = conf.getUntrackedParameter<std::string>("eventype", "single");
22  sign_ = conf.getUntrackedParameter<std::string>("sign", "*");
23  // useAllHistos_ = conf.getUntrackedParameter<bool>("useAllHistos", false);
24 
25  // HEP17 configuration
26  hep17_ = conf.getUntrackedParameter<bool>("hep17");
27 
28  // Collections
29  tok_hbhe_ = consumes<HBHERecHitCollection>(conf.getUntrackedParameter<edm::InputTag>("HBHERecHitCollectionLabel"));
30  tok_hf_ = consumes<HFRecHitCollection>(conf.getUntrackedParameter<edm::InputTag>("HFRecHitCollectionLabel"));
31  tok_ho_ = consumes<HORecHitCollection>(conf.getUntrackedParameter<edm::InputTag>("HORecHitCollectionLabel"));
32  edm::InputTag EBRecHitCollectionLabel = conf.getParameter<edm::InputTag>("EBRecHitCollectionLabel");
33  tok_EB_ = consumes<EBRecHitCollection>(EBRecHitCollectionLabel);
34  edm::InputTag EERecHitCollectionLabel = conf.getParameter<edm::InputTag>("EERecHitCollectionLabel");
35  tok_EE_ = consumes<EERecHitCollection>(EERecHitCollectionLabel);
36 
37  subdet_ = 5;
38  if (hcalselector_ == "noise")
39  subdet_ = 0;
40  if (hcalselector_ == "HB")
41  subdet_ = 1;
42  if (hcalselector_ == "HE")
43  subdet_ = 2;
44  if (hcalselector_ == "HO")
45  subdet_ = 3;
46  if (hcalselector_ == "HF")
47  subdet_ = 4;
48  if (hcalselector_ == "all")
49  subdet_ = 5;
50  if (hcalselector_ == "ZS")
51  subdet_ = 6;
52 
53  etype_ = 1;
54  if (eventype_ == "multi")
55  etype_ = 2;
56 
57  iz = 1;
58  if (sign_ == "-")
59  iz = -1;
60  if (sign_ == "*")
61  iz = 0;
62 
63  imc = 0;
64 }
65 
68  es.get<HcalRecNumberingRecord>().get(pHRNDC);
69  hcons = &(*pHRNDC);
74 
76 
77  es.get<CaloGeometryRecord>().get(geometry);
78 
79  const CaloGeometry *geo = geometry.product();
80  const HcalGeometry *gHB = static_cast<const HcalGeometry *>(geo->getSubdetectorGeometry(DetId::Hcal, HcalBarrel));
81  const HcalGeometry *gHE = static_cast<const HcalGeometry *>(geo->getSubdetectorGeometry(DetId::Hcal, HcalEndcap));
82  const HcalGeometry *gHO = static_cast<const HcalGeometry *>(geo->getSubdetectorGeometry(DetId::Hcal, HcalOuter));
83  const HcalGeometry *gHF = static_cast<const HcalGeometry *>(geo->getSubdetectorGeometry(DetId::Hcal, HcalForward));
84 
85  nChannels_[1] = gHB->getHxSize(1);
86  nChannels_[2] = gHE->getHxSize(2);
87  nChannels_[3] = gHO->getHxSize(3);
88  nChannels_[4] = gHF->getHxSize(4);
89 
90  nChannels_[0] = nChannels_[1] + nChannels_[2] + nChannels_[3] + nChannels_[4];
91 
92  // std::cout << "Channels HB:" << nChannels_[1] << " HE:" << nChannels_[2] <<
93  // " HO:" << nChannels_[3] << " HF:" << nChannels_[4] << std::endl;
94 
95  // We hardcode the HF depths because in the dual readout configuration,
96  // rechits are not defined for depths 3&4
97  maxDepthHF_ = (maxDepthHF_ > 2 ? 2 : maxDepthHF_); // We retain the dynamic possibility
98  // that HF might have 0 or 1 depths
99 
102 
103  // Get Phi segmentation from geometry, use the max phi number so that all iphi
104  // values are included.
105 
106  int NphiMax = hcons->getNPhi(0);
107 
108  NphiMax = (hcons->getNPhi(1) > NphiMax ? hcons->getNPhi(1) : NphiMax);
109  NphiMax = (hcons->getNPhi(2) > NphiMax ? hcons->getNPhi(2) : NphiMax);
110  NphiMax = (hcons->getNPhi(3) > NphiMax ? hcons->getNPhi(3) : NphiMax);
111 
112  // Center the iphi bins on the integers
113  iphi_min_ = 0.5;
114  iphi_max_ = NphiMax + 0.5;
116 
117  // Retain classic behavior, all plots have same ieta range.
118 
119  int iEtaMax = (hcons->getEtaRange(0).second > hcons->getEtaRange(1).second ? hcons->getEtaRange(0).second
120  : hcons->getEtaRange(1).second);
121  iEtaMax = (iEtaMax > hcons->getEtaRange(2).second ? iEtaMax : hcons->getEtaRange(2).second);
122  iEtaMax = (iEtaMax > hcons->getEtaRange(3).second ? iEtaMax : hcons->getEtaRange(3).second);
123 
124  // Give an empty bin around the subdet ieta range to make it clear that all
125  // ieta rings have been included
126  ieta_min_ = -iEtaMax - 1.5;
127  ieta_max_ = iEtaMax + 1.5;
129 }
130 
132  edm::Run const & /* iRun*/,
133  edm::EventSetup const & /* iSetup */)
134 
135 {
136  Char_t histo[200];
137 
139 
140  // General counters (drawn)
141 
142  // Produce both a total per subdetector, and number of rechits per subdetector
143  // depth
144  // The bins are 1 unit wide, and the range is determined by the number of
145  // channels per subdetector
146 
147  for (int depth = 0; depth <= maxDepthHB_; depth++) {
148  if (depth == 0) {
149  sprintf(histo, "N_HB");
150  } else {
151  sprintf(histo, "N_HB_depth%d", depth);
152  }
153  int NBins = (int)(nChannels_[1] * 1.1);
154  Nhb.push_back(ibooker.book1D(histo, histo, NBins, 0., (float)NBins));
155  }
156  for (int depth = 0; depth <= maxDepthHE_; depth++) {
157  if (depth == 0) {
158  sprintf(histo, "N_HE");
159  } else {
160  sprintf(histo, "N_HE_depth%d", depth);
161  }
162  int NBins = (int)(nChannels_[2] * 1.1);
163  Nhe.push_back(ibooker.book1D(histo, histo, NBins, 0., (float)NBins));
164  }
165  for (int depth = 0; depth <= maxDepthHO_; depth++) {
166  if (depth == 0) {
167  sprintf(histo, "N_HO");
168  } else {
169  sprintf(histo, "N_HO_depth%d", depth);
170  }
171  int NBins = (int)(nChannels_[3] * 1.1);
172  Nho.push_back(ibooker.book1D(histo, histo, NBins, 0., (float)NBins));
173  }
174  for (int depth = 0; depth <= maxDepthHF_; depth++) {
175  if (depth == 0) {
176  sprintf(histo, "N_HF");
177  } else {
178  sprintf(histo, "N_HF_depth%d", depth);
179  }
180  int NBins = (int)(nChannels_[4] * 1.1);
181  Nhf.push_back(ibooker.book1D(histo, histo, NBins, 0., (float)NBins));
182  }
183 
184  // ZS
185  if (subdet_ == 6) {
186  }
187 
188  // ALL others, except ZS
189  else {
190  for (int depth = 1; depth <= maxDepthAll_; depth++) {
191  sprintf(histo, "emap_depth%d", depth);
192  emap.push_back(ibooker.book2D(histo, histo, ieta_bins_, ieta_min_, ieta_max_, iphi_bins_, iphi_min_, iphi_max_));
193  }
194  sprintf(histo, "emap_HO");
196 
197  // The mean energy histos are drawn, but not the RMS or emean seq
198 
199  for (int depth = 1; depth <= maxDepthHB_; depth++) {
200  sprintf(histo, "emean_vs_ieta_HB%d", depth);
201  emean_vs_ieta_HB.push_back(ibooker.bookProfile(histo, histo, ieta_bins_, ieta_min_, ieta_max_, -10., 2000., " "));
202 
203  sprintf(histo, "emean_vs_ieta_M0_HB%d", depth);
204  emean_vs_ieta_HBM0.push_back(
205  ibooker.bookProfile(histo, histo, ieta_bins_, ieta_min_, ieta_max_, -10., 2000., " "));
206 
207  sprintf(histo, "emean_vs_ieta_M3_HB%d", depth);
208  emean_vs_ieta_HBM3.push_back(
209  ibooker.bookProfile(histo, histo, ieta_bins_, ieta_min_, ieta_max_, -10., 2000., " "));
210  }
211  for (int depth = 1; depth <= maxDepthHE_; depth++) {
212  sprintf(histo, "emean_vs_ieta_HE%d", depth);
213  emean_vs_ieta_HE.push_back(ibooker.bookProfile(histo, histo, ieta_bins_, ieta_min_, ieta_max_, -10., 2000., " "));
214 
215  sprintf(histo, "emean_vs_ieta_M0_HE%d", depth);
216  emean_vs_ieta_HEM0.push_back(
217  ibooker.bookProfile(histo, histo, ieta_bins_, ieta_min_, ieta_max_, -10., 2000., " "));
218 
219  sprintf(histo, "emean_vs_ieta_M3_HE%d", depth);
220  emean_vs_ieta_HEM3.push_back(
221  ibooker.bookProfile(histo, histo, ieta_bins_, ieta_min_, ieta_max_, -10., 2000., " "));
222  }
223 
224  if (hep17_) {
225  for (int depth = 1; depth <= maxDepthHE_; depth++) {
226  sprintf(histo, "emean_vs_ieta_HEP17_depth%d", depth);
227  emean_vs_ieta_HEP17.push_back(
228  ibooker.bookProfile(histo, histo, ieta_bins_, ieta_min_, ieta_max_, -10., 2000., " "));
229 
230  sprintf(histo, "emean_vs_ieta_M0_HEP17_depth%d", depth);
231  emean_vs_ieta_HEP17M0.push_back(
232  ibooker.bookProfile(histo, histo, ieta_bins_, ieta_min_, ieta_max_, -10., 2000., " "));
233 
234  sprintf(histo, "emean_vs_ieta_M3_HEP17_depth%d", depth);
235  emean_vs_ieta_HEP17M3.push_back(
236  ibooker.bookProfile(histo, histo, ieta_bins_, ieta_min_, ieta_max_, -10., 2000., " "));
237  }
238  }
239 
240  for (int depth = 1; depth <= maxDepthHF_; depth++) {
241  sprintf(histo, "emean_vs_ieta_HF%d", depth);
242  emean_vs_ieta_HF.push_back(ibooker.bookProfile(histo, histo, ieta_bins_, ieta_min_, ieta_max_, -10., 2000., " "));
243  }
244  sprintf(histo, "emean_vs_ieta_HO");
245  emean_vs_ieta_HO = ibooker.bookProfile(histo, histo, ieta_bins_, ieta_min_, ieta_max_, -10., 2000., " ");
246 
247  // The only occupancy histos drawn are occupancy vs. ieta
248  // but the maps are needed because this is where the latter are filled from
249 
250  for (int depth = 1; depth <= maxDepthHB_; depth++) {
251  sprintf(histo, "occupancy_map_HB%d", depth);
252  occupancy_map_HB.push_back(
253  ibooker.book2D(histo, histo, ieta_bins_, ieta_min_, ieta_max_, iphi_bins_, iphi_min_, iphi_max_));
254  }
255 
256  for (int depth = 1; depth <= maxDepthHE_; depth++) {
257  sprintf(histo, "occupancy_map_HE%d", depth);
258  occupancy_map_HE.push_back(
259  ibooker.book2D(histo, histo, ieta_bins_, ieta_min_, ieta_max_, iphi_bins_, iphi_min_, iphi_max_));
260  }
261 
262  sprintf(histo, "occupancy_map_HO");
264 
265  for (int depth = 1; depth <= maxDepthHF_; depth++) {
266  sprintf(histo, "occupancy_map_HF%d", depth);
267  occupancy_map_HF.push_back(
268  ibooker.book2D(histo, histo, ieta_bins_, ieta_min_, ieta_max_, iphi_bins_, iphi_min_, iphi_max_));
269  }
270 
271  // nrechits vs iphi
272  for (int depth = 1; depth <= maxDepthHB_; depth++) {
273  sprintf(histo, "occupancy_vs_ieta_HB%d", depth);
274  occupancy_vs_ieta_HB.push_back(ibooker.book1D(histo, histo, ieta_bins_, ieta_min_, ieta_max_));
275  sprintf(histo, "nrechits_vs_iphi_HBP_d%d", depth);
276  nrechits_vs_iphi_HBP.push_back(ibooker.book1D(histo, histo, iphi_bins_, iphi_min_, iphi_max_));
277  sprintf(histo, "nrechits_vs_iphi_HBM_d%d", depth);
278  nrechits_vs_iphi_HBM.push_back(ibooker.book1D(histo, histo, iphi_bins_, iphi_min_, iphi_max_));
279  }
280 
281  for (int depth = 1; depth <= maxDepthHE_; depth++) {
282  sprintf(histo, "occupancy_vs_ieta_HE%d", depth);
283  occupancy_vs_ieta_HE.push_back(ibooker.book1D(histo, histo, ieta_bins_, ieta_min_, ieta_max_));
284  sprintf(histo, "nrechits_vs_iphi_HEP_d%d", depth);
285  nrechits_vs_iphi_HEP.push_back(ibooker.book1D(histo, histo, iphi_bins_, iphi_min_, iphi_max_));
286  sprintf(histo, "nrechits_vs_iphi_HEM_d%d", depth);
287  nrechits_vs_iphi_HEM.push_back(ibooker.book1D(histo, histo, iphi_bins_, iphi_min_, iphi_max_));
288  }
289 
290  sprintf(histo, "occupancy_vs_ieta_HO");
291  occupancy_vs_ieta_HO = ibooker.book1D(histo, histo, ieta_bins_, ieta_min_, ieta_max_);
292  sprintf(histo, "nrechits_vs_iphi_HOP");
293  nrechits_vs_iphi_HOP = ibooker.book1D(histo, histo, iphi_bins_, iphi_min_, iphi_max_);
294  sprintf(histo, "nrechits_vs_iphi_HOM");
295  nrechits_vs_iphi_HOM = ibooker.book1D(histo, histo, iphi_bins_, iphi_min_, iphi_max_);
296 
297  for (int depth = 1; depth <= maxDepthHF_; depth++) {
298  sprintf(histo, "occupancy_vs_ieta_HF%d", depth);
299  occupancy_vs_ieta_HF.push_back(ibooker.book1D(histo, histo, ieta_bins_, ieta_min_, ieta_max_));
300  sprintf(histo, "nrechits_vs_iphi_HFP_d%d", depth);
301  nrechits_vs_iphi_HFP.push_back(ibooker.book1D(histo, histo, iphi_bins_, iphi_min_, iphi_max_));
302  sprintf(histo, "nrechits_vs_iphi_HFM_d%d", depth);
303  nrechits_vs_iphi_HFM.push_back(ibooker.book1D(histo, histo, iphi_bins_, iphi_min_, iphi_max_));
304  }
305 
306  // All status word histos except HF67 are drawn
307  sprintf(histo, "HcalRecHitTask_RecHit_StatusWord_HB");
308  RecHit_StatusWord_HB = ibooker.book1DD(histo, histo, 32, -0.5, 31.5);
309 
310  sprintf(histo, "HcalRecHitTask_RecHit_StatusWord_HE");
311  RecHit_StatusWord_HE = ibooker.book1DD(histo, histo, 32, -0.5, 31.5);
312 
313  sprintf(histo, "HcalRecHitTask_RecHit_StatusWord_HF");
314  RecHit_StatusWord_HF = ibooker.book1DD(histo, histo, 32, -0.5, 31.5);
315 
316  sprintf(histo, "HcalRecHitTask_RecHit_StatusWord_HO");
317  RecHit_StatusWord_HO = ibooker.book1DD(histo, histo, 32, -0.5, 31.5);
318 
319  // Aux status word histos
320  sprintf(histo, "HcalRecHitTask_RecHit_Aux_StatusWord_HB");
321  RecHit_Aux_StatusWord_HB = ibooker.book1DD(histo, histo, 32, -0.5, 31.5);
322 
323  sprintf(histo, "HcalRecHitTask_RecHit_Aux_StatusWord_HE");
324  RecHit_Aux_StatusWord_HE = ibooker.book1DD(histo, histo, 32, -0.5, 31.5);
325 
326  sprintf(histo, "HcalRecHitTask_RecHit_Aux_StatusWord_HF");
327  RecHit_Aux_StatusWord_HF = ibooker.book1DD(histo, histo, 32, -0.5, 31.5);
328 
329  sprintf(histo, "HcalRecHitTask_RecHit_Aux_StatusWord_HO");
330  RecHit_Aux_StatusWord_HO = ibooker.book1DD(histo, histo, 32, -0.5, 31.5);
331 
332  } // end-of (subdet_ =! 6)
333 
334  // Status word correlations
335  sprintf(histo, "HcalRecHitTask_RecHit_StatusWordCorr_HB");
336  RecHit_StatusWordCorr_HB = ibooker.book2D(histo, histo, 2, -0.5, 1.5, 2, -0.5, 1.5);
337 
338  sprintf(histo, "HcalRecHitTask_RecHit_StatusWordCorr_HE");
339  RecHit_StatusWordCorr_HE = ibooker.book2D(histo, histo, 2, -0.5, 1.5, 2, -0.5, 1.5);
340 
341  //======================= Now various cases one by one ===================
342 
343  // Histograms drawn for single pion scan
344  if (subdet_ != 0 && imc != 0) { // just not for noise
345  sprintf(histo, "HcalRecHitTask_En_rechits_cone_profile_vs_ieta_all_depths");
346  meEnConeEtaProfile = ibooker.bookProfile(histo, histo, ieta_bins_, ieta_min_, ieta_max_, -100., 2000., " ");
347 
348  sprintf(histo, "HcalRecHitTask_En_rechits_cone_profile_vs_ieta_all_depths_E");
349  meEnConeEtaProfile_E = ibooker.bookProfile(histo, histo, ieta_bins_, ieta_min_, ieta_max_, -100., 2000., " ");
350 
351  sprintf(histo, "HcalRecHitTask_En_rechits_cone_profile_vs_ieta_all_depths_EH");
352  meEnConeEtaProfile_EH = ibooker.bookProfile(histo, histo, ieta_bins_, ieta_min_, ieta_max_, -100., 2000., " ");
353  }
354 
355  // ************** HB **********************************
356  if (subdet_ == 1 || subdet_ == 5) {
357  // Only severity level, energy of rechits and overall HB timing histos are
358  // drawn
359 
360  sprintf(histo, "HcalRecHitTask_severityLevel_HB");
361  sevLvl_HB = ibooker.book1DD(histo, histo, 25, -0.5, 24.5);
362 
363  sprintf(histo, "HcalRecHitTask_energy_of_rechits_HB");
364  meRecHitsEnergyHB = ibooker.book1DD(histo, histo, 2010, -10., 2000.);
365 
366  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M0_HB");
367  meRecHitsEnergyHBM0 = ibooker.book1DD(histo, histo, 2010, -10., 2000.);
368 
369  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M3_HB");
370  meRecHitsEnergyHBM3 = ibooker.book1DD(histo, histo, 2010, -10., 2000.);
371 
372  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M2vM0_HB");
373  meRecHitsEnergyM2vM0HB = ibooker.book2D(histo, histo, 42, -10., 200., 42, -10., 200.);
374 
375  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M3vM0_HB");
376  meRecHitsEnergyM3vM0HB = ibooker.book2D(histo, histo, 42, -10., 200., 42, -10., 200.);
377 
378  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M3vM2_HB");
379  meRecHitsEnergyM3vM2HB = ibooker.book2D(histo, histo, 42, -10., 200., 42, -10., 200.);
380 
381  sprintf(histo, "HcalRecHitTask_M2Log10Chi2_of_rechits_HB");
382  meRecHitsM2Chi2HB = ibooker.book1D(histo, histo, 120, -2., 10.);
383 
384  sprintf(histo, "HcalRecHitTask_timing_HB");
385  meTimeHB = ibooker.book1DD(histo, histo, 70, -48., 92.);
386 
387  // High, medium and low histograms to reduce RAM usage
388  sprintf(histo, "HcalRecHitTask_timing_vs_energy_Low_HB");
389  meTE_Low_HB = ibooker.book2D(histo, histo, 50, -5., 45., 70, -48., 92.);
390 
391  sprintf(histo, "HcalRecHitTask_timing_vs_energy_HB");
392  meTE_HB = ibooker.book2D(histo, histo, 150, -5., 295., 70, -48., 92.);
393 
394  sprintf(histo, "HcalRecHitTask_timing_vs_energy_High_HB");
395  meTE_High_HB = ibooker.book2D(histo, histo, 150, -5., 2995., 70, -48., 92.);
396 
397  sprintf(histo, "HcalRecHitTask_timing_vs_energy_profile_Low_HB");
398  meTEprofileHB_Low = ibooker.bookProfile(histo, histo, 50, -5., 45., -48., 92., " ");
399 
400  sprintf(histo, "HcalRecHitTask_timing_vs_energy_profile_HB");
401  meTEprofileHB = ibooker.bookProfile(histo, histo, 150, -5., 295., -48., 92., " ");
402 
403  sprintf(histo, "HcalRecHitTask_Log10Chi2_vs_energy_profile_HB");
404  meLog10Chi2profileHB = ibooker.bookProfile(histo, histo, 150, -5., 295., -2., 9.9, " ");
405 
406  sprintf(histo, "HcalRecHitTask_timing_vs_energy_profile_High_HB");
407  meTEprofileHB_High = ibooker.bookProfile(histo, histo, 150, -5., 2995., -48., 92., " ");
408  }
409 
410  // ********************** HE ************************************
411  if (subdet_ == 2 || subdet_ == 5) {
412  // Only severity level, energy of rechits and overall HB timing histos are
413  // drawn
414  sprintf(histo, "HcalRecHitTask_severityLevel_HE");
415  sevLvl_HE = ibooker.book1DD(histo, histo, 25, -0.5, 24.5);
416 
417  sprintf(histo, "HcalRecHitTask_energy_of_rechits_HE");
418  meRecHitsEnergyHE = ibooker.book1DD(histo, histo, 2010, -10., 2000.);
419 
420  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M0_HE");
421  meRecHitsEnergyHEM0 = ibooker.book1DD(histo, histo, 2010, -10., 2000.);
422 
423  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M3_HE");
424  meRecHitsEnergyHEM3 = ibooker.book1DD(histo, histo, 2010, -10., 2000.);
425 
426  if (hep17_) {
427  sprintf(histo, "HcalRecHitTask_energy_of_rechits_HEP17");
428  meRecHitsEnergyHEP17.push_back(ibooker.book1D(histo, histo, 2010, -10., 2000.));
429 
430  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M0_HEP17");
431  meRecHitsEnergyHEP17M0.push_back(ibooker.book1D(histo, histo, 2010, -10., 2000.));
432 
433  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M3_HEP17");
434  meRecHitsEnergyHEP17M3.push_back(ibooker.book1D(histo, histo, 2010, -10., 2000.));
435  for (int depth = 1; depth <= maxDepthHE_; depth++) {
436  sprintf(histo, "HcalRecHitTask_energy_of_rechits_HEP17_depth%d", depth);
437  meRecHitsEnergyHEP17.push_back(ibooker.book1D(histo, histo, 2010, -10., 2000.));
438 
439  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M0_HEP17_depth%d", depth);
440  meRecHitsEnergyHEP17M0.push_back(ibooker.book1D(histo, histo, 2010, -10., 2000.));
441 
442  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M3_HEP17_depth%d", depth);
443  meRecHitsEnergyHEP17M3.push_back(ibooker.book1D(histo, histo, 2010, -10., 2000.));
444  }
445  }
446 
447  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M2vM0_HE");
448  meRecHitsEnergyM2vM0HE = ibooker.book2D(histo, histo, 42, -10., 200., 42, -10., 200.);
449 
450  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M3vM0_HE");
451  meRecHitsEnergyM3vM0HE = ibooker.book2D(histo, histo, 42, -10., 200., 42, -10., 200.);
452 
453  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M3vM2_HE");
454  meRecHitsEnergyM3vM2HE = ibooker.book2D(histo, histo, 42, -10., 200., 42, -10., 200.);
455 
456  sprintf(histo, "HcalRecHitTask_M2Log10Chi2_of_rechits_HE");
457  meRecHitsM2Chi2HE = ibooker.book1D(histo, histo, 120, -2., 10.);
458 
459  sprintf(histo, "HcalRecHitTask_timing_HE");
460  meTimeHE = ibooker.book1DD(histo, histo, 70, -48., 92.);
461 
462  sprintf(histo, "HcalRecHitTask_timing_vs_energy_Low_HE");
463  meTE_Low_HE = ibooker.book2D(histo, histo, 80, -5., 75., 70, -48., 92.);
464 
465  sprintf(histo, "HcalRecHitTask_timing_vs_energy_HE");
466  meTE_HE = ibooker.book2D(histo, histo, 200, -5., 395., 70, -48., 92.);
467 
468  sprintf(histo, "HcalRecHitTask_timing_vs_energy_profile_Low_HE");
469  meTEprofileHE_Low = ibooker.bookProfile(histo, histo, 80, -5., 75., -48., 92., " ");
470 
471  sprintf(histo, "HcalRecHitTask_timing_vs_energy_profile_HE");
472  meTEprofileHE = ibooker.bookProfile(histo, histo, 200, -5., 395., -48., 92., " ");
473 
474  sprintf(histo, "HcalRecHitTask_Log10Chi2_vs_energy_profile_HE");
475  meLog10Chi2profileHE = ibooker.bookProfile(histo, histo, 200, -5., 395., -2., 9.9, " ");
476  }
477 
478  // ************** HO ****************************************
479  if (subdet_ == 3 || subdet_ == 5) {
480  // Only severity level, energy of rechits and overall HB timing histos are
481  // drawn
482 
483  sprintf(histo, "HcalRecHitTask_severityLevel_HO");
484  sevLvl_HO = ibooker.book1DD(histo, histo, 25, -0.5, 24.5);
485 
486  sprintf(histo, "HcalRecHitTask_energy_of_rechits_HO");
487  meRecHitsEnergyHO = ibooker.book1DD(histo, histo, 2010, -10., 2000.);
488 
489  sprintf(histo, "HcalRecHitTask_timing_HO");
490  meTimeHO = ibooker.book1DD(histo, histo, 70, -48., 92.);
491 
492  sprintf(histo, "HcalRecHitTask_timing_vs_energy_HO");
493  meTE_HO = ibooker.book2D(histo, histo, 60, -5., 55., 70, -48., 92.);
494 
495  sprintf(histo, "HcalRecHitTask_timing_vs_energy_High_HO");
496  meTE_High_HO = ibooker.book2D(histo, histo, 100, -5., 995., 70, -48., 92.);
497 
498  sprintf(histo, "HcalRecHitTask_timing_vs_energy_profile_HO");
499  meTEprofileHO = ibooker.bookProfile(histo, histo, 60, -5., 55., -48., 92., " ");
500 
501  sprintf(histo, "HcalRecHitTask_timing_vs_energy_profile_High_HO");
502  meTEprofileHO_High = ibooker.bookProfile(histo, histo, 100, -5., 995., -48., 92., " ");
503  }
504 
505  // ********************** HF ************************************
506  if (subdet_ == 4 || subdet_ == 5) {
507  // Only severity level, energy of rechits and overall HB timing histos are
508  // drawn
509 
510  sprintf(histo, "HcalRecHitTask_severityLevel_HF");
511  sevLvl_HF = ibooker.book1DD(histo, histo, 25, -0.5, 24.5);
512 
513  sprintf(histo, "HcalRecHitTask_energy_of_rechits_HF");
514  meRecHitsEnergyHF = ibooker.book1DD(histo, histo, 2010, -10., 2000.);
515 
516  sprintf(histo, "HcalRecHitTask_timing_HF");
517  meTimeHF = ibooker.book1DD(histo, histo, 70, -48., 92.);
518 
519  sprintf(histo, "HcalRecHitTask_timing_vs_energy_Low_HF");
520  meTE_Low_HF = ibooker.book2D(histo, histo, 100, -5., 195., 70, -48., 92.);
521 
522  sprintf(histo, "HcalRecHitTask_timing_vs_energy_HF");
523  meTE_HF = ibooker.book2D(histo, histo, 200, -5., 995., 70, -48., 92.);
524 
525  sprintf(histo, "HcalRecHitTask_timing_vs_energy_profile_Low_HF");
526  meTEprofileHF_Low = ibooker.bookProfile(histo, histo, 100, -5., 195., -48., 92., " ");
527 
528  sprintf(histo, "HcalRecHitTask_timing_vs_energy_profile_HF");
529  meTEprofileHF = ibooker.bookProfile(histo, histo, 200, -5., 995., -48., 92., " ");
530  }
531 }
532 
534  using namespace edm;
535 
536  // cuts for each subdet_ector mimiking "Scheme B"
537  // double cutHB = 0.9, cutHE = 1.4, cutHO = 1.1, cutHFL = 1.2, cutHFS = 1.8;
538 
539  // energy in HCAL
540  double eHcal = 0.;
541  // Total numbet of RecHits in HCAL, in the cone, above 1 GeV theshold
542  int nrechits = 0;
543  int nrechitsThresh = 0;
544 
545  // energy in ECAL
546  double eEcal = 0.;
547  double eEcalB = 0.;
548  double eEcalE = 0.;
549  double eEcalCone = 0.;
550 
551  // HCAL energy around MC eta-phi at all depths;
552  double partR = 0.3;
553 
554  // Single particle samples: actual eta-phi position of cluster around
555  // hottest cell
556  double etaHot = 99999.;
557  double phiHot = 99999.;
558 
559  // previously was: c.get<IdealGeometryRecord>().get (geometry);
560  c.get<CaloGeometryRecord>().get(geometry);
561 
562  // HCAL Topology **************************************************
564  c.get<HcalRecNumberingRecord>().get(topo);
565  theHcalTopology = topo.product();
566 
567  // HCAL channel status map ****************************************
569  c.get<HcalChannelQualityRcd>().get("withTopo", hcalChStatus);
570  theHcalChStatus = hcalChStatus.product();
571 
572  // Assignment of severity levels **********************************
573  edm::ESHandle<HcalSeverityLevelComputer> hcalSevLvlComputerHndl;
574  c.get<HcalSeverityLevelComputerRcd>().get(hcalSevLvlComputerHndl);
575  theHcalSevLvlComputer = hcalSevLvlComputerHndl.product();
576 
577  // Fill working vectors of HCAL RecHits quantities (all of these are drawn)
578  fillRecHitsTmp(subdet_, ev);
579 
580  // HB
581  if (subdet_ == 5 || subdet_ == 1) {
582  for (unsigned int iv = 0; iv < hcalHBSevLvlVec.size(); iv++) {
584  }
585  }
586  // HE
587  if (subdet_ == 5 || subdet_ == 2) {
588  for (unsigned int iv = 0; iv < hcalHESevLvlVec.size(); iv++) {
590  }
591  }
592  // HO
593  if (subdet_ == 5 || subdet_ == 3) {
594  for (unsigned int iv = 0; iv < hcalHOSevLvlVec.size(); iv++) {
596  }
597  }
598  // HF
599  if (subdet_ == 5 || subdet_ == 4) {
600  for (unsigned int iv = 0; iv < hcalHFSevLvlVec.size(); iv++) {
602  }
603  }
604 
605  //===========================================================================
606  // IN ALL other CASES : ieta-iphi maps
607  //===========================================================================
608 
609  // ECAL
610  if (ecalselector_ == "yes" && (subdet_ == 1 || subdet_ == 2 || subdet_ == 5)) {
612  if (ev.getByToken(tok_EB_, rhitEB)) {
613  for (const auto &recHit : *(rhitEB.product())) {
614  double en = recHit.energy();
615  eEcal += en;
616  eEcalB += en;
617  }
618  }
619 
621  if (ev.getByToken(tok_EE_, rhitEE)) {
622  for (const auto &recHit : *(rhitEE.product())) {
623  double en = recHit.energy();
624  eEcal += en;
625  eEcalE += en;
626  }
627  }
628  } // end of ECAL selection
629 
630  // Counting, including ZS items
631  // Filling HCAL maps ----------------------------------------------------
632  // double maxE = -99999.;
633 
634  // element 0: any depth. element 1,2,..: depth 1,2
635  std::vector<int> nhb_v(maxDepthHB_ + 1, 0);
636  std::vector<int> nhe_v(maxDepthHE_ + 1, 0);
637  std::vector<int> nho_v(maxDepthHO_ + 1, 0);
638  std::vector<int> nhf_v(maxDepthHF_ + 1, 0);
639 
640  for (unsigned int i = 0; i < cen.size(); i++) {
641  int sub = csub[i];
642  int depth = cdepth[i];
643  int ieta = cieta[i];
644  int iphi = ciphi[i];
645  double en = cen[i];
646  double enM0 = cenM0[i];
647  double enM3 = cenM3[i];
648  // double eta = ceta[i];
649  // double phi = cphi[i];
650  uint32_t stwd = cstwd[i];
651  uint32_t auxstwd = cauxstwd[i];
652  // double z = cz[i];
653 
654  // This will be true if hep17 == "yes" and the rechit is in the hep17 wedge
655  bool isHEP17 = (sub == 2) && (iphi >= 63) && (iphi <= 66) && (ieta > 0) && (hep17_);
656 
657  // Make sure that an invalid depth won't cause an error. We should probably
658  // report the problem as well.
659  if (depth < 1)
660  continue;
661  if (sub == 1 && depth > maxDepthHB_)
662  continue;
663  if (sub == 2 && depth > maxDepthHE_)
664  continue;
665  if (sub == 3 && depth > maxDepthHO_)
666  continue;
667  if (sub == 4 && depth > maxDepthHF_)
668  continue;
669 
670  if (sub == 1) {
671  nhb_v[depth]++;
672  nhb_v[0]++;
673  } // element 0: any depth, element 1,2,..: depth 1,2,...
674  if (sub == 2) {
675  nhe_v[depth]++;
676  nhe_v[0]++;
677  } //
678  if (sub == 3) {
679  nho_v[depth]++;
680  nho_v[0]++;
681  } //
682  if (sub == 4) {
683  nhf_v[depth]++;
684  nhf_v[0]++;
685  } //
686 
687  if (subdet_ == 6) { // ZS specific
688  }
689 
690  if (subdet_ != 6) {
691  int ieta2 = ieta;
692  int depth2 = depth;
693  if (sub == 4) {
694  if (ieta2 < 0)
695  ieta2--;
696  else
697  ieta2++;
698  }
699  if (sub == 3)
700  emap_HO->Fill(double(ieta2), double(iphi), en); // HO
701  else
702  emap[depth2 - 1]->Fill(double(ieta2), double(iphi), en); // HB+HE+HF
703 
704  // to distinguish HE and HF
705  if (depth == 1 || depth == 2) {
706  int ieta1 = ieta;
707  if (sub == 4) {
708  if (ieta1 < 0)
709  ieta1--;
710  else
711  ieta1++;
712  }
713  }
714 
715  if (sub == 1) {
716  emean_vs_ieta_HB[depth - 1]->Fill(double(ieta), en);
717  emean_vs_ieta_HBM0[depth - 1]->Fill(double(ieta), enM0);
718  emean_vs_ieta_HBM3[depth - 1]->Fill(double(ieta), enM3);
719  occupancy_map_HB[depth - 1]->Fill(double(ieta), double(iphi));
720  if (ieta > 0)
721  nrechits_vs_iphi_HBP[depth - 1]->Fill(double(iphi));
722  else
723  nrechits_vs_iphi_HBM[depth - 1]->Fill(double(iphi));
724  }
725  if (sub == 2) {
726  if (!isHEP17) {
727  emean_vs_ieta_HE[depth - 1]->Fill(double(ieta), en);
728  emean_vs_ieta_HEM0[depth - 1]->Fill(double(ieta), enM0);
729  emean_vs_ieta_HEM3[depth - 1]->Fill(double(ieta), enM3);
730  } else {
731  emean_vs_ieta_HEP17[depth - 1]->Fill(double(ieta), en);
732  emean_vs_ieta_HEP17M0[depth - 1]->Fill(double(ieta), enM0);
733  emean_vs_ieta_HEP17M3[depth - 1]->Fill(double(ieta), enM3);
734  }
735  occupancy_map_HE[depth - 1]->Fill(double(ieta), double(iphi));
736  if (ieta > 0)
737  nrechits_vs_iphi_HEP[depth - 1]->Fill(double(iphi));
738  else
739  nrechits_vs_iphi_HEM[depth - 1]->Fill(double(iphi));
740  }
741  if (sub == 3) {
742  emean_vs_ieta_HO->Fill(double(ieta), en);
743  occupancy_map_HO->Fill(double(ieta), double(iphi));
744  if (ieta > 0)
745  nrechits_vs_iphi_HOP->Fill(double(iphi));
746  else
747  nrechits_vs_iphi_HOM->Fill(double(iphi));
748  }
749  if (sub == 4) {
750  emean_vs_ieta_HF[depth - 1]->Fill(double(ieta), en);
751  occupancy_map_HF[depth - 1]->Fill(double(ieta), double(iphi));
752  if (ieta > 0)
753  nrechits_vs_iphi_HFP[depth - 1]->Fill(double(iphi));
754  else
755  nrechits_vs_iphi_HFM[depth - 1]->Fill(double(iphi));
756  }
757  }
758 
759  // 32-bit status word
760  uint32_t statadd;
761  unsigned int isw67 = 0;
762 
763  // Statusword correlation
764  unsigned int sw27 = 27;
765  unsigned int sw13 = 13;
766 
767  uint32_t statadd27 = 0x1 << sw27;
768  uint32_t statadd13 = 0x1 << sw13;
769 
770  float status27 = 0;
771  float status13 = 0;
772 
773  if (stwd & statadd27)
774  status27 = 1;
775  if (stwd & statadd13)
776  status13 = 1;
777 
778  if (sub == 1) {
779  RecHit_StatusWordCorr_HB->Fill(status13, status27);
780  } else if (sub == 2) {
781  RecHit_StatusWordCorr_HE->Fill(status13, status27);
782  }
783 
784  for (unsigned int isw = 0; isw < 32; isw++) {
785  statadd = 0x1 << (isw);
786  if (stwd & statadd) {
787  if (sub == 1)
789  else if (sub == 2)
791  else if (sub == 3)
793  else if (sub == 4) {
795  if (isw == 6)
796  isw67 += 1;
797  if (isw == 7)
798  isw67 += 2;
799  }
800  }
801  }
802 
803  for (unsigned int isw = 0; isw < 32; isw++) {
804  statadd = 0x1 << (isw);
805  if (auxstwd & statadd) {
806  if (sub == 1)
808  else if (sub == 2)
810  else if (sub == 3)
812  else if (sub == 4)
814  }
815  }
816  }
817 
818  for (int depth = 0; depth <= maxDepthHB_; depth++)
819  Nhb[depth]->Fill(double(nhb_v[depth]));
820  for (int depth = 0; depth <= maxDepthHE_; depth++)
821  Nhe[depth]->Fill(double(nhe_v[depth]));
822  for (int depth = 0; depth <= maxDepthHO_; depth++)
823  Nho[depth]->Fill(double(nho_v[depth]));
824  for (int depth = 0; depth <= maxDepthHF_; depth++)
825  Nhf[depth]->Fill(double(nhf_v[depth]));
826 
827  //===========================================================================
828  // SUBSYSTEMS,
829  //===========================================================================
830 
831  if ((subdet_ != 6) && (subdet_ != 0)) {
832  double clusEta = 999.;
833  double clusPhi = 999.;
834  double clusEn = 0.;
835 
836  double HcalCone = 0.;
837 
838  int ietaMax = 9999;
839  // double enMax1 = -9999.;
840  // double enMax2 = -9999.;
841  // double enMax3 = -9999.;
842  // double enMax4 = -9999.;
843  // double enMax = -9999.;
844  // double etaMax = 9999.;
845 
846  // CYCLE over cells ====================================================
847 
848  for (unsigned int i = 0; i < cen.size(); i++) {
849  int sub = csub[i];
850  double eta = ceta[i];
851  double phi = cphi[i];
852  double ieta = cieta[i];
853  double iphi = ciphi[i];
854  double en = cen[i];
855  double enM0 = cenM0[i];
856  double enM3 = cenM3[i];
857  double chi2 = cchi2[i];
858  double chi2_log10 = 9.99; // initial value - stay with this value if chi2<0.
859  if (chi2 > 0.)
860  chi2_log10 = log10(chi2);
861  double t = ctime[i];
862  double depth = cdepth[i];
863 
864  bool isHEP17 = (sub == 2) && (iphi >= 63) && (iphi <= 66) && (ieta > 0) && (hep17_);
865 
866  // int ieta = cieta[i];
867 
868  double rhot = dR(etaHot, phiHot, eta, phi);
869  if (rhot < partR && en > 1.) {
870  clusEta = (clusEta * clusEn + eta * en) / (clusEn + en);
871  clusPhi = phi12(clusPhi, clusEn, phi, en);
872  clusEn += en;
873  }
874 
875  nrechits++;
876  eHcal += en;
877 
878  if (en > 1.)
879  nrechitsThresh++;
880 
881  // The energy and overall timing histos are drawn while
882  // the ones split by depth are not
883  if (sub == 1 && (subdet_ == 1 || subdet_ == 5)) {
884  meTimeHB->Fill(t);
885  meRecHitsEnergyHB->Fill(en);
886  meRecHitsEnergyHBM0->Fill(enM0);
887  meRecHitsEnergyHBM3->Fill(enM3);
888 
889  meRecHitsEnergyM2vM0HB->Fill(enM0, en);
890  meRecHitsEnergyM3vM0HB->Fill(enM0, enM3);
891  meRecHitsEnergyM3vM2HB->Fill(en, enM3);
892 
893  meRecHitsM2Chi2HB->Fill(chi2_log10);
894  meLog10Chi2profileHB->Fill(en, chi2_log10);
895 
896  meTE_Low_HB->Fill(en, t);
897  meTE_HB->Fill(en, t);
898  meTE_High_HB->Fill(en, t);
899  meTEprofileHB_Low->Fill(en, t);
900  meTEprofileHB->Fill(en, t);
901  meTEprofileHB_High->Fill(en, t);
902  }
903  if (sub == 2 && (subdet_ == 2 || subdet_ == 5)) {
904  meTimeHE->Fill(t);
905  if (!isHEP17) {
906  meRecHitsEnergyHE->Fill(en);
907  meRecHitsEnergyHEM0->Fill(enM0);
908  meRecHitsEnergyHEM3->Fill(enM3);
909  } else {
910  meRecHitsEnergyHEP17[0]->Fill(en);
911  meRecHitsEnergyHEP17M0[0]->Fill(enM0);
912  meRecHitsEnergyHEP17M3[0]->Fill(enM3);
913  meRecHitsEnergyHEP17[depth]->Fill(en);
914  meRecHitsEnergyHEP17M0[depth]->Fill(enM0);
915  meRecHitsEnergyHEP17M3[depth]->Fill(enM3);
916  }
917 
918  meRecHitsEnergyM2vM0HE->Fill(enM0, en);
919  meRecHitsEnergyM3vM0HE->Fill(enM0, enM3);
920  meRecHitsEnergyM3vM2HE->Fill(en, enM3);
921 
922  meRecHitsM2Chi2HE->Fill(chi2_log10);
923  meLog10Chi2profileHE->Fill(en, chi2_log10);
924 
925  meTE_Low_HE->Fill(en, t);
926  meTE_HE->Fill(en, t);
927  meTEprofileHE_Low->Fill(en, t);
928  meTEprofileHE->Fill(en, t);
929  }
930  if (sub == 4 && (subdet_ == 4 || subdet_ == 5)) {
931  meTimeHF->Fill(t);
932  meRecHitsEnergyHF->Fill(en);
933 
934  meTE_Low_HF->Fill(en, t);
935  meTE_HF->Fill(en, t);
936  meTEprofileHF_Low->Fill(en, t);
937  meTEprofileHF->Fill(en, t);
938  }
939  if (sub == 3 && (subdet_ == 3 || subdet_ == 5)) {
940  meTimeHO->Fill(t);
941  meRecHitsEnergyHO->Fill(en);
942 
943  meTE_HO->Fill(en, t);
944  meTE_High_HO->Fill(en, t);
945  meTEprofileHO->Fill(en, t);
946  meTEprofileHO_High->Fill(en, t);
947  }
948  }
949 
950  if (imc != 0) {
951  // Cone by depth are not drawn, the others are used for pion scan
952  meEnConeEtaProfile->Fill(double(ietaMax), HcalCone); //
953  meEnConeEtaProfile_E->Fill(double(ietaMax), eEcalCone);
954  meEnConeEtaProfile_EH->Fill(double(ietaMax), HcalCone + eEcalCone);
955  }
956 
957  // Single particle samples ONLY ! ======================================
958  // Fill up some histos for "integrated" subsustems.
959  // These are not drawn
960  }
961 
962  nevtot++;
963 }
964 
967  using namespace edm;
968 
969  // initialize data vectors
970  csub.clear();
971  cen.clear();
972  cenM0.clear();
973  cenM3.clear();
974  cchi2.clear();
975  ceta.clear();
976  cphi.clear();
977  ctime.clear();
978  cieta.clear();
979  ciphi.clear();
980  cdepth.clear();
981  cz.clear();
982  cstwd.clear();
983  cauxstwd.clear();
984  hcalHBSevLvlVec.clear();
985  hcalHESevLvlVec.clear();
986  hcalHFSevLvlVec.clear();
987  hcalHOSevLvlVec.clear();
988 
989  if (subdet_ == 1 || subdet_ == 2 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
990  // HBHE
992  if (ev.getByToken(tok_hbhe_, hbhecoll)) {
993  for (HBHERecHitCollection::const_iterator j = hbhecoll->begin(); j != hbhecoll->end(); j++) {
994  HcalDetId cell(j->id());
995  const HcalGeometry *cellGeometry = dynamic_cast<const HcalGeometry *>(geometry->getSubdetectorGeometry(cell));
996  double eta = cellGeometry->getPosition(cell).eta();
997  double phi = cellGeometry->getPosition(cell).phi();
998  double zc = cellGeometry->getPosition(cell).z();
999  int sub = cell.subdet();
1000  int depth = cell.depth();
1001  int inteta = cell.ieta();
1002  int intphi = cell.iphi();
1003  double en = j->energy();
1004  double enM0 = j->eraw();
1005  double enM3 = j->eaux();
1006  double chi2 = j->chi2();
1007  double t = j->time();
1008  int stwd = j->flags();
1009  int auxstwd = j->aux();
1010 
1011  int severityLevel = hcalSevLvl((CaloRecHit *)&*j);
1012  if (cell.subdet() == HcalBarrel) {
1013  hcalHBSevLvlVec.push_back(severityLevel);
1014  } else if (cell.subdet() == HcalEndcap) {
1015  hcalHESevLvlVec.push_back(severityLevel);
1016  }
1017 
1018  if ((iz > 0 && eta > 0.) || (iz < 0 && eta < 0.) || iz == 0) {
1019  csub.push_back(sub);
1020  cen.push_back(en);
1021  cenM0.push_back(enM0);
1022  cenM3.push_back(enM3);
1023  cchi2.push_back(chi2);
1024  ceta.push_back(eta);
1025  cphi.push_back(phi);
1026  ctime.push_back(t);
1027  cieta.push_back(inteta);
1028  ciphi.push_back(intphi);
1029  cdepth.push_back(depth);
1030  cz.push_back(zc);
1031  cstwd.push_back(stwd);
1032  cauxstwd.push_back(auxstwd);
1033  }
1034  }
1035  }
1036  }
1037 
1038  if (subdet_ == 4 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
1039  // HF
1041  if (ev.getByToken(tok_hf_, hfcoll)) {
1042  for (HFRecHitCollection::const_iterator j = hfcoll->begin(); j != hfcoll->end(); j++) {
1043  HcalDetId cell(j->id());
1044  auto cellGeometry = (geometry->getSubdetectorGeometry(cell))->getGeometry(cell);
1045  double eta = cellGeometry->getPosition().eta();
1046  double phi = cellGeometry->getPosition().phi();
1047  double zc = cellGeometry->getPosition().z();
1048  int sub = cell.subdet();
1049  int depth = cell.depth();
1050  int inteta = cell.ieta();
1051  int intphi = cell.iphi();
1052  double en = j->energy();
1053  double enM0 = 0.;
1054  double enM3 = 0.;
1055  double chi2 = 0.;
1056  double t = j->time();
1057  int stwd = j->flags();
1058  int auxstwd = j->aux();
1059 
1060  int severityLevel = hcalSevLvl((CaloRecHit *)&*j);
1061  if (cell.subdet() == HcalForward) {
1062  hcalHFSevLvlVec.push_back(severityLevel);
1063  }
1064 
1065  if ((iz > 0 && eta > 0.) || (iz < 0 && eta < 0.) || iz == 0) {
1066  csub.push_back(sub);
1067  cen.push_back(en);
1068  cenM0.push_back(enM0);
1069  cenM3.push_back(enM3);
1070  cchi2.push_back(chi2);
1071  ceta.push_back(eta);
1072  cphi.push_back(phi);
1073  ctime.push_back(t);
1074  cieta.push_back(inteta);
1075  ciphi.push_back(intphi);
1076  cdepth.push_back(depth);
1077  cz.push_back(zc);
1078  cstwd.push_back(stwd);
1079  cauxstwd.push_back(auxstwd);
1080  }
1081  }
1082  }
1083  }
1084 
1085  // HO
1086  if (subdet_ == 3 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
1088  if (ev.getByToken(tok_ho_, hocoll)) {
1089  for (HORecHitCollection::const_iterator j = hocoll->begin(); j != hocoll->end(); j++) {
1090  HcalDetId cell(j->id());
1091  auto cellGeometry = (geometry->getSubdetectorGeometry(cell))->getGeometry(cell);
1092  double eta = cellGeometry->getPosition().eta();
1093  double phi = cellGeometry->getPosition().phi();
1094  double zc = cellGeometry->getPosition().z();
1095  int sub = cell.subdet();
1096  int depth = cell.depth();
1097  int inteta = cell.ieta();
1098  int intphi = cell.iphi();
1099  double t = j->time();
1100  double en = j->energy();
1101  double enM0 = 0.;
1102  double enM3 = 0.;
1103  double chi2 = 0.;
1104  int stwd = j->flags();
1105  int auxstwd = j->aux();
1106 
1107  int severityLevel = hcalSevLvl((CaloRecHit *)&*j);
1108  if (cell.subdet() == HcalOuter) {
1109  hcalHOSevLvlVec.push_back(severityLevel);
1110  }
1111 
1112  if ((iz > 0 && eta > 0.) || (iz < 0 && eta < 0.) || iz == 0) {
1113  csub.push_back(sub);
1114  cen.push_back(en);
1115  cenM0.push_back(enM0);
1116  cenM3.push_back(enM3);
1117  cchi2.push_back(chi2);
1118  ceta.push_back(eta);
1119  cphi.push_back(phi);
1120  ctime.push_back(t);
1121  cieta.push_back(inteta);
1122  ciphi.push_back(intphi);
1123  cdepth.push_back(depth);
1124  cz.push_back(zc);
1125  cstwd.push_back(stwd);
1126  cauxstwd.push_back(auxstwd);
1127  }
1128  }
1129  }
1130  }
1131 }
1132 
1133 double HcalRecHitsAnalyzer::dR(double eta1, double phi1, double eta2, double phi2) {
1134  double PI = 3.1415926535898;
1135  double deltaphi = phi1 - phi2;
1136  if (phi2 > phi1) {
1137  deltaphi = phi2 - phi1;
1138  }
1139  if (deltaphi > PI) {
1140  deltaphi = 2. * PI - deltaphi;
1141  }
1142  double deltaeta = eta2 - eta1;
1143  double tmp = sqrt(deltaeta * deltaeta + deltaphi * deltaphi);
1144  return tmp;
1145 }
1146 
1147 double HcalRecHitsAnalyzer::phi12(double phi1, double en1, double phi2, double en2) {
1148  // weighted mean value of phi1 and phi2
1149 
1150  double tmp;
1151  double PI = 3.1415926535898;
1152  double a1 = phi1;
1153  double a2 = phi2;
1154 
1155  if (a1 > 0.5 * PI && a2 < 0.)
1156  a2 += 2 * PI;
1157  if (a2 > 0.5 * PI && a1 < 0.)
1158  a1 += 2 * PI;
1159  tmp = (a1 * en1 + a2 * en2) / (en1 + en2);
1160  if (tmp > PI)
1161  tmp -= 2. * PI;
1162 
1163  return tmp;
1164 }
1165 
1166 double HcalRecHitsAnalyzer::dPhiWsign(double phi1, double phi2) {
1167  // clockwise phi2 w.r.t phi1 means "+" phi distance
1168  // anti-clockwise phi2 w.r.t phi1 means "-" phi distance
1169 
1170  double PI = 3.1415926535898;
1171  double a1 = phi1;
1172  double a2 = phi2;
1173  double tmp = a2 - a1;
1174  if (a1 * a2 < 0.) {
1175  if (a1 > 0.5 * PI)
1176  tmp += 2. * PI;
1177  if (a2 > 0.5 * PI)
1178  tmp -= 2. * PI;
1179  }
1180  return tmp;
1181 }
1182 
1184  HcalDetId id = hit->detid();
1185  if (theHcalTopology->getMergePositionFlag() && id.subdet() == HcalEndcap) {
1186  id = theHcalTopology->idFront(id);
1187  }
1188 
1189  const uint32_t recHitFlag = hit->flags();
1190  const uint32_t dbStatusFlag = theHcalChStatus->getValues(id)->getValue();
1191 
1192  int severityLevel = theHcalSevLvlComputer->getSeverityLevel(id, recHitFlag, dbStatusFlag);
1193 
1194  return severityLevel;
1195 }
1196 
MonitorElement * nrechits_vs_iphi_HOP
MonitorElement * sevLvl_HF
std::vector< MonitorElement * > emean_vs_ieta_HEP17M3
T getParameter(std::string const &) const
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:49
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * meTEprofileHB_High
MonitorElement * RecHit_StatusWord_HE
std::vector< int > csub
MonitorElement * meRecHitsM2Chi2HB
MonitorElement * meTimeHF
std::vector< double > cphi
std::vector< int > hcalHOSevLvlVec
double dR(double eta1, double phi1, double eta2, double phi2)
MonitorElement * RecHit_StatusWord_HF
MonitorElement * meRecHitsEnergyM3vM2HE
std::vector< MonitorElement * > Nho
std::vector< MonitorElement * > emean_vs_ieta_HBM3
MonitorElement * sevLvl_HE
std::vector< MonitorElement * > occupancy_vs_ieta_HB
MonitorElement * RecHit_Aux_StatusWord_HO
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:113
unsigned int getHxSize(const int type) const
double dPhiWsign(double phi1, double phi2)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
MonitorElement * meTE_Low_HE
constexpr const DetId & detid() const
Definition: CaloRecHit.h:35
MonitorElement * meRecHitsEnergyHEM3
std::vector< int > cdepth
std::vector< MonitorElement * > occupancy_map_HE
const HcalTopology * theHcalTopology
int hcalSevLvl(const CaloRecHit *hit)
std::vector< T >::const_iterator const_iterator
std::vector< int > hcalHBSevLvlVec
bool ev
MonitorElement * occupancy_map_HO
const Item * getValues(DetId fId, bool throwOnFail=true) const
std::vector< MonitorElement * > occupancy_map_HF
std::vector< double > ceta
edm::EDGetTokenT< EBRecHitCollection > tok_EB_
MonitorElement * meEnConeEtaProfile_EH
CaloGeometry const * getGeometry()
std::vector< int > hcalHESevLvlVec
double phi12(double phi1, double en1, double phi2, double en2)
bool getMergePositionFlag() const
Definition: HcalTopology.h:171
MonitorElement * meRecHitsEnergyM3vM0HE
std::vector< MonitorElement * > Nhe
MonitorElement * meTE_Low_HB
std::pair< int, int > getEtaRange(const int &i) const
MonitorElement * meTEprofileHF_Low
const HcalSeverityLevelComputer * theHcalSevLvlComputer
std::vector< MonitorElement * > Nhf
MonitorElement * meTE_HB
MonitorElement * meRecHitsEnergyM2vM0HB
std::vector< MonitorElement * > nrechits_vs_iphi_HEP
void Fill(long long x)
MonitorElement * sevLvl_HO
virtual void fillRecHitsTmp(int subdet_, edm::Event const &ev)
std::vector< MonitorElement * > emean_vs_ieta_HEP17
std::vector< MonitorElement * > emean_vs_ieta_HBM0
MonitorElement * meRecHitsEnergyM2vM0HE
std::vector< MonitorElement * > occupancy_vs_ieta_HF
MonitorElement * emap_HO
std::vector< MonitorElement * > occupancy_vs_ieta_HE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::vector< MonitorElement * > emean_vs_ieta_HB
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * meTE_HO
const HcalChannelQuality * theHcalChStatus
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
std::vector< MonitorElement * > occupancy_map_HB
MonitorElement * meEnConeEtaProfile_E
T sqrt(T t)
Definition: SSEVec.h:18
std::vector< MonitorElement * > emap
std::vector< MonitorElement * > nrechits_vs_iphi_HFP
MonitorElement * meTEprofileHO
MonitorElement * meTEprofileHB
edm::EDGetTokenT< HORecHitCollection > tok_ho_
std::vector< double > cchi2
MonitorElement * meLog10Chi2profileHE
std::vector< MonitorElement * > nrechits_vs_iphi_HFM
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
MonitorElement * meRecHitsEnergyHBM0
MonitorElement * meTE_High_HO
MonitorElement * meRecHitsEnergyHO
MonitorElement * meRecHitsM2Chi2HE
MonitorElement * meTE_HF
std::vector< uint32_t > cauxstwd
MonitorElement * meRecHitsEnergyHEM0
MonitorElement * occupancy_vs_ieta_HO
MonitorElement * meTEprofileHE_Low
MonitorElement * RecHit_StatusWord_HO
MonitorElement * meRecHitsEnergyHB
std::vector< MonitorElement * > emean_vs_ieta_HE
std::vector< int > ciphi
MonitorElement * nrechits_vs_iphi_HOM
MonitorElement * emean_vs_ieta_HO
MonitorElement * sevLvl_HB
std::vector< MonitorElement * > emean_vs_ieta_HEP17M0
#define PI
Definition: QcdUeDQM.h:36
std::vector< double > cz
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
std::vector< MonitorElement * > nrechits_vs_iphi_HBP
const_iterator end() const
MonitorElement * meTimeHE
std::vector< int > cieta
std::vector< MonitorElement * > nrechits_vs_iphi_HEM
MonitorElement * meTimeHO
MonitorElement * meRecHitsEnergyHF
std::vector< double > cenM3
HcalRecHitsAnalyzer(edm::ParameterSet const &conf)
MonitorElement * meEnConeEtaProfile
std::vector< MonitorElement * > emean_vs_ieta_HEM3
MonitorElement * meTEprofileHE
std::vector< uint32_t > cstwd
T const * product() const
Definition: Handle.h:74
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109
std::vector< MonitorElement * > meRecHitsEnergyHEP17
MonitorElement * RecHit_Aux_StatusWord_HB
void analyze(edm::Event const &ev, edm::EventSetup const &c) override
void dqmBeginRun(const edm::Run &run, const edm::EventSetup &c) override
int getMaxDepth(const int &type) const
std::vector< MonitorElement * > emean_vs_ieta_HF
MonitorElement * meRecHitsEnergyM3vM2HB
int getSeverityLevel(const DetId &myid, const uint32_t &myflag, const uint32_t &mystatus) const
edm::EDGetTokenT< HFRecHitCollection > tok_hf_
std::vector< MonitorElement * > meRecHitsEnergyHEP17M0
MonitorElement * meLog10Chi2profileHB
std::vector< MonitorElement * > nrechits_vs_iphi_HBM
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
MonitorElement * meTE_High_HB
std::vector< int > hcalHFSevLvlVec
MonitorElement * RecHit_StatusWord_HB
HLT enums.
MonitorElement * meTEprofileHO_High
T get() const
Definition: EventSetup.h:71
const HcalDDDRecConstants * hcons
MonitorElement * meTEprofileHB_Low
edm::EDGetTokenT< EERecHitCollection > tok_EE_
std::vector< MonitorElement * > Nhb
std::vector< double > ctime
std::vector< double > cen
MonitorElement * meRecHitsEnergyM3vM0HB
HcalDetId idFront(const HcalDetId &id) const
Definition: HcalTopology.h:177
MonitorElement * meRecHitsEnergyHBM3
std::vector< double > cenM0
MonitorElement * RecHit_StatusWordCorr_HE
MonitorElement * meTimeHB
MonitorElement * meTEprofileHF
MonitorElement * RecHit_Aux_StatusWord_HF
MonitorElement * RecHit_Aux_StatusWord_HE
uint32_t getValue() const
MonitorElement * book1DD(Args &&...args)
Definition: DQMStore.h:108
T const * product() const
Definition: ESHandle.h:86
constexpr uint32_t flags() const
Definition: CaloRecHit.h:36
MonitorElement * RecHit_StatusWordCorr_HB
std::vector< MonitorElement * > meRecHitsEnergyHEP17M3
edm::ESHandle< CaloGeometry > geometry
const_iterator begin() const
Definition: Run.h:45
int getNPhi(const int &type) const
MonitorElement * meTE_HE
std::vector< MonitorElement * > emean_vs_ieta_HEM0
MonitorElement * meRecHitsEnergyHE
MonitorElement * meTE_Low_HF