CMS 3D CMS Logo

ECALRecHitAnalyzer.cc
Go to the documentation of this file.
4 
5 // author: Bobby Scurlock, University of Florida
6 // first version 11/20/2006
7 
8 #define DEBUG(X) \
9  { \
10  if (debug_) { \
11  std::cout << X << std::endl; \
12  } \
13  }
14 
16  // Retrieve Information from the Configuration File
17  EBRecHitsLabel_ = consumes<EBRecHitCollection>(iConfig.getParameter<edm::InputTag>("EBRecHitsLabel"));
18  EERecHitsLabel_ = consumes<EERecHitCollection>(iConfig.getParameter<edm::InputTag>("EERecHitsLabel"));
19  caloGeomToken_ = esConsumes<edm::Transition::BeginRun>();
20  FolderName_ = iConfig.getUntrackedParameter<std::string>("FolderName");
21  debug_ = iConfig.getParameter<bool>("Debug");
22  // EBRecHitsLabel_= consumes<EcalRecHitCollection>(edm::InputTag(EBRecHitsLabel_));
23  // EERecHitsLabel_= consumes<EcalRecHitCollection>(edm::InputTag(EERecHitsLabel_));
24 }
25 
26 void ECALRecHitAnalyzer::dqmbeginRun(const edm::Run& iRun, const edm::EventSetup& iSetup) {
27  CurrentEvent = -1;
28  caloGeom_ = &iSetup.getData(caloGeomToken_);
29  // Fill the geometry histograms
30  FillGeometry(iSetup);
31 }
32 
34  // get ahold of back-end interface
35  // Book Geometry Histograms
36  ibooker.setCurrentFolder(FolderName_ + "/geometry");
37 
38  // ECAL barrel
39  hEB_ieta_iphi_etaMap = ibooker.book2D("hEB_ieta_iphi_etaMap", "", 171, -85, 86, 360, 1, 361);
40  hEB_ieta_iphi_phiMap = ibooker.book2D("hEB_ieta_iphi_phiMap", "", 171, -85, 86, 360, 1, 361);
41  hEB_ieta_detaMap = ibooker.book1D("hEB_ieta_detaMap", "", 171, -85, 86);
42  hEB_ieta_dphiMap = ibooker.book1D("hEB_ieta_dphiMap", "", 171, -85, 86);
43  // ECAL +endcap
44  hEEpZ_ix_iy_irMap = ibooker.book2D("hEEpZ_ix_iy_irMap", "", 100, 1, 101, 100, 1, 101);
45  hEEpZ_ix_iy_xMap = ibooker.book2D("hEEpZ_ix_iy_xMap", "", 100, 1, 101, 100, 1, 101);
46  hEEpZ_ix_iy_yMap = ibooker.book2D("hEEpZ_ix_iy_yMap", "", 100, 1, 101, 100, 1, 101);
47  hEEpZ_ix_iy_zMap = ibooker.book2D("hEEpZ_ix_iy_zMap", "", 100, 1, 101, 100, 1, 101);
48  hEEpZ_ix_iy_dxMap = ibooker.book2D("hEEpZ_ix_iy_dxMap", "", 100, 1, 101, 100, 1, 101);
49  hEEpZ_ix_iy_dyMap = ibooker.book2D("hEEpZ_ix_iy_dyMap", "", 100, 1, 101, 100, 1, 101);
50  // ECAL -endcap
51  hEEmZ_ix_iy_irMap = ibooker.book2D("hEEmZ_ix_iy_irMap", "", 100, 1, 101, 100, 1, 101);
52  hEEmZ_ix_iy_xMap = ibooker.book2D("hEEmZ_ix_iy_xMap", "", 100, 1, 101, 100, 1, 101);
53  hEEmZ_ix_iy_yMap = ibooker.book2D("hEEmZ_ix_iy_yMap", "", 100, 1, 101, 100, 1, 101);
54  hEEmZ_ix_iy_zMap = ibooker.book2D("hEEmZ_ix_iy_zMap", "", 100, 1, 101, 100, 1, 101);
55  hEEmZ_ix_iy_dxMap = ibooker.book2D("hEEmZ_ix_iy_dxMap", "", 100, 1, 101, 100, 1, 101);
56  hEEmZ_ix_iy_dyMap = ibooker.book2D("hEEmZ_ix_iy_dyMap", "", 100, 1, 101, 100, 1, 101);
57 
58  // Initialize bins for geometry to -999 because z = 0 is a valid entry
59  for (int i = 1; i <= 100; i++)
60  for (int j = 1; j <= 100; j++) {
67 
74  }
75 
76  for (int i = 1; i <= 171; i++) {
79  for (int j = 1; j <= 360; j++) {
82  }
83  }
84 
85  // Book Data Histograms
87 
88  hECAL_Nevents = ibooker.book1D("hECAL_Nevents", "", 1, 0, 1);
89 
90  // Energy Histograms by logical index
91  hEEpZ_energy_ix_iy = ibooker.book2D("hEEpZ_energy_ix_iy", "", 100, 1, 101, 100, 1, 101);
92  hEEmZ_energy_ix_iy = ibooker.book2D("hEEmZ_energy_ix_iy", "", 100, 1, 101, 100, 1, 101);
93  hEB_energy_ieta_iphi = ibooker.book2D("hEB_energy_ieta_iphi", "", 171, -85, 86, 360, 1, 361);
94 
95  hEEpZ_Minenergy_ix_iy = ibooker.book2D("hEEpZ_Minenergy_ix_iy", "", 100, 1, 101, 100, 1, 101);
96  hEEmZ_Minenergy_ix_iy = ibooker.book2D("hEEmZ_Minenergy_ix_iy", "", 100, 1, 101, 100, 1, 101);
97  hEB_Minenergy_ieta_iphi = ibooker.book2D("hEB_Minenergy_ieta_iphi", "", 171, -85, 86, 360, 1, 361);
98 
99  hEEpZ_Maxenergy_ix_iy = ibooker.book2D("hEEpZ_Maxenergy_ix_iy", "", 100, 1, 101, 100, 1, 101);
100  hEEmZ_Maxenergy_ix_iy = ibooker.book2D("hEEmZ_Maxenergy_ix_iy", "", 100, 1, 101, 100, 1, 101);
101  hEB_Maxenergy_ieta_iphi = ibooker.book2D("hEB_Maxenergy_ieta_iphi", "", 171, -85, 86, 360, 1, 361);
102 
103  // need to initialize those
104  for (int i = 1; i <= 171; i++)
105  for (int j = 1; j <= 360; j++) {
108  }
109  for (int i = 1; i <= 100; i++)
110  for (int j = 1; j <= 100; j++) {
115  }
116 
117  // Occupancy Histograms by logical index
118  hEEpZ_Occ_ix_iy = ibooker.book2D("hEEpZ_Occ_ix_iy", "", 100, 1, 101, 100, 1, 101);
119  hEEmZ_Occ_ix_iy = ibooker.book2D("hEEmZ_Occ_ix_iy", "", 100, 1, 101, 100, 1, 101);
120  hEB_Occ_ieta_iphi = ibooker.book2D("hEB_Occ_ieta_iphi", "", 171, -85, 86, 360, 1, 361);
121 
122  // Integrated Histograms
123  if (finebinning_) {
124  hEEpZ_energyvsir = ibooker.book2D("hEEpZ_energyvsir", "", 100, 1, 101, 20110, -10, 201);
125  hEEmZ_energyvsir = ibooker.book2D("hEEmZ_energyvsir", "", 100, 1, 101, 20110, -10, 201);
126  hEB_energyvsieta = ibooker.book2D("hEB_energyvsieta", "", 171, -85, 86, 20110, -10, 201);
127 
128  hEEpZ_Maxenergyvsir = ibooker.book2D("hEEpZ_Maxenergyvsir", "", 100, 1, 101, 20110, -10, 201);
129  hEEmZ_Maxenergyvsir = ibooker.book2D("hEEmZ_Maxenergyvsir", "", 100, 1, 101, 20110, -10, 201);
130  hEB_Maxenergyvsieta = ibooker.book2D("hEB_Maxenergyvsieta", "", 171, -85, 86, 20110, -10, 201);
131 
132  hEEpZ_Minenergyvsir = ibooker.book2D("hEEpZ_Minenergyvsir", "", 100, 1, 101, 20110, -10, 201);
133  hEEmZ_Minenergyvsir = ibooker.book2D("hEEmZ_Minenergyvsir", "", 100, 1, 101, 20110, -10, 201);
134  hEB_Minenergyvsieta = ibooker.book2D("hEB_Minenergyvsieta", "", 171, -85, 86, 20110, -10, 201);
135 
136  hEEpZ_SETvsir = ibooker.book2D("hEEpZ_SETvsir", "", 50, 1, 51, 20010, 0, 201);
137  hEEmZ_SETvsir = ibooker.book2D("hEEmZ_SETvsir", "", 50, 1, 51, 20010, 0, 201);
138  hEB_SETvsieta = ibooker.book2D("hEB_SETvsieta", "", 171, -85, 86, 20010, 0, 201);
139 
140  hEEpZ_METvsir = ibooker.book2D("hEEpZ_METvsir", "", 50, 1, 51, 20010, 0, 201);
141  hEEmZ_METvsir = ibooker.book2D("hEEmZ_METvsir", "", 50, 1, 51, 20010, 0, 201);
142  hEB_METvsieta = ibooker.book2D("hEB_METvsieta", "", 171, -85, 86, 20010, 0, 201);
143 
144  hEEpZ_METPhivsir = ibooker.book2D("hEEpZ_METPhivsir", "", 50, 1, 51, 80, -4, 4);
145  hEEmZ_METPhivsir = ibooker.book2D("hEEmZ_METPhivsir", "", 50, 1, 51, 80, -4, 4);
146  hEB_METPhivsieta = ibooker.book2D("hEB_METPhivsieta", "", 171, -85, 86, 80, -4, 4);
147 
148  hEEpZ_MExvsir = ibooker.book2D("hEEpZ_MExvsir", "", 50, 1, 51, 10010, -50, 51);
149  hEEmZ_MExvsir = ibooker.book2D("hEEmZ_MExvsir", "", 50, 1, 51, 10010, -50, 51);
150  hEB_MExvsieta = ibooker.book2D("hEB_MExvsieta", "", 171, -85, 86, 10010, -50, 51);
151 
152  hEEpZ_MEyvsir = ibooker.book2D("hEEpZ_MEyvsir", "", 50, 1, 51, 10010, -50, 51);
153  hEEmZ_MEyvsir = ibooker.book2D("hEEmZ_MEyvsir", "", 50, 1, 51, 10010, -50, 51);
154  hEB_MEyvsieta = ibooker.book2D("hEB_MEyvsieta", "", 171, -85, 86, 10010, -50, 51);
155 
156  hEEpZ_Occvsir = ibooker.book2D("hEEpZ_Occvsir", "", 50, 1, 51, 1000, 0, 1000);
157  hEEmZ_Occvsir = ibooker.book2D("hEEmZ_Occvsir", "", 50, 1, 51, 1000, 0, 1000);
158  hEB_Occvsieta = ibooker.book2D("hEB_Occvsieta", "", 171, -85, 86, 400, 0, 400);
159  } else {
160  hEEpZ_energyvsir = ibooker.book2D("hEEpZ_energyvsir", "", 100, 1, 101, 510, -10, 100);
161  hEEmZ_energyvsir = ibooker.book2D("hEEmZ_energyvsir", "", 100, 1, 101, 510, -10, 100);
162  hEB_energyvsieta = ibooker.book2D("hEB_energyvsieta", "", 171, -85, 86, 510, -10, 100);
163 
164  hEEpZ_Maxenergyvsir = ibooker.book2D("hEEpZ_Maxenergyvsir", "", 100, 1, 101, 510, -10, 100);
165  hEEmZ_Maxenergyvsir = ibooker.book2D("hEEmZ_Maxenergyvsir", "", 100, 1, 101, 510, -10, 100);
166  hEB_Maxenergyvsieta = ibooker.book2D("hEB_Maxenergyvsieta", "", 171, -85, 86, 510, -10, 100);
167 
168  hEEpZ_Minenergyvsir = ibooker.book2D("hEEpZ_Minenergyvsir", "", 100, 1, 101, 510, -10, 100);
169  hEEmZ_Minenergyvsir = ibooker.book2D("hEEmZ_Minenergyvsir", "", 100, 1, 101, 510, -10, 100);
170  hEB_Minenergyvsieta = ibooker.book2D("hEB_Minenergyvsieta", "", 171, -85, 86, 510, -10, 100);
171 
172  hEEpZ_SETvsir = ibooker.book2D("hEEpZ_SETvsir", "", 50, 1, 51, 510, 0, 100);
173  hEEmZ_SETvsir = ibooker.book2D("hEEmZ_SETvsir", "", 50, 1, 51, 510, 0, 100);
174  hEB_SETvsieta = ibooker.book2D("hEB_SETvsieta", "", 171, -85, 86, 510, 0, 100);
175 
176  hEEpZ_METvsir = ibooker.book2D("hEEpZ_METvsir", "", 50, 1, 51, 510, 0, 100);
177  hEEmZ_METvsir = ibooker.book2D("hEEmZ_METvsir", "", 50, 1, 51, 510, 0, 100);
178  hEB_METvsieta = ibooker.book2D("hEB_METvsieta", "", 171, -85, 86, 510, 0, 100);
179 
180  hEEpZ_METPhivsir = ibooker.book2D("hEEpZ_METPhivsir", "", 50, 1, 51, 80, -4, 4);
181  hEEmZ_METPhivsir = ibooker.book2D("hEEmZ_METPhivsir", "", 50, 1, 51, 80, -4, 4);
182  hEB_METPhivsieta = ibooker.book2D("hEB_METPhivsieta", "", 171, -85, 86, 80, -4, 4);
183 
184  hEEpZ_MExvsir = ibooker.book2D("hEEpZ_MExvsir", "", 50, 1, 51, 510, -50, 51);
185  hEEmZ_MExvsir = ibooker.book2D("hEEmZ_MExvsir", "", 50, 1, 51, 510, -50, 51);
186  hEB_MExvsieta = ibooker.book2D("hEB_MExvsieta", "", 171, -85, 86, 510, -50, 51);
187 
188  hEEpZ_MEyvsir = ibooker.book2D("hEEpZ_MEyvsir", "", 50, 1, 51, 510, -50, 51);
189  hEEmZ_MEyvsir = ibooker.book2D("hEEmZ_MEyvsir", "", 50, 1, 51, 510, -50, 51);
190  hEB_MEyvsieta = ibooker.book2D("hEB_MEyvsieta", "", 171, -85, 86, 510, -50, 51);
191 
192  hEEpZ_Occvsir = ibooker.book2D("hEEpZ_Occvsir", "", 50, 1, 51, 1000, 0, 1000);
193  hEEmZ_Occvsir = ibooker.book2D("hEEmZ_Occvsir", "", 50, 1, 51, 1000, 0, 1000);
194  hEB_Occvsieta = ibooker.book2D("hEB_Occvsieta", "", 171, -85, 86, 400, 0, 400);
195  }
196 }
197 
199  // Fill geometry histograms
200  using namespace edm;
201  //const auto& cG = iSetup.getData(caloGeomToken_);
202  //----Fill Ecal Barrel----//
204  int n = 0;
205  std::vector<DetId> EBids = EBgeom->getValidDetIds(DetId::Ecal, 1);
206  for (std::vector<DetId>::iterator i = EBids.begin(); i != EBids.end(); i++) {
207  n++;
208  auto cell = EBgeom->getGeometry(*i);
209  //GlobalPoint p = cell->getPosition();
210 
211  EBDetId EcalID(i->rawId());
212 
213  int Crystal_ieta = EcalID.ieta();
214  int Crystal_iphi = EcalID.iphi();
215  double Crystal_eta = cell->getPosition().eta();
216  double Crystal_phi = cell->getPosition().phi();
217  hEB_ieta_iphi_etaMap->setBinContent(Crystal_ieta + 86, Crystal_iphi, Crystal_eta);
218  hEB_ieta_iphi_phiMap->setBinContent(Crystal_ieta + 86, Crystal_iphi, (Crystal_phi * 180 / M_PI));
219 
220  DEBUG(" Crystal " << n);
221  DEBUG(" ieta, iphi = " << Crystal_ieta << ", " << Crystal_iphi);
222  DEBUG(" eta, phi = " << cell->getPosition().eta() << ", " << cell->getPosition().phi());
223  DEBUG(" ");
224  }
225  //----Fill Ecal Endcap----------//
227  n = 0;
228  std::vector<DetId> EEids = EEgeom->getValidDetIds(DetId::Ecal, 2);
229  for (std::vector<DetId>::iterator i = EEids.begin(); i != EEids.end(); i++) {
230  n++;
231  auto cell = EEgeom->getGeometry(*i);
232  //GlobalPoint p = cell->getPosition();
233  EEDetId EcalID(i->rawId());
234  int Crystal_zside = EcalID.zside();
235  int Crystal_ix = EcalID.ix();
236  int Crystal_iy = EcalID.iy();
237  Float_t ix_ = Crystal_ix - 50.5;
238  Float_t iy_ = Crystal_iy - 50.5;
239  Int_t ir = (Int_t)sqrt(ix_ * ix_ + iy_ * iy_);
240 
241  //double Crystal_eta = cell->getPosition().eta();
242  //double Crystal_phi = cell->getPosition().phi();
243  double Crystal_x = cell->getPosition().x();
244  double Crystal_y = cell->getPosition().y();
245  double Crystal_z = cell->getPosition().z();
246  // ECAL -endcap
247  if (Crystal_zside == -1) {
248  hEEmZ_ix_iy_irMap->setBinContent(Crystal_ix, Crystal_iy, ir);
249  hEEmZ_ix_iy_xMap->setBinContent(Crystal_ix, Crystal_iy, Crystal_x);
250  hEEmZ_ix_iy_yMap->setBinContent(Crystal_ix, Crystal_iy, Crystal_y);
251  hEEmZ_ix_iy_zMap->setBinContent(Crystal_ix, Crystal_iy, Crystal_z);
252  }
253  // ECAL +endcap
254  if (Crystal_zside == 1) {
255  hEEpZ_ix_iy_irMap->setBinContent(Crystal_ix, Crystal_iy, ir);
256  hEEpZ_ix_iy_xMap->setBinContent(Crystal_ix, Crystal_iy, Crystal_x);
257  hEEpZ_ix_iy_yMap->setBinContent(Crystal_ix, Crystal_iy, Crystal_y);
258  hEEpZ_ix_iy_zMap->setBinContent(Crystal_ix, Crystal_iy, Crystal_z);
259  }
260 
261  DEBUG(" Crystal " << n);
262  DEBUG(" side = " << Crystal_zside);
263  DEBUG(" ix, iy = " << Crystal_ix << ", " << Crystal_iy);
264  DEBUG(" x, y = " << Crystal_x << ", " << Crystal_y);
265  ;
266  DEBUG(" ");
267  }
268 
269  //-------Set the cell size for each (ieta, iphi) bin-------//
270  //double currentHighEdge_eta = 0;
271  for (int ieta = 1; ieta <= 85; ieta++) {
272  int ieta_ = 86 + ieta;
273 
274  double eta = hEB_ieta_iphi_etaMap->getBinContent(ieta_, 1);
275  double etam1 = -999;
276 
277  if (ieta == 1)
278  etam1 = hEB_ieta_iphi_etaMap->getBinContent(85, 1);
279  else
280  etam1 = hEB_ieta_iphi_etaMap->getBinContent(ieta_ - 1, 1);
281 
282  //double phi = hEB_ieta_iphi_phiMap->getBinContent(ieta_, 1);
283  double deta = fabs(eta - etam1);
284  double dphi = fabs(hEB_ieta_iphi_phiMap->getBinContent(ieta_, 1) - hEB_ieta_iphi_phiMap->getBinContent(ieta_, 2));
285 
286  hEB_ieta_detaMap->setBinContent(ieta_, deta); // positive rings
287  hEB_ieta_dphiMap->setBinContent(ieta_, dphi); // positive rings
288  hEB_ieta_detaMap->setBinContent(86 - ieta, deta); // negative rings
289  hEB_ieta_dphiMap->setBinContent(86 - ieta, dphi); // negative rings
290  }
291 }
292 
294  CurrentEvent++;
295  DEBUG("Event: " << CurrentEvent);
296  WriteECALRecHits(iEvent, iSetup);
297  hECAL_Nevents->Fill(0.5);
298 }
299 
303  iEvent.getByToken(EBRecHitsLabel_, EBRecHits);
304  iEvent.getByToken(EERecHitsLabel_, EERecHits);
305  DEBUG("Got ECALRecHits");
306 
307  //const CaloSubdetectorGeometry* EBgeom=cG.getSubdetectorGeometry(DetId::Ecal,1);
308  //const CaloSubdetectorGeometry* EEgeom=cG.getSubdetectorGeometry(DetId::Ecal,2);
309  DEBUG("Got Geometry");
310 
311  TLorentzVector vEBMET_EtaRing[171];
312  int EBActiveRing[171];
313  int EBNActiveCells[171];
314  double EBSET_EtaRing[171];
315  double EBMaxEnergy_EtaRing[171];
316  double EBMinEnergy_EtaRing[171];
317  double EBenergy_EtaRing[171];
318 
319  for (int i = 0; i < 171; i++) {
320  EBActiveRing[i] = 0;
321  EBNActiveCells[i] = 0;
322  EBSET_EtaRing[i] = 0.0;
323  EBMaxEnergy_EtaRing[i] = -999;
324  EBMinEnergy_EtaRing[i] = 14E3;
325  EBenergy_EtaRing[i] = 0.0;
326  }
327 
328  edm::LogInfo("OutputInfo") << "Looping over EB" << std::endl;
329 
331  //int nEBrechit = 0;
332 
333  for (ebrechit = EBRecHits->begin(); ebrechit != EBRecHits->end(); ebrechit++) {
334  EBDetId det = ebrechit->id();
335  double Energy = ebrechit->energy();
336  Int_t ieta = det.ieta();
337  Int_t iphi = det.iphi();
338  int EtaRing = 85 + ieta; // this counts from 0
339  double eta = hEB_ieta_iphi_etaMap->getBinContent(EtaRing + 1, iphi);
340  double phi = hEB_ieta_iphi_phiMap->getBinContent(EtaRing + 1, iphi);
341  double theta = 2 * TMath::ATan(exp(-1 * eta));
342  double ET = Energy * TMath::Sin(theta);
343  TLorentzVector v_;
344 
345  if (Energy > EBMaxEnergy_EtaRing[EtaRing])
346  EBMaxEnergy_EtaRing[EtaRing] = Energy;
347  if (Energy < EBMinEnergy_EtaRing[EtaRing])
348  EBMinEnergy_EtaRing[EtaRing] = Energy;
349 
350  if (Energy > 0) {
351  EBActiveRing[EtaRing] = 1;
352  EBNActiveCells[EtaRing]++;
353  EBSET_EtaRing[EtaRing] += ET;
354  v_.SetPtEtaPhiE(ET, 0, phi, ET);
355  vEBMET_EtaRing[EtaRing] -= v_;
356  EBenergy_EtaRing[EtaRing] += Energy;
358  }
359 
361  if (Energy > hEB_Maxenergy_ieta_iphi->getBinContent(EtaRing + 1, iphi))
363  if (Energy < hEB_Minenergy_ieta_iphi->getBinContent(EtaRing + 1, iphi))
365 
366  } // loop over EB
367 
368  for (int iEtaRing = 0; iEtaRing < 171; iEtaRing++) {
369  hEB_Minenergyvsieta->Fill(iEtaRing - 85, EBMinEnergy_EtaRing[iEtaRing]);
370  hEB_Maxenergyvsieta->Fill(iEtaRing - 85, EBMaxEnergy_EtaRing[iEtaRing]);
371 
372  if (EBActiveRing[iEtaRing]) {
373  hEB_METvsieta->Fill(iEtaRing - 85, vEBMET_EtaRing[iEtaRing].Pt());
374  hEB_METPhivsieta->Fill(iEtaRing - 85, vEBMET_EtaRing[iEtaRing].Phi());
375  hEB_MExvsieta->Fill(iEtaRing - 85, vEBMET_EtaRing[iEtaRing].Px());
376  hEB_MEyvsieta->Fill(iEtaRing - 85, vEBMET_EtaRing[iEtaRing].Py());
377  hEB_SETvsieta->Fill(iEtaRing - 85, EBSET_EtaRing[iEtaRing]);
378  hEB_Occvsieta->Fill(iEtaRing - 85, EBNActiveCells[iEtaRing]);
379  hEB_energyvsieta->Fill(iEtaRing - 85, EBenergy_EtaRing[iEtaRing]);
380  }
381  }
382 
383  TLorentzVector vEEpZMET_EtaRing[101];
384  int EEpZActiveRing[101];
385  int EEpZNActiveCells[101];
386  double EEpZSET_EtaRing[101];
387  double EEpZMaxEnergy_EtaRing[101];
388  double EEpZMinEnergy_EtaRing[101];
389 
390  TLorentzVector vEEmZMET_EtaRing[101];
391  int EEmZActiveRing[101];
392  int EEmZNActiveCells[101];
393  double EEmZSET_EtaRing[101];
394  double EEmZMaxEnergy_EtaRing[101];
395  double EEmZMinEnergy_EtaRing[101];
396 
397  for (int i = 0; i < 101; i++) {
398  EEpZActiveRing[i] = 0;
399  EEpZNActiveCells[i] = 0;
400  EEpZSET_EtaRing[i] = 0.0;
401  EEpZMaxEnergy_EtaRing[i] = -999;
402  EEpZMinEnergy_EtaRing[i] = 14E3;
403 
404  EEmZActiveRing[i] = 0;
405  EEmZNActiveCells[i] = 0;
406  EEmZSET_EtaRing[i] = 0.0;
407  EEmZMaxEnergy_EtaRing[i] = -999;
408  EEmZMinEnergy_EtaRing[i] = 14E3;
409  }
410 
411  edm::LogInfo("OutputInfo") << "Looping over EE" << std::endl;
413  //int nEErechit = 0;
414  for (eerechit = EERecHits->begin(); eerechit != EERecHits->end(); eerechit++) {
415  EEDetId det = eerechit->id();
416  double Energy = eerechit->energy();
417  Int_t ix = det.ix();
418  Int_t iy = det.iy();
419  //Float_t ix_ = (Float_t)-999;
420  //Float_t iy_ = (Float_t)-999;
421  Int_t ir = -999;
422  // edm::LogInfo("OutputInfo") << ix << " " << iy << " " << ix_ << " " << iy_ << " " << ir << std::endl;
423 
424  double x = -999;
425  double y = -999;
426  double z = -999;
427  double theta = -999;
428  double phi = -999;
429 
430  int Crystal_zside = det.zside();
431 
432  if (Crystal_zside == -1) {
433  ir = (Int_t)hEEmZ_ix_iy_irMap->getBinContent(ix, iy);
437  }
438  if (Crystal_zside == 1) {
439  ir = (Int_t)hEEpZ_ix_iy_irMap->getBinContent(ix, iy);
443  }
444  TVector3 pos_vector(x, y, z);
445  phi = pos_vector.Phi();
446  theta = pos_vector.Theta();
447  double ET = Energy * TMath::Sin(theta);
448  TLorentzVector v_;
449 
450  if (Crystal_zside == -1) {
451  if (Energy > 0) {
452  EEmZActiveRing[ir] = 1;
453  EEmZNActiveCells[ir]++;
454  EEmZSET_EtaRing[ir] += ET;
455  v_.SetPtEtaPhiE(ET, 0, phi, ET);
456  vEEmZMET_EtaRing[ir] -= v_;
458  }
461 
462  if (Energy > EEmZMaxEnergy_EtaRing[ir])
463  EEmZMaxEnergy_EtaRing[ir] = Energy;
464  if (Energy < EEmZMinEnergy_EtaRing[ir])
465  EEmZMinEnergy_EtaRing[ir] = Energy;
466 
469  if (Energy < hEEmZ_Minenergy_ix_iy->getBinContent(ix, iy))
471  }
472  if (Crystal_zside == 1) {
473  if (Energy > 0) {
474  EEpZActiveRing[ir] = 1;
475  EEpZNActiveCells[ir]++;
476  EEpZSET_EtaRing[ir] += ET;
477  v_.SetPtEtaPhiE(ET, 0, phi, ET);
478  vEEpZMET_EtaRing[ir] -= v_;
480  }
483 
484  if (Energy > EEpZMaxEnergy_EtaRing[ir])
485  EEpZMaxEnergy_EtaRing[ir] = Energy;
486  if (Energy < EEpZMinEnergy_EtaRing[ir])
487  EEpZMinEnergy_EtaRing[ir] = Energy;
490  if (Energy < hEEpZ_Minenergy_ix_iy->getBinContent(ix, iy))
492  }
493  } // loop over EE
494  edm::LogInfo("OutputInfo") << "Done Looping over EE" << std::endl;
495  for (int iEtaRing = 0; iEtaRing < 101; iEtaRing++) {
496  hEEpZ_Maxenergyvsir->Fill(iEtaRing, EEpZMaxEnergy_EtaRing[iEtaRing]);
497  hEEpZ_Minenergyvsir->Fill(iEtaRing, EEpZMinEnergy_EtaRing[iEtaRing]);
498  hEEmZ_Maxenergyvsir->Fill(iEtaRing, EEmZMaxEnergy_EtaRing[iEtaRing]);
499  hEEmZ_Minenergyvsir->Fill(iEtaRing, EEmZMinEnergy_EtaRing[iEtaRing]);
500 
501  if (EEpZActiveRing[iEtaRing]) {
502  hEEpZ_METvsir->Fill(iEtaRing, vEEpZMET_EtaRing[iEtaRing].Pt());
503  hEEpZ_METPhivsir->Fill(iEtaRing, vEEpZMET_EtaRing[iEtaRing].Phi());
504  hEEpZ_MExvsir->Fill(iEtaRing, vEEpZMET_EtaRing[iEtaRing].Px());
505  hEEpZ_MEyvsir->Fill(iEtaRing, vEEpZMET_EtaRing[iEtaRing].Py());
506  hEEpZ_SETvsir->Fill(iEtaRing, EEpZSET_EtaRing[iEtaRing]);
507  hEEpZ_Occvsir->Fill(iEtaRing, EEpZNActiveCells[iEtaRing]);
508  }
509 
510  if (EEmZActiveRing[iEtaRing]) {
511  hEEmZ_METvsir->Fill(iEtaRing, vEEmZMET_EtaRing[iEtaRing].Pt());
512  hEEmZ_METPhivsir->Fill(iEtaRing, vEEmZMET_EtaRing[iEtaRing].Phi());
513  hEEmZ_MExvsir->Fill(iEtaRing, vEEmZMET_EtaRing[iEtaRing].Px());
514  hEEmZ_MEyvsir->Fill(iEtaRing, vEEmZMET_EtaRing[iEtaRing].Py());
515  hEEmZ_SETvsir->Fill(iEtaRing, EEmZSET_EtaRing[iEtaRing]);
516  hEEmZ_Occvsir->Fill(iEtaRing, EEmZNActiveCells[iEtaRing]);
517  }
518  }
519  edm::LogInfo("OutputInfo") << "Done ..." << std::endl;
520 } // loop over RecHits
#define DEBUG(X)
MonitorElement * hEB_Maxenergyvsieta
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
MonitorElement * hEB_MExvsieta
MonitorElement * hEEmZ_ix_iy_dxMap
MonitorElement * hEEmZ_Occvsir
MonitorElement * hEEpZ_METPhivsir
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
MonitorElement * hEEmZ_METvsir
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
MonitorElement * hEEpZ_METvsir
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
MonitorElement * hEB_Maxenergy_ieta_iphi
MonitorElement * hEB_METvsieta
MonitorElement * hEEpZ_ix_iy_irMap
MonitorElement * hEB_Occvsieta
int ix() const
Definition: EEDetId.h:77
std::vector< EcalRecHit >::const_iterator const_iterator
MonitorElement * hEB_energyvsieta
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * hEEpZ_ix_iy_zMap
MonitorElement * hEEpZ_Maxenergy_ix_iy
MonitorElement * hEB_METPhivsieta
MonitorElement * hEEmZ_Minenergyvsir
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
T getUntrackedParameter(std::string const &, T const &) const
void Fill(long long x)
int iEvent
Definition: GenABIO.cc:224
MonitorElement * hEEmZ_energy_ix_iy
MonitorElement * hEEmZ_energyvsir
MonitorElement * hEEmZ_ix_iy_dyMap
MonitorElement * hEEmZ_Occ_ix_iy
MonitorElement * hECAL_Nevents
MonitorElement * hEB_ieta_dphiMap
T sqrt(T t)
Definition: SSEVec.h:23
MonitorElement * hEEmZ_Maxenergyvsir
MonitorElement * hEEmZ_SETvsir
const CaloGeometry * caloGeom_
MonitorElement * hEB_Occ_ieta_iphi
MonitorElement * hEEpZ_Minenergyvsir
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_
MonitorElement * hEEpZ_Minenergy_ix_iy
MonitorElement * hEB_Minenergy_ieta_iphi
MonitorElement * hEEmZ_METPhivsir
MonitorElement * hEEmZ_MEyvsir
MonitorElement * hEEpZ_energyvsir
void FillGeometry(const edm::EventSetup &)
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 * hEEpZ_ix_iy_dyMap
MonitorElement * hEB_ieta_detaMap
MonitorElement * hEEmZ_Minenergy_ix_iy
MonitorElement * hEB_energy_ieta_iphi
MonitorElement * hEB_MEyvsieta
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.
#define M_PI
MonitorElement * hEB_Minenergyvsieta
ECALRecHitAnalyzer(const edm::ParameterSet &)
Log< level::Info, false > LogInfo
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
MonitorElement * hEEpZ_ix_iy_yMap
MonitorElement * hEEmZ_ix_iy_zMap
MonitorElement * hEEmZ_Maxenergy_ix_iy
int zside() const
Definition: EEDetId.h:71
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
virtual void dqmbeginRun(const edm::Run &, const edm::EventSetup &)
MonitorElement * hEB_ieta_iphi_etaMap
MonitorElement * hEEpZ_SETvsir
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:221
MonitorElement * hEEpZ_Maxenergyvsir
HLT enums.
MonitorElement * hEEmZ_MExvsir
MonitorElement * hEEmZ_ix_iy_yMap
MonitorElement * hEEmZ_ix_iy_xMap
MonitorElement * hEEpZ_MEyvsir
void WriteECALRecHits(const edm::Event &, const edm::EventSetup &)
MonitorElement * hEB_SETvsieta
MonitorElement * hEEpZ_MExvsir
MonitorElement * hEEpZ_Occvsir
MonitorElement * hEEpZ_energy_ix_iy
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
MonitorElement * hEEpZ_Occ_ix_iy
#define ET
MonitorElement * hEEmZ_ix_iy_irMap
edm::EDGetTokenT< EERecHitCollection > EERecHitsLabel_
MonitorElement * hEB_ieta_iphi_phiMap
MonitorElement * hEEpZ_ix_iy_xMap
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
Geom::Theta< T > theta() const
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
edm::EDGetTokenT< EBRecHitCollection > EBRecHitsLabel_
Definition: Run.h:45
int iy() const
Definition: EEDetId.h:83
void analyze(const edm::Event &, const edm::EventSetup &) override
virtual double getBinContent(int binx) const
get content of bin (1-D)
MonitorElement * hEEpZ_ix_iy_dxMap