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
 
 SummaryClient ()
 
 ~SummaryClient ()
 
- Public Member Functions inherited from ecaldqm::DQWorkerClient
void bookMEs (DQMStore &) override
 
 DQWorkerClient ()
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void releaseMEs () override
 
void releaseSource ()
 
void resetMEs ()
 
bool retrieveSource (DQMStore const &, ProcessType)
 
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 &)
 
virtual void bookMEs (DQMStore::IBooker &)
 
 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, kRun, 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=kRun) 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
std::set< std::string > qualitySummaries_
 
MESetCollection sources_
 
StatusManager const * statusManager_
 
- Protected Attributes inherited from ecaldqm::DQWorker
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 36 of file SummaryClient.cc.

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

37  {
38  MESet& meReportSummaryContents(MEs_.at("ReportSummaryContents"));
39  MESet& meReportSummary(MEs_.at("ReportSummary"));
40 
41  MESet const& sIntegrityByLumi(sources_.at("IntegrityByLumi"));
42  MESet const& sDesyncByLumi(sources_.at("DesyncByLumi"));
43  MESet const& sFEByLumi(sources_.at("FEByLumi"));
44 
45  // TODO GIVE IMPLEMENTATIONT TO PER-LUMI REPORT
46 
47  for(unsigned iDCC(0); iDCC < nDCC; ++iDCC){
48  int dccid(iDCC + 1);
49  meReportSummaryContents.fill(dccid, 1.);
50  }
51  meReportSummary.fill(1.);
52 
53  if(_pType == kLumi) return;
54 
55  double integrityByLumi[nDCC];
56  double rawDataByLumi[nDCC];
57  for(unsigned iDCC(0); iDCC < nDCC; ++iDCC){
58  integrityByLumi[iDCC] = sIntegrityByLumi.getBinContent(iDCC + 1);
59  rawDataByLumi[iDCC] = sDesyncByLumi.getBinContent(iDCC + 1) + sFEByLumi.getBinContent(iDCC + 1);
60  }
61 
62  MESet& meQualitySummary(MEs_.at("QualitySummary"));
63  MESet& meReportSummaryMap(MEs_.at("ReportSummaryMap"));
64 
65  MESet const& sIntegrity(sources_.at("Integrity"));
66  MESet const& sRawData(sources_.at("RawData"));
67  MESet const* sPresample(using_("Presample") ? &sources_.at("Presample") : 0);
68  MESet const* sTiming(using_("Timing") ? &sources_.at("Timing") : 0);
69  MESet const* sTriggerPrimitives(using_("TriggerPrimitives") ? &sources_.at("TriggerPrimitives") : 0);
70  MESet const* sHotCell(using_("HotCell") ? &sources_.at("HotCell") : 0);
71 
72  float totalChannels(0.);
73  float totalGood(0.);
74 
75  double dccChannels[nDCC];
76  std::fill_n(dccChannels, nDCC, 0.);
77  double dccGood[nDCC];
78  std::fill_n(dccGood, nDCC, 0.);
79 
80  std::map<uint32_t, int> badChannelsCount;
81 
82  MESet::iterator qEnd(meQualitySummary.end());
83  MESet::const_iterator iItr(sIntegrity);
84  for(MESet::iterator qItr(meQualitySummary.beginChannel()); qItr != qEnd; qItr.toNextChannel()){
85 
86  DetId id(qItr->getId());
87  unsigned iDCC(dccId(id) - 1);
88 
89  iItr = qItr;
90 
91  int integrity(iItr->getBinContent());
92 
93  if(integrity == kUnknown){
94  qItr->setBinContent(integrity);
95  continue;
96  }
97 
98  int presample(sPresample ? sPresample->getBinContent(id) : kUnknown);
99  int hotcell(sHotCell ? sHotCell->getBinContent(id) : kUnknown);
100  int timing(sTiming ? sTiming->getBinContent(id) : kUnknown);
101  int trigprim(sTriggerPrimitives ? sTriggerPrimitives->getBinContent(id) : kUnknown);
102 
103  int rawdata(sRawData.getBinContent(id));
104 
105  if(integrity == kBad && integrityByLumi[iDCC] == 0.) integrity = kGood;
106  if(rawdata == kBad && rawDataByLumi[iDCC] == 0.) rawdata = kGood;
107 
108  int status(kGood);
109  if(integrity == kBad || presample == kBad || timing == kBad || rawdata == kBad || trigprim == kBad || hotcell == kBad)
110  status = kBad;
111  else if(integrity == kUnknown && presample == kUnknown && timing == kUnknown && rawdata == kUnknown && trigprim == kUnknown)
112  status = kUnknown;
113 
114  qItr->setBinContent(status);
115 
116  if(status == kBad){
117  if(id.subdetId() == EcalBarrel) badChannelsCount[EBDetId(id).tower().rawId()] += 1;
118  if(id.subdetId() == EcalEndcap) badChannelsCount[EEDetId(id).sc().rawId()] += 1;
119  }
120  else{
121  dccGood[iDCC] += 1.;
122  totalGood += 1.;
123  }
124  dccChannels[iDCC] += 1.;
125  totalChannels += 1.;
126  }
127 
128  // search clusters of bad towers
129  if(onlineMode_){
130  for(int iz(-1); iz < 2; iz += 2){
131  for(int ieta(0); ieta < 17; ++ieta){
132  if(iz == 1 && ieta == 0) continue;
133  for(int iphi(1); iphi <= 72; ++iphi){
134  EcalTrigTowerDetId ttids[4];
135  unsigned badTowers(0);
136  for(int deta(0); deta < 2; ++deta){
137  int ttz(ieta == 0 && deta == 0 ? -1 : iz);
138  int tteta(ieta == 0 && deta == 0 ? 1 : ieta + deta);
139  for(int dphi(0); dphi < 2; ++dphi){
140  int ttphi(iphi != 72 ? iphi + dphi : 1);
141  EcalTrigTowerDetId ttid(ttz, EcalBarrel, tteta, ttphi);
142  ttids[deta * 2 + dphi] = ttid;
143 
144  if(badChannelsCount[ttid.rawId()] > towerBadFraction_ * 25.)
145  badTowers += 1;
146  }
147  }
148 
149  if(badTowers > 2){
150  for(unsigned iD(0); iD < 4; ++iD)
151  dccGood[dccId(ttids[iD]) - 1] = 0.;
152  }
153  }
154  }
155  }
156  for(int iz(-1); iz <= 1; iz += 2){
157  for(int ix(1); ix < 20; ++ix){
158  for(int iy(1); iy < 20; ++iy){
159  EcalScDetId scids[4];
160  unsigned badTowers(0);
161  for(int dx(0); dx < 2; ++dx){
162  for(int dy(0); dy < 2; ++dy){
163  if(!EcalScDetId::validDetId(ix + dx, iy + dy, iz)){
164  scids[dx * 2 + dy] = EcalScDetId(0);
165  continue;
166  }
167  EcalScDetId scid(ix + dx, iy + dy, iz);
168  scids[dx * 2 + dy] = scid;
169 
170  if(badChannelsCount[scid.rawId()] > towerBadFraction_ * scConstituents(scid).size())
171  badTowers += 1;
172  }
173  }
174 
175  // contiguous towers bad -> [(00)(11)] [(11)(00)] [(01)(01)] [(10)(10)] []=>x ()=>y
176  if(badTowers > 2){
177  for(unsigned iD(0); iD < 4; ++iD){
178  EcalScDetId& scid(scids[iD]);
179  if(scid.null()) continue;
180  dccGood[dccId(scid) - 1] = 0.;
181  }
182  }
183  }
184  }
185  }
186  }
187 
188  double nBad(0.);
189  for(unsigned iDCC(0); iDCC < nDCC; ++iDCC){
190  if(dccChannels[iDCC] < 1.) continue;
191 
192  int dccid(iDCC + 1);
193  float frac(dccGood[iDCC] / dccChannels[iDCC]);
194  meReportSummaryMap.setBinContent(dccid, frac);
195  meReportSummaryContents.fill(dccid, frac);
196 
197  if(1. - frac > fedBadFraction_) nBad += 1.;
198  }
199 
200  if(totalChannels > 0.) meReportSummary.fill(totalGood / totalChannels);
201 
202  if(onlineMode_){
203  if(totalChannels > 0.) MEs_.at("GlobalSummary").setBinContent(1, totalGood / totalChannels);
204  MEs_.at("NBadFEDs").setBinContent(1, nBad);
205  }
206  }
static bool validDetId(int ix, int iy, int iz)
Definition: EcalScDetId.cc:64
bool using_(std::string const &_name, ProcessType _type=kRun) 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:76
EcalScDetId sc() const
Definition: EEDetId.h:88
std::vector< DetId > scConstituents(EcalScDetId const &)
dictionary rawdata
Definition: lumiPlot.py:393
tuple status
Definition: ntuplemaker.py:245
unsigned dccId(DetId const &)
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 19 of file SummaryClient.h.

Referenced by producePlots(), and setParams().

float ecaldqm::SummaryClient::towerBadFraction_
private

Definition at line 18 of file SummaryClient.h.

Referenced by producePlots(), and setParams().