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