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)
 
 ~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 &)
 
 DQWorker ()
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
const EcalDQMSetupObjects getEcalDQMSetupObjects ()
 
const EcalElectronicsMappingGetElectronicsMap ()
 
const CaloGeometryGetGeometry ()
 
const std::string & getName () const
 
const CaloTopologyGetTopology ()
 
const EcalTrigTowerConstituentsMapGetTrigTowerMap ()
 
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 setTime (time_t _t)
 
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 }
 
enum  Quality {
  kBad = 0, kGood = 1, kUnknown = 2, kMBad = 3,
  kMGood = 4, kMUnknown = 5
}
 
- 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)
 
- 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.

13  qualitySummaries_.insert("QualitySummary");
14  qualitySummaries_.insert("ReportSummaryMap");
15  qualitySummaries_.insert("ReportSummaryContents");
16  qualitySummaries_.insert("ReportSummary");
17  }

References ecaldqm::DQWorkerClient::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.

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
107  uint32_t mask(1 << EcalDQMStatusHelper::STATUS_FLAG_ERROR);
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()

References ecaldqm::MESetCollection::at(), ecaldqm::dccId(), EcalBarrel, EcalEndcap, fedBadFraction_, DivergingColor::frac, ecaldqm::MESet::getBinContent(), ecaldqm::DQWorker::getEcalDQMSetupObjects(), ecaldqm::DQWorker::GetElectronicsMap(), ecaldqm::DQWorker::GetTrigTowerMap(), triggerObjects_cff::id, ecaldqm::DQWorkerClient::kBad, ecaldqm::DQWorkerClient::kGood, ecaldqm::DQWorkerClient::kMUnknown, ecaldqm::DQWorkerClient::kUnknown, 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_().

◆ resetMEs()

void ecaldqm::SummaryClient::resetMEs ( )
overridevirtual

Reimplemented from ecaldqm::DQWorkerClient.

Definition at line 34 of file SummaryClient.cc.

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  }

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

◆ setParams()

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

Reimplemented from ecaldqm::DQWorker.

Definition at line 19 of file SummaryClient.cc.

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  }

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

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().

ecaldqm::DQWorkerClient::using_
bool using_(std::string const &_name, ProcessType _type=kJob) const
Definition: DQWorkerClient.h:43
mps_update.status
status
Definition: mps_update.py:69
ecaldqm::MESet::setBinContent
virtual void setBinContent(EcalDQMSetupObjects const, DetId const &, double)
Definition: MESet.h:79
EBDetId
Definition: EBDetId.h:17
l1extraParticles_cfi._params
_params
Definition: l1extraParticles_cfi.py:29
ecaldqm::DQWorkerClient::statusManager_
StatusManager const * statusManager_
Definition: DQWorkerClient.h:60
EcalDQMStatusHelper::STATUS_FLAG_ERROR
static const int STATUS_FLAG_ERROR
Definition: EcalDQMStatusHelper.h:44
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
ecaldqm::DQWorker::GetElectronicsMap
const EcalElectronicsMapping * GetElectronicsMap()
Definition: DQWorker.cc:104
EcalBarrel
Definition: EcalSubdetector.h:10
DetId
Definition: DetId.h:17
EBDetId::tower
EcalTrigTowerDetId tower() const
get the HCAL/trigger iphi of this crystal
Definition: EBDetId.h:57
ecaldqm::DQWorkerClient::qualitySummaries_
std::set< std::string > qualitySummaries_
Definition: DQWorkerClient.h:56
DivergingColor.frac
float frac
Definition: DivergingColor.py:175
ecaldqm::SummaryClient::towerBadFraction_
float towerBadFraction_
Definition: SummaryClient.h:19
ecaldqm::SummaryClient::fedBadFraction_
float fedBadFraction_
Definition: SummaryClient.h:20
ecaldqm::DQWorker::GetTrigTowerMap
const EcalTrigTowerConstituentsMap * GetTrigTowerMap()
Definition: DQWorker.cc:110
ecaldqm::DQWorkerClient::resetMEs
virtual void resetMEs()
Definition: DQWorkerClient.cc:113
ecaldqm::DQWorker::MEs_
MESetCollection MEs_
Definition: DQWorker.h:104
EEDetId
Definition: EEDetId.h:14
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalEndcap
Definition: EcalSubdetector.h:10
ecaldqm::DQWorkerClient::kUnknown
Definition: DQWorkerClient.h:37
ecaldqm::DQWorkerClient::kBad
Definition: DQWorkerClient.h:37
ecaldqm::DQWorker::onlineMode_
bool onlineMode_
Definition: DQWorker.h:111
ecaldqm::DQWorkerClient::sources_
MESetCollection sources_
Definition: DQWorkerClient.h:55
ecaldqm::MESetCollection::at
MESet & at(const std::string &key)
Definition: MESet.h:399
ecaldqm::DQWorkerClient::kMUnknown
Definition: DQWorkerClient.h:37
ecaldqm::MESetCollection::erase
void erase(const std::string &key)
Definition: MESet.h:390
ecaldqm::DQWorkerClient::DQWorkerClient
DQWorkerClient()
Definition: DQWorkerClient.cc:17
EEDetId::sc
EcalScDetId sc() const
Definition: EEDetId.h:89
ecaldqm::dccId
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
Definition: EcalDQMCommonUtils.cc:16
ecaldqm::DQWorker::getEcalDQMSetupObjects
const EcalDQMSetupObjects getEcalDQMSetupObjects()
Definition: DQWorker.cc:128
ecalMatacq_cfi.timing
timing
Definition: ecalMatacq_cfi.py:26
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
ecaldqm::DQWorkerClient::kGood
Definition: DQWorkerClient.h:37
ecaldqm::nDCC
Definition: EcalDQMCommonUtils.h:91