CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions
HcalClientUtils.h File Reference
#include "TH1F.h"
#include "TH1.h"
#include "TH2F.h"
#include "TCanvas.h"
#include <string>
#include "DQMServices/Core/interface/DQMStore.h"
#include "DQMServices/Core/interface/MonitorElement.h"
#include "DQMServices/Core/interface/QTest.h"
#include "DQMServices/Core/interface/QReport.h"
#include "TROOT.h"
#include "TGaxis.h"
#include <iostream>
#include <fstream>
#include <vector>

Go to the source code of this file.

Classes

class  HcalUtilsClient
 

Functions

void createH2CompTest (DQMStore *dbe, std::vector< std::string > &params, TH2F *ref)
 
void createH2ContentTest (DQMStore *dbe, std::vector< std::string > &params)
 
void createMeanValueTest (DQMStore *dbe, std::vector< std::string > &params)
 
void createXRangeTest (DQMStore *dbe, std::vector< std::string > &params)
 
void createYRangeTest (DQMStore *dbe, std::vector< std::string > &params)
 
void dumpHisto (TH1F *hist, std::vector< std::string > &names, std::vector< double > &meanX, std::vector< double > &meanY, std::vector< double > &rmsX, std::vector< double > &rmsY)
 
void dumpHisto2 (TH2F *hist, std::vector< std::string > &names, std::vector< double > &meanX, std::vector< double > &meanY, std::vector< double > &rmsX, std::vector< double > &rmsY)
 
TH1F * getHisto (std::string name, std::string process, DQMStore *dbe_, bool verb=false, bool clone=false)
 
TH1F * getHisto (const MonitorElement *me, bool verb=false, bool clone=false)
 
TH2F * getHisto2 (std::string name, std::string process, DQMStore *dbe_, bool verb=false, bool clone=false)
 
TH2F * getHisto2 (const MonitorElement *me, bool verb=false, bool clone=false)
 
TH3F * getHistoTH3F (std::string name, std::string process, DQMStore *dbe_, bool verb=false, bool clone=false)
 
TH3F * getHistoTH3F (const MonitorElement *me, bool verb=false, bool clone=false)
 
TProfile * getHistoTProfile (std::string name, std::string process, DQMStore *dbe_, bool verb=false, bool clone=false)
 
TProfile * getHistoTProfile (const MonitorElement *me, bool verb=false, bool clone=false)
 
TProfile2D * getHistoTProfile2D (std::string name, std::string process, DQMStore *dbe_, bool verb=false, bool clone=false)
 
TProfile2D * getHistoTProfile2D (const MonitorElement *me, bool verb=false, bool clone=false)
 
std::string getIMG (int runNo, TH1F *hist, int size, std::string htmlDir, const char *xlab, const char *ylab)
 
std::string getIMG2 (int runNo, TH2F *hist, int size, std::string htmlDir, const char *xlab, const char *ylab, bool color=false)
 
std::string getIMGTProfile (int runNo, TProfile *hist, int size, std::string htmlDir, const char *xlab, const char *ylab, std::string opts="NONE")
 
void histoHTML (int runNo, TH1F *hist, const char *xlab, const char *ylab, int width, ofstream &htmlFile, std::string htmlDir)
 
void histoHTML2 (int runNo, TH2F *hist, const char *xlab, const char *ylab, int width, ofstream &htmlFile, std::string htmlDir, bool color=false)
 
void histoHTMLTProfile (int runNo, TProfile *hist, const char *xlab, const char *ylab, int width, ofstream &htmlFile, std::string htmlDir, std::string opts="NONE")
 
void htmlErrors (int runNo, std::string htmlDir, std::string client, std::string process, DQMStore *dbe, std::map< std::string, std::vector< QReport * > > mapE, std::map< std::string, std::vector< QReport * > > mapW, std::map< std::string, std::vector< QReport * > > mapO)
 
bool isValidGeom (std::string type, int depth)
 
bool isValidGeom (int subdet, int iEta, int iPhi, int depth)
 
void resetME (const char *name, DQMStore *dbe)
 

Function Documentation

void createH2CompTest ( DQMStore dbe,
std::vector< std::string > &  params,
TH2F *  ref 
)

Definition at line 418 of file HcalClientUtils.cc.

References DQMStore::createQTest(), DQMStore::get(), DQMStore::getQCriterion(), MonitorElement::getQReport(), and NULL.

418  {
419  if (params.size() < 2 ) return;
420  if(ref==NULL) return;
421  if(!dbe) return;
422 
423  QCriterion* qc = dbe->getQCriterion(params[1]);
424  MonitorElement* me = dbe->get(params[0]);
425  if(me!=NULL && qc == NULL){
426  printf("\n\nDon't have this QC, but have the me!\n\n");
427  const QReport* qr = me->getQReport(params[1]);
428  if(qr) return;
429  printf("\n\nThe ME doesn't have the QC!!\n\n");
430  qc = dbe->createQTest("Comp2RefEqualH2",params[1]);
431  /* Time to get with
432  DQMServices/Core V03-00-12-qtest
433  DQMServices/ClientConfig V03-00-04-qtest
434  // Contents within a mean value
435  Comp2RefEqualH2ROOT* me_qc = dynamic_cast<Comp2RefEqualH2ROOT*> (qc);
436  //set reference histogram
437  me_qc->setReference(ref);
438  // link it to the monitor element
439  printf("\n\nGonna run it...\n\n");
440  dbe->useQTest(params[0], params[1]);
441  */
442  }
443  else printf("\n\nAlready had the QC or didn't have the ME!\n\n");
444 
445  return;
446 }
QCriterion * getQCriterion(const std::string &qtname) const
Definition: DQMStore.cc:2597
const QReport * getQReport(const std::string &qtname) const
get QReport corresponding to &lt;qtname&gt; (null pointer if QReport does not exist)
#define NULL
Definition: scimark2.h:8
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1468
QCriterion * createQTest(const std::string &algoname, const std::string &qtname)
Definition: DQMStore.cc:2608
void createH2ContentTest ( DQMStore dbe,
std::vector< std::string > &  params 
)

Definition at line 395 of file HcalClientUtils.cc.

References DQMStore::get(), DQMStore::getQCriterion(), and NULL.

395  {
396  if (params.size() < 2 ) return;
397  if(!dbe) return;
398 
399  QCriterion* qc = dbe->getQCriterion(params[1]);
400  MonitorElement* me = dbe->get(params[0]);
401  if(me!=NULL && qc == NULL){
402  /* Time to get with
403  DQMServices/Core V03-00-12-qtest
404  DQMServices/ClientConfig V03-00-04-qtest
405  qc = dbe->createQTest(ContentsTH2FWithinRange::getAlgoName(),params[1]);
406  // Contents within a mean value
407  ContentsTH2FWithinRangeROOT* me_qc = dynamic_cast<ContentsTH2FWithinRangeROOT*> (qc);
408  me_qc->setMeanRange(0,1e-10);
409  me_qc->setRMSRange(0,1e-10);
410  // link it to the monitor element
411  dbe->useQTest(params[0], params[1]);
412  */
413  }
414 
415  return;
416 }
QCriterion * getQCriterion(const std::string &qtname) const
Definition: DQMStore.cc:2597
#define NULL
Definition: scimark2.h:8
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1468
void createMeanValueTest ( DQMStore dbe,
std::vector< std::string > &  params 
)

Definition at line 371 of file HcalClientUtils.cc.

References DQMStore::createQTest(), DQMStore::getQCriterion(), NULL, QCriterion::setErrorProb(), MeanWithinExpected::setExpectedMean(), QCriterion::setWarningProb(), DQMStore::useQTest(), MeanWithinExpected::useRMS(), and MeanWithinExpected::useSigma().

371  {
372  if (params.size() < 7 ) return;
373  if(!dbe) return;
374 
375  QCriterion* qc = dbe->getQCriterion(params[1]);
376  if(qc == NULL){
377  qc = dbe->createQTest("MeanWithinExpected",params[1]);
378  // Contents within a mean value
379  MeanWithinExpected* me_qc = (MeanWithinExpected*) qc;
380  //set probability limit for test warning
381  me_qc->setWarningProb(atof(params[2].c_str()));
382  //set probability limit for test error
383  me_qc->setErrorProb(atof(params[3].c_str()));
384  // set Expected Mean
385  me_qc->setExpectedMean(atof(params[4].c_str()));
386  // set Test Type
387  if (params[6] == "useRMS") me_qc->useRMS();
388  else if (params[6] == "useSigma") me_qc->useSigma(atof(params[5].c_str()));
389  }
390  // link it to the monitor element
391  dbe->useQTest(params[0], params[1]);
392  return;
393 }
void setErrorProb(float prob)
Definition: QTest.h:61
QCriterion * getQCriterion(const std::string &qtname) const
Definition: DQMStore.cc:2597
void useRMS(void)
Definition: QTest.cc:1247
#define NULL
Definition: scimark2.h:8
void useSigma(double expectedSigma)
Definition: QTest.cc:1236
Algorithm for testing if histogram&#39;s mean value is near expected value.
Definition: QTest.h:392
void setExpectedMean(double mean)
Definition: QTest.h:402
void setWarningProb(float prob)
set probability limit for warning and error (default: 90% and 50%)
Definition: QTest.h:60
void useQTest(const std::string &dir, const std::string &qtname)
Definition: DQMStore.cc:2629
QCriterion * createQTest(const std::string &algoname, const std::string &qtname)
Definition: DQMStore.cc:2608
void createXRangeTest ( DQMStore dbe,
std::vector< std::string > &  params 
)

Definition at line 329 of file HcalClientUtils.cc.

References DQMStore::createQTest(), ContentsXRange::getAlgoName(), DQMStore::getQCriterion(), NULL, ContentsXRange::setAllowedXRange(), QCriterion::setErrorProb(), QCriterion::setWarningProb(), and DQMStore::useQTest().

329  {
330  if (params.size() < 6) return;
331  if(!dbe) return;
332 
333  QCriterion* qc = dbe->getQCriterion(params[1]);
334  if(qc == NULL){
335  qc = dbe->createQTest(ContentsXRange::getAlgoName(),params[1]);
336  // Contents within [Xmin, Xmax]
337  ContentsXRange* me_qc = (ContentsXRange*) qc;
338  //set probability limit for test warning
339  me_qc->setWarningProb(atof(params[2].c_str()));
340  //set probability limit for test error
341  me_qc->setErrorProb(atof(params[3].c_str()));
342  // set allowed range in X-axis (default values: histogram's X-range)
343  me_qc->setAllowedXRange(atof(params[4].c_str()), atof(params[5].c_str()));
344  }
345  // link it to the monitor element
346  dbe->useQTest(params[0], params[1]);
347  return;
348 }
void setErrorProb(float prob)
Definition: QTest.h:61
QCriterion * getQCriterion(const std::string &qtname) const
Definition: DQMStore.cc:2597
virtual void setAllowedXRange(double xmin, double xmax)
set allowed range in X-axis (default values: histogram&#39;s X-range)
Definition: QTest.h:236
static std::string getAlgoName(void)
Definition: QTest.h:232
#define NULL
Definition: scimark2.h:8
void setWarningProb(float prob)
set probability limit for warning and error (default: 90% and 50%)
Definition: QTest.h:60
void useQTest(const std::string &dir, const std::string &qtname)
Definition: DQMStore.cc:2629
QCriterion * createQTest(const std::string &algoname, const std::string &qtname)
Definition: DQMStore.cc:2608
void createYRangeTest ( DQMStore dbe,
std::vector< std::string > &  params 
)

Definition at line 350 of file HcalClientUtils.cc.

References DQMStore::createQTest(), ContentsYRange::getAlgoName(), DQMStore::getQCriterion(), NULL, ContentsYRange::setAllowedYRange(), QCriterion::setErrorProb(), QCriterion::setWarningProb(), and DQMStore::useQTest().

350  {
351  if (params.size() < 6) return;
352  if(!dbe) return;
353 
354  QCriterion* qc = dbe->getQCriterion(params[1]);
355  if(qc == NULL){
356  qc = dbe->createQTest(ContentsYRange::getAlgoName(),params[1]);
357  // Contents within [Xmin, Xmax]
358  ContentsYRange* me_qc = (ContentsYRange*) qc;
359  //set probability limit for test warning
360  me_qc->setWarningProb(atof(params[2].c_str()));
361  //set probability limit for test error
362  me_qc->setErrorProb(atof(params[3].c_str()));
363  // set allowed range in Y-axis (default values: histogram's Y-range)
364  me_qc->setAllowedYRange(atof(params[4].c_str()), atof(params[5].c_str()));
365  }
366  // link it to the monitor element
367  dbe->useQTest(params[0], params[1]);
368  return;
369 }
void setErrorProb(float prob)
Definition: QTest.h:61
QCriterion * getQCriterion(const std::string &qtname) const
Definition: DQMStore.cc:2597
#define NULL
Definition: scimark2.h:8
static std::string getAlgoName(void)
Definition: QTest.h:257
void setWarningProb(float prob)
set probability limit for warning and error (default: 90% and 50%)
Definition: QTest.h:60
void useQTest(const std::string &dir, const std::string &qtname)
Definition: DQMStore.cc:2629
QCriterion * createQTest(const std::string &algoname, const std::string &qtname)
Definition: DQMStore.cc:2608
virtual void setAllowedYRange(double ymin, double ymax)
Definition: QTest.h:261
void dumpHisto ( TH1F *  hist,
std::vector< std::string > &  names,
std::vector< double > &  meanX,
std::vector< double > &  meanY,
std::vector< double > &  rmsX,
std::vector< double > &  rmsY 
)

Definition at line 75 of file HcalClientUtils.cc.

77  {
78 
79  names.push_back((std::string)hist->GetName());
80  meanX.push_back(hist->GetMean(1));
81  meanY.push_back(-123e10);
82  rmsX.push_back(hist->GetRMS(1));
83  rmsY.push_back(-123e10);
84  return;
85 }
static const HistoName names[]
void dumpHisto2 ( TH2F *  hist,
std::vector< std::string > &  names,
std::vector< double > &  meanX,
std::vector< double > &  meanY,
std::vector< double > &  rmsX,
std::vector< double > &  rmsY 
)

Definition at line 86 of file HcalClientUtils.cc.

88  {
89 
90  names.push_back((std::string)hist->GetName());
91  meanX.push_back(hist->GetMean(1));
92  meanY.push_back(hist->GetMean(2));
93  rmsX.push_back(hist->GetRMS(1));
94  rmsY.push_back(hist->GetRMS(2));
95  return;
96 }
static const HistoName names[]
TH1F* getHisto ( std::string  name,
std::string  process,
DQMStore dbe_,
bool  verb = false,
bool  clone = false 
)

Definition at line 239 of file HcalClientUtils.cc.

References gather_cfg::cout, DQMStore::get(), MonitorElement::getTH1F(), interpolateCardsSimple::histo, NULL, dbtoconf::out, and indexGen::title.

Referenced by DTTTrigT0SegCorrection::correction(), DTTTrigResidualCorrection::correction(), and htmlErrors().

239  {
240  if(!dbe_) return NULL;
241 
242  char title[150];
243  sprintf(title, "%sHcal/%s",process.c_str(),name.c_str());
244  TH1F* out = NULL;
245 
246  const MonitorElement* me = dbe_->get(title);
247  if (me){
248  if ( verb ) std::cout << "Found '" << title << "'" << std::endl;
249  if ( clone ) {
250  char histo[150];
251  sprintf(histo, "ME %s",name.c_str());
252  out = dynamic_cast<TH1F*> (me->getTH1F()->Clone(histo));
253  } else {
254  out = me->getTH1F();
255  }
256  }
257 
258  return out;
259 }
#define NULL
Definition: scimark2.h:8
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1468
tuple out
Definition: dbtoconf.py:99
TH1F * getTH1F(void) const
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
tuple cout
Definition: gather_cfg.py:121
tuple process
Definition: LaserDQM_cfg.py:3
TH1F* getHisto ( const MonitorElement me,
bool  verb = false,
bool  clone = false 
)

Definition at line 280 of file HcalClientUtils.cc.

References gather_cfg::cout, MonitorElement::getName(), MonitorElement::getTH1F(), interpolateCardsSimple::histo, NULL, and dbtoconf::out.

280  {
281  TH1F* out = NULL;
282 
283  if ( me ) {
284  if ( verb ) std::cout << "Found '" << me->getName() << "'" << std::endl;
285  if ( clone ) {
286  char histo[150];
287  sprintf(histo, "ME %s",((std::string)(me->getName())).c_str());
288  out = dynamic_cast<TH1F*> (me->getTH1F()->Clone(histo));
289  } else {
290  out = me->getTH1F();
291  }
292  }
293  return out;
294 }
const std::string & getName(void) const
get name of ME
#define NULL
Definition: scimark2.h:8
tuple out
Definition: dbtoconf.py:99
TH1F * getTH1F(void) const
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
tuple cout
Definition: gather_cfg.py:121
TH2F* getHisto2 ( std::string  name,
std::string  process,
DQMStore dbe_,
bool  verb = false,
bool  clone = false 
)

Definition at line 216 of file HcalClientUtils.cc.

References gather_cfg::cout, DQMStore::get(), interpolateCardsSimple::histo, NULL, dbtoconf::out, and indexGen::title.

Referenced by htmlErrors().

216  {
217 
218  if(!dbe_) return NULL;
219 
220  TH2F* out = NULL;
221  char title[150];
222  sprintf(title, "%sHcal/%s",process.c_str(),name.c_str());
223 
224  MonitorElement* me = dbe_->get(title);
225 
226  if ( me ) {
227  if ( verb) std::cout << "Found '" << title << "'" << std::endl;
228  if ( clone) {
229  char histo[150];
230  sprintf(histo, "ME %s",name.c_str());
231  out = dynamic_cast<TH2F*> (me->getTH2F()->Clone(histo));
232  } else {
233  out = me->getTH2F();
234  }
235  }
236  return out;
237 }
#define NULL
Definition: scimark2.h:8
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1468
tuple out
Definition: dbtoconf.py:99
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
tuple cout
Definition: gather_cfg.py:121
tuple process
Definition: LaserDQM_cfg.py:3
TH2F* getHisto2 ( const MonitorElement me,
bool  verb = false,
bool  clone = false 
)

Definition at line 262 of file HcalClientUtils.cc.

References gather_cfg::cout, MonitorElement::getName(), MonitorElement::getTH2F(), interpolateCardsSimple::histo, NULL, and dbtoconf::out.

262  {
263 
264  TH2F* out = NULL;
265 
266  if ( me ) {
267  if ( verb) std::cout << "Found '" << me->getName() << "'" << std::endl;
268  // MonitorElementT<TNamed>* ob = dynamic_cast<MonitorElementT<TNamed>*> (me);
269  if ( clone ) {
270  char histo[150];
271  sprintf(histo, "ME %s", ((std::string)(me->getName())).c_str());
272  out = dynamic_cast<TH2F*> (me->getTH2F()->Clone(histo));
273  } else {
274  out = me->getTH2F();
275  }
276  }
277  return out;
278 }
const std::string & getName(void) const
get name of ME
#define NULL
Definition: scimark2.h:8
tuple out
Definition: dbtoconf.py:99
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
tuple cout
Definition: gather_cfg.py:121
TH2F * getTH2F(void) const
TH3F* getHistoTH3F ( std::string  name,
std::string  process,
DQMStore dbe_,
bool  verb = false,
bool  clone = false 
)

Definition at line 723 of file HcalClientUtils.cc.

References gather_cfg::cout, DQMStore::get(), MonitorElement::getTH3F(), interpolateCardsSimple::histo, NULL, dbtoconf::out, and indexGen::title.

723  {
724  if(!dbe_) return NULL;
725 
726  char title[150];
727  sprintf(title, "%sHcal/%s",process.c_str(),name.c_str());
728  TH3F* out = NULL;
729 
730  const MonitorElement* me = dbe_->get(title);
731  if (me){
732  if ( verb ) std::cout << "Found '" << title << "'" << std::endl;
733  if ( clone ) {
734  char histo[150];
735  sprintf(histo, "ME %s",name.c_str());
736  out = dynamic_cast<TH3F*> (me->getTH3F()->Clone(histo));
737  } else {
738  out = me->getTH3F();
739  }
740  }
741 
742  return out;
743 }
TH3F * getTH3F(void) const
#define NULL
Definition: scimark2.h:8
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1468
tuple out
Definition: dbtoconf.py:99
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
tuple cout
Definition: gather_cfg.py:121
tuple process
Definition: LaserDQM_cfg.py:3
TH3F* getHistoTH3F ( const MonitorElement me,
bool  verb = false,
bool  clone = false 
)

Definition at line 745 of file HcalClientUtils.cc.

References gather_cfg::cout, MonitorElement::getName(), MonitorElement::getTH3F(), interpolateCardsSimple::histo, NULL, and dbtoconf::out.

745  {
746  TH3F* out = NULL;
747 
748  if ( me ) {
749  if ( verb ) std::cout << "Found '" << me->getName() << "'" << std::endl;
750  if ( clone ) {
751  char histo[150];
752  sprintf(histo, "ME %s",((std::string)(me->getName())).c_str());
753  out = dynamic_cast<TH3F*> (me->getTH3F()->Clone(histo));
754  } else {
755  out = me->getTH3F();
756  }
757  }
758  return out;
759 }
const std::string & getName(void) const
get name of ME
TH3F * getTH3F(void) const
#define NULL
Definition: scimark2.h:8
tuple out
Definition: dbtoconf.py:99
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
tuple cout
Definition: gather_cfg.py:121
TProfile* getHistoTProfile ( std::string  name,
std::string  process,
DQMStore dbe_,
bool  verb = false,
bool  clone = false 
)

Definition at line 589 of file HcalClientUtils.cc.

References gather_cfg::cout, DQMStore::get(), MonitorElement::getTProfile(), interpolateCardsSimple::histo, NULL, dbtoconf::out, and indexGen::title.

589  {
590  if(!dbe_) return NULL;
591 
592  char title[150];
593  sprintf(title, "%sHcal/%s",process.c_str(),name.c_str());
594  TProfile* out = NULL;
595 
596  const MonitorElement* me = dbe_->get(title);
597  if (me){
598  if ( verb ) std::cout << "Found '" << title << "'" << std::endl;
599  if ( clone ) {
600  char histo[150];
601  sprintf(histo, "ME %s",name.c_str());
602  out = dynamic_cast<TProfile*> (me->getTProfile()->Clone(histo));
603  } else {
604  out = me->getTProfile();
605  }
606  }
607 
608  return out;
609 }
#define NULL
Definition: scimark2.h:8
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1468
tuple out
Definition: dbtoconf.py:99
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
TProfile * getTProfile(void) const
tuple cout
Definition: gather_cfg.py:121
tuple process
Definition: LaserDQM_cfg.py:3
TProfile* getHistoTProfile ( const MonitorElement me,
bool  verb = false,
bool  clone = false 
)

Definition at line 611 of file HcalClientUtils.cc.

References gather_cfg::cout, MonitorElement::getName(), MonitorElement::getTProfile(), interpolateCardsSimple::histo, NULL, and dbtoconf::out.

611  {
612  TProfile* out = NULL;
613 
614  if ( me ) {
615  if ( verb ) std::cout << "Found '" << me->getName() << "'" << std::endl;
616  if ( clone ) {
617  char histo[150];
618  sprintf(histo, "ME %s",((std::string)(me->getName())).c_str());
619  out = dynamic_cast<TProfile*> (me->getTProfile()->Clone(histo));
620  } else {
621  out = me->getTProfile();
622  }
623  }
624  return out;
625 }
const std::string & getName(void) const
get name of ME
#define NULL
Definition: scimark2.h:8
tuple out
Definition: dbtoconf.py:99
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
TProfile * getTProfile(void) const
tuple cout
Definition: gather_cfg.py:121
TProfile2D* getHistoTProfile2D ( std::string  name,
std::string  process,
DQMStore dbe_,
bool  verb = false,
bool  clone = false 
)

Definition at line 684 of file HcalClientUtils.cc.

References gather_cfg::cout, DQMStore::get(), MonitorElement::getTProfile2D(), interpolateCardsSimple::histo, NULL, dbtoconf::out, and indexGen::title.

684  {
685  if(!dbe_) return NULL;
686 
687  char title[150];
688  sprintf(title, "%sHcal/%s",process.c_str(),name.c_str());
689  TProfile2D* out = NULL;
690 
691  const MonitorElement* me = dbe_->get(title);
692  if (me){
693  if ( verb ) std::cout << "Found '" << title << "'" << std::endl;
694  if ( clone ) {
695  char histo[150];
696  sprintf(histo, "ME %s",name.c_str());
697  out = dynamic_cast<TProfile2D*> (me->getTProfile2D()->Clone(histo));
698  } else {
699  out = me->getTProfile2D();
700  }
701  }
702 
703  return out;
704 }
TProfile2D * getTProfile2D(void) const
#define NULL
Definition: scimark2.h:8
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1468
tuple out
Definition: dbtoconf.py:99
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
tuple cout
Definition: gather_cfg.py:121
tuple process
Definition: LaserDQM_cfg.py:3
TProfile2D* getHistoTProfile2D ( const MonitorElement me,
bool  verb = false,
bool  clone = false 
)

Definition at line 706 of file HcalClientUtils.cc.

References gather_cfg::cout, MonitorElement::getName(), MonitorElement::getTProfile2D(), interpolateCardsSimple::histo, NULL, and dbtoconf::out.

706  {
707  TProfile2D* out = NULL;
708 
709  if ( me ) {
710  if ( verb ) std::cout << "Found '" << me->getName() << "'" << std::endl;
711  if ( clone ) {
712  char histo[150];
713  sprintf(histo, "ME %s",((std::string)(me->getName())).c_str());
714  out = dynamic_cast<TProfile2D*> (me->getTProfile2D()->Clone(histo));
715  } else {
716  out = me->getTProfile2D();
717  }
718  }
719  return out;
720 }
const std::string & getName(void) const
get name of ME
TProfile2D * getTProfile2D(void) const
#define NULL
Definition: scimark2.h:8
tuple out
Definition: dbtoconf.py:99
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
tuple cout
Definition: gather_cfg.py:121
std::string getIMG ( int  runNo,
TH1F *  hist,
int  size,
std::string  htmlDir,
const char *  xlab,
const char *  ylab 
)

Definition at line 181 of file HcalClientUtils.cc.

References timingPdfMaker::can, cleanString(), alignCSCRings::dest, mergeVDriftHistosByStation::name, NULL, parseString(), and indexGen::title.

Referenced by histoHTML(), and htmlErrors().

181  {
182 
183  if(hist==NULL) {
184  printf("getIMG: This histo is NULL, %s, %s\n",xlab,ylab);
185  return "";
186  }
187 
188  std::string name = hist->GetTitle();
189  cleanString(name);
190  char dest[512];
191  if(runNo>-1) sprintf(dest,"%s - Run %d",name.c_str(),runNo);
192  else sprintf(dest,"%s",name.c_str());
193  hist->SetTitle(dest);
194  std::string title = dest;
195 
196  int xwid = 900; int ywid =540;
197  if(size==1){
198  title = title+"_tmb";
199  xwid = 600; ywid = 360;
200  }
201  TCanvas* can = new TCanvas(dest,dest, xwid, ywid);
202 
203  parseString(title);
204  std::string outName = title + ".gif";
205  std::string saveName = htmlDir + outName;
206  hist->SetXTitle(xlab);
207  hist->SetYTitle(ylab);
208  hist->Draw();
209 
210  can->SaveAs(saveName.c_str());
211  delete can;
212 
213  return outName;
214 }
#define NULL
Definition: scimark2.h:8
void parseString(std::string &title)
void cleanString(std::string &title)
tuple size
Write out results.
std::string getIMG2 ( int  runNo,
TH2F *  hist,
int  size,
std::string  htmlDir,
const char *  xlab,
const char *  ylab,
bool  color = false 
)

Definition at line 138 of file HcalClientUtils.cc.

References timingPdfMaker::can, cleanString(), alignCSCRings::dest, mergeVDriftHistosByStation::name, NULL, parseString(), and indexGen::title.

Referenced by histoHTML2(), and htmlErrors().

138  {
139 
140  if(hist==NULL) {
141  printf("getIMG2: This histo is NULL, %s, %s\n",xlab,ylab);
142  return "";
143  }
144 
145  std::string name = hist->GetTitle();
146  cleanString(name);
147  char dest[512];
148  if(runNo>-1) sprintf(dest,"%s - Run %d",name.c_str(),runNo);
149  else sprintf(dest,"%s",name.c_str());
150  hist->SetTitle(dest);
151  std::string title = dest;
152 
153  int xwid = 900; int ywid =540;
154  if(size==1){
155  title = title+"_tmb";
156  xwid = 600; ywid = 360;
157  }
158  TCanvas* can = new TCanvas(dest,dest, xwid, ywid);
159 
160  // Put grids on all 2-D histograms
161  can->SetGridx();
162  can->SetGridy();
163 
164 
165  parseString(title);
166  std::string outName = title + ".gif";
167  std::string saveName = htmlDir + outName;
168  hist->SetXTitle(xlab);
169  hist->SetYTitle(ylab);
170  if(color) hist->Draw();
171  else{
172  hist->SetStats(false);
173  hist->Draw("COLZ");
174  }
175  can->SaveAs(saveName.c_str());
176  delete can;
177 
178  return outName;
179 }
#define NULL
Definition: scimark2.h:8
void parseString(std::string &title)
void cleanString(std::string &title)
tuple size
Write out results.
std::string getIMGTProfile ( int  runNo,
TProfile *  hist,
int  size,
std::string  htmlDir,
const char *  xlab,
const char *  ylab,
std::string  opts = "NONE" 
)

Definition at line 627 of file HcalClientUtils.cc.

References timingPdfMaker::can, cleanString(), alignCSCRings::dest, mergeVDriftHistosByStation::name, NULL, parseString(), and indexGen::title.

Referenced by histoHTMLTProfile().

627  {
628 
629  if(hist==NULL) {
630  printf("getIMG: This histo is NULL, %s, %s\n",xlab,ylab);
631  return "";
632  }
633 
634  std::string name = hist->GetTitle();
635  cleanString(name);
636  char dest[512];
637  if(runNo>-1) sprintf(dest,"%s - Run %d",name.c_str(),runNo);
638  else sprintf(dest,"%s",name.c_str());
639  hist->SetTitle(dest);
640  std::string title = dest;
641 
642  int xwid = 900; int ywid =540;
643  if(size==1){
644  title = title+"_tmb";
645  xwid = 600; ywid = 360;
646  }
647  TCanvas* can = new TCanvas(dest,dest, xwid, ywid);
648 
649  parseString(title);
650  std::string outName = title + ".gif";
651  std::string saveName = htmlDir + outName;
652  hist->SetXTitle(xlab);
653  hist->SetYTitle(ylab);
654  if (opts!="NONE")
655  hist->SetOption(opts.c_str());
656  hist->Draw();
657 
658  can->SaveAs(saveName.c_str());
659  delete can;
660 
661  return outName;
662 }
#define NULL
Definition: scimark2.h:8
void parseString(std::string &title)
void cleanString(std::string &title)
tuple size
Write out results.
void histoHTML ( int  runNo,
TH1F *  hist,
const char *  xlab,
const char *  ylab,
int  width,
ofstream &  htmlFile,
std::string  htmlDir 
)

Definition at line 297 of file HcalClientUtils.cc.

References getIMG(), and NULL.

297  {
298 
299  if(hist!=NULL){
300  std::string imgNameTMB = "";
301  imgNameTMB = getIMG(runNo,hist,1,htmlDir,xlab,ylab);
302  std::string imgName = "";
303  imgName = getIMG(runNo,hist,2,htmlDir,xlab,ylab);
304 
305  if (imgName.size() != 0 )
306  htmlFile << "<td><a href=\"" << imgName << "\"><img src=\"" << imgNameTMB << "\"></a></td>" << std::endl;
307  else
308  htmlFile << "<td><img src=\"" << " " << "\"></td>" << std::endl;
309  }
310  else htmlFile << "<td><img src=\"" << " " << "\"></td>" << std::endl;
311  return;
312 }
#define NULL
Definition: scimark2.h:8
std::string getIMG(int runNo, TH1F *hist, int size, std::string htmlDir, const char *xlab, const char *ylab)
void histoHTML2 ( int  runNo,
TH2F *  hist,
const char *  xlab,
const char *  ylab,
int  width,
ofstream &  htmlFile,
std::string  htmlDir,
bool  color = false 
)

Definition at line 314 of file HcalClientUtils.cc.

References getIMG2(), and NULL.

314  {
315  if(hist!=NULL){
316  std::string imgNameTMB = "";
317  imgNameTMB = getIMG2(runNo,hist,1,htmlDir,xlab,ylab,color);
318  std::string imgName = "";
319  imgName = getIMG2(runNo,hist,2,htmlDir,xlab,ylab,color);
320  if (imgName.size() != 0 )
321  htmlFile << "<td><a href=\"" << imgName << "\"><img src=\"" << imgNameTMB << "\"></a></td>" << std::endl;
322  else
323  htmlFile << "<td><img src=\"" << " " << "\"></td>" << std::endl;
324  }
325  else htmlFile << "<td><img src=\"" << " " << "\"></td>" << std::endl;
326  return;
327 }
#define NULL
Definition: scimark2.h:8
std::string getIMG2(int runNo, TH2F *hist, int size, std::string htmlDir, const char *xlab, const char *ylab, bool color=false)
void histoHTMLTProfile ( int  runNo,
TProfile *  hist,
const char *  xlab,
const char *  ylab,
int  width,
ofstream &  htmlFile,
std::string  htmlDir,
std::string  opts = "NONE" 
)

Definition at line 664 of file HcalClientUtils.cc.

References getIMGTProfile(), and NULL.

664  {
665 
666  if(hist!=NULL){
667  std::string imgNameTMB = "";
668  imgNameTMB = getIMGTProfile(runNo,hist,1,htmlDir,xlab,ylab,opts);
669  std::string imgName = "";
670  imgName = getIMGTProfile(runNo,hist,2,htmlDir,xlab,ylab,opts);
671 
672  if (imgName.size() != 0 )
673  htmlFile << "<td><a href=\"" << imgName << "\"><img src=\"" << imgNameTMB << "\"></a></td>" << std::endl;
674  else
675  htmlFile << "<td><img src=\"" << " " << "\"></td>" << std::endl;
676  }
677  else htmlFile << "<td><img src=\"" << " " << "\"></td>" << std::endl;
678  return;
679 }
#define NULL
Definition: scimark2.h:8
std::string getIMGTProfile(int runNo, TProfile *hist, int size, std::string htmlDir, const char *xlab, const char *ylab, std::string opts="NONE")
void htmlErrors ( int  runNo,
std::string  htmlDir,
std::string  client,
std::string  process,
DQMStore dbe,
std::map< std::string, std::vector< QReport * > >  mapE,
std::map< std::string, std::vector< QReport * > >  mapW,
std::map< std::string, std::vector< QReport * > >  mapO 
)

Definition at line 448 of file HcalClientUtils.cc.

References benchmark_cfg::errors, DQMStore::get(), getHisto(), getHisto2(), getIMG(), getIMG2(), MonitorElement::getMeanError(), and zeeHLT_cff::report.

448  {
449  if(!dbe) return;
450 
451  std::map<std::string, std::vector<QReport*> >::iterator mapIter;
452 
453  ofstream errorFile;
454  errorFile.open((htmlDir + client+ "Errors.html").c_str());
455  errorFile << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"> " << std::endl;
456  errorFile << "<html> " << std::endl;
457  errorFile << "<head> " << std::endl;
458  errorFile << " <meta content=\"text/html; charset=ISO-8859-1\" " << std::endl;
459  errorFile << " http-equiv=\"content-type\"> " << std::endl;
460  errorFile << " <title>Monitor: Hcal " << client <<" Task Error Output</title> " << std::endl;
461  errorFile << "</head> " << std::endl;
462  errorFile << "<style type=\"text/css\"> td { font-weight: bold } </style>" << std::endl;
463  errorFile << "<body> " << std::endl;
464  errorFile << "<br> " << std::endl;
465  errorFile << "<h2>" << client <<" Errors</h2> " << std::endl;
466 
467  for (mapIter=mapE.begin(); mapIter!=mapE.end();mapIter++){
468  std::string meName = mapIter->first;
469  std::vector<QReport*> errors = mapIter->second;
470  errorFile << "<br>" << std::endl;
471  errorFile << "<hr>" << std::endl;
472  errorFile << "Monitorable '" << meName << "' has the following errors: <br>" << std::endl;
473  for(std::vector<QReport*>::iterator report=errors.begin(); report!=errors.end(); report++){
474  errorFile << " "<< (*report)->getQRName() << ": "<< (*report)->getMessage() << std::endl;
475  }
476  MonitorElement* me = dbe->get(meName);
477  errorFile << "<br>" << std::endl;
478  errorFile << "<br>" << std::endl;
479  const char * substr = strstr(meName.c_str(), client.c_str());
480  if(me->getMeanError(2)==0){
481  TH1F* obj1f = getHisto(substr, process.c_str(), dbe);
482  std::string save = getIMG(runNo,obj1f,1,htmlDir,"X1a","Y1a");
483  errorFile << "<img src=\"" << save << "\">" << std::endl;
484  }
485  else{
486  TH2F* obj2f = getHisto2(substr, process.c_str(), dbe);
487  std::string save = getIMG2(runNo,obj2f,1,htmlDir,"X2a","Y2a");
488  errorFile << "<img src=\"" << save << "\">" << std::endl;
489  }
490  errorFile << "<br>" << std::endl;
491  errorFile << std::endl;
492  }
493  errorFile << "<hr>" << std::endl;
494  errorFile.close();
495 
496 
497  errorFile.open((htmlDir + client+ "Warnings.html").c_str());
498  errorFile << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"> " << std::endl;
499  errorFile << "<html> " << std::endl;
500  errorFile << "<head> " << std::endl;
501  errorFile << " <meta content=\"text/html; charset=ISO-8859-1\" " << std::endl;
502  errorFile << " http-equiv=\"content-type\"> " << std::endl;
503  errorFile << " <title>Monitor: Hcal " << client <<" Task Warning Output</title> " << std::endl;
504  errorFile << "</head> " << std::endl;
505  errorFile << "<style type=\"text/css\"> td { font-weight: bold } </style>" << std::endl;
506  errorFile << "<body> " << std::endl;
507  errorFile << "<br> " << std::endl;
508  errorFile << "<h2>" << client <<" Warnings</h2> " << std::endl;
509 
510  for (mapIter=mapW.begin(); mapIter!=mapW.end();mapIter++){
511  std::string meName = mapIter->first;
512  std::vector<QReport*> errors = mapIter->second;
513  errorFile << "<br>" << std::endl;
514  errorFile << "<hr>" << std::endl;
515  errorFile << "Monitorable '" << meName << "' has the following warnings: <BR>" << std::endl;
516  for(std::vector<QReport*>::iterator report=errors.begin(); report!=errors.end(); report++){
517  errorFile << " "<< (*report)->getQRName() << ": "<< (*report)->getMessage() << std::endl;
518  }
519  MonitorElement* me = dbe->get(meName);
520  errorFile << "<br>" << std::endl;
521  errorFile << "<br>" << std::endl;
522  const char * substr = strstr(meName.c_str(), client.c_str());
523  if(me->getMeanError(2)==0){
524  TH1F* obj1f = getHisto(substr, process.c_str(), dbe);
525  std::string save = getIMG(runNo,obj1f,1,htmlDir,"X1b","Y1b");
526  errorFile << "<img src=\"" << save << "\">" << std::endl;
527  }
528  else{
529  TH2F* obj2f = getHisto2(substr, process.c_str(), dbe);
530  std::string save = getIMG2(runNo,obj2f,1,htmlDir,"X2b","Y2b");
531  errorFile << "<img src=\"" << save << "\">" << std::endl;
532  }
533  errorFile << "<br>" << std::endl;
534  errorFile << std::endl;
535  }
536  errorFile << "<hr>" << std::endl;
537  errorFile.close();
538 
539  errorFile.open((htmlDir + client+ "Messages.html").c_str());
540  errorFile << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"> " << std::endl;
541  errorFile << "<html> " << std::endl;
542  errorFile << "<head> " << std::endl;
543  errorFile << " <meta content=\"text/html; charset=ISO-8859-1\" " << std::endl;
544  errorFile << " http-equiv=\"content-type\"> " << std::endl;
545  errorFile << " <title>Monitor: Hcal " << client <<" Task Message Output</title> " << std::endl;
546  errorFile << "</head> " << std::endl;
547  errorFile << "<style type=\"text/css\"> td { font-weight: bold } </style>" << std::endl;
548  errorFile << "<body> " << std::endl;
549  errorFile << "<br> " << std::endl;
550  errorFile << "<h2>" << client <<" Messages</h2> " << std::endl;
551 
552  for (mapIter=mapO.begin(); mapIter!=mapO.end();mapIter++){
553  std::string meName = mapIter->first;
554  std::vector<QReport*> errors = mapIter->second;
555  errorFile << "<br>" << std::endl;
556  errorFile << "<hr>" << std::endl;
557  errorFile << "Monitorable '" << meName << "' has the following messages: <br>" << std::endl;
558  for(std::vector<QReport*>::iterator report=errors.begin(); report!=errors.end(); report++){
559  errorFile << " "<< (*report)->getQRName() << ": "<< (*report)->getMessage() << std::endl;
560  }
561  errorFile << "<br>" << std::endl;
562  errorFile << "<br>" << std::endl;
563  MonitorElement* me = dbe->get(meName);
564  const char * substr = strstr(meName.c_str(), client.c_str());
565  if(me->getMeanError(2)==0){
566  TH1F* obj1f = getHisto(substr, process.c_str(), dbe);
567  std::string save = getIMG(runNo,obj1f,1,htmlDir,"X1c","Y1c");
568  errorFile << "<img src=\"" << save << "\">" << std::endl;
569  }
570  else{
571  TH2F* obj2f = getHisto2(substr, process.c_str(), dbe);
572  std::string save = getIMG2(runNo,obj2f,1,htmlDir,"X2c","Y2c");
573  errorFile << "<img src=\"" << save << "\">" << std::endl;
574  }
575  errorFile << "<br>" << std::endl;
576  errorFile << std::endl;
577  }
578  errorFile << "<hr>" << std::endl;
579  errorFile.close();
580 
581  return;
582 
583 }
TH2F * getHisto2(std::string name, std::string process, DQMStore *dbe_, bool verb=false, bool clone=false)
double getMeanError(int axis=1) const
tuple report
Definition: zeeHLT_cff.py: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:1468
std::string getIMG2(int runNo, TH2F *hist, int size, std::string htmlDir, const char *xlab, const char *ylab, bool color=false)
tuple process
Definition: LaserDQM_cfg.py:3
std::string getIMG(int runNo, TH1F *hist, int size, std::string htmlDir, const char *xlab, const char *ylab)
TH1F * getHisto(std::string name, std::string process, DQMStore *dbe_, bool verb=false, bool clone=false)
bool isValidGeom ( std::string  type,
int  depth 
)

Definition at line 14 of file HcalClientUtils.cc.

15 {
16  if (type=="HB" && (depth==1 || depth==2))
17  return true;
18  if (type=="HE" && (depth==1 || depth==2 || depth==3))
19  return true;
20  if (type=="HO" && (depth==4))
21  return true;
22  if (type=="HF" && (depth==1 || depth==2))
23  return true;
24  return false;
25 }
type
Definition: HCALResponse.h:22
bool isValidGeom ( int  subdet,
int  iEta,
int  iPhi,
int  depth 
)

Definition at line 27 of file HcalClientUtils.cc.

References abs, Gflash::EtaMax, and Gflash::EtaMin.

27  {
28 
29  if(subdet<0 || subdet>3) return false;
30 
31  int EtaMin[4]; int EtaMax[4];
32  int PhiMin[4]; int PhiMax[4];
33  int DepMin[4]; int DepMax[4];
34 
35  //HB ieta/iphi/depths
36  EtaMin[0]=1; EtaMax[0]=16;
37  PhiMin[0]=1; PhiMax[0]=72;
38  DepMin[0]=1; DepMax[0]=2;
39 
40  //HE ieta/iPhi/Depths
41  EtaMin[1]=16; EtaMax[1]=29;
42  PhiMin[1]=1; PhiMax[1]=72;
43  DepMin[1]=1; DepMax[1]=3;
44 
45  //HF ieta/iphi/depths
46  EtaMin[2]=29; EtaMax[2]=41;
47  PhiMin[2]=1; PhiMax[2]=72;
48  DepMin[2]=1; DepMax[2]=2;
49 
50  //HO ieta/iphi/depths
51  EtaMin[3]=1; EtaMax[3]=15;
52  PhiMin[3]=1; PhiMax[3]=72;
53  DepMin[3]=4; DepMax[3]=4;
54 
55  if(iEta!=0) if(abs(iEta)<EtaMin[subdet] || abs(iEta)>EtaMax[subdet]) return false;
56  if(iPhi!=0) if(abs(iPhi)<PhiMin[subdet] || abs(iPhi)>PhiMax[subdet]) return false;
57  if(depth!=0) if(abs(depth)<DepMin[subdet] || abs(depth)>DepMax[subdet]) return false;
58 
59 
60  if(subdet==0 && abs(depth)==2 && abs(iEta)<15) return false;
61  else if(subdet==1){
62  if(abs(iEta)>20 && (iPhi%2)==0) return false;
63  if(abs(iEta)>39 && (iPhi%4)!=3) return false;
64  if(abs(iEta)==16 && abs(depth)!=3) return false;
65  if(abs(iEta)==17 && abs(depth)!=1) return false;
66  if(abs(depth)==3){
67  if(abs(iEta)!=27 && abs(iEta)!=28 &&abs(iEta)!=16) return false;
68  }
69  }
70  else if(subdet==2 && (iPhi%2)==0) return false;
71 
72  return true;
73 }
#define abs(x)
Definition: mlp_lapack.h:159
const double EtaMax[kNumberCalorimeter]
const double EtaMin[kNumberCalorimeter]
void resetME ( const char *  name,
DQMStore dbe 
)

Definition at line 7 of file HcalClientUtils.cc.

References DQMStore::get(), NULL, and DQMStore::softReset().

7  {
8  if(dbe==NULL) return;
9  MonitorElement* me= dbe->get(name);
10  if(me) dbe->softReset(me);
11  return;
12 }
#define NULL
Definition: scimark2.h:8
void softReset(MonitorElement *me)
Definition: DQMStore.cc:2734
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1468