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
HcalNZSClient Class Reference

#include <HcalNZSClient.h>

Inheritance diagram for HcalNZSClient:
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)
 
 HcalNZSClient ()
 Constructors. More...
 
 HcalNZSClient (std::string myname)
 
 HcalNZSClient (std::string myname, const edm::ParameterSet &ps)
 
void setup (void)
 
bool test_enabled (void)
 
void updateChannelStatus (std::map< HcalDetId, unsigned int > &myqual)
 
 ~HcalNZSClient ()
 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 HcalNZSClient.h.

Constructor & Destructor Documentation

HcalNZSClient::HcalNZSClient ( )
inline

Constructors.

Definition at line 13 of file HcalNZSClient.h.

References HcalBaseDQClient::name_.

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

Definition at line 18 of file HcalNZSClient.cc.

References HcalBaseDQClient::name_.

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

Definition at line 23 of file HcalNZSClient.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>("NZSFolder","NZSMonitor_Hcal/"); // NZSMonitor_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>("NZS_validHtmlOutput",true);
37  cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
38  badChannelStatusMask_ = ps.getUntrackedParameter<int>("NZS_BadChannelStatusMask",
39  ps.getUntrackedParameter<int>("BadChannelStatusMask",0));
40 
41  minerrorrate_ = ps.getUntrackedParameter<double>("NZS_minerrorrate",
42  ps.getUntrackedParameter<double>("minerrorrate",0.01));
43  minevents_ = ps.getUntrackedParameter<int>("NZS_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_
HcalNZSClient::~HcalNZSClient ( )

Destructor.

Definition at line 259 of file HcalNZSClient.cc.

260 {}

Member Function Documentation

void HcalNZSClient::analyze ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 49 of file HcalNZSClient.cc.

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

Referenced by endRun().

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

Reimplemented from HcalBaseDQClient.

Definition at line 170 of file HcalNZSClient.cc.

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

171 {
173  if (debug_>0)
174  {
175  std::cout <<"<HcalNZSClient::beginJob()> Displaying dqmStore directory structure:"<<std::endl;
177  }
178 }
tuple cout
Definition: gather_cfg.py:121
void showDirStructure(void) const
Definition: DQMStore.cc:3332
DQMStore * dqmStore_
void HcalNZSClient::beginRun ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 181 of file HcalNZSClient.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_.

182 {
183  enoughevents_=false;
184  if (!dqmStore_)
185  {
186  if (debug_>0) std::cout <<"<HcalNZSClient::beginRun> dqmStore does not exist!"<<std::endl;
187  return;
188  }
190  problemnames_.clear();
191 
192  // Put the appropriate name of your problem summary here
193  ProblemCells=dqmStore_->book2D(" ProblemNZS",
194  " Problem NZS Rate for all HCAL;ieta;iphi",
195  85,-42.5,42.5,
196  72,0.5,72.5);
197  problemnames_.push_back(ProblemCells->getName());
198  if (debug_>1)
199  std::cout << "Tried to create ProblemCells Monitor Element in directory "<<subdir_<<" \t Failed? "<<(ProblemCells==0)<<std::endl;
200  dqmStore_->setCurrentFolder(subdir_+"problem_NZS");
202  ProblemCellsByDepth->setup(dqmStore_," Problem NZS Rate");
203  for (unsigned int i=0; i<ProblemCellsByDepth->depth.size();++i)
204  problemnames_.push_back(ProblemCellsByDepth->depth[i]->getName());
205  nevts_=0;
206 }
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:1082
DQMStore * dqmStore_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
void HcalNZSClient::calculateProblems ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 55 of file HcalNZSClient.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::minevents_, 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\tHcalNZSClient::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  /*
86  // This is a sample of how to get a histogram from the task that can then be used for evaluation purposes
87  TH2F* DigiPresentByDepth[i]
88  MonitorElement* me;
89  for (int i=0;i<4;++i)
90  {
91  std::string s=subdir_+"dead_digi_never_present/"+name[i]+"Digi Present At Least Once";
92  me=dqmStore_->get(s.c_str());
93  DigiPresentByDepth[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, DigiPresentByDepth[i], debug_);
94  }
95  */
96 
97 
98  // Because we're clearing and re-forming the problem cell histogram here, we don't need to do any cute
99  // setting of the underflow bin to 0, and we can plot results as a raw rate between 0-1.
100 
101  for (unsigned int d=0;ProblemCellsByDepth!=0 && d<ProblemCellsByDepth->depth.size();++d)
102  {
103  if (ProblemCellsByDepth->depth[d]==0) continue;
104 
105  //totalevents=DigiPresentByDepth[d]->GetBinContent(0);
106  totalevents=0;
107  if (totalevents==0 || totalevents<minevents_) continue;
108  etabins=(ProblemCellsByDepth->depth[d]->getTH2F())->GetNbinsX();
109  phibins=(ProblemCellsByDepth->depth[d]->getTH2F())->GetNbinsY();
110  problemvalue=0;
111  for (int eta=0;eta<etabins;++eta)
112  {
113  int ieta=CalcIeta(eta,d+1);
114  if (ieta==-9999) continue;
115  for (int phi=0;phi<phibins;++phi)
116  {
117  problemvalue=0;
118  //if (DigiPresentByDepth[d]!=0 && DigiPresentByDepth[d]->GetBinContent(eta+1,phi+1)==0) problemvalue=totalevents;
119  if (problemvalue==0) continue;
120  problemvalue/=totalevents; // problem value is a rate; should be between 0 and 1
121  problemvalue = std::min(1.,problemvalue);
122 
123  zside=0;
124  if (isHF(eta,d+1)) // shift ieta by 1 for HF
125  ieta<0 ? zside = -1 : zside = 1;
126 
127  // For problem cells that exceed our allowed rate,
128  // set the values to -1 if the cells are already marked in the status database
129  if (problemvalue>minerrorrate_)
130  {
131  HcalSubdetector subdet=HcalEmpty;
132  if (isHB(eta,d+1))subdet=HcalBarrel;
133  else if (isHE(eta,d+1)) subdet=HcalEndcap;
134  else if (isHF(eta,d+1)) subdet=HcalForward;
135  else if (isHO(eta,d+1)) subdet=HcalOuter;
136  HcalDetId hcalid(subdet, ieta, phi+1, (int)(d+1));
137  if (badstatusmap.find(hcalid)!=badstatusmap.end())
138  problemvalue=999;
139  }
140 
141  ProblemCellsByDepth->depth[d]->setBinContent(eta+1,phi+1,problemvalue);
142  if (ProblemCells!=0) ProblemCells->Fill(ieta+zside,phi+1,problemvalue);
143  } // loop on phi
144  } // loop on eta
145  } // loop on depth
146 
147  if (ProblemCells==0)
148  {
149  if (debug_>0) std::cout <<"<HcalNZSClient::analyze> ProblemCells histogram does not exist!"<<std::endl;
150  return;
151  }
152 
153  // Normalization of ProblemCell plot, in the case where there are errors in multiple depths
154  etabins=(ProblemCells->getTH2F())->GetNbinsX();
155  phibins=(ProblemCells->getTH2F())->GetNbinsY();
156  for (int eta=0;eta<etabins;++eta)
157  {
158  for (int phi=0;phi<phibins;++phi)
159  {
162  }
163  }
164 
167  return;
168 }
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)
DQMStore * dqmStore_
Definition: DDAxes.h:10
void HcalNZSClient::cleanup ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 211 of file HcalNZSClient.cc.

211 {}
void HcalNZSClient::endJob ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 179 of file HcalNZSClient.cc.

179 {}
void HcalNZSClient::endRun ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 208 of file HcalNZSClient.cc.

References analyze().

208 {analyze();}
void analyze(void)
bool HcalNZSClient::hasErrors_Temp ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 213 of file HcalNZSClient.cc.

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

214 {
215  if (!ProblemCells)
216  {
217  if (debug_>1) std::cout <<"<HcalNZSClient::hasErrors_Temp> ProblemCells histogram does not exist!"<<std::endl;
218  return false;
219  }
220  int problemcount=0;
221  int ieta=-9999;
222 
223  for (int depth=0;depth<4; ++depth)
224  {
225  int etabins = (ProblemCells->getTH2F())->GetNbinsX();
226  int phibins = (ProblemCells->getTH2F())->GetNbinsY();
227  for (int hist_eta=0;hist_eta<etabins;++hist_eta)
228  {
229  for (int hist_phi=0; hist_phi<phibins;++hist_phi)
230  {
231  ieta=CalcIeta(hist_eta,depth+1);
232  if (ieta==-9999) continue;
233  if (ProblemCellsByDepth->depth[depth]==0)
234  continue;
235  if (ProblemCellsByDepth->depth[depth]->getBinContent(hist_eta,hist_phi)>minerrorrate_)
236  ++problemcount;
237 
238  } // for (int hist_phi=1;...)
239  } // for (int hist_eta=1;...)
240  } // for (int depth=0;...)
241 
242  if (problemcount>0) return true;
243  return false;
244 }
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 HcalNZSClient::hasOther_Temp ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 247 of file HcalNZSClient.cc.

247 {return false;}
bool HcalNZSClient::hasWarnings_Temp ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 246 of file HcalNZSClient.cc.

246 {return false;}
void HcalNZSClient::setup ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 210 of file HcalNZSClient.cc.

210 {}
bool HcalNZSClient::test_enabled ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 248 of file HcalNZSClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 251 of file HcalNZSClient.cc.

252 {
253  // This gets called by HcalMonitorClient
254  // trigger primitives don't yet contribute to channel status (though they could...)
255  // see dead or hot cell code for an example
256 
257 } //void HcalNZSClient::updateChannelStatus

Member Data Documentation

int HcalNZSClient::nevts_
private

Definition at line 36 of file HcalNZSClient.h.

Referenced by beginRun().