CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EEOccupancyTask.cc
Go to the documentation of this file.
1 /*
2  * \file EEOccupancyTask.cc
3  *
4  * $Date: 2012/04/27 13:46:15 $
5  * $Revision: 1.94 $
6  * \author G. Della Ricca
7  * \author G. Franzoni
8  *
9 */
10 
11 #include <iostream>
12 #include <fstream>
13 #include <vector>
14 
18 
20 
22 
30 
33 
35 
37 
39 
40  init_ = false;
41 
42  initCaloGeometry_ = false;
43 
45 
46  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
47 
48  subfolder_ = ps.getUntrackedParameter<std::string>("subfolder", "");
49 
50  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
51 
52  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
53 
54  EcalRawDataCollection_ = ps.getParameter<edm::InputTag>("EcalRawDataCollection");
55  EEDigiCollection_ = ps.getParameter<edm::InputTag>("EEDigiCollection");
56  EcalPnDiodeDigiCollection_ = ps.getParameter<edm::InputTag>("EcalPnDiodeDigiCollection");
57  EcalRecHitCollection_ = ps.getParameter<edm::InputTag>("EcalRecHitCollection");
58  EcalTrigPrimDigiCollection_ = ps.getParameter<edm::InputTag>("EcalTrigPrimDigiCollection");
59 
60  for (int i = 0; i < 18; i++) {
61  meOccupancy_[i] = 0;
62  meOccupancyMem_[i] = 0;
63  meEERecHitEnergy_[i] = 0;
64  meSpectrum_[i] = 0;
65  }
66 
67  meEERecHitSpectrum_[0] = 0;
68  meEERecHitSpectrum_[1] = 0;
69 
70  meEEDigiOccupancy_[0] = 0;
73  meEEDigiOccupancy_[1] = 0;
76 
77  meEERecHitOccupancy_[0] = 0;
80  meEERecHitOccupancy_[1] = 0;
83 
90 
97 
104 
107 
110 
111  meEELedDigiOccupancy_[0] = 0;
112  meEELedDigiOccupancy_[1] = 0;
113 
116 
117  recHitEnergyMin_ = 0.500; // GeV
118  trigPrimEtMin_ = 4.; // 4 ADCs == 1 GeV
119 
120  for (int i = 0; i < EEDetId::kSizeForDenseIndexing; i++) {
121  geometryEE[i][0] = 0;
122  geometryEE[i][1] = 0;
123  }
124 
125 }
126 
128 
129 }
130 
132 
133  ievt_ = 0;
134 
135  if ( dqmStore_ ) {
136  dqmStore_->setCurrentFolder(prefixME_ + "/EEOccupancyTask");
137  if(subfolder_.size())
138  dqmStore_->setCurrentFolder(prefixME_ + "/EEOccupancyTask/" + subfolder_);
139  dqmStore_->rmdir(prefixME_ + "/EEOccupancyTask");
140  }
141 
142 }
143 
145 
146  Numbers::initGeometry(c, false);
147 
148  if( !initCaloGeometry_ ) {
150  initCaloGeometry_ = true;
151  }
152 
153  if ( ! mergeRuns_ ) this->reset();
154 
155 }
156 
158 
159 }
160 
162 
163  for (int i = 0; i < 18; i++) {
164  if ( meOccupancy_[i] ) meOccupancy_[i]->Reset();
165  if ( meOccupancyMem_[i] ) meOccupancyMem_[i]->Reset();
167  if ( meSpectrum_[i] ) meSpectrum_[i]->Reset();
168  }
169 
172 
179 
186 
193 
200 
207 
210 
213 
216 
219 
220 }
221 
223 
224  init_ = true;
225 
226  std::string name;
227 
228  if ( dqmStore_ ) {
229  dqmStore_->setCurrentFolder(prefixME_ + "/EEOccupancyTask");
230  if(subfolder_.size())
231  dqmStore_->setCurrentFolder(prefixME_ + "/EEOccupancyTask/" + subfolder_);
232 
233  for (int i = 0; i < 18; i++) {
234  name = "EEOT digi occupancy " + Numbers::sEE(i+1);
235  meOccupancy_[i] = dqmStore_->book2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50.);
236  meOccupancy_[i]->setAxisTitle("ix", 1);
237  if ( i+1 >= 1 && i+1 <= 9 ) meOccupancy_[i]->setAxisTitle("101-ix", 1);
238  meOccupancy_[i]->setAxisTitle("iy", 2);
239  dqmStore_->tag(meOccupancy_[i], i+1);
240 
241  name = "EEOT MEM digi occupancy " + Numbers::sEE(i+1);
242  meOccupancyMem_[i] = dqmStore_->book2D(name, name, 10, 0., 10., 5, 0., 5.);
243  meOccupancyMem_[i]->setAxisTitle("pseudo-strip", 1);
244  meOccupancyMem_[i]->setAxisTitle("channel", 2);
245  dqmStore_->tag(meOccupancyMem_[i], i+1);
246 
247  name = "EEOT rec hit energy " + Numbers::sEE(i+1);
248  meEERecHitEnergy_[i] = dqmStore_->bookProfile2D(name, name, 50, Numbers::ix0EE(i+1)+0., Numbers::ix0EE(i+1)+50., 50, Numbers::iy0EE(i+1)+0., Numbers::iy0EE(i+1)+50., 4096, 0., 4096., "s");
249  meEERecHitEnergy_[i]->setAxisTitle("ix", 1);
250  if ( i+1 >= 1 && i+1 <= 9 ) meEERecHitEnergy_[i]->setAxisTitle("101-ix", 1);
251  meEERecHitEnergy_[i]->setAxisTitle("iy", 2);
252  meEERecHitEnergy_[i]->setAxisTitle("energy (GeV)", 3);
253  dqmStore_->tag(meEERecHitEnergy_[i], i+1);
254 
255  name = "EEOT energy spectrum " + Numbers::sEE(i+1);
256  meSpectrum_[i] = dqmStore_->book1D(name, name, 100, 0., 1.5);
257  meSpectrum_[i]->setAxisTitle("energy (GeV)", 1);
258  dqmStore_->tag(meSpectrum_[i], i+1);
259  }
260 
261  name = "EEOT rec hit spectrum EE -";
262  meEERecHitSpectrum_[0] = dqmStore_->book1D(name, name, 100, 0., 10.);
263  meEERecHitSpectrum_[0]->setAxisTitle("energy (GeV)", 1);
264 
265  name = "EEOT rec hit spectrum EE +";
266  meEERecHitSpectrum_[1] = dqmStore_->book1D(name, name, 100, 0., 10.);
267  meEERecHitSpectrum_[1]->setAxisTitle("energy (GeV)", 1);
268 
269  name = "EEOT digi occupancy EE -";
270  meEEDigiOccupancy_[0] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
271  meEEDigiOccupancy_[0]->setAxisTitle("jx", 1);
272  meEEDigiOccupancy_[0]->setAxisTitle("jy", 2);
273  name = "EEOT digi occupancy EE - projection eta";
274  meEEDigiOccupancyProEta_[0] = dqmStore_->book1DD(name, name, 22, -3.0, -1.479);
276  meEEDigiOccupancyProEta_[0]->setAxisTitle("number of digis", 2);
277  name = "EEOT digi occupancy EE - projection phi";
278  meEEDigiOccupancyProPhi_[0] = dqmStore_->book1DD(name, name, 50, -M_PI, M_PI);
280  meEEDigiOccupancyProPhi_[0]->setAxisTitle("number of digis", 2);
281 
282  name = "EEOT digi occupancy EE +";
283  meEEDigiOccupancy_[1] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
284  meEEDigiOccupancy_[1]->setAxisTitle("jx", 1);
285  meEEDigiOccupancy_[1]->setAxisTitle("jy", 2);
286  name = "EEOT digi occupancy EE + projection eta";
287  meEEDigiOccupancyProEta_[1] = dqmStore_->book1DD(name, name, 22, 1.479, 3.0);
289  meEEDigiOccupancyProEta_[1]->setAxisTitle("number of digis", 2);
290  name = "EEOT digi occupancy EE + projection phi";
291  meEEDigiOccupancyProPhi_[1] = dqmStore_->book1DD(name, name, 50, -M_PI, M_PI);
293  meEEDigiOccupancyProPhi_[1]->setAxisTitle("number of digis", 2);
294 
295  name = "EEOT rec hit occupancy EE -";
296  meEERecHitOccupancy_[0] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
297  meEERecHitOccupancy_[0]->setAxisTitle("jx", 1);
298  meEERecHitOccupancy_[0]->setAxisTitle("jy", 2);
299  name = "EEOT rec hit occupancy EE - projection eta";
300  meEERecHitOccupancyProEta_[0] = dqmStore_->book1DD(name, name, 22, -3.0, -1.479);
302  meEERecHitOccupancyProEta_[0]->setAxisTitle("number of hits", 2);
303  name = "EEOT rec hit occupancy EE - projection phi";
304  meEERecHitOccupancyProPhi_[0] = dqmStore_->book1DD(name, name, 50, -M_PI, M_PI);
306  meEERecHitOccupancyProPhi_[0]->setAxisTitle("number of hits", 2);
307 
308  name = "EEOT rec hit occupancy EE +";
309  meEERecHitOccupancy_[1] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
310  meEERecHitOccupancy_[1]->setAxisTitle("jx", 1);
311  meEERecHitOccupancy_[1]->setAxisTitle("jy", 2);
312  name = "EEOT rec hit occupancy EE + projection eta";
313  meEERecHitOccupancyProEta_[1] = dqmStore_->book1DD(name, name, 22, 1.479, 3.0);
315  meEERecHitOccupancyProEta_[1]->setAxisTitle("number of hits", 2);
316  name = "EEOT rec hit occupancy EE + projection phi";
317  meEERecHitOccupancyProPhi_[1] = dqmStore_->book1DD(name, name, 50, -M_PI, M_PI);
319  meEERecHitOccupancyProPhi_[1]->setAxisTitle("number of hits", 2);
320 
321  name = "EEOT rec hit thr occupancy EE -";
322  meEERecHitOccupancyThr_[0] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
325  name = "EEOT rec hit thr occupancy EE - projection eta";
326  meEERecHitOccupancyProEtaThr_[0] = dqmStore_->book1DD(name, name, 22, -3.0, -1.479);
328  meEERecHitOccupancyProEtaThr_[0]->setAxisTitle("number of hits", 2);
329  name = "EEOT rec hit thr occupancy EE - projection phi";
330  meEERecHitOccupancyProPhiThr_[0] = dqmStore_->book1DD(name, name, 50, -M_PI, M_PI);
332  meEERecHitOccupancyProPhiThr_[0]->setAxisTitle("number of hits", 2);
333 
334  name = "EEOT rec hit thr occupancy EE +";
335  meEERecHitOccupancyThr_[1] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
338  name = "EEOT rec hit thr occupancy EE + projection eta";
339  meEERecHitOccupancyProEtaThr_[1] = dqmStore_->book1DD(name, name, 22, 1.479, 3.0);
341  meEERecHitOccupancyProEtaThr_[1]->setAxisTitle("number of hits", 2);
342  name = "EEOT rec hit thr occupancy EE + projection phi";
343  meEERecHitOccupancyProPhiThr_[1] = dqmStore_->book1DD(name, name, 50, -M_PI, M_PI);
345  meEERecHitOccupancyProPhiThr_[1]->setAxisTitle("number of hits", 2);
346 
347  name = "EEOT TP digi occupancy EE -";
348  meEETrigPrimDigiOccupancy_[0] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
351  name = "EEOT TP digi occupancy EE - projection eta";
352  meEETrigPrimDigiOccupancyProEta_[0] = dqmStore_->book1DD(name, name, 22, -3.0, -1.479);
354  meEETrigPrimDigiOccupancyProEta_[0]->setAxisTitle("number of TP digis", 2);
355  name = "EEOT TP digi occupancy EE - projection phi";
358  meEETrigPrimDigiOccupancyProPhi_[0]->setAxisTitle("number of TP digis", 2);
359 
360  name = "EEOT TP digi occupancy EE +";
361  meEETrigPrimDigiOccupancy_[1] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
364  name = "EEOT TP digi occupancy EE + projection eta";
365  meEETrigPrimDigiOccupancyProEta_[1] = dqmStore_->book1DD(name, name, 22, 1.479, 3.0);
367  meEETrigPrimDigiOccupancyProEta_[1]->setAxisTitle("number of TP digis", 2);
368  name = "EEOT TP digi occupancy EE + projection phi";
371  meEETrigPrimDigiOccupancyProPhi_[1]->setAxisTitle("number of TP digis", 2);
372 
373  name = "EEOT TP digi thr occupancy EE -";
374  meEETrigPrimDigiOccupancyThr_[0] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
377  name = "EEOT TP digi thr occupancy EE - projection eta";
378  meEETrigPrimDigiOccupancyProEtaThr_[0] = dqmStore_->book1DD(name, name, 22, -3.0, -1.479);
380  meEETrigPrimDigiOccupancyProEtaThr_[0]->setAxisTitle("number of TP digis", 2);
381  name = "EEOT TP digi thr occupancy EE - projection phi";
384  meEETrigPrimDigiOccupancyProPhiThr_[0]->setAxisTitle("number of TP digis", 2);
385 
386  name = "EEOT TP digi thr occupancy EE +";
387  meEETrigPrimDigiOccupancyThr_[1] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
390  name = "EEOT TP digi thr occupancy EE + projection eta";
391  meEETrigPrimDigiOccupancyProEtaThr_[1] = dqmStore_->book1DD(name, name, 22, 1.479, 3.0);
393  meEETrigPrimDigiOccupancyProEtaThr_[1]->setAxisTitle("number of TP digis", 2);
394  name = "EEOT TP digi thr occupancy EE + projection phi";
397  meEETrigPrimDigiOccupancyProPhiThr_[1]->setAxisTitle("number of TP digis", 2);
398 
399  name = "EEOT test pulse digi occupancy EE -";
400  meEETestPulseDigiOccupancy_[0] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
403 
404  name = "EEOT test pulse digi occupancy EE +";
405  meEETestPulseDigiOccupancy_[1] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
408 
409  name = "EEOT led digi occupancy EE -";
410  meEELedDigiOccupancy_[0] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
411  meEELedDigiOccupancy_[0]->setAxisTitle("jx", 1);
412  meEELedDigiOccupancy_[0]->setAxisTitle("jy", 2);
413 
414  name = "EEOT led digi occupancy EE +";
415  meEELedDigiOccupancy_[1] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
416  meEELedDigiOccupancy_[1]->setAxisTitle("jx", 1);
417  meEELedDigiOccupancy_[1]->setAxisTitle("jy", 2);
418 
419  name = "EEOT laser digi occupancy EE -";
420  meEELaserDigiOccupancy_[0] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
423 
424  name = "EEOT laser digi occupancy EE +";
425  meEELaserDigiOccupancy_[1] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
428 
429  name = "EEOT pedestal digi occupancy EE -";
430  meEEPedestalDigiOccupancy_[0] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
433 
434  name = "EEOT pedestal digi occupancy EE +";
435  meEEPedestalDigiOccupancy_[1] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
438 
439  }
440 
441 }
442 
444 
445  if ( ! init_ ) return;
446 
447  if ( dqmStore_ ) {
448  dqmStore_->setCurrentFolder(prefixME_ + "/EEOccupancyTask");
449  if(subfolder_.size())
450  dqmStore_->setCurrentFolder(prefixME_ + "/EEOccupancyTask/" + subfolder_);
451 
452  for (int i = 0; i < 18; i++) {
454  meOccupancy_[i] = 0;
456  meOccupancyMem_[i] = 0;
458  meEERecHitEnergy_[i] = 0;
460  meSpectrum_[i] = 0;
461  }
462 
464  meEERecHitSpectrum_[0] = 0;
466  meEERecHitSpectrum_[1] = 0;
467 
469  meEEDigiOccupancy_[0] = 0;
474 
476  meEEDigiOccupancy_[1] = 0;
481 
483  meEERecHitOccupancy_[0] = 0;
488 
490  meEERecHitOccupancy_[1] = 0;
495 
502 
509 
516 
523 
530 
537 
542 
547 
549  meEELedDigiOccupancy_[0] = 0;
551  meEELedDigiOccupancy_[1] = 0;
552 
557 
558  }
559 
560  init_ = false;
561 
562 }
563 
565 
566  edm::LogInfo("EEOccupancyTask") << "analyzed " << ievt_ << " events";
567 
568  if ( enableCleanup_ ) this->cleanup();
569 
570 }
571 
573 
574  if ( ! init_ ) this->setup();
575 
576  ievt_++;
577 
578  int runType[18] = { notdata };
579 
581 
582  if ( e.getByLabel(EcalRawDataCollection_, dcchs) ) {
583 
584  for ( EcalRawDataCollection::const_iterator dcchItr = dcchs->begin(); dcchItr != dcchs->end(); ++dcchItr ) {
585 
586  if ( Numbers::subDet( *dcchItr ) != EcalEndcap ) continue;
587 
588  int ism = Numbers::iSM( *dcchItr, EcalEndcap );
589 
590  int runtype = dcchItr->getRunType();
591 
592  if ( runtype == EcalDCCHeaderBlock::COSMIC ||
593  runtype == EcalDCCHeaderBlock::MTCC ||
597  runtype == EcalDCCHeaderBlock::PHYSICS_LOCAL ) runType[ism-1] = physics;
598  if ( runtype == EcalDCCHeaderBlock::TESTPULSE_MGPA ||
599  runtype == EcalDCCHeaderBlock::TESTPULSE_GAP ) runType[ism-1] = testpulse;
600  if ( runtype == EcalDCCHeaderBlock::LASER_STD ||
601  runtype == EcalDCCHeaderBlock::LASER_GAP ) runType[ism-1] = laser;
602  if ( runtype == EcalDCCHeaderBlock::LED_STD ||
603  runtype == EcalDCCHeaderBlock::LED_GAP ) runType[ism-1] = led;
604  if ( runtype == EcalDCCHeaderBlock::PEDESTAL_STD ||
605  runtype == EcalDCCHeaderBlock::PEDESTAL_GAP ) runType[ism-1] = pedestal;
606 
607  }
608 
609  } else {
610  edm::LogWarning("EEOccupancyTask") << EcalRawDataCollection_ << " not available";
611  }
612 
614 
615  if ( e.getByLabel(EEDigiCollection_, digis) ) {
616 
617  int need = digis->size();
618  LogDebug("EEOccupancyTask") << "event " << ievt_ << " digi collection size " << need;
619 
620  for ( EEDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr ) {
621 
622  EEDetId id = digiItr->id();
623 
624  int ix = id.ix();
625  int iy = id.iy();
626 
627  int hi = id.hashedIndex();
628 
629  if ( geometryEE[hi][0] == 0 ) {
630  const GlobalPoint& pos = pGeometry_->getGeometry(id)->getPosition();
631  geometryEE[hi][0] = pos.eta();
632  geometryEE[hi][1] = pos.phi();
633  }
634 
635  float eta = geometryEE[hi][0];
636  float phi = geometryEE[hi][1];
637 
638  int ism = Numbers::iSM( id );
639 
640  if ( ism >= 1 && ism <= 9 ) ix = 101 - ix;
641 
642  float xix = ix - 0.5;
643  float xiy = iy - 0.5;
644 
645  if ( xix <= 0. || xix >= 100. || xiy <= 0. || xiy >= 100. ) {
646  edm::LogWarning("EEOccupancyTask") << " det id = " << id;
647  edm::LogWarning("EEOccupancyTask") << " sm, ix, iw " << ism << " " << ix << " " << iy;
648  edm::LogWarning("EEOccupancyTask") << " xix, xiy " << xix << " " << xiy;
649  }
650 
651  if ( meOccupancy_[ism-1] ) meOccupancy_[ism-1]->Fill( xix, xiy );
652 
653  int eex = id.ix();
654  int eey = id.iy();
655 
656  float xeex = eex - 0.5;
657  float xeey = eey - 0.5;
658 
659  if ( runType[ism-1] == physics || runType[ism-1] == notdata ) {
660 
661  if ( ism >=1 && ism <= 9 ) {
662  if ( meEEDigiOccupancy_[0] ) meEEDigiOccupancy_[0]->Fill( xeex, xeey );
665  } else {
666  if ( meEEDigiOccupancy_[1] ) meEEDigiOccupancy_[1]->Fill( xeex, xeey );
669  }
670 
671  }
672 
673  if ( runType[ism-1] == testpulse ) {
674 
675  if ( ism >=1 && ism <= 9 ) {
677  } else {
679  }
680 
681  }
682 
683  if ( runType[ism-1] == laser ) {
684 
685  if ( ism >=1 && ism <= 9 ) {
686  if ( meEELaserDigiOccupancy_[0] ) meEELaserDigiOccupancy_[0]->Fill( xeex, xeey );
687  } else {
688  if ( meEELaserDigiOccupancy_[1] ) meEELaserDigiOccupancy_[1]->Fill( xeex, xeey );
689  }
690 
691  }
692 
693  if ( runType[ism-1] == led ) {
694 
695  if ( ism >=1 && ism <= 9 ) {
696  if ( meEELedDigiOccupancy_[0] ) meEELedDigiOccupancy_[0]->Fill( xeex, xeey );
697  } else {
698  if ( meEELedDigiOccupancy_[1] ) meEELedDigiOccupancy_[1]->Fill( xeex, xeey );
699  }
700 
701  }
702 
703  if ( runType[ism-1] == pedestal ) {
704 
705  if ( ism >=1 && ism <= 9 ) {
706  if ( meEEPedestalDigiOccupancy_[0] ) meEEPedestalDigiOccupancy_[0]->Fill( xeex, xeey );
707  } else {
708  if ( meEEPedestalDigiOccupancy_[1] ) meEEPedestalDigiOccupancy_[1]->Fill( xeex, xeey );
709  }
710 
711  }
712 
713  }
714 
715  } else {
716 
717  edm::LogWarning("EEOccupancyTask") << EEDigiCollection_ << " not available";
718 
719  }
720 
722 
723  if ( e.getByLabel(EcalPnDiodeDigiCollection_, PNs) ) {
724 
725  // filling mem occupancy only for the 5 channels belonging
726  // to a fully reconstructed PN's
727 
728  for ( EcalPnDiodeDigiCollection::const_iterator pnItr = PNs->begin(); pnItr != PNs->end(); ++pnItr ) {
729 
730  if ( Numbers::subDet( pnItr->id() ) != EcalEndcap ) continue;
731 
732  int ism = Numbers::iSM( pnItr->id() );
733 
734  float PnId = pnItr->id().iPnId();
735 
736  PnId = PnId - 0.5;
737  float st = 0.0;
738 
739  for (int chInStrip = 1; chInStrip <= 5; chInStrip++){
740  if ( meOccupancyMem_[ism-1] ) {
741  st = chInStrip - 0.5;
742  meOccupancyMem_[ism-1]->Fill(PnId, st);
743  }
744  }
745 
746  }
747 
748  } else {
749 
750  edm::LogWarning("EEOccupancyTask") << EcalPnDiodeDigiCollection_ << " not available";
751 
752  }
753 
755  c.get<EcalSeverityLevelAlgoRcd>().get(sevlv);
756 
758 
759  if ( e.getByLabel(EcalRecHitCollection_, rechits) ) {
760 
761  int nebrh = rechits->size();
762  LogDebug("EEOccupancyTask") << "event " << ievt_ << " rec hits collection size " << nebrh;
763 
764  for ( EcalRecHitCollection::const_iterator rechitItr = rechits->begin(); rechitItr != rechits->end(); ++rechitItr ) {
765 
766  EEDetId id = rechitItr->id();
767 
768  int eex = id.ix();
769  int eey = id.iy();
770 
771  int hi = id.hashedIndex();
772 
773  if ( geometryEE[hi][0] == 0 ) {
774  const GlobalPoint& pos = pGeometry_->getGeometry(id)->getPosition();
775  geometryEE[hi][0] = pos.eta();
776  geometryEE[hi][1] = pos.phi();
777  }
778 
779  float eta = geometryEE[hi][0];
780  float phi = geometryEE[hi][1];
781 
782  int ism = Numbers::iSM( id );
783 
784  // sector view (from electronics)
785  float xix = ( ism >= 1 && ism <= 9 ) ? 101 - eex - 0.5 : eex - 0.5;
786  float xiy = eey - 0.5;
787 
788  // physics view (from IP)
789  float xeex = eex - 0.5;
790  float xeey = eey - 0.5;
791 
792  if ( runType[ism-1] == physics || runType[ism-1] == notdata ) {
793 
794  if ( ism >= 1 && ism <= 9 ) {
795  if ( meEERecHitOccupancy_[0] ) meEERecHitOccupancy_[0]->Fill( xeex, xeey );
798  } else {
799  if ( meEERecHitOccupancy_[1] ) meEERecHitOccupancy_[1]->Fill( xeex, xeey );
802  }
803 
804  uint32_t flag = rechitItr->recoFlag();
805 
806  uint32_t sev = sevlv->severityLevel(id, *rechits);
807 
808  if ( rechitItr->energy() > recHitEnergyMin_ && flag == EcalRecHit::kGood && sev == EcalSeverityLevel::kGood ) {
809 
810  if ( ism >= 1 && ism <= 9 ) {
811  if ( meEERecHitOccupancyThr_[0] ) meEERecHitOccupancyThr_[0]->Fill( xeex, xeey );
814  } else {
815  if ( meEERecHitOccupancyThr_[1] ) meEERecHitOccupancyThr_[1]->Fill( xeex, xeey );
818  }
819 
820  }
821 
822  if ( flag == EcalRecHit::kGood && sev == EcalSeverityLevel::kGood ) {
823  if ( meEERecHitEnergy_[ism-1] ) meEERecHitEnergy_[ism-1]->Fill( xix, xiy, rechitItr->energy() );
824  if ( meSpectrum_[ism-1] ) meSpectrum_[ism-1]->Fill( rechitItr->energy() );
825  if ( ism >= 1 && ism <= 9 ) meEERecHitSpectrum_[0]->Fill( rechitItr->energy() );
826  else meEERecHitSpectrum_[1]->Fill( rechitItr->energy() );
827  }
828 
829  }
830  }
831 
832  } else {
833 
834  edm::LogWarning("EEOccupancyTask") << EcalRecHitCollection_ << " not available";
835 
836  }
837 
839 
840  if ( e.getByLabel(EcalTrigPrimDigiCollection_, trigPrimDigis) ) {
841 
842  int nebtpg = trigPrimDigis->size();
843  LogDebug("EEOccupancyTask") << "event " << ievt_ << " trigger primitives digis collection size " << nebtpg;
844 
845  for ( EcalTrigPrimDigiCollection::const_iterator tpdigiItr = trigPrimDigis->begin(); tpdigiItr != trigPrimDigis->end(); ++tpdigiItr ) {
846 
847  if ( Numbers::subDet( tpdigiItr->id() ) != EcalEndcap ) continue;
848 
849  int ism = Numbers::iSM( tpdigiItr->id() );
850 
851  std::vector<DetId>* crystals = Numbers::crystals( tpdigiItr->id() );
852 
853  for ( unsigned int i=0; i<crystals->size(); i++ ) {
854 
855  EEDetId id = (*crystals)[i];
856 
857  int eex = id.ix();
858  int eey = id.iy();
859 
860  int hi = id.hashedIndex();
861 
862  if ( geometryEE[hi][0] == 0 ) {
863  const GlobalPoint& pos = pGeometry_->getGeometry(id)->getPosition();
864  geometryEE[hi][0] = pos.eta();
865  geometryEE[hi][1] = pos.phi();
866  }
867 
868  float eta = geometryEE[hi][0];
869  float phi = geometryEE[hi][1];
870 
871  float xeex = eex - 0.5;
872  float xeey = eey - 0.5;
873 
874  if ( runType[ism-1] == physics || runType[ism-1] == notdata ) {
875 
876  if ( ism >= 1 && ism <= 9 ) {
877  if ( meEETrigPrimDigiOccupancy_[0] ) meEETrigPrimDigiOccupancy_[0]->Fill( xeex, xeey );
880  } else {
881  if ( meEETrigPrimDigiOccupancy_[1] ) meEETrigPrimDigiOccupancy_[1]->Fill( xeex, xeey );
884  }
885 
886  if ( tpdigiItr->compressedEt() > trigPrimEtMin_ ) {
887 
888  if ( ism >= 1 && ism <= 9 ) {
892  } else {
896  }
897 
898  }
899 
900  }
901  }
902  }
903 
904  } else {
905 
906  edm::LogWarning("EEOccupancyTask") << EcalTrigPrimDigiCollection_ << " not available";
907 
908  }
909 
910 }
911 
#define LogDebug(id)
MonitorElement * meEEPedestalDigiOccupancy_[2]
T getParameter(std::string const &) const
MonitorElement * meEETrigPrimDigiOccupancyProEtaThr_[2]
T getUntrackedParameter(std::string const &, T const &) const
static std::string sEE(const unsigned ism)
Definition: Numbers.cc:226
int i
Definition: DBlmapReader.cc:9
void beginJob(void)
BeginJob.
long int flag
Definition: mlp_lapack.h:47
MonitorElement * meEETestPulseDigiOccupancy_[2]
int ix() const
Definition: EEDetId.h:71
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
MonitorElement * meEERecHitEnergy_[18]
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2530
void setup(void)
Setup.
Some &quot;id&quot; conversions.
MonitorElement * meEETrigPrimDigiOccupancyProPhi_[2]
void beginRun(const edm::Run &r, const edm::EventSetup &c)
BeginRun.
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
std::vector< T >::const_iterator const_iterator
MonitorElement * meEELaserDigiOccupancy_[2]
MonitorElement * meEERecHitOccupancyProEtaThr_[2]
edm::InputTag EcalPnDiodeDigiCollection_
MonitorElement * meSpectrum_[18]
void endRun(const edm::Run &r, const edm::EventSetup &c)
EndRun.
MonitorElement * meEEDigiOccupancyProEta_[2]
static int ix0EE(const unsigned ism)
Definition: Numbers.cc:773
MonitorElement * book1DD(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1S histogram.
Definition: DQMStore.cc:749
edm::ESHandle< CaloGeometry > pGeometry_
T eta() const
MonitorElement * meEERecHitOccupancyProPhi_[2]
static int iy0EE(const unsigned ism)
Definition: Numbers.cc:812
virtual ~EEOccupancyTask()
Destructor.
float geometryEE[EEDetId::kSizeForDenseIndexing][2]
void Fill(long long x)
void endJob(void)
EndJob.
void tag(MonitorElement *me, unsigned int myTag)
Definition: DQMStore.cc:1354
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
MonitorElement * meOccupancyMem_[18]
MonitorElement * meEETrigPrimDigiOccupancyThr_[2]
edm::InputTag EcalTrigPrimDigiCollection_
static std::vector< DetId > * crystals(const EcalTrigTowerDetId &id)
Definition: Numbers.cc:585
edm::InputTag EcalRawDataCollection_
void removeElement(const std::string &name)
Definition: DQMStore.cc:2572
std::string getName(Reflex::Type &cc)
Definition: ClassFiller.cc:18
MonitorElement * meEERecHitOccupancyProPhiThr_[2]
MonitorElement * meEERecHitOccupancy_[2]
MonitorElement * meEEDigiOccupancy_[2]
MonitorElement * meEETrigPrimDigiOccupancy_[2]
EEOccupancyTask(const edm::ParameterSet &ps)
Constructor.
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
MonitorElement * meEERecHitOccupancyThr_[2]
MonitorElement * meEEDigiOccupancyProPhi_[2]
#define M_PI
Definition: BFit3D.cc:3
static void initGeometry(const edm::EventSetup &setup, bool verbose=false)
Definition: Numbers.cc:50
const T & get() const
Definition: EventSetup.h:55
void reset(void)
Reset.
DQMStore * dqmStore_
MonitorElement * meEELedDigiOccupancy_[2]
MonitorElement * meEETrigPrimDigiOccupancyProEta_[2]
edm::InputTag EcalRecHitCollection_
T eta() const
Definition: PV3DBase.h:75
MonitorElement * meOccupancy_[18]
static unsigned iSM(const unsigned ism, const EcalSubdetector subdet)
Definition: Numbers.cc:246
MonitorElement * meEERecHitOccupancyProEta_[2]
std::string prefixME_
std::string subfolder_
edm::InputTag EEDigiCollection_
static EcalSubdetector subDet(const EBDetId &id)
Definition: Numbers.cc:145
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:845
void cleanup(void)
Cleanup.
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:56
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void Reset(void)
reset ME (ie. contents, errors, etc)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
Definition: Run.h:33
MonitorElement * meEETrigPrimDigiOccupancyProPhiThr_[2]
MonitorElement * meEERecHitSpectrum_[2]
Definition: DDAxes.h:10
MonitorElement * bookProfile2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, int nchZ, double lowZ, double highZ, const char *option="s")
Definition: DQMStore.cc:1175