CMS 3D CMS Logo

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