CMS 3D CMS Logo

TowerStatusTask.cc
Go to the documentation of this file.
1 #include "../interface/TowerStatusTask.h"
2 
7 
12 
17 
18 namespace ecaldqm {
19 
22  doDAQInfo_(false),
23  doDCSInfo_(false)
24  {
25  std::fill_n(daqStatus_, nDCC, 0.);
26  std::fill_n(dcsStatus_, nDCC, 0.);
27  }
28 
29  void
31  {
32  doDAQInfo_ = _params.getUntrackedParameter<bool>("doDAQInfo");
33  doDCSInfo_ = _params.getUntrackedParameter<bool>("doDCSInfo");
34 
35  if(doDAQInfo_ && doDCSInfo_) return;
36  if(doDAQInfo_){
37  MEs_.erase(std::string("DCSSummary"));
38  MEs_.erase(std::string("DCSSummaryMap"));
39  MEs_.erase(std::string("DCSContents"));
40  }
41  else if(doDCSInfo_){
42  MEs_.erase(std::string("DAQSummary"));
43  MEs_.erase(std::string("DAQSummaryMap"));
44  MEs_.erase(std::string("DAQContents"));
45  }
46  else
47  throw cms::Exception("InvalidConfiguration") << "Nothing to do in TowerStatusTask";
48  }
49 
50  void
52  {
53  if(doDAQInfo_){
54  std::fill_n(daqStatus_, nDCC, 1.);
55 
57  _es.get<EcalDAQTowerStatusRcd>().get(daqHndl);
58  if(daqHndl.isValid()){
59  for(unsigned id(0); id < EcalTrigTowerDetId::kEBTotalTowers; id++){
60  if(daqHndl->barrel(id).getStatusCode() != 0){
62  daqStatus_[dccId(ttid) - 1] -= 25. / 1700.;
63  }
64  }
65  for(unsigned id(0); id < EcalScDetId::kSizeForDenseIndexing; id++){
66  if(daqHndl->endcap(id).getStatusCode() != 0){
68  unsigned dccid(dccId(scid));
69  daqStatus_[dccid - 1] -= double(scConstituents(scid).size()) / nCrystals(dccid);
70  }
71  }
72  }
73  else
74  edm::LogWarning("EventSetup") << "EcalDAQTowerStatus record not valid";
75  }
76 
77  if(doDCSInfo_){
78  std::fill_n(dcsStatus_, nDCC, 1.);
79 
81  _es.get<EcalDCSTowerStatusRcd>().get(dcsHndl);
82  if(dcsHndl.isValid()){
83  for(unsigned id(0); id < EcalTrigTowerDetId::kEBTotalTowers; id++){
84  if(dcsHndl->barrel(id).getStatusCode() != 0){
86  dcsStatus_[dccId(ttid) - 1] -= 25. / 1700.;
87  }
88  }
89  for(unsigned id(0); id < EcalScDetId::kSizeForDenseIndexing; id++){
90  if(dcsHndl->endcap(id).getStatusCode() != 0){
92  unsigned dccid(dccId(scid));
93  dcsStatus_[dccid - 1] -= double(scConstituents(scid).size()) / nCrystals(dccid);
94  }
95  }
96  }
97  else
98  edm::LogWarning("EventSetup") << "EcalDCSTowerStatus record not valid";
99  }
100  }
101 
102  void
104  {
107  }
108 
109  void
110  TowerStatusTask::producePlotsTask_(float const* _status, std::string const& _type)
111  {
112  MESet* meSummary(nullptr);
113  MESet* meSummaryMap(nullptr);
114  MESet* meContents(nullptr);
115  meSummary = &MEs_.at(_type + "Summary");
116  meSummaryMap = &MEs_.at(_type + "SummaryMap");
117  meContents = &MEs_.at(_type + "Contents");
118 
119  meSummary->reset(-1.);
120  meSummaryMap->resetAll(-1.);
121  meSummaryMap->reset();
122  meContents->reset(-1.);
123 
124  float totalFraction(0.);
125  for(int iDCC(0); iDCC < nDCC; iDCC++){
126  meSummaryMap->setBinContent(iDCC + 1, _status[iDCC]);
127  meContents->fill(iDCC + 1, _status[iDCC]);
128  totalFraction += _status[iDCC] / nCrystals(iDCC + 1);
129  }
130 
131  meSummary->fill(totalFraction);
132  }
133 
135 }
size
Write out results.
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:108
Code getStatusCode() const
return decoded status
static EcalScDetId unhashIndex(int hi)
Definition: EcalScDetId.h:118
virtual void setBinContent(DetId const &, double)
Definition: MESet.h:51
void producePlots(ProcessType) override
void producePlotsTask_(float const *, std::string const &)
void setParams(edm::ParameterSet const &) override
unsigned nCrystals(unsigned)
virtual void reset(double=0., double=0., double=0.)
Definition: MESet.cc:110
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
const T & get() const
Definition: EventSetup.h:59
virtual void fill(DetId const &, double=1., double=1., double=1.)
Definition: MESet.h:46
MESetCollection MEs_
Definition: DQWorker.h:75
virtual void resetAll(double=0., double=0., double=0.)
Definition: MESet.cc:118
uint16_t getStatusCode() const
const Item & barrel(size_t hashedIndex) const
std::vector< DetId > scConstituents(EcalScDetId const &)
bool isValid() const
Definition: ESHandle.h:47
unsigned dccId(DetId const &)