CMS 3D CMS Logo

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