CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TowerStatusTask.cc
Go to the documentation of this file.
2 
7 
12 
13 namespace ecaldqm {
14 
15  TowerStatusTask::TowerStatusTask() : DQWorkerClient(), doDAQInfo_(false), doDCSInfo_(false) {
16  std::fill_n(daqStatus_, nDCC, 0.);
17  std::fill_n(dcsStatus_, nDCC, 0.);
18  }
19 
21  doDAQInfo_ = _params.getUntrackedParameter<bool>("doDAQInfo");
22  doDCSInfo_ = _params.getUntrackedParameter<bool>("doDCSInfo");
23 
24  if (doDAQInfo_ && doDCSInfo_)
25  return;
26  if (doDAQInfo_) {
27  MEs_.erase(std::string("DCSSummary"));
28  MEs_.erase(std::string("DCSSummaryMap"));
29  MEs_.erase(std::string("DCSContents"));
30  } else if (doDCSInfo_) {
31  MEs_.erase(std::string("DAQSummary"));
32  MEs_.erase(std::string("DAQSummaryMap"));
33  MEs_.erase(std::string("DAQContents"));
34  } else
35  throw cms::Exception("InvalidConfiguration") << "Nothing to do in TowerStatusTask";
36  }
37 
41  }
42 
44  if (doDAQInfo_) {
45  std::fill_n(daqStatus_, nDCC, 1.);
46 
47  const EcalDAQTowerStatus* daqHndl = &_es.getData(daqHndlToken);
48  auto daqhandle = _es.getHandle(daqHndlToken);
49  if (daqhandle.isValid()) {
50  for (unsigned id(0); id < EcalTrigTowerDetId::kEBTotalTowers; id++) {
51  if (daqHndl->barrel(id).getStatusCode() != 0) {
53  daqStatus_[dccId(ttid, GetElectronicsMap()) - 1] -= 25. / 1700.;
54  }
55  }
56  for (unsigned id(0); id < EcalScDetId::kSizeForDenseIndexing; id++) {
57  if (daqHndl->endcap(id).getStatusCode() != 0) {
59  unsigned dccid(dccId(scid, GetElectronicsMap()));
60  daqStatus_[dccid - 1] -= double(scConstituents(scid).size()) / nCrystals(dccid);
61  }
62  }
63  } else
64  edm::LogWarning("EventSetup") << "EcalDAQTowerStatus record not valid";
65  }
66 
67  if (doDCSInfo_) {
68  std::fill_n(dcsStatus_, nDCC, 1.);
69 
70  const EcalDCSTowerStatus* dcsHndl = &_es.getData(dcsHndlToken);
71  auto dcshandle = _es.getHandle(dcsHndlToken);
72  if (dcshandle.isValid()) {
73  for (unsigned id(0); id < EcalTrigTowerDetId::kEBTotalTowers; id++) {
74  if (dcsHndl->barrel(id).getStatusCode() != 0) {
76  dcsStatus_[dccId(ttid, GetElectronicsMap()) - 1] -= 25. / 1700.;
77  }
78  }
79  for (unsigned id(0); id < EcalScDetId::kSizeForDenseIndexing; id++) {
80  if (dcsHndl->endcap(id).getStatusCode() != 0) {
82  unsigned dccid(dccId(scid, GetElectronicsMap()));
83  dcsStatus_[dccid - 1] -= double(scConstituents(scid).size()) / nCrystals(dccid);
84  }
85  }
86  } else
87  edm::LogWarning("EventSetup") << "EcalDCSTowerStatus record not valid";
88  }
89  }
90 
92  if (doDAQInfo_)
94  if (doDCSInfo_)
96  }
97 
98  void TowerStatusTask::producePlotsTask_(float const* _status, std::string const& _type) {
99  MESet* meSummary(nullptr);
100  MESet* meSummaryMap(nullptr);
101  MESet* meContents(nullptr);
102  meSummary = &MEs_.at(_type + "Summary");
103  meSummaryMap = &MEs_.at(_type + "SummaryMap");
104  meContents = &MEs_.at(_type + "Contents");
105 
106  meSummary->reset(GetElectronicsMap(), -1.);
107  meSummaryMap->resetAll(-1.);
108  meSummaryMap->reset(GetElectronicsMap());
109  meContents->reset(GetElectronicsMap(), -1.);
110 
111  float totalFraction(0.);
112  for (int iDCC(0); iDCC < nDCC; iDCC++) {
113  meSummaryMap->setBinContent(getEcalDQMSetupObjects(), iDCC + 1, _status[iDCC]);
114  meContents->fill(getEcalDQMSetupObjects(), iDCC + 1, _status[iDCC]);
115  totalFraction += _status[iDCC] / nCrystals(iDCC + 1);
116  }
117 
118  meSummary->fill(getEcalDQMSetupObjects(), totalFraction);
119  }
120 
122 } // namespace ecaldqm
virtual void setBinContent(EcalDQMSetupObjects const, DetId const &, double)
Definition: MESet.h:79
T getUntrackedParameter(std::string const &, T const &) const
static EcalTrigTowerDetId detIdFromDenseIndex(uint32_t di)
const Item & endcap(size_t hashedIndex) const
#define DEFINE_ECALDQM_WORKER(TYPE)
Definition: DQWorker.h:162
edm::ESGetToken< EcalDAQTowerStatus, EcalDAQTowerStatusRcd > daqHndlToken
MESet & at(const std::string &key)
Definition: MESet.h:399
edm::ESGetToken< EcalDCSTowerStatus, EcalDCSTowerStatusRcd > dcsHndlToken
static EcalScDetId unhashIndex(int hi)
Definition: EcalScDetId.h:117
void producePlots(ProcessType) override
void producePlotsTask_(float const *, std::string const &)
void setTokens(edm::ConsumesCollector &) override
void setParams(edm::ParameterSet const &) override
bool getData(T &iHolder) const
Definition: EventSetup.h:122
unsigned nCrystals(unsigned)
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
virtual void fill(EcalDQMSetupObjects const, DetId const &, double=1., double=1., double=1.)
Definition: MESet.h:74
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
EcalDQMSetupObjects const getEcalDQMSetupObjects()
Definition: DQWorker.cc:142
MESetCollection MEs_
Definition: DQWorker.h:125
virtual void resetAll(double=0., double=0., double=0.)
Definition: MESet.cc:108
const Item & barrel(size_t hashedIndex) const
EcalElectronicsMapping const * GetElectronicsMap()
Definition: DQWorker.cc:118
std::vector< DetId > scConstituents(EcalScDetId const &)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
Log< level::Warning, false > LogWarning
virtual void reset(EcalElectronicsMapping const *, double=0., double=0., double=0.)
Definition: MESet.cc:98
tuple size
Write out results.
void erase(const std::string &key)
Definition: MESet.h:390