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

#include <HcalNZSClient.h>

Inheritance diagram for HcalNZSClient:
HcalBaseDQClient

Public Member Functions

void analyze (DQMStore::IBooker &, DQMStore::IGetter &)
 
void beginRun (void)
 
void calculateProblems (DQMStore::IBooker &, DQMStore::IGetter &)
 
void cleanup (void)
 
void endJob (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
virtual void calculateProblems (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)
 
void setTopo (const HcalTopology *topo)
 
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_
 
const HcalTopologytopo_
 
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_, 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>("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 
48  doProblemCellSetup_ = true;
49 }
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * ProblemCells
EtaPhiHists * ProblemCellsByDepth
bool doProblemCellSetup_
Definition: HcalNZSClient.h:39
std::string subdir_
std::string prefixME_
HcalNZSClient::~HcalNZSClient ( )

Destructor.

Definition at line 255 of file HcalNZSClient.cc.

References HcalBaseDQClient::ProblemCellsByDepth.

256 {
258 }
EtaPhiHists * ProblemCellsByDepth

Member Function Documentation

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

Reimplemented from HcalBaseDQClient.

Definition at line 51 of file HcalNZSClient.cc.

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

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

Reimplemented from HcalBaseDQClient.

Definition at line 198 of file HcalNZSClient.cc.

References HcalBaseDQClient::enoughevents_, and nevts_.

199 {
200  enoughevents_=false;
201  nevts_=0;
202 }
void HcalNZSClient::calculateProblems ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)

Definition at line 58 of file HcalNZSClient.cc.

References HcalBaseDQClient::badstatusmap, HcalObjRepresent::CalcIeta(), gather_cfg::cout, ztail::d, 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::minevents_, HcalBaseDQClient::name(), phi, HcalBaseDQClient::ProblemCells, HcalBaseDQClient::ProblemCellsByDepth, MonitorElement::Reset(), MonitorElement::setBinContent(), and ecaldqm::zside().

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

Reimplemented from HcalBaseDQClient.

Definition at line 207 of file HcalNZSClient.cc.

Referenced by esMonitoring.FDJsonServer::handle_close().

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

Reimplemented from HcalBaseDQClient.

Definition at line 172 of file HcalNZSClient.cc.

172 {}
bool HcalNZSClient::hasErrors_Temp ( void  )
virtual

Reimplemented from HcalBaseDQClient.

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

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

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

Reimplemented from HcalBaseDQClient.

Definition at line 242 of file HcalNZSClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 206 of file HcalNZSClient.cc.

206 {}
void HcalNZSClient::setupProblemCells ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
private

Definition at line 174 of file HcalNZSClient.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().

175 {
176 
178  problemnames_.clear();
179 
180  // Put the appropriate name of your problem summary here
181  ProblemCells=ib.book2D(" ProblemNZS",
182  " Problem NZS Rate for all HCAL;ieta;iphi",
183  85,-42.5,42.5,
184  72,0.5,72.5);
185  problemnames_.push_back(ProblemCells->getName());
186  if (debug_>1)
187  std::cout << "Tried to create ProblemCells Monitor Element in directory "<<subdir_<<" \t Failed? "<<(ProblemCells==0)<<std::endl;
188  ib.setCurrentFolder(subdir_+"problem_NZS");
190  ProblemCellsByDepth->setup(ib," Problem NZS Rate");
191  for (unsigned int i=0; i<ProblemCellsByDepth->depth.size();++i)
192  problemnames_.push_back(ProblemCellsByDepth->depth[i]->getName());
193 
194  doProblemCellSetup_ = false;
195 
196 }
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="")
bool doProblemCellSetup_
Definition: HcalNZSClient.h:39
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 HcalNZSClient::test_enabled ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 244 of file HcalNZSClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 247 of file HcalNZSClient.cc.

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

Member Data Documentation

bool HcalNZSClient::doProblemCellSetup_
private

Definition at line 39 of file HcalNZSClient.h.

Referenced by analyze(), HcalNZSClient(), and setupProblemCells().

int HcalNZSClient::nevts_
private

Definition at line 35 of file HcalNZSClient.h.

Referenced by beginRun().