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 Attributes
HcalDetDiagNoiseMonitorClient Class Reference

#include <HcalDetDiagNoiseMonitorClient.h>

Inheritance diagram for HcalDetDiagNoiseMonitorClient:
HcalBaseDQClient

Public Member Functions

void analyze (void)
 
void beginJob (void)
 
void beginRun (void)
 
void calculateProblems (void)
 
void cleanup (void)
 
void endJob (void)
 
void endRun (void)
 
bool hasErrors_Temp (void)
 
bool hasOther_Temp (void)
 
bool hasWarnings_Temp (void)
 
 HcalDetDiagNoiseMonitorClient ()
 Constructors. More...
 
 HcalDetDiagNoiseMonitorClient (std::string myname)
 
 HcalDetDiagNoiseMonitorClient (std::string myname, const edm::ParameterSet &ps)
 
void setup (void)
 
bool test_enabled (void)
 
void updateChannelStatus (std::map< HcalDetId, unsigned int > &myqual)
 
 ~HcalDetDiagNoiseMonitorClient ()
 Destructor. More...
 
- Public Member Functions inherited from HcalBaseDQClient
void getLogicalMap (const edm::EventSetup &es)
 
 HcalBaseDQClient ()
 
 HcalBaseDQClient (std::string s, const edm::ParameterSet &ps)
 
virtual void htmlOutput (std::string htmlDir)
 
std::string name ()
 
void setEventSetup (const edm::EventSetup &es)
 
virtual void setStatusMap (std::map< HcalDetId, unsigned int > &map)
 
virtual bool validHtmlOutput ()
 
virtual ~HcalBaseDQClient (void)
 

Private Attributes

int nevts_
 

Additional Inherited Members

- Public Attributes inherited from HcalBaseDQClient
int badChannelStatusMask_
 
std::map< HcalDetId, unsigned int > badstatusmap
 
const edm::EventSetupc
 
bool cloneME_
 
int debug_
 
DQMStoredqmStore_
 
bool enableCleanup_
 
bool enoughevents_
 
HcalLogicalMaplogicalMap_
 
double minerrorrate_
 
int minevents_
 
std::string name_
 
bool needLogicalMap_
 
bool Online_
 
std::string prefixME_
 
MonitorElementProblemCells
 
EtaPhiHistsProblemCellsByDepth
 
std::vector< std::string > problemnames_
 
std::string subdir_
 
bool testenabled_
 
bool validHtmlOutput_
 

Detailed Description

Definition at line 8 of file HcalDetDiagNoiseMonitorClient.h.

Constructor & Destructor Documentation

HcalDetDiagNoiseMonitorClient::HcalDetDiagNoiseMonitorClient ( )
inline

Constructors.

Definition at line 13 of file HcalDetDiagNoiseMonitorClient.h.

References HcalBaseDQClient::name_.

13 {name_="";};
HcalDetDiagNoiseMonitorClient::HcalDetDiagNoiseMonitorClient ( std::string  myname)

Definition at line 18 of file HcalDetDiagNoiseMonitorClient.cc.

References HcalBaseDQClient::name_.

19 {
20  name_=myname;
21 }
HcalDetDiagNoiseMonitorClient::HcalDetDiagNoiseMonitorClient ( std::string  myname,
const edm::ParameterSet ps 
)

Definition at line 23 of file HcalDetDiagNoiseMonitorClient.cc.

References HcalBaseDQClient::badChannelStatusMask_, HcalBaseDQClient::cloneME_, HcalBaseDQClient::debug_, HcalBaseDQClient::enableCleanup_, edm::ParameterSet::getUntrackedParameter(), HcalBaseDQClient::minerrorrate_, HcalBaseDQClient::minevents_, HcalBaseDQClient::name_, HcalBaseDQClient::prefixME_, HcalBaseDQClient::ProblemCells, HcalBaseDQClient::ProblemCellsByDepth, AlCaHLTBitMon_QueryRunRegistry::string, HcalBaseDQClient::subdir_, and HcalBaseDQClient::validHtmlOutput_.

24 {
25  name_=myname;
26  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup",false);
27  debug_ = ps.getUntrackedParameter<int>("debug",0);
28  prefixME_ = ps.getUntrackedParameter<std::string>("subSystemFolder","Hcal/");
29  if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
30  prefixME_.append("/");
31  subdir_ = ps.getUntrackedParameter<std::string>("DetDiagNoiseMonitorFolder","DetDiagNoiseMonitor_Hcal/"); // DetDiagNoiseMonitor_Hcal/
32  if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
33  subdir_.append("/");
34  subdir_=prefixME_+subdir_;
35 
36  validHtmlOutput_ = ps.getUntrackedParameter<bool>("DetDiagNoiseMonitor_validHtmlOutput",true);
37  cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
38  badChannelStatusMask_ = ps.getUntrackedParameter<int>("DetDiagNoiseMonitor_BadChannelStatusMask",
39  ps.getUntrackedParameter<int>("BadChannelStatusMask",0));
40 
41  minerrorrate_ = ps.getUntrackedParameter<double>("DetDiagNoiseMonitor_minerrorrate",
42  ps.getUntrackedParameter<double>("minerrorrate",0.05));
43  minevents_ = ps.getUntrackedParameter<int>("DetDiagNoiseMonitor_minevents",
44  ps.getUntrackedParameter<int>("minevents",1));
45  ProblemCells=0;
47 }
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * ProblemCells
EtaPhiHists * ProblemCellsByDepth
std::string subdir_
std::string prefixME_
HcalDetDiagNoiseMonitorClient::~HcalDetDiagNoiseMonitorClient ( )

Destructor.

Definition at line 274 of file HcalDetDiagNoiseMonitorClient.cc.

275 {}

Member Function Documentation

void HcalDetDiagNoiseMonitorClient::analyze ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 49 of file HcalDetDiagNoiseMonitorClient.cc.

References calculateProblems(), gather_cfg::cout, and HcalBaseDQClient::debug_.

Referenced by endRun().

50 {
51  if (debug_>2) std::cout <<"\tHcalDetDiagNoiseMonitorClient::analyze()"<<std::endl;
53 }
tuple cout
Definition: gather_cfg.py:121
void HcalDetDiagNoiseMonitorClient::beginJob ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 185 of file HcalDetDiagNoiseMonitorClient.cc.

References gather_cfg::cout, HcalBaseDQClient::debug_, HcalBaseDQClient::dqmStore_, cppFunctionSkipper::operator, and DQMStore::showDirStructure().

186 {
188  if (debug_>0)
189  {
190  std::cout <<"<HcalDetDiagNoiseMonitorClient::beginJob()> Displaying dqmStore directory structure:"<<std::endl;
192  }
193 }
tuple cout
Definition: gather_cfg.py:121
void showDirStructure(void) const
Definition: DQMStore.cc:3348
DQMStore * dqmStore_
void HcalDetDiagNoiseMonitorClient::beginRun ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 196 of file HcalDetDiagNoiseMonitorClient.cc.

References DQMStore::book2D(), gather_cfg::cout, HcalBaseDQClient::debug_, EtaPhiHists::depth, HcalBaseDQClient::dqmStore_, HcalBaseDQClient::enoughevents_, MonitorElement::getName(), i, nevts_, HcalBaseDQClient::ProblemCells, HcalBaseDQClient::ProblemCellsByDepth, HcalBaseDQClient::problemnames_, DQMStore::setCurrentFolder(), EtaPhiHists::setup(), and HcalBaseDQClient::subdir_.

197 {
198  enoughevents_=false;
199  if (!dqmStore_)
200  {
201  if (debug_>0) std::cout <<"<HcalDetDiagNoiseMonitorClient::beginRun> dqmStore does not exist!"<<std::endl;
202  return;
203  }
205  problemnames_.clear();
206 
207  // Put the appropriate name of your problem summary here
208  ProblemCells=dqmStore_->book2D(" ProblemDetDiagNoiseMonitor",
209  " Problem DetDiagNoiseMonitor Rate for all HCAL;ieta;iphi",
210  85,-42.5,42.5,
211  72,0.5,72.5);
212  problemnames_.push_back(ProblemCells->getName());
213  if (debug_>1)
214  std::cout << "Tried to create ProblemCells Monitor Element in directory "<<subdir_<<" \t Failed? "<<(ProblemCells==0)<<std::endl;
215  dqmStore_->setCurrentFolder(subdir_+"problem_DetDiagNoiseMonitor");
217  ProblemCellsByDepth->setup(dqmStore_," Problem DetDiagNoiseMonitor Rate");
218  for (unsigned int i=0; i<ProblemCellsByDepth->depth.size();++i)
219  problemnames_.push_back(ProblemCellsByDepth->depth[i]->getName());
220  nevts_=0;
221 }
const std::string & getName(void) const
get name of ME
int i
Definition: DBlmapReader.cc:9
MonitorElement * ProblemCells
void setup(DQMStore *&m_dbe, std::string Name, std::string Units="")
std::vector< MonitorElement * > depth
std::vector< std::string > problemnames_
EtaPhiHists * ProblemCellsByDepth
std::string subdir_
tuple cout
Definition: gather_cfg.py:121
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1092
DQMStore * dqmStore_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:677
void HcalDetDiagNoiseMonitorClient::calculateProblems ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 55 of file HcalDetDiagNoiseMonitorClient.cc.

References HcalBaseDQClient::badstatusmap, HcalObjRepresent::CalcIeta(), gather_cfg::cout, HcalBaseDQClient::debug_, EtaPhiHists::depth, HcalBaseDQClient::dqmStore_, HcalBaseDQClient::enoughevents_, eta(), MonitorElement::Fill(), HcalObjRepresent::FillUnphysicalHEHFBins(), MonitorElement::getBinContent(), MonitorElement::getTH2F(), HcalBarrel, HcalEmpty, HcalEndcap, HcalEtaPhiHistNames(), HcalForward, HcalOuter, isHB(), isHE(), isHF(), isHO(), bookConverter::min, HcalBaseDQClient::minerrorrate_, HcalBaseDQClient::name(), phi, HcalBaseDQClient::ProblemCells, HcalBaseDQClient::ProblemCellsByDepth, MonitorElement::Reset(), MonitorElement::setBinContent(), and ecaldqm::zside().

Referenced by analyze().

56 {
57  if (debug_>2) std::cout <<"\t\tHcalDetDiagNoiseMonitorClient::calculateProblems()"<<std::endl;
58  if(!dqmStore_) return;
59  //double totalevents=0;
60  int etabins=0, phibins=0, zside=0;
61  double problemvalue=0;
62 
63  // Clear away old problems
64  if (ProblemCells!=0)
65  {
67  (ProblemCells->getTH2F())->SetMaximum(1.05);
68  (ProblemCells->getTH2F())->SetMinimum(0.);
69  }
70  for (unsigned int d=0;ProblemCellsByDepth!=0 && d<ProblemCellsByDepth->depth.size();++d)
71  {
72  if (ProblemCellsByDepth->depth[d]!=0)
73  {
74  ProblemCellsByDepth->depth[d]->Reset();
75  (ProblemCellsByDepth->depth[d]->getTH2F())->SetMaximum(1.05);
76  (ProblemCellsByDepth->depth[d]->getTH2F())->SetMinimum(0.);
77  }
78  }
79  enoughevents_=true;
80  // Get histograms that are used in testing
81  // currently none used,
82 
83  std::vector<std::string> name = HcalEtaPhiHistNames();
84 
85  // This is a sample of how to get a histogram from the task that can then be used for evaluation purposes
86  /*
87  TH2F* BadTiming[4];
88  TH2F* BadEnergy[4];
89  MonitorElement* me;
90  for (int i=0;i<4;++i)
91  {
92  std::string s=subdir_+name[i]+" Problem Bad Laser Timing";
93  me=dqmStore_->get(s.c_str());
94  if (me!=0) BadTiming[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, BadTiming[i], debug_);
95  else if (debug_>0) std::cout <<"<HcalDetDiagNoiseMonitorClient::analyze> could not get histogram '"<<s<<"'"<<std::endl;
96  s=subdir_+name[i]+" Problem Bad Laser Energy";
97  me=dqmStore_->get(s.c_str());
98  if (me!=0) BadEnergy[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, BadEnergy[i], debug_);
99  else if (debug_>0) std::cout <<"<HcalDetDiagNoiseMonitorClient::analyze> could not get histogram '"<<s<<"'"<<std::endl;
100  }
101  */
102 
103  // Because we're clearing and re-forming the problem cell histogram here, we don't need to do any cute
104  // setting of the underflow bin to 0, and we can plot results as a raw rate between 0-1.
105 
106  for (unsigned int d=0;ProblemCellsByDepth!=0 && d<ProblemCellsByDepth->depth.size();++d)
107  {
108  if (ProblemCellsByDepth->depth[d]==0) continue;
109 
110  //totalevents=DigiPresentByDepth[d]->GetBinContent(0);
111  //totalevents=0;
112  // Check underflow bins for events processed
113  /*
114  if (BadTiming[d]!=0) totalevents = BadTiming[d]->GetBinContent(0);
115  else if (BadEnergy[d]!=0) totalevents = BadEnergy[d]->GetBinContent(0);
116  */
117  //if (totalevents==0 || totalevents<minevents_) continue;
118 
119  //totalevents=1; // temporary value pending removal of histogram normalization from tasks
120 
121  etabins=(ProblemCellsByDepth->depth[d]->getTH2F())->GetNbinsX();
122  phibins=(ProblemCellsByDepth->depth[d]->getTH2F())->GetNbinsY();
123  for (int eta=0;eta<etabins;++eta)
124  {
125  int ieta=CalcIeta(eta,d+1);
126  if (ieta==-9999) continue;
127  for (int phi=0;phi<phibins;++phi)
128  {
129  problemvalue=0;
130  /*
131  if (BadTiming[d]!=0) problemvalue += BadTiming[d]->GetBinContent(eta+1,phi+1)*1./totalevents;
132  else if (BadEnergy[d]!=0) problemvalue += BadEnergy[d]->GetBinContent(eta+1,phi+1)*1./totalevents;
133  */
134  if (problemvalue==0) continue;
135  // problem value is a rate; we can normalize it here
136  problemvalue = std::min(1.,problemvalue);
137 
138  zside=0;
139  if (isHF(eta,d+1)) // shift ieta by 1 for HF
140  ieta<0 ? zside = -1 : zside = 1;
141 
142  // For problem cells that exceed our allowed rate,
143  // set the values to -1 if the cells are already marked in the status database
144  if (problemvalue>minerrorrate_)
145  {
146  HcalSubdetector subdet=HcalEmpty;
147  if (isHB(eta,d+1))subdet=HcalBarrel;
148  else if (isHE(eta,d+1)) subdet=HcalEndcap;
149  else if (isHF(eta,d+1)) subdet=HcalForward;
150  else if (isHO(eta,d+1)) subdet=HcalOuter;
151  HcalDetId hcalid(subdet, ieta, phi+1, (int)(d+1));
152  if (badstatusmap.find(hcalid)!=badstatusmap.end())
153  problemvalue=999;
154  }
155 
156  ProblemCellsByDepth->depth[d]->setBinContent(eta+1,phi+1,problemvalue);
157  if (ProblemCells!=0) ProblemCells->Fill(ieta+zside,phi+1,problemvalue);
158  } // loop on phi
159  } // loop on eta
160  } // loop on depth
161 
162  if (ProblemCells==0)
163  {
164  if (debug_>0) std::cout <<"<HcalDetDiagNoiseMonitorClient::analyze> ProblemCells histogram does not exist!"<<std::endl;
165  return;
166  }
167 
168  // Normalization of ProblemCell plot, in the case where there are errors in multiple depths
169  etabins=(ProblemCells->getTH2F())->GetNbinsX();
170  phibins=(ProblemCells->getTH2F())->GetNbinsY();
171  for (int eta=0;eta<etabins;++eta)
172  {
173  for (int phi=0;phi<phibins;++phi)
174  {
177  }
178  }
179 
182  return;
183 }
bool isHO(int etabin, int depth)
MonitorElement * ProblemCells
std::string name()
void setBinContent(int binx, double content)
set content of bin (1-D)
std::vector< std::string > HcalEtaPhiHistNames()
int zside(DetId const &)
bool isHE(int etabin, int depth)
T eta() const
void Fill(long long x)
std::vector< MonitorElement * > depth
int CalcIeta(int subdet, int eta, int depth)
EtaPhiHists * ProblemCellsByDepth
HcalSubdetector
Definition: HcalAssistant.h:31
bool isHB(int etabin, int depth)
bool isHF(int etabin, int depth)
std::map< HcalDetId, unsigned int > badstatusmap
void FillUnphysicalHEHFBins(std::vector< TH2F > &hh)
double getBinContent(int binx) const
get content of bin (1-D)
tuple cout
Definition: gather_cfg.py:121
TH2F * getTH2F(void) const
void Reset(void)
reset ME (ie. contents, errors, etc)
DQMStore * dqmStore_
Definition: DDAxes.h:10
void HcalDetDiagNoiseMonitorClient::cleanup ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 226 of file HcalDetDiagNoiseMonitorClient.cc.

226 {}
void HcalDetDiagNoiseMonitorClient::endJob ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 194 of file HcalDetDiagNoiseMonitorClient.cc.

194 {}
void HcalDetDiagNoiseMonitorClient::endRun ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 223 of file HcalDetDiagNoiseMonitorClient.cc.

References analyze().

bool HcalDetDiagNoiseMonitorClient::hasErrors_Temp ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 228 of file HcalDetDiagNoiseMonitorClient.cc.

References HcalObjRepresent::CalcIeta(), gather_cfg::cout, HcalBaseDQClient::debug_, EtaPhiHists::depth, MonitorElement::getTH2F(), HcalBaseDQClient::minerrorrate_, HcalBaseDQClient::ProblemCells, and HcalBaseDQClient::ProblemCellsByDepth.

229 {
230  if (!ProblemCells)
231  {
232  if (debug_>1) std::cout <<"<HcalDetDiagNoiseMonitorClient::hasErrors_Temp> ProblemCells histogram does not exist!"<<std::endl;
233  return false;
234  }
235  int problemcount=0;
236  int ieta=-9999;
237 
238  for (int depth=0;depth<4; ++depth)
239  {
240  int etabins = (ProblemCells->getTH2F())->GetNbinsX();
241  int phibins = (ProblemCells->getTH2F())->GetNbinsY();
242  for (int hist_eta=0;hist_eta<etabins;++hist_eta)
243  {
244  for (int hist_phi=0; hist_phi<phibins;++hist_phi)
245  {
246  ieta=CalcIeta(hist_eta,depth+1);
247  if (ieta==-9999) continue;
248  if (ProblemCellsByDepth->depth[depth]==0)
249  continue;
250  if (ProblemCellsByDepth->depth[depth]->getBinContent(hist_eta,hist_phi)>minerrorrate_)
251  ++problemcount;
252 
253  } // for (int hist_phi=1;...)
254  } // for (int hist_eta=1;...)
255  } // for (int depth=0;...)
256 
257  if (problemcount>0) return true;
258  return false;
259 }
MonitorElement * ProblemCells
std::vector< MonitorElement * > depth
int CalcIeta(int subdet, int eta, int depth)
EtaPhiHists * ProblemCellsByDepth
tuple cout
Definition: gather_cfg.py:121
TH2F * getTH2F(void) const
bool HcalDetDiagNoiseMonitorClient::hasOther_Temp ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 262 of file HcalDetDiagNoiseMonitorClient.cc.

262 {return false;}
bool HcalDetDiagNoiseMonitorClient::hasWarnings_Temp ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 261 of file HcalDetDiagNoiseMonitorClient.cc.

261 {return false;}
void HcalDetDiagNoiseMonitorClient::setup ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 225 of file HcalDetDiagNoiseMonitorClient.cc.

225 {}
bool HcalDetDiagNoiseMonitorClient::test_enabled ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 263 of file HcalDetDiagNoiseMonitorClient.cc.

263 {return true;}
void HcalDetDiagNoiseMonitorClient::updateChannelStatus ( std::map< HcalDetId, unsigned int > &  myqual)
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 266 of file HcalDetDiagNoiseMonitorClient.cc.

267 {
268  // This gets called by HcalMonitorClient
269  // trigger primitives don't yet contribute to channel status (though they could...)
270  // see dead or hot cell code for an example
271 
272 } //void HcalDetDiagNoiseMonitorClient::updateChannelStatus

Member Data Documentation

int HcalDetDiagNoiseMonitorClient::nevts_
private

Definition at line 36 of file HcalDetDiagNoiseMonitorClient.h.

Referenced by beginRun().