CMS 3D CMS Logo

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