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

#include <HcalBeamClient.h>

Inheritance diagram for HcalBeamClient:
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)
 
 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
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 doProblemCellSetup (DQMStore::IBooker &, DQMStore::IGetter &)
 

Private Attributes

int nevts_
 
bool setupProblemCells_
 

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 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, setupProblemCells_, 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 
55  setupProblemCells_=true;
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 273 of file HcalBeamClient.cc.

References HcalBaseDQClient::ProblemCellsByDepth.

274 {
276 }
EtaPhiHists * ProblemCellsByDepth

Member Function Documentation

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

Reimplemented from HcalBaseDQClient.

Definition at line 58 of file HcalBeamClient.cc.

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

59 {
60  if (debug_>2) std::cout <<"\tHcalBeamClient::analyze()"<<std::endl;
61  enoughevents_=false;
62 
64 
65  calculateProblems(ib,ig);
66 }
virtual void calculateProblems(void)
tuple cout
Definition: gather_cfg.py:121
void doProblemCellSetup(DQMStore::IBooker &, DQMStore::IGetter &)
void HcalBeamClient::beginRun ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 217 of file HcalBeamClient.cc.

References HcalBaseDQClient::enoughevents_.

218 {
219  enoughevents_=false;
220 }
void HcalBeamClient::calculateProblems ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)

Definition at line 68 of file HcalBeamClient.cc.

References funct::abs(), HcalBaseDQClient::badstatusmap, 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(), HcalForward, i, j, HcalBaseDQClient::minerrorrate_, HcalBaseDQClient::minevents_, phi, HcalBaseDQClient::ProblemCells, HcalBaseDQClient::ProblemCellsByDepth, MonitorElement::Reset(), MonitorElement::setBinContent(), HcalBaseDQClient::subdir_, and ecaldqm::zside().

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

Reimplemented from HcalBaseDQClient.

Definition at line 225 of file HcalBeamClient.cc.

Referenced by esMonitoring.FDJsonServer::handle_close().

225 {}
void HcalBeamClient::doProblemCellSetup ( DQMStore::IBooker ib,
DQMStore::IGetter ig 
)
private

Definition at line 189 of file HcalBeamClient.cc.

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

Referenced by analyze().

190 {
191 
193  problemnames_.clear();
194 
195  // Put the appropriate name of your problem summary here
196  if (ProblemCells==0)
197  ProblemCells=ib.book2D(" Problem BeamMonitor",
198  " Problem Beam Monitor Rate for all HCAL;ieta;iphi",
199  85,-42.5,42.5,
200  72,0.5,72.5);
201  problemnames_.push_back(ProblemCells->getName());
202  if (debug_>1)
203  std::cout << "Tried to create ProblemCells Monitor Element in directory "<<subdir_<<" \t Failed? "<<(ProblemCells==0)<<std::endl;
204  ib.setCurrentFolder(subdir_+"problem_beammonitor");
205  nevts_=0;
206  if (ProblemCellsByDepth!=0) return; // histograms already set up
208  ProblemCellsByDepth->setup(ib," Problem BeamMonitor Rate");
209  for (unsigned int i=0; i<ProblemCellsByDepth->depth.size();++i)
210  problemnames_.push_back(ProblemCellsByDepth->depth[i]->getName());
211 
212  setupProblemCells_ = false;
213 
214 }
const std::string & getName(void) const
get name of ME
int i
Definition: DBlmapReader.cc:9
MonitorElement * ProblemCells
std::vector< MonitorElement * > depth
std::vector< std::string > problemnames_
EtaPhiHists * ProblemCellsByDepth
void setup(DQMStore::IBooker &m_dbe, std::string Name, std::string Units="")
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
void HcalBeamClient::endJob ( void  )
virtual

Reimplemented from HcalBaseDQClient.

Definition at line 187 of file HcalBeamClient.cc.

187 {}
bool HcalBeamClient::hasErrors_Temp ( void  )
virtual

Reimplemented from HcalBaseDQClient.

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

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

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

Reimplemented from HcalBaseDQClient.

Definition at line 260 of file HcalBeamClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 224 of file HcalBeamClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 262 of file HcalBeamClient.cc.

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

Reimplemented from HcalBaseDQClient.

Definition at line 265 of file HcalBeamClient.cc.

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

Member Data Documentation

int HcalBeamClient::nevts_
private

Definition at line 35 of file HcalBeamClient.h.

Referenced by doProblemCellSetup().

bool HcalBeamClient::setupProblemCells_
private

Definition at line 38 of file HcalBeamClient.h.

Referenced by analyze(), doProblemCellSetup(), and HcalBeamClient().