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  * \author G. Della Ricca
5  * \author G. Franzoni
6  *
7 */
8 
9 #include <iostream>
10 #include <fstream>
11 #include <vector>
12 
16 
18 
20 
25 
28 
30 
32 
34 
35  init_ = false;
36 
37  initCaloGeometry_ = false;
38 
40 
41  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
42 
43  subfolder_ = ps.getUntrackedParameter<std::string>("subfolder", "");
44 
45  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
46 
47  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
48 
49  EcalRawDataCollection_ = consumes<EcalRawDataCollection>(ps.getParameter<edm::InputTag>("EcalRawDataCollection"));
50  EEDigiCollection_ = consumes<EEDigiCollection>(ps.getParameter<edm::InputTag>("EEDigiCollection"));
51  EcalPnDiodeDigiCollection_ = consumes<EcalPnDiodeDigiCollection>(ps.getParameter<edm::InputTag>("EcalPnDiodeDigiCollection"));
52  EcalRecHitCollection_ = consumes<EcalRecHitCollection>(ps.getParameter<edm::InputTag>("EcalRecHitCollection"));
53  EcalTrigPrimDigiCollection_ = consumes<EcalTrigPrimDigiCollection>(ps.getParameter<edm::InputTag>("EcalTrigPrimDigiCollection"));
54 
55  for (int i = 0; i < 18; i++) {
56  meOccupancy_[i] = 0;
57  meOccupancyMem_[i] = 0;
58  meEERecHitEnergy_[i] = 0;
59  meSpectrum_[i] = 0;
60  }
61 
62  meEERecHitSpectrum_[0] = 0;
63  meEERecHitSpectrum_[1] = 0;
64 
65  meEEDigiOccupancy_[0] = 0;
68  meEEDigiOccupancy_[1] = 0;
71 
72  meEERecHitOccupancy_[0] = 0;
75  meEERecHitOccupancy_[1] = 0;
78 
85 
92 
99 
102 
105 
106  meEELedDigiOccupancy_[0] = 0;
107  meEELedDigiOccupancy_[1] = 0;
108 
111 
112  recHitEnergyMin_ = 0.500; // GeV
113  trigPrimEtMin_ = 4.; // 4 ADCs == 1 GeV
114 
115  for (int i = 0; i < EEDetId::kSizeForDenseIndexing; i++) {
116  geometryEE[i][0] = 0;
117  geometryEE[i][1] = 0;
118  }
119 
120 }
121 
123 
124 }
125 
127 
128  ievt_ = 0;
129 
130  if ( dqmStore_ ) {
131  dqmStore_->setCurrentFolder(prefixME_ + "/EEOccupancyTask");
132  if(subfolder_.size())
133  dqmStore_->setCurrentFolder(prefixME_ + "/EEOccupancyTask/" + subfolder_);
134  dqmStore_->rmdir(prefixME_ + "/EEOccupancyTask");
135  }
136 
137 }
138 
140 
141  Numbers::initGeometry(c, false);
142 
143  if( !initCaloGeometry_ ) {
145  initCaloGeometry_ = true;
146  }
147 
148  if ( ! mergeRuns_ ) this->reset();
149 
150 }
151 
153 
154 }
155 
157 
158  for (int i = 0; i < 18; i++) {
159  if ( meOccupancy_[i] ) meOccupancy_[i]->Reset();
160  if ( meOccupancyMem_[i] ) meOccupancyMem_[i]->Reset();
162  if ( meSpectrum_[i] ) meSpectrum_[i]->Reset();
163  }
164 
167 
174 
181 
188 
195 
202 
205 
208 
211 
214 
215 }
216 
218 
219  init_ = true;
220 
222 
223  if ( dqmStore_ ) {
224  dqmStore_->setCurrentFolder(prefixME_ + "/EEOccupancyTask");
225  if(subfolder_.size())
226  dqmStore_->setCurrentFolder(prefixME_ + "/EEOccupancyTask/" + subfolder_);
227 
228  for (int i = 0; i < 18; i++) {
229  name = "EEOT digi occupancy " + Numbers::sEE(i+1);
230  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.);
231  meOccupancy_[i]->setAxisTitle("ix", 1);
232  if ( i+1 >= 1 && i+1 <= 9 ) meOccupancy_[i]->setAxisTitle("101-ix", 1);
233  meOccupancy_[i]->setAxisTitle("iy", 2);
234  dqmStore_->tag(meOccupancy_[i], i+1);
235 
236  name = "EEOT MEM digi occupancy " + Numbers::sEE(i+1);
237  meOccupancyMem_[i] = dqmStore_->book2D(name, name, 10, 0., 10., 5, 0., 5.);
238  meOccupancyMem_[i]->setAxisTitle("pseudo-strip", 1);
239  meOccupancyMem_[i]->setAxisTitle("channel", 2);
240  dqmStore_->tag(meOccupancyMem_[i], i+1);
241 
242  name = "EEOT rec hit energy " + Numbers::sEE(i+1);
243  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");
244  meEERecHitEnergy_[i]->setAxisTitle("ix", 1);
245  if ( i+1 >= 1 && i+1 <= 9 ) meEERecHitEnergy_[i]->setAxisTitle("101-ix", 1);
246  meEERecHitEnergy_[i]->setAxisTitle("iy", 2);
247  meEERecHitEnergy_[i]->setAxisTitle("energy (GeV)", 3);
248  dqmStore_->tag(meEERecHitEnergy_[i], i+1);
249 
250  name = "EEOT energy spectrum " + Numbers::sEE(i+1);
251  meSpectrum_[i] = dqmStore_->book1D(name, name, 100, 0., 1.5);
252  meSpectrum_[i]->setAxisTitle("energy (GeV)", 1);
253  dqmStore_->tag(meSpectrum_[i], i+1);
254  }
255 
256  name = "EEOT rec hit spectrum EE -";
257  meEERecHitSpectrum_[0] = dqmStore_->book1D(name, name, 100, 0., 10.);
258  meEERecHitSpectrum_[0]->setAxisTitle("energy (GeV)", 1);
259 
260  name = "EEOT rec hit spectrum EE +";
261  meEERecHitSpectrum_[1] = dqmStore_->book1D(name, name, 100, 0., 10.);
262  meEERecHitSpectrum_[1]->setAxisTitle("energy (GeV)", 1);
263 
264  name = "EEOT digi occupancy EE -";
265  meEEDigiOccupancy_[0] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
266  meEEDigiOccupancy_[0]->setAxisTitle("jx", 1);
267  meEEDigiOccupancy_[0]->setAxisTitle("jy", 2);
268  name = "EEOT digi occupancy EE - projection eta";
269  meEEDigiOccupancyProEta_[0] = dqmStore_->book1DD(name, name, 22, -3.0, -1.479);
271  meEEDigiOccupancyProEta_[0]->setAxisTitle("number of digis", 2);
272  name = "EEOT digi occupancy EE - projection phi";
273  meEEDigiOccupancyProPhi_[0] = dqmStore_->book1DD(name, name, 50, -M_PI, M_PI);
275  meEEDigiOccupancyProPhi_[0]->setAxisTitle("number of digis", 2);
276 
277  name = "EEOT digi occupancy EE +";
278  meEEDigiOccupancy_[1] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
279  meEEDigiOccupancy_[1]->setAxisTitle("jx", 1);
280  meEEDigiOccupancy_[1]->setAxisTitle("jy", 2);
281  name = "EEOT digi occupancy EE + projection eta";
282  meEEDigiOccupancyProEta_[1] = dqmStore_->book1DD(name, name, 22, 1.479, 3.0);
284  meEEDigiOccupancyProEta_[1]->setAxisTitle("number of digis", 2);
285  name = "EEOT digi occupancy EE + projection phi";
286  meEEDigiOccupancyProPhi_[1] = dqmStore_->book1DD(name, name, 50, -M_PI, M_PI);
288  meEEDigiOccupancyProPhi_[1]->setAxisTitle("number of digis", 2);
289 
290  name = "EEOT rec hit occupancy EE -";
291  meEERecHitOccupancy_[0] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
292  meEERecHitOccupancy_[0]->setAxisTitle("jx", 1);
293  meEERecHitOccupancy_[0]->setAxisTitle("jy", 2);
294  name = "EEOT rec hit occupancy EE - projection eta";
295  meEERecHitOccupancyProEta_[0] = dqmStore_->book1DD(name, name, 22, -3.0, -1.479);
297  meEERecHitOccupancyProEta_[0]->setAxisTitle("number of hits", 2);
298  name = "EEOT rec hit occupancy EE - projection phi";
299  meEERecHitOccupancyProPhi_[0] = dqmStore_->book1DD(name, name, 50, -M_PI, M_PI);
301  meEERecHitOccupancyProPhi_[0]->setAxisTitle("number of hits", 2);
302 
303  name = "EEOT rec hit occupancy EE +";
304  meEERecHitOccupancy_[1] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
305  meEERecHitOccupancy_[1]->setAxisTitle("jx", 1);
306  meEERecHitOccupancy_[1]->setAxisTitle("jy", 2);
307  name = "EEOT rec hit occupancy EE + projection eta";
308  meEERecHitOccupancyProEta_[1] = dqmStore_->book1DD(name, name, 22, 1.479, 3.0);
310  meEERecHitOccupancyProEta_[1]->setAxisTitle("number of hits", 2);
311  name = "EEOT rec hit occupancy EE + projection phi";
312  meEERecHitOccupancyProPhi_[1] = dqmStore_->book1DD(name, name, 50, -M_PI, M_PI);
314  meEERecHitOccupancyProPhi_[1]->setAxisTitle("number of hits", 2);
315 
316  name = "EEOT rec hit thr occupancy EE -";
317  meEERecHitOccupancyThr_[0] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
320  name = "EEOT rec hit thr occupancy EE - projection eta";
321  meEERecHitOccupancyProEtaThr_[0] = dqmStore_->book1DD(name, name, 22, -3.0, -1.479);
323  meEERecHitOccupancyProEtaThr_[0]->setAxisTitle("number of hits", 2);
324  name = "EEOT rec hit thr occupancy EE - projection phi";
325  meEERecHitOccupancyProPhiThr_[0] = dqmStore_->book1DD(name, name, 50, -M_PI, M_PI);
327  meEERecHitOccupancyProPhiThr_[0]->setAxisTitle("number of hits", 2);
328 
329  name = "EEOT rec hit thr occupancy EE +";
330  meEERecHitOccupancyThr_[1] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
333  name = "EEOT rec hit thr occupancy EE + projection eta";
334  meEERecHitOccupancyProEtaThr_[1] = dqmStore_->book1DD(name, name, 22, 1.479, 3.0);
336  meEERecHitOccupancyProEtaThr_[1]->setAxisTitle("number of hits", 2);
337  name = "EEOT rec hit thr occupancy EE + projection phi";
338  meEERecHitOccupancyProPhiThr_[1] = dqmStore_->book1DD(name, name, 50, -M_PI, M_PI);
340  meEERecHitOccupancyProPhiThr_[1]->setAxisTitle("number of hits", 2);
341 
342  name = "EEOT TP digi occupancy EE -";
343  meEETrigPrimDigiOccupancy_[0] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
346  name = "EEOT TP digi occupancy EE - projection eta";
347  meEETrigPrimDigiOccupancyProEta_[0] = dqmStore_->book1DD(name, name, 22, -3.0, -1.479);
349  meEETrigPrimDigiOccupancyProEta_[0]->setAxisTitle("number of TP digis", 2);
350  name = "EEOT TP digi occupancy EE - projection phi";
353  meEETrigPrimDigiOccupancyProPhi_[0]->setAxisTitle("number of TP digis", 2);
354 
355  name = "EEOT TP digi occupancy EE +";
356  meEETrigPrimDigiOccupancy_[1] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
359  name = "EEOT TP digi occupancy EE + projection eta";
360  meEETrigPrimDigiOccupancyProEta_[1] = dqmStore_->book1DD(name, name, 22, 1.479, 3.0);
362  meEETrigPrimDigiOccupancyProEta_[1]->setAxisTitle("number of TP digis", 2);
363  name = "EEOT TP digi occupancy EE + projection phi";
366  meEETrigPrimDigiOccupancyProPhi_[1]->setAxisTitle("number of TP digis", 2);
367 
368  name = "EEOT TP digi thr occupancy EE -";
369  meEETrigPrimDigiOccupancyThr_[0] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
372  name = "EEOT TP digi thr occupancy EE - projection eta";
373  meEETrigPrimDigiOccupancyProEtaThr_[0] = dqmStore_->book1DD(name, name, 22, -3.0, -1.479);
375  meEETrigPrimDigiOccupancyProEtaThr_[0]->setAxisTitle("number of TP digis", 2);
376  name = "EEOT TP digi thr occupancy EE - projection phi";
379  meEETrigPrimDigiOccupancyProPhiThr_[0]->setAxisTitle("number of TP digis", 2);
380 
381  name = "EEOT TP digi thr occupancy EE +";
382  meEETrigPrimDigiOccupancyThr_[1] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
385  name = "EEOT TP digi thr occupancy EE + projection eta";
386  meEETrigPrimDigiOccupancyProEtaThr_[1] = dqmStore_->book1DD(name, name, 22, 1.479, 3.0);
388  meEETrigPrimDigiOccupancyProEtaThr_[1]->setAxisTitle("number of TP digis", 2);
389  name = "EEOT TP digi thr occupancy EE + projection phi";
392  meEETrigPrimDigiOccupancyProPhiThr_[1]->setAxisTitle("number of TP digis", 2);
393 
394  name = "EEOT test pulse digi occupancy EE -";
395  meEETestPulseDigiOccupancy_[0] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
398 
399  name = "EEOT test pulse digi occupancy EE +";
400  meEETestPulseDigiOccupancy_[1] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
403 
404  name = "EEOT led digi occupancy EE -";
405  meEELedDigiOccupancy_[0] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
406  meEELedDigiOccupancy_[0]->setAxisTitle("jx", 1);
407  meEELedDigiOccupancy_[0]->setAxisTitle("jy", 2);
408 
409  name = "EEOT led digi occupancy EE +";
410  meEELedDigiOccupancy_[1] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
411  meEELedDigiOccupancy_[1]->setAxisTitle("jx", 1);
412  meEELedDigiOccupancy_[1]->setAxisTitle("jy", 2);
413 
414  name = "EEOT laser digi occupancy EE -";
415  meEELaserDigiOccupancy_[0] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
418 
419  name = "EEOT laser digi occupancy EE +";
420  meEELaserDigiOccupancy_[1] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
423 
424  name = "EEOT pedestal digi occupancy EE -";
425  meEEPedestalDigiOccupancy_[0] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
428 
429  name = "EEOT pedestal digi occupancy EE +";
430  meEEPedestalDigiOccupancy_[1] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
433 
434  }
435 
436 }
437 
439 
440  if ( ! init_ ) return;
441 
442  if ( dqmStore_ ) {
443  dqmStore_->setCurrentFolder(prefixME_ + "/EEOccupancyTask");
444  if(subfolder_.size())
445  dqmStore_->setCurrentFolder(prefixME_ + "/EEOccupancyTask/" + subfolder_);
446 
447  for (int i = 0; i < 18; i++) {
448  if ( meOccupancy_[i] ) dqmStore_->removeElement( meOccupancy_[i]->getName() );
449  meOccupancy_[i] = 0;
450  if ( meOccupancyMem_[i] ) dqmStore_->removeElement( meOccupancyMem_[i]->getName() );
451  meOccupancyMem_[i] = 0;
452  if ( meEERecHitEnergy_[i] ) dqmStore_->removeElement( meEERecHitEnergy_[i]->getName() );
453  meEERecHitEnergy_[i] = 0;
454  if ( meSpectrum_[i] ) dqmStore_->removeElement( meSpectrum_[i]->getName() );
455  meSpectrum_[i] = 0;
456  }
457 
459  meEERecHitSpectrum_[0] = 0;
461  meEERecHitSpectrum_[1] = 0;
462 
463  if ( meEEDigiOccupancy_[0] ) dqmStore_->removeElement( meEEDigiOccupancy_[0]->getName() );
464  meEEDigiOccupancy_[0] = 0;
469 
470  if ( meEEDigiOccupancy_[1] ) dqmStore_->removeElement( meEEDigiOccupancy_[1]->getName() );
471  meEEDigiOccupancy_[1] = 0;
476 
478  meEERecHitOccupancy_[0] = 0;
483 
485  meEERecHitOccupancy_[1] = 0;
490 
497 
504 
511 
518 
525 
532 
537 
542 
544  meEELedDigiOccupancy_[0] = 0;
546  meEELedDigiOccupancy_[1] = 0;
547 
552 
553  }
554 
555  init_ = false;
556 
557 }
558 
560 
561  edm::LogInfo("EEOccupancyTask") << "analyzed " << ievt_ << " events";
562 
563  if ( enableCleanup_ ) this->cleanup();
564 
565 }
566 
568 
569  if ( ! init_ ) this->setup();
570 
571  ievt_++;
572 
573  int runType[18] = { notdata };
574 
576 
577  if ( e.getByToken(EcalRawDataCollection_, dcchs) ) {
578 
579  for ( EcalRawDataCollection::const_iterator dcchItr = dcchs->begin(); dcchItr != dcchs->end(); ++dcchItr ) {
580 
581  if ( Numbers::subDet( *dcchItr ) != EcalEndcap ) continue;
582 
583  int ism = Numbers::iSM( *dcchItr, EcalEndcap );
584 
585  int runtype = dcchItr->getRunType();
586 
587  if ( runtype == EcalDCCHeaderBlock::COSMIC ||
588  runtype == EcalDCCHeaderBlock::MTCC ||
592  runtype == EcalDCCHeaderBlock::PHYSICS_LOCAL ) runType[ism-1] = physics;
593  if ( runtype == EcalDCCHeaderBlock::TESTPULSE_MGPA ||
594  runtype == EcalDCCHeaderBlock::TESTPULSE_GAP ) runType[ism-1] = testpulse;
595  if ( runtype == EcalDCCHeaderBlock::LASER_STD ||
596  runtype == EcalDCCHeaderBlock::LASER_GAP ) runType[ism-1] = laser;
597  if ( runtype == EcalDCCHeaderBlock::LED_STD ||
598  runtype == EcalDCCHeaderBlock::LED_GAP ) runType[ism-1] = led;
599  if ( runtype == EcalDCCHeaderBlock::PEDESTAL_STD ||
600  runtype == EcalDCCHeaderBlock::PEDESTAL_GAP ) runType[ism-1] = pedestal;
601 
602  }
603 
604  } else {
605  edm::LogWarning("EEOccupancyTask") << "EcalRawDataCollection not available";
606  }
607 
609 
610  if ( e.getByToken(EEDigiCollection_, digis) ) {
611 
612  int need = digis->size();
613  LogDebug("EEOccupancyTask") << "event " << ievt_ << " digi collection size " << need;
614 
615  for ( EEDigiCollection::const_iterator digiItr = digis->begin(); digiItr != digis->end(); ++digiItr ) {
616 
617  EEDetId id = digiItr->id();
618 
619  int ix = id.ix();
620  int iy = id.iy();
621 
622  int hi = id.hashedIndex();
623 
624  if ( geometryEE[hi][0] == 0 ) {
625  const GlobalPoint& pos = pGeometry_->getGeometry(id)->getPosition();
626  geometryEE[hi][0] = pos.eta();
627  geometryEE[hi][1] = pos.phi();
628  }
629 
630  float eta = geometryEE[hi][0];
631  float phi = geometryEE[hi][1];
632 
633  int ism = Numbers::iSM( id );
634 
635  if ( ism >= 1 && ism <= 9 ) ix = 101 - ix;
636 
637  float xix = ix - 0.5;
638  float xiy = iy - 0.5;
639 
640  if ( xix <= 0. || xix >= 100. || xiy <= 0. || xiy >= 100. ) {
641  edm::LogWarning("EEOccupancyTask") << " det id = " << id;
642  edm::LogWarning("EEOccupancyTask") << " sm, ix, iw " << ism << " " << ix << " " << iy;
643  edm::LogWarning("EEOccupancyTask") << " xix, xiy " << xix << " " << xiy;
644  }
645 
646  if ( meOccupancy_[ism-1] ) meOccupancy_[ism-1]->Fill( xix, xiy );
647 
648  int eex = id.ix();
649  int eey = id.iy();
650 
651  float xeex = eex - 0.5;
652  float xeey = eey - 0.5;
653 
654  if ( runType[ism-1] == physics || runType[ism-1] == notdata ) {
655 
656  if ( ism >=1 && ism <= 9 ) {
657  if ( meEEDigiOccupancy_[0] ) meEEDigiOccupancy_[0]->Fill( xeex, xeey );
660  } else {
661  if ( meEEDigiOccupancy_[1] ) meEEDigiOccupancy_[1]->Fill( xeex, xeey );
664  }
665 
666  }
667 
668  if ( runType[ism-1] == testpulse ) {
669 
670  if ( ism >=1 && ism <= 9 ) {
672  } else {
674  }
675 
676  }
677 
678  if ( runType[ism-1] == laser ) {
679 
680  if ( ism >=1 && ism <= 9 ) {
681  if ( meEELaserDigiOccupancy_[0] ) meEELaserDigiOccupancy_[0]->Fill( xeex, xeey );
682  } else {
683  if ( meEELaserDigiOccupancy_[1] ) meEELaserDigiOccupancy_[1]->Fill( xeex, xeey );
684  }
685 
686  }
687 
688  if ( runType[ism-1] == led ) {
689 
690  if ( ism >=1 && ism <= 9 ) {
691  if ( meEELedDigiOccupancy_[0] ) meEELedDigiOccupancy_[0]->Fill( xeex, xeey );
692  } else {
693  if ( meEELedDigiOccupancy_[1] ) meEELedDigiOccupancy_[1]->Fill( xeex, xeey );
694  }
695 
696  }
697 
698  if ( runType[ism-1] == pedestal ) {
699 
700  if ( ism >=1 && ism <= 9 ) {
701  if ( meEEPedestalDigiOccupancy_[0] ) meEEPedestalDigiOccupancy_[0]->Fill( xeex, xeey );
702  } else {
703  if ( meEEPedestalDigiOccupancy_[1] ) meEEPedestalDigiOccupancy_[1]->Fill( xeex, xeey );
704  }
705 
706  }
707 
708  }
709 
710  } else {
711 
712  edm::LogWarning("EEOccupancyTask") << "EEDigiCollection not available";
713 
714  }
715 
717 
718  if ( e.getByToken(EcalPnDiodeDigiCollection_, PNs) ) {
719 
720  // filling mem occupancy only for the 5 channels belonging
721  // to a fully reconstructed PN's
722 
723  for ( EcalPnDiodeDigiCollection::const_iterator pnItr = PNs->begin(); pnItr != PNs->end(); ++pnItr ) {
724 
725  if ( Numbers::subDet( pnItr->id() ) != EcalEndcap ) continue;
726 
727  int ism = Numbers::iSM( pnItr->id() );
728 
729  float PnId = pnItr->id().iPnId();
730 
731  PnId = PnId - 0.5;
732  float st = 0.0;
733 
734  for (int chInStrip = 1; chInStrip <= 5; chInStrip++){
735  if ( meOccupancyMem_[ism-1] ) {
736  st = chInStrip - 0.5;
737  meOccupancyMem_[ism-1]->Fill(PnId, st);
738  }
739  }
740 
741  }
742 
743  } else {
744 
745  edm::LogWarning("EEOccupancyTask") << "EcalPnDiodeDigiCollection not available";
746 
747  }
748 
750  c.get<EcalSeverityLevelAlgoRcd>().get(sevlv);
751 
753 
754  if ( e.getByToken(EcalRecHitCollection_, rechits) ) {
755 
756  int nebrh = rechits->size();
757  LogDebug("EEOccupancyTask") << "event " << ievt_ << " rec hits collection size " << nebrh;
758 
759  for ( EcalRecHitCollection::const_iterator rechitItr = rechits->begin(); rechitItr != rechits->end(); ++rechitItr ) {
760 
761  EEDetId id = rechitItr->id();
762 
763  int eex = id.ix();
764  int eey = id.iy();
765 
766  int hi = id.hashedIndex();
767 
768  if ( geometryEE[hi][0] == 0 ) {
769  const GlobalPoint& pos = pGeometry_->getGeometry(id)->getPosition();
770  geometryEE[hi][0] = pos.eta();
771  geometryEE[hi][1] = pos.phi();
772  }
773 
774  float eta = geometryEE[hi][0];
775  float phi = geometryEE[hi][1];
776 
777  int ism = Numbers::iSM( id );
778 
779  // sector view (from electronics)
780  float xix = ( ism >= 1 && ism <= 9 ) ? 101 - eex - 0.5 : eex - 0.5;
781  float xiy = eey - 0.5;
782 
783  // physics view (from IP)
784  float xeex = eex - 0.5;
785  float xeey = eey - 0.5;
786 
787  if ( runType[ism-1] == physics || runType[ism-1] == notdata ) {
788 
789  if ( ism >= 1 && ism <= 9 ) {
790  if ( meEERecHitOccupancy_[0] ) meEERecHitOccupancy_[0]->Fill( xeex, xeey );
793  } else {
794  if ( meEERecHitOccupancy_[1] ) meEERecHitOccupancy_[1]->Fill( xeex, xeey );
797  }
798 
799  uint32_t flag = rechitItr->recoFlag();
800 
801  uint32_t sev = sevlv->severityLevel(id, *rechits);
802 
803  if ( rechitItr->energy() > recHitEnergyMin_ && flag == EcalRecHit::kGood && sev == EcalSeverityLevel::kGood ) {
804 
805  if ( ism >= 1 && ism <= 9 ) {
806  if ( meEERecHitOccupancyThr_[0] ) meEERecHitOccupancyThr_[0]->Fill( xeex, xeey );
809  } else {
810  if ( meEERecHitOccupancyThr_[1] ) meEERecHitOccupancyThr_[1]->Fill( xeex, xeey );
813  }
814 
815  }
816 
817  if ( flag == EcalRecHit::kGood && sev == EcalSeverityLevel::kGood ) {
818  if ( meEERecHitEnergy_[ism-1] ) meEERecHitEnergy_[ism-1]->Fill( xix, xiy, rechitItr->energy() );
819  if ( meSpectrum_[ism-1] ) meSpectrum_[ism-1]->Fill( rechitItr->energy() );
820  if ( ism >= 1 && ism <= 9 ) meEERecHitSpectrum_[0]->Fill( rechitItr->energy() );
821  else meEERecHitSpectrum_[1]->Fill( rechitItr->energy() );
822  }
823 
824  }
825  }
826 
827  } else {
828 
829  edm::LogWarning("EEOccupancyTask") << "EcalRecHitCollection not available";
830 
831  }
832 
834 
835  if ( e.getByToken(EcalTrigPrimDigiCollection_, trigPrimDigis) ) {
836 
837  int nebtpg = trigPrimDigis->size();
838  LogDebug("EEOccupancyTask") << "event " << ievt_ << " trigger primitives digis collection size " << nebtpg;
839 
840  for ( EcalTrigPrimDigiCollection::const_iterator tpdigiItr = trigPrimDigis->begin(); tpdigiItr != trigPrimDigis->end(); ++tpdigiItr ) {
841 
842  if ( Numbers::subDet( tpdigiItr->id() ) != EcalEndcap ) continue;
843 
844  int ism = Numbers::iSM( tpdigiItr->id() );
845 
846  std::vector<DetId>* crystals = Numbers::crystals( tpdigiItr->id() );
847 
848  for ( unsigned int i=0; i<crystals->size(); i++ ) {
849 
850  EEDetId id = (*crystals)[i];
851 
852  int eex = id.ix();
853  int eey = id.iy();
854 
855  int hi = id.hashedIndex();
856 
857  if ( geometryEE[hi][0] == 0 ) {
858  const GlobalPoint& pos = pGeometry_->getGeometry(id)->getPosition();
859  geometryEE[hi][0] = pos.eta();
860  geometryEE[hi][1] = pos.phi();
861  }
862 
863  float eta = geometryEE[hi][0];
864  float phi = geometryEE[hi][1];
865 
866  float xeex = eex - 0.5;
867  float xeey = eey - 0.5;
868 
869  if ( runType[ism-1] == physics || runType[ism-1] == notdata ) {
870 
871  if ( ism >= 1 && ism <= 9 ) {
872  if ( meEETrigPrimDigiOccupancy_[0] ) meEETrigPrimDigiOccupancy_[0]->Fill( xeex, xeey );
875  } else {
876  if ( meEETrigPrimDigiOccupancy_[1] ) meEETrigPrimDigiOccupancy_[1]->Fill( xeex, xeey );
879  }
880 
881  if ( tpdigiItr->compressedEt() > trigPrimEtMin_ ) {
882 
883  if ( ism >= 1 && ism <= 9 ) {
887  } else {
891  }
892 
893  }
894 
895  }
896  }
897  }
898 
899  } else {
900 
901  edm::LogWarning("EEOccupancyTask") << "EcalTrigPrimDigiCollection not available";
902 
903  }
904 
905 }
906 
#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:223
int i
Definition: DBlmapReader.cc:9
void beginJob(void)
BeginJob.
MonitorElement * meEETestPulseDigiOccupancy_[2]
int ix() const
Definition: EEDetId.h:76
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:872
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2730
void setup(void)
Setup.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
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:69
std::vector< EcalDCCHeaderBlock >::const_iterator const_iterator
MonitorElement * meEELaserDigiOccupancy_[2]
MonitorElement * meEERecHitOccupancyProEtaThr_[2]
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:770
MonitorElement * book1DD(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1S histogram.
Definition: DQMStore.cc:904
edm::EDGetTokenT< EcalPnDiodeDigiCollection > EcalPnDiodeDigiCollection_
edm::ESHandle< CaloGeometry > pGeometry_
T eta() const
edm::EDGetTokenT< EcalRecHitCollection > EcalRecHitCollection_
MonitorElement * meEERecHitOccupancyProPhi_[2]
static int iy0EE(const unsigned ism)
Definition: Numbers.cc:809
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:1509
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
MonitorElement * meOccupancyMem_[18]
MonitorElement * meEETrigPrimDigiOccupancyThr_[2]
edm::EDGetTokenT< EcalTrigPrimDigiCollection > EcalTrigPrimDigiCollection_
static std::vector< DetId > * crystals(const EcalTrigTowerDetId &id)
Definition: Numbers.cc:582
void removeElement(const std::string &name)
Definition: DQMStore.cc:2772
MonitorElement * meEERecHitOccupancyProPhiThr_[2]
MonitorElement * meEERecHitOccupancy_[2]
MonitorElement * meEEDigiOccupancy_[2]
MonitorElement * meEETrigPrimDigiOccupancy_[2]
EEOccupancyTask(const edm::ParameterSet &ps)
Constructor.
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:47
const T & get() const
Definition: EventSetup.h:55
void reset(void)
Reset.
edm::EDGetTokenT< EEDigiCollection > EEDigiCollection_
DQMStore * dqmStore_
MonitorElement * meEELedDigiOccupancy_[2]
MonitorElement * meEETrigPrimDigiOccupancyProEta_[2]
T eta() const
Definition: PV3DBase.h:76
MonitorElement * meOccupancy_[18]
static unsigned iSM(const unsigned ism, const EcalSubdetector subdet)
Definition: Numbers.cc:243
MonitorElement * meEERecHitOccupancyProEta_[2]
std::string prefixME_
std::string subfolder_
edm::EDGetTokenT< EcalRawDataCollection > EcalRawDataCollection_
static EcalSubdetector subDet(const EBDetId &id)
Definition: Numbers.cc:142
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:1000
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:584
Definition: Run.h:41
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:1330