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 ()
 
- 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 ()
 
bool retrieveSource (DQMStore::IGetter &, ProcessType)
 
bool runsOn (ProcessType _type) const
 
void setStatusManager (StatusManager const &_manager)
 
virtual ~DQWorkerClient ()
 
- 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 &)
 
std::string const & 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 ()(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 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

ecaldqm::SummaryClient::SummaryClient ( )

Definition at line 13 of file SummaryClient.cc.

References ecaldqm::DQWorkerClient::qualitySummaries_.

13  :
16  fedBadFraction_(0.)
17  {
18  qualitySummaries_.insert("QualitySummary");
19  qualitySummaries_.insert("ReportSummaryMap");
20  qualitySummaries_.insert("ReportSummaryContents");
21  qualitySummaries_.insert("ReportSummary");
22  }
std::set< std::string > qualitySummaries_
ecaldqm::SummaryClient::~SummaryClient ( )
inline

Definition at line 11 of file SummaryClient.h.

References producePlots(), resetMEs(), and setParams().

11 {}

Member Function Documentation

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

Implements ecaldqm::DQWorkerClient.

Definition at line 57 of file SummaryClient.cc.

References ecaldqm::dccId(), DEFINE_ECALDQM_WORKER, EcalBarrel, EcalEndcap, fedBadFraction_, cropTnPTrees::frac, ecaldqm::MESet::getBinContent(), triggerObjects_cff::id, ecaldqm::DQWorkerClient::kBad, ecaldqm::DQWorkerClient::kGood, ecaldqm::DQWorkerClient::kMUnknown, ecaldqm::DQWorkerClient::kUnknown, RecoTauDiscriminantConfiguration::mask, ecaldqm::DQWorker::MEs_, ecaldqm::nDCC, ecaldqm::DQWorker::onlineMode_, matplotRender::rawdata, DetId::rawId(), EEDetId::sc(), ecaldqm::DQWorkerClient::sources_, mps_update::status, EcalDQMStatusHelper::STATUS_FLAG_ERROR, ecaldqm::DQWorkerClient::statusManager_, ecaldqm::MESet::iterator::toNextChannel(), EBDetId::tower(), and ecaldqm::DQWorkerClient::using_().

Referenced by ~SummaryClient().

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

Reimplemented from ecaldqm::DQWorkerClient.

Definition at line 38 of file SummaryClient.cc.

References ecaldqm::DQWorker::MEs_, ecaldqm::nDCC, and ecaldqm::DQWorkerClient::resetMEs().

Referenced by ~SummaryClient().

39  {
41 
42  MESet& meReportSummaryContents(MEs_.at("ReportSummaryContents"));
43  MESet& meReportSummary(MEs_.at("ReportSummary"));
44  MESet& meReportSummaryMap(MEs_.at("ReportSummaryMap"));
45 
46  for(unsigned iDCC(0); iDCC < nDCC; ++iDCC){
47  int dccid(iDCC + 1);
48  meReportSummaryContents.fill(dccid, -1.);
49  }
50 
51  meReportSummary.fill(-1.);
52 
53  meReportSummaryMap.reset(-1.);
54  }
MESetCollection MEs_
Definition: DQWorker.h:75
void ecaldqm::SummaryClient::setParams ( edm::ParameterSet const &  _params)
overrideprivatevirtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 25 of file SummaryClient.cc.

References fedBadFraction_, spr::find(), edm::ParameterSet::getUntrackedParameter(), ecaldqm::DQWorkerClient::sources_, AlCaHLTBitMon_QueryRunRegistry::string, and towerBadFraction_.

Referenced by ~SummaryClient().

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

Member Data Documentation

float ecaldqm::SummaryClient::fedBadFraction_
private

Definition at line 20 of file SummaryClient.h.

Referenced by producePlots(), and setParams().

float ecaldqm::SummaryClient::towerBadFraction_
private

Definition at line 19 of file SummaryClient.h.

Referenced by setParams().