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* set(nullptr);
32 
33  switch (_collection) {
34  case kMEMTowerIdErrors:
35  set = &MEs_.at("MEMTowerId");
36  break;
38  set = &MEs_.at("MEMBlockSize");
39  break;
40  case kMEMChIdErrors:
41  set = &MEs_.at("MEMChId");
42  break;
43  case kMEMGainErrors:
44  set = &MEs_.at("MEMGain");
45  break;
46  default:
47  return;
48  }
49 
50  std::for_each(_ids.begin(), _ids.end(), [&](EcalElectronicsIdCollection::value_type const& id) {
51  if (id.towerId() == 69) {
52  edm::LogWarning("EcalDQM")
53  << "PNDiodeTask::runOnErrors : one of the ids in the electronics ID collection is unphysical in lumi "
54  "number "
55  << timestamp_.iLumi << ", event number "
56  << timestamp_
57  .iEvt; // Added March 2018 because some events have this unphysical tower ID and cause the ECAL calibration application to crash.
58  } else {
59  set->fill(EcalElectronicsId(id.dccId(), id.towerId(), 1, id.xtalId()));
60  }
61  });
62  }
63 
65  MESet& meOccupancy(MEs_.at("Occupancy"));
66  MESet& meOccupancySummary(MEs_.at("OccupancySummary"));
67  MESet& mePedestal(MEs_.at("Pedestal"));
68 
69  std::for_each(_digis.begin(), _digis.end(), [&](EcalPnDiodeDigiCollection::value_type const& digi) {
70  const EcalPnDiodeDetId& id(digi.id());
71 
72  if (!enable_[dccId(id) - 1])
73  return;
74 
75  meOccupancy.fill(id);
76  meOccupancySummary.fill(id);
77 
78  for (int iSample(0); iSample < 4; iSample++) {
79  if (digi.sample(iSample).gainId() != 1)
80  break;
81  mePedestal.fill(id, double(digi.sample(iSample).adc()));
82  }
83  });
84  }
85 
87 } // namespace ecaldqm
edm::EDCollection::begin
const_iterator begin() const
Definition: EDCollection.h:117
edm::EDCollection::value_type
T value_type
Definition: EDCollection.h:18
MessageLogger.h
ecaldqm::PNDiodeTask
Definition: PNDiodeTask.h:13
ecaldqm
Definition: DQWorker.h:24
ecaldqm::PNDiodeTask::runOnPnDigis
void runOnPnDigis(EcalPnDiodeDigiCollection const &)
Definition: PNDiodeTask.cc:64
ecaldqm::kMEMChIdErrors
Definition: Collections.h:21
Reconstruction_hiPF_cff.enable
enable
Definition: Reconstruction_hiPF_cff.py:84
edm::SortedCollection
Definition: SortedCollection.h:49
ecaldqm::PNDiodeTask::enable_
bool enable_[ecaldqm::nDCC]
Definition: PNDiodeTask.h:26
EcalPnDiodeDetId
Definition: EcalPnDiodeDetId.h:22
EcalDCCHeaderBlock::LED_GAP
Definition: EcalDCCHeaderBlock.h:45
EcalDCCHeaderBlock::TESTPULSE_GAP
Definition: EcalDCCHeaderBlock.h:43
EcalDCCHeaderBlock::LASER_GAP
Definition: EcalDCCHeaderBlock.h:42
ecaldqm::MESet::fill
virtual void fill(DetId const &, double=1., double=1., double=1.)
Definition: MESet.h:46
EcalDCCHeaderBlock::LASER_STD
Definition: EcalDCCHeaderBlock.h:26
ecaldqm::DQWorkerTask
Definition: DQWorkerTask.h:71
edm::SortedCollection::begin
const_iterator begin() const
Definition: SortedCollection.h:262
EcalDCCHeaderBlock::PEDESTAL_GAP
Definition: EcalDCCHeaderBlock.h:44
ecaldqm::PNDiodeTask::runOnErrors
void runOnErrors(EcalElectronicsIdCollection const &, Collections)
Definition: PNDiodeTask.cc:27
EcalDCCHeaderBlock::TESTPULSE_MGPA
Definition: EcalDCCHeaderBlock.h:30
EcalElectronicsId
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
Definition: EcalElectronicsId.h:18
ecaldqm::DQWorker::MEs_
MESetCollection MEs_
Definition: DQWorker.h:78
edm::LogWarning
Definition: MessageLogger.h:141
edm::EDCollection::empty
bool empty() const
Definition: EDCollection.h:77
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
ecaldqm::PNDiodeTask::filterRunType
bool filterRunType(short const *) override
Definition: PNDiodeTask.cc:10
ecaldqm::Collections
Collections
Definition: Collections.h:8
EcalDCCHeaderBlock::PEDESTAL_STD
Definition: EcalDCCHeaderBlock.h:31
ecaldqm::PNDiodeTask::PNDiodeTask
PNDiodeTask()
Definition: PNDiodeTask.cc:8
edm::EDCollection
Definition: EDCollection.h:16
ecaldqm::kMEMBlockSizeErrors
Definition: Collections.h:20
ecaldqm::DQWorker::Timestamp::iLumi
edm::LuminosityBlockNumber_t iLumi
Definition: DQWorker.h:35
ecaldqm::towerId
unsigned towerId(DetId const &)
Definition: EcalDQMCommonUtils.cc:79
edm::SortedCollection::value_type
T value_type
Definition: SortedCollection.h:77
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
ecaldqm::kMEMGainErrors
Definition: Collections.h:22
ecaldqm::DQWorker::timestamp_
Timestamp timestamp_
Definition: DQWorker.h:81
ecaldqm::kMEMTowerIdErrors
Definition: Collections.h:19
Exception.h
ecaldqm::nDCC
Definition: EcalDQMCommonUtils.h:92
ecaldqm::DQWorker::Timestamp::iEvt
edm::EventNumber_t iEvt
Definition: DQWorker.h:36
DEFINE_ECALDQM_WORKER
#define DEFINE_ECALDQM_WORKER(TYPE)
Definition: DQWorker.h:112
EcalDCCHeaderBlock::LED_STD
Definition: EcalDCCHeaderBlock.h:34
edm::EDCollection::end
const_iterator end() const
Definition: EDCollection.h:122
ecaldqm::MESet
Definition: MESet.h:27
ecaldqm::dccId
unsigned dccId(DetId const &)
Definition: EcalDQMCommonUtils.cc:16
PNDiodeTask.h