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

#include <HcalDetDiagNoiseMonitorClient.h>

Inheritance diagram for HcalDetDiagNoiseMonitorClient:
HcalBaseDQClient

Public Member Functions

void analyze (DQMStore::IBooker &, DQMStore::IGetter &)
 
void beginRun (void)
 
void calculateProblems (DQMStore::IBooker &, DQMStore::IGetter &)
 
void cleanup (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
virtual void calculateProblems (void)
 
virtual void endJob (void)
 
void getLogicalMap (const edm::EventSetup &es)
 
 HcalBaseDQClient ()
 
 HcalBaseDQClient (std::string s, const edm::ParameterSet &ps)
 
virtual void htmlOutput (DQMStore::IBooker &, DQMStore::IGetter &, std::string htmlDir)
 
std::string name ()
 
void setEventSetup (const edm::EventSetup &es)
 
virtual void setStatusMap (std::map< HcalDetId, unsigned int > &map)
 
virtual bool validHtmlOutput (DQMStore::IBooker &, DQMStore::IGetter &)
 
virtual ~HcalBaseDQClient (void)
 

Private Member Functions

void setupProblemCells (DQMStore::IBooker &, DQMStore::IGetter &)
 

Private Attributes

bool doProblemCellSetup_
 
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_
 
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_, doProblemCellSetup_, 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 
48  doProblemCellSetup_ = true;
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 269 of file HcalDetDiagNoiseMonitorClient.cc.

References HcalBaseDQClient::ProblemCellsByDepth.

270 {
272 }
EtaPhiHists * ProblemCellsByDepth

Member Function Documentation

void HcalDetDiagNoiseMonitorClient::analyze ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 51 of file HcalDetDiagNoiseMonitorClient.cc.

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

52 {
53  if (debug_>2) std::cout <<"\tHcalDetDiagNoiseMonitorClient::analyze()"<<std::endl;
55  calculateProblems(ib,ig);
56 }
void setupProblemCells(DQMStore::IBooker &, DQMStore::IGetter &)
virtual void calculateProblems(void)
tuple cout
Definition: gather_cfg.py:121
void HcalDetDiagNoiseMonitorClient::beginRun ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 212 of file HcalDetDiagNoiseMonitorClient.cc.

References HcalBaseDQClient::enoughevents_, and nevts_.

void HcalDetDiagNoiseMonitorClient::calculateProblems ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)

Definition at line 58 of file HcalDetDiagNoiseMonitorClient.cc.

References HcalBaseDQClient::badstatusmap, HcalObjRepresent::CalcIeta(), gather_cfg::cout, HcalBaseDQClient::debug_, EtaPhiHists::depth, 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(), MonitorElement::setBinContent(), and ecaldqm::zside().

59 {
60  if (debug_>2) std::cout <<"\t\tHcalDetDiagNoiseMonitorClient::calculateProblems()"<<std::endl;
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()
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
T min(T a, T b)
Definition: MathUtil.h:58
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)
Definition: DDAxes.h:10
void HcalDetDiagNoiseMonitorClient::cleanup ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 221 of file HcalDetDiagNoiseMonitorClient.cc.

221 {}
void HcalDetDiagNoiseMonitorClient::endRun ( void  )
bool HcalDetDiagNoiseMonitorClient::hasErrors_Temp ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 223 of file HcalDetDiagNoiseMonitorClient.cc.

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

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

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

Reimplemented from HcalBaseDQClient.

Definition at line 256 of file HcalDetDiagNoiseMonitorClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 220 of file HcalDetDiagNoiseMonitorClient.cc.

220 {}
void HcalDetDiagNoiseMonitorClient::setupProblemCells ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
private

Definition at line 189 of file HcalDetDiagNoiseMonitorClient.cc.

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

Referenced by analyze().

190 {
191 
193  problemnames_.clear();
194 
195  // Put the appropriate name of your problem summary here
196  ProblemCells=ib.book2D(" ProblemDetDiagNoiseMonitor",
197  " Problem DetDiagNoiseMonitor Rate for all HCAL;ieta;iphi",
198  85,-42.5,42.5,
199  72,0.5,72.5);
200  problemnames_.push_back(ProblemCells->getName());
201  if (debug_>1)
202  std::cout << "Tried to create ProblemCells Monitor Element in directory "<<subdir_<<" \t Failed? "<<(ProblemCells==0)<<std::endl;
203  ib.setCurrentFolder(subdir_+"problem_DetDiagNoiseMonitor");
205  ProblemCellsByDepth->setup(ib," Problem DetDiagNoiseMonitor Rate");
206  for (unsigned int i=0; i<ProblemCellsByDepth->depth.size();++i)
207  problemnames_.push_back(ProblemCellsByDepth->depth[i]->getName());
208 
209  doProblemCellSetup_ = false;
210 }
const std::string & getName(void) const
get name of ME
int i
Definition: DBlmapReader.cc:9
MonitorElement * ProblemCells
std::vector< MonitorElement * > depth
std::vector< std::string > problemnames_
EtaPhiHists * ProblemCellsByDepth
void setup(DQMStore::IBooker &m_dbe, std::string Name, std::string Units="")
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
std::string subdir_
tuple cout
Definition: gather_cfg.py:121
bool HcalDetDiagNoiseMonitorClient::test_enabled ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 258 of file HcalDetDiagNoiseMonitorClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 261 of file HcalDetDiagNoiseMonitorClient.cc.

262 {
263  // This gets called by HcalMonitorClient
264  // trigger primitives don't yet contribute to channel status (though they could...)
265  // see dead or hot cell code for an example
266 
267 } //void HcalDetDiagNoiseMonitorClient::updateChannelStatus

Member Data Documentation

bool HcalDetDiagNoiseMonitorClient::doProblemCellSetup_
private
int HcalDetDiagNoiseMonitorClient::nevts_
private

Definition at line 35 of file HcalDetDiagNoiseMonitorClient.h.

Referenced by beginRun().