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_.size() != 0 ) {
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, "nrechits_vs_iphi_HBP_d%d",depth );
238  nrechits_vs_iphi_HBP.push_back( ibooker.book1D(histo, histo, iphi_bins_, iphi_min_, iphi_max_) );
239  sprintf (histo, "nrechits_vs_iphi_HBM_d%d",depth );
240  nrechits_vs_iphi_HBM.push_back( ibooker.book1D(histo, histo, iphi_bins_, iphi_min_, iphi_max_) );
241  }
242 
243  for (int depth = 1; depth <= maxDepthHE_; depth++) {
244  sprintf (histo, "nrechits_vs_iphi_HEP_d%d",depth );
245  nrechits_vs_iphi_HEP.push_back( ibooker.book1D(histo, histo, iphi_bins_, iphi_min_, iphi_max_) );
246  sprintf (histo, "nrechits_vs_iphi_HEM_d%d",depth );
247  nrechits_vs_iphi_HEM.push_back( ibooker.book1D(histo, histo, iphi_bins_, iphi_min_, iphi_max_) );
248  }
249 
250  sprintf (histo, "nrechits_vs_iphi_HOP" );
251  nrechits_vs_iphi_HOP = ibooker.book1D(histo, histo, iphi_bins_, iphi_min_, iphi_max_);
252  sprintf (histo, "nrechits_vs_iphi_HOM" );
253  nrechits_vs_iphi_HOM = ibooker.book1D(histo, histo, iphi_bins_, iphi_min_, iphi_max_);
254 
255  for (int depth = 1; depth <= maxDepthHF_; depth++) {
256  sprintf (histo, "nrechits_vs_iphi_HFP_d%d",depth );
257  nrechits_vs_iphi_HFP.push_back( ibooker.book1D(histo, histo, iphi_bins_, iphi_min_, iphi_max_) );
258  sprintf (histo, "nrechits_vs_iphi_HFM_d%d",depth );
259  nrechits_vs_iphi_HFM.push_back( ibooker.book1D(histo, histo, iphi_bins_, iphi_min_, iphi_max_) );
260  }
261 
262  //All status word histos except HF67 are drawn
263  sprintf (histo, "HcalRecHitTask_RecHit_StatusWord_HB" ) ;
264  RecHit_StatusWord_HB = ibooker.book1D(histo, histo, 32 , -0.5, 31.5);
265 
266  sprintf (histo, "HcalRecHitTask_RecHit_StatusWord_HE" ) ;
267  RecHit_StatusWord_HE = ibooker.book1D(histo, histo, 32 , -0.5, 31.5);
268 
269  sprintf (histo, "HcalRecHitTask_RecHit_StatusWord_HF" ) ;
270  RecHit_StatusWord_HF = ibooker.book1D(histo, histo, 32 , -0.5, 31.5);
271 
272  sprintf (histo, "HcalRecHitTask_RecHit_StatusWord_HO" ) ;
273  RecHit_StatusWord_HO = ibooker.book1D(histo, histo, 32 , -0.5, 31.5);
274 
275  //Aux status word histos
276  sprintf (histo, "HcalRecHitTask_RecHit_Aux_StatusWord_HB" ) ;
277  RecHit_Aux_StatusWord_HB = ibooker.book1D(histo, histo, 32 , -0.5, 31.5);
278 
279  sprintf (histo, "HcalRecHitTask_RecHit_Aux_StatusWord_HE" ) ;
280  RecHit_Aux_StatusWord_HE = ibooker.book1D(histo, histo, 32 , -0.5, 31.5);
281 
282  sprintf (histo, "HcalRecHitTask_RecHit_Aux_StatusWord_HF" ) ;
283  RecHit_Aux_StatusWord_HF = ibooker.book1D(histo, histo, 32 , -0.5, 31.5);
284 
285  sprintf (histo, "HcalRecHitTask_RecHit_Aux_StatusWord_HO" ) ;
286  RecHit_Aux_StatusWord_HO = ibooker.book1D(histo, histo, 32 , -0.5, 31.5);
287 
288  } // end-of (subdet_ =! 6)
289 
290  //Status word correlations
291  sprintf (histo, "HcalRecHitTask_RecHit_StatusWordCorr_HB");
292  RecHit_StatusWordCorr_HB = ibooker.book2D(histo, histo, 2, -0.5, 1.5, 2, -0.5, 1.5);
293 
294  sprintf (histo, "HcalRecHitTask_RecHit_StatusWordCorr_HE");
295  RecHit_StatusWordCorr_HE = ibooker.book2D(histo, histo, 2, -0.5, 1.5, 2, -0.5, 1.5);
296 
297 
298  //======================= Now various cases one by one ===================
299 
300  //Histograms drawn for single pion scan
301  if(subdet_ != 0 && imc != 0) { // just not for noise
302  sprintf (histo, "HcalRecHitTask_En_rechits_cone_profile_vs_ieta_all_depths");
303  meEnConeEtaProfile = ibooker.bookProfile(histo, histo, ieta_bins_, ieta_min_, ieta_max_, -100., 2000., " ");
304 
305  sprintf (histo, "HcalRecHitTask_En_rechits_cone_profile_vs_ieta_all_depths_E");
306  meEnConeEtaProfile_E = ibooker.bookProfile(histo, histo, ieta_bins_, ieta_min_, ieta_max_, -100., 2000., " ");
307 
308  sprintf (histo, "HcalRecHitTask_En_rechits_cone_profile_vs_ieta_all_depths_EH");
309  meEnConeEtaProfile_EH = ibooker.bookProfile(histo, histo, ieta_bins_, ieta_min_, ieta_max_, -100., 2000., " ");
310  }
311 
312  // ************** HB **********************************
313  if (subdet_ == 1 || subdet_ == 5 ){
314 
315  //Only severity level, energy of rechits and overall HB timing histos are drawn
316 
317  sprintf(histo, "HcalRecHitTask_severityLevel_HB");
318  sevLvl_HB = ibooker.book1D(histo, histo, 25, -0.5, 24.5);
319 
320  sprintf (histo, "HcalRecHitTask_energy_of_rechits_HB" ) ;
321  meRecHitsEnergyHB = ibooker.book1D(histo, histo, 2010 , -10. , 2000.);
322 
323  sprintf (histo, "HcalRecHitTask_energy_of_rechits_M0_HB" ) ;
324  meRecHitsEnergyHBM0 = ibooker.book1D(histo, histo, 2010 , -10. , 2000.);
325 
326  sprintf (histo, "HcalRecHitTask_energy_of_rechits_M3_HB" ) ;
327  meRecHitsEnergyHBM3 = ibooker.book1D(histo, histo, 2010 , -10. , 2000.);
328 
329  sprintf (histo, "HcalRecHitTask_energy_of_rechits_M2vM0_HB" ) ;
330  meRecHitsEnergyM2vM0HB = ibooker.book2D(histo, histo, 42 , -10. , 200., 42, -10., 200.);
331 
332  sprintf (histo, "HcalRecHitTask_energy_of_rechits_M3vM0_HB" ) ;
333  meRecHitsEnergyM3vM0HB = ibooker.book2D(histo, histo, 42 , -10. , 200., 42, -10., 200.);
334 
335  sprintf (histo, "HcalRecHitTask_energy_of_rechits_M3vM2_HB" ) ;
336  meRecHitsEnergyM3vM2HB = ibooker.book2D(histo, histo, 42 , -10. , 200., 42, -10., 200.);
337 
338  sprintf (histo, "HcalRecHitTask_M2Log10Chi2_of_rechits_HB" ) ;
339  meRecHitsM2Chi2HB = ibooker.book1D(histo, histo, 120 , -2. , 10.);
340 
341  sprintf (histo, "HcalRecHitTask_timing_HB" ) ;
342  meTimeHB = ibooker.book1D(histo, histo, 70, -48., 92.);
343 
344  //High, medium and low histograms to reduce RAM usage
345  sprintf (histo, "HcalRecHitTask_timing_vs_energy_Low_HB" ) ;
346  meTE_Low_HB = ibooker.book2D(histo, histo, 50, -5., 45., 70, -48., 92.);
347 
348  sprintf (histo, "HcalRecHitTask_timing_vs_energy_HB" ) ;
349  meTE_HB = ibooker.book2D(histo, histo, 150, -5., 295., 70, -48., 92.);
350 
351  sprintf (histo, "HcalRecHitTask_timing_vs_energy_High_HB" ) ;
352  meTE_High_HB = ibooker.book2D(histo, histo, 150, -5., 2995., 70, -48., 92.);
353 
354  sprintf (histo, "HcalRecHitTask_timing_vs_energy_profile_Low_HB" ) ;
355  meTEprofileHB_Low = ibooker.bookProfile(histo, histo, 50, -5., 45., -48., 92., " ");
356 
357  sprintf (histo, "HcalRecHitTask_timing_vs_energy_profile_HB" ) ;
358  meTEprofileHB = ibooker.bookProfile(histo, histo, 150, -5., 295., -48., 92., " ");
359 
360  sprintf (histo, "HcalRecHitTask_Log10Chi2_vs_energy_profile_HB" ) ;
361  meLog10Chi2profileHB = ibooker.bookProfile(histo, histo, 150, -5., 295., -2., 10., " ");
362 
363  sprintf (histo, "HcalRecHitTask_timing_vs_energy_profile_High_HB" ) ;
364  meTEprofileHB_High = ibooker.bookProfile(histo, histo, 150, -5., 2995., -48., 92., " ");
365 
366  }
367 
368  // ********************** HE ************************************
369  if ( subdet_ == 2 || subdet_ == 5 ){
370 
371 
372  //Only severity level, energy of rechits and overall HB timing histos are drawn
373  sprintf(histo, "HcalRecHitTask_severityLevel_HE");
374  sevLvl_HE = ibooker.book1D(histo, histo, 25, -0.5, 24.5);
375 
376  sprintf (histo, "HcalRecHitTask_energy_of_rechits_HE" ) ;
377  meRecHitsEnergyHE = ibooker.book1D(histo, histo, 2010, -10., 2000.);
378 
379  sprintf (histo, "HcalRecHitTask_energy_of_rechits_M0_HE" ) ;
380  meRecHitsEnergyHEM0 = ibooker.book1D(histo, histo, 2010, -10., 2000.);
381 
382  sprintf (histo, "HcalRecHitTask_energy_of_rechits_M3_HE" ) ;
383  meRecHitsEnergyHEM3 = ibooker.book1D(histo, histo, 2010, -10., 2000.);
384 
385  if(hep17_){
386  sprintf (histo, "HcalRecHitTask_energy_of_rechits_HEP17" ) ;
387  meRecHitsEnergyHEP17.push_back(ibooker.book1D(histo, histo, 2010 , -10. , 2000.));
388 
389  sprintf (histo, "HcalRecHitTask_energy_of_rechits_M0_HEP17" ) ;
390  meRecHitsEnergyHEP17M0.push_back(ibooker.book1D(histo, histo, 2010 , -10. , 2000.));
391 
392  sprintf (histo, "HcalRecHitTask_energy_of_rechits_M3_HEP17" ) ;
393  meRecHitsEnergyHEP17M3.push_back(ibooker.book1D(histo, histo, 2010 , -10. , 2000.));
394  for (int depth = 1; depth <= maxDepthHE_; depth++) {
395  sprintf (histo, "HcalRecHitTask_energy_of_rechits_HEP17_depth%d",depth ) ;
396  meRecHitsEnergyHEP17.push_back(ibooker.book1D(histo, histo, 2010 , -10. , 2000.));
397 
398  sprintf (histo, "HcalRecHitTask_energy_of_rechits_M0_HEP17_depth%d",depth ) ;
399  meRecHitsEnergyHEP17M0.push_back(ibooker.book1D(histo, histo, 2010 , -10. , 2000.));
400 
401  sprintf (histo, "HcalRecHitTask_energy_of_rechits_M3_HEP17_depth%d",depth ) ;
402  meRecHitsEnergyHEP17M3.push_back(ibooker.book1D(histo, histo, 2010 , -10. , 2000.));
403  }
404  }
405 
406  sprintf (histo, "HcalRecHitTask_energy_of_rechits_M2vM0_HE" ) ;
407  meRecHitsEnergyM2vM0HE = ibooker.book2D(histo, histo, 42 , -10. , 200., 42, -10., 200.);
408 
409  sprintf (histo, "HcalRecHitTask_energy_of_rechits_M3vM0_HE" ) ;
410  meRecHitsEnergyM3vM0HE = ibooker.book2D(histo, histo, 42 , -10. , 200., 42, -10., 200.);
411 
412  sprintf (histo, "HcalRecHitTask_energy_of_rechits_M3vM2_HE" ) ;
413  meRecHitsEnergyM3vM2HE = ibooker.book2D(histo, histo, 42 , -10. , 200., 42, -10., 200.);
414 
415  sprintf (histo, "HcalRecHitTask_M2Log10Chi2_of_rechits_HE" ) ;
416  meRecHitsM2Chi2HE = ibooker.book1D(histo, histo, 120 , -2. , 10.);
417 
418  sprintf (histo, "HcalRecHitTask_timing_HE" ) ;
419  meTimeHE = ibooker.book1D(histo, histo, 70, -48., 92.);
420 
421  sprintf (histo, "HcalRecHitTask_timing_vs_energy_Low_HE" ) ;
422  meTE_Low_HE = ibooker.book2D(histo, histo, 80, -5., 75., 70, -48., 92.);
423 
424  sprintf (histo, "HcalRecHitTask_timing_vs_energy_HE" ) ;
425  meTE_HE = ibooker.book2D(histo, histo, 200, -5., 395., 70, -48., 92.);
426 
427  sprintf (histo, "HcalRecHitTask_timing_vs_energy_profile_Low_HE" ) ;
428  meTEprofileHE_Low = ibooker.bookProfile(histo, histo, 80, -5., 75., -48., 92., " ");
429 
430  sprintf (histo, "HcalRecHitTask_timing_vs_energy_profile_HE" ) ;
431  meTEprofileHE = ibooker.bookProfile(histo, histo, 200, -5., 395., -48., 92., " ");
432 
433  sprintf (histo, "HcalRecHitTask_Log10Chi2_vs_energy_profile_HE" ) ;
434  meLog10Chi2profileHE = ibooker.bookProfile(histo, histo, 200, -5., 395., -2., 10., " ");
435 
436 
437  }
438 
439  // ************** HO ****************************************
440  if ( subdet_ == 3 || subdet_ == 5 ){
441 
442  //Only severity level, energy of rechits and overall HB timing histos are drawn
443 
444  sprintf(histo, "HcalRecHitTask_severityLevel_HO");
445  sevLvl_HO = ibooker.book1D(histo, histo, 25, -0.5, 24.5);
446 
447  sprintf (histo, "HcalRecHitTask_energy_of_rechits_HO" ) ;
448  meRecHitsEnergyHO = ibooker.book1D(histo, histo, 2010 , -10. , 2000.);
449 
450  sprintf (histo, "HcalRecHitTask_timing_HO" ) ;
451  meTimeHO = ibooker.book1D(histo, histo, 70, -48., 92.);
452 
453  sprintf (histo, "HcalRecHitTask_timing_vs_energy_HO" ) ;
454  meTE_HO= ibooker.book2D(histo, histo, 60, -5., 55., 70, -48., 92.);
455 
456  sprintf (histo, "HcalRecHitTask_timing_vs_energy_High_HO" ) ;
457  meTE_High_HO= ibooker.book2D(histo, histo, 100, -5., 995., 70, -48., 92.);
458 
459  sprintf (histo, "HcalRecHitTask_timing_vs_energy_profile_HO" ) ;
460  meTEprofileHO = ibooker.bookProfile(histo, histo, 60, -5., 55., -48., 92., " ");
461 
462  sprintf (histo, "HcalRecHitTask_timing_vs_energy_profile_High_HO" ) ;
463  meTEprofileHO_High = ibooker.bookProfile(histo, histo, 100, -5., 995., -48., 92., " ");
464 
465  }
466 
467  // ********************** HF ************************************
468  if ( subdet_ == 4 || subdet_ == 5 ){
469 
470  //Only severity level, energy of rechits and overall HB timing histos are drawn
471 
472  sprintf(histo, "HcalRecHitTask_severityLevel_HF");
473  sevLvl_HF = ibooker.book1D(histo, histo, 25, -0.5, 24.5);
474 
475  sprintf (histo, "HcalRecHitTask_energy_of_rechits_HF" ) ;
476  meRecHitsEnergyHF = ibooker.book1D(histo, histo, 2010 , -10. , 2000.);
477 
478  sprintf (histo, "HcalRecHitTask_timing_HF" ) ;
479  meTimeHF = ibooker.book1D(histo, histo, 70, -48., 92.);
480 
481  sprintf (histo, "HcalRecHitTask_timing_vs_energy_Low_HF" ) ;
482  meTE_Low_HF = ibooker.book2D(histo, histo, 100, -5., 195., 70, -48., 92.);
483 
484  sprintf (histo, "HcalRecHitTask_timing_vs_energy_HF" ) ;
485  meTE_HF = ibooker.book2D(histo, histo, 200, -5., 995., 70, -48., 92.);
486 
487  sprintf (histo, "HcalRecHitTask_timing_vs_energy_profile_Low_HF" ) ;
488  meTEprofileHF_Low = ibooker.bookProfile(histo, histo, 100, -5., 195., -48., 92., " ");
489 
490  sprintf (histo, "HcalRecHitTask_timing_vs_energy_profile_HF" ) ;
491  meTEprofileHF = ibooker.bookProfile(histo, histo, 200, -5., 995., -48., 92., " ");
492 
493  }
494 
495 }
496 
497 
499 
500  using namespace edm;
501 
502  // cuts for each subdet_ector mimiking "Scheme B"
503  // double cutHB = 0.9, cutHE = 1.4, cutHO = 1.1, cutHFL = 1.2, cutHFS = 1.8;
504 
505  // energy in HCAL
506  double eHcal = 0.;
507  // Total numbet of RecHits in HCAL, in the cone, above 1 GeV theshold
508  int nrechits = 0;
509  int nrechitsThresh = 0;
510 
511  // energy in ECAL
512  double eEcal = 0.;
513  double eEcalB = 0.;
514  double eEcalE = 0.;
515  double eEcalCone = 0.;
516 
517  // HCAL energy around MC eta-phi at all depths;
518  double partR = 0.3;
519 
520  // Single particle samples: actual eta-phi position of cluster around
521  // hottest cell
522  double etaHot = 99999.;
523  double phiHot = 99999.;
524 
525  // previously was: c.get<IdealGeometryRecord>().get (geometry);
526  c.get<CaloGeometryRecord>().get (geometry);
527 
528  // HCAL Topology **************************************************
530  c.get<HcalRecNumberingRecord>().get(topo);
531  theHcalTopology = topo.product();
532 
533  // HCAL channel status map ****************************************
535  c.get<HcalChannelQualityRcd>().get( "withTopo", hcalChStatus );
536  theHcalChStatus = hcalChStatus.product();
537 
538  // Assignment of severity levels **********************************
539  edm::ESHandle<HcalSeverityLevelComputer> hcalSevLvlComputerHndl;
540  c.get<HcalSeverityLevelComputerRcd>().get(hcalSevLvlComputerHndl);
541  theHcalSevLvlComputer = hcalSevLvlComputerHndl.product();
542 
543  // Fill working vectors of HCAL RecHits quantities (all of these are drawn)
544  fillRecHitsTmp(subdet_, ev);
545 
546  // HB
547  if( subdet_ ==5 || subdet_ == 1 ){
548  for(unsigned int iv=0; iv<hcalHBSevLvlVec.size(); iv++){
550  }
551  }
552  // HE
553  if( subdet_ ==5 || subdet_ == 2 ){
554  for(unsigned int iv=0; iv<hcalHESevLvlVec.size(); iv++){
556  }
557  }
558  // HO
559  if( subdet_ ==5 || subdet_ == 3 ){
560  for(unsigned int iv=0; iv<hcalHOSevLvlVec.size(); iv++){
562  }
563  }
564  // HF
565  if( subdet_ ==5 || subdet_ == 4 ){
566  for(unsigned int iv=0; iv<hcalHFSevLvlVec.size(); iv++){
568  }
569  }
570 
571  //===========================================================================
572  // IN ALL other CASES : ieta-iphi maps
573  //===========================================================================
574 
575  // ECAL
576  if(ecalselector_ == "yes" && (subdet_ == 1 || subdet_ == 2 || subdet_ == 5)) {
577 
579  if ( ev.getByToken(tok_EB_, rhitEB) ) {
580 
581  for ( const auto & recHit : *(rhitEB.product()) ) {
582 
583  double en = recHit.energy();
584  eEcal += en;
585  eEcalB += en;
586  }
587  }
588 
589 
591  if ( ev.getByToken(tok_EE_, rhitEE) ) {
592 
593  for ( const auto & recHit : *(rhitEE.product()) ) {
594 
595  double en = recHit.energy();
596  eEcal += en;
597  eEcalE += en;
598 
599  }
600  }
601  } // end of ECAL selection
602 
603  // Counting, including ZS items
604  // Filling HCAL maps ----------------------------------------------------
605  // double maxE = -99999.;
606 
607  // element 0: any depth. element 1,2,..: depth 1,2
608  std::vector<int> nhb_v(maxDepthHB_+1,0);
609  std::vector<int> nhe_v(maxDepthHE_+1,0);
610  std::vector<int> nho_v(maxDepthHO_+1,0);
611  std::vector<int> nhf_v(maxDepthHF_+1,0);
612 
613  for (unsigned int i = 0; i < cen.size(); i++) {
614 
615  int sub = csub[i];
616  int depth = cdepth[i];
617  int ieta = cieta[i];
618  int iphi = ciphi[i];
619  double en = cen[i];
620  double enM0 = cenM0[i];
621  double enM3 = cenM3[i];
622  // double eta = ceta[i];
623  // double phi = cphi[i];
624  uint32_t stwd = cstwd[i];
625  uint32_t auxstwd = cauxstwd[i];
626  // double z = cz[i];
627 
628  //This will be true if hep17 == "yes" and the rechit is in the hep17 wedge
629  bool isHEP17 = (sub == 2) && (iphi >= 63) && (iphi <= 66) && (ieta > 0) && (hep17_);
630 
631  //Make sure that an invalid depth won't cause an error. We should probably report the problem as well.
632  if( depth < 1 ) continue;
633  if( sub == 1 && depth > maxDepthHB_ ) continue;
634  if( sub == 2 && depth > maxDepthHE_ ) continue;
635  if( sub == 3 && depth > maxDepthHO_ ) continue;
636  if( sub == 4 && depth > maxDepthHF_ ) continue;
637 
638  if( sub ==1 ){ nhb_v[depth]++; nhb_v[0]++;} // element 0: any depth, element 1,2,..: depth 1,2,...
639  if( sub ==2 ){ nhe_v[depth]++; nhe_v[0]++;} //
640  if( sub ==3 ){ nho_v[depth]++; nho_v[0]++;} //
641  if( sub ==4 ){ nhf_v[depth]++; nhf_v[0]++;} //
642 
643  if( subdet_ == 6) { // ZS specific
644  }
645 
646  if( subdet_ != 6) {
647  int ieta2 = ieta;
648  int depth2 = depth;
649  if(sub == 4){
650  if (ieta2 < 0) ieta2--;
651  else ieta2++;
652  }
653  if(sub == 3) depth2 = maxDepthAll_ - maxDepthHO_ + depth; //This will use the last depths for HO
654  emap[depth2-1]->Fill(double(ieta2),double(iphi),en);
655 
656  // to distinguish HE and HF
657  if( depth == 1 || depth == 2 ) {
658  int ieta1 = ieta;
659  if(sub == 4) {
660  if (ieta1 < 0) ieta1--;
661  else ieta1++;
662  }
663  }
664 
665  if ( sub == 1){
666  emean_vs_ieta_HB[depth-1]->Fill(double(ieta), en);
667  emean_vs_ieta_HBM0[depth-1]->Fill(double(ieta), enM0);
668  emean_vs_ieta_HBM3[depth-1]->Fill(double(ieta), enM3);
669  occupancy_map_HB[depth-1]->Fill(double(ieta),double(iphi));
670  if (ieta>0) nrechits_vs_iphi_HBP[depth-1]->Fill(double(iphi));
671  else nrechits_vs_iphi_HBM[depth-1]->Fill(double(iphi));
672  }
673  if ( sub == 2){
674  if(!isHEP17){
675  emean_vs_ieta_HE[depth-1]->Fill(double(ieta), en);
676  emean_vs_ieta_HEM0[depth-1]->Fill(double(ieta), enM0);
677  emean_vs_ieta_HEM3[depth-1]->Fill(double(ieta), enM3);
678  }else{
679  emean_vs_ieta_HEP17[depth-1]->Fill(double(ieta), en);
680  emean_vs_ieta_HEP17M0[depth-1]->Fill(double(ieta), enM0);
681  emean_vs_ieta_HEP17M3[depth-1]->Fill(double(ieta), enM3);
682  }
683  occupancy_map_HE[depth-1]->Fill(double(ieta),double(iphi));
684  if (ieta>0) nrechits_vs_iphi_HEP[depth-1]->Fill(double(iphi));
685  else nrechits_vs_iphi_HEM[depth-1]->Fill(double(iphi));
686  }
687  if ( sub == 3){
688  emean_vs_ieta_HO->Fill(double(ieta), en);
689  occupancy_map_HO->Fill(double(ieta),double(iphi));
690  if (ieta>0) nrechits_vs_iphi_HOP->Fill(double(iphi));
691  else nrechits_vs_iphi_HOM->Fill(double(iphi));
692  }
693  if ( sub == 4){
694  emean_vs_ieta_HF[depth-1]->Fill(double(ieta), en);
695  occupancy_map_HF[depth-1]->Fill(double(ieta),double(iphi));
696  if (ieta>0) nrechits_vs_iphi_HFP[depth-1]->Fill(double(iphi));
697  else nrechits_vs_iphi_HFM[depth-1]->Fill(double(iphi));
698  }
699  }
700 
701 
702 
703  //32-bit status word
704  uint32_t statadd;
705  unsigned int isw67 = 0;
706 
707  //Statusword correlation
708  unsigned int sw27 = 27;
709  unsigned int sw13 = 13;
710 
711  uint32_t statadd27 = 0x1<<sw27;
712  uint32_t statadd13 = 0x1<<sw13;
713 
714  float status27 = 0;
715  float status13 = 0;
716 
717  if(stwd & statadd27) status27 = 1;
718  if(stwd & statadd13) status13 = 1;
719 
720  if (sub == 1){
721  RecHit_StatusWordCorr_HB->Fill(status13, status27);
722  } else if (sub == 2){
723  RecHit_StatusWordCorr_HE->Fill(status13, status27);
724  }
725 
726 
727  for (unsigned int isw = 0; isw < 32; isw++){
728  statadd = 0x1<<(isw);
729  if (stwd & statadd){
730  if (sub == 1) RecHit_StatusWord_HB->Fill(isw);
731  else if (sub == 2) RecHit_StatusWord_HE->Fill(isw);
732  else if (sub == 3) RecHit_StatusWord_HO->Fill(isw);
733  else if (sub == 4){
735  if (isw == 6) isw67 += 1;
736  if (isw == 7) isw67 += 2;
737  }
738  }
739  }
740 
741  for (unsigned int isw =0; isw < 32; isw++){
742  statadd = 0x1<<(isw);
743  if( auxstwd & statadd ){
744  if (sub == 1) RecHit_Aux_StatusWord_HB->Fill(isw);
745  else if (sub == 2) RecHit_Aux_StatusWord_HE->Fill(isw);
746  else if (sub == 3) RecHit_Aux_StatusWord_HO->Fill(isw);
747  else if (sub == 4) RecHit_Aux_StatusWord_HF->Fill(isw);
748  }
749 
750  }
751 
752  }
753 
754  for(int depth = 0; depth <= maxDepthHB_; depth++) Nhb[depth]->Fill(double(nhb_v[depth]));
755  for(int depth = 0; depth <= maxDepthHE_; depth++) Nhe[depth]->Fill(double(nhe_v[depth]));
756  for(int depth = 0; depth <= maxDepthHO_; depth++) Nho[depth]->Fill(double(nho_v[depth]));
757  for(int depth = 0; depth <= maxDepthHF_; depth++) Nhf[depth]->Fill(double(nhf_v[depth]));
758 
759  //===========================================================================
760  // SUBSYSTEMS,
761  //===========================================================================
762 
763  if ((subdet_ != 6) && (subdet_ != 0)) {
764 
765  double clusEta = 999.;
766  double clusPhi = 999.;
767  double clusEn = 0.;
768 
769  double HcalCone = 0.;
770 
771  int ietaMax = 9999;
772  // double enMax1 = -9999.;
773  // double enMax2 = -9999.;
774  // double enMax3 = -9999.;
775  // double enMax4 = -9999.;
776  // double enMax = -9999.;
777  // double etaMax = 9999.;
778 
779  // CYCLE over cells ====================================================
780 
781  for (unsigned int i = 0; i < cen.size(); i++) {
782  int sub = csub[i];
783  double eta = ceta[i];
784  double phi = cphi[i];
785  double ieta = cieta[i];
786  double iphi = ciphi[i];
787  double en = cen[i];
788  double enM0 = cenM0[i];
789  double enM3 = cenM3[i];
790  double chi2 = cchi2[i];
791  double t = ctime[i];
792  double depth = cdepth[i];
793 
794  bool isHEP17 = (sub == 2) && (iphi >= 63) && (iphi <= 66) && (ieta > 0) && (hep17_);
795 
796 // int ieta = cieta[i];
797 
798  double rhot = dR(etaHot, phiHot, eta, phi);
799  if(rhot < partR && en > 1.) {
800  clusEta = (clusEta * clusEn + eta * en)/(clusEn + en);
801  clusPhi = phi12(clusPhi, clusEn, phi, en);
802  clusEn += en;
803  }
804 
805  nrechits++;
806  eHcal += en;
807 
808  if(en > 1. ) nrechitsThresh++;
809 
810  //The energy and overall timing histos are drawn while
811  //the ones split by depth are not
812  if(sub == 1 && (subdet_ == 1 || subdet_ == 5)) {
813  meTimeHB->Fill(t);
814  meRecHitsEnergyHB->Fill(en);
815  meRecHitsEnergyHBM0->Fill(enM0);
816  meRecHitsEnergyHBM3->Fill(enM3);
817 
818  meRecHitsEnergyM2vM0HB->Fill(enM0,en);
819  meRecHitsEnergyM3vM0HB->Fill(enM0,enM3);
820  meRecHitsEnergyM3vM2HB->Fill(en,enM3);
821 
822  meRecHitsM2Chi2HB->Fill(log10(chi2));
823  meLog10Chi2profileHB->Fill(en,log10(chi2));
824 
825  meTE_Low_HB->Fill( en, t);
826  meTE_HB->Fill( en, t);
827  meTE_High_HB->Fill( en, t);
828  meTEprofileHB_Low->Fill(en, t);
829  meTEprofileHB->Fill(en, t);
830  meTEprofileHB_High->Fill(en, t);
831  }
832  if(sub == 2 && (subdet_ == 2 || subdet_ == 5)) {
833  meTimeHE->Fill(t);
834  if(!isHEP17){
835  meRecHitsEnergyHE->Fill(en);
836  meRecHitsEnergyHEM0->Fill(enM0);
837  meRecHitsEnergyHEM3->Fill(enM3);
838  }else{
839  meRecHitsEnergyHEP17[0]->Fill(en);
840  meRecHitsEnergyHEP17M0[0]->Fill(enM0);
841  meRecHitsEnergyHEP17M3[0]->Fill(enM3);
842  meRecHitsEnergyHEP17[depth]->Fill(en);
843  meRecHitsEnergyHEP17M0[depth]->Fill(enM0);
844  meRecHitsEnergyHEP17M3[depth]->Fill(enM3);
845  }
846 
847  meRecHitsEnergyM2vM0HE->Fill(enM0,en);
848  meRecHitsEnergyM3vM0HE->Fill(enM0,enM3);
849  meRecHitsEnergyM3vM2HE->Fill(en,enM3);
850 
851  meRecHitsM2Chi2HE->Fill(log10(chi2));
852  meLog10Chi2profileHE->Fill(en,log10(chi2));
853 
854  meTE_Low_HE->Fill( en, t);
855  meTE_HE->Fill( en, t);
856  meTEprofileHE_Low->Fill(en, t);
857  meTEprofileHE->Fill(en, t);
858  }
859  if(sub == 4 && (subdet_ == 4 || subdet_ == 5)) {
860  meTimeHF->Fill(t);
861  meRecHitsEnergyHF->Fill(en);
862 
863  meTE_Low_HF->Fill(en, t);
864  meTE_HF->Fill(en, t);
865  meTEprofileHF_Low->Fill(en, t);
866  meTEprofileHF->Fill(en, t);
867 
868  }
869  if(sub == 3 && (subdet_ == 3 || subdet_ == 5)) {
870  meTimeHO->Fill(t);
871  meRecHitsEnergyHO->Fill(en);
872 
873  meTE_HO->Fill( en, t);
874  meTE_High_HO->Fill( en, t);
875  meTEprofileHO->Fill(en, t);
876  meTEprofileHO_High->Fill(en, t);
877  }
878  }
879 
880  if(imc != 0) {
881  //Cone by depth are not drawn, the others are used for pion scan
882  meEnConeEtaProfile ->Fill(double(ietaMax), HcalCone); //
883  meEnConeEtaProfile_E ->Fill(double(ietaMax), eEcalCone);
884  meEnConeEtaProfile_EH ->Fill(double(ietaMax), HcalCone+eEcalCone);
885  }
886 
887  // Single particle samples ONLY ! ======================================
888  // Fill up some histos for "integrated" subsustems.
889  // These are not drawn
890  }
891 
892  nevtot++;
893 }
894 
895 
898 
899  using namespace edm;
900 
901 
902  // initialize data vectors
903  csub.clear();
904  cen.clear();
905  cenM0.clear();
906  cenM3.clear();
907  cchi2.clear();
908  ceta.clear();
909  cphi.clear();
910  ctime.clear();
911  cieta.clear();
912  ciphi.clear();
913  cdepth.clear();
914  cz.clear();
915  cstwd.clear();
916  cauxstwd.clear();
917  hcalHBSevLvlVec.clear();
918  hcalHESevLvlVec.clear();
919  hcalHFSevLvlVec.clear();
920  hcalHOSevLvlVec.clear();
921 
922  if( subdet_ == 1 || subdet_ == 2 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
923 
924  //HBHE
926  if ( ev.getByToken(tok_hbhe_, hbhecoll) ) {
927 
928  for (HBHERecHitCollection::const_iterator j=hbhecoll->begin(); j != hbhecoll->end(); j++) {
929  HcalDetId cell(j->id());
930  const HcalGeometry* cellGeometry =
931  (HcalGeometry*)(geometry->getSubdetectorGeometry(cell));
932  double eta = cellGeometry->getPosition(cell).eta () ;
933  double phi = cellGeometry->getPosition(cell).phi () ;
934  double zc = cellGeometry->getPosition(cell).z ();
935  int sub = cell.subdet();
936  int depth = cell.depth();
937  int inteta = cell.ieta();
938  int intphi = cell.iphi();
939  double en = j->energy();
940  double enM0 = j->eraw();
941  double enM3 = j->eaux();
942  double chi2 = j->chi2();
943  double t = j->time();
944  int stwd = j->flags();
945  int auxstwd = j->aux();
946 
947  int severityLevel = hcalSevLvl( (CaloRecHit*) &*j );
948  if( cell.subdet()==HcalBarrel ){
949  hcalHBSevLvlVec.push_back(severityLevel);
950  }else if (cell.subdet()==HcalEndcap ){
951  hcalHESevLvlVec.push_back(severityLevel);
952  }
953 
954  if((iz > 0 && eta > 0.) || (iz < 0 && eta <0.) || iz == 0) {
955 
956  csub.push_back(sub);
957  cen.push_back(en);
958  cenM0.push_back(enM0);
959  cenM3.push_back(enM3);
960  cchi2.push_back(chi2);
961  ceta.push_back(eta);
962  cphi.push_back(phi);
963  ctime.push_back(t);
964  cieta.push_back(inteta);
965  ciphi.push_back(intphi);
966  cdepth.push_back(depth);
967  cz.push_back(zc);
968  cstwd.push_back(stwd);
969  cauxstwd.push_back(auxstwd);
970  }
971  }
972 
973  }
974  }
975 
976  if( subdet_ == 4 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
977 
978  //HF
980  if ( ev.getByToken(tok_hf_, hfcoll) ) {
981 
982  for (HFRecHitCollection::const_iterator j = hfcoll->begin(); j != hfcoll->end(); j++) {
983  HcalDetId cell(j->id());
984  const CaloCellGeometry* cellGeometry =
985  geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
986  double eta = cellGeometry->getPosition().eta () ;
987  double phi = cellGeometry->getPosition().phi () ;
988  double zc = cellGeometry->getPosition().z ();
989  int sub = cell.subdet();
990  int depth = cell.depth();
991  int inteta = cell.ieta();
992  int intphi = cell.iphi();
993  double en = j->energy();
994  double enM0 = 0.;
995  double enM3 = 0.;
996  double chi2 = 0.;
997  double t = j->time();
998  int stwd = j->flags();
999  int auxstwd = j->aux();
1000 
1001  int severityLevel = hcalSevLvl( (CaloRecHit*) &*j );
1002  if( cell.subdet()==HcalForward ){
1003  hcalHFSevLvlVec.push_back(severityLevel);
1004  }
1005 
1006  if((iz > 0 && eta > 0.) || (iz < 0 && eta <0.) || iz == 0) {
1007 
1008  csub.push_back(sub);
1009  cen.push_back(en);
1010  cenM0.push_back(enM0);
1011  cenM3.push_back(enM3);
1012  cchi2.push_back(chi2);
1013  ceta.push_back(eta);
1014  cphi.push_back(phi);
1015  ctime.push_back(t);
1016  cieta.push_back(inteta);
1017  ciphi.push_back(intphi);
1018  cdepth.push_back(depth);
1019  cz.push_back(zc);
1020  cstwd.push_back(stwd);
1021  cauxstwd.push_back(auxstwd);
1022  }
1023  }
1024  }
1025  }
1026 
1027  //HO
1028  if( subdet_ == 3 || subdet_ == 5 || subdet_ == 6 || subdet_ == 0) {
1029 
1031  if ( ev.getByToken(tok_ho_, hocoll) ) {
1032 
1033  for (HORecHitCollection::const_iterator j = hocoll->begin(); j != hocoll->end(); j++) {
1034  HcalDetId cell(j->id());
1035  const CaloCellGeometry* cellGeometry =
1036  geometry->getSubdetectorGeometry (cell)->getGeometry (cell) ;
1037  double eta = cellGeometry->getPosition().eta () ;
1038  double phi = cellGeometry->getPosition().phi () ;
1039  double zc = cellGeometry->getPosition().z ();
1040  int sub = cell.subdet();
1041  int depth = cell.depth();
1042  int inteta = cell.ieta();
1043  int intphi = cell.iphi();
1044  double t = j->time();
1045  double en = j->energy();
1046  double enM0 = 0.;
1047  double enM3 = 0.;
1048  double chi2 = 0.;
1049  int stwd = j->flags();
1050  int auxstwd = j->aux();
1051 
1052  int severityLevel = hcalSevLvl( (CaloRecHit*) &*j );
1053  if( cell.subdet()==HcalOuter ){
1054  hcalHOSevLvlVec.push_back(severityLevel);
1055  }
1056 
1057  if((iz > 0 && eta > 0.) || (iz < 0 && eta <0.) || iz == 0) {
1058  csub.push_back(sub);
1059  cen.push_back(en);
1060  cenM0.push_back(enM0);
1061  cenM3.push_back(enM3);
1062  cchi2.push_back(chi2);
1063  ceta.push_back(eta);
1064  cphi.push_back(phi);
1065  ctime.push_back(t);
1066  cieta.push_back(inteta);
1067  ciphi.push_back(intphi);
1068  cdepth.push_back(depth);
1069  cz.push_back(zc);
1070  cstwd.push_back(stwd);
1071  cauxstwd.push_back(auxstwd);
1072  }
1073  }
1074  }
1075  }
1076 }
1077 
1078 double HcalRecHitsAnalyzer::dR(double eta1, double phi1, double eta2, double phi2) {
1079  double PI = 3.1415926535898;
1080  double deltaphi= phi1 - phi2;
1081  if( phi2 > phi1 ) { deltaphi= phi2 - phi1;}
1082  if(deltaphi > PI) { deltaphi = 2.*PI - deltaphi;}
1083  double deltaeta = eta2 - eta1;
1084  double tmp = sqrt(deltaeta* deltaeta + deltaphi*deltaphi);
1085  return tmp;
1086 }
1087 
1088 double HcalRecHitsAnalyzer::phi12(double phi1, double en1, double phi2, double en2) {
1089  // weighted mean value of phi1 and phi2
1090 
1091  double tmp;
1092  double PI = 3.1415926535898;
1093  double a1 = phi1; double a2 = phi2;
1094 
1095  if( a1 > 0.5*PI && a2 < 0.) a2 += 2*PI;
1096  if( a2 > 0.5*PI && a1 < 0.) a1 += 2*PI;
1097  tmp = (a1 * en1 + a2 * en2)/(en1 + en2);
1098  if(tmp > PI) tmp -= 2.*PI;
1099 
1100  return tmp;
1101 
1102 }
1103 
1104 double HcalRecHitsAnalyzer::dPhiWsign(double phi1, double phi2) {
1105  // clockwise phi2 w.r.t phi1 means "+" phi distance
1106  // anti-clockwise phi2 w.r.t phi1 means "-" phi distance
1107 
1108  double PI = 3.1415926535898;
1109  double a1 = phi1; double a2 = phi2;
1110  double tmp = a2 - a1;
1111  if( a1*a2 < 0.) {
1112  if(a1 > 0.5 * PI) tmp += 2.*PI;
1113  if(a2 > 0.5 * PI) tmp -= 2.*PI;
1114  }
1115  return tmp;
1116 
1117 }
1118 
1120 
1121  HcalDetId id = hit->detid();
1122  if (theHcalTopology->withSpecialRBXHBHE() && id.subdet() == HcalEndcap) {
1123  id = theHcalTopology->idFront(id);
1124  }
1125 
1126  const uint32_t recHitFlag = hit->flags();
1127  const uint32_t dbStatusFlag = theHcalChStatus->getValues(id)->getValue();
1128 
1129  int severityLevel = theHcalSevLvlComputer->getSeverityLevel(id, recHitFlag, dbStatusFlag);
1130 
1131  return severityLevel;
1132 
1133 }
1134 
1136 
std::vector< MonitorElement * > emean_vs_ieta_HEP17
int getNPhi(const int type) const
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:460
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
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