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 20 of file HcalDetDiagNoiseMonitorClient.cc.

References HcalBaseDQClient::name_.

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

Definition at line 25 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_.

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

Destructor.

Definition at line 276 of file HcalDetDiagNoiseMonitorClient.cc.

277 {}

Member Function Documentation

void HcalDetDiagNoiseMonitorClient::analyze ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 51 of file HcalDetDiagNoiseMonitorClient.cc.

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

Referenced by endRun().

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

Reimplemented from HcalBaseDQClient.

Definition at line 187 of file HcalDetDiagNoiseMonitorClient.cc.

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

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

Reimplemented from HcalBaseDQClient.

Definition at line 198 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_.

199 {
200  enoughevents_=false;
201  if (!dqmStore_)
202  {
203  if (debug_>0) std::cout <<"<HcalDetDiagNoiseMonitorClient::beginRun> dqmStore does not exist!"<<std::endl;
204  return;
205  }
207  problemnames_.clear();
208 
209  // Put the appropriate name of your problem summary here
210  ProblemCells=dqmStore_->book2D(" ProblemDetDiagNoiseMonitor",
211  " Problem DetDiagNoiseMonitor Rate for all HCAL;ieta;iphi",
212  85,-42.5,42.5,
213  72,0.5,72.5);
214  problemnames_.push_back(ProblemCells->getName());
215  if (debug_>1)
216  std::cout << "Tried to create ProblemCells Monitor Element in directory "<<subdir_<<" \t Failed? "<<(ProblemCells==0)<<std::endl;
217  dqmStore_->setCurrentFolder(subdir_+"problem_DetDiagNoiseMonitor");
219  ProblemCellsByDepth->setup(dqmStore_," Problem DetDiagNoiseMonitor Rate");
220  for (unsigned int i=0; i<ProblemCellsByDepth->depth.size();++i)
221  problemnames_.push_back(ProblemCellsByDepth->depth[i]->getName());
222  nevts_=0;
223 }
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:850
DQMStore * dqmStore_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
void HcalDetDiagNoiseMonitorClient::calculateProblems ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 57 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(), min, HcalBaseDQClient::minerrorrate_, HcalBaseDQClient::name(), phi, HcalBaseDQClient::ProblemCells, HcalBaseDQClient::ProblemCellsByDepth, MonitorElement::Reset(), and MonitorElement::setBinContent().

Referenced by analyze().

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

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

Reimplemented from HcalBaseDQClient.

Definition at line 196 of file HcalDetDiagNoiseMonitorClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 225 of file HcalDetDiagNoiseMonitorClient.cc.

References analyze().

bool HcalDetDiagNoiseMonitorClient::hasErrors_Temp ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 230 of file HcalDetDiagNoiseMonitorClient.cc.

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

231 {
232  if (!ProblemCells)
233  {
234  if (debug_>1) std::cout <<"<HcalDetDiagNoiseMonitorClient::hasErrors_Temp> ProblemCells histogram does not exist!"<<std::endl;
235  return false;
236  }
237  int problemcount=0;
238  int ieta=-9999;
239 
240  for (int depth=0;depth<4; ++depth)
241  {
242  int etabins = (ProblemCells->getTH2F())->GetNbinsX();
243  int phibins = (ProblemCells->getTH2F())->GetNbinsY();
244  for (int hist_eta=0;hist_eta<etabins;++hist_eta)
245  {
246  for (int hist_phi=0; hist_phi<phibins;++hist_phi)
247  {
248  ieta=CalcIeta(hist_eta,depth+1);
249  if (ieta==-9999) continue;
250  if (ProblemCellsByDepth->depth[depth]==0)
251  continue;
252  if (ProblemCellsByDepth->depth[depth]->getBinContent(hist_eta,hist_phi)>minerrorrate_)
253  ++problemcount;
254 
255  } // for (int hist_phi=1;...)
256  } // for (int hist_eta=1;...)
257  } // for (int depth=0;...)
258 
259  if (problemcount>0) return true;
260  return false;
261 }
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 264 of file HcalDetDiagNoiseMonitorClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 263 of file HcalDetDiagNoiseMonitorClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 227 of file HcalDetDiagNoiseMonitorClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 265 of file HcalDetDiagNoiseMonitorClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 268 of file HcalDetDiagNoiseMonitorClient.cc.

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

Member Data Documentation

int HcalDetDiagNoiseMonitorClient::nevts_
private

Definition at line 36 of file HcalDetDiagNoiseMonitorClient.h.

Referenced by beginRun().