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 currentLowEdge_eta = 0;
271  //double currentHighEdge_eta = 0;
272  for (int ieta = 1; ieta <= 85; ieta++) {
273  int ieta_ = 86 + ieta;
274 
275  double eta = hEB_ieta_iphi_etaMap->getBinContent(ieta_, 1);
276  double etam1 = -999;
277 
278  if (ieta == 1)
279  etam1 = hEB_ieta_iphi_etaMap->getBinContent(85, 1);
280  else
281  etam1 = hEB_ieta_iphi_etaMap->getBinContent(ieta_ - 1, 1);
282 
283  //double phi = hEB_ieta_iphi_phiMap->getBinContent(ieta_, 1);
284  double deta = fabs(eta - etam1);
285  double dphi = fabs(hEB_ieta_iphi_phiMap->getBinContent(ieta_, 1) - hEB_ieta_iphi_phiMap->getBinContent(ieta_, 2));
286 
287  currentLowEdge_eta += deta;
288  hEB_ieta_detaMap->setBinContent(ieta_, deta); // positive rings
289  hEB_ieta_dphiMap->setBinContent(ieta_, dphi); // positive rings
290  hEB_ieta_detaMap->setBinContent(86 - ieta, deta); // negative rings
291  hEB_ieta_dphiMap->setBinContent(86 - ieta, dphi); // negative rings
292  }
293 }
294 
296  CurrentEvent++;
297  DEBUG("Event: " << CurrentEvent);
298  WriteECALRecHits(iEvent, iSetup);
299  hECAL_Nevents->Fill(0.5);
300 }
301 
305  iEvent.getByToken(EBRecHitsLabel_, EBRecHits);
306  iEvent.getByToken(EERecHitsLabel_, EERecHits);
307  DEBUG("Got ECALRecHits");
308 
309  //const CaloSubdetectorGeometry* EBgeom=cG.getSubdetectorGeometry(DetId::Ecal,1);
310  //const CaloSubdetectorGeometry* EEgeom=cG.getSubdetectorGeometry(DetId::Ecal,2);
311  DEBUG("Got Geometry");
312 
313  TLorentzVector vEBMET_EtaRing[171];
314  int EBActiveRing[171];
315  int EBNActiveCells[171];
316  double EBSET_EtaRing[171];
317  double EBMaxEnergy_EtaRing[171];
318  double EBMinEnergy_EtaRing[171];
319  double EBenergy_EtaRing[171];
320 
321  for (int i = 0; i < 171; i++) {
322  EBActiveRing[i] = 0;
323  EBNActiveCells[i] = 0;
324  EBSET_EtaRing[i] = 0.0;
325  EBMaxEnergy_EtaRing[i] = -999;
326  EBMinEnergy_EtaRing[i] = 14E3;
327  EBenergy_EtaRing[i] = 0.0;
328  }
329 
330  edm::LogInfo("OutputInfo") << "Looping over EB" << std::endl;
331 
333  //int nEBrechit = 0;
334 
335  for (ebrechit = EBRecHits->begin(); ebrechit != EBRecHits->end(); ebrechit++) {
336  EBDetId det = ebrechit->id();
337  double Energy = ebrechit->energy();
338  Int_t ieta = det.ieta();
339  Int_t iphi = det.iphi();
340  int EtaRing = 85 + ieta; // this counts from 0
341  double eta = hEB_ieta_iphi_etaMap->getBinContent(EtaRing + 1, iphi);
342  double phi = hEB_ieta_iphi_phiMap->getBinContent(EtaRing + 1, iphi);
343  double theta = 2 * TMath::ATan(exp(-1 * eta));
344  double ET = Energy * TMath::Sin(theta);
345  TLorentzVector v_;
346 
347  if (Energy > EBMaxEnergy_EtaRing[EtaRing])
348  EBMaxEnergy_EtaRing[EtaRing] = Energy;
349  if (Energy < EBMinEnergy_EtaRing[EtaRing])
350  EBMinEnergy_EtaRing[EtaRing] = Energy;
351 
352  if (Energy > 0) {
353  EBActiveRing[EtaRing] = 1;
354  EBNActiveCells[EtaRing]++;
355  EBSET_EtaRing[EtaRing] += ET;
356  v_.SetPtEtaPhiE(ET, 0, phi, ET);
357  vEBMET_EtaRing[EtaRing] -= v_;
358  EBenergy_EtaRing[EtaRing] += Energy;
360  }
361 
363  if (Energy > hEB_Maxenergy_ieta_iphi->getBinContent(EtaRing + 1, iphi))
365  if (Energy < hEB_Minenergy_ieta_iphi->getBinContent(EtaRing + 1, iphi))
367 
368  } // loop over EB
369 
370  for (int iEtaRing = 0; iEtaRing < 171; iEtaRing++) {
371  hEB_Minenergyvsieta->Fill(iEtaRing - 85, EBMinEnergy_EtaRing[iEtaRing]);
372  hEB_Maxenergyvsieta->Fill(iEtaRing - 85, EBMaxEnergy_EtaRing[iEtaRing]);
373 
374  if (EBActiveRing[iEtaRing]) {
375  hEB_METvsieta->Fill(iEtaRing - 85, vEBMET_EtaRing[iEtaRing].Pt());
376  hEB_METPhivsieta->Fill(iEtaRing - 85, vEBMET_EtaRing[iEtaRing].Phi());
377  hEB_MExvsieta->Fill(iEtaRing - 85, vEBMET_EtaRing[iEtaRing].Px());
378  hEB_MEyvsieta->Fill(iEtaRing - 85, vEBMET_EtaRing[iEtaRing].Py());
379  hEB_SETvsieta->Fill(iEtaRing - 85, EBSET_EtaRing[iEtaRing]);
380  hEB_Occvsieta->Fill(iEtaRing - 85, EBNActiveCells[iEtaRing]);
381  hEB_energyvsieta->Fill(iEtaRing - 85, EBenergy_EtaRing[iEtaRing]);
382  }
383  }
384 
385  TLorentzVector vEEpZMET_EtaRing[101];
386  int EEpZActiveRing[101];
387  int EEpZNActiveCells[101];
388  double EEpZSET_EtaRing[101];
389  double EEpZMaxEnergy_EtaRing[101];
390  double EEpZMinEnergy_EtaRing[101];
391 
392  TLorentzVector vEEmZMET_EtaRing[101];
393  int EEmZActiveRing[101];
394  int EEmZNActiveCells[101];
395  double EEmZSET_EtaRing[101];
396  double EEmZMaxEnergy_EtaRing[101];
397  double EEmZMinEnergy_EtaRing[101];
398 
399  for (int i = 0; i < 101; i++) {
400  EEpZActiveRing[i] = 0;
401  EEpZNActiveCells[i] = 0;
402  EEpZSET_EtaRing[i] = 0.0;
403  EEpZMaxEnergy_EtaRing[i] = -999;
404  EEpZMinEnergy_EtaRing[i] = 14E3;
405 
406  EEmZActiveRing[i] = 0;
407  EEmZNActiveCells[i] = 0;
408  EEmZSET_EtaRing[i] = 0.0;
409  EEmZMaxEnergy_EtaRing[i] = -999;
410  EEmZMinEnergy_EtaRing[i] = 14E3;
411  }
412 
413  edm::LogInfo("OutputInfo") << "Looping over EE" << std::endl;
415  //int nEErechit = 0;
416  for (eerechit = EERecHits->begin(); eerechit != EERecHits->end(); eerechit++) {
417  EEDetId det = eerechit->id();
418  double Energy = eerechit->energy();
419  Int_t ix = det.ix();
420  Int_t iy = det.iy();
421  //Float_t ix_ = (Float_t)-999;
422  //Float_t iy_ = (Float_t)-999;
423  Int_t ir = -999;
424  // edm::LogInfo("OutputInfo") << ix << " " << iy << " " << ix_ << " " << iy_ << " " << ir << std::endl;
425 
426  double x = -999;
427  double y = -999;
428  double z = -999;
429  double theta = -999;
430  double phi = -999;
431 
432  int Crystal_zside = det.zside();
433 
434  if (Crystal_zside == -1) {
435  ir = (Int_t)hEEmZ_ix_iy_irMap->getBinContent(ix, iy);
436  x = hEEmZ_ix_iy_xMap->getBinContent(ix, iy);
437  y = hEEmZ_ix_iy_yMap->getBinContent(ix, iy);
438  z = hEEmZ_ix_iy_zMap->getBinContent(ix, iy);
439  }
440  if (Crystal_zside == 1) {
441  ir = (Int_t)hEEpZ_ix_iy_irMap->getBinContent(ix, iy);
442  x = hEEpZ_ix_iy_xMap->getBinContent(ix, iy);
443  y = hEEpZ_ix_iy_yMap->getBinContent(ix, iy);
444  z = hEEpZ_ix_iy_zMap->getBinContent(ix, iy);
445  }
446  TVector3 pos_vector(x, y, z);
447  phi = pos_vector.Phi();
448  theta = pos_vector.Theta();
449  double ET = Energy * TMath::Sin(theta);
450  TLorentzVector v_;
451 
452  if (Crystal_zside == -1) {
453  if (Energy > 0) {
454  EEmZActiveRing[ir] = 1;
455  EEmZNActiveCells[ir]++;
456  EEmZSET_EtaRing[ir] += ET;
457  v_.SetPtEtaPhiE(ET, 0, phi, ET);
458  vEEmZMET_EtaRing[ir] -= v_;
459  hEEmZ_Occ_ix_iy->Fill(ix, iy);
460  }
462  hEEmZ_energy_ix_iy->Fill(ix, iy, Energy);
463 
464  if (Energy > EEmZMaxEnergy_EtaRing[ir])
465  EEmZMaxEnergy_EtaRing[ir] = Energy;
466  if (Energy < EEmZMinEnergy_EtaRing[ir])
467  EEmZMinEnergy_EtaRing[ir] = Energy;
468 
471  if (Energy < hEEmZ_Minenergy_ix_iy->getBinContent(ix, iy))
473  }
474  if (Crystal_zside == 1) {
475  if (Energy > 0) {
476  EEpZActiveRing[ir] = 1;
477  EEpZNActiveCells[ir]++;
478  EEpZSET_EtaRing[ir] += ET;
479  v_.SetPtEtaPhiE(ET, 0, phi, ET);
480  vEEpZMET_EtaRing[ir] -= v_;
481  hEEpZ_Occ_ix_iy->Fill(ix, iy);
482  }
484  hEEpZ_energy_ix_iy->Fill(ix, iy, Energy);
485 
486  if (Energy > EEpZMaxEnergy_EtaRing[ir])
487  EEpZMaxEnergy_EtaRing[ir] = Energy;
488  if (Energy < EEpZMinEnergy_EtaRing[ir])
489  EEpZMinEnergy_EtaRing[ir] = Energy;
492  if (Energy < hEEpZ_Minenergy_ix_iy->getBinContent(ix, iy))
494  }
495  } // loop over EE
496  edm::LogInfo("OutputInfo") << "Done Looping over EE" << std::endl;
497  for (int iEtaRing = 0; iEtaRing < 101; iEtaRing++) {
498  hEEpZ_Maxenergyvsir->Fill(iEtaRing, EEpZMaxEnergy_EtaRing[iEtaRing]);
499  hEEpZ_Minenergyvsir->Fill(iEtaRing, EEpZMinEnergy_EtaRing[iEtaRing]);
500  hEEmZ_Maxenergyvsir->Fill(iEtaRing, EEmZMaxEnergy_EtaRing[iEtaRing]);
501  hEEmZ_Minenergyvsir->Fill(iEtaRing, EEmZMinEnergy_EtaRing[iEtaRing]);
502 
503  if (EEpZActiveRing[iEtaRing]) {
504  hEEpZ_METvsir->Fill(iEtaRing, vEEpZMET_EtaRing[iEtaRing].Pt());
505  hEEpZ_METPhivsir->Fill(iEtaRing, vEEpZMET_EtaRing[iEtaRing].Phi());
506  hEEpZ_MExvsir->Fill(iEtaRing, vEEpZMET_EtaRing[iEtaRing].Px());
507  hEEpZ_MEyvsir->Fill(iEtaRing, vEEpZMET_EtaRing[iEtaRing].Py());
508  hEEpZ_SETvsir->Fill(iEtaRing, EEpZSET_EtaRing[iEtaRing]);
509  hEEpZ_Occvsir->Fill(iEtaRing, EEpZNActiveCells[iEtaRing]);
510  }
511 
512  if (EEmZActiveRing[iEtaRing]) {
513  hEEmZ_METvsir->Fill(iEtaRing, vEEmZMET_EtaRing[iEtaRing].Pt());
514  hEEmZ_METPhivsir->Fill(iEtaRing, vEEmZMET_EtaRing[iEtaRing].Phi());
515  hEEmZ_MExvsir->Fill(iEtaRing, vEEmZMET_EtaRing[iEtaRing].Px());
516  hEEmZ_MEyvsir->Fill(iEtaRing, vEEmZMET_EtaRing[iEtaRing].Py());
517  hEEmZ_SETvsir->Fill(iEtaRing, EEmZSET_EtaRing[iEtaRing]);
518  hEEmZ_Occvsir->Fill(iEtaRing, EEmZNActiveCells[iEtaRing]);
519  }
520  }
521  edm::LogInfo("OutputInfo") << "Done ..." << std::endl;
522 } // loop over RecHits
#define DEBUG(X)
MonitorElement * hEB_Maxenergyvsieta
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MonitorElement * hEB_MExvsieta
MonitorElement * hEEmZ_ix_iy_dxMap
MonitorElement * hEEmZ_Occvsir
MonitorElement * hEEpZ_METPhivsir
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:19
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
bool getData(T &iHolder) const
Definition: EventSetup.h:122
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
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:212
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
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