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

#include <HcalDigiClient.h>

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

Constructor & Destructor Documentation

HcalDigiClient::HcalDigiClient ( )
inline

Constructors.

Definition at line 13 of file HcalDigiClient.h.

References HcalBaseDQClient::name_.

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

Definition at line 18 of file HcalDigiClient.cc.

References HcalBaseDQClient::name_.

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

Definition at line 23 of file HcalDigiClient.cc.

References HcalBaseDQClient::badChannelStatusMask_, HcalBaseDQClient::cloneME_, HcalBaseDQClient::debug_, doProblemCellSetup_, HcalBaseDQClient::enableCleanup_, edm::ParameterSet::getUntrackedParameter(), HcalChannelStatus::HcalCellDead, HFTiming_averageTime, 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>("DigiFolder","DigiMonitor_Hcal/"); // DigiMonitor_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>("Digi_validHtmlOutput",true);
37  cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
38  badChannelStatusMask_ = ps.getUntrackedParameter<int>("Digi_BadChannelStatusMask",
39  ps.getUntrackedParameter<int>("BadChannelStatusMask",
40  (1<<HcalChannelStatus::HcalCellDead))); // identify channel status values to mask
41 
42  minerrorrate_ = ps.getUntrackedParameter<double>("Digi_minerrorrate",
43  ps.getUntrackedParameter<double>("minerrorrate",0.05));
44  minevents_ = ps.getUntrackedParameter<int>("Digi_minevents",
45  ps.getUntrackedParameter<int>("minevents",1));
46  Online_ = ps.getUntrackedParameter<bool>("online",false);
47 
49  ProblemCells=0;
50 
52 
53  doProblemCellSetup_ = true;
54 }
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * ProblemCells
MonitorElement * HFTiming_averageTime
EtaPhiHists * ProblemCellsByDepth
bool doProblemCellSetup_
std::string subdir_
std::string prefixME_
HcalDigiClient::~HcalDigiClient ( )

Destructor.

Definition at line 299 of file HcalDigiClient.cc.

References HcalBaseDQClient::ProblemCellsByDepth.

300 {
302 }
EtaPhiHists * ProblemCellsByDepth

Member Function Documentation

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

Reimplemented from HcalBaseDQClient.

Definition at line 56 of file HcalDigiClient.cc.

References HcalBaseDQClient::calculateProblems(), HcalBaseDQClient::cloneME_, gather_cfg::cout, HcalBaseDQClient::debug_, doProblemCellSetup_, DQMStore::IGetter::get(), MonitorElement::getTH2F(), HFTiming_averageTime, MonitorElement::Reset(), alignCSCRings::s, MonitorElement::setBinContent(), setupProblemCells(), AlCaHLTBitMon_QueryRunRegistry::string, HcalBaseDQClient::subdir_, x, and y.

57 {
58  if (debug_>2) std::cout <<"\tHcalDigiClient::analyze()"<<std::endl;
60  calculateProblems(ib,ig);
61 
62  // Get Pawel's timing plots to form averages
63  TH2F* TimingStudyTime=0;
64  TH2F* TimingStudyOcc=0;
65  std::string s=subdir_+"HFTimingStudy/sumplots/HFTiming_Total_Time";
66 
67  MonitorElement* me=ig.get(s.c_str());
68  if (me!=0)
69  TimingStudyTime=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_,TimingStudyTime, debug_);
70 
71  s=subdir_+"HFTimingStudy/sumplots/HFTiming_Occupancy";
72  me=ig.get(s.c_str());
73  if (me!=0)
74  TimingStudyOcc=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_,TimingStudyOcc, debug_);
75 
76  if (HFTiming_averageTime!=0)
77  {
79  if (TimingStudyTime!=0 && TimingStudyOcc!=0)
80  {
81  int etabins=(HFTiming_averageTime->getTH2F())->GetNbinsX();
82  int phibins=(HFTiming_averageTime->getTH2F())->GetNbinsY();
83  for (int x=1;x<=etabins;++x)
84  for (int y=1;y<=phibins;++y)
85  if (TimingStudyOcc->GetBinContent(x,y)!=0)
86  HFTiming_averageTime->setBinContent(x,y,TimingStudyTime->GetBinContent(x,y)*1./TimingStudyOcc->GetBinContent(x,y));
87  }
88  HFTiming_averageTime->getTH2F()->SetMinimum(0);
89  }
90 }
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:302
MonitorElement * HFTiming_averageTime
void setupProblemCells(DQMStore::IBooker &, DQMStore::IGetter &)
bool doProblemCellSetup_
virtual void calculateProblems(void)
std::string subdir_
tuple cout
Definition: gather_cfg.py:121
TH2F * getTH2F(void) const
void Reset(void)
reset ME (ie. contents, errors, etc)
void HcalDigiClient::beginRun ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 245 of file HcalDigiClient.cc.

References HcalBaseDQClient::enoughevents_, and nevts_.

246 {
247  enoughevents_=false;
248  nevts_=0;
249 }
void HcalDigiClient::calculateProblems ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)

Definition at line 92 of file HcalDigiClient.cc.

References HcalBaseDQClient::badstatusmap, HcalObjRepresent::CalcIeta(), HcalBaseDQClient::cloneME_, gather_cfg::cout, ztail::d, HcalBaseDQClient::debug_, EtaPhiHists::depth, HcalBaseDQClient::enoughevents_, eta, MonitorElement::Fill(), HcalObjRepresent::FillUnphysicalHEHFBins(), DQMStore::IGetter::get(), MonitorElement::getBinContent(), MonitorElement::getTH2F(), HcalBarrel, HcalEmpty, HcalEndcap, HcalEtaPhiHistNames(), HcalForward, HcalOuter, i, isHB(), isHE(), isHF(), isHO(), HcalBaseDQClient::minerrorrate_, HcalBaseDQClient::minevents_, HcalBaseDQClient::name(), phi, HcalBaseDQClient::ProblemCells, HcalBaseDQClient::ProblemCellsByDepth, MonitorElement::Reset(), alignCSCRings::s, MonitorElement::setBinContent(), AlCaHLTBitMon_QueryRunRegistry::string, HcalBaseDQClient::subdir_, and ecaldqm::zside().

93 {
94  if (debug_>2) std::cout <<"\t\tHcalDigiClient::calculateProblems()"<<std::endl;
95  int totalevents=0;
96  int etabins=0, phibins=0, zside=0;
97  double problemvalue=0;
98 
99  // Clear away old problems
100  if (ProblemCells!=0)
101  {
102  ProblemCells->Reset();
103  (ProblemCells->getTH2F())->SetMaximum(1.05);
104  (ProblemCells->getTH2F())->SetMinimum(0.);
105  }
106  for (unsigned int d=0;ProblemCellsByDepth!=0 && d<ProblemCellsByDepth->depth.size();++d)
107  {
108  if (ProblemCellsByDepth->depth[d]!=0)
109  {
110  ProblemCellsByDepth->depth[d]->Reset();
111  (ProblemCellsByDepth->depth[d]->getTH2F())->SetMaximum(1.05);
112  (ProblemCellsByDepth->depth[d]->getTH2F())->SetMinimum(0.);
113  }
114  }
115 
116  // Get histograms that are used in testing
117  TH2F* BadDigisByDepth[4];
118  TH2F* GoodDigisByDepth[4];
119 
120  std::vector<std::string> name = HcalEtaPhiHistNames();
121 
122  bool gothistos=true;
123 
124  MonitorElement* me;
125  for (int i=0;i<4;++i)
126  {
127  std::string s=subdir_+"bad_digis/bad_digi_occupancy/"+name[i]+"Bad Digi Map";
128  me=ig.get(s.c_str());
129  if (me==0)
130  {
131  gothistos=false;
132  if (debug_>0) std::cout <<"<HcalDigiClient::calculateProblems> Could not get histogram with name "<<s<<std::endl;
133  }
134  BadDigisByDepth[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, BadDigisByDepth[i], debug_);
135 
136  s=subdir_+"good_digis/digi_occupancy/"+name[i]+" Digi Eta-Phi Occupancy Map";
137  me=ig.get(s.c_str());
138  if (me==0)
139  {
140  gothistos=false;
141  if (debug_>0) std::cout <<"<HcalDigiClient::calculateProblems> Could not get histogram with name "<<s<<std::endl;
142  }
143  GoodDigisByDepth[i]=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_, BadDigisByDepth[i], debug_);
144  }
145 
146  if (gothistos==false)
147  {
148  if (debug_>0) std::cout <<"<HcalDigiClient::calculateProblems> Unable to get all necessary histograms to evaluate problem rate"<<std::endl;
149  return;
150  }
151 
152  for (unsigned int d=0;ProblemCellsByDepth!=0 && d<ProblemCellsByDepth->depth.size();++d)
153  {
154  if (ProblemCellsByDepth->depth[d]==0) continue;
155 
156  if (BadDigisByDepth[d]==0 || GoodDigisByDepth[d]==0) continue;
157  totalevents=(int)GoodDigisByDepth[d]->GetBinContent(0,0);
158  if (totalevents<minevents_ ) continue;
159  enoughevents_=true;
160  etabins=(ProblemCellsByDepth->depth[d]->getTH2F())->GetNbinsX();
161  phibins=(ProblemCellsByDepth->depth[d]->getTH2F())->GetNbinsY();
162  for (int eta=0;eta<etabins;++eta)
163  {
164  int ieta=CalcIeta(eta,d+1);
165  if (ieta==-9999) continue;
166  for (int phi=0;phi<phibins;++phi)
167  {
168  problemvalue=0; // problem fraction sums over all three tests
169  if (BadDigisByDepth[d]->GetBinContent(eta+1,phi+1) > 0) // bad cells found
170  problemvalue=(BadDigisByDepth[d]->GetBinContent(eta+1,phi+1)*1./(BadDigisByDepth[d]->GetBinContent(eta+1,phi+1)+GoodDigisByDepth[d]->GetBinContent(eta+1,phi+1)));
171 
172  zside=0;
173  if (isHF(eta,d+1)) // shift ieta by 1 for HF
174  ieta<0 ? zside = -1 : zside = 1;
175 
176  // For problem cells that exceed our allowed rate,
177  // set the values to -1 if the cells are already marked in the status database
178  if (problemvalue>minerrorrate_)
179  {
180  HcalSubdetector subdet=HcalEmpty;
181  if (isHB(eta,d+1))subdet=HcalBarrel;
182  else if (isHE(eta,d+1)) subdet=HcalEndcap;
183  else if (isHF(eta,d+1)) subdet=HcalForward;
184  else if (isHO(eta,d+1)) subdet=HcalOuter;
185  HcalDetId hcalid(subdet, ieta, phi+1, (int)(d+1));
186  if (badstatusmap.find(hcalid)!=badstatusmap.end())
187  problemvalue=999;
188  }
189  ProblemCellsByDepth->depth[d]->setBinContent(eta+1,phi+1,problemvalue);
190  if (ProblemCells!=0) ProblemCells->Fill(ieta+zside,phi+1,problemvalue);
191  } // loop on phi
192  } // loop on eta
193  } // loop on depth
194 
195  if (ProblemCells==0)
196  {
197  if (debug_>0) std::cout <<"<HcalDigiClient::analyze> ProblemCells histogram does not exist!"<<std::endl;
198  return;
199  }
200 
201  // Normalization of ProblemCell plot, in the case where there are errors in multiple depths
202  etabins=(ProblemCells->getTH2F())->GetNbinsX();
203  phibins=(ProblemCells->getTH2F())->GetNbinsY();
204  for (int eta=0;eta<etabins;++eta)
205  {
206  for (int phi=0;phi<phibins;++phi)
207  {
210  }
211  }
214  return;
215 }
bool isHO(int etabin, int depth)
int i
Definition: DBlmapReader.cc:9
MonitorElement * ProblemCells
std::string name()
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:302
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
bool isHB(int etabin, int depth)
bool isHF(int etabin, int depth)
std::string subdir_
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 HcalDigiClient::cleanup ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 254 of file HcalDigiClient.cc.

Referenced by esMonitoring.FDJsonServer::handle_close().

254 {}
void HcalDigiClient::endJob ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 219 of file HcalDigiClient.cc.

219 {}
bool HcalDigiClient::hasErrors_Temp ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 256 of file HcalDigiClient.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.

257 {
258  if (!ProblemCells)
259  {
260  if (debug_>1) std::cout <<"<HcalDigiClient::hasErrors_Temp> ProblemCells histogram does not exist!"<<std::endl;
261  return false;
262  }
263  int problemcount=0;
264  int ieta=-9999;
265 
266  for (int depth=0;depth<4; ++depth)
267  {
268  int etabins = (ProblemCells->getTH2F())->GetNbinsX();
269  int phibins = (ProblemCells->getTH2F())->GetNbinsY();
270  for (int hist_eta=0;hist_eta<etabins;++hist_eta)
271  {
272  for (int hist_phi=0; hist_phi<phibins;++hist_phi)
273  {
274  ieta=CalcIeta(hist_eta,depth+1);
275  if (ieta==-9999) continue;
277  continue;
278  if (ProblemCellsByDepth->depth[depth]->getBinContent(hist_eta,hist_phi)>minerrorrate_)
279  ++problemcount;
280  } // for (int hist_phi=1;...)
281  } // for (int hist_eta=1;...)
282  } // for (int depth=0;...)
283 
284  if (problemcount>0) return true;
285  return false;
286 }
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 HcalDigiClient::hasOther_Temp ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 289 of file HcalDigiClient.cc.

289 {return false;}
bool HcalDigiClient::hasWarnings_Temp ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 288 of file HcalDigiClient.cc.

288 {return false;}
void HcalDigiClient::setup ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 253 of file HcalDigiClient.cc.

253 {}
void HcalDigiClient::setupProblemCells ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
private

Definition at line 221 of file HcalDigiClient.cc.

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

Referenced by analyze().

222 {
224  problemnames_.clear();
225  ProblemCells=ib.book2D(" ProblemDigis",
226  " Problem Digi Rate for all HCAL;ieta;iphi",
227  85,-42.5,42.5,
228  72,0.5,72.5);
229  problemnames_.push_back(ProblemCells->getName());
230  if (debug_>1)
231  std::cout << "Tried to create ProblemCells Monitor Element in directory "<<subdir_<<" \t Failed? "<<(ProblemCells==0)<<std::endl;
232  ib.setCurrentFolder(subdir_+"problem_digis");
234  ProblemCellsByDepth->setup(ib," Problem Digi Rate");
235  for (unsigned int i=0; i<ProblemCellsByDepth->depth.size();++i)
236  problemnames_.push_back(ProblemCellsByDepth->depth[i]->getName());
237 
238  ib.setCurrentFolder(subdir_+"HFTimingStudy");
239  HFTiming_averageTime=ib.book2D("HFTimingStudy_Average_Time","HFTimingStudy Average Time (time sample)",83,-41.5,41.5,72,0.5,72.5);
240 
241  doProblemCellSetup_ = false;
242 
243 }
const std::string & getName(void) const
get name of ME
int i
Definition: DBlmapReader.cc:9
MonitorElement * ProblemCells
MonitorElement * HFTiming_averageTime
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_
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 HcalDigiClient::test_enabled ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 290 of file HcalDigiClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 293 of file HcalDigiClient.cc.

294 {
295  // digi client does not alter channel status yet;
296  // look at dead cell or hot cell clients for example code
297 } //void HcalDigiClient::updateChannelStatus

Member Data Documentation

bool HcalDigiClient::doProblemCellSetup_
private

Definition at line 39 of file HcalDigiClient.h.

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

MonitorElement* HcalDigiClient::HFTiming_averageTime
private

Definition at line 36 of file HcalDigiClient.h.

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

int HcalDigiClient::nevts_
private

Definition at line 35 of file HcalDigiClient.h.

Referenced by beginRun().