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
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 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::Online_, HcalBaseDQClient::prefixME_, HcalBaseDQClient::ProblemCells, HcalBaseDQClient::ProblemCellsByDepth, AlCaHLTBitMon_QueryRunRegistry::string, 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_minLS",1);
50  // minevents_ = ps.getUntrackedParameter<int>("Beam_minevents",
51  // ps.getUntrackedParameter<int>("minevents",1));
52  Online_ = ps.getUntrackedParameter<bool>("online",false);
53 
54  ProblemCells=0;
56 }
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * ProblemCells
EtaPhiHists * ProblemCellsByDepth
std::string subdir_
std::string prefixME_
HcalBeamClient::~HcalBeamClient ( )

Destructor.

Definition at line 276 of file HcalBeamClient.cc.

277 {}

Member Function Documentation

void HcalBeamClient::analyze ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 58 of file HcalBeamClient.cc.

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

Referenced by endRun().

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

Reimplemented from HcalBaseDQClient.

Definition at line 185 of file HcalBeamClient.cc.

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

186 {
188  if (debug_>0)
189  {
190  std::cout <<"<HcalBeamClient::beginJob()> Displaying dqmStore directory structure:"<<std::endl;
192  }
193 }
tuple cout
Definition: gather_cfg.py:121
void showDirStructure(void) const
Definition: DQMStore.cc:2766
DQMStore * dqmStore_
void HcalBeamClient::beginRun ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 196 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_.

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

Reimplemented from HcalBaseDQClient.

Definition at line 65 of file HcalBeamClient.cc.

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

66 {
67  if (debug_>2) std::cout <<"\t\tHcalBeamClient::calculateProblems()"<<std::endl;
68  if(!dqmStore_) return;
69  double totalLumiBlocks=0;
70  // reminder:: lumi histograms work a bit differently, counting total number of lumi blocks, not total number of events
71  int etabins=0, phibins=0, zside=0;
72  double problemvalue=0;
73 
74  // Clear away old problems
75  if (ProblemCells!=0)
76  {
78  (ProblemCells->getTH2F())->SetMaximum(1.05);
79  (ProblemCells->getTH2F())->SetMinimum(0.);
80  }
81  for (unsigned int d=0;ProblemCellsByDepth!=0 && d<ProblemCellsByDepth->depth.size();++d)
82  {
83  if (ProblemCellsByDepth->depth[d]!=0)
84  {
85  ProblemCellsByDepth->depth[d]->Reset();
86  (ProblemCellsByDepth->depth[d]->getTH2F())->SetMaximum(1.05);
87  (ProblemCellsByDepth->depth[d]->getTH2F())->SetMinimum(0.);
88  }
89  }
90 
91  // Get histograms that are used in testing
92  // currently none used,
93 
94  // get the dead and hot cell lumi histograms
95  TH2F* dead = 0;
96  TH2F* hot = 0;
97  MonitorElement* me;
98  me=dqmStore_->get(subdir_+"Lumi/HFlumi_total_deadcells");
99  if (me!=0)
100  dead=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_,dead,debug_);
101  else if (debug_>0) std::cout <<" <HcalBeamClient::calculateProblems> Unable to get dead cell plot 'HFlumi_total_deadcells"<<std::endl;
102  me=dqmStore_->get(subdir_+"Lumi/HFlumi_total_hotcells");
103  if (me!=0)
104  hot=HcalUtilsClient::getHisto<TH2F*>(me, cloneME_,dead,debug_);
105  else if (debug_>0) std::cout <<" <HcalBeamClient::calculateProblems> Unable to get hot cell plot 'HFlumi_total_hotcells"<<std::endl;
106  int myieta=0;
107  int mydepth=0;
108  int myiphi=0;
109 
110  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
111 
112  if (dead!=0 || hot!=0)
113  {
114  if (dead!=0)
115  {
116  totalLumiBlocks=dead->GetBinContent(-1,-1);
117  etabins=dead->GetNbinsX();
118  phibins=dead->GetNbinsY();
119  }
120  else
121  {
122  totalLumiBlocks=hot->GetBinContent(-1,-1);
123  etabins=hot->GetNbinsX();
124  phibins=hot->GetNbinsY();
125  }
126  if (totalLumiBlocks<minevents_ || totalLumiBlocks==0)
127  return;
128  for (int i=0;i<etabins;++i)
129  {
130  i<=3 ? myieta = i-36 : myieta=i+29; // separate HFM, HFP
131  if (abs(myieta)==33 || abs(myieta)==34)
132  mydepth=1;
133  else if (abs(myieta)==35 || abs(myieta)==36)
134  mydepth=2;
135  for (int j=0;j<phibins;++j)
136  {
137  problemvalue=0;
138  myiphi=2*j+1; // lumi HF histograms only have 36 bins
139  if (dead!=0 && dead->GetBinContent(i+1,j+1)*1./totalLumiBlocks>minerrorrate_)
140  {
141  problemvalue+=dead->GetBinContent(i+1,j+1)*1./totalLumiBlocks;
142  if (debug_>1) std::cout <<"<HcalBeamClient::calculateProblem> Dead cell found at ieta = "<<myieta<<" iphi = "<<myiphi<<" depth = "<<mydepth<<std::endl;
143  }
144  if (hot!=0 && hot->GetBinContent(i+1,j+1)*1./totalLumiBlocks>minerrorrate_)
145  {
146  problemvalue+=hot->GetBinContent(i+1,j+1)*1./totalLumiBlocks;
147  if (debug_>1) std::cout <<"<HcalBeamClient::calculateProblem> hot cell found at ieta = "<<myieta<<" iphi = "<<myiphi<<" depth = "<<mydepth<<std::endl;
148  }
149  if (problemvalue==0) continue;
150 
151  // Search for known bad problems in channel status db
152  HcalDetId hcalid(HcalForward, myieta, myiphi, mydepth);
153  if (badstatusmap.find(hcalid)!=badstatusmap.end())
154  problemvalue=999;
155  myieta<0 ? zside=-1 : zside=1;
156  ProblemCellsByDepth->depth[mydepth-1]->Fill(myieta+zside,myiphi,problemvalue);
157  if (ProblemCells!=0) ProblemCells->Fill(myieta+zside,myiphi,problemvalue);
158  }
159  }
160  }
161 
162 
163  if (ProblemCells==0)
164  {
165  if (debug_>0) std::cout <<"<HcalBeamClient::analyze> ProblemCells histogram does not exist!"<<std::endl;
166  return;
167  }
168 
169  // Normalization of ProblemCell plot, in the case where there are errors in multiple depths
170  etabins=(ProblemCells->getTH2F())->GetNbinsX();
171  phibins=(ProblemCells->getTH2F())->GetNbinsY();
172  for (int eta=0;eta<etabins;++eta)
173  {
174  for (int phi=0;phi<phibins;++phi)
175  {
178  }
179  }
182  return;
183 }
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:1473
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 HcalBeamClient::cleanup ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 228 of file HcalBeamClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 194 of file HcalBeamClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 225 of file HcalBeamClient.cc.

References analyze().

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

Reimplemented from HcalBaseDQClient.

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

Reimplemented from HcalBaseDQClient.

Definition at line 264 of file HcalBeamClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 263 of file HcalBeamClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 227 of file HcalBeamClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 265 of file HcalBeamClient.cc.

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

Reimplemented from HcalBaseDQClient.

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

Member Data Documentation

int HcalBeamClient::nevts_
private

Definition at line 36 of file HcalBeamClient.h.

Referenced by beginRun().