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

#include <HcalDetDiagTimingClient.h>

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

Constructor & Destructor Documentation

HcalDetDiagTimingClient::HcalDetDiagTimingClient ( )
inline

Constructors.

Definition at line 13 of file HcalDetDiagTimingClient.h.

References HcalBaseDQClient::name_.

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

Definition at line 18 of file HcalDetDiagTimingClient.cc.

References HcalBaseDQClient::name_.

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

Definition at line 23 of file HcalDetDiagTimingClient.cc.

References HcalBaseDQClient::badChannelStatusMask_, HcalBaseDQClient::cloneME_, HcalBaseDQClient::debug_, doProblemCellSetup_, HcalBaseDQClient::enableCleanup_, edm::ParameterSet::getUntrackedParameter(), HcalBaseDQClient::minerrorrate_, HcalBaseDQClient::minevents_, HcalBaseDQClient::name_, HcalBaseDQClient::Online_, 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>("DetDiagTimingFolder","DetDiagTimingMonitor_Hcal/"); // DetDiagTiming_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>("DetDiagTiming_validHtmlOutput",true);
37  cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
38  badChannelStatusMask_ = ps.getUntrackedParameter<int>("DetDiagTiming_BadChannelStatusMask",
39  ps.getUntrackedParameter<int>("BadChannelStatusMask",0));
40 
41  minerrorrate_ = ps.getUntrackedParameter<double>("DetDiagTiming_minerrorrate",
42  ps.getUntrackedParameter<double>("minerrorrate",0.05));
43  minevents_ = ps.getUntrackedParameter<int>("DetDiagTiming_minevents",
44  ps.getUntrackedParameter<int>("minevents",1));
45  Online_ = ps.getUntrackedParameter<bool>("online",false);
46 
47  ProblemCells=0;
49 
50  doProblemCellSetup_ = true;
51 }
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * ProblemCells
EtaPhiHists * ProblemCellsByDepth
std::string subdir_
std::string prefixME_
HcalDetDiagTimingClient::~HcalDetDiagTimingClient ( )

Destructor.

Definition at line 272 of file HcalDetDiagTimingClient.cc.

References HcalBaseDQClient::ProblemCellsByDepth.

273 {
275 }
EtaPhiHists * ProblemCellsByDepth

Member Function Documentation

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

Reimplemented from HcalBaseDQClient.

Definition at line 53 of file HcalDetDiagTimingClient.cc.

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

54 {
55  if (debug_>2) std::cout <<"\tHcalDetDiagTimingClient::analyze()"<<std::endl;
57  calculateProblems(ib,ig);
58 }
void setupProblemCells(DQMStore::IBooker &, DQMStore::IGetter &)
virtual void calculateProblems(void)
tuple cout
Definition: gather_cfg.py:121
void HcalDetDiagTimingClient::beginRun ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 215 of file HcalDetDiagTimingClient.cc.

References HcalBaseDQClient::enoughevents_, and nevts_.

216 {
217  enoughevents_=false;
218  nevts_=0;
219 }
void HcalDetDiagTimingClient::calculateProblems ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)

Definition at line 60 of file HcalDetDiagTimingClient.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::name(), phi, HcalBaseDQClient::ProblemCells, HcalBaseDQClient::ProblemCellsByDepth, MonitorElement::Reset(), MonitorElement::setBinContent(), and ecaldqm::zside().

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

Reimplemented from HcalBaseDQClient.

Definition at line 224 of file HcalDetDiagTimingClient.cc.

Referenced by esMonitoring.FDJsonServer::handle_close().

224 {}
void HcalDetDiagTimingClient::endJob ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 189 of file HcalDetDiagTimingClient.cc.

189 {}
bool HcalDetDiagTimingClient::hasErrors_Temp ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 226 of file HcalDetDiagTimingClient.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.

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

Reimplemented from HcalBaseDQClient.

Definition at line 260 of file HcalDetDiagTimingClient.cc.

260 {return false;}
bool HcalDetDiagTimingClient::hasWarnings_Temp ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 259 of file HcalDetDiagTimingClient.cc.

259 {return false;}
void HcalDetDiagTimingClient::setup ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 223 of file HcalDetDiagTimingClient.cc.

223 {}
void HcalDetDiagTimingClient::setupProblemCells ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
private

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

192 {
193 
195  problemnames_.clear();
196 
197  // Put the appropriate name of your problem summary here
198  ProblemCells=ib.book2D(" ProblemDetDiagTiming",
199  " Problem DetDiagTiming Rate for all HCAL;ieta;iphi",
200  85,-42.5,42.5,
201  72,0.5,72.5);
202  problemnames_.push_back(ProblemCells->getName());
203  if (debug_>1)
204  std::cout << "Tried to create ProblemCells Monitor Element in directory "<<subdir_<<" \t Failed? "<<(ProblemCells==0)<<std::endl;
205  ib.setCurrentFolder(subdir_+"problem_DetDiagTiming");
207  ProblemCellsByDepth->setup(ib," Problem DetDiagTiming Rate");
208  for (unsigned int i=0; i<ProblemCellsByDepth->depth.size();++i)
209  problemnames_.push_back(ProblemCellsByDepth->depth[i]->getName());
210 
211  doProblemCellSetup_ = false;
212 
213 }
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 HcalDetDiagTimingClient::test_enabled ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 261 of file HcalDetDiagTimingClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 264 of file HcalDetDiagTimingClient.cc.

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

Member Data Documentation

bool HcalDetDiagTimingClient::doProblemCellSetup_
private

Definition at line 38 of file HcalDetDiagTimingClient.h.

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

int HcalDetDiagTimingClient::nevts_
private

Definition at line 35 of file HcalDetDiagTimingClient.h.

Referenced by beginRun().