CMS 3D CMS Logo

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

#include <SummaryClient.h>

Inheritance diagram for ecaldqm::SummaryClient:
ecaldqm::DQWorkerClient ecaldqm::DQWorker

Public Member Functions

void producePlots (ProcessType) override
 
void resetMEs () override
 
 SummaryClient ()
 
 ~SummaryClient () 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 ()
 
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 fedBadFraction_
 
float towerBadFraction_
 

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 SummaryClient.h.

Constructor & Destructor Documentation

◆ SummaryClient()

ecaldqm::SummaryClient::SummaryClient ( )

Definition at line 12 of file SummaryClient.cc.

References ecaldqm::DQWorkerClient::qualitySummaries_.

13  qualitySummaries_.insert("QualitySummary");
14  qualitySummaries_.insert("ReportSummaryMap");
15  qualitySummaries_.insert("ReportSummaryContents");
16  qualitySummaries_.insert("ReportSummary");
17  }
std::set< std::string > qualitySummaries_

◆ ~SummaryClient()

ecaldqm::SummaryClient::~SummaryClient ( )
inlineoverride

Definition at line 11 of file SummaryClient.h.

11 {}

Member Function Documentation

◆ producePlots()

void ecaldqm::SummaryClient::producePlots ( ProcessType  _pType)
overridevirtual

Implements ecaldqm::DQWorkerClient.

Definition at line 51 of file SummaryClient.cc.

References ecaldqm::MESetCollection::at(), ecaldqm::dccId(), EcalBarrel, EcalEndcap, fedBadFraction_, DivergingColor::frac, ecaldqm::MESet::getBinContent(), ecaldqm::DQWorker::getEcalDQMSetupObjects(), ecaldqm::DQWorker::GetElectronicsMap(), ecaldqm::DQWorker::GetTrigTowerMap(), l1ctLayer2EG_cff::id, ecaldqm::DQWorkerClient::kBad, ecaldqm::DQWorkerClient::kGood, ecaldqm::DQWorkerClient::kMUnknown, ecaldqm::DQWorkerClient::kUnknown, ALPAKA_ACCELERATOR_NAMESPACE::pixelClustering::pixelStatus::mask, ecaldqm::DQWorker::MEs_, ecaldqm::nDCC, ecaldqm::DQWorker::onlineMode_, DetId::rawId(), EEDetId::sc(), ecaldqm::MESet::setBinContent(), ecaldqm::DQWorkerClient::sources_, mps_update::status, EcalDQMStatusHelper::STATUS_FLAG_ERROR, ecaldqm::DQWorkerClient::statusManager_, ecalMatacq_cfi::timing, ecaldqm::MESet::iterator::toNextChannel(), EBDetId::tower(), and ecaldqm::DQWorkerClient::using_().

51  {
52  MESet& meReportSummaryContents(MEs_.at("ReportSummaryContents"));
53  MESet& meReportSummary(MEs_.at("ReportSummary"));
54 
55  for (unsigned iDCC(0); iDCC < nDCC; ++iDCC) {
56  int dccid(iDCC + 1);
57  meReportSummaryContents.fill(getEcalDQMSetupObjects(), dccid, -1.);
58  }
59  meReportSummary.fill(getEcalDQMSetupObjects(), -1.);
60 
61  MESet const& sIntegrityByLumi(sources_.at("IntegrityByLumi"));
62  MESet const& sDesyncByLumi(sources_.at("DesyncByLumi"));
63  MESet const& sFEByLumi(sources_.at("FEByLumi")); // Does NOT include FE=Disabled
64  MESet const& sFEStatusErrMapByLumi(sources_.at("FEStatusErrMapByLumi")); // Includes FE=Disabled
65 
66  double integrityByLumi[nDCC];
67  double rawDataByLumi[nDCC];
68  for (unsigned iDCC(0); iDCC < nDCC; ++iDCC) {
69  integrityByLumi[iDCC] = sIntegrityByLumi.getBinContent(getEcalDQMSetupObjects(), iDCC + 1);
70  rawDataByLumi[iDCC] = sDesyncByLumi.getBinContent(getEcalDQMSetupObjects(), iDCC + 1) +
71  sFEByLumi.getBinContent(getEcalDQMSetupObjects(), iDCC + 1);
72  }
73 
74  MESet& meQualitySummary(MEs_.at("QualitySummary"));
75  MESet& meReportSummaryMap(MEs_.at("ReportSummaryMap"));
76 
77  MESet const* sIntegrity(using_("Integrity") ? &sources_.at("Integrity") : nullptr);
78  MESet const& sRawData(sources_.at("RawData"));
79  MESet const* sPresample(using_("Presample") ? &sources_.at("Presample") : nullptr);
80  MESet const* sTiming(using_("Timing") ? &sources_.at("Timing") : nullptr);
81  MESet const* sTriggerPrimitives(using_("TriggerPrimitives") ? &sources_.at("TriggerPrimitives") : nullptr);
82  MESet const* sHotCell(using_("HotCell") ? &sources_.at("HotCell") : nullptr);
83 
84  float totalChannels(0.);
85  float totalGood(0.), totalGoodRaw(0);
86 
87  double dccChannels[nDCC];
88  std::fill_n(dccChannels, nDCC, 0.);
89  double dccGood[nDCC], dccGoodRaw[nDCC];
90  std::fill_n(dccGood, nDCC, 0.);
91  std::fill_n(dccGoodRaw, nDCC, 0.);
92 
93  std::map<uint32_t, int> badChannelsCount;
94 
95  // Override IntegrityByLumi check if any Desync errors present
96  // Used to set an entire FED to BAD
97  MESet const& sBXSRP(sources_.at("BXSRP"));
98  MESet const& sBXTCC(sources_.at("BXTCC"));
99  std::vector<bool> hasMismatchDCC(nDCC, false);
100  for (unsigned iDCC(0); iDCC < nDCC; ++iDCC) {
101  if (sBXSRP.getBinContent(getEcalDQMSetupObjects(), iDCC + 1) > 50. ||
102  sBXTCC.getBinContent(getEcalDQMSetupObjects(), iDCC + 1) > 50.) // "any" = 50
103  hasMismatchDCC[iDCC] = true;
104  }
105 
106  // Get RawData mask
108 
109  MESet::iterator qEnd(meQualitySummary.end(GetElectronicsMap()));
110  for (MESet::iterator qItr(meQualitySummary.beginChannel(GetElectronicsMap())); qItr != qEnd;
111  qItr.toNextChannel(GetElectronicsMap())) {
112  DetId id(qItr->getId());
113  unsigned iDCC(dccId(id, GetElectronicsMap()) - 1);
114 
115  // Initialize individual Quality Summaries
116  // NOTE: These represent quality over *cumulative* statistics
117  int integrity(sIntegrity ? (int)sIntegrity->getBinContent(getEcalDQMSetupObjects(), id) : kUnknown);
118  int presample(sPresample ? (int)sPresample->getBinContent(getEcalDQMSetupObjects(), id) : kUnknown);
119  int hotcell(sHotCell ? (int)sHotCell->getBinContent(getEcalDQMSetupObjects(), id) : kUnknown);
120  int timing(sTiming ? (int)sTiming->getBinContent(getEcalDQMSetupObjects(), id) : kUnknown);
121  int trigprim(sTriggerPrimitives ? (int)sTriggerPrimitives->getBinContent(getEcalDQMSetupObjects(), id)
122  : kUnknown);
123  int rawdata(sRawData.getBinContent(getEcalDQMSetupObjects(), id));
124 
125  double rawdataLS(sFEStatusErrMapByLumi.getBinContent(getEcalDQMSetupObjects(), id)); // Includes FE=Disabled
126 
127  // If there are no RawData or Integrity errors in this LS, set them back to GOOD
128  //if(integrity == kBad && integrityByLumi[iDCC] == 0.) integrity = kGood;
129  if (integrity == kBad && integrityByLumi[iDCC] == 0. && !hasMismatchDCC[iDCC])
130  integrity = kGood;
131  //if(rawdata == kBad && rawDataByLumi[iDCC] == 0.) rawdata = kGood;
132  if (rawdata == kBad && rawDataByLumi[iDCC] == 0. && rawdataLS == 0.)
133  rawdata = kGood;
134 
135  // Fill Global Quality Summary
136  int status(kGood);
137  if (integrity == kBad || presample == kBad || timing == kBad || rawdata == kBad || trigprim == kBad ||
138  hotcell == kBad)
139  status = kBad;
140  else if (integrity == kUnknown && presample == kUnknown && timing == kUnknown && rawdata == kUnknown &&
141  trigprim == kUnknown)
142  status = kUnknown;
143  // Skip channels with no/low integrity statistics (based on digi occupancy)
144  // Normally, ensures Global Quality and Report Summaries are not filled when stats are still low / channel masked / ECAL not in run
145  // However, problematic FEDs can sometimes drop hits so check that channel is not flagged as BAD elsewhere
146  if (status != kBad && (integrity == kUnknown || integrity == kMUnknown)) {
147  qItr->setBinContent(integrity);
148  if (onlineMode_)
149  continue;
150  }
151  qItr->setBinContent(status);
152 
153  // Keep running count of good/bad channels/towers: Uses cumulative stats.
154  if (status == kBad) {
155  if (id.subdetId() == EcalBarrel)
156  badChannelsCount[EBDetId(id).tower().rawId()] += 1;
157  if (id.subdetId() == EcalEndcap)
158  badChannelsCount[EEDetId(id).sc().rawId()] += 1;
159  } else {
160  dccGood[iDCC] += 1.;
161  totalGood += 1.;
162  }
163  dccChannels[iDCC] += 1.;
164  totalChannels += 1.;
165 
166  // Keep running count of good channels in RawData only: Uses LS stats only.
167  // LS-based reports only use RawData as input to save on having to run other workers
168  bool isMasked(meQualitySummary.maskMatches(id, mask, statusManager_, GetTrigTowerMap()));
169  if (rawdataLS == 0. || isMasked) { // channel != kBad in rawdata
170  dccGoodRaw[iDCC] += 1.;
171  totalGoodRaw += 1.;
172  }
173 
174  } // qItr channel loop
175 
176  // search clusters of bad towers
177  /*if(onlineMode_){
178 
179  // EB
180  for(int iz(-1); iz < 2; iz += 2){
181  for(int ieta(0); ieta < 17; ++ieta){
182  if(iz == 1 && ieta == 0) continue;
183  for(int iphi(1); iphi <= 72; ++iphi){
184  EcalTrigTowerDetId ttids[4];
185  unsigned badTowers(0);
186  for(int deta(0); deta < 2; ++deta){
187  int ttz(ieta == 0 && deta == 0 ? -1 : iz);
188  int tteta(ieta == 0 && deta == 0 ? 1 : ieta + deta);
189  for(int dphi(0); dphi < 2; ++dphi){
190  int ttphi(iphi != 72 ? iphi + dphi : 1);
191  EcalTrigTowerDetId ttid(ttz, EcalBarrel, tteta, ttphi);
192  ttids[deta * 2 + dphi] = ttid;
193 
194  if(badChannelsCount[ttid.rawId()] > towerBadFraction_ * 25.)
195  badTowers += 1;
196  } // dphi
197  } // deta
198  if(badTowers > 2){
199  for(unsigned iD(0); iD < 4; ++iD)
200  dccGood[dccId(ttids[iD]) - 1] = 0.;
201  }
202  } // iphi
203  } // ieta
204  } // iz
205 
206  // EE
207  for(int iz(-1); iz <= 1; iz += 2){
208  for(int ix(1); ix < 20; ++ix){
209  for(int iy(1); iy < 20; ++iy){
210  EcalScDetId scids[4];
211  unsigned badTowers(0);
212  for(int dx(0); dx < 2; ++dx){
213  for(int dy(0); dy < 2; ++dy){
214  if(!EcalScDetId::validDetId(ix + dx, iy + dy, iz)){
215  scids[dx * 2 + dy] = EcalScDetId(0);
216  continue;
217  }
218  EcalScDetId scid(ix + dx, iy + dy, iz);
219  scids[dx * 2 + dy] = scid;
220 
221  if(badChannelsCount[scid.rawId()] > towerBadFraction_ * scConstituents(scid).size())
222  badTowers += 1;
223  } // dy
224  } // dx
225  // contiguous towers bad -> [(00)(11)] [(11)(00)] [(01)(01)] [(10)(10)] []=>x ()=>y
226  if(badTowers > 2){
227  for(unsigned iD(0); iD < 4; ++iD){
228  EcalScDetId& scid(scids[iD]);
229  if(scid.null()) continue;
230  dccGood[dccId(scid) - 1] = 0.;
231  }
232  }
233  } // iy
234  } // ix
235  } // iz
236 
237  } // cluster search */
238 
239  // Fill Report Summaries
240  double nBad(0.);
241  for (unsigned iDCC(0); iDCC < nDCC; ++iDCC) {
242  if (dccChannels[iDCC] < 1.)
243  continue;
244 
245  int dccid(iDCC + 1);
246  float frac(dccGood[iDCC] / dccChannels[iDCC]);
247  float fracRaw(dccGoodRaw[iDCC] / dccChannels[iDCC]);
248  meReportSummaryMap.setBinContent(getEcalDQMSetupObjects(), dccid, frac);
249  float fracLS(onlineMode_ ? frac : fracRaw);
250  meReportSummaryContents.fill(getEcalDQMSetupObjects(), dccid, fracLS); // reported by LS
251 
252  if (1. - frac > fedBadFraction_)
253  nBad += 1.;
254  }
255 
256  float totalGoodLS(onlineMode_ ? totalGood : totalGoodRaw);
257  if (totalChannels > 0.)
258  meReportSummary.fill(getEcalDQMSetupObjects(), totalGoodLS / totalChannels); // reported by LS
259 
260  if (onlineMode_) {
261  if (totalChannels > 0.)
262  MEs_.at("GlobalSummary").setBinContent(getEcalDQMSetupObjects(), 1, totalGood / totalChannels);
263  MEs_.at("NBadFEDs").setBinContent(getEcalDQMSetupObjects(), 1, nBad);
264  }
265 
266  } // producePlots()
virtual void setBinContent(EcalDQMSetupObjects const, DetId const &, double)
Definition: MESet.h:79
MESet & at(const std::string &key)
Definition: MESet.h:399
static constexpr int kGood
static constexpr int kMUnknown
static constexpr int kUnknown
static const int STATUS_FLAG_ERROR
bool using_(std::string const &_name, ProcessType _type=kJob) const
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
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
MESetCollection MEs_
Definition: DQWorker.h:131
EcalScDetId sc() const
Definition: EEDetId.h:89
EcalTrigTowerDetId tower() const
get the HCAL/trigger iphi of this crystal
Definition: EBDetId.h:57
EcalTrigTowerConstituentsMap const * GetTrigTowerMap()
Definition: DQWorker.cc:155

◆ resetMEs()

void ecaldqm::SummaryClient::resetMEs ( )
overridevirtual

Reimplemented from ecaldqm::DQWorkerClient.

Definition at line 34 of file SummaryClient.cc.

References ecaldqm::MESetCollection::at(), ecaldqm::DQWorker::getEcalDQMSetupObjects(), ecaldqm::DQWorker::GetElectronicsMap(), ecaldqm::DQWorker::MEs_, ecaldqm::nDCC, and ecaldqm::DQWorkerClient::resetMEs().

34  {
36 
37  MESet& meReportSummaryContents(MEs_.at("ReportSummaryContents"));
38  MESet& meReportSummary(MEs_.at("ReportSummary"));
39  MESet& meReportSummaryMap(MEs_.at("ReportSummaryMap"));
40 
41  for (unsigned iDCC(0); iDCC < nDCC; ++iDCC) {
42  int dccid(iDCC + 1);
43  meReportSummaryContents.fill(getEcalDQMSetupObjects(), dccid, -1.);
44  }
45 
46  meReportSummary.fill(getEcalDQMSetupObjects(), -1.);
47 
48  meReportSummaryMap.reset(GetElectronicsMap(), -1.);
49  }
MESet & at(const std::string &key)
Definition: MESet.h:399
EcalElectronicsMapping const * GetElectronicsMap()
Definition: DQWorker.cc:150
EcalDQMSetupObjects const getEcalDQMSetupObjects()
Definition: DQWorker.cc:170
static constexpr int nDCC
MESetCollection MEs_
Definition: DQWorker.h:131

◆ setParams()

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

Reimplemented from ecaldqm::DQWorker.

Definition at line 19 of file SummaryClient.cc.

References l1extraParticles_cfi::_params, ecaldqm::MESetCollection::erase(), fedBadFraction_, spr::find(), ecaldqm::DQWorkerClient::sources_, AlCaHLTBitMon_QueryRunRegistry::string, and towerBadFraction_.

19  {
20  towerBadFraction_ = _params.getUntrackedParameter<double>("towerBadFraction");
21  fedBadFraction_ = _params.getUntrackedParameter<double>("fedBadFraction");
22 
23  std::vector<std::string> sourceList(_params.getUntrackedParameter<std::vector<std::string> >("activeSources"));
24  if (std::find(sourceList.begin(), sourceList.end(), "Presample") == sourceList.end())
25  sources_.erase(std::string("Presample"));
26  if (std::find(sourceList.begin(), sourceList.end(), "Timing") == sourceList.end())
27  sources_.erase(std::string("Timing"));
28  if (std::find(sourceList.begin(), sourceList.end(), "TriggerPrimitives") == sourceList.end())
29  sources_.erase(std::string("TriggerPrimitives"));
30  if (std::find(sourceList.begin(), sourceList.end(), "HotCell") == sourceList.end())
31  sources_.erase(std::string("HotCell"));
32  }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
MESetCollection sources_
void erase(const std::string &key)
Definition: MESet.h:390

Member Data Documentation

◆ fedBadFraction_

float ecaldqm::SummaryClient::fedBadFraction_
private

Definition at line 20 of file SummaryClient.h.

Referenced by producePlots(), and setParams().

◆ towerBadFraction_

float ecaldqm::SummaryClient::towerBadFraction_
private

Definition at line 19 of file SummaryClient.h.

Referenced by setParams().