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

#include <HcalDetDiagTimingClient.h>

Inheritance diagram for HcalDetDiagTimingClient:
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)
 
 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
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 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_, 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 }
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * ProblemCells
EtaPhiHists * ProblemCellsByDepth
std::string subdir_
std::string prefixME_
HcalDetDiagTimingClient::~HcalDetDiagTimingClient ( )

Destructor.

Definition at line 276 of file HcalDetDiagTimingClient.cc.

277 {}

Member Function Documentation

void HcalDetDiagTimingClient::analyze ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 51 of file HcalDetDiagTimingClient.cc.

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

Referenced by endRun().

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

Reimplemented from HcalBaseDQClient.

Definition at line 187 of file HcalDetDiagTimingClient.cc.

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

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

Reimplemented from HcalBaseDQClient.

Definition at line 198 of file HcalDetDiagTimingClient.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 <<"<HcalDetDiagTimingClient::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(" ProblemDetDiagTiming",
211  " Problem DetDiagTiming 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_DetDiagTiming");
219  ProblemCellsByDepth->setup(dqmStore_," Problem DetDiagTiming 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:1056
DQMStore * dqmStore_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:639
void HcalDetDiagTimingClient::calculateProblems ( void  )
virtual

Reimplemented from HcalBaseDQClient.

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

Referenced by analyze().

58 {
59  if (debug_>2) std::cout <<"\t\tHcalDetDiagTimingClient::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;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 <<"<HcalDetDiagTimingClient::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 <<"<HcalDetDiagTimingClient::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;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 <<"<HcalDetDiagTimingClient::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
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 HcalDetDiagTimingClient::cleanup ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 228 of file HcalDetDiagTimingClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 196 of file HcalDetDiagTimingClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 225 of file HcalDetDiagTimingClient.cc.

References analyze().

bool HcalDetDiagTimingClient::hasErrors_Temp ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 230 of file HcalDetDiagTimingClient.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 <<"<HcalDetDiagTimingClient::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 HcalDetDiagTimingClient::hasOther_Temp ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 264 of file HcalDetDiagTimingClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 263 of file HcalDetDiagTimingClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 227 of file HcalDetDiagTimingClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 265 of file HcalDetDiagTimingClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 268 of file HcalDetDiagTimingClient.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 HcalDetDiagTimingClient::updateChannelStatus

Member Data Documentation

int HcalDetDiagTimingClient::nevts_
private

Definition at line 36 of file HcalDetDiagTimingClient.h.

Referenced by beginRun().