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 18 of file HcalBeamClient.cc.

References HcalBaseDQClient::name_.

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

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

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>("BeamFolder","BeamMonitor_Hcal/"); // BeamMonitor_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>("Beam_validHtmlOutput",true);
37  cloneME_ = ps.getUntrackedParameter<bool>("cloneME", true);
38  // known hot/dead channels blacked out on plot
39  badChannelStatusMask_ = ps.getUntrackedParameter<int>("Beam_BadChannelStatusMask",
40  ps.getUntrackedParameter<int>("BadChannelStatusMask",
43  ));
44 
45  minerrorrate_ = ps.getUntrackedParameter<double>("Beam_minerrorrate",
46  ps.getUntrackedParameter<double>("minerrorrate",0.05));
47  minevents_ = ps.getUntrackedParameter<int>("Beam_minLS",1);
48  // minevents_ = ps.getUntrackedParameter<int>("Beam_minevents",
49  // ps.getUntrackedParameter<int>("minevents",1));
50  Online_ = ps.getUntrackedParameter<bool>("online",false);
51 
52  ProblemCells=0;
54 }
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * ProblemCells
EtaPhiHists * ProblemCellsByDepth
std::string subdir_
std::string prefixME_
HcalBeamClient::~HcalBeamClient ( )

Destructor.

Definition at line 274 of file HcalBeamClient.cc.

275 {}

Member Function Documentation

void HcalBeamClient::analyze ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 56 of file HcalBeamClient.cc.

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

Referenced by endRun().

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

Reimplemented from HcalBaseDQClient.

Definition at line 183 of file HcalBeamClient.cc.

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

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

Reimplemented from HcalBaseDQClient.

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

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

Reimplemented from HcalBaseDQClient.

Definition at line 63 of file HcalBeamClient.cc.

References funct::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(), HcalBaseDQClient::subdir_, and ecaldqm::zside().

Referenced by analyze().

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

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

Reimplemented from HcalBaseDQClient.

Definition at line 192 of file HcalBeamClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 223 of file HcalBeamClient.cc.

References analyze().

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

Reimplemented from HcalBaseDQClient.

Definition at line 228 of file HcalBeamClient.cc.

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

229 {
230  if (!ProblemCells)
231  {
232  if (debug_>1) std::cout <<"<HcalBeamClient::hasErrors_Temp> ProblemCells histogram does not exist!"<<std::endl;
233  return false;
234  }
235  int problemcount=0;
236  int ieta=-9999;
237 
238  for (int depth=0;depth<4; ++depth)
239  {
240  int etabins = (ProblemCells->getTH2F())->GetNbinsX();
241  int phibins = (ProblemCells->getTH2F())->GetNbinsY();
242  for (int hist_eta=0;hist_eta<etabins;++hist_eta)
243  {
244  for (int hist_phi=0; hist_phi<phibins;++hist_phi)
245  {
246  ieta=CalcIeta(hist_eta,depth+1);
247  if (ieta==-9999) continue;
248  if (ProblemCellsByDepth->depth[depth]==0)
249  continue;
250  if (ProblemCellsByDepth->depth[depth]->getBinContent(hist_eta,hist_phi)>minerrorrate_)
251  ++problemcount;
252 
253  } // for (int hist_phi=1;...)
254  } // for (int hist_eta=1;...)
255  } // for (int depth=0;...)
256 
257  if (problemcount>0) return true;
258  return false;
259 }
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 262 of file HcalBeamClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 261 of file HcalBeamClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 225 of file HcalBeamClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 263 of file HcalBeamClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 266 of file HcalBeamClient.cc.

267 {
268  // This gets called by HcalMonitorClient
269  // trigger primitives don't yet contribute to channel status (though they could...)
270  // see dead or hot cell code for an example
271 
272 } //void HcalBeamClient::updateChannelStatus

Member Data Documentation

int HcalBeamClient::nevts_
private

Definition at line 36 of file HcalBeamClient.h.

Referenced by beginRun().