CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalMEFormatter.cc
Go to the documentation of this file.
2 
4 
8 
10 
11 #include <limits>
12 
15  ecaldqm::DQWorker()
16 {
17  initialize("EcalMEFormatter", _ps);
18  setME(_ps.getUntrackedParameterSet("MEs"));
19  verbosity_ = _ps.getUntrackedParameter<int>("verbosity", 0);
20 }
21 
22 /*static*/
23 void
25 {
28  desc.addUntracked<int>("verbosity", 0);
29 
30  _descs.addDefault(desc);
31 }
32 
33 void
35 {
36  format_(_igetter, true);
37 }
38 
39 void
41 {
42  format_(_igetter, false);
43 }
44 
45 void
46 EcalMEFormatter::format_(DQMStore::IGetter& _igetter, bool _checkLumi)
47 {
48  std::string failedPath;
49 
50  for(ecaldqm::MESetCollection::iterator mItr(MEs_.begin()); mItr != MEs_.end(); ++mItr){
51  if(_checkLumi && !mItr->second->getLumiFlag()) continue;
52  mItr->second->clear();
53  if(!mItr->second->retrieve(_igetter, &failedPath)){
54  if(verbosity_ > 0) edm::LogWarning("EcalDQM") << "Could not find ME " << mItr->first << "@" << failedPath;
55  continue;
56  }
57  if(verbosity_ > 1) edm::LogInfo("EcalDQM") << "Retrieved " << mItr->first << " from DQMStore";
58 
59  if(dynamic_cast<ecaldqm::MESetDet2D*>(mItr->second)) formatDet2D_(*mItr->second);
60  }
61 }
62 
63 void
65 {
66  if(_meSet.getKind() != MonitorElement::DQM_KIND_TPROFILE2D) return;
67 
68  MonitorElement* me(0);
69  unsigned iME(0);
70  while((me = _meSet.getME(iME++))){
71  TProfile2D* prof(me->getTProfile2D());
72  for(int iX(1); iX <= prof->GetNbinsX(); ++iX){
73  for(int iY(1); iY <= prof->GetNbinsY(); ++iY){
74  int bin(prof->GetBin(iX, iY));
75  if(prof->GetBinEntries(bin) == 0.){
76  if(verbosity_ > 2) edm::LogInfo("EcalDQM") << "Found empty bin " << bin << " in histogram " << prof->GetName();
77  // TEMPORARY SETUP UNTIL RENDERPLUGIN IS UPDATED TO DO THIS
78  // WHEN IT IS, SWITCH TO ENTRIES -1 CONTENT 0
79  prof->SetBinEntries(bin, 1.);
80  prof->SetBinContent(bin, -std::numeric_limits<double>::max());
81  }
82  }
83  }
84  }
85 }
86 
T getUntrackedParameter(std::string const &, T const &) const
virtual MonitorElement const * getME(unsigned _iME) const
Definition: MESet.h:98
MonitorElement::Kind getKind() const
Definition: MESet.h:95
void formatDet2D_(ecaldqm::MESet &)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
TProfile2D * getTProfile2D(void) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
EcalMEFormatter(edm::ParameterSet const &)
void addDefault(ParameterSetDescription const &psetDescription)
void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
static void fillDescriptions(edm::ConfigurationDescriptions &)
virtual void setME(edm::ParameterSet const &)
Definition: DQWorker.cc:56
void initialize(std::string const &_name, edm::ParameterSet const &)
Definition: DQWorker.cc:48
static void fillDescriptions(edm::ParameterSetDescription &_desc)
Definition: DQWorker.cc:31
MESetCollection MEs_
Definition: DQWorker.h:75
void format_(DQMStore::IGetter &, bool)
void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override