CMS 3D CMS Logo

PNDiodeTask.cc
Go to the documentation of this file.
2 
5 
6 namespace ecaldqm {
7 
8  PNDiodeTask::PNDiodeTask() : DQWorkerTask() { std::fill_n(enable_, nDCC, false); }
9 
10  bool PNDiodeTask::filterRunType(short const* _runType) {
11  bool enable(false);
12 
13  for (int iDCC(0); iDCC < 54; iDCC++) {
14  if (_runType[iDCC] == EcalDCCHeaderBlock::LASER_STD || _runType[iDCC] == EcalDCCHeaderBlock::LASER_GAP ||
15  _runType[iDCC] == EcalDCCHeaderBlock::LED_STD || _runType[iDCC] == EcalDCCHeaderBlock::LED_GAP ||
16  _runType[iDCC] == EcalDCCHeaderBlock::TESTPULSE_MGPA || _runType[iDCC] == EcalDCCHeaderBlock::TESTPULSE_GAP ||
17  _runType[iDCC] == EcalDCCHeaderBlock::PEDESTAL_STD || _runType[iDCC] == EcalDCCHeaderBlock::PEDESTAL_GAP) {
18  enable = true;
19  enable_[iDCC] = true;
20  } else
21  enable_[iDCC] = false;
22  }
23 
24  return enable;
25  }
26 
28  if (_ids.empty())
29  return;
30 
31  MESet* meMEMErrors = &MEs_.at("MEMErrors");
32 
33  // MEM Box Integrity Errors (TowerIds 69 and 70)
34  // errorType matches to the following labels in DQM plot
35  // 0 = TOWERID
36  // 1 = BLOCKSIZE
37  // 2 = CHID
38  // 3 = GAIN
39  int errorType(-1);
40  switch (_collection) {
41  case kMEMTowerIdErrors:
42  errorType = 0;
43  break;
45  errorType = 1;
46  break;
47  case kMEMChIdErrors:
48  errorType = 2;
49  break;
50  case kMEMGainErrors:
51  errorType = 3;
52  break;
53  default:
54  return;
55  }
56 
57  // Integrity errors for MEM boxes (towerIds 69/70)
58  // Plot contains two bins per dccId. Integer number
59  // bins correspond to towerId 69 and half integer
60  // number bins correspond to towerId 70.
61  std::for_each(_ids.begin(),
62  _ids.end(),
64  if (id.towerId() == 69)
65  meMEMErrors->fill(getEcalDQMSetupObjects(), id.dccId() + 0.0, errorType);
66  else if (id.towerId() == 70)
67  meMEMErrors->fill(getEcalDQMSetupObjects(), id.dccId() + 0.5, errorType);
68  else {
69  edm::LogWarning("EcalDQM")
70  << "PNDiodeTask::runOnErrors : one of the ids in the electronics ID collection does not "
71  << "correspond to one of the MEM box towerIds (69/70) in lumi number " << timestamp_.iLumi
72  << ", event number " << timestamp_.iEvt;
73  }
74  });
75  }
76 
78  MESet& meOccupancy(MEs_.at("Occupancy"));
79  MESet& meOccupancySummary(MEs_.at("OccupancySummary"));
80  MESet& mePedestal(MEs_.at("Pedestal"));
81 
82  std::for_each(_digis.begin(), _digis.end(), [&](EcalPnDiodeDigiCollection::value_type const& digi) {
83  const EcalPnDiodeDetId& id(digi.id());
84 
85  if (!enable_[dccId(id, GetElectronicsMap()) - 1])
86  return;
87 
88  meOccupancy.fill(getEcalDQMSetupObjects(), id);
89  meOccupancySummary.fill(getEcalDQMSetupObjects(), id);
90 
91  for (int iSample(0); iSample < 4; iSample++) {
92  if (digi.sample(iSample).gainId() != 1)
93  break;
94  mePedestal.fill(getEcalDQMSetupObjects(), id, double(digi.sample(iSample).adc()));
95  }
96  });
97  }
98 
100 } // namespace ecaldqm
void runOnErrors(EcalElectronicsIdCollection const &, Collections)
Definition: PNDiodeTask.cc:27
bool enable_[ecaldqm::nDCC]
Definition: PNDiodeTask.h:26
#define DEFINE_ECALDQM_WORKER(TYPE)
Definition: DQWorker.h:168
edm::LuminosityBlockNumber_t iLumi
Definition: DQWorker.h:48
MESet & at(const std::string &key)
Definition: MESet.h:399
bool filterRunType(short const *) override
Definition: PNDiodeTask.cc:10
void runOnPnDigis(EcalPnDiodeDigiCollection const &)
Definition: PNDiodeTask.cc:77
unsigned towerId(DetId const &, EcalElectronicsMapping const *)
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
virtual void fill(EcalDQMSetupObjects const, DetId const &, double=1., double=1., double=1.)
Definition: MESet.h:74
const_iterator begin() const
enable
Messages.
Definition: DiMuonV_cfg.py:93
const_iterator begin() const
Definition: EDCollection.h:118
const_iterator end() const
EcalElectronicsMapping const * GetElectronicsMap()
Definition: DQWorker.cc:150
EcalDQMSetupObjects const getEcalDQMSetupObjects()
Definition: DQWorker.cc:170
Timestamp timestamp_
Definition: DQWorker.h:134
static constexpr int nDCC
edm::EventNumber_t iEvt
Definition: DQWorker.h:49
MESetCollection MEs_
Definition: DQWorker.h:131
Log< level::Warning, false > LogWarning
const_iterator end() const
Definition: EDCollection.h:123
bool empty() const
Definition: EDCollection.h:78