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] = std::max(int(gHE->getHxSize(2)), 1);
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 
100  maxDepthAll_ = (maxDepthHB_ + maxDepthHO_ > maxDepthHE_ ? maxDepthHB_ + maxDepthHO_ : maxDepthHE_);
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_cleaned_energy_of_rechits_HB");
367  meRecHitsCleanedEnergyHB = ibooker.book1DD(histo, histo, 2010, -10., 2000.);
368 
369  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M0_HB");
370  meRecHitsEnergyHBM0 = ibooker.book1DD(histo, histo, 2010, -10., 2000.);
371 
372  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M3_HB");
373  meRecHitsEnergyHBM3 = ibooker.book1DD(histo, histo, 2010, -10., 2000.);
374 
375  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M2vM0_HB");
376  meRecHitsEnergyM2vM0HB = ibooker.book2D(histo, histo, 42, -10., 200., 42, -10., 200.);
377 
378  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M3vM0_HB");
379  meRecHitsEnergyM3vM0HB = ibooker.book2D(histo, histo, 42, -10., 200., 42, -10., 200.);
380 
381  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M3vM2_HB");
382  meRecHitsEnergyM3vM2HB = ibooker.book2D(histo, histo, 42, -10., 200., 42, -10., 200.);
383 
384  sprintf(histo, "HcalRecHitTask_M2Log10Chi2_of_rechits_HB");
385  meRecHitsM2Chi2HB = ibooker.book1D(histo, histo, 120, -2., 10.);
386 
387  sprintf(histo, "HcalRecHitTask_timing_HB");
388  meTimeHB = ibooker.book1DD(histo, histo, 70, -48., 92.);
389 
390  // High, medium and low histograms to reduce RAM usage
391  sprintf(histo, "HcalRecHitTask_timing_vs_energy_Low_HB");
392  meTE_Low_HB = ibooker.book2D(histo, histo, 50, -5., 45., 70, -48., 92.);
393 
394  sprintf(histo, "HcalRecHitTask_timing_vs_energy_HB");
395  meTE_HB = ibooker.book2D(histo, histo, 150, -5., 295., 70, -48., 92.);
396 
397  sprintf(histo, "HcalRecHitTask_timing_vs_energy_High_HB");
398  meTE_High_HB = ibooker.book2D(histo, histo, 150, -5., 2995., 70, -48., 92.);
399 
400  sprintf(histo, "HcalRecHitTask_timing_vs_energy_profile_Low_HB");
401  meTEprofileHB_Low = ibooker.bookProfile(histo, histo, 50, -5., 45., -48., 92., " ");
402 
403  sprintf(histo, "HcalRecHitTask_timing_vs_energy_profile_HB");
404  meTEprofileHB = ibooker.bookProfile(histo, histo, 150, -5., 295., -48., 92., " ");
405 
406  sprintf(histo, "HcalRecHitTask_Log10Chi2_vs_energy_profile_HB");
407  meLog10Chi2profileHB = ibooker.bookProfile(histo, histo, 150, -5., 295., -2., 9.9, " ");
408 
409  sprintf(histo, "HcalRecHitTask_timing_vs_energy_profile_High_HB");
410  meTEprofileHB_High = ibooker.bookProfile(histo, histo, 150, -5., 2995., -48., 92., " ");
411  }
412 
413  // ********************** HE ************************************
414  if (subdet_ == 2 || subdet_ == 5) {
415  // Only severity level, energy of rechits and overall HB timing histos are
416  // drawn
417  sprintf(histo, "HcalRecHitTask_severityLevel_HE");
418  sevLvl_HE = ibooker.book1DD(histo, histo, 25, -0.5, 24.5);
419 
420  sprintf(histo, "HcalRecHitTask_energy_of_rechits_HE");
421  meRecHitsEnergyHE = ibooker.book1DD(histo, histo, 2010, -10., 2000.);
422 
423  sprintf(histo, "HcalRecHitTask_cleaned_energy_of_rechits_HE");
424  meRecHitsCleanedEnergyHE = ibooker.book1DD(histo, histo, 2010, -10., 2000.);
425 
426  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M0_HE");
427  meRecHitsEnergyHEM0 = ibooker.book1DD(histo, histo, 2010, -10., 2000.);
428 
429  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M3_HE");
430  meRecHitsEnergyHEM3 = ibooker.book1DD(histo, histo, 2010, -10., 2000.);
431 
432  if (hep17_) {
433  sprintf(histo, "HcalRecHitTask_energy_of_rechits_HEP17");
434  meRecHitsEnergyHEP17.push_back(ibooker.book1D(histo, histo, 2010, -10., 2000.));
435 
436  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M0_HEP17");
437  meRecHitsEnergyHEP17M0.push_back(ibooker.book1D(histo, histo, 2010, -10., 2000.));
438 
439  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M3_HEP17");
440  meRecHitsEnergyHEP17M3.push_back(ibooker.book1D(histo, histo, 2010, -10., 2000.));
441  for (int depth = 1; depth <= maxDepthHE_; depth++) {
442  sprintf(histo, "HcalRecHitTask_energy_of_rechits_HEP17_depth%d", depth);
443  meRecHitsEnergyHEP17.push_back(ibooker.book1D(histo, histo, 2010, -10., 2000.));
444 
445  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M0_HEP17_depth%d", depth);
446  meRecHitsEnergyHEP17M0.push_back(ibooker.book1D(histo, histo, 2010, -10., 2000.));
447 
448  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M3_HEP17_depth%d", depth);
449  meRecHitsEnergyHEP17M3.push_back(ibooker.book1D(histo, histo, 2010, -10., 2000.));
450  }
451  }
452 
453  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M2vM0_HE");
454  meRecHitsEnergyM2vM0HE = ibooker.book2D(histo, histo, 42, -10., 200., 42, -10., 200.);
455 
456  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M3vM0_HE");
457  meRecHitsEnergyM3vM0HE = ibooker.book2D(histo, histo, 42, -10., 200., 42, -10., 200.);
458 
459  sprintf(histo, "HcalRecHitTask_energy_of_rechits_M3vM2_HE");
460  meRecHitsEnergyM3vM2HE = ibooker.book2D(histo, histo, 42, -10., 200., 42, -10., 200.);
461 
462  sprintf(histo, "HcalRecHitTask_M2Log10Chi2_of_rechits_HE");
463  meRecHitsM2Chi2HE = ibooker.book1D(histo, histo, 120, -2., 10.);
464 
465  sprintf(histo, "HcalRecHitTask_timing_HE");
466  meTimeHE = ibooker.book1DD(histo, histo, 70, -48., 92.);
467 
468  sprintf(histo, "HcalRecHitTask_timing_vs_energy_Low_HE");
469  meTE_Low_HE = ibooker.book2D(histo, histo, 80, -5., 75., 70, -48., 92.);
470 
471  sprintf(histo, "HcalRecHitTask_timing_vs_energy_HE");
472  meTE_HE = ibooker.book2D(histo, histo, 200, -5., 395., 70, -48., 92.);
473 
474  sprintf(histo, "HcalRecHitTask_timing_vs_energy_profile_Low_HE");
475  meTEprofileHE_Low = ibooker.bookProfile(histo, histo, 80, -5., 75., -48., 92., " ");
476 
477  sprintf(histo, "HcalRecHitTask_timing_vs_energy_profile_HE");
478  meTEprofileHE = ibooker.bookProfile(histo, histo, 200, -5., 395., -48., 92., " ");
479 
480  sprintf(histo, "HcalRecHitTask_Log10Chi2_vs_energy_profile_HE");
481  meLog10Chi2profileHE = ibooker.bookProfile(histo, histo, 200, -5., 395., -2., 9.9, " ");
482  }
483 
484  // ************** HO ****************************************
485  if (subdet_ == 3 || subdet_ == 5) {
486  // Only severity level, energy of rechits and overall HB timing histos are
487  // drawn
488 
489  sprintf(histo, "HcalRecHitTask_severityLevel_HO");
490  sevLvl_HO = ibooker.book1DD(histo, histo, 25, -0.5, 24.5);
491 
492  sprintf(histo, "HcalRecHitTask_energy_of_rechits_HO");
493  meRecHitsEnergyHO = ibooker.book1DD(histo, histo, 2010, -10., 2000.);
494 
495  sprintf(histo, "HcalRecHitTask_cleaned_energy_of_rechits_HO");
496  meRecHitsCleanedEnergyHO = ibooker.book1DD(histo, histo, 2010, -10., 2000.);
497 
498  sprintf(histo, "HcalRecHitTask_timing_HO");
499  meTimeHO = ibooker.book1DD(histo, histo, 70, -48., 92.);
500 
501  sprintf(histo, "HcalRecHitTask_timing_vs_energy_HO");
502  meTE_HO = ibooker.book2D(histo, histo, 60, -5., 55., 70, -48., 92.);
503 
504  sprintf(histo, "HcalRecHitTask_timing_vs_energy_High_HO");
505  meTE_High_HO = ibooker.book2D(histo, histo, 100, -5., 995., 70, -48., 92.);
506 
507  sprintf(histo, "HcalRecHitTask_timing_vs_energy_profile_HO");
508  meTEprofileHO = ibooker.bookProfile(histo, histo, 60, -5., 55., -48., 92., " ");
509 
510  sprintf(histo, "HcalRecHitTask_timing_vs_energy_profile_High_HO");
511  meTEprofileHO_High = ibooker.bookProfile(histo, histo, 100, -5., 995., -48., 92., " ");
512  }
513 
514  // ********************** HF ************************************
515  if (subdet_ == 4 || subdet_ == 5) {
516  // Only severity level, energy of rechits and overall HB timing histos are
517  // drawn
518 
519  sprintf(histo, "HcalRecHitTask_severityLevel_HF");
520  sevLvl_HF = ibooker.book1DD(histo, histo, 25, -0.5, 24.5);
521 
522  sprintf(histo, "HcalRecHitTask_energy_of_rechits_HF");
523  meRecHitsEnergyHF = ibooker.book1DD(histo, histo, 2010, -10., 2000.);
524 
525  sprintf(histo, "HcalRecHitTask_cleaned_energy_of_rechits_HF");
526  meRecHitsCleanedEnergyHF = ibooker.book1DD(histo, histo, 2010, -10., 2000.);
527 
528  sprintf(histo, "HcalRecHitTask_timing_HF");
529  meTimeHF = ibooker.book1DD(histo, histo, 70, -48., 92.);
530 
531  sprintf(histo, "HcalRecHitTask_timing_vs_energy_Low_HF");
532  meTE_Low_HF = ibooker.book2D(histo, histo, 100, -5., 195., 70, -48., 92.);
533 
534  sprintf(histo, "HcalRecHitTask_timing_vs_energy_HF");
535  meTE_HF = ibooker.book2D(histo, histo, 200, -5., 995., 70, -48., 92.);
536 
537  sprintf(histo, "HcalRecHitTask_timing_vs_energy_profile_Low_HF");
538  meTEprofileHF_Low = ibooker.bookProfile(histo, histo, 100, -5., 195., -48., 92., " ");
539 
540  sprintf(histo, "HcalRecHitTask_timing_vs_energy_profile_HF");
541  meTEprofileHF = ibooker.bookProfile(histo, histo, 200, -5., 995., -48., 92., " ");
542  }
543 }
544 
546  using namespace edm;
547 
548  // cuts for each subdet_ector mimiking "Scheme B"
549  // double cutHB = 0.9, cutHE = 1.4, cutHO = 1.1, cutHFL = 1.2, cutHFS = 1.8;
550 
551  // energy in HCAL
552  double eHcal = 0.;
553  // Total numbet of RecHits in HCAL, in the cone, above 1 GeV theshold
554  int nrechits = 0;
555  int nrechitsThresh = 0;
556 
557  // energy in ECAL
558  double eEcal = 0.;
559  double eEcalB = 0.;
560  double eEcalE = 0.;
561  double eEcalCone = 0.;
562 
563  // HCAL energy around MC eta-phi at all depths;
564  double partR = 0.3;
565 
566  // Single particle samples: actual eta-phi position of cluster around
567  // hottest cell
568  double etaHot = 99999.;
569  double phiHot = 99999.;
570 
571  // previously was: c.get<IdealGeometryRecord>().get (geometry);
572  c.get<CaloGeometryRecord>().get(geometry);
573 
574  // HCAL Topology **************************************************
576  c.get<HcalRecNumberingRecord>().get(topo);
577  theHcalTopology = topo.product();
578 
579  // HCAL channel status map ****************************************
581  c.get<HcalChannelQualityRcd>().get("withTopo", hcalChStatus);
582  theHcalChStatus = hcalChStatus.product();
583 
584  // Assignment of severity levels **********************************
585  edm::ESHandle<HcalSeverityLevelComputer> hcalSevLvlComputerHndl;
586  c.get<HcalSeverityLevelComputerRcd>().get(hcalSevLvlComputerHndl);
587  theHcalSevLvlComputer = hcalSevLvlComputerHndl.product();
588 
589  // Fill working vectors of HCAL RecHits quantities (all of these are drawn)
590  fillRecHitsTmp(subdet_, ev);
591 
592  // HB
593  if (subdet_ == 5 || subdet_ == 1) {
594  for (unsigned int iv = 0; iv < hcalHBSevLvlVec.size(); iv++) {
596  }
597  }
598  // HE
599  if (subdet_ == 5 || subdet_ == 2) {
600  for (unsigned int iv = 0; iv < hcalHESevLvlVec.size(); iv++) {
602  }
603  }
604  // HO
605  if (subdet_ == 5 || subdet_ == 3) {
606  for (unsigned int iv = 0; iv < hcalHOSevLvlVec.size(); iv++) {
608  }
609  }
610  // HF
611  if (subdet_ == 5 || subdet_ == 4) {
612  for (unsigned int iv = 0; iv < hcalHFSevLvlVec.size(); iv++) {
614  }
615  }
616 
617  //===========================================================================
618  // IN ALL other CASES : ieta-iphi maps
619  //===========================================================================
620 
621  // ECAL
622  if (ecalselector_ == "yes" && (subdet_ == 1 || subdet_ == 2 || subdet_ == 5)) {
624  if (ev.getByToken(tok_EB_, rhitEB)) {
625  for (const auto &recHit : *(rhitEB.product())) {
626  double en = recHit.energy();
627  eEcal += en;
628  eEcalB += en;
629  }
630  }
631 
633  if (ev.getByToken(tok_EE_, rhitEE)) {
634  for (const auto &recHit : *(rhitEE.product())) {
635  double en = recHit.energy();
636  eEcal += en;
637  eEcalE += en;
638  }
639  }
640  } // end of ECAL selection
641 
642  // Counting, including ZS items
643  // Filling HCAL maps ----------------------------------------------------
644  // double maxE = -99999.;
645 
646  // element 0: any depth. element 1,2,..: depth 1,2
647  std::vector<int> nhb_v(maxDepthHB_ + 1, 0);
648  std::vector<int> nhe_v(maxDepthHE_ + 1, 0);
649  std::vector<int> nho_v(maxDepthHO_ + 1, 0);
650  std::vector<int> nhf_v(maxDepthHF_ + 1, 0);
651 
652  for (unsigned int i = 0; i < cen.size(); i++) {
653  int sub = csub[i];
654  int depth = cdepth[i];
655  int ieta = cieta[i];
656  int iphi = ciphi[i];
657  double en = cen[i];
658  double enM0 = cenM0[i];
659  double enM3 = cenM3[i];
660  // double eta = ceta[i];
661  // double phi = cphi[i];
662  uint32_t stwd = cstwd[i];
663  uint32_t auxstwd = cauxstwd[i];
664  // double z = cz[i];
665 
666  // This will be true if hep17 == "yes" and the rechit is in the hep17 wedge
667  bool isHEP17 = (sub == 2) && (iphi >= 63) && (iphi <= 66) && (ieta > 0) && (hep17_);
668 
669  // Make sure that an invalid depth won't cause an error. We should probably
670  // report the problem as well.
671  if (depth < 1)
672  continue;
673  if (sub == 1 && depth > maxDepthHB_)
674  continue;
675  if (sub == 2 && depth > maxDepthHE_)
676  continue;
677  if (sub == 3 && depth > maxDepthHO_)
678  continue;
679  if (sub == 4 && depth > maxDepthHF_)
680  continue;
681 
682  if (sub == 1) {
683  nhb_v[depth]++;
684  nhb_v[0]++;
685  } // element 0: any depth, element 1,2,..: depth 1,2,...
686  if (sub == 2) {
687  nhe_v[depth]++;
688  nhe_v[0]++;
689  } //
690  if (sub == 3) {
691  nho_v[depth]++;
692  nho_v[0]++;
693  } //
694  if (sub == 4) {
695  nhf_v[depth]++;
696  nhf_v[0]++;
697  } //
698 
699  if (subdet_ == 6) { // ZS specific
700  }
701 
702  if (subdet_ != 6) {
703  int ieta2 = ieta;
704  int depth2 = depth;
705  if (sub == 4) {
706  if (ieta2 < 0)
707  ieta2--;
708  else
709  ieta2++;
710  }
711  if (sub == 3)
712  emap_HO->Fill(double(ieta2), double(iphi), en); // HO
713  else
714  emap[depth2 - 1]->Fill(double(ieta2), double(iphi), en); // HB+HE+HF
715 
716  // to distinguish HE and HF
717  if (depth == 1 || depth == 2) {
718  int ieta1 = ieta;
719  if (sub == 4) {
720  if (ieta1 < 0)
721  ieta1--;
722  else
723  ieta1++;
724  }
725  }
726 
727  if (sub == 1) {
728  emean_vs_ieta_HB[depth - 1]->Fill(double(ieta), en);
729  emean_vs_ieta_HBM0[depth - 1]->Fill(double(ieta), enM0);
730  emean_vs_ieta_HBM3[depth - 1]->Fill(double(ieta), enM3);
731  occupancy_map_HB[depth - 1]->Fill(double(ieta), double(iphi));
732  if (ieta > 0)
733  nrechits_vs_iphi_HBP[depth - 1]->Fill(double(iphi));
734  else
735  nrechits_vs_iphi_HBM[depth - 1]->Fill(double(iphi));
736  }
737  if (sub == 2) {
738  if (!isHEP17) {
739  emean_vs_ieta_HE[depth - 1]->Fill(double(ieta), en);
740  emean_vs_ieta_HEM0[depth - 1]->Fill(double(ieta), enM0);
741  emean_vs_ieta_HEM3[depth - 1]->Fill(double(ieta), enM3);
742  } else {
743  emean_vs_ieta_HEP17[depth - 1]->Fill(double(ieta), en);
744  emean_vs_ieta_HEP17M0[depth - 1]->Fill(double(ieta), enM0);
745  emean_vs_ieta_HEP17M3[depth - 1]->Fill(double(ieta), enM3);
746  }
747  occupancy_map_HE[depth - 1]->Fill(double(ieta), double(iphi));
748  if (ieta > 0)
749  nrechits_vs_iphi_HEP[depth - 1]->Fill(double(iphi));
750  else
751  nrechits_vs_iphi_HEM[depth - 1]->Fill(double(iphi));
752  }
753  if (sub == 3) {
754  emean_vs_ieta_HO->Fill(double(ieta), en);
755  occupancy_map_HO->Fill(double(ieta), double(iphi));
756  if (ieta > 0)
757  nrechits_vs_iphi_HOP->Fill(double(iphi));
758  else
759  nrechits_vs_iphi_HOM->Fill(double(iphi));
760  }
761  if (sub == 4) {
762  emean_vs_ieta_HF[depth - 1]->Fill(double(ieta), en);
763  occupancy_map_HF[depth - 1]->Fill(double(ieta), double(iphi));
764  if (ieta > 0)
765  nrechits_vs_iphi_HFP[depth - 1]->Fill(double(iphi));
766  else
767  nrechits_vs_iphi_HFM[depth - 1]->Fill(double(iphi));
768  }
769  }
770 
771  // 32-bit status word
772  uint32_t statadd;
773  unsigned int isw67 = 0;
774 
775  // Statusword correlation
776  unsigned int sw27 = 27;
777  unsigned int sw13 = 13;
778 
779  uint32_t statadd27 = 0x1 << sw27;
780  uint32_t statadd13 = 0x1 << sw13;
781 
782  float status27 = 0;
783  float status13 = 0;
784 
785  if (stwd & statadd27)
786  status27 = 1;
787  if (stwd & statadd13)
788  status13 = 1;
789 
790  if (sub == 1) {
791  RecHit_StatusWordCorr_HB->Fill(status13, status27);
792  } else if (sub == 2) {
793  RecHit_StatusWordCorr_HE->Fill(status13, status27);
794  }
795 
796  for (unsigned int isw = 0; isw < 32; isw++) {
797  statadd = 0x1 << (isw);
798  if (stwd & statadd) {
799  if (sub == 1)
801  else if (sub == 2)
803  else if (sub == 3)
805  else if (sub == 4) {
807  if (isw == 6)
808  isw67 += 1;
809  if (isw == 7)
810  isw67 += 2;
811  }
812  }
813  }
814 
815  for (unsigned int isw = 0; isw < 32; isw++) {
816  statadd = 0x1 << (isw);
817  if (auxstwd & statadd) {
818  if (sub == 1)
820  else if (sub == 2)
822  else if (sub == 3)
824  else if (sub == 4)
826  }
827  }
828  }
829 
830  for (int depth = 0; depth <= maxDepthHB_; depth++)
831  Nhb[depth]->Fill(double(nhb_v[depth]));
832  for (int depth = 0; depth <= maxDepthHE_; depth++)
833  Nhe[depth]->Fill(double(nhe_v[depth]));
834  for (int depth = 0; depth <= maxDepthHO_; depth++)
835  Nho[depth]->Fill(double(nho_v[depth]));
836  for (int depth = 0; depth <= maxDepthHF_; depth++)
837  Nhf[depth]->Fill(double(nhf_v[depth]));
838 
839  //===========================================================================
840  // SUBSYSTEMS,
841  //===========================================================================
842 
843  if ((subdet_ != 6) && (subdet_ != 0)) {
844  double clusEta = 999.;
845  double clusPhi = 999.;
846  double clusEn = 0.;
847 
848  double HcalCone = 0.;
849 
850  int ietaMax = 9999;
851  // double enMax1 = -9999.;
852  // double enMax2 = -9999.;
853  // double enMax3 = -9999.;
854  // double enMax4 = -9999.;
855  // double enMax = -9999.;
856  // double etaMax = 9999.;
857 
858  // CYCLE over cells ====================================================
859 
860  for (unsigned int i = 0; i < cen.size(); i++) {
861  int sub = csub[i];
862  double eta = ceta[i];
863  double phi = cphi[i];
864  double ieta = cieta[i];
865  double iphi = ciphi[i];
866  double en = cen[i];
867  double enM0 = cenM0[i];
868  double enM3 = cenM3[i];
869  double chi2 = cchi2[i];
870  double chi2_log10 = 9.99; // initial value - stay with this value if chi2<0.
871  if (chi2 > 0.)
872  chi2_log10 = log10(chi2);
873  double t = ctime[i];
874  double depth = cdepth[i];
875  int sevlev = csevlev[i];
876 
877  bool isHEP17 = (sub == 2) && (iphi >= 63) && (iphi <= 66) && (ieta > 0) && (hep17_);
878 
879  // int ieta = cieta[i];
880 
881  double rhot = dR(etaHot, phiHot, eta, phi);
882  if (rhot < partR && en > 1.) {
883  clusEta = (clusEta * clusEn + eta * en) / (clusEn + en);
884  clusPhi = phi12(clusPhi, clusEn, phi, en);
885  clusEn += en;
886  }
887 
888  nrechits++;
889  eHcal += en;
890 
891  if (en > 1.)
892  nrechitsThresh++;
893 
894  // The energy and overall timing histos are drawn while
895  // the ones split by depth are not
896  if (sub == 1 && (subdet_ == 1 || subdet_ == 5)) {
897  meTimeHB->Fill(t);
898  meRecHitsEnergyHB->Fill(en);
899  if (sevlev <= 9)
901 
902  meRecHitsEnergyHBM0->Fill(enM0);
903  meRecHitsEnergyHBM3->Fill(enM3);
904 
905  meRecHitsEnergyM2vM0HB->Fill(enM0, en);
906  meRecHitsEnergyM3vM0HB->Fill(enM0, enM3);
907  meRecHitsEnergyM3vM2HB->Fill(en, enM3);
908 
909  meRecHitsM2Chi2HB->Fill(chi2_log10);
910  meLog10Chi2profileHB->Fill(en, chi2_log10);
911 
912  meTE_Low_HB->Fill(en, t);
913  meTE_HB->Fill(en, t);
914  meTE_High_HB->Fill(en, t);
915  meTEprofileHB_Low->Fill(en, t);
916  meTEprofileHB->Fill(en, t);
917  meTEprofileHB_High->Fill(en, t);
918  }
919  if (sub == 2 && (subdet_ == 2 || subdet_ == 5)) {
920  meTimeHE->Fill(t);
921  if (!isHEP17) {
922  meRecHitsEnergyHE->Fill(en);
923  if (sevlev <= 9)
925 
926  meRecHitsEnergyHEM0->Fill(enM0);
927  meRecHitsEnergyHEM3->Fill(enM3);
928  } else {
929  meRecHitsEnergyHEP17[0]->Fill(en);
930  meRecHitsEnergyHEP17M0[0]->Fill(enM0);
931  meRecHitsEnergyHEP17M3[0]->Fill(enM3);
932  meRecHitsEnergyHEP17[depth]->Fill(en);
933  meRecHitsEnergyHEP17M0[depth]->Fill(enM0);
934  meRecHitsEnergyHEP17M3[depth]->Fill(enM3);
935  }
936 
937  meRecHitsEnergyM2vM0HE->Fill(enM0, en);
938  meRecHitsEnergyM3vM0HE->Fill(enM0, enM3);
939  meRecHitsEnergyM3vM2HE->Fill(en, enM3);
940 
941  meRecHitsM2Chi2HE->Fill(chi2_log10);
942  meLog10Chi2profileHE->Fill(en, chi2_log10);
943 
944  meTE_Low_HE->Fill(en, t);
945  meTE_HE->Fill(en, t);
946  meTEprofileHE_Low->Fill(en, t);
947  meTEprofileHE->Fill(en, t);
948  }
949  if (sub == 4 && (subdet_ == 4 || subdet_ == 5)) {
950  meTimeHF->Fill(t);
951  meRecHitsEnergyHF->Fill(en);
952  if (sevlev <= 9)
954 
955  meTE_Low_HF->Fill(en, t);
956  meTE_HF->Fill(en, t);
957  meTEprofileHF_Low->Fill(en, t);
958  meTEprofileHF->Fill(en, t);
959  }
960  if (sub == 3 && (subdet_ == 3 || subdet_ == 5)) {
961  meTimeHO->Fill(t);
962  meRecHitsEnergyHO->Fill(en);
963  if (sevlev <= 9)
965 
966  meTE_HO->Fill(en, t);
967  meTE_High_HO->Fill(en, t);
968  meTEprofileHO->Fill(en, t);
969  meTEprofileHO_High->Fill(en, t);
970  }
971  }
972 
973  if (imc != 0) {
974  // Cone by depth are not drawn, the others are used for pion scan
975  meEnConeEtaProfile->Fill(double(ietaMax), HcalCone); //
976  meEnConeEtaProfile_E->Fill(double(ietaMax), eEcalCone);
977  meEnConeEtaProfile_EH->Fill(double(ietaMax), HcalCone + eEcalCone);
978  }
979 
980  // Single particle samples ONLY ! ======================================
981  // Fill up some histos for "integrated" subsustems.
982  // These are not drawn
983  }
984 
985  nevtot++;
986 }
987 
990  using namespace edm;
991 
992  // initialize data vectors
993  csub.clear();
994  cen.clear();
995  cenM0.clear();
996  cenM3.clear();
997  cchi2.clear();
998  ceta.clear();
999  cphi.clear();
1000  ctime.clear();
1001  cieta.clear();
1002  ciphi.clear();
1003  cdepth.clear();
1004  cz.clear();
1005  cstwd.clear();
1006  cauxstwd.clear();
1007  csevlev.clear();
1008  hcalHBSevLvlVec.clear();
1009  hcalHESevLvlVec.clear();
1010  hcalHFSevLvlVec.clear();
1011  hcalHOSevLvlVec.clear();
1012 
1013  if (subdet_ == 1 || subdet_ == 2 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
1014  // HBHE
1016  if (ev.getByToken(tok_hbhe_, hbhecoll)) {
1017  for (HBHERecHitCollection::const_iterator j = hbhecoll->begin(); j != hbhecoll->end(); j++) {
1018  HcalDetId cell(j->id());
1019  const HcalGeometry *cellGeometry = dynamic_cast<const HcalGeometry *>(geometry->getSubdetectorGeometry(cell));
1020  double eta = cellGeometry->getPosition(cell).eta();
1021  double phi = cellGeometry->getPosition(cell).phi();
1022  double zc = cellGeometry->getPosition(cell).z();
1023  int sub = cell.subdet();
1024  int depth = cell.depth();
1025  int inteta = cell.ieta();
1026  int intphi = cell.iphi();
1027  double en = j->energy();
1028  double enM0 = j->eraw();
1029  double enM3 = j->eaux();
1030  double chi2 = j->chi2();
1031  double t = j->time();
1032  int stwd = j->flags();
1033  int auxstwd = j->aux();
1034 
1035  int severityLevel = hcalSevLvl((CaloRecHit *)&*j);
1036  if (cell.subdet() == HcalBarrel) {
1037  hcalHBSevLvlVec.push_back(severityLevel);
1038  } else if (cell.subdet() == HcalEndcap) {
1039  hcalHESevLvlVec.push_back(severityLevel);
1040  }
1041 
1042  if ((iz > 0 && eta > 0.) || (iz < 0 && eta < 0.) || iz == 0) {
1043  csub.push_back(sub);
1044  cen.push_back(en);
1045  cenM0.push_back(enM0);
1046  cenM3.push_back(enM3);
1047  cchi2.push_back(chi2);
1048  ceta.push_back(eta);
1049  cphi.push_back(phi);
1050  ctime.push_back(t);
1051  cieta.push_back(inteta);
1052  ciphi.push_back(intphi);
1053  cdepth.push_back(depth);
1054  cz.push_back(zc);
1055  cstwd.push_back(stwd);
1056  cauxstwd.push_back(auxstwd);
1057  csevlev.push_back(severityLevel);
1058  }
1059  }
1060  }
1061  }
1062 
1063  if (subdet_ == 4 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
1064  // HF
1066  if (ev.getByToken(tok_hf_, hfcoll)) {
1067  for (HFRecHitCollection::const_iterator j = hfcoll->begin(); j != hfcoll->end(); j++) {
1068  HcalDetId cell(j->id());
1069  auto cellGeometry = (geometry->getSubdetectorGeometry(cell))->getGeometry(cell);
1070  double eta = cellGeometry->getPosition().eta();
1071  double phi = cellGeometry->getPosition().phi();
1072  double zc = cellGeometry->getPosition().z();
1073  int sub = cell.subdet();
1074  int depth = cell.depth();
1075  int inteta = cell.ieta();
1076  int intphi = cell.iphi();
1077  double en = j->energy();
1078  double enM0 = 0.;
1079  double enM3 = 0.;
1080  double chi2 = 0.;
1081  double t = j->time();
1082  int stwd = j->flags();
1083  int auxstwd = j->aux();
1084 
1085  int severityLevel = hcalSevLvl((CaloRecHit *)&*j);
1086  if (cell.subdet() == HcalForward) {
1087  hcalHFSevLvlVec.push_back(severityLevel);
1088  }
1089 
1090  if ((iz > 0 && eta > 0.) || (iz < 0 && eta < 0.) || iz == 0) {
1091  csub.push_back(sub);
1092  cen.push_back(en);
1093  cenM0.push_back(enM0);
1094  cenM3.push_back(enM3);
1095  cchi2.push_back(chi2);
1096  ceta.push_back(eta);
1097  cphi.push_back(phi);
1098  ctime.push_back(t);
1099  cieta.push_back(inteta);
1100  ciphi.push_back(intphi);
1101  cdepth.push_back(depth);
1102  cz.push_back(zc);
1103  cstwd.push_back(stwd);
1104  cauxstwd.push_back(auxstwd);
1105  csevlev.push_back(severityLevel);
1106  }
1107  }
1108  }
1109  }
1110 
1111  // HO
1112  if (subdet_ == 3 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
1114  if (ev.getByToken(tok_ho_, hocoll)) {
1115  for (HORecHitCollection::const_iterator j = hocoll->begin(); j != hocoll->end(); j++) {
1116  HcalDetId cell(j->id());
1117  auto cellGeometry = (geometry->getSubdetectorGeometry(cell))->getGeometry(cell);
1118  double eta = cellGeometry->getPosition().eta();
1119  double phi = cellGeometry->getPosition().phi();
1120  double zc = cellGeometry->getPosition().z();
1121  int sub = cell.subdet();
1122  int depth = cell.depth();
1123  int inteta = cell.ieta();
1124  int intphi = cell.iphi();
1125  double t = j->time();
1126  double en = j->energy();
1127  double enM0 = 0.;
1128  double enM3 = 0.;
1129  double chi2 = 0.;
1130  int stwd = j->flags();
1131  int auxstwd = j->aux();
1132 
1133  int severityLevel = hcalSevLvl((CaloRecHit *)&*j);
1134  if (cell.subdet() == HcalOuter) {
1135  hcalHOSevLvlVec.push_back(severityLevel);
1136  }
1137 
1138  if ((iz > 0 && eta > 0.) || (iz < 0 && eta < 0.) || iz == 0) {
1139  csub.push_back(sub);
1140  cen.push_back(en);
1141  cenM0.push_back(enM0);
1142  cenM3.push_back(enM3);
1143  cchi2.push_back(chi2);
1144  ceta.push_back(eta);
1145  cphi.push_back(phi);
1146  ctime.push_back(t);
1147  cieta.push_back(inteta);
1148  ciphi.push_back(intphi);
1149  cdepth.push_back(depth);
1150  cz.push_back(zc);
1151  cstwd.push_back(stwd);
1152  cauxstwd.push_back(auxstwd);
1153  csevlev.push_back(severityLevel);
1154  }
1155  }
1156  }
1157  }
1158 }
1159 
1160 double HcalRecHitsAnalyzer::dR(double eta1, double phi1, double eta2, double phi2) {
1161  double PI = 3.1415926535898;
1162  double deltaphi = phi1 - phi2;
1163  if (phi2 > phi1) {
1164  deltaphi = phi2 - phi1;
1165  }
1166  if (deltaphi > PI) {
1167  deltaphi = 2. * PI - deltaphi;
1168  }
1169  double deltaeta = eta2 - eta1;
1170  double tmp = sqrt(deltaeta * deltaeta + deltaphi * deltaphi);
1171  return tmp;
1172 }
1173 
1174 double HcalRecHitsAnalyzer::phi12(double phi1, double en1, double phi2, double en2) {
1175  // weighted mean value of phi1 and phi2
1176 
1177  double tmp;
1178  double PI = 3.1415926535898;
1179  double a1 = phi1;
1180  double a2 = phi2;
1181 
1182  if (a1 > 0.5 * PI && a2 < 0.)
1183  a2 += 2 * PI;
1184  if (a2 > 0.5 * PI && a1 < 0.)
1185  a1 += 2 * PI;
1186  tmp = (a1 * en1 + a2 * en2) / (en1 + en2);
1187  if (tmp > PI)
1188  tmp -= 2. * PI;
1189 
1190  return tmp;
1191 }
1192 
1193 double HcalRecHitsAnalyzer::dPhiWsign(double phi1, double phi2) {
1194  // clockwise phi2 w.r.t phi1 means "+" phi distance
1195  // anti-clockwise phi2 w.r.t phi1 means "-" phi distance
1196 
1197  double PI = 3.1415926535898;
1198  double a1 = phi1;
1199  double a2 = phi2;
1200  double tmp = a2 - a1;
1201  if (a1 * a2 < 0.) {
1202  if (a1 > 0.5 * PI)
1203  tmp += 2. * PI;
1204  if (a2 > 0.5 * PI)
1205  tmp -= 2. * PI;
1206  }
1207  return tmp;
1208 }
1209 
1211  HcalDetId id = hit->detid();
1212  if (theHcalTopology->getMergePositionFlag() && id.subdet() == HcalEndcap) {
1213  id = theHcalTopology->idFront(id);
1214  }
1215 
1216  const uint32_t recHitFlag = hit->flags();
1217  const uint32_t dbStatusFlag = theHcalChStatus->getValues(id)->getValue();
1218 
1219  int severityLevel = theHcalSevLvlComputer->getSeverityLevel(id, recHitFlag, dbStatusFlag);
1220 
1221  return severityLevel;
1222 }
1223 
MonitorElement * nrechits_vs_iphi_HOP
MonitorElement * sevLvl_HF
std::vector< MonitorElement * > emean_vs_ieta_HEP17M3
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
Definition: DQMStore.cc:239
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:34
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * meTEprofileHB_High
MonitorElement * RecHit_StatusWord_HE
std::vector< int > csub
std::vector< int > csevlev
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
unsigned int getHxSize(const int type) const
double dPhiWsign(double phi1, double phi2)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
MonitorElement * meTE_Low_HE
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:418
constexpr const DetId & detid() const
Definition: CaloRecHit.h:33
MonitorElement * book1DD(TString const &name, TString const &title, int nchX, double lowX, double highX)
Definition: DQMStore.cc:257
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:167
MonitorElement * meRecHitsEnergyM3vM0HE
std::vector< MonitorElement * > Nhe
MonitorElement * meTE_Low_HB
MonitorElement * meTEprofileHF_Low
const HcalSeverityLevelComputer * theHcalSevLvlComputer
std::vector< MonitorElement * > Nhf
MonitorElement * meTE_HB
MonitorElement * meRecHitsEnergyM2vM0HB
std::vector< MonitorElement * > nrechits_vs_iphi_HEP
MonitorElement * sevLvl_HO
void Fill(long long x)
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
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:19
std::vector< MonitorElement * > emap
std::vector< MonitorElement * > nrechits_vs_iphi_HFP
MonitorElement * meTEprofileHO
MonitorElement * meTEprofileHB
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, char const *option="s")
Definition: DQMStore.cc:333
edm::EDGetTokenT< HORecHitCollection > tok_ho_
std::vector< double > cchi2
MonitorElement * meLog10Chi2profileHE
std::vector< MonitorElement * > nrechits_vs_iphi_HFM
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:37
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 * meRecHitsCleanedEnergyHF
MonitorElement * meTEprofileHE
std::vector< uint32_t > cstwd
T const * product() const
Definition: Handle.h:69
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
MonitorElement * meRecHitsCleanedEnergyHB
MonitorElement * meTE_High_HB
std::vector< int > hcalHFSevLvlVec
MonitorElement * RecHit_StatusWord_HB
HLT enums.
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Definition: DQMStore.cc:266
MonitorElement * meTEprofileHO_High
T get() const
Definition: EventSetup.h:73
const HcalDDDRecConstants * hcons
MonitorElement * meTEprofileHB_Low
edm::EDGetTokenT< EERecHitCollection > tok_EE_
std::vector< MonitorElement * > Nhb
MonitorElement * meRecHitsCleanedEnergyHE
std::vector< double > ctime
std::vector< double > cen
MonitorElement * meRecHitsEnergyM3vM0HB
HcalDetId idFront(const HcalDetId &id) const
Definition: HcalTopology.h:170
MonitorElement * meRecHitsEnergyHBM3
std::vector< double > cenM0
MonitorElement * RecHit_StatusWordCorr_HE
MonitorElement * meTimeHB
std::pair< int, int > getEtaRange(const int &i) const
MonitorElement * meTEprofileHF
MonitorElement * RecHit_Aux_StatusWord_HF
MonitorElement * RecHit_Aux_StatusWord_HE
uint32_t getValue() const
tmp
align.sh
Definition: createJobs.py:716
T const * product() const
Definition: ESHandle.h:86
constexpr uint32_t flags() const
Definition: CaloRecHit.h:34
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 * meRecHitsCleanedEnergyHO
MonitorElement * meTE_HE
std::vector< MonitorElement * > emean_vs_ieta_HEM0
MonitorElement * meRecHitsEnergyHE
MonitorElement * meTE_Low_HF