16 if (type==
"HB" && (depth==1 || depth==2))
18 if (type==
"HE" && (depth==1 || depth==2 || depth==3))
20 if (type==
"HO" && (depth==4))
22 if (type==
"HF" && (depth==1 || depth==2))
29 if(subdet<0 || subdet>3)
return false;
32 int PhiMin[4];
int PhiMax[4];
33 int DepMin[4];
int DepMax[4];
36 EtaMin[0]=1; EtaMax[0]=16;
37 PhiMin[0]=1; PhiMax[0]=72;
38 DepMin[0]=1; DepMax[0]=2;
41 EtaMin[1]=16; EtaMax[1]=29;
42 PhiMin[1]=1; PhiMax[1]=72;
43 DepMin[1]=1; DepMax[1]=3;
46 EtaMin[2]=29; EtaMax[2]=41;
47 PhiMin[2]=1; PhiMax[2]=72;
48 DepMin[2]=1; DepMax[2]=2;
51 EtaMin[3]=1; EtaMax[3]=15;
52 PhiMin[3]=1; PhiMax[3]=72;
53 DepMin[3]=4; DepMax[3]=4;
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;
60 if(subdet==0 &&
abs(depth)==2 &&
abs(iEta)<15)
return false;
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;
67 if(
abs(iEta)!=27 &&
abs(iEta)!=28 &&
abs(iEta)!=16)
return false;
70 else if(subdet==2 && (iPhi%2)==0)
return false;
76 std::vector<double> &meanX, std::vector<double> &meanY,
77 std::vector<double> &rmsX, std::vector<double> &rmsY){
80 meanX.push_back(hist->GetMean(1));
81 meanY.push_back(-123e10);
82 rmsX.push_back(hist->GetRMS(1));
83 rmsY.push_back(-123e10);
87 std::vector<double> &meanX, std::vector<double> &meanY,
88 std::vector<double> &rmsX, std::vector<double> &rmsY){
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));
100 for (
unsigned int i = 0;
i < title.size();
i++ ) {
101 if ( title.substr(
i, 6) ==
" - Run" ){
102 title.replace(
i, title.size()-
i,
"");
104 if ( title.substr(
i, 4) ==
"_Run" ){
105 title.replace(
i, title.size()-
i,
"");
107 if ( title.substr(
i, 5) ==
"__Run" ){
108 title.replace(
i, title.size()-
i,
"");
115 for (
unsigned int i = 0;
i < title.size();
i++ ) {
116 if ( title.substr(
i, 1) ==
" " ){
117 title.replace(
i, 1,
"_");
119 if ( title.substr(
i, 1) ==
"#" ){
120 title.replace(
i, 1,
"N");
122 if ( title.substr(
i, 1) ==
"-" ){
123 title.replace(
i, 1,
"_");
125 if ( title.substr(
i, 1) ==
"&" ){
126 title.replace(
i, 1,
"_and_");
128 if ( title.substr(
i, 1) ==
"("
129 || title.substr(
i, 1) ==
")"
131 title.replace(
i, 1,
"_");
141 printf(
"getIMG2: This histo is NULL, %s, %s\n",xlab,ylab);
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);
153 int xwid = 900;
int ywid =540;
155 title = title+
"_tmb";
156 xwid = 600; ywid = 360;
158 TCanvas*
can =
new TCanvas(dest,dest, xwid, ywid);
168 hist->SetXTitle(xlab);
169 hist->SetYTitle(ylab);
170 if(color) hist->Draw();
172 hist->SetStats(
false);
175 can->SaveAs(saveName.c_str());
184 printf(
"getIMG: This histo is NULL, %s, %s\n",xlab,ylab);
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);
196 int xwid = 900;
int ywid =540;
198 title = title+
"_tmb";
199 xwid = 600; ywid = 360;
201 TCanvas*
can =
new TCanvas(dest,dest, xwid, ywid);
206 hist->SetXTitle(xlab);
207 hist->SetYTitle(ylab);
210 can->SaveAs(saveName.c_str());
218 if(!dbe_)
return NULL;
222 sprintf(title,
"%sHcal/%s",process.c_str(),name.c_str());
227 if ( verb)
std::cout <<
"Found '" << title <<
"'" << std::endl;
230 sprintf(histo,
"ME %s",name.c_str());
231 out =
dynamic_cast<TH2F*
> (me->getTH2F()->Clone(histo));
240 if(!dbe_)
return NULL;
243 sprintf(title,
"%sHcal/%s",process.c_str(),name.c_str());
248 if ( verb )
std::cout <<
"Found '" << title <<
"'" << std::endl;
251 sprintf(histo,
"ME %s",name.c_str());
252 out =
dynamic_cast<TH1F*
> (me->
getTH1F()->Clone(histo));
272 out =
dynamic_cast<TH2F*
> (me->
getTH2F()->Clone(histo));
288 out =
dynamic_cast<TH1F*
> (me->
getTH1F()->Clone(histo));
301 imgNameTMB =
getIMG(runNo,hist,1,htmlDir,xlab,ylab);
303 imgName =
getIMG(runNo,hist,2,htmlDir,xlab,ylab);
305 if (imgName.size() != 0 )
306 htmlFile <<
"<td><a href=\"" << imgName <<
"\"><img src=\"" << imgNameTMB <<
"\"></a></td>" << std::endl;
308 htmlFile <<
"<td><img src=\"" <<
" " <<
"\"></td>" << std::endl;
310 else htmlFile <<
"<td><img src=\"" <<
" " <<
"\"></td>" << std::endl;
317 imgNameTMB =
getIMG2(runNo,hist,1,htmlDir,xlab,ylab,color);
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;
323 htmlFile <<
"<td><img src=\"" <<
" " <<
"\"></td>" << std::endl;
325 else htmlFile <<
"<td><img src=\"" <<
" " <<
"\"></td>" << std::endl;
330 if (params.size() < 6)
return;
346 dbe->
useQTest(params[0], params[1]);
351 if (params.size() < 6)
return;
367 dbe->
useQTest(params[0], params[1]);
372 if (params.size() < 7 )
return;
377 qc = dbe->
createQTest(
"MeanWithinExpected",params[1]);
387 if (params[6] ==
"useRMS") me_qc->
useRMS();
388 else if (params[6] ==
"useSigma") me_qc->
useSigma(atof(params[5].c_str()));
391 dbe->
useQTest(params[0], params[1]);
396 if (params.size() < 2 )
return;
419 if (params.size() < 2 )
return;
420 if(ref==
NULL)
return;
426 printf(
"\n\nDon't have this QC, but have the me!\n\n");
429 printf(
"\n\nThe ME doesn't have the QC!!\n\n");
430 qc = dbe->
createQTest(
"Comp2RefEqualH2",params[1]);
443 else printf(
"\n\nAlready had the QC or didn't have the ME!\n\n");
448 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){
451 std::map<std::string, std::vector<QReport*> >::iterator mapIter;
453 std::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;
467 for (mapIter=mapE.begin(); mapIter!=mapE.end();mapIter++){
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;
477 errorFile <<
"<br>" << std::endl;
478 errorFile <<
"<br>" << std::endl;
479 const char * substr = strstr(meName.c_str(), client.c_str());
481 TH1F* obj1f =
getHisto(substr, process.c_str(), dbe);
483 errorFile <<
"<img src=\"" << save <<
"\">" << std::endl;
486 TH2F* obj2f =
getHisto2(substr, process.c_str(), dbe);
488 errorFile <<
"<img src=\"" << save <<
"\">" << std::endl;
490 errorFile <<
"<br>" << std::endl;
491 errorFile << std::endl;
493 errorFile <<
"<hr>" << std::endl;
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;
510 for (mapIter=mapW.begin(); mapIter!=mapW.end();mapIter++){
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;
520 errorFile <<
"<br>" << std::endl;
521 errorFile <<
"<br>" << std::endl;
522 const char * substr = strstr(meName.c_str(), client.c_str());
524 TH1F* obj1f =
getHisto(substr, process.c_str(), dbe);
526 errorFile <<
"<img src=\"" << save <<
"\">" << std::endl;
529 TH2F* obj2f =
getHisto2(substr, process.c_str(), dbe);
531 errorFile <<
"<img src=\"" << save <<
"\">" << std::endl;
533 errorFile <<
"<br>" << std::endl;
534 errorFile << std::endl;
536 errorFile <<
"<hr>" << std::endl;
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;
552 for (mapIter=mapO.begin(); mapIter!=mapO.end();mapIter++){
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;
561 errorFile <<
"<br>" << std::endl;
562 errorFile <<
"<br>" << std::endl;
564 const char * substr = strstr(meName.c_str(), client.c_str());
566 TH1F* obj1f =
getHisto(substr, process.c_str(), dbe);
568 errorFile <<
"<img src=\"" << save <<
"\">" << std::endl;
571 TH2F* obj2f =
getHisto2(substr, process.c_str(), dbe);
573 errorFile <<
"<img src=\"" << save <<
"\">" << std::endl;
575 errorFile <<
"<br>" << std::endl;
576 errorFile << std::endl;
578 errorFile <<
"<hr>" << std::endl;
590 if(!dbe_)
return NULL;
593 sprintf(title,
"%sHcal/%s",process.c_str(),name.c_str());
598 if ( verb )
std::cout <<
"Found '" << title <<
"'" << std::endl;
601 sprintf(histo,
"ME %s",name.c_str());
602 out =
dynamic_cast<TProfile*
> (me->
getTProfile()->Clone(histo));
619 out =
dynamic_cast<TProfile*
> (me->
getTProfile()->Clone(histo));
630 printf(
"getIMG: This histo is NULL, %s, %s\n",xlab,ylab);
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);
642 int xwid = 900;
int ywid =540;
644 title = title+
"_tmb";
645 xwid = 600; ywid = 360;
647 TCanvas*
can =
new TCanvas(dest,dest, xwid, ywid);
652 hist->SetXTitle(xlab);
653 hist->SetYTitle(ylab);
655 hist->SetOption(opts.c_str());
658 can->SaveAs(saveName.c_str());
672 if (imgName.size() != 0 )
673 htmlFile <<
"<td><a href=\"" << imgName <<
"\"><img src=\"" << imgNameTMB <<
"\"></a></td>" << std::endl;
675 htmlFile <<
"<td><img src=\"" <<
" " <<
"\"></td>" << std::endl;
677 else htmlFile <<
"<td><img src=\"" <<
" " <<
"\"></td>" << std::endl;
685 if(!dbe_)
return NULL;
688 sprintf(title,
"%sHcal/%s",process.c_str(),name.c_str());
693 if ( verb )
std::cout <<
"Found '" << title <<
"'" << std::endl;
696 sprintf(histo,
"ME %s",name.c_str());
697 out =
dynamic_cast<TProfile2D*
> (me->
getTProfile2D()->Clone(histo));
714 out =
dynamic_cast<TProfile2D*
> (me->
getTProfile2D()->Clone(histo));
724 if(!dbe_)
return NULL;
727 sprintf(title,
"%sHcal/%s",process.c_str(),name.c_str());
732 if ( verb )
std::cout <<
"Found '" << title <<
"'" << std::endl;
735 sprintf(histo,
"ME %s",name.c_str());
736 out =
dynamic_cast<TH3F*
> (me->
getTH3F()->Clone(histo));
753 out =
dynamic_cast<TH3F*
> (me->
getTH3F()->Clone(histo));
void setErrorProb(float prob)
QCriterion * getQCriterion(const std::string &qtname) const
const std::string & getName(void) const
get name of ME
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)
const QReport * getQReport(const std::string &qtname) const
get QReport corresponding to <qtname> (null pointer if QReport does not exist)
static const HistoName names[]
TProfile2D * getTProfile2D(void) const
virtual void setAllowedXRange(double xmin, double xmax)
set allowed range in X-axis (default values: histogram's X-range)
void createXRangeTest(DQMStore *dbe, std::vector< std::string > ¶ms)
TH2F * getHisto2(std::string name, std::string process, DQMStore *dbe_, bool verb=false, bool clone=false)
TProfile2D * getHistoTProfile2D(std::string name, std::string process, DQMStore *dbe_, bool verb=false, bool clone=false)
TH3F * getTH3F(void) const
static std::string getAlgoName(void)
void useSigma(double expectedSigma)
void resetME(const char *name, DQMStore *dbe)
std::string getIMGTProfile(int runNo, TProfile *hist, int size, std::string htmlDir, const char *xlab, const char *ylab, std::string opts="NONE")
void histoHTML2(int runNo, TH2F *hist, const char *xlab, const char *ylab, int width, std::ofstream &htmlFile, std::string htmlDir, bool color=false)
const double EtaMax[kNumberCalorimeter]
void histoHTML(int runNo, TH1F *hist, const char *xlab, const char *ylab, int width, std::ofstream &htmlFile, std::string htmlDir)
double getMeanError(int axis=1) const
Algorithm for testing if histogram's mean value is near expected value.
void parseString(std::string &title)
TProfile * getHistoTProfile(std::string name, std::string process, DQMStore *dbe_, bool verb=false, bool clone=false)
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 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)
Abs< T >::type abs(const T &t)
const double EtaMin[kNumberCalorimeter]
void createMeanValueTest(DQMStore *dbe, std::vector< std::string > ¶ms)
void softReset(MonitorElement *me)
static std::string getAlgoName(void)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
void setExpectedMean(double mean)
void createYRangeTest(DQMStore *dbe, std::vector< std::string > ¶ms)
std::string getIMG2(int runNo, TH2F *hist, int size, std::string htmlDir, const char *xlab, const char *ylab, bool color=false)
TH1F * getTH1F(void) const
void setWarningProb(float prob)
set probability limit for warning and error (default: 90% and 50%)
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
void createH2CompTest(DQMStore *dbe, std::vector< std::string > ¶ms, TH2F *ref)
void cleanString(std::string &title)
void histoHTMLTProfile(int runNo, TProfile *hist, const char *xlab, const char *ylab, int width, std::ofstream &htmlFile, std::string htmlDir, std::string opts="NONE")
TProfile * getTProfile(void) const
void useQTest(const std::string &dir, const std::string &qtname)
void createH2ContentTest(DQMStore *dbe, std::vector< std::string > ¶ms)
QCriterion * createQTest(const std::string &algoname, const std::string &qtname)
TH2F * getTH2F(void) const
std::string getIMG(int runNo, TH1F *hist, int size, std::string htmlDir, const char *xlab, const char *ylab)
virtual void setAllowedYRange(double ymin, double ymax)
TH1F * getHisto(std::string name, std::string process, DQMStore *dbe_, bool verb=false, bool clone=false)
tuple size
Write out results.
TH3F * getHistoTH3F(std::string name, std::string process, DQMStore *dbe_, bool verb=false, bool clone=false)