test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 

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 11 of file SummaryClient.cc.

References ecaldqm::DQWorkerClient::qualitySummaries_.

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

Definition at line 11 of file SummaryClient.h.

11 {}

Member Function Documentation

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

Implements ecaldqm::DQWorkerClient.

Definition at line 55 of file SummaryClient.cc.

References ecaldqm::dccId(), EcalBarrel, EcalEndcap, fedBadFraction_, cropTnPTrees::frac, ecaldqm::MESet::getBinContent(), ecaldqm::DQWorkerClient::kBad, ecaldqm::DQWorkerClient::kGood, ecaldqm::DQWorkerClient::kMUnknown, ecaldqm::DQWorkerClient::kUnknown, ecaldqm::DQWorker::MEs_, ecaldqm::nDCC, DetId::null(), ecaldqm::DQWorker::onlineMode_, lumiPlot::rawdata, DetId::rawId(), EEDetId::sc(), ecaldqm::scConstituents(), ecaldqm::DQWorkerClient::sources_, mps_update::status, ecaldqm::MESet::iterator::toNextChannel(), EBDetId::tower(), towerBadFraction_, ecaldqm::DQWorkerClient::using_(), and EcalScDetId::validDetId().

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

Reimplemented from ecaldqm::DQWorkerClient.

Definition at line 36 of file SummaryClient.cc.

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

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

Reimplemented from ecaldqm::DQWorker.

Definition at line 23 of file SummaryClient.cc.

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

24  {
25  towerBadFraction_ = _params.getUntrackedParameter<double>("towerBadFraction");
26  fedBadFraction_ = _params.getUntrackedParameter<double>("fedBadFraction");
27 
28  std::vector<std::string> sourceList(_params.getUntrackedParameter<std::vector<std::string> >("activeSources"));
29  if(std::find(sourceList.begin(), sourceList.end(), "Presample") == sourceList.end()) sources_.erase(std::string("Presample"));
30  if(std::find(sourceList.begin(), sourceList.end(), "Timing") == sourceList.end()) sources_.erase(std::string("Timing"));
31  if(std::find(sourceList.begin(), sourceList.end(), "TriggerPrimitives") == sourceList.end()) sources_.erase(std::string("TriggerPrimitives"));
32  if(std::find(sourceList.begin(), sourceList.end(), "HotCell") == sourceList.end()) sources_.erase(std::string("HotCell"));
33  }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
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 producePlots(), and setParams().