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

#include <HcalBeamClient.h>

Inheritance diagram for HcalBeamClient:
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)
 
 HcalBeamClient ()
 Constructors. More...
 
 HcalBeamClient (std::string myname)
 
 HcalBeamClient (std::string myname, const edm::ParameterSet &ps)
 
void setup (void)
 
bool test_enabled (void)
 
void updateChannelStatus (std::map< HcalDetId, unsigned int > &myqual)
 
 ~HcalBeamClient ()
 Destructor. More...
 
- Public Member Functions inherited from HcalBaseDQClient
 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 ()
 
 ~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_
 
double minerrorrate_
 
int minevents_
 
std::string name_
 
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 HcalBeamClient.h.

Constructor & Destructor Documentation

HcalBeamClient::HcalBeamClient ( )
inline

Constructors.

Definition at line 13 of file HcalBeamClient.h.

References HcalBaseDQClient::name_.

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

Definition at line 20 of file HcalBeamClient.cc.

References HcalBaseDQClient::name_.

21 {
22  name_=myname;
23 }
HcalBeamClient::HcalBeamClient ( std::string  myname,
const edm::ParameterSet ps 
)

Definition at line 25 of file HcalBeamClient.cc.

References HcalBaseDQClient::badChannelStatusMask_, HcalBaseDQClient::cloneME_, HcalBaseDQClient::debug_, HcalBaseDQClient::enableCleanup_, edm::ParameterSet::getUntrackedParameter(), HcalChannelStatus::HcalCellDead, HcalChannelStatus::HcalCellHot, HcalBaseDQClient::minerrorrate_, HcalBaseDQClient::minevents_, HcalBaseDQClient::name_, HcalBaseDQClient::prefixME_, HcalBaseDQClient::ProblemCells, HcalBaseDQClient::ProblemCellsByDepth, HcalBaseDQClient::subdir_, and HcalBaseDQClient::validHtmlOutput_.

26 {
27  name_=myname;
28  enableCleanup_ = ps.getUntrackedParameter<bool>("enableCleanup",false);
29  debug_ = ps.getUntrackedParameter<int>("debug",0);
30  prefixME_ = ps.getUntrackedParameter<std::string>("subSystemFolder","Hcal/");
31  if (prefixME_.substr(prefixME_.size()-1,prefixME_.size())!="/")
32  prefixME_.append("/");
33  subdir_ = ps.getUntrackedParameter<std::string>("BeamFolder","BeamMonitor_Hcal/"); // BeamMonitor_Hcal
34  if (subdir_.size()>0 && subdir_.substr(subdir_.size()-1,subdir_.size())!="/")
35  subdir_.append("/");
36  subdir_=prefixME_+subdir_;
37 
38  validHtmlOutput_ = ps.getUntrackedParameter<bool>("Beam_validHtmlOutput",true);
39  cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
40  // known hot/dead channels blacked out on plot
41  badChannelStatusMask_ = ps.getUntrackedParameter<int>("Beam_BadChannelStatusMask",
42  ps.getUntrackedParameter<int>("BadChannelStatusMask",
45  ));
46 
47  minerrorrate_ = ps.getUntrackedParameter<double>("Beam_minerrorrate",
48  ps.getUntrackedParameter<double>("minerrorrate",0.05));
49  minevents_ = ps.getUntrackedParameter<int>("Beam_minevents",
50  ps.getUntrackedParameter<int>("minevents",1));
51  ProblemCells=0;
53 }
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * ProblemCells
EtaPhiHists * ProblemCellsByDepth
std::string subdir_
std::string prefixME_
HcalBeamClient::~HcalBeamClient ( )

Destructor.

Member Function Documentation

void HcalBeamClient::analyze ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 55 of file HcalBeamClient.cc.

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

Referenced by endRun().

56 {
57  if (debug_>2) std::cout <<"\tHcalBeamClient::analyze()"<<std::endl;
58  enoughevents_=false;
60 }
void calculateProblems(void)
tuple cout
Definition: gather_cfg.py:41
void HcalBeamClient::beginJob ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 181 of file HcalBeamClient.cc.

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

182 {
184  if (debug_>0)
185  {
186  std::cout <<"<HcalBeamClient::beginJob()> Displaying dqmStore directory structure:"<<std::endl;
188  }
189 }
tuple cout
Definition: gather_cfg.py:41
void showDirStructure(void) const
Definition: DQMStore.cc:2539
DQMStore * dqmStore_
void HcalBeamClient::beginRun ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 192 of file HcalBeamClient.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_.

193 {
194  enoughevents_=false;
195  if (!dqmStore_)
196  {
197  if (debug_>0) std::cout <<"<HcalBeamClient::beginRun> dqmStore does not exist!"<<std::endl;
198  return;
199  }
201  problemnames_.clear();
202 
203  // Put the appropriate name of your problem summary here
204  if (ProblemCells==0)
205  ProblemCells=dqmStore_->book2D(" Problem BeamMonitor",
206  " Problem Beam Monitor Rate for all HCAL;ieta;iphi",
207  85,-42.5,42.5,
208  72,0.5,72.5);
209  problemnames_.push_back(ProblemCells->getName());
210  if (debug_>1)
211  std::cout << "Tried to create ProblemCells Monitor Element in directory "<<subdir_<<" \t Failed? "<<(ProblemCells==0)<<std::endl;
212  dqmStore_->setCurrentFolder(subdir_+"problem_beammonitor");
213  nevts_=0;
214  if (ProblemCellsByDepth!=0) return; // histograms already set up
216  ProblemCellsByDepth->setup(dqmStore_," Problem BeamMonitor Rate");
217  for (unsigned int i=0; i<ProblemCellsByDepth->depth.size();++i)
218  problemnames_.push_back(ProblemCellsByDepth->depth[i]->getName());
219 }
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:41
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:647
DQMStore * dqmStore_
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:237
void HcalBeamClient::calculateProblems ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 62 of file HcalBeamClient.cc.

References abs, HcalBaseDQClient::badstatusmap, HcalBaseDQClient::cloneME_, gather_cfg::cout, HcalBaseDQClient::debug_, EtaPhiHists::depth, HcalBaseDQClient::dqmStore_, HcalBaseDQClient::enoughevents_, eta(), MonitorElement::Fill(), FillUnphysicalHEHFBins(), DQMStore::get(), MonitorElement::getBinContent(), MonitorElement::getTH2F(), HcalForward, i, j, HcalBaseDQClient::minerrorrate_, HcalBaseDQClient::minevents_, phi, HcalBaseDQClient::ProblemCells, HcalBaseDQClient::ProblemCellsByDepth, MonitorElement::Reset(), MonitorElement::setBinContent(), and HcalBaseDQClient::subdir_.

Referenced by analyze().

63 {
64  if (debug_>2) std::cout <<"\t\tHcalBeamClient::calculateProblems()"<<std::endl;
65  if(!dqmStore_) return;
66  double totalLumiBlocks=0;
67  // reminder:: lumi histograms work a bit differently, counting total number of lumi blocks, not total number of events
68  int etabins=0, phibins=0, zside=0;
69  double problemvalue=0;
70 
71  // Clear away old problems
72  if (ProblemCells!=0)
73  {
75  (ProblemCells->getTH2F())->SetMaximum(1.05);
76  (ProblemCells->getTH2F())->SetMinimum(0.);
77  }
78  for (unsigned int d=0;ProblemCellsByDepth!=0 && d<ProblemCellsByDepth->depth.size();++d)
79  {
80  if (ProblemCellsByDepth->depth[d]!=0)
81  {
82  ProblemCellsByDepth->depth[d]->Reset();
83  (ProblemCellsByDepth->depth[d]->getTH2F())->SetMaximum(1.05);
84  (ProblemCellsByDepth->depth[d]->getTH2F())->SetMinimum(0.);
85  }
86  }
87 
88  // Get histograms that are used in testing
89  // currently none used,
90 
91  // get the dead and hot cell lumi histograms
92  TH2F* dead = 0;
93  TH2F* hot = 0;
94  MonitorElement* me;
95  me=dqmStore_->get(subdir_+"Lumi/HFlumi_total_deadcells");
96  if (me!=0)
97  dead=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_,dead,debug_);
98  else if (debug_>0) std::cout <<" <HcalBeamClient::calculateProblems> Unable to get dead cell plot 'HFlumi_total_deadcells"<<std::endl;
99  me=dqmStore_->get(subdir_+"Lumi/HFlumi_total_hotcells");
100  if (me!=0)
101  hot=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_,dead,debug_);
102  else if (debug_>0) std::cout <<" <HcalBeamClient::calculateProblems> Unable to get hot cell plot 'HFlumi_total_hotcells"<<std::endl;
103  int myieta=0;
104  int mydepth=0;
105  int myiphi=0;
106 
107  enoughevents_=true; // beam client works a little differently, counting only lumi blocks that have enough events to process. For this reason, let client continue running regardless of lumi blocks processed
108 
109  if (dead!=0 || hot!=0)
110  {
111  if (dead!=0)
112  {
113  totalLumiBlocks=dead->GetBinContent(-1,-1);
114  etabins=dead->GetNbinsX();
115  phibins=dead->GetNbinsY();
116  }
117  else
118  {
119  totalLumiBlocks=hot->GetBinContent(-1,-1);
120  etabins=hot->GetNbinsX();
121  phibins=hot->GetNbinsY();
122  }
123  if (totalLumiBlocks<minevents_ || totalLumiBlocks==0)
124  return;
125  for (int i=0;i<etabins;++i)
126  {
127  i<=3 ? myieta = i-36 : myieta=i+29; // separate HFM, HFP
128  if (abs(myieta)==33 || abs(myieta)==34)
129  mydepth=1;
130  else if (abs(myieta)==35 || abs(myieta)==36)
131  mydepth=2;
132  for (int j=0;j<phibins;++j)
133  {
134  problemvalue=0;
135  myiphi=2*j+1; // lumi HF histograms only have 36 bins
136  if (dead!=0 && dead->GetBinContent(i+1,j+1)*1./totalLumiBlocks>minerrorrate_)
137  {
138  problemvalue+=dead->GetBinContent(i+1,j+1)*1./totalLumiBlocks;
139  if (debug_>1) std::cout <<"<HcalBeamClient::calculateProblem> Dead cell found at ieta = "<<myieta<<" iphi = "<<myiphi<<" depth = "<<mydepth<<std::endl;
140  }
141  if (hot!=0 && hot->GetBinContent(i+1,j+1)*1./totalLumiBlocks>minerrorrate_)
142  {
143  problemvalue+=hot->GetBinContent(i+1,j+1)*1./totalLumiBlocks;
144  if (debug_>1) std::cout <<"<HcalBeamClient::calculateProblem> hot cell found at ieta = "<<myieta<<" iphi = "<<myiphi<<" depth = "<<mydepth<<std::endl;
145  }
146  if (problemvalue==0) continue;
147  // Search for known bad problems in channel status db
148  HcalDetId hcalid(HcalForward, myieta, myiphi, mydepth);
149  if (badstatusmap.find(hcalid)!=badstatusmap.end())
150  problemvalue=999;
151  myieta<0 ? zside=-1 : zside=1;
152  ProblemCellsByDepth->depth[mydepth-1]->Fill(myieta+zside,myiphi,problemvalue);
153  if (ProblemCells!=0) ProblemCells->Fill(myieta+zside,myiphi,problemvalue);
154  }
155  }
156  }
157 
158 
159  if (ProblemCells==0)
160  {
161  if (debug_>0) std::cout <<"<HcalBeamClient::analyze> ProblemCells histogram does not exist!"<<std::endl;
162  return;
163  }
164 
165  // Normalization of ProblemCell plot, in the case where there are errors in multiple depths
166  etabins=(ProblemCells->getTH2F())->GetNbinsX();
167  phibins=(ProblemCells->getTH2F())->GetNbinsY();
168  for (int eta=0;eta<etabins;++eta)
169  {
170  for (int phi=0;phi<phibins;++phi)
171  {
174  }
175  }
178  return;
179 }
int i
Definition: DBlmapReader.cc:9
MonitorElement * ProblemCells
void setBinContent(int binx, double content)
set content of bin (1-D)
#define abs(x)
Definition: mlp_lapack.h:159
T eta() const
void Fill(long long x)
std::vector< MonitorElement * > depth
EtaPhiHists * ProblemCellsByDepth
int j
Definition: DBlmapReader.cc:9
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1270
void FillUnphysicalHEHFBins(EtaPhiHists &hh)
std::string subdir_
std::map< HcalDetId, unsigned int > badstatusmap
double getBinContent(int binx) const
get content of bin (1-D)
tuple cout
Definition: gather_cfg.py:41
TH2F * getTH2F(void) const
void Reset(void)
reset ME (ie. contents, errors, etc)
DQMStore * dqmStore_
Definition: DDAxes.h:10
void HcalBeamClient::cleanup ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 224 of file HcalBeamClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 190 of file HcalBeamClient.cc.

190 {}
void HcalBeamClient::endRun ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 221 of file HcalBeamClient.cc.

References analyze().

221 {analyze();}
void analyze(void)
bool HcalBeamClient::hasErrors_Temp ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 226 of file HcalBeamClient.cc.

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

227 {
228  if (!ProblemCells)
229  {
230  if (debug_>1) std::cout <<"<HcalBeamClient::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;
246  if (ProblemCellsByDepth->depth[depth]==0)
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
EtaPhiHists * ProblemCellsByDepth
int CalcIeta(int subdet, int eta, int depth)
tuple cout
Definition: gather_cfg.py:41
TH2F * getTH2F(void) const
bool HcalBeamClient::hasOther_Temp ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 260 of file HcalBeamClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 259 of file HcalBeamClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 223 of file HcalBeamClient.cc.

223 {}
bool HcalBeamClient::test_enabled ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 261 of file HcalBeamClient.cc.

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

Reimplemented from HcalBaseDQClient.

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

Member Data Documentation

int HcalBeamClient::nevts_
private

Definition at line 36 of file HcalBeamClient.h.

Referenced by beginRun().