CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ecaldqm::OccupancyClient Class Reference

#include <OccupancyClient.h>

Inheritance diagram for ecaldqm::OccupancyClient:
ecaldqm::DQWorkerClient ecaldqm::DQWorker

Public Member Functions

 OccupancyClient ()
 
void producePlots (ProcessType) override
 
 ~OccupancyClient () override
 
- Public Member Functions inherited from ecaldqm::DQWorkerClient
void bookMEs (DQMStore::IBooker &) override
 
 DQWorkerClient ()
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void releaseMEs () override
 
void releaseSource ()
 
virtual void resetMEs ()
 
void resetPerLumi ()
 
bool retrieveSource (DQMStore::IGetter &, ProcessType)
 
bool runsOn (ProcessType _type) const
 
void setStatusManager (StatusManager const &_manager)
 
virtual void setTokens (edm::ConsumesCollector &)
 
 ~DQWorkerClient () override
 
- Public Member Functions inherited from ecaldqm::DQWorker
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void beginRun (edm::Run const &, edm::EventSetup const &)
 
bool checkElectronicsMap (bool=true)
 
bool checkGeometry (bool=true)
 
bool checkTopology (bool=true)
 
bool checkTrigTowerMap (bool=true)
 
 DQWorker ()
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
EcalDQMSetupObjects const getEcalDQMSetupObjects ()
 
EcalElectronicsMapping const * GetElectronicsMap ()
 
CaloGeometry const * GetGeometry ()
 
std::string const & getName () const
 
CaloTopology const * GetTopology ()
 
EcalTrigTowerConstituentsMap const * GetTrigTowerMap ()
 
bool onlineMode () const
 
void setEventNumber (edm::EventNumber_t _e)
 
void setLumiNumber (edm::LuminosityBlockNumber_t _l)
 
void setRunNumber (edm::RunNumber_t _r)
 
void setSetupObjects (edm::EventSetup const &)
 
void setSetupObjectsEndLumi (edm::EventSetup const &)
 
void setTime (time_t _t)
 
void setTokens (edm::ConsumesCollector &)
 
virtual ~DQWorker () noexcept(false)
 

Private Member Functions

void setParams (edm::ParameterSet const &) override
 

Private Attributes

float deviationThreshold_
 
int minHits_
 

Additional Inherited Members

- Public Types inherited from ecaldqm::DQWorkerClient
enum  ProcessType { kLumi, kJob, nProcessType }
 
- Static Public Member Functions inherited from ecaldqm::DQWorkerClient
static void fillDescriptions (edm::ParameterSetDescription &)
 
- Static Public Member Functions inherited from ecaldqm::DQWorker
static void fillDescriptions (edm::ParameterSetDescription &_desc)
 
- Public Attributes inherited from ecaldqm::DQWorker
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcdelecMapHandle
 
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcdelecMapHandleEndLumi
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordgeomHandle
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordgeomHandleEndLumi
 
edm::ESGetToken< CaloTopology, CaloTopologyRecordtopoHandle
 
edm::ESGetToken< CaloTopology, CaloTopologyRecordtopoHandleEndLumi
 
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecordttMapHandle
 
edm::ESGetToken< EcalTrigTowerConstituentsMap, IdealGeometryRecordttMapHandleEndLumi
 
- Static Public Attributes inherited from ecaldqm::DQWorkerClient
static constexpr int kBad = 0
 
static constexpr int kGood = 1
 
static constexpr int kMBad = 3
 
static constexpr int kMGood = 4
 
static constexpr int kMUnknown = 5
 
static constexpr int kUnknown = 2
 
- Protected Types inherited from ecaldqm::DQWorker
typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Protected Member Functions inherited from ecaldqm::DQWorkerClient
void setME (edm::ParameterSet const &_ps) final
 
void setSource (edm::ParameterSet const &) override
 
void towerAverage_ (MESet &, MESet const &, float)
 
bool using_ (std::string const &_name, ProcessType _type=kJob) const
 
- Protected Member Functions inherited from ecaldqm::DQWorker
void initialize (std::string const &_name, edm::ParameterSet const &)
 
void print_ (std::string const &, int=0) const
 
void setVerbosity (int _verbosity)
 
- Protected Attributes inherited from ecaldqm::DQWorkerClient
bool hasLumiPlots_
 
std::set< std::string > qualitySummaries_
 
MESetCollection sources_
 
StatusManager const * statusManager_
 
- Protected Attributes inherited from ecaldqm::DQWorker
bool booked_
 
MESetCollection MEs_
 
std::string name_
 
bool onlineMode_
 
Timestamp timestamp_
 
int verbosity_
 
bool willConvertToEDM_
 

Detailed Description

Definition at line 8 of file OccupancyClient.h.

Constructor & Destructor Documentation

◆ OccupancyClient()

ecaldqm::OccupancyClient::OccupancyClient ( )

Definition at line 12 of file OccupancyClient.cc.

References ecaldqm::DQWorkerClient::qualitySummaries_.

13  qualitySummaries_.insert("QualitySummary");
14  }
std::set< std::string > qualitySummaries_

◆ ~OccupancyClient()

ecaldqm::OccupancyClient::~OccupancyClient ( )
inlineoverride

Definition at line 11 of file OccupancyClient.h.

11 {}

Member Function Documentation

◆ producePlots()

void ecaldqm::OccupancyClient::producePlots ( ProcessType  )
overridevirtual

Implements ecaldqm::DQWorkerClient.

Definition at line 21 of file OccupancyClient.cc.

References ecaldqm::MESetCollection::at(), ecaldqm::dccId(), makePileupJSON::denom, EcalTrigTowerDetId::detIdFromDenseIndex(), deviationThreshold_, EcalTriggerTower, ecaldqm::DQWorker::getEcalDQMSetupObjects(), ecaldqm::DQWorker::GetElectronicsMap(), ecaldqm::DQWorker::GetTrigTowerMap(), EcalPhiSymFlatTableProducers_cfi::id, hcalRecHitTable_cff::ieta, EcalTrigTowerDetId::ieta(), ecaldqm::DQWorkerClient::kBad, ecaldqm::DQWorkerClient::kGood, ecaldqm::DQWorkerClient::kMBad, ecaldqm::DQWorkerClient::kMGood, EcalTrigTowerDetId::kSizeForDenseIndexing, ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::mask, ecaldqm::DQWorker::MEs_, minHits_, ecaldqm::nDCC, EcalDQMStatusHelper::PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR, EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_ERROR, EcalDQMStatusHelper::PHYSICS_BAD_CHANNEL_WARNING, quality, ecaldqm::scConstituents(), ecaldqm::DQWorkerClient::sources_, ecaldqm::DQWorkerClient::statusManager_, ecaldqm::MESet::const_iterator::toNextChannel(), and EcalTrigTowerConstituentsMap::towerOf().

21  {
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(GetElectronicsMap()));
50  MESet::const_iterator rItr(GetElectronicsMap(), sRecHitThr);
51  for (MESet::const_iterator dItr(sDigi.beginChannel(GetElectronicsMap())); dItr != dEnd;
52  dItr.toNextChannel(GetElectronicsMap())) {
53  rItr = dItr;
54 
55  float entries(dItr->getBinContent());
56  float rhentries(rItr->getBinContent());
57 
58  DetId id(dItr->getId());
59  int ieta(0);
60  if (id.subdetId() == EcalTriggerTower) // barrel
62  else {
63  std::vector<DetId> ids(scConstituents(EcalScDetId(id)));
64  if (ids.empty())
65  continue;
66  ieta = GetTrigTowerMap()->towerOf(ids[0]).ieta();
67  }
68 
69  unsigned index(ieta < 0 ? ieta + 28 : ieta + 27);
70 
71  digiPhiRingMean[index] += entries;
72  rechitPhiRingMean[index] += rhentries;
73  numCrystals[index] += 1;
74  }
75 
76  for (unsigned ie(0); ie < nPhiRings; ie++) {
77  digiPhiRingMean[ie] /= numCrystals[ie];
78  rechitPhiRingMean[ie] /= numCrystals[ie];
79  }
80 
81  // Store # of entries for Occupancy analysis
82  std::vector<float> Nentries(nDCC, 0.); // digis
83  std::vector<float> Nrhentries(nDCC, 0.); // (filtered) rechits
84 
85  // second round to find hot towers
86  for (MESet::const_iterator dItr(sDigi.beginChannel(GetElectronicsMap())); dItr != dEnd;
87  dItr.toNextChannel(GetElectronicsMap())) {
88  DetId id(dItr->getId());
89 
90  bool doMask(meQualitySummary.maskMatches(id, mask, statusManager_, GetTrigTowerMap()));
91 
92  rItr = dItr;
93 
94  float entries(dItr->getBinContent());
95  float rhentries(rItr->getBinContent());
96 
97  int ieta(0);
98  if (id.subdetId() == EcalTriggerTower) // barrel
100  else {
101  std::vector<DetId> ids(scConstituents(EcalScDetId(id)));
102  if (ids.empty())
103  continue;
104  ieta = GetTrigTowerMap()->towerOf(ids[0]).ieta();
105  }
106 
107  unsigned index(ieta < 0 ? ieta + 28 : ieta + 27);
108 
109  int quality(doMask ? kMGood : kGood);
110 
111  if (entries > minHits_ && entries > digiPhiRingMean[index] * deviationThreshold_) {
112  // meHotDigi->fill(id);
113  quality = doMask ? kMBad : kBad;
114  }
115  if (rhentries > minHits_ && rhentries > rechitPhiRingMean[index] * deviationThreshold_) {
116  // meHotRecHitThr->fill(id);
117  quality = doMask ? kMBad : kBad;
118  }
119 
120  meQualitySummary.setBinContent(getEcalDQMSetupObjects(), id, double(quality));
121 
122  // Keep count of digis & rechits for Occupancy analysis
123  unsigned iDCC(dccId(id, GetElectronicsMap()) - 1);
124  if (entries > minHits_)
125  Nentries[iDCC] += entries;
126  if (rhentries > minHits_)
127  Nrhentries[iDCC] += rhentries;
128  }
129 
130  double tpdigiPhiRingMean[nPhiRings];
131  std::fill_n(tpdigiPhiRingMean, nPhiRings, 0.);
132 
133  for (unsigned iTT(0); iTT < EcalTrigTowerDetId::kSizeForDenseIndexing; ++iTT) {
135  float entries(sTPDigiThr.getBinContent(getEcalDQMSetupObjects(), ttid));
136 
137  unsigned index(ttid.ieta() < 0 ? ttid.ieta() + 28 : ttid.ieta() + 27);
138 
139  tpdigiPhiRingMean[index] += entries;
140  }
141 
142  for (int ie(0); ie < 28; ie++) {
143  float denom(-1.);
144  if (ie < 27)
145  denom = 72.;
146  else
147  denom = 36.;
148  tpdigiPhiRingMean[ie] /= denom;
149  tpdigiPhiRingMean[55 - ie] /= denom;
150  }
151 
152  for (unsigned iTT(0); iTT < EcalTrigTowerDetId::kSizeForDenseIndexing; ++iTT) {
154 
155  float entries(sTPDigiThr.getBinContent(getEcalDQMSetupObjects(), ttid));
156 
157  unsigned index(ttid.ieta() < 0 ? ttid.ieta() + 28 : ttid.ieta() + 27);
158 
159  int quality(kGood);
160 
161  if (entries > minHits_ && entries > tpdigiPhiRingMean[index] * deviationThreshold_) {
162  // meHotTPDigiThr.fill(ttid);
163  quality = kBad;
164  }
165 
166  if (quality != kBad)
167  continue;
168 
169  std::vector<DetId> ids(GetTrigTowerMap()->constituentsOf(ttid));
170  for (unsigned iD(0); iD < ids.size(); ++iD) {
171  DetId& id(ids[iD]);
172 
173  int quality(meQualitySummary.getBinContent(getEcalDQMSetupObjects(), id));
174  if (quality == kMBad || quality == kBad)
175  continue;
176 
177  meQualitySummary.setBinContent(
179  id,
180  meQualitySummary.maskMatches(id, mask, statusManager_, GetTrigTowerMap()) ? kMBad : kBad);
181  }
182  }
183  /* Disabling as it's creating false alarms with whole FEDs RED when few hot towers show up. To be tuned.
184  // Quality check: set entire FED to BAD if its occupancy begins to vanish
185  // Fill FED statistics from (filtered) RecHit Occupancy
186  float meanFEDEB(0), meanFEDEE(0), rmsFEDEB(0), rmsFEDEE(0);
187  unsigned int nFEDEB(0), nFEDEE(0);
188  for (unsigned iDCC(0); iDCC < nDCC; iDCC++) {
189  if (iDCC >= kEBmLow && iDCC <= kEBpHigh) {
190  meanFEDEB += Nrhentries[iDCC];
191  rmsFEDEB += Nrhentries[iDCC] * Nrhentries[iDCC];
192  nFEDEB++;
193  } else {
194  meanFEDEE += Nrhentries[iDCC];
195  rmsFEDEE += Nrhentries[iDCC] * Nrhentries[iDCC];
196  nFEDEE++;
197  }
198  }
199  meanFEDEB /= float(nFEDEB);
200  rmsFEDEB /= float(nFEDEB);
201  meanFEDEE /= float(nFEDEE);
202  rmsFEDEE /= float(nFEDEE);
203  rmsFEDEB = sqrt(abs(rmsFEDEB - meanFEDEB * meanFEDEB));
204  rmsFEDEE = sqrt(abs(rmsFEDEE - meanFEDEE * meanFEDEE));
205  // Analyze FED statistics
206  float meanFED(0.), rmsFED(0.), nRMS(5.);
207  for (MESet::iterator qsItr(meQualitySummary.beginChannel(GetElectronicsMap()));
208  qsItr != meQualitySummary.end(GetElectronicsMap());
209  qsItr.toNextChannel(GetElectronicsMap())) {
210  DetId id(qsItr->getId());
211  unsigned iDCC(dccId(id, GetElectronicsMap()) - 1);
212  if (iDCC >= kEBmLow && iDCC <= kEBpHigh) {
213  meanFED = meanFEDEB;
214  rmsFED = rmsFEDEB;
215  } else {
216  meanFED = meanFEDEE;
217  rmsFED = rmsFEDEE;
218  }
219  float threshold(meanFED < nRMS * rmsFED ? minHits_ : meanFED - nRMS * rmsFED);
220  if (meanFED > 1000. && Nrhentries[iDCC] < threshold)
221  meQualitySummary.setBinContent(
222  getEcalDQMSetupObjects(),
223  id,
224  meQualitySummary.maskMatches(id, mask, statusManager_, GetTrigTowerMap()) ? kMBad : kBad);
225  }
226  */
227  } // producePlots()
static EcalTrigTowerDetId detIdFromDenseIndex(uint32_t di)
static const int PHYSICS_BAD_CHANNEL_WARNING
int ieta() const
get the tower ieta
static constexpr int kSizeForDenseIndexing
MESet & at(const std::string &key)
Definition: MESet.h:401
static constexpr int kGood
static const int PEDESTAL_ONLINE_HIGH_GAIN_RMS_ERROR
static const int PHYSICS_BAD_CHANNEL_ERROR
static constexpr int kMBad
EcalTrigTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
string quality
StatusManager const * statusManager_
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
static constexpr int kBad
MESetCollection sources_
EcalElectronicsMapping const * GetElectronicsMap()
Definition: DQWorker.cc:150
EcalDQMSetupObjects const getEcalDQMSetupObjects()
Definition: DQWorker.cc:170
Definition: DetId.h:17
static constexpr int nDCC
MESetCollection MEs_
Definition: DQWorker.h:131
static constexpr int kMGood
std::vector< DetId > scConstituents(EcalScDetId const &)
EcalTrigTowerConstituentsMap const * GetTrigTowerMap()
Definition: DQWorker.cc:155

◆ setParams()

void ecaldqm::OccupancyClient::setParams ( edm::ParameterSet const &  _params)
overrideprivatevirtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 16 of file OccupancyClient.cc.

References l1extraParticles_cfi::_params, deviationThreshold_, and minHits_.

16  {
17  minHits_ = _params.getUntrackedParameter<int>("minHits");
18  deviationThreshold_ = _params.getUntrackedParameter<double>("deviationThreshold");
19  }

Member Data Documentation

◆ deviationThreshold_

float ecaldqm::OccupancyClient::deviationThreshold_
private

Definition at line 19 of file OccupancyClient.h.

Referenced by producePlots(), and setParams().

◆ minHits_

int ecaldqm::OccupancyClient::minHits_
private

Definition at line 18 of file OccupancyClient.h.

Referenced by producePlots(), and setParams().