00001 #ifndef DQM_HCALCLIENTUTILS_H
00002 #define DQM_HCALCLIENTUTILS_H
00003
00004 #include "TH1F.h"
00005 #include "TH1.h"
00006 #include "TH2F.h"
00007 #include "TCanvas.h"
00008 #include <string>
00009 #include "DQMServices/Core/interface/DQMStore.h"
00010 #include "DQMServices/Core/interface/MonitorElement.h"
00011 #include "DQMServices/Core/interface/QTest.h"
00012 #include "DQMServices/Core/interface/QReport.h"
00013
00014 #include "TROOT.h"
00015 #include "TGaxis.h"
00016 #include <iostream>
00017 #include <fstream>
00018 #include <vector>
00019 #include <string>
00020
00021
00022 class HcalUtilsClient
00023 {
00024
00025 public:
00026
00034 template<class T> static T getHisto( const MonitorElement* me, bool clone = false, T ret = 0,int debug=0) {
00035 if( me ) {
00036 if (debug>0) std::cout << "Found '" << me->getName() <<"'" << std::endl;
00037 TObject* ob = const_cast<MonitorElement*>(me)->getRootObject();
00038 if( ob ) {
00039 if( clone ) {
00040 if( ret ) {
00041 delete ret;
00042 }
00043 std::string s = "ME " + me->getName();
00044 ret = dynamic_cast<T>(ob->Clone(s.c_str()));
00045 if( ret ) {
00046 ret->SetDirectory(0);
00047 }
00048 } else {
00049 ret = dynamic_cast<T>(ob);
00050 }
00051 } else {
00052 ret = 0;
00053 }
00054 } else {
00055 if( !clone ) {
00056 ret = 0;
00057 }
00058 }
00059 return ret;
00060 }
00061
00062 };
00063
00064
00065
00066
00067 void resetME(const char* name, DQMStore* dbe);
00068
00069 bool isValidGeom(std::string type, int depth);
00070 bool isValidGeom(int subdet, int iEta, int iPhi, int depth);
00071
00072 TH2F* getHisto2(std::string name, std::string process, DQMStore* dbe_, bool verb=false, bool clone=false);
00073 TH1F* getHisto(std::string name, std::string process, DQMStore* dbe_, bool verb=false, bool clone=false);
00074
00075 TH2F* getHisto2(const MonitorElement* me, bool verb=false, bool clone=false);
00076 TH1F* getHisto(const MonitorElement* me, bool verb=false, bool clone=false);
00077
00078 std::string getIMG(int runNo,TH1F* hist, int size, std::string htmlDir, const char* xlab, const char* ylab);
00079 std::string getIMG2(int runNo,TH2F* hist, int size, std::string htmlDir, const char* xlab, const char* ylab, bool color=false);
00080
00081 void histoHTML(int runNo,TH1F* hist, const char* xlab, const char* ylab, int width, ofstream& htmlFile, std::string htmlDir);
00082 void histoHTML2(int runNo,TH2F* hist, const char* xlab, const char* ylab, int width, ofstream& htmlFile, std::string htmlDir, bool color=false);
00083
00084 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);
00085
00086 void createXRangeTest(DQMStore* dbe, std::vector<std::string>& params);
00087 void createYRangeTest(DQMStore* dbe, std::vector<std::string>& params);
00088 void createMeanValueTest(DQMStore* dbe, std::vector<std::string>& params);
00089 void createH2CompTest(DQMStore* dbe, std::vector<std::string>& params, TH2F* ref);
00090 void createH2ContentTest(DQMStore* dbe, std::vector<std::string>& params);
00091
00092 void dumpHisto(TH1F* hist, std::vector<std::string> &names,
00093 std::vector<double> &meanX, std::vector<double> &meanY,
00094 std::vector<double> &rmsX, std::vector<double> &rmsY);
00095 void dumpHisto2(TH2F* hist, std::vector<std::string> &names,
00096 std::vector<double> &meanX, std::vector<double> &meanY,
00097 std::vector<double> &rmsX, std::vector<double> &rmsY);
00098
00099
00100
00101
00102 TProfile* getHistoTProfile(std::string name, std::string process, DQMStore* dbe_, bool verb=false, bool clone=false);
00103 TProfile* getHistoTProfile(const MonitorElement* me, bool verb=false, bool clone=false);
00104
00105
00106 std::string getIMGTProfile(int runNo,TProfile* hist, int size, std::string htmlDir, const char* xlab, const char* ylab,std::string opts="NONE");
00107 void histoHTMLTProfile(int runNo,TProfile* hist, const char* xlab, const char* ylab, int width, ofstream& htmlFile, std::string htmlDir, std::string opts="NONE");
00108
00109
00110
00111 TProfile2D* getHistoTProfile2D(std::string name, std::string process, DQMStore* dbe_, bool verb=false, bool clone=false);
00112 TProfile2D* getHistoTProfile2D(const MonitorElement* me, bool verb=false, bool clone=false);
00113 TH3F* getHistoTH3F(std::string name, std::string process, DQMStore* dbe_, bool verb=false, bool clone=false);
00114 TH3F* getHistoTH3F(const MonitorElement* me, bool verb=false, bool clone=false);
00115
00116
00117
00118
00119 #endif
00120