CMS 3D CMS Logo

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