CMS 3D CMS Logo

OccupancyClient.cc
Go to the documentation of this file.
2 
4 
6 
8 
10 
11 namespace ecaldqm {
12  OccupancyClient::OccupancyClient() : DQWorkerClient(), minHits_(0), deviationThreshold_(0.) {
13  qualitySummaries_.insert("QualitySummary");
14  }
15 
17  minHits_ = _params.getUntrackedParameter<int>("minHits");
18  deviationThreshold_ = _params.getUntrackedParameter<double>("deviationThreshold");
19  }
20 
22  using namespace std;
23 
24  // number of allowed ieta indices
25  // EE-: -28 to -1 with -27, -25 empty
26  // EE+: 1 to 28 with 26, 28 empty
27  unsigned const nPhiRings(56);
28 
29  MESet& meQualitySummary(MEs_.at("QualitySummary"));
30  // MESet& meHotDigi(MEs_.at("HotDigi"));
31  // MESet& meHotRecHitThr(MEs_.at("HotRecHitThr"));
32  // MESet& meHotTPDigiThr(MEs_.at("HotTPDigiThr"));
33 
34  MESet const& sDigi(sources_.at("DigiAll"));
35  MESet const& sRecHitThr(sources_.at("RecHitThrAll"));
36  MESet const& sTPDigiThr(sources_.at("TPDigiThrAll"));
37 
41 
42  double digiPhiRingMean[nPhiRings];
43  std::fill_n(digiPhiRingMean, nPhiRings, 0.);
44  double rechitPhiRingMean[nPhiRings];
45  std::fill_n(rechitPhiRingMean, nPhiRings, 0.);
46  int numCrystals[nPhiRings]; // this is static, but is easier to count now
47  std::fill_n(numCrystals, nPhiRings, 0);
48 
49  MESet::const_iterator dEnd(sDigi.end());
50  MESet::const_iterator rItr(sRecHitThr);
51  for (MESet::const_iterator dItr(sDigi.beginChannel()); dItr != dEnd; dItr.toNextChannel()) {
52  rItr = dItr;
53 
54  float entries(dItr->getBinContent());
55  float rhentries(rItr->getBinContent());
56 
57  DetId id(dItr->getId());
58  int ieta(0);
59  if (id.subdetId() == EcalTriggerTower) // barrel
61  else {
62  std::vector<DetId> ids(scConstituents(EcalScDetId(id)));
63  if (ids.empty())
64  continue;
65  ieta = getTrigTowerMap()->towerOf(ids[0]).ieta();
66  }
67 
68  unsigned index(ieta < 0 ? ieta + 28 : ieta + 27);
69 
70  digiPhiRingMean[index] += entries;
71  rechitPhiRingMean[index] += rhentries;
72  numCrystals[index] += 1;
73  }
74 
75  for (unsigned ie(0); ie < nPhiRings; ie++) {
76  digiPhiRingMean[ie] /= numCrystals[ie];
77  rechitPhiRingMean[ie] /= numCrystals[ie];
78  }
79 
80  // Store # of entries for Occupancy analysis
81  std::vector<float> Nentries(nDCC, 0.); // digis
82  std::vector<float> Nrhentries(nDCC, 0.); // (filtered) rechits
83 
84  // second round to find hot towers
85  for (MESet::const_iterator dItr(sDigi.beginChannel()); dItr != dEnd; dItr.toNextChannel()) {
86  DetId id(dItr->getId());
87 
88  bool doMask(meQualitySummary.maskMatches(id, mask, statusManager_));
89 
90  rItr = dItr;
91 
92  float entries(dItr->getBinContent());
93  float rhentries(rItr->getBinContent());
94 
95  int ieta(0);
96  if (id.subdetId() == EcalTriggerTower) // barrel
98  else {
99  std::vector<DetId> ids(scConstituents(EcalScDetId(id)));
100  if (ids.empty())
101  continue;
102  ieta = getTrigTowerMap()->towerOf(ids[0]).ieta();
103  }
104 
105  unsigned index(ieta < 0 ? ieta + 28 : ieta + 27);
106 
107  int quality(doMask ? kMGood : kGood);
108 
109  if (entries > minHits_ && entries > digiPhiRingMean[index] * deviationThreshold_) {
110  // meHotDigi->fill(id);
111  quality = doMask ? kMBad : kBad;
112  }
113  if (rhentries > minHits_ && rhentries > rechitPhiRingMean[index] * deviationThreshold_) {
114  // meHotRecHitThr->fill(id);
115  quality = doMask ? kMBad : kBad;
116  }
117 
118  meQualitySummary.setBinContent(id, double(quality));
119 
120  // Keep count of digis & rechits for Occupancy analysis
121  unsigned iDCC(dccId(id) - 1);
122  if (entries > minHits_)
123  Nentries[iDCC] += entries;
124  if (rhentries > minHits_)
125  Nrhentries[iDCC] += rhentries;
126  }
127 
128  double tpdigiPhiRingMean[nPhiRings];
129  std::fill_n(tpdigiPhiRingMean, nPhiRings, 0.);
130 
131  for (unsigned iTT(0); iTT < EcalTrigTowerDetId::kSizeForDenseIndexing; ++iTT) {
133  float entries(sTPDigiThr.getBinContent(ttid));
134 
135  unsigned index(ttid.ieta() < 0 ? ttid.ieta() + 28 : ttid.ieta() + 27);
136 
137  tpdigiPhiRingMean[index] += entries;
138  }
139 
140  for (int ie(0); ie < 28; ie++) {
141  float denom(-1.);
142  if (ie < 27)
143  denom = 72.;
144  else
145  denom = 36.;
146  tpdigiPhiRingMean[ie] /= denom;
147  tpdigiPhiRingMean[55 - ie] /= denom;
148  }
149 
150  for (unsigned iTT(0); iTT < EcalTrigTowerDetId::kSizeForDenseIndexing; ++iTT) {
152 
153  float entries(sTPDigiThr.getBinContent(ttid));
154 
155  unsigned index(ttid.ieta() < 0 ? ttid.ieta() + 28 : ttid.ieta() + 27);
156 
157  int quality(kGood);
158 
159  if (entries > minHits_ && entries > tpdigiPhiRingMean[index] * deviationThreshold_) {
160  // meHotTPDigiThr.fill(ttid);
161  quality = kBad;
162  }
163 
164  if (quality != kBad)
165  continue;
166 
167  std::vector<DetId> ids(getTrigTowerMap()->constituentsOf(ttid));
168  for (unsigned iD(0); iD < ids.size(); ++iD) {
169  DetId& id(ids[iD]);
170 
171  int quality(meQualitySummary.getBinContent(id));
172  if (quality == kMBad || quality == kBad)
173  continue;
174 
175  meQualitySummary.setBinContent(id, meQualitySummary.maskMatches(id, mask, statusManager_) ? kMBad : kBad);
176  }
177  }
178 
179  // Quality check: set entire FED to BAD if its occupancy begins to vanish
180  // Fill FED statistics from (filtered) RecHit Occupancy
181  float meanFEDEB(0), meanFEDEE(0), rmsFEDEB(0), rmsFEDEE(0);
182  unsigned int nFEDEB(0), nFEDEE(0);
183  for (unsigned iDCC(0); iDCC < nDCC; iDCC++) {
184  if (iDCC >= kEBmLow && iDCC <= kEBpHigh) {
185  meanFEDEB += Nrhentries[iDCC];
186  rmsFEDEB += Nrhentries[iDCC] * Nrhentries[iDCC];
187  nFEDEB++;
188  } else {
189  meanFEDEE += Nrhentries[iDCC];
190  rmsFEDEE += Nrhentries[iDCC] * Nrhentries[iDCC];
191  nFEDEE++;
192  }
193  }
194  meanFEDEB /= float(nFEDEB);
195  rmsFEDEB /= float(nFEDEB);
196  meanFEDEE /= float(nFEDEE);
197  rmsFEDEE /= float(nFEDEE);
198  rmsFEDEB = sqrt(abs(rmsFEDEB - meanFEDEB * meanFEDEB));
199  rmsFEDEE = sqrt(abs(rmsFEDEE - meanFEDEE * meanFEDEE));
200  // Analyze FED statistics
201  float meanFED(0.), rmsFED(0.), nRMS(5.);
202  for (MESet::iterator qsItr(meQualitySummary.beginChannel()); qsItr != meQualitySummary.end();
203  qsItr.toNextChannel()) {
204  DetId id(qsItr->getId());
205  unsigned iDCC(dccId(id) - 1);
206  if (iDCC >= kEBmLow && iDCC <= kEBpHigh) {
207  meanFED = meanFEDEB;
208  rmsFED = rmsFEDEB;
209  } else {
210  meanFED = meanFEDEE;
211  rmsFED = rmsFEDEE;
212  }
213  float threshold(meanFED < nRMS * rmsFED ? minHits_ : meanFED - nRMS * rmsFED);
214  if (meanFED > 1000. && Nrhentries[iDCC] < threshold)
215  meQualitySummary.setBinContent(id, meQualitySummary.maskMatches(id, mask, statusManager_) ? kMBad : kBad);
216  }
217 
218  } // producePlots()
219 
221 } // namespace ecaldqm
ecaldqm::OccupancyClient::deviationThreshold_
float deviationThreshold_
Definition: OccupancyClient.h:19
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
ecaldqm
Definition: DQWorker.h:24
makePileupJSON.denom
denom
Definition: makePileupJSON.py:147
l1extraParticles_cfi._params
_params
Definition: l1extraParticles_cfi.py:29
ecaldqm::DQWorkerClient::statusManager_
StatusManager const * statusManager_
Definition: DQWorkerClient.h:60
ecaldqm::OccupancyClient::producePlots
void producePlots(ProcessType) override
Definition: OccupancyClient.cc:21
EcalTrigTowerDetId
Definition: EcalTrigTowerDetId.h:14
ecaldqm::MESet::const_iterator::toNextChannel
const_iterator & toNextChannel()
Definition: MESet.cc:404
EcalDQMStatusHelper.h
DetId
Definition: DetId.h:17
ecaldqm::DQWorkerClient::qualitySummaries_
std::set< std::string > qualitySummaries_
Definition: DQWorkerClient.h:56
EcalTrigTowerDetId::kSizeForDenseIndexing
Definition: EcalTrigTowerDetId.h:119
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
ecaldqm::OccupancyClient::setParams
void setParams(edm::ParameterSet const &) override
Definition: OccupancyClient.cc:16
EcalScDetId
Definition: EcalScDetId.h:24
ecaldqm::DQWorkerClient::ProcessType
ProcessType
Definition: DQWorkerClient.h:15
ecaldqm::MESet::iterator::toNextChannel
const_iterator & toNextChannel()
Definition: MESet.h:289
ecaldqm::kEBpHigh
Definition: EcalDQMCommonUtils.h:88
ecaldqm::DQWorker::MEs_
MESetCollection MEs_
Definition: DQWorker.h:78
ecaldqm::DQWorkerClient::kMBad
Definition: DQWorkerClient.h:37
EcalTrigTowerDetId.h
ecaldqm::DQWorkerClient::kBad
Definition: DQWorkerClient.h:37
ecaldqm::OccupancyClient::minHits_
int minHits_
Definition: OccupancyClient.h:18
ecaldqm::DQWorkerClient::sources_
MESetCollection sources_
Definition: DQWorkerClient.h:55
ecaldqm::DQWorkerClient::kMGood
Definition: DQWorkerClient.h:37
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
edm::ParameterSet
Definition: ParameterSet.h:36
ecaldqm::OccupancyClient::OccupancyClient
OccupancyClient()
Definition: OccupancyClient.cc:12
ecaldqm::MESet::iterator
Definition: MESet.h:268
ecaldqm::kEBmLow
Definition: EcalDQMCommonUtils.h:85
ecaldqm::DQWorkerClient
Definition: DQWorkerClient.h:13
EcalTrigTowerDetId::ieta
int ieta() const
get the tower ieta
Definition: EcalTrigTowerDetId.h:44
ecaldqm::getTrigTowerMap
const EcalTrigTowerConstituentsMap * getTrigTowerMap()
Definition: EcalDQMCommonUtils.cc:458
EcalTrigTowerConstituentsMap::towerOf
EcalTrigTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
Definition: EcalTrigTowerConstituentsMap.cc:11
EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_WARNING
static const int PHYSICS_BAD_CHANNEL_WARNING
Definition: EcalDQMStatusHelper.h:46
ecaldqm::scConstituents
std::vector< DetId > scConstituents(EcalScDetId const &)
Definition: EcalDQMCommonUtils.cc:173
EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR
static const int PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR
Definition: EcalDQMStatusHelper.h:25
std
Definition: JetResolutionObject.h:76
EcalTriggerTower
Definition: EcalSubdetector.h:10
ecaldqm::MESet::const_iterator
Definition: MESet.h:245
qcdUeDQM_cfi.quality
quality
Definition: qcdUeDQM_cfi.py:31
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
ecaldqm::DQWorkerClient::kGood
Definition: DQWorkerClient.h:37
EcalTrigTowerDetId::detIdFromDenseIndex
static EcalTrigTowerDetId detIdFromDenseIndex(uint32_t di)
Definition: EcalTrigTowerDetId.cc:104
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
ecaldqm::nDCC
Definition: EcalDQMCommonUtils.h:92
DEFINE_ECALDQM_WORKER
#define DEFINE_ECALDQM_WORKER(TYPE)
Definition: DQWorker.h:112
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ParameterSet.h
OccupancyClient.h
ecaldqm::OccupancyClient
Definition: OccupancyClient.h:8
remoteMonitoring_LED_IterMethod_cfg.threshold
threshold
Definition: remoteMonitoring_LED_IterMethod_cfg.py:426
EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_ERROR
static const int PHYSICS_BAD_CHANNEL_ERROR
Definition: EcalDQMStatusHelper.h:47
EcalDQMCommonUtils.h
ecaldqm::MESet
Definition: MESet.h:27
ecaldqm::dccId
unsigned dccId(DetId const &)
Definition: EcalDQMCommonUtils.cc:16