CMS 3D CMS Logo

CaloTowersAnalyzer.cc
Go to the documentation of this file.
5 
7 
8  tok_towers_ = consumes<CaloTowerCollection>(conf.getUntrackedParameter<edm::InputTag>("CaloTowerCollectionLabel"));
9  // DQM ROOT output
10 
11  outputFile_ = conf.getUntrackedParameter<std::string>("outputFile", "myfile.root");
12 
13  hcalselector_ = conf.getUntrackedParameter<std::string>("hcalselector", "all");
14 
15  useAllHistos_ = conf.getUntrackedParameter<bool>("useAllHistos", false);
16 }
17 
19 
21  es.get<HcalRecNumberingRecord>().get( pHRNDC );
22  hcons = &(*pHRNDC);
23 
24  //Get Phi segmentation from geometry, use the max phi number so that all iphi values are included.
25 
26  int NphiMax = hcons->getNPhi(0);
27 
28  NphiMax = (hcons->getNPhi(1) > NphiMax ? hcons->getNPhi(1) : NphiMax);
29  NphiMax = (hcons->getNPhi(2) > NphiMax ? hcons->getNPhi(2) : NphiMax);
30  NphiMax = (hcons->getNPhi(3) > NphiMax ? hcons->getNPhi(3) : NphiMax);
31 
32  //Center the iphi bins on the integers
33  iphi_min_ = 0.5;
34  iphi_max_ = NphiMax + 0.5;
36 
37  //Retain classic behavior, all plots have same ieta range.
38 
39  int iEtaMax = (hcons->getEtaRange(0).second > hcons->getEtaRange(1).second ? hcons->getEtaRange(0).second : hcons->getEtaRange(1).second);
40  iEtaMax = (iEtaMax > hcons->getEtaRange(2).second ? iEtaMax : hcons->getEtaRange(2).second);
41  iEtaMax = (iEtaMax > hcons->getEtaRange(3).second ? iEtaMax : hcons->getEtaRange(3).second);
42 
43  //Give an empty bin around the subdet ieta range to make it clear that all ieta rings have been included
44  ieta_min_ = -iEtaMax - 1.5;
45  ieta_max_ = iEtaMax + 1.5;
47 
48 }
49 
50 void CaloTowersAnalyzer::bookHistograms(DQMStore::IBooker & ibooker, edm::Run const & /* iRun*/, edm::EventSetup const & /* iSetup */)
51 {
52 
53  etaMin[0] = 0.;
54  etaMax[0] = 1.4;
55  etaMin[1] = 1.4;
56  etaMax[1] = 2.9;
57  etaMin[2] = 2.9;
58  etaMax[2] = 5.2;
59 
60  isub = 0;
61  if(hcalselector_ == "HB") isub = 1;
62  if(hcalselector_ == "HE") isub = 2;
63  if(hcalselector_ == "HF") isub = 3;
64 
65  if ( outputFile_.size() != 0 ) {
66  edm::LogInfo("OutputInfo") << " Hcal RecHit Task histograms will be saved to '" << outputFile_.c_str() << "'";
67  } else {
68  edm::LogInfo("OutputInfo") << " Hcal RecHit Task histograms will NOT be saved";
69  }
70 
71  Char_t histo[100];
72 
73 
74  ibooker.setCurrentFolder("CaloTowersD/CaloTowersTask") ;
75 
76 
77 
78  //These two histos are not drawn by our macros, but they are used
79  //in the EndJob for norms and such so I am leaving them alone for now
80  //-------------------------------------------------------------------------------------------
81  sprintf (histo, "Ntowers_per_event_vs_ieta" );
82  Ntowers_vs_ieta = ibooker.book1D(histo, histo, ieta_bins_, ieta_min_, ieta_max_);
83 
84  sprintf (histo, "CaloTowersTask_map_Nentries" );
86  //-------------------------------------------------------------------------------------------
87 
88  //These the single pion scan histos
89  //-------------------------------------------------------------------------------------------
90  //The first three are not used
91  if (useAllHistos_){
92  sprintf (histo, "emean_vs_ieta_E" );
93  emean_vs_ieta_E = ibooker.bookProfile(histo, histo, ieta_bins_, ieta_min_, ieta_max_, 2100, -100., 2000.);
94  sprintf (histo, "emean_vs_ieta_H" );
95  emean_vs_ieta_H = ibooker.bookProfile(histo, histo, ieta_bins_, ieta_min_, ieta_max_, 2100, -100., 2000.);
96  sprintf (histo, "emean_vs_ieta_EH" );
97  emean_vs_ieta_EH = ibooker.bookProfile(histo, histo, ieta_bins_, ieta_min_, ieta_max_, 2100, -100., 2000.);
98  }
99  //These are drawn
100  sprintf (histo, "emean_vs_ieta_E1" );
101  emean_vs_ieta_E1 = ibooker.bookProfile(histo, histo, ieta_bins_, ieta_min_, ieta_max_, 2100, -100., 2000.);
102  sprintf (histo, "emean_vs_ieta_H1" );
103  emean_vs_ieta_H1 = ibooker.bookProfile(histo, histo, ieta_bins_, ieta_min_, ieta_max_, 2100, -100., 2000.);
104  sprintf (histo, "emean_vs_ieta_EH1" );
105  emean_vs_ieta_EH1 = ibooker.bookProfile(histo, histo, ieta_bins_, ieta_min_, ieta_max_, 2100, -100., 2000.);
106  //-------------------------------------------------------------------------------------------
107 
108  //Map energy histos are not drawn
109  if (useAllHistos_){
110  sprintf (histo, "CaloTowersTask_map_energy_E" );
112  sprintf (histo, "CaloTowersTask_map_energy_H");
114  sprintf (histo, "CaloTowersTask_map_energy_EH" );
116  }
117 
118  //All ECAL cell histos are used
119  // XXX: ECAL 0-25 [0-26, 26 bins] HCAL 0-4 [0-5, 5 bins]
120  sprintf (histo, "number_of_bad_cells_Ecal_EB");
121  numBadCellsEcal_EB = ibooker.book1D(histo, histo, 26, 0, 26);
122  sprintf (histo, "number_of_bad_cells_Ecal_EE");
123  numBadCellsEcal_EE = ibooker.book1D(histo, histo, 26, 0, 26);
124  sprintf (histo, "number_of_recovered_cells_Ecal_EB");
125  numRcvCellsEcal_EB = ibooker.book1D(histo, histo, 26, 0, 26);
126  sprintf (histo, "number_of_recovered_cells_Ecal_EE");
127  numRcvCellsEcal_EE = ibooker.book1D(histo, histo, 26, 0, 26);
128  sprintf (histo, "number_of_problematic_cells_Ecal_EB");
129  numPrbCellsEcal_EB = ibooker.book1D(histo, histo, 26, 0, 26);
130  sprintf (histo, "number_of_problematic_cells_Ecal_EE");
131  numPrbCellsEcal_EE = ibooker.book1D(histo, histo, 26, 0, 26);
132 
133  //Occupancy vs. ieta is drawn, occupancy map is needed to draw it
134  sprintf (histo, "CaloTowersTask_map_occupancy" );
136 
137  sprintf (histo, "CaloTowersTask_occupancy_vs_ieta" );
138  occupancy_vs_ieta = ibooker.book1D(histo, histo, ieta_bins_, -41, 41);
139 
140  if( isub == 1 || isub == 0) {
141  //All cell histos are used
142  sprintf (histo, "number_of_bad_cells_Hcal_HB");
143  numBadCellsHcal_HB = ibooker.book1D(histo, histo, 5, 0, 5);
144  sprintf (histo, "number_of_recovered_cells_Hcal_HB");
145  numRcvCellsHcal_HB = ibooker.book1D(histo, histo, 5, 0, 5);
146  sprintf (histo, "number_of_problematic_cells_Hcal_HB");
147  numPrbCellsHcal_HB = ibooker.book1D(histo, histo, 5, 0, 5);
148 
149  //These are the five oldest CaloTower histos used: NTowers, E in HCAL/ECAL, MET and SET
150  //-------------------------------------------------------------------------------------------
151  sprintf (histo, "CaloTowersTask_energy_HCAL_HB" ) ;
152  meEnergyHcal_HB = ibooker.book1D(histo, histo, 4100, -200, 8000);
153 
154  sprintf (histo, "CaloTowersTask_energy_ECAL_HB" ) ;
155  meEnergyEcal_HB = ibooker.book1D(histo, histo, 3100, -200, 6000);
156 
157  sprintf (histo, "CaloTowersTask_number_of_fired_towers_HB" ) ;
158  meNumFiredTowers_HB = ibooker.book1D(histo, histo, 1000, 0, 2000);
159 
160  sprintf (histo, "CaloTowersTask_MET_HB" ) ;
161  MET_HB = ibooker.book1D(histo, histo, 3000, 0. , 3000. ) ;
162 
163  sprintf (histo, "CaloTowersTask_SET_HB" ) ;
164  SET_HB = ibooker.book1D(histo, histo, 8000, 0. , 8000. ) ;
165  //-------------------------------------------------------------------------------------------
166 
167  //Timing histos and profiles -- all six are necessary
168  //-------------------------------------------------------------------------------------------
169  sprintf (histo, "CaloTowersTask_EM_Timing_HB" ) ;
170  emTiming_HB = ibooker.book1D(histo, histo, 110, -120., 100. ) ;
171 
172  sprintf (histo, "CaloTowersTask_HAD_Timing_HB" ) ;
173  hadTiming_HB = ibooker.book1D(histo, histo, 70, -48., 92. ) ;
174 
175  //Energy-Timing histos are divided into low, medium and high to reduce memory usage
176  //EM
177  sprintf (histo, "CaloTowersTask_EM_Energy_Timing_Low_HB" ) ;
178  emEnergyTiming_Low_HB = ibooker.book2D(histo, histo, 40, 0. , 40., 110, -120., 100. ) ;
179 
180  sprintf (histo, "CaloTowersTask_EM_Energy_Timing_HB" ) ;
181  emEnergyTiming_HB = ibooker.book2D(histo, histo, 200, 0. , 400., 110, -120., 100. ) ;
182 
183  sprintf (histo, "CaloTowersTask_EM_Energy_Timing_High_HB" ) ;
184  emEnergyTiming_High_HB = ibooker.book2D(histo, histo, 200, 0. , 3000., 110, -120., 100. ) ;
185 
186  sprintf (histo, "CaloTowersTask_EM_Energy_Timing_profile_Low_HB" ) ;
187  emEnergyTiming_profile_Low_HB = ibooker.bookProfile(histo, histo, 40, 0. , 40., 110, -120., 100. ) ;
188 
189  sprintf (histo, "CaloTowersTask_EM_Energy_Timing_profile_HB" ) ;
190  emEnergyTiming_profile_HB = ibooker.bookProfile(histo, histo, 200, 0. , 400., 110, -120., 100. ) ;
191 
192  sprintf (histo, "CaloTowersTask_EM_Energy_Timing_profile_High_HB" ) ;
193  emEnergyTiming_profile_High_HB = ibooker.bookProfile(histo, histo, 200, 0. , 3000., 110, -120., 100. ) ;
194 
195  //HAD
196  sprintf (histo, "CaloTowersTask_HAD_Energy_Timing_Low_HB" ) ;
197  hadEnergyTiming_Low_HB = ibooker.book2D(histo, histo, 40, 0. , 40., 70, -48., 92. ) ;
198 
199  sprintf (histo, "CaloTowersTask_HAD_Energy_Timing_HB" ) ;
200  hadEnergyTiming_HB = ibooker.book2D(histo, histo, 100, 0. , 200., 70, -48., 92. ) ;
201 
202  sprintf (histo, "CaloTowersTask_HAD_Energy_Timing_High_HB" ) ;
203  hadEnergyTiming_High_HB = ibooker.book2D(histo, histo, 300, 0. , 3000., 70, -48., 92. ) ;
204 
205  sprintf (histo, "CaloTowersTask_HAD_Energy_Timing_profile_Low_HB" ) ;
206  hadEnergyTiming_profile_Low_HB = ibooker.bookProfile(histo, histo, 40, 0. , 40., 70, -48., 92. ) ;
207 
208  sprintf (histo, "CaloTowersTask_HAD_Energy_Timing_profile_HB" ) ;
209  hadEnergyTiming_profile_HB = ibooker.bookProfile(histo, histo, 100, 0. , 200., 70, -48., 92. ) ;
210 
211  sprintf (histo, "CaloTowersTask_HAD_Energy_Timing_profile_High_HB" ) ;
212  hadEnergyTiming_profile_High_HB = ibooker.bookProfile(histo, histo, 300, 0. , 3000., 70, -48., 92. ) ;
213  //-------------------------------------------------------------------------------------------
214 
215  sprintf (histo, "CaloTowersTask_Iphi_HCAL_component_of_tower_HBP" ) ;
216  meIphiHcalTower_HBP = ibooker.book1D(histo, histo, iphi_bins_, iphi_min_, iphi_max_);
217  sprintf (histo, "CaloTowersTask_Iphi_HCAL_component_of_tower_HBM" ) ;
218  meIphiHcalTower_HBM = ibooker.book1D(histo, histo, iphi_bins_, iphi_min_, iphi_max_);
219 
220  //-------------------------------------------------------------------------------------------
221 
222  //Everything else is not drawn
223  if (useAllHistos_){
224  sprintf (histo, "CaloTowersTask_sum_of_energy_HCAL_vs_ECAL_HB") ;
225  meEnergyHcalvsEcal_HB = ibooker.book2D(histo, histo, 500, 0., 500., 500, 0., 500.);
226 
227  sprintf (histo, "CaloTowersTask_energy_OUTER_HB" ) ;
228  meEnergyHO_HB = ibooker.book1D(histo, histo, 1640, -200, 8000);
229 
230  sprintf (histo, "CaloTowersTask_energy_of_ECAL_component_of_tower_HB" ) ;
231  meEnergyEcalTower_HB = ibooker.book1D(histo, histo, 440, -200, 2000);
232 
233  sprintf (histo, "CaloTowersTask_energy_of_HCAL_component_of_tower_HB" ) ;
234  meEnergyHcalTower_HB = ibooker.book1D(histo, histo, 440 , -200 , 2000);
235 
236  sprintf (histo, "CaloTowersTask_energy_HcalPlusEcalPlusHO_HB" ) ;
237  meTotEnergy_HB = ibooker.book1D(histo, histo,400, 0., 2000.) ;
238 
239  sprintf (histo, "CaloTowersTask_map_energy_HB" );
241  sprintf (histo, "CaloTowersTask_map_energy_HCAL_HB");
243  sprintf (histo, "CaloTowersTask_map_energy_ECAL_HB" );
245 
246  sprintf (histo, "CaloTowersTask_phi_MET_HB" ) ;
247  phiMET_HB = ibooker.book1D(histo, histo, 72, -3.1415926535898, 3.1415926535898 ) ;
248  }
249  }
250 
251  if( isub == 2 || isub == 0) {
252  //All cell histos are used
253  sprintf (histo, "number_of_bad_cells_Hcal_HE");
254  numBadCellsHcal_HE = ibooker.book1D(histo, histo, 5, 0, 5);
255  sprintf (histo, "number_of_recovered_cells_Hcal_HE");
256  numRcvCellsHcal_HE = ibooker.book1D(histo, histo, 5, 0, 5);
257  sprintf (histo, "number_of_problematic_cells_Hcal_HE");
258  numPrbCellsHcal_HE = ibooker.book1D(histo, histo, 5, 0, 5);
259 
260  //These are the five oldest CaloTower histos used: NTowers, E in HCAL/ECAL, MET and SET
261  //-------------------------------------------------------------------------------------------
262  sprintf (histo, "CaloTowersTask_energy_HCAL_HE" ) ;
263  meEnergyHcal_HE = ibooker.book1D(histo, histo, 1240, -200, 6000);
264 
265  sprintf (histo, "CaloTowersTask_energy_ECAL_HE" ) ;
266  meEnergyEcal_HE = ibooker.book1D(histo, histo, 1240, -200, 6000);
267 
268  sprintf (histo, "CaloTowersTask_number_of_fired_towers_HE" ) ;
269  meNumFiredTowers_HE = ibooker.book1D(histo, histo, 1000, 0, 2000);
270 
271  sprintf (histo, "CaloTowersTask_MET_HE" ) ;
272  MET_HE = ibooker.book1D(histo, histo, 1000, 0. , 1000. ) ;
273 
274  sprintf (histo, "CaloTowersTask_SET_HE" ) ;
275  SET_HE = ibooker.book1D(histo, histo, 2000, 0. , 2000. ) ;
276  //-------------------------------------------------------------------------------------------
277 
278  //Timing histos and profiles -- all six are necessary
279  //-------------------------------------------------------------------------------------------
280  sprintf (histo, "CaloTowersTask_EM_Timing_HE" ) ;
281  emTiming_HE = ibooker.book1D(histo, histo, 110, -120., 100. ) ;
282 
283  sprintf (histo, "CaloTowersTask_HAD_Timing_HE" ) ;
284  hadTiming_HE = ibooker.book1D(histo, histo, 70, -48., 92. ) ;
285 
286  //Energy-Timing histos are divided into low and normal to reduce memory usage
287  //EM
288  sprintf (histo, "CaloTowersTask_EM_Energy_Timing_Low_HE" ) ;
289  emEnergyTiming_Low_HE = ibooker.book2D(histo, histo, 160, 0. , 160., 110, -120., 100. ) ;
290 
291  sprintf (histo, "CaloTowersTask_EM_Energy_Timing_HE" ) ;
292  emEnergyTiming_HE = ibooker.book2D(histo, histo, 200, 0. , 800., 110, -120., 100. ) ;
293 
294  sprintf (histo, "CaloTowersTask_EM_Energy_Timing_profile_Low_HE" ) ;
295  emEnergyTiming_profile_Low_HE = ibooker.bookProfile(histo, histo, 160, 0. , 160., 110, -120., 100. ) ;
296 
297  sprintf (histo, "CaloTowersTask_EM_Energy_Timing_profile_HE" ) ;
298  emEnergyTiming_profile_HE = ibooker.bookProfile(histo, histo, 200, 0. , 800., 110, -120., 100. ) ;
299 
300  //HAD
301  sprintf (histo, "CaloTowersTask_HAD_Energy_Timing_Low_HE" ) ;
302  hadEnergyTiming_Low_HE = ibooker.book2D(histo, histo, 160, 0. , 160., 70, -48., 92. ) ;
303 
304  sprintf (histo, "CaloTowersTask_HAD_Energy_Timing_HE" ) ;
305  hadEnergyTiming_HE = ibooker.book2D(histo, histo, 200, 0. , 800., 70, -48., 92. ) ;
306 
307  sprintf (histo, "CaloTowersTask_HAD_Energy_Timing_profile_Low_HE" ) ;
308  hadEnergyTiming_profile_Low_HE = ibooker.bookProfile(histo, histo, 160, 0. , 160., 70, -48., 92. ) ;
309 
310  sprintf (histo, "CaloTowersTask_HAD_Energy_Timing_profile_HE" ) ;
311  hadEnergyTiming_profile_HE = ibooker.bookProfile(histo, histo, 200, 0. , 800., 70, -48., 92. ) ;
312  //-------------------------------------------------------------------------------------------
313 
314  sprintf (histo, "CaloTowersTask_Iphi_HCAL_component_of_tower_HEP" ) ;
315  meIphiHcalTower_HEP = ibooker.book1D(histo, histo, iphi_bins_, iphi_min_, iphi_max_);
316  sprintf (histo, "CaloTowersTask_Iphi_HCAL_component_of_tower_HEM" ) ;
317  meIphiHcalTower_HEM = ibooker.book1D(histo, histo, iphi_bins_, iphi_min_, iphi_max_);
318 
319  //-------------------------------------------------------------------------------------------
320 
321  //Everything else is not drawn
322  if (useAllHistos_){
323  sprintf (histo, "CaloTowersTask_sum_of_energy_HCAL_vs_ECAL_HE") ;
324  meEnergyHcalvsEcal_HE = ibooker.book2D(histo, histo, 500, 0., 500., 500, 0., 500.);
325 
326  sprintf (histo, "CaloTowersTask_energy_OUTER_HE" ) ;
327  meEnergyHO_HE = ibooker.book1D(histo, histo, 440, -200, 2000);
328 
329  sprintf (histo, "CaloTowersTask_energy_of_ECAL_component_of_tower_HE" ) ;
330  meEnergyEcalTower_HE = ibooker.book1D(histo, histo, 1100, -200, 2000);
331 
332  sprintf (histo, "CaloTowersTask_energy_of_HCAL_component_of_tower_HE" ) ;
333  meEnergyHcalTower_HE = ibooker.book1D(histo, histo, 1100 , -200 , 2000);
334 
335  sprintf (histo, "CaloTowersTask_energy_HcalPlusEcalPlusHO_HE" ) ;
336  meTotEnergy_HE = ibooker.book1D(histo, histo,400, 0., 2000.) ;
337 
338  sprintf (histo, "CaloTowersTask_map_energy_HE" );
340  sprintf (histo, "CaloTowersTask_map_energy_HCAL_HE");
342  sprintf (histo, "CaloTowersTask_map_energy_ECAL_HE" );
344 
345  sprintf (histo, "CaloTowersTask_phi_MET_HE" ) ;
346  phiMET_HE = ibooker.book1D(histo, histo, 72, -3.1415926535898, 3.1415926535898 ) ;
347  }
348  }
349 
350 
351  if( isub == 3 || isub == 0) {
352  //All cell histos are used
353  sprintf (histo, "number_of_bad_cells_Hcal_HF");
354  numBadCellsHcal_HF = ibooker.book1D(histo, histo, 5, 0, 5);
355  sprintf (histo, "number_of_recovered_cells_Hcal_HF");
356  numRcvCellsHcal_HF = ibooker.book1D(histo, histo, 5, 0, 5);
357  sprintf (histo, "number_of_problematic_cells_Hcal_HF");
358  numPrbCellsHcal_HF = ibooker.book1D(histo, histo, 5, 0, 5);
359 
360  //These are the five oldest CaloTower histos used: NTowers, E in HCAL/ECAL, MET and SET
361  //-------------------------------------------------------------------------------------------
362  sprintf (histo, "CaloTowersTask_energy_HCAL_HF" ) ;
363  meEnergyHcal_HF = ibooker.book1D(histo, histo, 4040, -200, 20000);
364 
365  sprintf (histo, "CaloTowersTask_energy_ECAL_HF" ) ;
366  meEnergyEcal_HF = ibooker.book1D(histo, histo, 2440, -200, 12000);
367 
368  sprintf (histo, "CaloTowersTask_number_of_fired_towers_HF" ) ;
369  meNumFiredTowers_HF = ibooker.book1D(histo, histo, 1000, 0, 2000);
370 
371  sprintf (histo, "CaloTowersTask_MET_HF" ) ;
372  MET_HF = ibooker.book1D(histo, histo, 500, 0. , 500. ) ;
373 
374  sprintf (histo, "CaloTowersTask_SET_HF" ) ;
375  SET_HF = ibooker.book1D(histo, histo, 2000, 0. , 2000. ) ;
376  //-------------------------------------------------------------------------------------------
377 
378  //Timing histos and profiles -- all six are necessary
379  //-------------------------------------------------------------------------------------------
380  sprintf (histo, "CaloTowersTask_EM_Timing_HF" ) ;
381  emTiming_HF = ibooker.book1D(histo, histo, 110, -120., 100. ) ;
382 
383  sprintf (histo, "CaloTowersTask_HAD_Timing_HF" ) ;
384  hadTiming_HF = ibooker.book1D(histo, histo, 70, -48., 92. ) ;
385 
386  //EM
387  sprintf (histo, "CaloTowersTask_EM_Energy_Timing_HF" ) ;
388  emEnergyTiming_HF = ibooker.book2D(histo, histo, 150, 0. , 300., 110, -120., 100. ) ;
389 
390  sprintf (histo, "CaloTowersTask_EM_Energy_Timing_profile_HF" ) ;
391  emEnergyTiming_profile_HF = ibooker.bookProfile(histo, histo, 150, 0. , 300., 110, -120., 100. ) ;
392 
393  //HAD (requires two different sets of histograms to lower RAM usage)
394  sprintf (histo, "CaloTowersTask_HAD_Energy_Timing_Low_HF" ) ;
395  hadEnergyTiming_Low_HF = ibooker.book2D(histo, histo, 40, 0. , 40., 70, -48., 92. ) ;
396 
397  sprintf (histo, "CaloTowersTask_HAD_Energy_Timing_HF" ) ;
398  hadEnergyTiming_HF = ibooker.book2D(histo, histo, 200, 0. , 600., 70, -48., 92. ) ;
399 
400  sprintf (histo, "CaloTowersTask_HAD_Energy_Timing_profile_Low_HF" ) ;
401  hadEnergyTiming_profile_Low_HF = ibooker.bookProfile(histo, histo, 40, 0. , 40., 70, -48., 92. ) ;
402 
403  sprintf (histo, "CaloTowersTask_HAD_Energy_Timing_profile_HF" ) ;
404  hadEnergyTiming_profile_HF = ibooker.bookProfile(histo, histo, 200, 0. , 600., 70, -48., 92. ) ;
405  //-------------------------------------------------------------------------------------------
406 
407  sprintf (histo, "CaloTowersTask_Iphi_tower_HFP" ) ;
408  meIphiCaloTower_HFP = ibooker.book1D(histo, histo, iphi_bins_, iphi_min_, iphi_max_);
409  sprintf (histo, "CaloTowersTask_Iphi_tower_HFM" ) ;
410  meIphiCaloTower_HFM = ibooker.book1D(histo, histo, iphi_bins_, iphi_min_, iphi_max_);
411 
412  //-------------------------------------------------------------------------------------------
413 
414  //Everything else is not drawn
415  if (useAllHistos_){
416  sprintf (histo, "CaloTowersTask_sum_of_energy_HCAL_vs_ECAL_HF") ;
417  meEnergyHcalvsEcal_HF = ibooker.book2D(histo, histo, 500, 0., 500., 500, 0., 500.);
418 
419  sprintf (histo, "CaloTowersTask_energy_OUTER_HF" ) ;
420  meEnergyHO_HF = ibooker.book1D(histo, histo, 440, -200, 2000);
421 
422  sprintf (histo, "CaloTowersTask_energy_of_ECAL_component_of_tower_HF" ) ;
423  meEnergyEcalTower_HF = ibooker.book1D(histo, histo, 440, -200, 2000);
424 
425  sprintf (histo, "CaloTowersTask_energy_of_HCAL_component_of_tower_HF" ) ;
426  meEnergyHcalTower_HF = ibooker.book1D(histo, histo, 440 , -200 , 2000);
427 
428  sprintf (histo, "CaloTowersTask_energy_HcalPlusEcalPlusHO_HF" ) ;
429  meTotEnergy_HF = ibooker.book1D(histo, histo, 400, 0., 2000.) ;
430 
431  sprintf (histo, "CaloTowersTask_map_energy_HF" );
433  sprintf (histo, "CaloTowersTask_map_energy_HCAL_HF");
435  sprintf (histo, "CaloTowersTask_map_energy_ECAL_HF" );
437 
438  sprintf (histo, "CaloTowersTask_phi_MET_HF" ) ;
439  phiMET_HF = ibooker.book1D(histo, histo, 72, -3.1415926535898, 3.1415926535898 ) ;
440  }
441  }
442 
443 }
444 
445 
447 
448 }
449 
451 }
452 
454 
456 
457  nevent++;
458 
460  event.getByToken(tok_towers_,towers);
462 
463  double met;
464  double phimet;
465 
466  // ieta scan
467  //double partR = 0.3;
468  //double Rmin = 9999.;
469  //double Econe = 0.;
470  //double Hcone = 0.;
471  //double Ee1 = 0.;
472  //double Eh1 = 0.;
473  double ieta_MC = 9999;
474  double iphi_MC = 9999;
475 
476  // HB
477  double sumEnergyHcal_HB = 0.;
478  double sumEnergyEcal_HB = 0.;
479  double sumEnergyHO_HB = 0.;
480  Int_t numFiredTowers_HB = 0;
481  double metx_HB = 0.;
482  double mety_HB = 0.;
483  double metz_HB = 0.;
484  double sEt_HB = 0.;
485  // HE
486  double sumEnergyHcal_HE = 0.;
487  double sumEnergyEcal_HE = 0.;
488  double sumEnergyHO_HE = 0.;
489  Int_t numFiredTowers_HE = 0;
490  double metx_HE = 0.;
491  double mety_HE = 0.;
492  double metz_HE = 0.;
493  double sEt_HE = 0.;
494  // HF
495  double sumEnergyHcal_HF = 0.;
496  double sumEnergyEcal_HF = 0.;
497  double sumEnergyHO_HF = 0.;
498  Int_t numFiredTowers_HF = 0;
499  double metx_HF = 0.;
500  double mety_HF = 0.;
501  double metz_HF = 0.;
502  double sEt_HF = 0.;
503 
504  for ( cal = towers->begin(); cal != towers->end(); ++cal ) {
505 
506  double eE = cal->emEnergy();
507  double eH = cal->hadEnergy();
508  double eHO = cal->outerEnergy();
509  double etaT = cal->eta();
510  // double phiT = cal->phi();
511  double en = cal->energy();
512  double etT = cal->et();
513  double had_tm = cal->hcalTime();
514  double em_tm = cal->ecalTime();
515 
516  int numBadEcalCells = cal->numBadEcalCells();
517  int numRcvEcalCells = cal->numRecoveredEcalCells();
518  int numPrbEcalCells = cal->numProblematicEcalCells();
519 
520  int numBadHcalCells = cal->numBadHcalCells();
521  int numRcvHcalCells = cal->numRecoveredHcalCells();
522  int numPrbHcalCells = cal->numProblematicHcalCells();
523 
524  math::RhoEtaPhiVector mom(cal->et(), cal->eta(), cal->phi());
525  // Vector mom = cal->momentum();
526 
527  // cell properties
528  CaloTowerDetId idT = cal->id();
529  int ieta = idT.ieta();
530  int iphi = idT.iphi();
531 
532  // ecal: 0 EcalBarrel 1 EcalEndcap
533  // hcal: 0 hcalBarrel 1 HcalEndcap 2 HcalForward
534  std::vector<int> inEcals(2), inHcals(3);
535  unsigned int constitSize = cal->constituentsSize();
536  for(unsigned int ic=0; ic<constitSize; ic++){
537  DetId detId = cal->constituent(ic);
538  if(detId.det() == DetId::Ecal){
539  if( detId.subdetId()==EcalBarrel ) inEcals[0] =1;
540  else if( detId.subdetId()==EcalEndcap ) inEcals[1] =1;
541  }
542  if(detId.det() == DetId::Hcal){
543  if( HcalDetId(detId).subdet()==HcalBarrel ) inHcals[0] =1;
544  else if( HcalDetId(detId).subdet()==HcalEndcap ) inHcals[1] =1;
545  else if( HcalDetId(detId).subdet()==HcalForward ) inHcals[2] =1;
546  }
547  }
548  //All cell histos are used
549  if( inEcals[0] ) {
550  numBadCellsEcal_EB->Fill(numBadEcalCells);
551  numRcvCellsEcal_EB->Fill(numRcvEcalCells);
552  numPrbCellsEcal_EB->Fill(numPrbEcalCells);
553  }
554  if( inEcals[1] ) {
555  numBadCellsEcal_EE->Fill(numBadEcalCells);
556  numRcvCellsEcal_EE->Fill(numRcvEcalCells);
557  numPrbCellsEcal_EE->Fill(numPrbEcalCells);
558  }
559 
560  //Ntowers is used in EndJob, occupancy_map is used for occupancy vs ieta
561  Ntowers_vs_ieta -> Fill(double(ieta),1.);
562  occupancy_map -> Fill(double(ieta),double(iphi));
563 
564  if((isub == 0 || isub == 1)
565  && (fabs(etaT) < etaMax[0] && fabs(etaT) >= etaMin[0] )) {
566 
567  //All cell histos are used
568  numBadCellsHcal_HB->Fill(numBadHcalCells);
569  numRcvCellsHcal_HB->Fill(numRcvHcalCells);
570  numPrbCellsHcal_HB->Fill(numPrbHcalCells);
571 
572  //Map energy histos are not used
573  if (useAllHistos_){
574  mapEnergy_HB -> Fill(double(ieta), double(iphi), en);
575  mapEnergyHcal_HB -> Fill(double(ieta), double(iphi), eH);
576  mapEnergyEcal_HB -> Fill(double(ieta), double(iphi), eE);
577  }
578  // std::cout << " e_ecal = " << eE << std::endl;
579 
580  if (eH>0.){ // iphi of HCAL component of calotower
581  if (ieta>0) meIphiHcalTower_HBP -> Fill(double(iphi));
582  else meIphiHcalTower_HBM -> Fill(double(iphi));
583  }
584 
585  // simple sums
586  sumEnergyHcal_HB += eH;
587  sumEnergyEcal_HB += eE;
588  sumEnergyHO_HB += eHO;
589 
590  numFiredTowers_HB++;
591 
592  //Not used
593  if (useAllHistos_){
596  }
597 
598  // MET, SET & phimet
599  // double etT = cal->et();
600  metx_HB += mom.x();
601  mety_HB += mom.y(); //etT * sin(phiT);
602  sEt_HB += etT;
603 
604  //Timing (all histos are used)
605  emTiming_HB->Fill(em_tm);
606  hadTiming_HB->Fill(had_tm);
607 
608  emEnergyTiming_Low_HB->Fill(eE, em_tm);
609  emEnergyTiming_HB->Fill(eE, em_tm);
610  emEnergyTiming_High_HB->Fill(eE, em_tm);
612  emEnergyTiming_profile_HB->Fill(eE, em_tm);
614 
615  hadEnergyTiming_Low_HB->Fill(eH, had_tm);
616  hadEnergyTiming_HB->Fill(eH, had_tm);
617  hadEnergyTiming_High_HB->Fill(eH, had_tm);
618  hadEnergyTiming_profile_Low_HB->Fill(eH, had_tm);
619  hadEnergyTiming_profile_HB->Fill(eH, had_tm);
621  }
622 
623  if((isub == 0 || isub == 2)
624  && (fabs(etaT) < etaMax[1] && fabs(etaT) >= etaMin[1] )) {
625 
626  //All cell histos are used
627  numBadCellsHcal_HE->Fill(numBadHcalCells);
628  numRcvCellsHcal_HE->Fill(numRcvHcalCells);
629  numPrbCellsHcal_HE->Fill(numPrbHcalCells);
630 
631  //Map energy histos are not used
632  if (useAllHistos_){
633  mapEnergy_HE -> Fill(double(ieta), double(iphi), en);
634  mapEnergyHcal_HE -> Fill(double(ieta), double(iphi), eH);
635  mapEnergyEcal_HE -> Fill(double(ieta), double(iphi), eE);
636  }
637  // std::cout << " e_ecal = " << eE << std::endl;
638 
639  if (eH>0.){ // iphi of HCAL component of calotower
640  if (ieta>0) meIphiHcalTower_HEP -> Fill(double(iphi));
641  else meIphiHcalTower_HEM -> Fill(double(iphi));
642  }
643 
644  // simple sums
645  sumEnergyHcal_HE += eH;
646  sumEnergyEcal_HE += eE;
647  sumEnergyHO_HE += eHO;
648 
649  numFiredTowers_HE++;
650 
651  //Not used
652  if (useAllHistos_){
655  }
656  // MET, SET & phimet
657  // double etT = cal->et();
658  metx_HE += mom.x();
659  mety_HE += mom.y(); //etT * sin(phiT);
660  sEt_HE += etT;
661 
662  //Timing (all histos are used)
663  emTiming_HE->Fill(em_tm);
664  hadTiming_HE->Fill(had_tm);
665 
666  emEnergyTiming_Low_HE->Fill(eE, em_tm);
667  emEnergyTiming_HE->Fill(eE, em_tm);
669  emEnergyTiming_profile_HE->Fill(eE, em_tm);
670 
671  hadEnergyTiming_Low_HE->Fill(eH, had_tm);
672  hadEnergyTiming_HE->Fill(eH, had_tm);
673  hadEnergyTiming_profile_Low_HE->Fill(eH, had_tm);
674  hadEnergyTiming_profile_HE->Fill(eH, had_tm);
675  }
676 
677  if((isub == 0 || isub == 3)
678  && (fabs(etaT) < etaMax[2] && fabs(etaT) >= etaMin[2] )) {
679 
680  //All cell histos are used
681  numBadCellsHcal_HF->Fill(numBadHcalCells);
682  numRcvCellsHcal_HF->Fill(numRcvHcalCells);
683  numPrbCellsHcal_HF->Fill(numPrbHcalCells);
684 
685  //Map energy histos are not used
686  if (useAllHistos_){
687  mapEnergy_HF -> Fill(double(ieta), double(iphi), en);
688  mapEnergyHcal_HF -> Fill(double(ieta), double(iphi), eH);
689  mapEnergyEcal_HF -> Fill(double(ieta), double(iphi), eE);
690  }
691  // std::cout << " e_ecal = " << eE << std::endl;
692 
693  if (ieta>0) meIphiCaloTower_HFP -> Fill(double(iphi));
694  else meIphiCaloTower_HFM -> Fill(double(iphi));
695 
696  // simple sums
697  sumEnergyHcal_HF += eH;
698  sumEnergyEcal_HF += eE;
699  sumEnergyHO_HF += eHO;
700 
701  numFiredTowers_HF++;
702 
703  //Not used
704  if (useAllHistos_){
707  }
708  // MET, SET & phimet
709  // double etT = cal->et();
710  metx_HF += mom.x();
711  mety_HF += mom.y(); //etT * sin(phiT);
712  sEt_HF += etT;
713 
714  //Timing (all histos are used)
715  emTiming_HF->Fill(em_tm);
716  hadTiming_HF->Fill(had_tm);
717  emEnergyTiming_HF->Fill(eE, em_tm);
718  emEnergyTiming_profile_HF->Fill(eE, em_tm);
719 
720  hadEnergyTiming_Low_HF->Fill(eH, had_tm);
721  hadEnergyTiming_HF->Fill(eH, had_tm);
722  hadEnergyTiming_profile_Low_HF->Fill(eH, had_tm);
723  hadEnergyTiming_profile_HF->Fill(eH, had_tm);
724  }
725 
726 
727 
728  } // end of Towers cycle
729 
730  //These are the six single pion histos; only the second set is used
731 
732  mapEnergy_N -> Fill(double(ieta_MC), double(iphi_MC), 1.);
733 
734  if(isub == 0 || isub == 1) {
735  met = sqrt(metx_HB*metx_HB + mety_HB*mety_HB);
736  Vector metv(metx_HB,mety_HB,metz_HB);
737  phimet = metv.phi();
738 
739  //Five oldest drawn histos first; the rest are not used
740  meEnergyHcal_HB-> Fill(sumEnergyHcal_HB);
741  meEnergyEcal_HB-> Fill(sumEnergyEcal_HB);
742  meNumFiredTowers_HB-> Fill(numFiredTowers_HB);
743  MET_HB -> Fill (met);
744  SET_HB -> Fill (sEt_HB);
745 
746  if (useAllHistos_){
747  meEnergyHcalvsEcal_HB->Fill(sumEnergyEcal_HB, sumEnergyHcal_HB);
748  meEnergyHO_HB-> Fill(sumEnergyHO_HB);
749  meTotEnergy_HB-> Fill(sumEnergyHcal_HB+sumEnergyEcal_HB
750  +sumEnergyHO_HB);
751  phiMET_HB -> Fill (phimet);
752  }
753  }
754 
755 
756  if(isub == 0 || isub == 2) {
757  met = sqrt(metx_HE*metx_HE + mety_HE*mety_HE);
758  Vector metv(metx_HE,mety_HE,metz_HE);
759  phimet = metv.phi();
760 
761  //Five oldest drawn histos first; the rest are not used
762  meEnergyHcal_HE-> Fill(sumEnergyHcal_HE);
763  meEnergyEcal_HE-> Fill(sumEnergyEcal_HE);
764  meNumFiredTowers_HE-> Fill(numFiredTowers_HE);
765  MET_HE -> Fill (met);
766  SET_HE -> Fill (sEt_HE);
767 
768  if (useAllHistos_){
769  meEnergyHcalvsEcal_HE->Fill(sumEnergyEcal_HE, sumEnergyHcal_HE);
770  meEnergyHO_HE-> Fill(sumEnergyHO_HE);
771  meTotEnergy_HE-> Fill(sumEnergyHcal_HE+sumEnergyEcal_HE
772  +sumEnergyHO_HE);
773  phiMET_HE -> Fill (phimet);
774  }
775  }
776 
777  if(isub == 0 || isub == 3) {
778  met = sqrt(metx_HF*metx_HF + mety_HF*mety_HF);
779  Vector metv(metx_HF,mety_HF,metz_HF);
780  phimet = metv.phi();
781 
782  //Five oldest drawn histos first; the rest are not used
783  meEnergyHcal_HF-> Fill(sumEnergyHcal_HF);
784  meEnergyEcal_HF-> Fill(sumEnergyEcal_HF);
785  meNumFiredTowers_HF-> Fill(numFiredTowers_HF);
786  MET_HF -> Fill (met);
787  SET_HF -> Fill (sEt_HF);
788 
789  if (useAllHistos_){
790  meEnergyHcalvsEcal_HF->Fill(sumEnergyEcal_HF, sumEnergyHcal_HF);
791  meEnergyHO_HF-> Fill(sumEnergyHO_HF);
792  meTotEnergy_HF-> Fill(sumEnergyHcal_HF+sumEnergyEcal_HF
793  +sumEnergyHO_HF);
794  phiMET_HF -> Fill (phimet);
795  }
796  }
797 
798 }
799 
800 double CaloTowersAnalyzer::dR(double eta1, double phi1, double eta2, double phi2) {
801  double PI = 3.1415926535898;
802  double deltaphi= phi1 - phi2;
803  if( phi2 > phi1 ) { deltaphi= phi2 - phi1;}
804  if(deltaphi > PI) { deltaphi = 2.*PI - deltaphi;}
805  double deltaeta = eta2 - eta1;
806  double tmp = sqrt(deltaeta* deltaeta + deltaphi*deltaphi);
807  return tmp;
808 }
809 
811 
MonitorElement * emean_vs_ieta_EH1
MonitorElement * mapEnergyEcal_HF
virtual void dqmBeginRun(const edm::Run &run, const edm::EventSetup &c) override
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * meNumFiredTowers_HF
MonitorElement * hadEnergyTiming_profile_High_HB
MonitorElement * hadEnergyTiming_HF
MonitorElement * meEnergyHcalTower_HF
MonitorElement * meEnergyHcalvsEcal_HE
HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:49
MonitorElement * hadEnergyTiming_Low_HE
MonitorElement * meEnergyHcalTower_HE
MonitorElement * numRcvCellsHcal_HF
MonitorElement * MET_HE
MonitorElement * phiMET_HF
MonitorElement * emEnergyTiming_profile_Low_HB
MonitorElement * bookProfile(Args &&...args)
Definition: DQMStore.h:157
MonitorElement * phiMET_HE
MonitorElement * meEnergyEcalTower_HF
MonitorElement * hadEnergyTiming_profile_Low_HE
CaloTowersAnalyzer(edm::ParameterSet const &conf)
virtual void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
MonitorElement * emEnergyTiming_Low_HB
MonitorElement * emTiming_HE
MonitorElement * meEnergyEcalTower_HE
MonitorElement * numRcvCellsEcal_EB
std::vector< CaloTower >::const_iterator const_iterator
MonitorElement * meEnergyHcalTower_HB
MonitorElement * emEnergyTiming_profile_Low_HE
MonitorElement * meIphiHcalTower_HEM
MonitorElement * numRcvCellsEcal_EE
MonitorElement * meIphiHcalTower_HEP
MonitorElement * SET_HF
MonitorElement * meEnergyHcal_HF
MonitorElement * meEnergyHcal_HB
MonitorElement * meEnergyHO_HB
MonitorElement * emTiming_HB
MonitorElement * MET_HF
MonitorElement * occupancy_map
MonitorElement * emEnergyTiming_HE
MonitorElement * hadEnergyTiming_Low_HB
MonitorElement * hadEnergyTiming_profile_Low_HB
MonitorElement * emean_vs_ieta_H
RhoEtaPhiVectorD RhoEtaPhiVector
spatial vector with cylindrical internal representation using pseudorapidity
Definition: Vector3D.h:32
std::pair< int, int > getEtaRange(const int &i) const
MonitorElement * hadTiming_HE
MonitorElement * SET_HB
void Fill(long long x)
MonitorElement * mapEnergyEcal_HB
MonitorElement * meEnergyHO_HF
MonitorElement * occupancy_vs_ieta
MonitorElement * mapEnergy_EH
MonitorElement * phiMET_HB
MonitorElement * meEnergyEcal_HE
MonitorElement * hadEnergyTiming_profile_HB
MonitorElement * meEnergyEcal_HB
MonitorElement * numBadCellsHcal_HE
MonitorElement * meTotEnergy_HE
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
MonitorElement * mapEnergy_E
MonitorElement * hadEnergyTiming_Low_HF
MonitorElement * SET_HE
T sqrt(T t)
Definition: SSEVec.h:18
MonitorElement * numRcvCellsHcal_HB
MonitorElement * meNumFiredTowers_HB
MonitorElement * MET_HB
MonitorElement * numPrbCellsHcal_HB
MonitorElement * mapEnergyHcal_HF
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
MonitorElement * meEnergyHcal_HE
virtual void analyze(edm::Event const &e, edm::EventSetup const &c) override
MonitorElement * hadTiming_HB
edm::EDGetTokenT< CaloTowerCollection > tok_towers_
MonitorElement * numBadCellsEcal_EE
MonitorElement * numPrbCellsEcal_EE
MonitorElement * mapEnergy_HE
MonitorElement * mapEnergy_HF
MonitorElement * mapEnergy_HB
MonitorElement * meEnergyEcalTower_HB
MonitorElement * meIphiHcalTower_HBP
MonitorElement * emean_vs_ieta_H1
MonitorElement * emEnergyTiming_High_HB
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
math::RhoEtaPhiVector Vector
MonitorElement * numRcvCellsHcal_HE
#define PI
Definition: QcdUeDQM.h:36
MonitorElement * emEnergyTiming_profile_HF
MonitorElement * hadEnergyTiming_HE
MonitorElement * numPrbCellsHcal_HE
MonitorElement * emEnergyTiming_profile_High_HB
MonitorElement * meTotEnergy_HB
MonitorElement * meTotEnergy_HF
MonitorElement * hadEnergyTiming_High_HB
MonitorElement * mapEnergyHcal_HE
const_iterator end() const
MonitorElement * hadEnergyTiming_HB
MonitorElement * numPrbCellsHcal_HF
Definition: DetId.h:18
MonitorElement * hadEnergyTiming_profile_HF
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
MonitorElement * numBadCellsHcal_HB
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
met
===> hadronic RAZOR
MonitorElement * Ntowers_vs_ieta
MonitorElement * emEnergyTiming_HB
const T & get() const
Definition: EventSetup.h:55
MonitorElement * meEnergyHO_HE
MonitorElement * hadEnergyTiming_profile_HE
MonitorElement * emEnergyTiming_Low_HE
MonitorElement * emean_vs_ieta_E
MonitorElement * numPrbCellsEcal_EB
MonitorElement * emean_vs_ieta_EH
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
MonitorElement * numBadCellsHcal_HF
double dR(double eta1, double phi1, double eta2, double phi2)
MonitorElement * hadTiming_HF
MonitorElement * numBadCellsEcal_EB
MonitorElement * mapEnergyEcal_HE
MonitorElement * emTiming_HF
MonitorElement * meIphiCaloTower_HFM
const HcalDDDRecConstants * hcons
MonitorElement * emEnergyTiming_profile_HE
MonitorElement * mapEnergy_N
int ieta() const
get the tower ieta
MonitorElement * meEnergyHcalvsEcal_HB
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
MonitorElement * mapEnergyHcal_HB
MonitorElement * emEnergyTiming_profile_HB
MonitorElement * meEnergyHcalvsEcal_HF
MonitorElement * emean_vs_ieta_E1
MonitorElement * meNumFiredTowers_HE
const_iterator begin() const
MonitorElement * emEnergyTiming_HF
Definition: event.py:1
Definition: Run.h:42
MonitorElement * hadEnergyTiming_profile_Low_HF
MonitorElement * mapEnergy_H
MonitorElement * meIphiCaloTower_HFP
int getNPhi(const int &type) const
MonitorElement * meIphiHcalTower_HBM
MonitorElement * meEnergyEcal_HF