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

References ecaldqm::MESetCollection::at(), ecaldqm::dccId(), EcalBarrel, EcalEndcap, fedBadFraction_, DivergingColor::frac, ecaldqm::MESet::getBinContent(), 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(dccid, -1.);
44  }
45 
46  meReportSummary.fill(-1.);
47 
48  meReportSummaryMap.reset(-1.);
49  }

References ecaldqm::MESetCollection::at(), 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
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
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::DQWorkerClient::resetMEs
virtual void resetMEs()
Definition: DQWorkerClient.cc:113
ecaldqm::DQWorker::MEs_
MESetCollection MEs_
Definition: DQWorker.h:78
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:85
ecaldqm::DQWorkerClient::sources_
MESetCollection sources_
Definition: DQWorkerClient.h:55
ecaldqm::MESetCollection::at
MESet & at(const std::string &key)
Definition: MESet.h:362
ecaldqm::DQWorkerClient::kMUnknown
Definition: DQWorkerClient.h:37
ecaldqm::MESetCollection::erase
void erase(const std::string &key)
Definition: MESet.h:353
ecaldqm::DQWorkerClient::DQWorkerClient
DQWorkerClient()
Definition: DQWorkerClient.cc:17
EEDetId::sc
EcalScDetId sc() const
Definition: EEDetId.h:89
ecalMatacq_cfi.timing
timing
Definition: ecalMatacq_cfi.py:26
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
ecaldqm::MESet::setBinContent
virtual void setBinContent(DetId const &, double)
Definition: MESet.h:51
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
ecaldqm::DQWorkerClient::kGood
Definition: DQWorkerClient.h:37
ecaldqm::nDCC
Definition: EcalDQMCommonUtils.h:92
ecaldqm::dccId
unsigned dccId(DetId const &)
Definition: EcalDQMCommonUtils.cc:16