CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
HCALRecHitAnalyzer.cc
Go to the documentation of this file.
2 // author: Bobby Scurlock, University of Florida
3 // first version 12/7/2006
4 // modified: Mike Schmitt
5 // date: 03.05.2007
6 // note: 1) code rewrite. 2.) changed to loop over all hcal detids;
7 // not only those within calotowers.
8 
12 
13 //#include "PluginManager/ModuleDef.h"
18 //#include "FWCore/Framework/interface/Handle.h"
21 
22 //#include "Geometry/Vector/interface/GlobalPoint.h"
29 
33 
34 #include <memory>
35 #include <vector>
36 #include <utility>
37 #include <ostream>
38 #include <fstream>
39 #include <string>
40 #include <algorithm>
41 #include <cmath>
42 #include <TLorentzVector.h>
44 
45 #define DEBUG(X) \
46  { \
47  if (debug_) { \
48  std::cout << X << std::endl; \
49  } \
50  }
51 
53  // Retrieve Information from the Configuration File
54  hBHERecHitsLabel_ = consumes<HBHERecHitCollection>(iConfig.getParameter<edm::InputTag>("HBHERecHitsLabel"));
55  hORecHitsLabel_ = consumes<HORecHitCollection>(iConfig.getParameter<edm::InputTag>("HORecHitsLabel"));
56  hFRecHitsLabel_ = consumes<HFRecHitCollection>(iConfig.getParameter<edm::InputTag>("HFRecHitsLabel"));
57  caloGeomToken_ = esConsumes<edm::Transition::BeginRun>();
58  debug_ = iConfig.getParameter<bool>("Debug");
59  finebinning_ = iConfig.getUntrackedParameter<bool>("FineBinning");
60  FolderName_ = iConfig.getUntrackedParameter<std::string>("FolderName");
61 }
62 
63 void HCALRecHitAnalyzer::dqmBeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) {
64  Nevents = 0;
65  FillGeometry(iSetup);
66 }
67 
69  // get ahold of back-end interface
70  // dbe_ = edm::Service<DQMStore>().operator->();
71 
72  ibooker.setCurrentFolder(FolderName_ + "/geometry");
73  hHCAL_ieta_iphi_HBMap = ibooker.book2D("METTask_HCAL_ieta_iphi_HBMap", "", 83, -41, 42, 72, 1, 73);
74  hHCAL_ieta_iphi_HEMap = ibooker.book2D("METTask_HCAL_ieta_iphi_HEMap", "", 83, -41, 42, 72, 1, 73);
75  hHCAL_ieta_iphi_HFMap = ibooker.book2D("METTask_HCAL_ieta_iphi_HFMap", "", 83, -41, 42, 72, 1, 73);
76  hHCAL_ieta_iphi_HOMap = ibooker.book2D("METTask_HCAL_ieta_iphi_HOMap", "", 83, -41, 42, 72, 1, 73);
77  hHCAL_ieta_iphi_etaMap = ibooker.book2D("METTask_HCAL_ieta_iphi_etaMap", "", 83, -41, 42, 72, 1, 73);
78  hHCAL_ieta_iphi_phiMap = ibooker.book2D("METTask_HCAL_ieta_iphi_phiMap", "", 83, -41, 42, 72, 1, 73);
79  hHCAL_ieta_detaMap = ibooker.book1D("METTask_HCAL_ieta_detaMap", "", 83, -41, 42);
80  hHCAL_ieta_dphiMap = ibooker.book1D("METTask_HCAL_ieta_dphiMap", "", 83, -41, 42);
81 
82  // Initialize bins for geometry to -999 because z = 0 is a valid entry
83  for (int i = 1; i <= 83; i++) {
86 
87  for (int j = 1; j <= 72; j++) {
94  }
95  }
96 
97  // ibooker.setCurrentFolder("RecoMETV/MET_HCAL/data");
99  //--Store number of events used
100  hHCAL_Nevents = ibooker.book1D("METTask_HCAL_Nevents", "", 1, 0, 1);
101  //--Data integrated over all events and stored by HCAL(ieta,iphi)
102 
103  hHCAL_D1_energy_ieta_iphi = ibooker.book2D("METTask_HCAL_D1_energy_ieta_iphi", "", 83, -41, 42, 72, 1, 73);
104  hHCAL_D2_energy_ieta_iphi = ibooker.book2D("METTask_HCAL_D2_energy_ieta_iphi", "", 83, -41, 42, 72, 1, 73);
105  hHCAL_D3_energy_ieta_iphi = ibooker.book2D("METTask_HCAL_D3_energy_ieta_iphi", "", 83, -41, 42, 72, 1, 73);
106  hHCAL_D4_energy_ieta_iphi = ibooker.book2D("METTask_HCAL_D4_energy_ieta_iphi", "", 83, -41, 42, 72, 1, 73);
107 
108  hHCAL_D1_Minenergy_ieta_iphi = ibooker.book2D("METTask_HCAL_D1_Minenergy_ieta_iphi", "", 83, -41, 42, 72, 1, 73);
109  hHCAL_D2_Minenergy_ieta_iphi = ibooker.book2D("METTask_HCAL_D2_Minenergy_ieta_iphi", "", 83, -41, 42, 72, 1, 73);
110  hHCAL_D3_Minenergy_ieta_iphi = ibooker.book2D("METTask_HCAL_D3_Minenergy_ieta_iphi", "", 83, -41, 42, 72, 1, 73);
111  hHCAL_D4_Minenergy_ieta_iphi = ibooker.book2D("METTask_HCAL_D4_Minenergy_ieta_iphi", "", 83, -41, 42, 72, 1, 73);
112 
113  hHCAL_D1_Maxenergy_ieta_iphi = ibooker.book2D("METTask_HCAL_D1_Maxenergy_ieta_iphi", "", 83, -41, 42, 72, 1, 73);
114  hHCAL_D2_Maxenergy_ieta_iphi = ibooker.book2D("METTask_HCAL_D2_Maxenergy_ieta_iphi", "", 83, -41, 42, 72, 1, 73);
115  hHCAL_D3_Maxenergy_ieta_iphi = ibooker.book2D("METTask_HCAL_D3_Maxenergy_ieta_iphi", "", 83, -41, 42, 72, 1, 73);
116  hHCAL_D4_Maxenergy_ieta_iphi = ibooker.book2D("METTask_HCAL_D4_Maxenergy_ieta_iphi", "", 83, -41, 42, 72, 1, 73);
117 
118  // need to initialize those
119  for (int i = 1; i <= 83; i++)
120  for (int j = 1; j <= 73; j++) {
125 
130  }
131 
132  hHCAL_D1_Occ_ieta_iphi = ibooker.book2D("METTask_HCAL_D1_Occ_ieta_iphi", "", 83, -41, 42, 72, 1, 73);
133  hHCAL_D2_Occ_ieta_iphi = ibooker.book2D("METTask_HCAL_D2_Occ_ieta_iphi", "", 83, -41, 42, 72, 1, 73);
134  hHCAL_D3_Occ_ieta_iphi = ibooker.book2D("METTask_HCAL_D3_Occ_ieta_iphi", "", 83, -41, 42, 72, 1, 73);
135  hHCAL_D4_Occ_ieta_iphi = ibooker.book2D("METTask_HCAL_D4_Occ_ieta_iphi", "", 83, -41, 42, 72, 1, 73);
136  //--Data over eta-rings
137 
138  // CaloTower values
139 
140  if (finebinning_) {
141  hHCAL_D1_energyvsieta = ibooker.book2D("METTask_HCAL_D1_energyvsieta", "", 83, -41, 42, 20101, -100, 2001);
142  hHCAL_D2_energyvsieta = ibooker.book2D("METTask_HCAL_D2_energyvsieta", "", 83, -41, 42, 20101, -100, 2001);
143  hHCAL_D3_energyvsieta = ibooker.book2D("METTask_HCAL_D3_energyvsieta", "", 83, -41, 42, 20101, -100, 2001);
144  hHCAL_D4_energyvsieta = ibooker.book2D("METTask_HCAL_D4_energyvsieta", "", 83, -41, 42, 20101, -100, 2001);
145 
146  hHCAL_D1_Minenergyvsieta = ibooker.book2D("METTask_HCAL_D1_Minenergyvsieta", "", 83, -41, 42, 20101, -100, 2001);
147  hHCAL_D2_Minenergyvsieta = ibooker.book2D("METTask_HCAL_D2_Minenergyvsieta", "", 83, -41, 42, 20101, -100, 2001);
148  hHCAL_D3_Minenergyvsieta = ibooker.book2D("METTask_HCAL_D3_Minenergyvsieta", "", 83, -41, 42, 20101, -100, 2001);
149  hHCAL_D4_Minenergyvsieta = ibooker.book2D("METTask_HCAL_D4_Minenergyvsieta", "", 83, -41, 42, 20101, -100, 2001);
150 
151  hHCAL_D1_Maxenergyvsieta = ibooker.book2D("METTask_HCAL_D1_Maxenergyvsieta", "", 83, -41, 42, 20101, -100, 2001);
152  hHCAL_D2_Maxenergyvsieta = ibooker.book2D("METTask_HCAL_D2_Maxenergyvsieta", "", 83, -41, 42, 20101, -100, 2001);
153  hHCAL_D3_Maxenergyvsieta = ibooker.book2D("METTask_HCAL_D3_Maxenergyvsieta", "", 83, -41, 42, 20101, -100, 2001);
154  hHCAL_D4_Maxenergyvsieta = ibooker.book2D("METTask_HCAL_D4_Maxenergyvsieta", "", 83, -41, 42, 20101, -100, 2001);
155 
156  // Integrated over phi
157  hHCAL_D1_Occvsieta = ibooker.book2D("METTask_HCAL_D1_Occvsieta", "", 83, -41, 42, 73, 0, 73);
158  hHCAL_D2_Occvsieta = ibooker.book2D("METTask_HCAL_D2_Occvsieta", "", 83, -41, 42, 73, 0, 73);
159  hHCAL_D3_Occvsieta = ibooker.book2D("METTask_HCAL_D3_Occvsieta", "", 83, -41, 42, 73, 0, 73);
160  hHCAL_D4_Occvsieta = ibooker.book2D("METTask_HCAL_D4_Occvsieta", "", 83, -41, 42, 73, 0, 73);
161 
162  hHCAL_D1_SETvsieta = ibooker.book2D("METTask_HCAL_D1_SETvsieta", "", 83, -41, 42, 20001, 0, 2001);
163  hHCAL_D2_SETvsieta = ibooker.book2D("METTask_HCAL_D2_SETvsieta", "", 83, -41, 42, 20001, 0, 2001);
164  hHCAL_D3_SETvsieta = ibooker.book2D("METTask_HCAL_D3_SETvsieta", "", 83, -41, 42, 20001, 0, 2001);
165  hHCAL_D4_SETvsieta = ibooker.book2D("METTask_HCAL_D4_SETvsieta", "", 83, -41, 42, 20001, 0, 2001);
166 
167  hHCAL_D1_METvsieta = ibooker.book2D("METTask_HCAL_D1_METvsieta", "", 83, -41, 42, 20001, 0, 2001);
168  hHCAL_D2_METvsieta = ibooker.book2D("METTask_HCAL_D2_METvsieta", "", 83, -41, 42, 20001, 0, 2001);
169  hHCAL_D3_METvsieta = ibooker.book2D("METTask_HCAL_D3_METvsieta", "", 83, -41, 42, 20001, 0, 2001);
170  hHCAL_D4_METvsieta = ibooker.book2D("METTask_HCAL_D4_METvsieta", "", 83, -41, 42, 20001, 0, 2001);
171 
172  hHCAL_D1_METPhivsieta = ibooker.book2D("METTask_HCAL_D1_METPhivsieta", "", 83, -41, 42, 80, -4, 4);
173  hHCAL_D2_METPhivsieta = ibooker.book2D("METTask_HCAL_D2_METPhivsieta", "", 83, -41, 42, 80, -4, 4);
174  hHCAL_D3_METPhivsieta = ibooker.book2D("METTask_HCAL_D3_METPhivsieta", "", 83, -41, 42, 80, -4, 4);
175  hHCAL_D4_METPhivsieta = ibooker.book2D("METTask_HCAL_D4_METPhivsieta", "", 83, -41, 42, 80, -4, 4);
176 
177  hHCAL_D1_MExvsieta = ibooker.book2D("METTask_HCAL_D1_MExvsieta", "", 83, -41, 42, 10001, -500, 501);
178  hHCAL_D2_MExvsieta = ibooker.book2D("METTask_HCAL_D2_MExvsieta", "", 83, -41, 42, 10001, -500, 501);
179  hHCAL_D3_MExvsieta = ibooker.book2D("METTask_HCAL_D3_MExvsieta", "", 83, -41, 42, 10001, -500, 501);
180  hHCAL_D4_MExvsieta = ibooker.book2D("METTask_HCAL_D4_MExvsieta", "", 83, -41, 42, 10001, -500, 501);
181 
182  hHCAL_D1_MEyvsieta = ibooker.book2D("METTask_HCAL_D1_MEyvsieta", "", 83, -41, 42, 10001, -500, 501);
183  hHCAL_D2_MEyvsieta = ibooker.book2D("METTask_HCAL_D2_MEyvsieta", "", 83, -41, 42, 10001, -500, 501);
184  hHCAL_D3_MEyvsieta = ibooker.book2D("METTask_HCAL_D3_MEyvsieta", "", 83, -41, 42, 10001, -500, 501);
185  hHCAL_D4_MEyvsieta = ibooker.book2D("METTask_HCAL_D4_MEyvsieta", "", 83, -41, 42, 10001, -500, 501);
186  } else {
187  hHCAL_D1_energyvsieta = ibooker.book2D("METTask_HCAL_D1_energyvsieta", "", 83, -41, 42, 1000, -10, 1990);
188  hHCAL_D2_energyvsieta = ibooker.book2D("METTask_HCAL_D2_energyvsieta", "", 83, -41, 42, 1000, -10, 1990);
189  hHCAL_D3_energyvsieta = ibooker.book2D("METTask_HCAL_D3_energyvsieta", "", 83, -41, 42, 1000, -10, 1990);
190  hHCAL_D4_energyvsieta = ibooker.book2D("METTask_HCAL_D4_energyvsieta", "", 83, -41, 42, 1000, -10, 1990);
191 
192  hHCAL_D1_Minenergyvsieta = ibooker.book2D("METTask_HCAL_D1_Minenergyvsieta", "", 83, -41, 42, 1000, -10, 1990);
193  hHCAL_D2_Minenergyvsieta = ibooker.book2D("METTask_HCAL_D2_Minenergyvsieta", "", 83, -41, 42, 1000, -10, 1990);
194  hHCAL_D3_Minenergyvsieta = ibooker.book2D("METTask_HCAL_D3_Minenergyvsieta", "", 83, -41, 42, 1000, -10, 1990);
195  hHCAL_D4_Minenergyvsieta = ibooker.book2D("METTask_HCAL_D4_Minenergyvsieta", "", 83, -41, 42, 1000, -10, 1990);
196 
197  hHCAL_D1_Maxenergyvsieta = ibooker.book2D("METTask_HCAL_D1_Maxenergyvsieta", "", 83, -41, 42, 1000, -10, 1990);
198  hHCAL_D2_Maxenergyvsieta = ibooker.book2D("METTask_HCAL_D2_Maxenergyvsieta", "", 83, -41, 42, 1000, -10, 1990);
199  hHCAL_D3_Maxenergyvsieta = ibooker.book2D("METTask_HCAL_D3_Maxenergyvsieta", "", 83, -41, 42, 1000, -10, 1990);
200  hHCAL_D4_Maxenergyvsieta = ibooker.book2D("METTask_HCAL_D4_Maxenergyvsieta", "", 83, -41, 42, 1000, -10, 1990);
201 
202  // Integrated over phi
203  hHCAL_D1_Occvsieta = ibooker.book2D("METTask_HCAL_D1_Occvsieta", "", 83, -41, 42, 73, 0, 73);
204  hHCAL_D2_Occvsieta = ibooker.book2D("METTask_HCAL_D2_Occvsieta", "", 83, -41, 42, 73, 0, 73);
205  hHCAL_D3_Occvsieta = ibooker.book2D("METTask_HCAL_D3_Occvsieta", "", 83, -41, 42, 73, 0, 73);
206  hHCAL_D4_Occvsieta = ibooker.book2D("METTask_HCAL_D4_Occvsieta", "", 83, -41, 42, 73, 0, 73);
207 
208  hHCAL_D1_SETvsieta = ibooker.book2D("METTask_HCAL_D1_SETvsieta", "", 83, -41, 42, 1000, 0, 2000);
209  hHCAL_D2_SETvsieta = ibooker.book2D("METTask_HCAL_D2_SETvsieta", "", 83, -41, 42, 1000, 0, 2000);
210  hHCAL_D3_SETvsieta = ibooker.book2D("METTask_HCAL_D3_SETvsieta", "", 83, -41, 42, 1000, 0, 2000);
211  hHCAL_D4_SETvsieta = ibooker.book2D("METTask_HCAL_D4_SETvsieta", "", 83, -41, 42, 1000, 0, 2000);
212 
213  hHCAL_D1_METvsieta = ibooker.book2D("METTask_HCAL_D1_METvsieta", "", 83, -41, 42, 1000, 0, 2000);
214  hHCAL_D2_METvsieta = ibooker.book2D("METTask_HCAL_D2_METvsieta", "", 83, -41, 42, 1000, 0, 2000);
215  hHCAL_D3_METvsieta = ibooker.book2D("METTask_HCAL_D3_METvsieta", "", 83, -41, 42, 1000, 0, 2000);
216  hHCAL_D4_METvsieta = ibooker.book2D("METTask_HCAL_D4_METvsieta", "", 83, -41, 42, 1000, 0, 2000);
217 
218  hHCAL_D1_METPhivsieta = ibooker.book2D("METTask_HCAL_D1_METPhivsieta", "", 83, -41, 42, 80, -4, 4);
219  hHCAL_D2_METPhivsieta = ibooker.book2D("METTask_HCAL_D2_METPhivsieta", "", 83, -41, 42, 80, -4, 4);
220  hHCAL_D3_METPhivsieta = ibooker.book2D("METTask_HCAL_D3_METPhivsieta", "", 83, -41, 42, 80, -4, 4);
221  hHCAL_D4_METPhivsieta = ibooker.book2D("METTask_HCAL_D4_METPhivsieta", "", 83, -41, 42, 80, -4, 4);
222 
223  hHCAL_D1_MExvsieta = ibooker.book2D("METTask_HCAL_D1_MExvsieta", "", 83, -41, 42, 500, -500, 500);
224  hHCAL_D2_MExvsieta = ibooker.book2D("METTask_HCAL_D2_MExvsieta", "", 83, -41, 42, 500, -500, 500);
225  hHCAL_D3_MExvsieta = ibooker.book2D("METTask_HCAL_D3_MExvsieta", "", 83, -41, 42, 500, -500, 500);
226  hHCAL_D4_MExvsieta = ibooker.book2D("METTask_HCAL_D4_MExvsieta", "", 83, -41, 42, 500, -500, 500);
227 
228  hHCAL_D1_MEyvsieta = ibooker.book2D("METTask_HCAL_D1_MEyvsieta", "", 83, -41, 42, 500, -500, 500);
229  hHCAL_D2_MEyvsieta = ibooker.book2D("METTask_HCAL_D2_MEyvsieta", "", 83, -41, 42, 500, -500, 500);
230  hHCAL_D3_MEyvsieta = ibooker.book2D("METTask_HCAL_D3_MEyvsieta", "", 83, -41, 42, 500, -500, 500);
231  hHCAL_D4_MEyvsieta = ibooker.book2D("METTask_HCAL_D4_MEyvsieta", "", 83, -41, 42, 500, -500, 500);
232  }
233  // Inspect Setup for CaloTower Geometry
234  // FillGeometry(iSetup);
235 }
236 
238  // ==========================================================
239  // Retrieve!
240  // ==========================================================
241 
242  const auto& pG = iSetup.getHandle(caloGeomToken_);
243 
244  if (!pG.isValid()) {
245  edm::LogInfo("OutputInfo") << "Failed to retrieve an Event Setup Handle, Aborting Task "
246  << "HCALRecHitAnalyzer::FillGeometry!\n";
247  return;
248  }
249 
250  const CaloGeometry cG = *pG;
251 
252  const HcalGeometry* HBgeom = dynamic_cast<const HcalGeometry*>(cG.getSubdetectorGeometry(DetId::Hcal, HcalBarrel));
253  const HcalGeometry* HEgeom = dynamic_cast<const HcalGeometry*>(cG.getSubdetectorGeometry(DetId::Hcal, HcalEndcap));
256 
257  // ==========================================================
258  // Fill Histograms!
259  // ==========================================================
260 
261  std::vector<DetId>::iterator i;
262 
263  int HBmin_ieta = 99, HBmax_ieta = -99;
264  int HBmin_iphi = 99, HBmax_iphi = -99;
265 
266  // Loop Over all Hcal Barrel DetId's
267  int nHBdetid = 0;
268  std::vector<DetId> HBids = HBgeom->getValidDetIds(DetId::Hcal, HcalBarrel);
269 
270  for (i = HBids.begin(); i != HBids.end(); i++) {
271  nHBdetid++;
272 
273  HcalDetId HcalID(*i);
274 
275  int Calo_ieta = 42 + HcalID.ieta();
276  int Calo_iphi = HcalID.iphi();
277  double Calo_eta = HBgeom->getPosition(HcalID).eta();
278  double Calo_phi = HBgeom->getPosition(HcalID).phi();
279 
280  if (hHCAL_ieta_iphi_etaMap->getBinContent(Calo_ieta, Calo_iphi) == -999) {
281  hHCAL_ieta_iphi_etaMap->setBinContent(Calo_ieta, Calo_iphi, Calo_eta);
282  hHCAL_ieta_iphi_phiMap->setBinContent(Calo_ieta, Calo_iphi, Calo_phi * 180.0 / M_PI);
283  }
284 
285  if (Calo_ieta > HBmax_ieta)
286  HBmax_ieta = Calo_ieta;
287  if (Calo_ieta < HBmin_ieta)
288  HBmin_ieta = Calo_ieta;
289  if (Calo_iphi > HBmax_iphi)
290  HBmax_iphi = Calo_iphi;
291  if (Calo_iphi > HBmax_iphi)
292  HBmin_iphi = Calo_iphi;
293  }
294 
295  int HEmin_ieta = 99, HEmax_ieta = -99;
296  int HEmin_iphi = 99, HEmax_iphi = -99;
297 
298  // Loop Over all Hcal Endcap DetId's
299  int nHEdetid = 0;
300  std::vector<DetId> HEids = HEgeom->getValidDetIds(DetId::Hcal, HcalEndcap);
301 
302  for (i = HEids.begin(); i != HEids.end(); i++) {
303  nHEdetid++;
304 
305  HcalDetId HcalID(*i);
306 
307  int Calo_ieta = 42 + HcalID.ieta();
308  int Calo_iphi = HcalID.iphi();
309  double Calo_eta = HEgeom->getPosition(HcalID).eta();
310  double Calo_phi = HEgeom->getPosition(HcalID).phi();
311 
312  // HCAL to HE eta, phi map comparison
313  if (hHCAL_ieta_iphi_etaMap->getBinContent(Calo_ieta, Calo_iphi) == -999) {
314  hHCAL_ieta_iphi_etaMap->setBinContent(Calo_ieta, Calo_iphi, Calo_eta);
315  hHCAL_ieta_iphi_phiMap->setBinContent(Calo_ieta, Calo_iphi, Calo_phi * 180.0 / M_PI);
316  }
317 
318  if (Calo_ieta > HEmax_ieta)
319  HEmax_ieta = Calo_ieta;
320  if (Calo_ieta < HEmin_ieta)
321  HEmin_ieta = Calo_ieta;
322  if (Calo_iphi > HEmax_iphi)
323  HEmax_iphi = Calo_iphi;
324  if (Calo_iphi > HEmax_iphi)
325  HEmin_iphi = Calo_iphi;
326  }
327 
328  int HFmin_ieta = 99, HFmax_ieta = -99;
329  int HFmin_iphi = 99, HFmax_iphi = -99;
330 
331  // Loop Over all Hcal Forward DetId's
332  int nHFdetid = 0;
333  std::vector<DetId> HFids = HFgeom->getValidDetIds(DetId::Hcal, HcalForward);
334 
335  for (i = HFids.begin(); i != HFids.end(); i++) {
336  nHFdetid++;
337 
338  auto cell = HFgeom->getGeometry(*i);
339  HcalDetId HcalID(i->rawId());
340  //GlobalPoint p = cell->getPosition();
341 
342  int Calo_ieta = 42 + HcalID.ieta();
343  int Calo_iphi = HcalID.iphi();
344  double Calo_eta = cell->getPosition().eta();
345  double Calo_phi = cell->getPosition().phi();
346 
347  // HCAL to HF eta, phi map comparison
348  if (hHCAL_ieta_iphi_etaMap->getBinContent(Calo_ieta, Calo_iphi) == -999) {
349  hHCAL_ieta_iphi_etaMap->setBinContent(Calo_ieta, Calo_iphi, Calo_eta);
350  hHCAL_ieta_iphi_phiMap->setBinContent(Calo_ieta, Calo_iphi, Calo_phi * 180.0 / M_PI);
351  }
352 
353  if (Calo_ieta > HFmax_ieta)
354  HFmax_ieta = Calo_ieta;
355  if (Calo_ieta < HFmin_ieta)
356  HFmin_ieta = Calo_ieta;
357  if (Calo_iphi > HFmax_iphi)
358  HFmax_iphi = Calo_iphi;
359  if (Calo_iphi > HFmax_iphi)
360  HFmin_iphi = Calo_iphi;
361  }
362 
363  int HOmin_ieta = 99, HOmax_ieta = -99;
364  int HOmin_iphi = 99, HOmax_iphi = -99;
365 
366  // Loop Over all Hcal Outer DetId's
367  int nHOdetid = 0;
368  std::vector<DetId> HOids = HOgeom->getValidDetIds(DetId::Hcal, HcalOuter);
369 
370  for (i = HOids.begin(); i != HOids.end(); i++) {
371  nHOdetid++;
372 
373  auto cell = HOgeom->getGeometry(*i);
374  HcalDetId HcalID(i->rawId());
375  //GlobalPoint p = cell->getPosition();
376 
377  int Calo_ieta = 42 + HcalID.ieta();
378  int Calo_iphi = HcalID.iphi();
379  double Calo_eta = cell->getPosition().eta();
380  double Calo_phi = cell->getPosition().phi();
381 
382  // HCAL to HO eta, phi map comparison
383  if (hHCAL_ieta_iphi_etaMap->getBinContent(Calo_ieta, Calo_iphi) == -999) {
384  hHCAL_ieta_iphi_etaMap->setBinContent(Calo_ieta, Calo_iphi, Calo_eta);
385  hHCAL_ieta_iphi_phiMap->setBinContent(Calo_ieta, Calo_iphi, Calo_phi * 180.0 / M_PI);
386  }
387 
388  if (Calo_ieta > HOmax_ieta)
389  HOmax_ieta = Calo_ieta;
390  if (Calo_ieta < HOmin_ieta)
391  HOmin_ieta = Calo_ieta;
392  if (Calo_iphi > HOmax_iphi)
393  HOmax_iphi = Calo_iphi;
394  if (Calo_iphi > HOmax_iphi)
395  HOmin_iphi = Calo_iphi;
396  }
397 
398  // Set the Cell Size for each (ieta, iphi) Bin
399  double currentLowEdge_eta = 0; //double currentHighEdge_eta = 0;
400  for (int ieta = 1; ieta < 42; ieta++) {
401  int ieta_ = 42 + ieta;
402  double eta = hHCAL_ieta_iphi_etaMap->getBinContent(ieta_, 3);
403  double phi = hHCAL_ieta_iphi_phiMap->getBinContent(ieta_, 3);
404  double deta = 2.0 * (eta - currentLowEdge_eta);
405  deta = ((float)((int)(1.0E3 * deta + 0.5))) / 1.0E3;
406  double dphi = 2.0 * phi;
407  if (ieta == 40 || ieta == 41)
408  dphi = 20;
409  if (ieta <= 39 && ieta >= 21)
410  dphi = 10;
411  if (ieta <= 20)
412  dphi = 5;
413  // BS: This is WRONG...need to correct overlap
414  if (ieta == 28)
415  deta = 0.218;
416  if (ieta == 29)
417  deta = 0.096;
418  currentLowEdge_eta += deta;
419 
420  // BS: This is WRONG...need to correct overlap
421  if (ieta == 29)
422  currentLowEdge_eta = 2.964;
423 
424  hHCAL_ieta_detaMap->setBinContent(ieta_, deta); // positive rings
425  hHCAL_ieta_dphiMap->setBinContent(ieta_, dphi); // positive rings
426  hHCAL_ieta_detaMap->setBinContent(42 - ieta, deta); // negative rings
427  hHCAL_ieta_dphiMap->setBinContent(42 - ieta, dphi); // negative rings
428 
429  } // end loop over ieta
430 
431  edm::LogInfo("OutputInfo") << "HB ieta range: " << HBmin_ieta << " " << HBmax_ieta;
432  edm::LogInfo("OutputInfo") << "HB iphi range: " << HBmin_iphi << " " << HBmax_iphi;
433  edm::LogInfo("OutputInfo") << "HE ieta range: " << HEmin_ieta << " " << HEmax_ieta;
434  edm::LogInfo("OutputInfo") << "HE iphi range: " << HEmin_iphi << " " << HEmax_iphi;
435  edm::LogInfo("OutputInfo") << "HF ieta range: " << HFmin_ieta << " " << HFmax_ieta;
436  edm::LogInfo("OutputInfo") << "HF iphi range: " << HFmin_iphi << " " << HFmax_iphi;
437  edm::LogInfo("OutputInfo") << "HO ieta range: " << HOmin_ieta << " " << HOmax_ieta;
438  edm::LogInfo("OutputInfo") << "HO iphi range: " << HOmin_iphi << " " << HOmax_iphi;
439 }
440 
442  Nevents++;
443  hHCAL_Nevents->Fill(0);
444  // ==========================================================
445  // Retrieve!
446  // ==========================================================
447 
449  const HORecHitCollection* HORecHits;
451 
452  edm::Handle<HBHERecHitCollection> HBHERecHitsHandle;
453  iEvent.getByToken(hBHERecHitsLabel_, HBHERecHitsHandle);
454  if (!HBHERecHitsHandle.isValid()) {
455  edm::LogInfo("OutputInfo") << "Failed to retrieve an Event Handle, Aborting Task "
456  << "HCALRecHitAnalyzer::analyze!\n";
457  return;
458  } else {
459  HBHERecHits = HBHERecHitsHandle.product();
460  }
461  edm::Handle<HORecHitCollection> HORecHitsHandle;
462  iEvent.getByToken(hORecHitsLabel_, HORecHitsHandle);
463  if (!HORecHitsHandle.isValid()) {
464  edm::LogInfo("OutputInfo") << "Failed to retrieve an Event Handle, Aborting Task "
465  << "HCALRecHitAnalyzer::analyze!\n";
466  return;
467  } else {
468  HORecHits = HORecHitsHandle.product();
469  }
470  edm::Handle<HFRecHitCollection> HFRecHitsHandle;
471  iEvent.getByToken(hFRecHitsLabel_, HFRecHitsHandle);
472  if (!HFRecHitsHandle.isValid()) {
473  edm::LogInfo("OutputInfo") << "Failed to retrieve an Event Handle, Aborting Task "
474  << "HCALRecHitAnalyzer::analyze!\n";
475  return;
476  } else {
477  HFRecHits = HFRecHitsHandle.product();
478  }
479 
480  // ==========================================================
481  // Fill Histograms!
482  // ==========================================================
483 
484  TLorentzVector vHBHEMET_EtaRing[83][4];
485  int HBHEActiveRing[83][4];
486  int HBHENActiveCells[83][4];
487  double HBHESET_EtaRing[83][4];
488  double HBHEMinEnergy_EtaRing[83][4];
489  double HBHEMaxEnergy_EtaRing[83][4];
490 
491  for (int i = 0; i < 83; i++) {
492  for (int j = 0; j < 4; j++) {
493  HBHEActiveRing[i][j] = 0;
494  HBHENActiveCells[i][j] = 0;
495  HBHESET_EtaRing[i][j] = 0;
496  HBHEMinEnergy_EtaRing[i][j] = 14E3;
497  HBHEMaxEnergy_EtaRing[i][j] = -999;
498  }
499  }
500 
501  // Loop over HBHERecHit's
503  int nHBrechit = 0, nHErechit = 0;
504 
505  for (hbherechit = HBHERecHits->begin(); hbherechit != HBHERecHits->end(); hbherechit++) {
506  HcalDetId det = hbherechit->id();
507  double Energy = hbherechit->energy();
508  Int_t depth = det.depth();
509  Int_t ieta = det.ieta();
510  Int_t iphi = det.iphi();
511  int EtaRing = 41 + ieta; // this counts from 0
512  double eta = hHCAL_ieta_iphi_etaMap->getBinContent(EtaRing + 1, iphi);
513  double phi = hHCAL_ieta_iphi_phiMap->getBinContent(EtaRing + 1, iphi);
514  double theta = 2 * TMath::ATan(exp(-1 * eta));
515  double ET = Energy * TMath::Sin(theta);
516  HcalSubdetector HcalNum = det.subdet();
517  TLorentzVector v_;
518 
519  if (Energy > 0) // zero suppress
520  {
521  HBHEActiveRing[EtaRing][depth - 1] = 1;
522  HBHENActiveCells[EtaRing][depth - 1]++;
523  HBHESET_EtaRing[EtaRing][depth - 1] += ET;
524  v_.SetPtEtaPhiE(ET, 0, phi, ET);
525  vHBHEMET_EtaRing[EtaRing][depth - 1] -= v_;
526 
527  DEBUG(EtaRing << " " << Energy << " " << ET << " " << theta << " " << eta << " " << phi << " : "
528  << vHBHEMET_EtaRing[EtaRing][depth - 1].Phi() << " " << vHBHEMET_EtaRing[EtaRing][depth - 1].Pt());
529 
530  switch (depth) {
531  case 1:
532  hHCAL_D1_Occ_ieta_iphi->Fill(ieta, iphi);
533  break;
534  case 2:
535  hHCAL_D2_Occ_ieta_iphi->Fill(ieta, iphi);
536  break;
537  case 3:
538  hHCAL_D3_Occ_ieta_iphi->Fill(ieta, iphi);
539  break;
540  } // end switch
541  }
542 
543  if (Energy > HBHEMaxEnergy_EtaRing[EtaRing][depth - 1])
544  HBHEMaxEnergy_EtaRing[EtaRing][depth - 1] = Energy;
545  if (Energy < HBHEMinEnergy_EtaRing[EtaRing][depth - 1])
546  HBHEMinEnergy_EtaRing[EtaRing][depth - 1] = Energy;
547 
548  switch (depth) {
549  case 1:
550  hHCAL_D1_energy_ieta_iphi->Fill(ieta, iphi, Energy);
551  hHCAL_D1_energyvsieta->Fill(ieta, Energy);
552  if (Energy > hHCAL_D1_Maxenergy_ieta_iphi->getBinContent(EtaRing + 1, iphi))
553  hHCAL_D1_Maxenergy_ieta_iphi->setBinContent(EtaRing + 1, iphi, Energy);
554  if (Energy < hHCAL_D1_Minenergy_ieta_iphi->getBinContent(EtaRing + 1, iphi))
555  hHCAL_D1_Minenergy_ieta_iphi->setBinContent(EtaRing + 1, iphi, Energy);
556 
557  break;
558  case 2:
559  hHCAL_D2_energy_ieta_iphi->Fill(ieta, iphi, Energy);
560 
561  hHCAL_D2_energyvsieta->Fill(ieta, Energy);
562  if (Energy > hHCAL_D2_Maxenergy_ieta_iphi->getBinContent(EtaRing + 1, iphi))
563  hHCAL_D2_Maxenergy_ieta_iphi->setBinContent(EtaRing + 1, iphi, Energy);
564  if (Energy < hHCAL_D2_Minenergy_ieta_iphi->getBinContent(EtaRing + 1, iphi))
565  hHCAL_D2_Minenergy_ieta_iphi->setBinContent(EtaRing + 1, iphi, Energy);
566  break;
567  case 3:
568  hHCAL_D3_energy_ieta_iphi->Fill(ieta, iphi, Energy);
569 
570  hHCAL_D3_energyvsieta->Fill(ieta, Energy);
571  if (Energy > hHCAL_D3_Maxenergy_ieta_iphi->getBinContent(EtaRing + 1, iphi))
572  hHCAL_D3_Maxenergy_ieta_iphi->setBinContent(EtaRing + 1, iphi, Energy);
573  if (Energy < hHCAL_D3_Minenergy_ieta_iphi->getBinContent(EtaRing + 1, iphi))
574  hHCAL_D3_Minenergy_ieta_iphi->setBinContent(EtaRing + 1, iphi, Energy);
575  break;
576  } // end switch
577 
578  if (HcalNum == HcalBarrel) {
579  nHBrechit++;
580  } else { // HcalEndcap
581  nHErechit++;
582  }
583  } // end loop over HBHERecHit's
584 
585  // Fill eta-ring MET quantities
586  for (int iEtaRing = 0; iEtaRing < 83; iEtaRing++) {
587  for (int jDepth = 0; jDepth < 3; jDepth++) {
588  switch (jDepth + 1) {
589  case 1:
590  hHCAL_D1_Maxenergyvsieta->Fill(iEtaRing - 41, HBHEMaxEnergy_EtaRing[iEtaRing][jDepth]);
591  hHCAL_D1_Minenergyvsieta->Fill(iEtaRing - 41, HBHEMinEnergy_EtaRing[iEtaRing][jDepth]);
592  break;
593  case 2:
594  hHCAL_D2_Maxenergyvsieta->Fill(iEtaRing - 41, HBHEMaxEnergy_EtaRing[iEtaRing][jDepth]);
595  hHCAL_D2_Minenergyvsieta->Fill(iEtaRing - 41, HBHEMinEnergy_EtaRing[iEtaRing][jDepth]);
596  break;
597  case 3:
598  hHCAL_D3_Maxenergyvsieta->Fill(iEtaRing - 41, HBHEMaxEnergy_EtaRing[iEtaRing][jDepth]);
599  hHCAL_D3_Minenergyvsieta->Fill(iEtaRing - 41, HBHEMinEnergy_EtaRing[iEtaRing][jDepth]);
600  break;
601  }
602 
603  if (HBHEActiveRing[iEtaRing][jDepth]) {
604  switch (jDepth + 1) {
605  case 1:
606  hHCAL_D1_METPhivsieta->Fill(iEtaRing - 41, vHBHEMET_EtaRing[iEtaRing][jDepth].Phi());
607  hHCAL_D1_MExvsieta->Fill(iEtaRing - 41, vHBHEMET_EtaRing[iEtaRing][jDepth].Px());
608  hHCAL_D1_MEyvsieta->Fill(iEtaRing - 41, vHBHEMET_EtaRing[iEtaRing][jDepth].Py());
609  hHCAL_D1_METvsieta->Fill(iEtaRing - 41, vHBHEMET_EtaRing[iEtaRing][jDepth].Pt());
610  hHCAL_D1_SETvsieta->Fill(iEtaRing - 41, HBHESET_EtaRing[iEtaRing][jDepth]);
611  hHCAL_D1_Occvsieta->Fill(iEtaRing - 41, HBHENActiveCells[iEtaRing][jDepth]);
612  break;
613  case 2:
614  hHCAL_D2_METPhivsieta->Fill(iEtaRing - 41, vHBHEMET_EtaRing[iEtaRing][jDepth].Phi());
615  hHCAL_D2_MExvsieta->Fill(iEtaRing - 41, vHBHEMET_EtaRing[iEtaRing][jDepth].Px());
616  hHCAL_D2_MEyvsieta->Fill(iEtaRing - 41, vHBHEMET_EtaRing[iEtaRing][jDepth].Py());
617  hHCAL_D2_METvsieta->Fill(iEtaRing - 41, vHBHEMET_EtaRing[iEtaRing][jDepth].Pt());
618  hHCAL_D2_SETvsieta->Fill(iEtaRing - 41, HBHESET_EtaRing[iEtaRing][jDepth]);
619  hHCAL_D2_Occvsieta->Fill(iEtaRing - 41, HBHENActiveCells[iEtaRing][jDepth]);
620  break;
621  case 3:
622  hHCAL_D3_METPhivsieta->Fill(iEtaRing - 41, vHBHEMET_EtaRing[iEtaRing][jDepth].Phi());
623  hHCAL_D3_MExvsieta->Fill(iEtaRing - 41, vHBHEMET_EtaRing[iEtaRing][jDepth].Px());
624  hHCAL_D3_MEyvsieta->Fill(iEtaRing - 41, vHBHEMET_EtaRing[iEtaRing][jDepth].Py());
625  hHCAL_D3_METvsieta->Fill(iEtaRing - 41, vHBHEMET_EtaRing[iEtaRing][jDepth].Pt());
626  hHCAL_D3_SETvsieta->Fill(iEtaRing - 41, HBHESET_EtaRing[iEtaRing][jDepth]);
627  hHCAL_D3_Occvsieta->Fill(iEtaRing - 41, HBHENActiveCells[iEtaRing][jDepth]);
628  break;
629  } //switch
630  } //activering
631  } //depth
632  } //etaring
633 
634  //-------------------------------------------------HO
635  TLorentzVector vHOMET_EtaRing[83];
636  int HOActiveRing[83];
637  int HONActiveCells[83];
638  double HOSET_EtaRing[83];
639  double HOMinEnergy_EtaRing[83];
640  double HOMaxEnergy_EtaRing[83];
641 
642  for (int i = 0; i < 83; i++) {
643  HOActiveRing[i] = 0;
644  HONActiveCells[i] = 0;
645  HOSET_EtaRing[i] = 0;
646  HOMinEnergy_EtaRing[i] = 14E3;
647  HOMaxEnergy_EtaRing[i] = -999;
648  }
649 
650  // Loop over HORecHit's
652  int nHOrechit = 0;
653 
654  for (horechit = HORecHits->begin(); horechit != HORecHits->end(); horechit++) {
655  nHOrechit++;
656 
657  HcalDetId det = horechit->id();
658  double Energy = horechit->energy();
660  Int_t ieta = det.ieta();
661  Int_t iphi = det.iphi();
662  int EtaRing = 41 + ieta; // this counts from 0
663  double eta = hHCAL_ieta_iphi_etaMap->getBinContent(EtaRing + 1, iphi);
664  double phi = hHCAL_ieta_iphi_phiMap->getBinContent(EtaRing + 1, iphi);
665  double theta = 2 * TMath::ATan(exp(-1 * eta));
666  double ET = Energy * TMath::Sin(theta);
667  TLorentzVector v_;
668 
669  if (Energy > 0) // zero suppress
670  {
671  HOActiveRing[EtaRing] = 1;
672  HONActiveCells[EtaRing]++;
673  HOSET_EtaRing[EtaRing] += ET;
674  v_.SetPtEtaPhiE(ET, 0, phi, ET);
675  vHOMET_EtaRing[EtaRing] -= v_;
676 
677  hHCAL_D4_Occ_ieta_iphi->Fill(ieta, iphi);
678  }
679 
680  if (Energy > HOMaxEnergy_EtaRing[EtaRing])
681  HOMaxEnergy_EtaRing[EtaRing] = Energy;
682  if (Energy < HOMinEnergy_EtaRing[EtaRing])
683  HOMinEnergy_EtaRing[EtaRing] = Energy;
684 
685  hHCAL_D4_energy_ieta_iphi->Fill(ieta, iphi, Energy);
686 
687  hHCAL_D4_energyvsieta->Fill(ieta, Energy);
688  if (Energy > hHCAL_D4_Maxenergy_ieta_iphi->getBinContent(EtaRing + 1, iphi))
689  hHCAL_D4_Maxenergy_ieta_iphi->setBinContent(EtaRing + 1, iphi, Energy);
690  if (Energy < hHCAL_D4_Minenergy_ieta_iphi->getBinContent(EtaRing + 1, iphi))
691  hHCAL_D4_Minenergy_ieta_iphi->setBinContent(EtaRing + 1, iphi, Energy);
692 
693  } // end loop over HORecHit's
694 
695  // Fill eta-ring MET quantities
696  for (int iEtaRing = 0; iEtaRing < 83; iEtaRing++) {
697  hHCAL_D4_Maxenergyvsieta->Fill(iEtaRing - 41, HOMaxEnergy_EtaRing[iEtaRing]);
698  hHCAL_D4_Minenergyvsieta->Fill(iEtaRing - 41, HOMinEnergy_EtaRing[iEtaRing]);
699 
700  if (HOActiveRing[iEtaRing]) {
701  hHCAL_D4_METPhivsieta->Fill(iEtaRing - 41, vHOMET_EtaRing[iEtaRing].Phi());
702  hHCAL_D4_MExvsieta->Fill(iEtaRing - 41, vHOMET_EtaRing[iEtaRing].Px());
703  hHCAL_D4_MEyvsieta->Fill(iEtaRing - 41, vHOMET_EtaRing[iEtaRing].Py());
704  hHCAL_D4_METvsieta->Fill(iEtaRing - 41, vHOMET_EtaRing[iEtaRing].Pt());
705  hHCAL_D4_SETvsieta->Fill(iEtaRing - 41, HOSET_EtaRing[iEtaRing]);
706  hHCAL_D4_Occvsieta->Fill(iEtaRing - 41, HONActiveCells[iEtaRing]);
707  }
708  }
709 
710  //------------------------------------------------HF
711 
712  TLorentzVector vHFMET_EtaRing[83][2];
713  int HFActiveRing[83][2];
714  int HFNActiveCells[83][2];
715  double HFSET_EtaRing[83][2];
716  double HFMinEnergy_EtaRing[83][2];
717  double HFMaxEnergy_EtaRing[83][2];
718 
719  for (int i = 0; i < 83; i++) {
720  for (int j = 0; j < 2; j++) {
721  HFActiveRing[i][j] = 0;
722  HFNActiveCells[i][j] = 0;
723  HFSET_EtaRing[i][j] = 0;
724  HFMinEnergy_EtaRing[i][j] = 14E3;
725  HFMaxEnergy_EtaRing[i][j] = -999;
726  }
727  }
728 
729  // Loop over HFRecHit's
731  int nHFrechit = 0;
732 
733  for (hfrechit = HFRecHits->begin(); hfrechit != HFRecHits->end(); hfrechit++) {
734  nHFrechit++;
735 
736  HcalDetId det = hfrechit->id();
737  double Energy = hfrechit->energy();
738  Int_t depth = det.depth();
739  Int_t ieta = det.ieta();
740  Int_t iphi = det.iphi();
741  int EtaRing = 41 + ieta; // this counts from 0
742  double eta = hHCAL_ieta_iphi_etaMap->getBinContent(EtaRing + 1, iphi);
743  double phi = hHCAL_ieta_iphi_phiMap->getBinContent(EtaRing + 1, iphi);
744  double theta = 2 * TMath::ATan(exp(-1 * eta));
745  double ET = Energy * TMath::Sin(theta);
746 
747  TLorentzVector v_;
748  if (Energy > 0) // zero suppress
749  {
750  HFActiveRing[EtaRing][depth - 1] = 1;
751  HFNActiveCells[EtaRing][depth - 1]++;
752  HFSET_EtaRing[EtaRing][depth - 1] += ET;
753  v_.SetPtEtaPhiE(ET, 0, phi, ET);
754  vHFMET_EtaRing[EtaRing][depth - 1] -= v_;
755 
756  switch (depth) {
757  case 1:
758  hHCAL_D1_Occ_ieta_iphi->Fill(ieta, iphi);
759  break;
760  case 2:
761  hHCAL_D2_Occ_ieta_iphi->Fill(ieta, iphi);
762  break;
763  }
764  }
765 
766  if (Energy > HFMaxEnergy_EtaRing[EtaRing][depth - 1])
767  HFMaxEnergy_EtaRing[EtaRing][depth - 1] = Energy;
768  if (Energy < HFMinEnergy_EtaRing[EtaRing][depth - 1])
769  HFMinEnergy_EtaRing[EtaRing][depth - 1] = Energy;
770 
771  switch (depth) {
772  case 1:
773  hHCAL_D1_energy_ieta_iphi->Fill(ieta, iphi, Energy);
774 
775  hHCAL_D1_energyvsieta->Fill(ieta, Energy);
776  if (Energy > hHCAL_D1_Maxenergy_ieta_iphi->getBinContent(EtaRing + 1, iphi))
777  hHCAL_D1_Maxenergy_ieta_iphi->setBinContent(EtaRing + 1, iphi, Energy);
778  if (Energy < hHCAL_D1_Minenergy_ieta_iphi->getBinContent(EtaRing + 1, iphi))
779  hHCAL_D1_Minenergy_ieta_iphi->setBinContent(EtaRing + 1, iphi, Energy);
780  break;
781  case 2:
782  hHCAL_D2_energy_ieta_iphi->Fill(ieta, iphi, Energy);
783 
784  hHCAL_D2_energyvsieta->Fill(ieta, Energy);
785  if (Energy > hHCAL_D2_Maxenergy_ieta_iphi->getBinContent(EtaRing + 1, iphi))
786  hHCAL_D2_Maxenergy_ieta_iphi->setBinContent(EtaRing + 1, iphi, Energy);
787  if (Energy < hHCAL_D2_Minenergy_ieta_iphi->getBinContent(EtaRing + 1, iphi))
788  hHCAL_D2_Minenergy_ieta_iphi->setBinContent(EtaRing + 1, iphi, Energy);
789  break;
790  }
791 
792  } // end loop over HFRecHit's
793 
794  // Fill eta-ring MET quantities
795  for (int iEtaRing = 0; iEtaRing < 83; iEtaRing++) {
796  for (int jDepth = 0; jDepth < 2; jDepth++) {
797  switch (jDepth + 1) {
798  case 1:
799  hHCAL_D1_Maxenergyvsieta->Fill(iEtaRing - 41, HFMaxEnergy_EtaRing[iEtaRing][jDepth]);
800  hHCAL_D1_Minenergyvsieta->Fill(iEtaRing - 41, HFMinEnergy_EtaRing[iEtaRing][jDepth]);
801  break;
802  case 2:
803  hHCAL_D2_Maxenergyvsieta->Fill(iEtaRing - 41, HFMaxEnergy_EtaRing[iEtaRing][jDepth]);
804  hHCAL_D2_Minenergyvsieta->Fill(iEtaRing - 41, HFMinEnergy_EtaRing[iEtaRing][jDepth]);
805  break;
806  }
807 
808  if (HFActiveRing[iEtaRing][jDepth]) {
809  switch (jDepth + 1) {
810  case 1:
811 
812  hHCAL_D1_METPhivsieta->Fill(iEtaRing - 41, vHFMET_EtaRing[iEtaRing][jDepth].Phi());
813  hHCAL_D1_MExvsieta->Fill(iEtaRing - 41, vHFMET_EtaRing[iEtaRing][jDepth].Px());
814  hHCAL_D1_MEyvsieta->Fill(iEtaRing - 41, vHFMET_EtaRing[iEtaRing][jDepth].Py());
815  hHCAL_D1_METvsieta->Fill(iEtaRing - 41, vHFMET_EtaRing[iEtaRing][jDepth].Pt());
816  hHCAL_D1_SETvsieta->Fill(iEtaRing - 41, HFSET_EtaRing[iEtaRing][jDepth]);
817  hHCAL_D1_Occvsieta->Fill(iEtaRing - 41, HFNActiveCells[iEtaRing][jDepth]);
818  break;
819 
820  case 2:
821 
822  hHCAL_D2_METPhivsieta->Fill(iEtaRing - 41, vHFMET_EtaRing[iEtaRing][jDepth].Phi());
823  hHCAL_D2_MExvsieta->Fill(iEtaRing - 41, vHFMET_EtaRing[iEtaRing][jDepth].Px());
824  hHCAL_D2_MEyvsieta->Fill(iEtaRing - 41, vHFMET_EtaRing[iEtaRing][jDepth].Py());
825  hHCAL_D2_METvsieta->Fill(iEtaRing - 41, vHFMET_EtaRing[iEtaRing][jDepth].Pt());
826  hHCAL_D2_SETvsieta->Fill(iEtaRing - 41, HFSET_EtaRing[iEtaRing][jDepth]);
827  hHCAL_D2_Occvsieta->Fill(iEtaRing - 41, HFNActiveCells[iEtaRing][jDepth]);
828  break;
829  }
830  }
831  }
832  }
833 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
T getUntrackedParameter(std::string const &, T const &) const
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
MonitorElement * hHCAL_D4_Maxenergy_ieta_iphi
MonitorElement * hHCAL_ieta_iphi_HFMap
MonitorElement * hHCAL_D3_Maxenergy_ieta_iphi
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_
MonitorElement * hHCAL_D3_Maxenergyvsieta
const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const override
Get a list of valid detector ids (for the given subdetector)
Definition: HcalGeometry.cc:76
MonitorElement * hHCAL_ieta_iphi_phiMap
MonitorElement * hHCAL_D1_SETvsieta
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
MonitorElement * hHCAL_D3_Occvsieta
HCALRecHitAnalyzer(const edm::ParameterSet &)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
MonitorElement * hHCAL_D2_Minenergy_ieta_iphi
MonitorElement * hHCAL_D4_METvsieta
MonitorElement * hHCAL_D4_energyvsieta
MonitorElement * hHCAL_D4_Maxenergyvsieta
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
MonitorElement * hHCAL_D1_Minenergy_ieta_iphi
std::vector< T >::const_iterator const_iterator
Geom::Theta< T > theta() const
MonitorElement * hHCAL_D4_Occvsieta
void FillGeometry(const edm::EventSetup &)
MonitorElement * hHCAL_D3_Minenergyvsieta
MonitorElement * hHCAL_D3_Occ_ieta_iphi
MonitorElement * hHCAL_D4_Occ_ieta_iphi
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
MonitorElement * hHCAL_D2_Minenergyvsieta
MonitorElement * hHCAL_ieta_iphi_etaMap
MonitorElement * hHCAL_D4_MEyvsieta
MonitorElement * hHCAL_D4_SETvsieta
MonitorElement * hHCAL_ieta_iphi_HBMap
MonitorElement * hHCAL_D3_METvsieta
MonitorElement * hHCAL_ieta_iphi_HOMap
virtual const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const
Get a list of valid detector ids (for the given subdetector)
MonitorElement * hHCAL_D3_MExvsieta
MonitorElement * hHCAL_D1_Maxenergy_ieta_iphi
void Fill(long long x)
constexpr HcalSubdetector subdet() const
get the subdetector
Definition: HcalDetId.h:138
MonitorElement * hHCAL_D1_Occ_ieta_iphi
MonitorElement * hHCAL_D4_METPhivsieta
MonitorElement * hHCAL_D4_Minenergyvsieta
int iEvent
Definition: GenABIO.cc:224
MonitorElement * hHCAL_D2_METvsieta
MonitorElement * hHCAL_D1_Occvsieta
MonitorElement * hHCAL_D1_Minenergyvsieta
MonitorElement * hHCAL_D1_METPhivsieta
constexpr int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
MonitorElement * hHCAL_D1_METvsieta
MonitorElement * hHCAL_D1_Maxenergyvsieta
void analyze(const edm::Event &, const edm::EventSetup &) override
MonitorElement * hHCAL_D3_energyvsieta
MonitorElement * hHCAL_D2_Maxenergyvsieta
MonitorElement * hHCAL_D2_energyvsieta
HcalSubdetector
Definition: HcalAssistant.h:31
edm::EDGetTokenT< HFRecHitCollection > hFRecHitsLabel_
constexpr int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
MonitorElement * hHCAL_D2_METPhivsieta
MonitorElement * hHCAL_D2_Occvsieta
bool isValid() const
Definition: HandleBase.h:70
virtual double getBinContent(int binx) const
get content of bin (1-D)
MonitorElement * hHCAL_D2_Maxenergy_ieta_iphi
MonitorElement * hHCAL_D3_METPhivsieta
MonitorElement * hHCAL_D1_energyvsieta
MonitorElement * hHCAL_ieta_detaMap
MonitorElement * hHCAL_D2_energy_ieta_iphi
GlobalPoint getPosition(const DetId &id) const
#define M_PI
const_iterator end() const
Log< level::Info, false > LogInfo
MonitorElement * hHCAL_D1_energy_ieta_iphi
MonitorElement * hHCAL_D4_Minenergy_ieta_iphi
MonitorElement * hHCAL_D3_SETvsieta
edm::EDGetTokenT< HORecHitCollection > hORecHitsLabel_
MonitorElement * hHCAL_D1_MExvsieta
MonitorElement * hHCAL_D4_MExvsieta
MonitorElement * hHCAL_D2_MEyvsieta
T const * product() const
Definition: Handle.h:70
#define DEBUG(X)
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Definition: DQMStore.h:177
MonitorElement * hHCAL_D1_MEyvsieta
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< HBHERecHitCollection > hBHERecHitsLabel_
T eta() const
Definition: PV3DBase.h:73
MonitorElement * hHCAL_D4_energy_ieta_iphi
MonitorElement * hHCAL_D3_energy_ieta_iphi
MonitorElement * hHCAL_D2_Occ_ieta_iphi
MonitorElement * hHCAL_Nevents
MonitorElement * hHCAL_D3_Minenergy_ieta_iphi
MonitorElement * hHCAL_D2_SETvsieta
#define ET
MonitorElement * hHCAL_D2_MExvsieta
constexpr int depth() const
get the tower depth
Definition: HcalDetId.h:164
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MonitorElement * hHCAL_D3_MEyvsieta
MonitorElement * hHCAL_ieta_iphi_HEMap
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
const_iterator begin() const
Definition: Run.h:45
MonitorElement * hHCAL_ieta_dphiMap