CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EESelectiveReadoutTask.cc
Go to the documentation of this file.
1 /*
2  * \file EESelectiveReadoutTask.cc
3  *
4  * $Date: 2012/04/27 13:46:16 $
5  * $Revision: 1.66 $
6  * \author P. Gras
7  * \author E. Di Marco
8  *
9 */
10 
11 #include <iostream>
12 #include <fstream>
13 #include <vector>
14 #include <math.h>
15 #include <cassert>
16 
20 
22 
24 
28 
32 
35 
37 
39 
42 
43 
45 
46  init_ = false;
47 
49 
50  prefixME_ = ps.getUntrackedParameter<std::string>("prefixME", "");
51 
52  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup", false);
53 
54  mergeRuns_ = ps.getUntrackedParameter<bool>("mergeRuns", false);
55 
56  // parameters...
57  EEDigiCollection_ = ps.getParameter<edm::InputTag>("EEDigiCollection");
58  EEUnsuppressedDigiCollection_ = ps.getParameter<edm::InputTag>("EEUsuppressedDigiCollection");
59  EESRFlagCollection_ = ps.getParameter<edm::InputTag>("EESRFlagCollection");
60  EcalTrigPrimDigiCollection_ = ps.getParameter<edm::InputTag>("EcalTrigPrimDigiCollection");
61  FEDRawDataCollection_ = ps.getParameter<edm::InputTag>("FEDRawDataCollection");
62  firstFIRSample_ = ps.getParameter<int>("ecalDccZs1stSample");
63 
64  useCondDb_ = ps.getParameter<bool>("configFromCondDB");
65  if(!useCondDb_) configFirWeights(ps.getParameter<std::vector<double> >("dccWeights"));
66 
67  // histograms...
68  EEDccEventSize_ = 0;
70 
71  for(int i=0; i<2; i++) {
72  EETowerSize_[i] = 0;
73  EETTFMismatch_[i] = 0;
81  EETTFlags_[i] = 0;
82  EECompleteZSMap_[i] = 0;
83  EECompleteZSCount_[i] = 0;
84  EEDroppedFRMap_[i] = 0;
85  EEDroppedFRCount_[i] = 0;
86  EEEventSize_[i] = 0;
91  }
92 
93  // initialize variable binning for DCC size...
94  float ZSthreshold = 0.608; // kBytes of 1 TT fully readout
95  float zeroBinSize = ZSthreshold / 20.;
96  for(int i=0; i<20; i++) ybins[i] = i*zeroBinSize;
97  for(int i=20; i<133; i++) ybins[i] = ZSthreshold * (i-19);
98  for(int i=0; i<=18; i++) xbins[i] = i+1;
99 
100 }
101 
103 
104 }
105 
107 
108  ievt_ = 0;
109 
110  if ( dqmStore_ ) {
111  dqmStore_->setCurrentFolder(prefixME_ + "/EESelectiveReadoutTask");
112  dqmStore_->rmdir(prefixME_ + "/EESelectiveReadoutTask");
113  }
114 
115 }
116 
118 
119  Numbers::initGeometry(c, false);
120 
121  if ( ! mergeRuns_ ) this->reset();
122 
123  for(int ix = 0; ix < 20; ix++ ) {
124  for(int iy = 0; iy < 20; iy++ ) {
125  for(int iz = 0; iz < 2; iz++) {
126  nEvtFullReadout[ix][iy][iz] = 0;
127  nEvtZS1Readout[ix][iy][iz] = 0;
128  nEvtZSReadout[ix][iy][iz] = 0;
129  nEvtCompleteReadoutIfZS[ix][iy][iz] = 0;
130  nEvtDroppedReadoutIfFR[ix][iy][iz] = 0;
131  nEvtRUForced[ix][iy][iz] = 0;
132  nEvtAnyReadout[ix][iy][iz] = 0;
133  }
134  }
135  }
136  for(int ix = 0; ix < 100; ix++ ) {
137  for(int iy = 0; iy < 100; iy++ ) {
138  for(int iz = 0; iz < 2; iz++) {
139  nEvtHighInterest[ix][iy][iz] = 0;
140  nEvtMediumInterest[ix][iy][iz] = 0;
141  nEvtLowInterest[ix][iy][iz] = 0;
142  nEvtAnyInterest[ix][iy][iz] = 0;
143  }
144  }
145  }
146 
147  //getting selective readout configuration
148  if(useCondDb_) {
150  c.get<EcalSRSettingsRcd>().get(hSr);
151  settings_ = hSr.product();
152  std::vector<double> wsFromDB;
153 
154  std::vector<std::vector<float> > dccs = settings_->dccNormalizedWeights_;
155  int nws = dccs.size();
156  if(nws == 1) {
157  for(std::vector<float>::const_iterator it = dccs[0].begin(); it != dccs[0].end(); it++) {
158  wsFromDB.push_back(*it);
159  }
160  }
161  else edm::LogWarning("EESelectiveReadoutTask") << "DCC weight set is not exactly 1.";
162 
163  configFirWeights(wsFromDB);
164  }
165 
166 }
167 
169 
170 }
171 
173 
174  if ( EETowerSize_[0] ) EETowerSize_[0]->Reset();
175  if ( EETowerSize_[1] ) EETowerSize_[1]->Reset();
176 
177  if ( EETTFMismatch_[0] ) EETTFMismatch_[0]->Reset();
178  if ( EETTFMismatch_[1] ) EETTFMismatch_[1]->Reset();
179 
181 
183 
186 
189 
192 
195 
198 
201 
204 
205  if ( EETTFlags_[0] ) EETTFlags_[0]->Reset();
206  if ( EETTFlags_[1] ) EETTFlags_[1]->Reset();
207 
208  if ( EECompleteZSMap_[0] ) EECompleteZSMap_[0]->Reset();
209  if ( EECompleteZSMap_[1] ) EECompleteZSMap_[1]->Reset();
210 
213 
214  if ( EEDroppedFRMap_[0] ) EEDroppedFRMap_[0]->Reset();
215  if ( EEDroppedFRMap_[1] ) EEDroppedFRMap_[1]->Reset();
216 
217  if ( EEDroppedFRCount_[0] ) EEDroppedFRCount_[0]->Reset();
218  if ( EEDroppedFRCount_[1] ) EEDroppedFRCount_[1]->Reset();
219 
220  if ( EEEventSize_[0] ) EEEventSize_[0]->Reset();
221  if ( EEEventSize_[1] ) EEEventSize_[1]->Reset();
222 
225 
228 
231 
234 
235 }
236 
238 
239  init_ = true;
240 
241  std::string name;
242 
243  if ( dqmStore_ ) {
244  dqmStore_->setCurrentFolder(prefixME_ + "/EESelectiveReadoutTask");
245 
246  name = "EESRT tower event size EE -";
247  EETowerSize_[0] = dqmStore_->bookProfile2D(name, name, 20, 0., 20., 20, 0., 20., 100, 0., 200., "s");
248  EETowerSize_[0]->setAxisTitle("jx", 1);
249  EETowerSize_[0]->setAxisTitle("jy", 2);
250 
251  name = "EESRT tower event size EE +";
252  EETowerSize_[1] = dqmStore_->bookProfile2D(name, name, 20, 0., 20., 20, 0., 20., 100, 0., 200., "s");
253  EETowerSize_[1]->setAxisTitle("jx", 1);
254  EETowerSize_[1]->setAxisTitle("jy", 2);
255 
256  name = "EESRT TT flag mismatch EE -";
257  EETTFMismatch_[0] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
258  EETTFMismatch_[0]->setAxisTitle("jx", 1);
259  EETTFMismatch_[0]->setAxisTitle("jy", 2);
260 
261  name = "EESRT TT flag mismatch EE +";
262  EETTFMismatch_[1] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
263  EETTFMismatch_[1]->setAxisTitle("jx", 1);
264  EETTFMismatch_[1]->setAxisTitle("jy", 2);
265 
266  name = "EESRT DCC event size";
267  EEDccEventSize_ = dqmStore_->bookProfile(name, name, 18, 1, 19, 100, 0., 200., "s");
268  EEDccEventSize_->setAxisTitle("event size (kB)", 2);
269  for (int i = 0; i < 18; i++) {
270  EEDccEventSize_->setBinLabel(i+1, Numbers::sEE(i+1).c_str(), 1);
271  }
272 
273  name = "EESRT event size vs DCC";
274  EEDccEventSizeMap_ = dqmStore_->book2D(name, name, 18, xbins, 132, ybins);
275  EEDccEventSizeMap_->setAxisTitle("event size (kB)", 2);
276  for (int i = 0; i < 18; i++) {
277  EEDccEventSizeMap_->setBinLabel(i+1, Numbers::sEE(i+1).c_str(), 1);
278  }
279 
280  name = "EESRT readout unit with SR forced EE -";
281  EEReadoutUnitForcedBitMap_[0] = dqmStore_->book2D(name, name, 20, 0., 20., 20, 0., 20.);
285 
286  name = "EESRT readout unit with SR forced EE +";
287  EEReadoutUnitForcedBitMap_[1] = dqmStore_->book2D(name, name, 20, 0., 20., 20, 0., 20.);
291 
292  name = "EESRT full readout SR Flags EE -";
293  EEFullReadoutSRFlagMap_[0] = dqmStore_->book2D(name, name, 20, 0., 20., 20, 0., 20.);
296  EEFullReadoutSRFlagMap_[0]->setAxisTitle("rate", 3);
297 
298  name = "EESRT full readout SR Flags EE +";
299  EEFullReadoutSRFlagMap_[1] = dqmStore_->book2D(name, name, 20, 0., 20., 20, 0., 20.);
302  EEFullReadoutSRFlagMap_[1]->setAxisTitle("rate", 3);
303 
304  name = "EESRT full readout SR Flags Number EE -";
305  EEFullReadoutSRFlagCount_[0] = dqmStore_->book1D(name, name, 200, 0., 200.);
306  EEFullReadoutSRFlagCount_[0]->setAxisTitle("Readout Units number", 1);
307 
308  name = "EESRT full readout SR Flags Number EE +";
309  EEFullReadoutSRFlagCount_[1] = dqmStore_->book1D(name, name, 200, 0., 200.);
310  EEFullReadoutSRFlagCount_[1]->setAxisTitle("Fully readout RU number", 1);
311 
312  name = "EESRT zero suppression 1 SR Flags EE -";
313  EEZeroSuppression1SRFlagMap_[0] = dqmStore_->book2D(name, name, 20, 0., 20., 20, 0., 20.);
317 
318  name = "EESRT zero suppression 1 SR Flags EE +";
319  EEZeroSuppression1SRFlagMap_[1] = dqmStore_->book2D(name, name, 20, 0., 20., 20, 0., 20.);
323 
324  name = "EESRT high interest TT Flags EE -";
325  EEHighInterestTriggerTowerFlagMap_[0] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
329 
330  name = "EESRT high interest TT Flags EE +";
331  EEHighInterestTriggerTowerFlagMap_[1] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
335 
336  name = "EESRT medium interest TT Flags EE -";
337  EEMediumInterestTriggerTowerFlagMap_[0] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
341 
342  name = "EESRT medium interest TT Flags EE +";
343  EEMediumInterestTriggerTowerFlagMap_[1] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
347 
348  name = "EESRT low interest TT Flags EE -";
349  EELowInterestTriggerTowerFlagMap_[0] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
353 
354  name = "EESRT low interest TT Flags EE +";
355  EELowInterestTriggerTowerFlagMap_[1] = dqmStore_->book2D(name, name, 100, 0., 100., 100, 0., 100.);
359 
360  name = "EESRT TT Flags EE -";
361  EETTFlags_[0] = dqmStore_->book1D(name, name, 8, 0., 8.);
362  EETTFlags_[0]->setAxisTitle("TT Flag value", 1);
363 
364  name = "EESRT TT Flags EE +";
365  EETTFlags_[1] = dqmStore_->book1D(name, name, 8, 0., 8.);
366  EETTFlags_[1]->setAxisTitle("TT Flag value", 1);
367 
368  name = "EESRT ZS Flagged Fully Readout EE -";
369  EECompleteZSMap_[0] = dqmStore_->book2D(name, name, 20, 0., 20., 20, 0., 20.);
370  EECompleteZSMap_[0]->setAxisTitle("jphi", 1);
371  EECompleteZSMap_[0]->setAxisTitle("jeta", 2);
372  EECompleteZSMap_[0]->setAxisTitle("rate", 3);
373 
374  name = "EESRT ZS Flagged Fully Readout EE +";
375  EECompleteZSMap_[1] = dqmStore_->book2D(name, name, 20, 0., 20., 20, 0., 20.);
376  EECompleteZSMap_[1]->setAxisTitle("jphi", 1);
377  EECompleteZSMap_[1]->setAxisTitle("jeta", 2);
378  EECompleteZSMap_[1]->setAxisTitle("rate", 3);
379 
380  name = "EESRT ZS Flagged Fully Readout Number EE -";
381  EECompleteZSCount_[0] = dqmStore_->book1D(name, name, 20, 0., 20.);
382  EECompleteZSCount_[0]->setAxisTitle("Readout Units number", 1);
383 
384  name = "EESRT ZS Flagged Fully Readout Number EE +";
385  EECompleteZSCount_[1] = dqmStore_->book1D(name, name, 20, 0., 20.);
386  EECompleteZSCount_[1]->setAxisTitle("Readout Units number", 1);
387 
388  name = "EESRT FR Flagged Dropped Readout EE -";
389  EEDroppedFRMap_[0] = dqmStore_->book2D(name, name, 20, 0., 20., 20, 0., 20.);
390  EEDroppedFRMap_[0]->setAxisTitle("jphi", 1);
391  EEDroppedFRMap_[0]->setAxisTitle("jeta", 2);
392  EEDroppedFRMap_[0]->setAxisTitle("rate", 3);
393 
394  name = "EESRT FR Flagged Dropped Readout EE +";
395  EEDroppedFRMap_[1] = dqmStore_->book2D(name, name, 20, 0., 20., 20, 0., 20.);
396  EEDroppedFRMap_[1]->setAxisTitle("jphi", 1);
397  EEDroppedFRMap_[1]->setAxisTitle("jeta", 2);
398  EEDroppedFRMap_[1]->setAxisTitle("rate", 3);
399 
400  name = "EESRT FR Flagged Dropped Readout Number EE -";
401  EEDroppedFRCount_[0] = dqmStore_->book1D(name, name, 20, 0., 20.);
402  EEDroppedFRCount_[0]->setAxisTitle("Readout Units number", 1);
403 
404  name = "EESRT FR Flagged Dropped Readout Number EE +";
405  EEDroppedFRCount_[1] = dqmStore_->book1D(name, name, 20, 0., 20.);
406  EEDroppedFRCount_[1]->setAxisTitle("Readout Units number", 1);
407 
408  name = "EESRT event size EE -";
409  EEEventSize_[0] = dqmStore_->book1D(name, name, 100, 0, 200);
410  EEEventSize_[0]->setAxisTitle("event size (kB)",1);
411 
412  name = "EESRT event size EE +";
413  EEEventSize_[1] = dqmStore_->book1D(name, name, 100, 0, 200);
414  EEEventSize_[1]->setAxisTitle("event size (kB)",1);
415 
416  name = "EESRT high interest payload EE -";
417  EEHighInterestPayload_[0] = dqmStore_->book1D(name, name, 100, 0, 200);
418  EEHighInterestPayload_[0]->setAxisTitle("event size (kB)",1);
419 
420  name = "EESRT high interest payload EE +";
421  EEHighInterestPayload_[1] = dqmStore_->book1D(name, name, 100, 0, 200);
422  EEHighInterestPayload_[1]->setAxisTitle("event size (kB)",1);
423 
424  name = "EESRT low interest payload EE -";
425  EELowInterestPayload_[0] = dqmStore_->book1D(name, name, 100, 0, 200);
426  EELowInterestPayload_[0]->setAxisTitle("event size (kB)",1);
427 
428  name = "EESRT low interest payload EE +";
429  EELowInterestPayload_[1] = dqmStore_->book1D(name, name, 100, 0, 200);
430  EELowInterestPayload_[1]->setAxisTitle("event size (kB)",1);
431 
432  name = "EESRT high interest ZS filter output EE -";
433  EEHighInterestZsFIR_[0] = dqmStore_->book1D(name, name, 60, -30, 30);
434  EEHighInterestZsFIR_[0]->setAxisTitle("ADC counts*4",1);
435 
436  name = "EESRT high interest ZS filter output EE +";
437  EEHighInterestZsFIR_[1] = dqmStore_->book1D(name, name, 60, -30, 30);
438  EEHighInterestZsFIR_[1]->setAxisTitle("ADC counts*4",1);
439 
440  name = "EESRT low interest ZS filter output EE -";
441  EELowInterestZsFIR_[0] = dqmStore_->book1D(name, name, 60, -30, 30);
442  EELowInterestZsFIR_[0]->setAxisTitle("ADC counts*4",1);
443 
444  name = "EESRT low interest ZS filter output EE +";
445  EELowInterestZsFIR_[1] = dqmStore_->book1D(name, name, 60, -30, 30);
446  EELowInterestZsFIR_[1]->setAxisTitle("ADC counts*4",1);
447 
448  }
449 
450 }
451 
453 
454  if ( ! init_ ) return;
455 
456  if ( dqmStore_ ) {
457  dqmStore_->setCurrentFolder(prefixME_ + "/EESelectiveReadoutTask");
458 
460  EETowerSize_[0] = 0;
461 
463  EETowerSize_[1] = 0;
464 
466  EETTFMismatch_[0] = 0;
467 
469  EETTFMismatch_[1] = 0;
470 
472  EEDccEventSize_ = 0;
473 
475  EEDccEventSizeMap_ = 0;
476 
479 
482 
485 
488 
491 
494 
497 
500 
503 
506 
509 
512 
514  EETTFlags_[0] = 0;
515 
517  EETTFlags_[1] = 0;
518 
520  EECompleteZSMap_[0] = 0;
521 
523  EECompleteZSMap_[1] = 0;
524 
526  EECompleteZSCount_[0] = 0;
527 
529  EECompleteZSCount_[1] = 0;
530 
532  EEDroppedFRMap_[0] = 0;
533 
535  EEDroppedFRMap_[1] = 0;
536 
538  EEDroppedFRCount_[0] = 0;
539 
541  EEDroppedFRCount_[1] = 0;
542 
544  EEEventSize_[0] = 0;
545 
547  EEEventSize_[1] = 0;
548 
550  EEHighInterestPayload_[0] = 0;
551 
553  EEHighInterestPayload_[1] = 0;
554 
556  EELowInterestPayload_[0] = 0;
557 
559  EELowInterestPayload_[1] = 0;
560 
562  EEHighInterestZsFIR_[0] = 0;
563 
565  EEHighInterestZsFIR_[1] = 0;
566 
568  EELowInterestZsFIR_[0] = 0;
569 
571  EELowInterestZsFIR_[1] = 0;
572 
573  }
574 
575  init_ = false;
576 
577 }
578 
580 
581  edm::LogInfo("EESelectiveReadoutTask") << "analyzed " << ievt_ << " events";
582 
583  if ( enableCleanup_ ) this->cleanup();
584 
585 }
586 
588 
589  if ( ! init_ ) this->setup();
590 
591  ievt_++;
592 
594  if ( e.getByLabel(FEDRawDataCollection_, raw) ) {
595 
596  int EEFirstFED[2];
597  EEFirstFED[0] = 601; // EE-
598  EEFirstFED[1] = 646; // EE+
599  for(int zside=0; zside<2; zside++) {
600 
601  int firstFedOnSide=EEFirstFED[zside];
602 
603  for ( int iDcc = 0; iDcc < 9; ++iDcc ) {
604 
605  int ism = 0;
606  if ( zside == 0 ) ism = iDcc+1;
607  else ism = 10+iDcc;
608 
609  EEDccEventSize_->Fill( ism, ((double)raw->FEDData(firstFedOnSide+iDcc).size())/kByte );
610  EEDccEventSizeMap_->Fill( ism, ((double)raw->FEDData(firstFedOnSide+iDcc).size())/kByte );
611 
612  }
613  }
614 
615  } else {
616  edm::LogWarning("EESelectiveReadoutTask") << FEDRawDataCollection_ << " not available";
617  }
618 
619  // Selective Readout Flags
620  int nFRO[2], nCompleteZS[2], nDroppedFRO[2];
621  nFRO[0] = nFRO[1] = 0;
622  nCompleteZS[0] = nCompleteZS[1] = 0;
623  nDroppedFRO[0] = nDroppedFRO[1] = 0;
625  if ( e.getByLabel(EESRFlagCollection_,eeSrFlags) ) {
626 
627  // Data Volume
628  double aLowInterest[2];
629  double aHighInterest[2];
630  double aAnyInterest[2];
631 
632  aLowInterest[0]=0;
633  aHighInterest[0]=0;
634  aAnyInterest[0]=0;
635  aLowInterest[1]=0;
636  aHighInterest[1]=0;
637  aAnyInterest[1]=0;
638 
640  if ( e.getByLabel(EEDigiCollection_ , eeDigis) ) {
641 
642  anaDigiInit();
643 
644  // channel status
645  edm::ESHandle<EcalChannelStatus> pChannelStatus;
646  c.get<EcalChannelStatusRcd>().get(pChannelStatus);
647  const EcalChannelStatus* chStatus = pChannelStatus.product();
648 
649  for (unsigned int digis=0; digis<eeDigis->size(); ++digis) {
650  EEDataFrame eedf = (*eeDigis)[digis];
651  EEDetId id = eedf.id();
653  chit = chStatus->getMap().find(id.rawId());
654  uint16_t statusCode = 0;
655  if( chit != chStatus->getMap().end() ) {
656  EcalChannelStatusCode ch_code = (*chit);
657  statusCode = ch_code.getStatusCode();
658  }
659  anaDigi(eedf, *eeSrFlags, statusCode);
660  }
661 
662  //low interest channels:
663  aLowInterest[0] = nEeLI_[0]*bytesPerCrystal/kByte;
664  EELowInterestPayload_[0]->Fill(aLowInterest[0]);
665  aLowInterest[1] = nEeLI_[1]*bytesPerCrystal/kByte;
666  EELowInterestPayload_[1]->Fill(aLowInterest[1]);
667 
668  //low interest channels:
669  aHighInterest[0] = nEeHI_[0]*bytesPerCrystal/kByte;
670  EEHighInterestPayload_[0]->Fill(aHighInterest[0]);
671  aHighInterest[1] = nEeHI_[1]*bytesPerCrystal/kByte;
672  EEHighInterestPayload_[1]->Fill(aHighInterest[1]);
673 
674  //any-interest channels:
675  aAnyInterest[0] = getEeEventSize(nEe_[0])/kByte;
676  EEEventSize_[0]->Fill(aAnyInterest[0]);
677  aAnyInterest[1] = getEeEventSize(nEe_[1])/kByte;
678  EEEventSize_[1]->Fill(aAnyInterest[1]);
679 
680  //event size by tower:
681  for(int ix = 0; ix < 20; ix++ ) {
682  for(int iy = 0; iy < 20; iy++ ) {
683  for(int iz = 0; iz < 2; iz++) {
684 
685  double towerSize = nCrySC[ix][iy][iz] * bytesPerCrystal;
686 
687  float xix = ix;
688  if ( iz == 0 ) xix = 19 - xix;
689  xix += 0.5;
690 
691  float xiy = iy+0.5;
692 
693  EETowerSize_[iz]->Fill(xix, xiy, towerSize);
694 
695  }
696  }
697  }
698 
699  } else {
700  edm::LogWarning("EESelectiveReadoutTask") << EEDigiCollection_ << " not available";
701  }
702 
703  // initialize dcchs_ to mask disabled towers
704  std::map< int, std::vector<short> > towersStatus;
706 
707  if( e.getByLabel(FEDRawDataCollection_, dcchs) ) {
708  for ( EcalRawDataCollection::const_iterator dcchItr = dcchs->begin(); dcchItr != dcchs->end(); ++dcchItr ) {
709  if ( Numbers::subDet( *dcchItr ) != EcalEndcap ) continue;
710  int ism = Numbers::iSM( *dcchItr, EcalEndcap );
711  towersStatus.insert(std::make_pair(ism, dcchItr->getFEStatus()));
712  }
713  }
714 
715  for ( EESrFlagCollection::const_iterator it = eeSrFlags->begin(); it != eeSrFlags->end(); ++it ) {
716 
717  EcalScDetId id = it->id();
718 
719  if ( Numbers::subDet( id ) != EcalEndcap ) continue;
720 
721  int ix = id.ix();
722  int iy = id.iy();
723  int iDcc = dccNumOfRU(id);
724  int ism = Numbers::iSM( id );
725  int isc = Numbers::iSC( id );
726 
727  int zside = id.zside();
728 
729  int iz = ( zside < 0 ) ? 0 : 1;
730 
731  if ( zside < 0 ) ix = 21 - ix;
732 
733  nEvtAnyReadout[ix-1][iy-1][iz]++;
734 
735  int flag = it->value() & ~EcalSrFlag::SRF_FORCED_MASK;
736 
737  int status=0;
738  if( towersStatus[ism].size() > 0 ) status = (towersStatus[ism])[isc];
739 
740  if(flag == EcalSrFlag::SRF_FULL) {
741  nEvtFullReadout[ix-1][iy-1][iz]++;
742  nFRO[iz]++;
743  if(nPerRu_[iDcc-1][isc] == 0) {
744  if(status != 1) nEvtDroppedReadoutIfFR[ix-1][iy-1][iz]++;
745  nDroppedFRO[iz]++;
746  }
747  }
748 
749  if(flag == EcalSrFlag::SRF_ZS1) nEvtZS1Readout[ix-1][iy-1][iz]++;
750 
751  if(it->value() & EcalSrFlag::SRF_FORCED_MASK) nEvtRUForced[ix-1][iy-1][iz]++;
752 
753  if(flag == EcalSrFlag::SRF_ZS1 || flag == EcalSrFlag::SRF_ZS2) {
754  nEvtZSReadout[ix-1][iy-1][iz]++;
755  if(nPerRu_[iDcc-1][isc] == getCrystalCount(iDcc,isc)) {
756  if(status != 1) nEvtCompleteReadoutIfZS[ix-1][iy-1][iz]++;
757  nCompleteZS[iz]++;
758  }
759  }
760 
761  }
762  } else {
763  edm::LogWarning("EESelectiveReadoutTask") << EESRFlagCollection_ << " not available";
764  }
765 
766  for(int ix = 0; ix < 20; ix++ ) {
767  for(int iy = 0; iy < 20; iy++ ) {
768  for(int iz = 0; iz < 2; iz++) {
769 
770  if( nEvtAnyReadout[ix][iy][iz] ) {
771 
772  float xix = ix;
773  if ( iz == 0 ) xix = 19 - xix;
774  xix += 0.5;
775 
776  float xiy = iy+0.5;
777 
778  float fraction = float(nEvtFullReadout[ix][iy][iz]) / float(nEvtAnyReadout[ix][iy][iz]);
779  float error = sqrt(fraction*(1-fraction)/float(nEvtAnyReadout[ix][iy][iz]));
780 
781  TH2F *h2d = EEFullReadoutSRFlagMap_[iz]->getTH2F();
782 
783  int binx=0, biny=0;
784 
785  if( h2d ) {
786  binx = h2d->GetXaxis()->FindBin(xix);
787  biny = h2d->GetYaxis()->FindBin(xiy);
788  }
789 
790  EEFullReadoutSRFlagMap_[iz]->setBinContent(binx, biny, fraction);
791  EEFullReadoutSRFlagMap_[iz]->setBinError(binx, biny, error);
792 
793 
794  fraction = float(nEvtZS1Readout[ix][iy][iz]) / float(nEvtAnyReadout[ix][iy][iz]);
795  error = sqrt(fraction*(1-fraction)/float(nEvtAnyReadout[ix][iy][iz]));
796 
798 
799  if( h2d ) {
800  binx = h2d->GetXaxis()->FindBin(xix);
801  biny = h2d->GetYaxis()->FindBin(xiy);
802  }
803 
804  EEZeroSuppression1SRFlagMap_[iz]->setBinContent(binx, biny, fraction);
805  EEZeroSuppression1SRFlagMap_[iz]->setBinError(binx, biny, error);
806 
807 
808  fraction = float(nEvtRUForced[ix][iy][iz]) / float(nEvtAnyReadout[ix][iy][iz]);
809  error = sqrt(fraction*(1-fraction)/float(nEvtAnyReadout[ix][iy][iz]));
810 
811  h2d = EEReadoutUnitForcedBitMap_[iz]->getTH2F();
812 
813  if( h2d ) {
814  binx = h2d->GetXaxis()->FindBin(xix);
815  biny = h2d->GetYaxis()->FindBin(xiy);
816  }
817 
818  EEReadoutUnitForcedBitMap_[iz]->setBinContent(binx, biny, fraction);
819  EEReadoutUnitForcedBitMap_[iz]->setBinError(binx, biny, error);
820 
821  if( nEvtZSReadout[ix][iy][iz] ) {
822  fraction = float(nEvtCompleteReadoutIfZS[ix][iy][iz]) / float(nEvtZSReadout[ix][iy][iz]);
823  error = sqrt(fraction*(1-fraction)/float(nEvtAnyReadout[ix][iy][iz]));
824 
825  h2d = EECompleteZSMap_[iz]->getTH2F();
826 
827  if( h2d ) {
828  binx = h2d->GetXaxis()->FindBin(xix);
829  biny = h2d->GetYaxis()->FindBin(xiy);
830  }
831 
832  EECompleteZSMap_[iz]->setBinContent(binx, biny, fraction);
833  EECompleteZSMap_[iz]->setBinError(binx, biny, error);
834  }
835 
836  if( nEvtFullReadout[ix][iy][iz] ) {
837  fraction = float(nEvtDroppedReadoutIfFR[ix][iy][iz]) / float(nEvtFullReadout[ix][iy][iz]);
838  error = sqrt(fraction*(1-fraction)/float(nEvtAnyReadout[ix][iy][iz]));
839 
840  h2d = EEDroppedFRMap_[iz]->getTH2F();
841 
842  if( h2d ) {
843  binx = h2d->GetXaxis()->FindBin(xix);
844  biny = h2d->GetYaxis()->FindBin(xiy);
845  }
846 
847  EEDroppedFRMap_[iz]->setBinContent(binx, biny, fraction);
848  EEDroppedFRMap_[iz]->setBinError(binx, biny, error);
849  }
850 
851  }
852 
853  }
854  }
855  }
856 
857  for(int iz = 0; iz < 2; iz++) {
858  EEFullReadoutSRFlagCount_[iz]->Fill( nFRO[iz] );
859  EECompleteZSCount_[iz]->Fill( nCompleteZS[iz] );
860  EEDroppedFRCount_[iz]->Fill( nDroppedFRO[iz] );
861  }
862 
864  if ( e.getByLabel(EcalTrigPrimDigiCollection_, TPCollection) ) {
865 
866  // Trigger Primitives
868  for ( TPdigi = TPCollection->begin(); TPdigi != TPCollection->end(); ++TPdigi ) {
869 
870  if ( Numbers::subDet( TPdigi->id() ) != EcalEndcap ) continue;
871 
872  int ismt = Numbers::iSM( TPdigi->id() );
873  int zside = TPdigi->id().zside();
874  int iz = ( zside < 0 ) ? 0 : 1;
875 
876  EETTFlags_[iz]->Fill( TPdigi->ttFlag() );
877 
878  std::vector<DetId>* crystals = Numbers::crystals( TPdigi->id() );
879 
880  for ( unsigned int i=0; i<crystals->size(); i++ ) {
881 
882  EEDetId id = (*crystals)[i];
883 
884  int ix = id.ix();
885  int iy = id.iy();
886  int ism = Numbers::iSM( id );
887  int itcc = Numbers::iTCC( ism, EcalEndcap, ix, iy );
888  int itt = Numbers::iTT( ism, EcalEndcap, ix, iy );
889 
890  if ( ismt >= 1 && ismt <= 9 ) ix = 101 - ix;
891 
892  nEvtAnyInterest[ix-1][iy-1][iz]++;
893 
894  if ( (TPdigi->ttFlag() & 0x3) == 0 ) nEvtLowInterest[ix-1][iy-1][iz]++;
895 
896  if ( (TPdigi->ttFlag() & 0x3) == 1 ) nEvtMediumInterest[ix-1][iy-1][iz]++;
897 
898  if ( (TPdigi->ttFlag() & 0x3) == 3 ) nEvtHighInterest[ix-1][iy-1][iz]++;
899 
900  float xix = ix-0.5;
901  if ( iz == 0 ) xix = 100 - xix;
902  float xiy = iy-0.5;
903 
904  if ( ((TPdigi->ttFlag() & 0x3) == 1 || (TPdigi->ttFlag() & 0x3) == 3)
905  && nCryTT[itcc-1][itt-1] != (int)crystals->size() ) EETTFMismatch_[iz]->Fill(xix, xiy);
906 
907  }
908 
909  }
910  } else {
911  edm::LogWarning("EESelectiveReadoutTask") << EcalTrigPrimDigiCollection_ << " not available";
912  }
913 
914  for(int ix = 0; ix < 100; ix++ ) {
915  for(int iy = 0; iy < 100; iy++ ) {
916  for(int iz = 0; iz < 2; iz++) {
917 
918  if( nEvtAnyInterest[ix][iy][iz] ) {
919 
920  float xix = ix;
921  if ( iz == 0 ) xix = 99 - xix;
922  xix += 0.5;
923 
924  float xiy = iy+0.5;
925 
926  float fraction = float(nEvtHighInterest[ix][iy][iz]) / float(nEvtAnyInterest[ix][iy][iz]);
927  float error = sqrt(fraction*(1-fraction)/float(nEvtAnyInterest[ix][iy][iz]));
928 
929  TH2F *h2d = EEHighInterestTriggerTowerFlagMap_[iz]->getTH2F();
930 
931  int binx=0, biny=0;
932 
933  if( h2d ) {
934  binx = h2d->GetXaxis()->FindBin(xix);
935  biny = h2d->GetYaxis()->FindBin(xiy);
936  }
937 
938  EEHighInterestTriggerTowerFlagMap_[iz]->setBinContent(binx, biny, fraction);
939  EEHighInterestTriggerTowerFlagMap_[iz]->setBinError(binx, biny, error);
940 
941 
942  fraction = float(nEvtMediumInterest[ix][iy][iz]) / float(nEvtAnyInterest[ix][iy][iz]);
943  error = sqrt(fraction*(1-fraction)/float(nEvtAnyInterest[ix][iy][iz]));
944 
946 
947  if( h2d ) {
948  binx = h2d->GetXaxis()->FindBin(xix);
949  biny = h2d->GetYaxis()->FindBin(xiy);
950  }
951 
952  EEMediumInterestTriggerTowerFlagMap_[iz]->setBinContent(binx, biny, fraction);
953  EEMediumInterestTriggerTowerFlagMap_[iz]->setBinError(binx, biny, error);
954 
955 
956  fraction = float(nEvtLowInterest[ix][iy][iz]) / float(nEvtAnyInterest[ix][iy][iz]);
957  error = sqrt(fraction*(1-fraction)/float(nEvtAnyInterest[ix][iy][iz]));
958 
960 
961  if( h2d ) {
962  binx = h2d->GetXaxis()->FindBin(xix);
963  biny = h2d->GetYaxis()->FindBin(xiy);
964  }
965 
966  EELowInterestTriggerTowerFlagMap_[iz]->setBinContent(binx, biny, fraction);
967  EELowInterestTriggerTowerFlagMap_[iz]->setBinError(binx, biny, error);
968 
969  }
970 
971  }
972  }
973  }
974 
975 }
976 
977 void EESelectiveReadoutTask::anaDigi(const EEDataFrame& frame, const EESrFlagCollection& srFlagColl, uint16_t statusCode){
978 
979  EEDetId id = frame.id();
980  int ism = Numbers::iSM( id );
981 
982  bool endcap = (id.subdetId()==EcalEndcap);
983 
984  if(endcap) {
985  if ( ism >= 1 && ism <= 9 ) {
986  ++nEe_[0];
987  } else {
988  ++nEe_[1];
989  }
990 
991  int ix = id.ix();
992  int iy = id.iy();
993 
994  int iX0 = iXY2cIndex(ix);
995  int iY0 = iXY2cIndex(iy);
996  int iZ0 = id.zside()>0?1:0;
997 
998  if(!eeRuActive_[iZ0][iX0/scEdge][iY0/scEdge]){
999  ++nRuPerDcc_[dccNum(id)];
1000  eeRuActive_[iZ0][iX0/scEdge][iY0/scEdge] = true;
1001  }
1002 
1004 
1005  if(srf == srFlagColl.end()){
1006  return;
1007  }
1008 
1009  int ttix = srf->id().ix();
1010  int ttiy = srf->id().iy();
1011 
1012  int zside = srf->id().zside();
1013 
1014  int ttiz = ( zside < 0 ) ? 0 : 1;
1015 
1016  nCrySC[ttix-1][ttiy-1][ttiz]++;
1017 
1018  int itcc = Numbers::iTCC( ism, EcalEndcap, ix, iy );
1019  int itt = Numbers::iTT( ism, EcalEndcap, ix, iy );
1020  nCryTT[itcc-1][itt-1]++;
1021 
1022  bool highInterest = ((srf->value() & ~EcalSrFlag::SRF_FORCED_MASK)
1024 
1025  int dccZsFIRval = dccZsFIR(frame, firWeights_, firstFIRSample_, 0);
1026 
1027  if ( ism >= 1 && ism <= 9 ) {
1028  if(highInterest) {
1029  ++nEeHI_[0];
1030  // if(statusCode != 9) EEHighInterestZsFIR_[0]->Fill( dccZsFIRval );
1031  EEHighInterestZsFIR_[0]->Fill( dccZsFIRval );
1032  } else{ //low interest
1033  ++nEeLI_[0];
1034  // if(statusCode != 9) EELowInterestZsFIR_[0]->Fill( dccZsFIRval );
1035  EELowInterestZsFIR_[0]->Fill( dccZsFIRval );
1036  }
1037  } else {
1038  if(highInterest) {
1039  ++nEeHI_[1];
1040  EEHighInterestZsFIR_[1]->Fill( dccZsFIRval );
1041  } else{ //low interest
1042  ++nEeLI_[1];
1043  EELowInterestZsFIR_[1]->Fill( dccZsFIRval );
1044  }
1045  }
1046  int isc = Numbers::iSC( ism, EcalEndcap, ix, iy );
1047  ++nPerDcc_[dccNum(id)-1];
1048  ++nPerRu_[dccNum(id)-1][isc];
1049  }
1050 
1051 }
1052 
1054  nEe_[0] = 0;
1055  nEeLI_[0] = 0;
1056  nEeHI_[0] = 0;
1057  nEe_[1] = 0;
1058  nEeLI_[1] = 0;
1059  nEeHI_[1] = 0;
1060  bzero(nPerDcc_, sizeof(nPerDcc_));
1061  bzero(nRuPerDcc_, sizeof(nRuPerDcc_));
1062  bzero(eeRuActive_, sizeof(eeRuActive_));
1063 
1064  for(int idcc=0; idcc<nECALDcc; idcc++) {
1065  for(int isc=0; isc<nDccChs; isc++) {
1066  nPerRu_[idcc][isc] = 0;
1067  }
1068  }
1069 
1070  for(int iz = 0; iz<2; iz++) {
1071  for(int ix = 0; ix < 20; ix++ ) {
1072  for(int iy = 0; iy < 20; iy++ ) {
1073  nCrySC[ix][iy][iz] = 0;
1074  }
1075  }
1076  }
1077 
1078  for (int itcc = 0; itcc < 108; itcc++) {
1079  for (int itt = 0; itt < 41; itt++) nCryTT[itcc][itt] = 0;
1080  }
1081 
1082 }
1083 
1084 const EcalScDetId
1086  if (xtalId.ix() > 40 && xtalId.ix() < 61 &&
1087  xtalId.iy() > 40 && xtalId.iy() < 61) {
1088  // crystal belongs to an inner partial supercrystal
1089  return Numbers::getEcalScDetId(xtalId);
1090  } else {
1091  return EcalScDetId((xtalId.ix()-1)/5+1, (xtalId.iy()-1)/5+1, xtalId.zside());
1092  }
1093 }
1094 
1095 unsigned EESelectiveReadoutTask::dccNum(const DetId& xtalId) const {
1096  int j;
1097  int k;
1098 
1099  if ( xtalId.det()!=DetId::Ecal ) {
1100  throw cms::Exception("EESelectiveReadoutTask") << "Crystal does not belong to ECAL";
1101  }
1102 
1103  int iDet = 0;
1104 
1105  if(xtalId.subdetId()==EcalEndcap){
1106  EEDetId eeDetId(xtalId);
1107  j = iXY2cIndex(eeDetId.ix());
1108  k = iXY2cIndex(eeDetId.iy());
1109  int zside = eeDetId.zside();
1110  if ( zside < 0 ) iDet = 0;
1111  else iDet = 2;
1112  } else {
1113  throw cms::Exception("EESelectiveReadoutTask") << "Not ECAL endcap.";
1114  }
1115  int iDcc0 = dccIndex(iDet,j,k);
1116  assert(iDcc0>=0 && iDcc0<nECALDcc);
1117  return iDcc0+1;
1118 }
1119 
1121  int j;
1122  int k;
1123 
1124  if ( scId.det()!=DetId::Ecal ) {
1125  throw cms::Exception("EESelectiveReadoutTask") << "SuperCrystal does not belong to ECAL";
1126  }
1127 
1128  int iDet = 0;
1129 
1130  if(scId.subdetId()==EcalEndcap){
1131  j = scId.ix()-1;
1132  k = scId.iy()-1;
1133  int zside = scId.zside();
1134  if ( zside < 0 ) iDet = 0;
1135  else iDet = 2;
1136  } else {
1137  throw cms::Exception("EESelectiveReadoutTask") << "Not ECAL endcap.";
1138  }
1139  int iDcc0 = 0;
1140  int iPhi = dccPhiIndexOfRU(j,k);
1141  if(iPhi<0) iDcc0 = -1;
1142  else iDcc0 = iPhi+iDet/2*45;
1143  assert(iDcc0>=0 && iDcc0<nECALDcc);
1144  return iDcc0+1;
1145 }
1146 
1147 double EESelectiveReadoutTask::getEeEventSize(double nReadXtals) const {
1148  double ruHeaderPayload = 0.;
1149  const int firstEbDcc0 = nEEDcc/2;
1150  for ( int iDcc0 = 0; iDcc0 < nECALDcc; ++iDcc0 ) {
1151  //skip barrel:
1152  if(iDcc0 == firstEbDcc0) iDcc0 += nEBDcc;
1153  ruHeaderPayload += nRuPerDcc_[iDcc0]*8.;
1154  }
1155  return getDccOverhead(EE)*nEEDcc +
1156  nReadXtals*bytesPerCrystal +
1157  ruHeaderPayload;
1158 }
1159 
1161  char flag=endcapDccMap[i+j*20];
1162  return (flag==' ')?-1:(flag-'0');
1163 }
1164 
1165 int EESelectiveReadoutTask::dccIndex(int iDet, int i, int j) const {
1166  int iPhi = dccPhiIndex(i, j);
1167  if(iPhi<0) return -1;
1168  //34 DCCs in barrel and 8 in EE-=>in EE+ DCC numbering starts at 45,
1169  //iDet/2 is 0 for EE- and 1 for EE+:
1170  return iPhi+iDet/2*45;
1171 }
1172 
1173 //This implementation assumes that int is coded on at least 28-bits,
1174 //which in pratice should be always true.
1175 int
1177  const std::vector<int>& firWeights,
1178  int firstFIRSample,
1179  bool* saturated){
1180  const int nFIRTaps = 6;
1181  //FIR filter weights:
1182  const std::vector<int>& w = firWeights;
1183 
1184  //accumulator used to compute weighted sum of samples
1185  int acc = 0;
1186  bool gain12saturated = false;
1187  const int gain12 = 0x01;
1188 
1189  int iWeight = 0;
1190  for(int i = -1; i < nFIRTaps - 1; ++i, ++iWeight){
1191  int iSample(firstFIRSample + i);
1192  if(iSample>=0 && iSample < frame.size()){
1193  EcalMGPASample sample(frame[iSample]);
1194  if(sample.gainId()!=gain12) gain12saturated = true;
1195  LogTrace("DccFir") << (iSample>=firstFIRSample?"+":"") << sample.adc()
1196  << "*(" << w[iWeight] << ")";
1197  acc+=sample.adc()*w[iWeight];
1198  } else{
1199  edm::LogWarning("DccFir") << __FILE__ << ":" << __LINE__ <<
1200  ": Not enough samples in data frame or 'ecalDccZs1stSample' module "
1201  "parameter is not valid...";
1202  }
1203  }
1204  LogTrace("DccFir") << "\n";
1205  //discards the 8 LSBs
1206  //(shift operator cannot be used on negative numbers because
1207  // the result depends on compilator implementation)
1208  acc = (acc>=0)?(acc >> 8):-(-acc >> 8);
1209  //ZS passed if weighted sum acc above ZS threshold or if
1210  //one sample has a lower gain than gain 12 (that is gain 12 output
1211  //is saturated)
1212 
1213  LogTrace("DccFir") << "acc: " << acc << "\n"
1214  << "saturated: " << (gain12saturated?"yes":"no") << "\n";
1215 
1216  if(saturated){
1217  *saturated = gain12saturated;
1218  }
1219 
1220  return gain12saturated?std::numeric_limits<int>::max():acc;
1221 }
1222 
1223 std::vector<int>
1224 EESelectiveReadoutTask::getFIRWeights(const std::vector<double>&
1225  normalizedWeights){
1226  const int nFIRTaps = 6;
1227  std::vector<int> firWeights(nFIRTaps, 0); //default weight: 0;
1228  const static int maxWeight = 0xEFF; //weights coded on 11+1 signed bits
1229  for(unsigned i=0; i < std::min((size_t)nFIRTaps,normalizedWeights.size()); ++i){
1230  firWeights[i] = lround(normalizedWeights[i] * (1<<10));
1231  if(std::abs(firWeights[i])>maxWeight){//overflow
1232  firWeights[i] = firWeights[i]<0?-maxWeight:maxWeight;
1233  }
1234  }
1235  return firWeights;
1236 }
1237 
1238 void
1239 EESelectiveReadoutTask::configFirWeights(std::vector<double> weightsForZsFIR){
1240  bool notNormalized = false;
1241  bool notInt = false;
1242  for(unsigned i=0; i < weightsForZsFIR.size(); ++i){
1243  if(weightsForZsFIR[i] > 1.) notNormalized = true;
1244  if((int)weightsForZsFIR[i]!=weightsForZsFIR[i]) notInt = true;
1245  }
1246  if(notInt && notNormalized){
1247  throw cms::Exception("InvalidParameter")
1248  << "weigtsForZsFIR paramater values are not valid: they "
1249  << "must either be integer and uses the hardware representation "
1250  << "of the weights or less or equal than 1 and used the normalized "
1251  << "representation.";
1252  }
1253  edm::LogInfo log("DccFir");
1254  if(notNormalized){
1255  firWeights_ = std::vector<int>(weightsForZsFIR.size());
1256  for(unsigned i = 0; i< weightsForZsFIR.size(); ++i){
1257  firWeights_[i] = (int)weightsForZsFIR[i];
1258  }
1259  } else{
1260  firWeights_ = getFIRWeights(weightsForZsFIR);
1261  }
1262 
1263  log << "Input weights for FIR: ";
1264  for(unsigned i = 0; i < weightsForZsFIR.size(); ++i){
1265  log << weightsForZsFIR[i] << "\t";
1266  }
1267 
1268  double s2 = 0.;
1269  log << "\nActual FIR weights: ";
1270  for(unsigned i = 0; i < firWeights_.size(); ++i){
1271  log << firWeights_[i] << "\t";
1272  s2 += firWeights_[i]*firWeights_[i];
1273  }
1274 
1275  s2 = sqrt(s2);
1276  log << "\nNormalized FIR weights after hw representation rounding: ";
1277  for(unsigned i = 0; i < firWeights_.size(); ++i){
1278  log << firWeights_[i] / (double)(1<<10) << "\t";
1279  }
1280 
1281  log <<"\nFirst FIR sample: " << firstFIRSample_;
1282 }
1283 
1284 int EESelectiveReadoutTask::getCrystalCount(int iDcc, int iDccCh) {
1285  if(iDcc<1 || iDcc>54) {
1286  // invalid DCC
1287  return 0;
1288  } else if (10 <= iDcc && iDcc <= 45) {
1289  // EB
1290  return 25;
1291  } else {
1292  // EE
1293  int iDccPhi;
1294  if(iDcc < 10) {
1295  iDccPhi = iDcc;
1296  } else {
1297  iDccPhi = iDcc - 45;
1298  }
1299  switch(iDccPhi*100+iDccCh){
1300  case 110:
1301  case 232:
1302  case 312:
1303  case 412:
1304  case 532:
1305  case 610:
1306  case 830:
1307  case 806:
1308  //inner partials at 12, 3, and 9 o'clock
1309  return 20;
1310  case 134:
1311  case 634:
1312  case 827:
1313  case 803:
1314  return 10;
1315  case 330:
1316  case 430:
1317  return 20;
1318  case 203:
1319  case 503:
1320  case 721:
1321  case 921:
1322  return 21;
1323  default:
1324  return 25;
1325  }
1326  }
1327 }
int nEvtFullReadout[20][20][2]
To store the events with full readout.
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const std::string & getName(void) const
get name of ME
static std::string sEE(const unsigned ism)
Definition: Numbers.cc:226
int i
Definition: DBlmapReader.cc:9
void beginRun(const edm::Run &r, const edm::EventSetup &c)
BeginRun.
void setBinContent(int binx, double content)
set content of bin (1-D)
long int flag
Definition: mlp_lapack.h:47
int ix() const
Definition: EEDetId.h:71
MonitorElement * EEFullReadoutSRFlagCount_[2]
EESelectiveReadoutTask(const edm::ParameterSet &ps)
Constructor.
MonitorElement * EEReadoutUnitForcedBitMap_[2]
double getDccOverhead(subdet_t subdet) const
MonitorElement * EELowInterestZsFIR_[2]
MonitorElement * EEDroppedFRCount_[2]
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
MonitorElement * EETowerSize_[2]
void configFirWeights(std::vector< double > weightsForZsFIR)
static const int SRF_ZS2
Definition: EcalSrFlag.h:22
const self & getMap() const
Some &quot;id&quot; conversions.
static const int SRF_FORCED_MASK
Definition: EcalSrFlag.h:30
static const int nECALDcc
Constants.
int nEvtZSReadout[20][20][2]
To store the events with ZS1 or ZS2 readout.
std::vector< T >::const_iterator const_iterator
int getCrystalCount(int iDcc, int iDccCh)
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
#define abs(x)
Definition: mlp_lapack.h:159
std::vector< std::vector< float > > dccNormalizedWeights_
MonitorElement * EEZeroSuppression1SRFlagMap_[2]
#define min(a, b)
Definition: mlp_lapack.h:161
MonitorElement * EEHighInterestZsFIR_[2]
int nEvtAnyInterest[100][100][2]
To store the events with any interest.
int nEvtDroppedReadoutIfFR[20][20][2]
To store the events with 0 channels readout when FR is requested.
int gainId() const
get the gainId (2 bits)
static const int nDccChs
maximum number of RUs read by a DCC
virtual ~EESelectiveReadoutTask()
Destructor.
MonitorElement * EECompleteZSMap_[2]
int nEvtCompleteReadoutIfZS[20][20][2]
To store the events with complete readout when ZS is requested.
static const char endcapDccMap[401]
int size() const
Definition: EcalDataFrame.h:27
MonitorElement * EETTFMismatch_[2]
int nPerRu_[nECALDcc][nDccChs]
MonitorElement * EEEventSize_[2]
tuple s2
Definition: indexGen.py:106
void Fill(long long x)
int nEvtLowInterest[100][100][2]
To store the events with low interest TT.
int dccIndex(int iDet, int i, int j) const
static std::vector< DetId > * crystals(const EcalTrigTowerDetId &id)
Definition: Numbers.cc:585
MonitorElement * EEHighInterestPayload_[2]
MonitorElement * EEHighInterestTriggerTowerFlagMap_[2]
uint16_t getStatusCode() const
double getEeEventSize(double nReadXtals) const
static unsigned iTCC(const unsigned ism, const EcalSubdetector subdet, const unsigned i1, const unsigned i2)
Definition: Numbers.cc:534
const T & max(const T &a, const T &b)
int ix() const
Definition: EcalScDetId.h:72
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
static unsigned iSC(const EcalScDetId &id)
Definition: Numbers.cc:437
T sqrt(T t)
Definition: SSEVec.h:46
void removeElement(const std::string &name)
Definition: DQMStore.cc:2572
int zside() const
Definition: EEDetId.h:65
static const int SRF_FULL
Definition: EcalSrFlag.h:25
int j
Definition: DBlmapReader.cc:9
edm::InputTag EcalTrigPrimDigiCollection_
MonitorElement * EEDccEventSizeMap_
int iy() const
Definition: EEDetId.h:77
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1031
bool eeRuActive_[nEndcaps][nEeX/scEdge][nEeY/scEdge]
std::string getName(Reflex::Type &cc)
Definition: ClassFiller.cc:18
void anaDigi(const EEDataFrame &frame, const EESrFlagCollection &srFlagColl, uint16_t statusCode)
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
#define LogTrace(id)
int iy() const
Definition: EcalScDetId.h:78
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
static const int SRF_ZS1
Definition: EcalSrFlag.h:19
key_type id() const
Definition: EEDataFrame.h:29
void endRun(const edm::Run &r, const edm::EventSetup &c)
EndRun.
int nEvtRUForced[20][20][2]
To store the events with RU forced.
int k[5][pyjets_maxn]
const_iterator end() const
MonitorElement * EETTFlags_[2]
Definition: DetId.h:20
static void initGeometry(const edm::EventSetup &setup, bool verbose=false)
Definition: Numbers.cc:50
int dccPhiIndexOfRU(int i, int j) const
const T & get() const
Definition: EventSetup.h:55
std::vector< Item >::const_iterator const_iterator
T const * product() const
Definition: ESHandle.h:62
int zside() const
Definition: EcalScDetId.h:66
unsigned dccNum(const DetId &xtalId) const
int nEvtMediumInterest[100][100][2]
To store the events with medium interest TT.
void beginJob(void)
BeginJob.
int nEvtZS1Readout[20][20][2]
To store the events with ZS1 readout.
int nEvtHighInterest[100][100][2]
To store the events with high interest TT.
int nCrySC[20][20][2]
To store the readout crystals / SC.
const EcalSRSettings * settings_
unsigned dccNumOfRU(const EcalScDetId &scId) const
std::vector< int > firWeights_
edm::InputTag EEUnsuppressedDigiCollection_
iterator find(key_type k)
#define begin
Definition: vmac.h:31
static unsigned iSM(const unsigned ism, const EcalSubdetector subdet)
Definition: Numbers.cc:246
MonitorElement * EECompleteZSCount_[2]
const_iterator find(uint32_t rawId) const
MonitorElement * EEDroppedFRMap_[2]
const_iterator end() const
static std::vector< int > getFIRWeights(const std::vector< double > &normalizedWeights)
static const EcalScDetId getEcalScDetId(const EEDetId &id)
Definition: Numbers.cc:679
int nEvtAnyReadout[20][20][2]
To store the events with any readout.
MonitorElement * EELowInterestPayload_[2]
static EcalSubdetector subDet(const EBDetId &id)
Definition: Numbers.cc:145
const EcalScDetId readOutUnitOf(const EEDetId &xtalId) const
tuple status
Definition: ntuplemaker.py:245
TH2F * getTH2F(void) const
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
Detector det() const
get the detector field from this detid
Definition: DetId.h:37
MonitorElement * EELowInterestTriggerTowerFlagMap_[2]
static const int scEdge
Number of crystals along a supercrystal edge.
int ism(int ieta, int iphi)
Definition: EcalPyUtils.cc:56
int dccPhiIndex(int i, int j) const
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)
static const int bytesPerCrystal
Number of bytes per crystal.
MonitorElement * EEMediumInterestTriggerTowerFlagMap_[2]
tuple size
Write out results.
static int dccZsFIR(const EcalDataFrame &frame, const std::vector< int > &firWeights, int firstFIRSample, bool *saturated=0)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
static unsigned iTT(const unsigned ism, const EcalSubdetector subdet, const unsigned i1, const unsigned i2)
Definition: Numbers.cc:485
Definition: Run.h:33
int adc() const
get the ADC sample (12 bits)
MonitorElement * EEFullReadoutSRFlagMap_[2]
T w() const
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