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

#include <HcalDigiClient.h>

Inheritance diagram for HcalDigiClient:
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)
 
 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
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

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

Destructor.

Definition at line 305 of file HcalDigiClient.cc.

306 {}

Member Function Documentation

void HcalDigiClient::analyze ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 54 of file HcalDigiClient.cc.

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

Referenced by endRun().

55 {
56  if (debug_>2) std::cout <<"\tHcalDigiClient::analyze()"<<std::endl;
58 
59  // Get Pawel's timing plots to form averages
60  TH2F* TimingStudyTime=0;
61  TH2F* TimingStudyOcc=0;
62  std::string s=subdir_+"HFTimingStudy/sumplots/HFTiming_Total_Time";
63 
64  MonitorElement* me=dqmStore_->get(s.c_str());
65  if (me!=0)
66  TimingStudyTime=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_,TimingStudyTime, debug_);
67 
68  s=subdir_+"HFTimingStudy/sumplots/HFTiming_Occupancy";
69  me=dqmStore_->get(s.c_str());
70  if (me!=0)
71  TimingStudyOcc=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_,TimingStudyOcc, debug_);
72 
73  if (HFTiming_averageTime!=0)
74  {
76  if (TimingStudyTime!=0 && TimingStudyOcc!=0)
77  {
78  int etabins=(HFTiming_averageTime->getTH2F())->GetNbinsX();
79  int phibins=(HFTiming_averageTime->getTH2F())->GetNbinsY();
80  for (int x=1;x<=etabins;++x)
81  for (int y=1;y<=phibins;++y)
82  if (TimingStudyOcc->GetBinContent(x,y)!=0)
83  HFTiming_averageTime->setBinContent(x,y,TimingStudyTime->GetBinContent(x,y)*1./TimingStudyOcc->GetBinContent(x,y));
84  }
85  HFTiming_averageTime->getTH2F()->SetMinimum(0);
86  }
87 }
void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * HFTiming_averageTime
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1623
void calculateProblems(void)
std::string subdir_
tuple cout
Definition: gather_cfg.py:121
Definition: DDAxes.h:10
TH2F * getTH2F(void) const
void Reset(void)
reset ME (ie. contents, errors, etc)
DQMStore * dqmStore_
void HcalDigiClient::beginJob ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 216 of file HcalDigiClient.cc.

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

217 {
219  if (debug_>0)
220  {
221  std::cout <<"<HcalDigiClient::beginJob()> Displaying dqmStore directory structure:"<<std::endl;
223  }
224 }
tuple cout
Definition: gather_cfg.py:121
void showDirStructure(void) const
Definition: DQMStore.cc:2961
DQMStore * dqmStore_
void HcalDigiClient::beginRun ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 228 of file HcalDigiClient.cc.

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

229 {
230  enoughevents_=false;
231  if (!dqmStore_)
232  {
233  if (debug_>0) std::cout <<"<HcalDigiClient::beginRun> dqmStore does not exist!"<<std::endl;
234  return;
235  }
237  problemnames_.clear();
238  ProblemCells=dqmStore_->book2D(" ProblemDigis",
239  " Problem Digi Rate for all HCAL;ieta;iphi",
240  85,-42.5,42.5,
241  72,0.5,72.5);
242  problemnames_.push_back(ProblemCells->getName());
243  if (debug_>1)
244  std::cout << "Tried to create ProblemCells Monitor Element in directory "<<subdir_<<" \t Failed? "<<(ProblemCells==0)<<std::endl;
245  dqmStore_->setCurrentFolder(subdir_+"problem_digis");
247  ProblemCellsByDepth->setup(dqmStore_," Problem Digi Rate");
248  for (unsigned int i=0; i<ProblemCellsByDepth->depth.size();++i)
249  problemnames_.push_back(ProblemCellsByDepth->depth[i]->getName());
250 
251  nevts_=0;
252 
253  dqmStore_->setCurrentFolder(subdir_+"HFTimingStudy");
254  HFTiming_averageTime=dqmStore_->book2D("HFTimingStudy_Average_Time","HFTimingStudy Average Time (time sample)",83,-41.5,41.5,72,0.5,72.5);
255 }
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="")
MonitorElement * HFTiming_averageTime
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:1000
DQMStore * dqmStore_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
void HcalDigiClient::calculateProblems ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 89 of file HcalDigiClient.cc.

References HcalBaseDQClient::badstatusmap, HcalObjRepresent::CalcIeta(), HcalBaseDQClient::cloneME_, gather_cfg::cout, HcalBaseDQClient::debug_, EtaPhiHists::depth, HcalBaseDQClient::dqmStore_, HcalBaseDQClient::enoughevents_, eta(), MonitorElement::Fill(), HcalObjRepresent::FillUnphysicalHEHFBins(), DQMStore::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, and HcalBaseDQClient::subdir_.

Referenced by analyze().

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

Reimplemented from HcalBaseDQClient.

Definition at line 260 of file HcalDigiClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 226 of file HcalDigiClient.cc.

226 {}
void HcalDigiClient::endRun ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 257 of file HcalDigiClient.cc.

References analyze().

257 {analyze();}
void analyze(void)
bool HcalDigiClient::hasErrors_Temp ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 262 of file HcalDigiClient.cc.

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

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

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

Reimplemented from HcalBaseDQClient.

Definition at line 294 of file HcalDigiClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 259 of file HcalDigiClient.cc.

259 {}
bool HcalDigiClient::test_enabled ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 296 of file HcalDigiClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 299 of file HcalDigiClient.cc.

300 {
301  // digi client does not alter channel status yet;
302  // look at dead cell or hot cell clients for example code
303 } //void HcalDigiClient::updateChannelStatus

Member Data Documentation

MonitorElement* HcalDigiClient::HFTiming_averageTime
private

Definition at line 37 of file HcalDigiClient.h.

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

int HcalDigiClient::nevts_
private

Definition at line 36 of file HcalDigiClient.h.

Referenced by beginRun().