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 
14  edm::EDAnalyzer(),
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_(true);
37 }
38 
39 void
41 {
42  format_(false);
43 }
44 
45 void
46 EcalMEFormatter::format_(bool _checkLumi)
47 {
48  DQMStore& dqmStore(*edm::Service<DQMStore>());
49  std::string failedPath;
50 
51  for(ecaldqm::MESetCollection::iterator mItr(MEs_.begin()); mItr != MEs_.end(); ++mItr){
52  if(_checkLumi && !mItr->second->getLumiFlag()) continue;
53  mItr->second->clear();
54  if(!mItr->second->retrieve(dqmStore, &failedPath)){
55  if(verbosity_ > 0) edm::LogWarning("EcalDQM") << "Could not find ME " << mItr->first << "@" << failedPath;
56  continue;
57  }
58  if(verbosity_ > 1) edm::LogInfo("EcalDQM") << "Retrieved " << mItr->first << " from DQMStore";
59 
60  if(dynamic_cast<ecaldqm::MESetDet2D*>(mItr->second)) formatDet2D_(*mItr->second);
61  }
62 }
63 
64 void
66 {
67  if(_meSet.getKind() != MonitorElement::DQM_KIND_TPROFILE2D) return;
68 
69  MonitorElement* me(0);
70  unsigned iME(0);
71  while((me = _meSet.getME(iME++))){
72  TProfile2D* prof(me->getTProfile2D());
73  for(int iX(1); iX <= prof->GetNbinsX(); ++iX){
74  for(int iY(1); iY <= prof->GetNbinsY(); ++iY){
75  int bin(prof->GetBin(iX, iY));
76  if(prof->GetBinEntries(bin) == 0.){
77  if(verbosity_ > 2) edm::LogInfo("EcalDQM") << "Found empty bin " << bin << " in histogram " << prof->GetName();
78  // TEMPORARY SETUP UNTIL RENDERPLUGIN IS UPDATED TO DO THIS
79  // WHEN IT IS, SWITCH TO ENTRIES -1 CONTENT 0
80  prof->SetBinEntries(bin, 1.);
81  prof->SetBinContent(bin, -std::numeric_limits<double>::max());
82  }
83  }
84  }
85  }
86 }
87 
T getUntrackedParameter(std::string const &, T const &) const
virtual MonitorElement const * getME(unsigned _iME) const
Definition: MESet.h:99
MonitorElement::Kind getKind() const
Definition: MESet.h:96
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
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override
ParameterSet getUntrackedParameterSet(std::string const &name, ParameterSet const &defaultValue) const
EcalMEFormatter(edm::ParameterSet const &)
void format_(bool)
void endRun(edm::Run const &, edm::EventSetup const &) override
void addDefault(ParameterSetDescription const &psetDescription)
const T & max(const T &a, const T &b)
static void fillDescriptions(edm::ConfigurationDescriptions &)
virtual void setME(edm::ParameterSet const &)
Definition: DQWorker.cc:55
void initialize(std::string const &_name, edm::ParameterSet const &)
Definition: DQWorker.cc:47
static void fillDescriptions(edm::ParameterSetDescription &_desc)
Definition: DQWorker.cc:30
MESetCollection MEs_
Definition: DQWorker.h:76
Definition: Run.h:41