CMS 3D CMS Logo

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/DQMOldReceiver.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.

Functions

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


Function Documentation

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

Definition at line 417 of file HcalClientUtils.cc.

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

00417                                                                        {
00418   if (params.size() < 2 ) return;
00419   if(ref==NULL) return;
00420   if(!dbe) return;
00421 
00422   QCriterion* qc = dbe->getQCriterion(params[1]);
00423   MonitorElement* me =  dbe->get(params[0]);
00424   if(me!=NULL && qc == NULL){
00425     printf("\n\nDon't have this QC, but have the me!\n\n");
00426     const QReport* qr = me->getQReport(params[1]);
00427     if(qr) return;
00428     printf("\n\nThe ME doesn't have the QC!!\n\n");
00429     qc = dbe->createQTest("Comp2RefEqualH2",params[1]);
00430     /*  Time to get with 
00431   DQMServices/Core V03-00-12-qtest
00432   DQMServices/ClientConfig V03-00-04-qtest
00433     // Contents within a mean value     
00434     Comp2RefEqualH2ROOT* me_qc = dynamic_cast<Comp2RefEqualH2ROOT*> (qc);
00435     //set reference histogram
00436     me_qc->setReference(ref);
00437     // link it to the monitor element
00438     printf("\n\nGonna run it...\n\n");
00439     dbe->useQTest(params[0], params[1]);
00440     */
00441   }
00442   else printf("\n\nAlready had the QC or didn't have the ME!\n\n");
00443 
00444   return;
00445 }

void createH2ContentTest ( DQMStore dbe,
vector< string > &  params 
)

Definition at line 394 of file HcalClientUtils.cc.

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

Referenced by HcalDigiClient::createTests(), and HcalDataFormatClient::createTests().

00394                                                                {
00395   if (params.size() < 2 ) return;
00396   if(!dbe) return;
00397 
00398   QCriterion* qc = dbe->getQCriterion(params[1]);
00399   MonitorElement* me =  dbe->get(params[0]);
00400   if(me!=NULL && qc == NULL){
00401     /*  Time to get with 
00402   DQMServices/Core V03-00-12-qtest
00403   DQMServices/ClientConfig V03-00-04-qtest
00404     qc = dbe->createQTest(ContentsTH2FWithinRange::getAlgoName(),params[1]);
00405     // Contents within a mean value     
00406     ContentsTH2FWithinRangeROOT* me_qc = dynamic_cast<ContentsTH2FWithinRangeROOT*> (qc);
00407     me_qc->setMeanRange(0,1e-10);
00408     me_qc->setRMSRange(0,1e-10);
00409     // link it to the monitor element
00410     dbe->useQTest(params[0], params[1]);
00411     */
00412   }
00413   
00414   return;
00415 }

void createMeanValueTest ( DQMStore dbe,
vector< string > &  params 
)

Definition at line 370 of file HcalClientUtils.cc.

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

00370                                                                {
00371   if (params.size() < 7 ) return;
00372   if(!dbe) return;
00373 
00374   QCriterion* qc = dbe->getQCriterion(params[1]);
00375   if(qc == NULL){
00376     qc = dbe->createQTest("MeanWithinExpected",params[1]);
00377     // Contents within a mean value
00378     MeanWithinExpected* me_qc = (MeanWithinExpected*) qc;
00379     //set probability limit for test warning
00380     me_qc->setWarningProb(atof(params[2].c_str()));
00381     //set probability limit for test error
00382     me_qc->setErrorProb(atof(params[3].c_str()));
00383     // set Expected Mean
00384     me_qc->setExpectedMean(atof(params[4].c_str()));
00385     // set Test Type
00386     if (params[6] == "useRMS") me_qc->useRMS();
00387     else if (params[6] == "useSigma") me_qc->useSigma(atof(params[5].c_str()));
00388   }
00389   // link it to the monitor element
00390   dbe->useQTest(params[0], params[1]);
00391   return;
00392 }

void createXRangeTest ( DQMStore dbe,
vector< string > &  params 
)

Definition at line 328 of file HcalClientUtils.cc.

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

Referenced by HcalLEDClient::createTests(), and HcalDataFormatClient::createTests().

00328                                                             {
00329   if (params.size() < 6) return;
00330   if(!dbe) return;
00331 
00332   QCriterion* qc = dbe->getQCriterion(params[1]);
00333   if(qc == NULL){
00334     qc = dbe->createQTest(ContentsXRange::getAlgoName(),params[1]);
00335     // Contents within [Xmin, Xmax]
00336     ContentsXRange* me_qc = (ContentsXRange*) qc;
00337     //set probability limit for test warning 
00338     me_qc->setWarningProb(atof(params[2].c_str()));
00339     //set probability limit for test error 
00340     me_qc->setErrorProb(atof(params[3].c_str()));
00341     // set allowed range in X-axis (default values: histogram's X-range)
00342     me_qc->setAllowedXRange(atof(params[4].c_str()), atof(params[5].c_str()));
00343   }
00344   // link it to the monitor element
00345   dbe->useQTest(params[0], params[1]);
00346   return;
00347 }

void createYRangeTest ( DQMStore dbe,
vector< string > &  params 
)

Definition at line 349 of file HcalClientUtils.cc.

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

Referenced by HcalDataFormatClient::createTests().

00349                                                             {
00350   if (params.size() < 6) return;
00351   if(!dbe) return;
00352 
00353   QCriterion* qc = dbe->getQCriterion(params[1]);
00354   if(qc == NULL){
00355     qc = dbe->createQTest(ContentsYRange::getAlgoName(),params[1]);
00356     // Contents within [Xmin, Xmax]
00357     ContentsYRange* me_qc = (ContentsYRange*) qc;
00358     //set probability limit for test warning 
00359     me_qc->setWarningProb(atof(params[2].c_str()));
00360     //set probability limit for test error 
00361     me_qc->setErrorProb(atof(params[3].c_str()));
00362     // set allowed range in Y-axis (default values: histogram's Y-range)
00363     me_qc->setAllowedYRange(atof(params[4].c_str()), atof(params[5].c_str()));
00364   }
00365   // link it to the monitor element
00366   dbe->useQTest(params[0], params[1]);
00367   return;
00368 }

void dumpHisto ( TH1F *  hist,
vector< string > &  names,
vector< double > &  meanX,
vector< double > &  meanY,
vector< double > &  rmsX,
vector< double > &  rmsY 
)

Definition at line 74 of file HcalClientUtils.cc.

00076                                                           {
00077   
00078   names.push_back((string)hist->GetName());
00079   meanX.push_back(hist->GetMean(1));
00080   meanY.push_back(-123e10);
00081   rmsX.push_back(hist->GetRMS(1));
00082   rmsY.push_back(-123e10);  
00083   return;
00084 }

void dumpHisto2 ( TH2F *  hist,
vector< string > &  names,
vector< double > &  meanX,
vector< double > &  meanY,
vector< double > &  rmsX,
vector< double > &  rmsY 
)

Definition at line 85 of file HcalClientUtils.cc.

00087                                                           {
00088   
00089   names.push_back((string)hist->GetName());
00090   meanX.push_back(hist->GetMean(1));
00091   meanY.push_back(hist->GetMean(2));
00092   rmsX.push_back(hist->GetRMS(1));
00093   rmsY.push_back(hist->GetRMS(2));
00094   return;
00095 }

TH1F* getHisto ( const MonitorElement me,
bool  verb = false,
bool  clone = false 
)

Definition at line 279 of file HcalClientUtils.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), MonitorElement::getName(), MonitorElement::getTH1F(), histo, NULL, and out.

00279                                                               {
00280   TH1F* out = NULL;
00281 
00282   if ( me ) {      
00283     if ( verb ) cout << "Found '" << me->getName() << "'" << endl;
00284     if ( clone ) {
00285       char histo[150];
00286       sprintf(histo, "ME %s",((string)(me->getName())).c_str());
00287       out = dynamic_cast<TH1F*> (me->getTH1F()->Clone(histo));
00288     } else {
00289       out = me->getTH1F();
00290     }
00291  }
00292   return out;
00293 }

TH1F* getHisto ( string  name,
string  process,
DQMStore dbe_,
bool  verb = false,
bool  clone = false 
)

Definition at line 238 of file HcalClientUtils.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), DQMStore::get(), MonitorElement::getTH1F(), histo, me, NULL, out, and indexGen::title.

Referenced by HcalLaserClient::getHistograms(), HcalDataFormatClient::getHistograms(), HcalLEDClient::getHistograms(), HcalTrigPrimClient::getHistograms(), and htmlErrors().

00238                                                                                   {
00239   if(!dbe_) return NULL;
00240   
00241   char title[150];  
00242   sprintf(title, "%sHcal/%s",process.c_str(),name.c_str());
00243   TH1F* out = NULL;
00244 
00245   const MonitorElement* me = dbe_->get(title);
00246   if (me){      
00247     if ( verb ) cout << "Found '" << title << "'" << endl;
00248     if ( clone ) {
00249       char histo[150];
00250       sprintf(histo, "ME %s",name.c_str());
00251       out = dynamic_cast<TH1F*> (me->getTH1F()->Clone(histo));
00252     } else {
00253       out = me->getTH1F();
00254     }
00255   }
00256 
00257   return out;
00258 }

TH2F* getHisto2 ( const MonitorElement me,
bool  verb = false,
bool  clone = false 
)

Definition at line 261 of file HcalClientUtils.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), MonitorElement::getName(), MonitorElement::getTH2F(), histo, NULL, and out.

00261                                                                {
00262   
00263   TH2F* out = NULL;
00264 
00265   if ( me ) {      
00266     if ( verb) cout << "Found '" << me->getName() << "'" << endl;
00267     //    MonitorElementT<TNamed>* ob = dynamic_cast<MonitorElementT<TNamed>*> (me);
00268     if ( clone ) {
00269       char histo[150];
00270       sprintf(histo, "ME %s", ((string)(me->getName())).c_str());
00271       out = dynamic_cast<TH2F*> (me->getTH2F()->Clone(histo));
00272     } else {
00273       out = me->getTH2F();
00274     }
00275   }
00276   return out;
00277 }

TH2F* getHisto2 ( string  name,
string  process,
DQMStore dbe_,
bool  verb = false,
bool  clone = false 
)

Definition at line 215 of file HcalClientUtils.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), DQMStore::get(), histo, me, NULL, out, and indexGen::title.

Referenced by HcalLaserClient::getHistograms(), HcalDataFormatClient::getHistograms(), HcalCaloTowerClient::getHistograms(), HcalLEDClient::getHistograms(), HcalTrigPrimClient::getHistograms(), and htmlErrors().

00215                                                                                    {
00216 
00217   if(!dbe_) return NULL;
00218 
00219   TH2F* out = NULL;
00220   char title[150];  
00221   sprintf(title, "%sHcal/%s",process.c_str(),name.c_str());
00222 
00223   MonitorElement* me = dbe_->get(title);
00224 
00225   if ( me ) {      
00226     if ( verb) cout << "Found '" << title << "'" << endl;
00227     if ( clone) {
00228       char histo[150];
00229       sprintf(histo, "ME %s",name.c_str());
00230       out = dynamic_cast<TH2F*> (me->getTH2F()->Clone(histo));
00231     } else {
00232       out = me->getTH2F();
00233     }
00234   }
00235   return out;
00236 }

TH3F* getHistoTH3F ( const MonitorElement me,
bool  verb = false,
bool  clone = false 
)

Definition at line 744 of file HcalClientUtils.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), MonitorElement::getName(), MonitorElement::getTH3F(), histo, NULL, and out.

00744                                                                   {
00745   TH3F* out = NULL;
00746   
00747   if ( me ) {      
00748     if ( verb ) cout << "Found '" << me->getName() << "'" << endl;
00749     if ( clone ) {
00750       char histo[150];
00751       sprintf(histo, "ME %s",((string)(me->getName())).c_str());
00752       out = dynamic_cast<TH3F*> (me->getTH3F()->Clone(histo));
00753     } else {
00754       out = me->getTH3F();
00755     }
00756  }
00757   return out;
00758 }

TH3F* getHistoTH3F ( string  name,
string  process,
DQMStore dbe_,
bool  verb = false,
bool  clone = false 
)

Definition at line 722 of file HcalClientUtils.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), DQMStore::get(), MonitorElement::getTH3F(), histo, me, NULL, out, and indexGen::title.

00722                                                                                       {
00723   if(!dbe_) return NULL;
00724   
00725   char title[150];  
00726   sprintf(title, "%sHcal/%s",process.c_str(),name.c_str());
00727   TH3F* out = NULL;
00728 
00729   const MonitorElement* me = dbe_->get(title);
00730   if (me){      
00731     if ( verb ) cout << "Found '" << title << "'" << endl;
00732     if ( clone ) {
00733       char histo[150];
00734       sprintf(histo, "ME %s",name.c_str());
00735       out = dynamic_cast<TH3F*> (me->getTH3F()->Clone(histo));
00736     } else {
00737       out = me->getTH3F();
00738     }
00739   }
00740 
00741   return out;
00742 }

TProfile* getHistoTProfile ( const MonitorElement me,
bool  verb = false,
bool  clone = false 
)

Definition at line 610 of file HcalClientUtils.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), MonitorElement::getName(), MonitorElement::getTProfile(), histo, NULL, and out.

00610                                                                           {
00611   TProfile* out = NULL;
00612   
00613   if ( me ) {      
00614     if ( verb ) cout << "Found '" << me->getName() << "'" << endl;
00615     if ( clone ) {
00616       char histo[150];
00617       sprintf(histo, "ME %s",((string)(me->getName())).c_str());
00618       out = dynamic_cast<TProfile*> (me->getTProfile()->Clone(histo));
00619     } else {
00620       out = me->getTProfile();
00621     }
00622  }
00623   return out;
00624 }

TProfile* getHistoTProfile ( string  name,
string  process,
DQMStore dbe_,
bool  verb = false,
bool  clone = false 
)

Definition at line 588 of file HcalClientUtils.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), DQMStore::get(), MonitorElement::getTProfile(), histo, me, NULL, out, and indexGen::title.

Referenced by HcalDataFormatClient::getHistograms().

00588                                                                                               {
00589   if(!dbe_) return NULL;
00590   
00591   char title[150];  
00592   sprintf(title, "%sHcal/%s",process.c_str(),name.c_str());
00593   TProfile* out = NULL;
00594 
00595   const MonitorElement* me = dbe_->get(title);
00596   if (me){      
00597     if ( verb ) cout << "Found '" << title << "'" << endl;
00598     if ( clone ) {
00599       char histo[150];
00600       sprintf(histo, "ME %s",name.c_str());
00601       out = dynamic_cast<TProfile*> (me->getTProfile()->Clone(histo));
00602     } else {
00603       out = me->getTProfile();
00604     }
00605   }
00606 
00607   return out;
00608 }

TProfile2D* getHistoTProfile2D ( const MonitorElement me,
bool  verb = false,
bool  clone = false 
)

Definition at line 705 of file HcalClientUtils.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), MonitorElement::getName(), MonitorElement::getTProfile2D(), histo, NULL, and out.

00705                                                                               {
00706   TProfile2D* out = NULL;
00707   
00708   if ( me ) {      
00709     if ( verb ) cout << "Found '" << me->getName() << "'" << endl;
00710     if ( clone ) {
00711       char histo[150];
00712       sprintf(histo, "ME %s",((string)(me->getName())).c_str());
00713       out = dynamic_cast<TProfile2D*> (me->getTProfile2D()->Clone(histo));
00714     } else {
00715       out = me->getTProfile2D();
00716     }
00717  }
00718   return out;
00719 }

TProfile2D* getHistoTProfile2D ( string  name,
string  process,
DQMStore dbe_,
bool  verb = false,
bool  clone = false 
)

Definition at line 683 of file HcalClientUtils.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), DQMStore::get(), MonitorElement::getTProfile2D(), histo, me, NULL, out, and indexGen::title.

00683                                                                                                   {
00684   if(!dbe_) return NULL;
00685   
00686   char title[150];  
00687   sprintf(title, "%sHcal/%s",process.c_str(),name.c_str());
00688   TProfile2D* out = NULL;
00689 
00690   const MonitorElement* me = dbe_->get(title);
00691   if (me){      
00692     if ( verb ) cout << "Found '" << title << "'" << endl;
00693     if ( clone ) {
00694       char histo[150];
00695       sprintf(histo, "ME %s",name.c_str());
00696       out = dynamic_cast<TProfile2D*> (me->getTProfile2D()->Clone(histo));
00697     } else {
00698       out = me->getTProfile2D();
00699     }
00700   }
00701 
00702   return out;
00703 }

string getIMG ( int  runNo,
TH1F *  hist,
int  size,
string  htmlDir,
const char *  xlab,
const char *  ylab 
)

Definition at line 180 of file HcalClientUtils.cc.

References cleanString(), cmsTiming_parser::dest, name, NULL, parseString(), and indexGen::title.

Referenced by histoHTML(), and htmlErrors().

00180                                                                                                  {
00181 
00182   if(hist==NULL) {
00183     printf("getIMG:  This histo is NULL, %s, %s\n",xlab,ylab);
00184     return "";
00185   }
00186 
00187   string name = hist->GetTitle();
00188   cleanString(name);
00189   char dest[512];
00190   if(runNo>-1) sprintf(dest,"%s - Run %d",name.c_str(),runNo);
00191   else sprintf(dest,"%s",name.c_str());
00192   hist->SetTitle(dest);
00193   string title = dest;
00194 
00195   int xwid = 900; int ywid =540;
00196   if(size==1){
00197     title = title+"_tmb";
00198     xwid = 600; ywid = 360;
00199   }
00200   TCanvas* can = new TCanvas(dest,dest, xwid, ywid);
00201 
00202   parseString(title);
00203   string outName = title + ".gif";
00204   string saveName = htmlDir + outName;
00205   hist->SetXTitle(xlab);
00206   hist->SetYTitle(ylab);
00207   hist->Draw();
00208 
00209   can->SaveAs(saveName.c_str());  
00210   delete can;
00211 
00212   return outName;
00213 }

string getIMG2 ( int  runNo,
TH2F *  hist,
int  size,
string  htmlDir,
const char *  xlab,
const char *  ylab,
bool  color = false 
)

Definition at line 137 of file HcalClientUtils.cc.

References cleanString(), cmsTiming_parser::dest, name, NULL, parseString(), and indexGen::title.

Referenced by histoHTML2(), and htmlErrors().

00137                                                                                                              {
00138 
00139   if(hist==NULL) {
00140     printf("getIMG2:  This histo is NULL, %s, %s\n",xlab,ylab);
00141     return "";
00142   }
00143 
00144   string name = hist->GetTitle();
00145   cleanString(name);
00146   char dest[512];
00147   if(runNo>-1) sprintf(dest,"%s - Run %d",name.c_str(),runNo);
00148   else sprintf(dest,"%s",name.c_str());
00149   hist->SetTitle(dest);
00150   string title = dest;
00151 
00152   int xwid = 900; int ywid =540;
00153   if(size==1){
00154     title = title+"_tmb";
00155     xwid = 600; ywid = 360;
00156   }
00157   TCanvas* can = new TCanvas(dest,dest, xwid, ywid);
00158 
00159   // Put grids on all 2-D histograms
00160   can->SetGridx();
00161   can->SetGridy();
00162   
00163 
00164   parseString(title);
00165   string outName = title + ".gif";
00166   string saveName = htmlDir + outName;
00167   hist->SetXTitle(xlab);
00168   hist->SetYTitle(ylab);
00169   if(color) hist->Draw();
00170   else{
00171     hist->SetStats(false);
00172     hist->Draw("COLZ");
00173   }
00174   can->SaveAs(saveName.c_str());  
00175   delete can;
00176 
00177   return outName;
00178 }

string getIMGTProfile ( int  runNo,
TProfile *  hist,
int  size,
string  htmlDir,
const char *  xlab,
const char *  ylab,
string  opts = "NONE" 
)

Definition at line 626 of file HcalClientUtils.cc.

References cleanString(), cmsTiming_parser::dest, name, NULL, parseString(), and indexGen::title.

Referenced by histoHTMLTProfile().

00626                                                                                                                           {
00627 
00628   if(hist==NULL) {
00629     printf("getIMG:  This histo is NULL, %s, %s\n",xlab,ylab);
00630     return "";
00631   }
00632 
00633   string name = hist->GetTitle();
00634   cleanString(name);
00635   char dest[512];
00636   if(runNo>-1) sprintf(dest,"%s - Run %d",name.c_str(),runNo);
00637   else sprintf(dest,"%s",name.c_str());
00638   hist->SetTitle(dest);
00639   string title = dest;
00640 
00641   int xwid = 900; int ywid =540;
00642   if(size==1){
00643     title = title+"_tmb";
00644     xwid = 600; ywid = 360;
00645   }
00646   TCanvas* can = new TCanvas(dest,dest, xwid, ywid);
00647 
00648   parseString(title);
00649   string outName = title + ".gif";
00650   string saveName = htmlDir + outName;
00651   hist->SetXTitle(xlab);
00652   hist->SetYTitle(ylab);
00653   if (opts!="NONE")
00654     hist->SetOption(opts.c_str());
00655   hist->Draw();
00656 
00657   can->SaveAs(saveName.c_str());  
00658   delete can;
00659 
00660   return outName;
00661 }

void histoHTML ( int  runNo,
TH1F *  hist,
const char *  xlab,
const char *  ylab,
int  width,
ofstream &  htmlFile,
string  htmlDir 
)

Definition at line 296 of file HcalClientUtils.cc.

References lat::endl(), getIMG(), and NULL.

Referenced by HcalDataFormatClient::htmlOutput(), HcalLEDClient::htmlOutput(), and HcalLaserClient::htmlOutput().

00296                                                                                                                         {
00297   
00298   if(hist!=NULL){    
00299     string imgNameTMB = "";   
00300     imgNameTMB = getIMG(runNo,hist,1,htmlDir,xlab,ylab); 
00301     string imgName = "";   
00302     imgName = getIMG(runNo,hist,2,htmlDir,xlab,ylab);  
00303 
00304     if (imgName.size() != 0 )
00305       htmlFile << "<td><a href=\"" <<  imgName << "\"><img src=\"" <<  imgNameTMB << "\"></a></td>" << endl;
00306     else
00307       htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
00308   }
00309   else htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
00310   return;
00311 }

void histoHTML2 ( int  runNo,
TH2F *  hist,
const char *  xlab,
const char *  ylab,
int  width,
ofstream &  htmlFile,
string  htmlDir,
bool  color = false 
)

Definition at line 313 of file HcalClientUtils.cc.

References lat::endl(), getIMG2(), and NULL.

Referenced by HcalDataFormatClient::htmlOutput(), HcalCaloTowerClient::htmlOutput(), HcalLEDClient::htmlOutput(), and HcalLaserClient::htmlOutput().

00313                                                                                                                                      {
00314   if(hist!=NULL){
00315     string imgNameTMB = "";
00316     imgNameTMB = getIMG2(runNo,hist,1,htmlDir,xlab,ylab,color);  
00317     string imgName = "";
00318     imgName = getIMG2(runNo,hist,2,htmlDir,xlab,ylab,color);  
00319     if (imgName.size() != 0 )
00320       htmlFile << "<td><a href=\"" <<  imgName << "\"><img src=\"" <<  imgNameTMB << "\"></a></td>" << endl;
00321     else
00322       htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
00323   }
00324   else htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
00325   return;
00326 }

void histoHTMLTProfile ( int  runNo,
TProfile *  hist,
const char *  xlab,
const char *  ylab,
int  width,
ofstream &  htmlFile,
string  htmlDir,
string  opts = "NONE" 
)

Definition at line 663 of file HcalClientUtils.cc.

References lat::endl(), getIMGTProfile(), and NULL.

Referenced by HcalDataFormatClient::htmlOutput().

00663                                                                                                                                                  {
00664   
00665   if(hist!=NULL){    
00666     string imgNameTMB = "";   
00667     imgNameTMB = getIMGTProfile(runNo,hist,1,htmlDir,xlab,ylab,opts); 
00668     string imgName = "";   
00669     imgName = getIMGTProfile(runNo,hist,2,htmlDir,xlab,ylab,opts);  
00670 
00671     if (imgName.size() != 0 )
00672       htmlFile << "<td><a href=\"" <<  imgName << "\"><img src=\"" <<  imgNameTMB << "\"></a></td>" << endl;
00673     else
00674       htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
00675   }
00676   else htmlFile << "<td><img src=\"" << " " << "\"></td>" << endl;
00677   return;
00678 }

void htmlErrors ( int  runNo,
string  htmlDir,
string  client,
string  process,
DQMStore dbe,
map< string, vector< QReport * > >  mapE,
map< string, vector< QReport * > >  mapW,
map< string, vector< QReport * > >  mapO 
)

Definition at line 447 of file HcalClientUtils.cc.

References lat::endl(), HLT_VtxMuL3::errors, DQMStore::get(), getHisto(), getHisto2(), getIMG(), getIMG2(), MonitorElement::getMeanError(), me, and WenuSkim_TriggerBit_cff::report.

Referenced by HcalHotCellClient::htmlExpertOutput(), HcalDeadCellClient::htmlExpertOutput(), HcalRecHitClient::htmlExpertOutput(), HcalBeamClient::htmlExpertOutput(), HcalPedestalClient::htmlExpertOutput(), HcalDataFormatClient::htmlOutput(), HcalCaloTowerClient::htmlOutput(), HcalLEDClient::htmlOutput(), HcalTrigPrimClient::htmlOutput(), HcalLaserClient::htmlOutput(), and HcalDigiClient::htmlOutput().

00447                                                                                                                                                                                                        {
00448   if(!dbe) return;
00449 
00450   map<string, vector<QReport*> >::iterator mapIter;
00451 
00452   ofstream errorFile;
00453   errorFile.open((htmlDir + client+ "Errors.html").c_str());
00454   errorFile << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">  " << endl;
00455   errorFile << "<html>  " << endl;
00456   errorFile << "<head>  " << endl;
00457   errorFile << "  <meta content=\"text/html; charset=ISO-8859-1\"  " << endl;
00458   errorFile << " https-equiv=\"content-type\">  " << endl;
00459   errorFile << "  <title>Monitor: Hcal " << client <<" Task Error Output</title> " << endl;
00460   errorFile << "</head>  " << endl;
00461   errorFile << "<style type=\"text/css\"> td { font-weight: bold } </style>" << endl;
00462   errorFile << "<body>  " << endl;
00463   errorFile << "<br>  " << endl;
00464   errorFile << "<h2>" << client <<" Errors</h2> " << endl;
00465 
00466   for (mapIter=mapE.begin(); mapIter!=mapE.end();mapIter++){
00467     string meName = mapIter->first;
00468     vector<QReport*> errors = mapIter->second;
00469     errorFile << "<br>" << endl;     
00470     errorFile << "<hr>" << endl;
00471     errorFile << "Monitorable '" << meName << "' has the following errors: <br>" << endl;
00472     for(vector<QReport*>::iterator report=errors.begin(); report!=errors.end(); report++){
00473       errorFile << "     "<< (*report)->getQRName() << ": "<< (*report)->getMessage() << endl;
00474     }
00475     MonitorElement* me = dbe->get(meName);
00476     errorFile << "<br>" << endl;
00477     errorFile << "<br>" << endl;
00478     char* substr = strstr(meName.c_str(), client.c_str());
00479     if(me->getMeanError(2)==0){
00480       TH1F* obj1f = getHisto(substr, process.c_str(), dbe);
00481       string save = getIMG(runNo,obj1f,1,htmlDir,"X1a","Y1a");
00482       errorFile << "<img src=\"" <<  save << "\">" << endl;
00483     }
00484     else{
00485       TH2F* obj2f = getHisto2(substr, process.c_str(), dbe);
00486       string save = getIMG2(runNo,obj2f,1,htmlDir,"X2a","Y2a");
00487       errorFile << "<img src=\"" <<  save << "\">" << endl;
00488     }
00489     errorFile << "<br>" << endl;
00490     errorFile << endl;
00491   }
00492   errorFile << "<hr>" << endl;
00493   errorFile.close();
00494 
00495 
00496   errorFile.open((htmlDir + client+ "Warnings.html").c_str());
00497   errorFile << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">  " << endl;
00498   errorFile << "<html>  " << endl;
00499   errorFile << "<head>  " << endl;
00500   errorFile << "  <meta content=\"text/html; charset=ISO-8859-1\"  " << endl;
00501   errorFile << " https-equiv=\"content-type\">  " << endl;
00502   errorFile << "  <title>Monitor: Hcal " << client <<" Task Warning Output</title> " << endl;
00503   errorFile << "</head>  " << endl;
00504   errorFile << "<style type=\"text/css\"> td { font-weight: bold } </style>" << endl;
00505   errorFile << "<body>  " << endl;
00506   errorFile << "<br>  " << endl;
00507   errorFile << "<h2>" << client <<" Warnings</h2> " << endl;
00508 
00509   for (mapIter=mapW.begin(); mapIter!=mapW.end();mapIter++){
00510     string meName = mapIter->first;
00511     vector<QReport*> errors = mapIter->second;
00512     errorFile << "<br>" << endl;     
00513     errorFile << "<hr>" << endl;
00514     errorFile << "Monitorable '" << meName << "' has the following warnings: <BR>" << endl;
00515     for(vector<QReport*>::iterator report=errors.begin(); report!=errors.end(); report++){
00516       errorFile << "     "<< (*report)->getQRName() << ": "<< (*report)->getMessage() << endl;
00517     }
00518     MonitorElement* me = dbe->get(meName);
00519     errorFile << "<br>" << endl;
00520     errorFile << "<br>" << endl;
00521     char* substr = strstr(meName.c_str(), client.c_str());
00522     if(me->getMeanError(2)==0){
00523       TH1F* obj1f = getHisto(substr, process.c_str(), dbe);
00524       string save = getIMG(runNo,obj1f,1,htmlDir,"X1b","Y1b");
00525       errorFile << "<img src=\"" <<  save << "\">" << endl;
00526     }
00527     else{
00528       TH2F* obj2f = getHisto2(substr, process.c_str(), dbe);
00529       string save = getIMG2(runNo,obj2f,1,htmlDir,"X2b","Y2b");
00530       errorFile << "<img src=\"" <<  save << "\">" << endl;
00531     }
00532     errorFile << "<br>" << endl;
00533     errorFile << endl;  
00534   }
00535   errorFile << "<hr>" << endl;
00536   errorFile.close();
00537   
00538   errorFile.open((htmlDir + client+ "Messages.html").c_str());
00539   errorFile << "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">  " << endl;
00540   errorFile << "<html>  " << endl;
00541   errorFile << "<head>  " << endl;
00542   errorFile << "  <meta content=\"text/html; charset=ISO-8859-1\"  " << endl;
00543   errorFile << " https-equiv=\"content-type\">  " << endl;
00544   errorFile << "  <title>Monitor: Hcal " << client <<" Task Message Output</title> " << endl;
00545   errorFile << "</head>  " << endl;
00546   errorFile << "<style type=\"text/css\"> td { font-weight: bold } </style>" << endl;
00547   errorFile << "<body>  " << endl;
00548   errorFile << "<br>  " << endl;
00549   errorFile << "<h2>" << client <<" Messages</h2> " << endl;
00550 
00551   for (mapIter=mapO.begin(); mapIter!=mapO.end();mapIter++){
00552     string meName = mapIter->first;
00553     vector<QReport*> errors = mapIter->second;
00554     errorFile << "<br>" << endl;     
00555     errorFile << "<hr>" << endl;
00556     errorFile << "Monitorable '" << meName << "' has the following messages: <br>" << endl;
00557     for(vector<QReport*>::iterator report=errors.begin(); report!=errors.end(); report++){
00558       errorFile << "     "<< (*report)->getQRName() << ": "<< (*report)->getMessage() << endl;
00559     }
00560     errorFile << "<br>" << endl;
00561     errorFile << "<br>" << endl;
00562     MonitorElement* me = dbe->get(meName);
00563     char* substr = strstr(meName.c_str(), client.c_str());
00564     if(me->getMeanError(2)==0){
00565       TH1F* obj1f = getHisto(substr, process.c_str(), dbe);
00566       string save = getIMG(runNo,obj1f,1,htmlDir,"X1c","Y1c");
00567       errorFile << "<img src=\"" <<  save << "\">" << endl;
00568     }
00569     else{
00570       TH2F* obj2f = getHisto2(substr, process.c_str(), dbe);
00571       string save = getIMG2(runNo,obj2f,1,htmlDir,"X2c","Y2c");
00572       errorFile << "<img src=\"" <<  save << "\">" << endl;
00573     }
00574     errorFile << "<br>" << endl;
00575     errorFile << endl;
00576   }
00577   errorFile << "<hr>" << endl;
00578   errorFile.close();
00579 
00580   return;
00581 
00582 }

bool isValidGeom ( int  subdet,
int  iEta,
int  iPhi,
int  depth 
)

Definition at line 26 of file HcalClientUtils.cc.

References funct::abs(), Gflash::EtaMax, and Gflash::EtaMin.

00026                                                            {
00027   
00028   if(subdet<0 || subdet>3) return false;
00029   
00030   int EtaMin[4]; int EtaMax[4];
00031   int PhiMin[4]; int PhiMax[4];
00032   int DepMin[4]; int DepMax[4];
00033   
00034   //HB ieta/iphi/depths
00035   EtaMin[0]=1; EtaMax[0]=16;
00036   PhiMin[0]=1; PhiMax[0]=72;
00037   DepMin[0]=1; DepMax[0]=2;
00038   
00039   //HE ieta/iPhi/Depths
00040   EtaMin[1]=16; EtaMax[1]=29;
00041   PhiMin[1]=1; PhiMax[1]=72;
00042   DepMin[1]=1; DepMax[1]=3;
00043   
00044   //HF ieta/iphi/depths
00045   EtaMin[2]=29; EtaMax[2]=41;
00046   PhiMin[2]=1; PhiMax[2]=72;
00047   DepMin[2]=1; DepMax[2]=2;
00048   
00049   //HO ieta/iphi/depths
00050   EtaMin[3]=1; EtaMax[3]=15;
00051   PhiMin[3]=1; PhiMax[3]=72;
00052   DepMin[3]=4; DepMax[3]=4;
00053   
00054   if(iEta!=0) if(abs(iEta)<EtaMin[subdet] || abs(iEta)>EtaMax[subdet]) return false;
00055   if(iPhi!=0) if(abs(iPhi)<PhiMin[subdet] || abs(iPhi)>PhiMax[subdet]) return false;
00056   if(depth!=0) if(abs(depth)<DepMin[subdet] || abs(depth)>DepMax[subdet]) return false;
00057   
00058   
00059   if(subdet==0 && abs(depth)==2 && abs(iEta)<15) return false;
00060   else if(subdet==1){
00061     if(abs(iEta)>20 && (iPhi%2)==0) return false;    
00062     if(abs(iEta)>39 && (iPhi%4)!=3) return false;    
00063     if(abs(iEta)==16 && abs(depth)!=3) return false;
00064     if(abs(iEta)==17 && abs(depth)!=1) return false;
00065     if(abs(depth)==3){
00066       if(abs(iEta)!=27 && abs(iEta)!=28 &&abs(iEta)!=16) return false;
00067     }
00068   }
00069   else if(subdet==2 && (iPhi%2)==0) return false;   
00070   
00071   return true;
00072 }

bool isValidGeom ( std::string  type,
int  depth 
)

Definition at line 13 of file HcalClientUtils.cc.

Referenced by HcalLaserClient::getHistograms(), HcalLEDClient::getHistograms(), HcalLaserClient::loadHistograms(), HcalLEDClient::loadHistograms(), HcalLaserClient::resetAllME(), and HcalLEDClient::resetAllME().

00014 {
00015   if (type=="HB" && (depth==1 || depth==2))
00016     return true;
00017   if (type=="HE" && (depth==1 || depth==2 || depth==3))
00018     return true;
00019   if (type=="HO" && (depth==4))
00020     return true;
00021   if (type=="HF" && (depth==1 || depth==2))
00022     return true;
00023   return false;
00024 }

void resetME ( const char *  name,
DQMStore dbe 
)

Definition at line 6 of file HcalClientUtils.cc.

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

Referenced by HcalDataFormatClient::resetAllME(), HcalTrigPrimClient::resetAllME(), HcalDigiClient::resetAllME(), HcalHotCellClient::resetAllME(), HcalPedestalClient::resetAllME(), HcalDeadCellClient::resetAllME(), HcalLaserClient::resetAllME(), HcalLEDClient::resetAllME(), HcalBeamClient::resetAllME(), HcalRecHitClient::resetAllME(), and HcalCaloTowerClient::resetAllME().

00006                                              {
00007   if(dbe==NULL) return;
00008   MonitorElement* me= dbe->get(name);
00009   if(me) dbe->softReset(me);
00010   return;
00011 }


Generated on Tue Jun 9 17:52:38 2009 for CMSSW by  doxygen 1.5.4