CMS 3D CMS Logo

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