CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalClientUtils.h
Go to the documentation of this file.
1 #ifndef DQM_HCALCLIENTUTILS_H
2 #define DQM_HCALCLIENTUTILS_H
3 
4 #include "TH1F.h"
5 #include "TH1.h"
6 #include "TH2F.h"
7 #include "TCanvas.h"
8 #include <string>
13 
14 #include "TROOT.h"
15 #include "TGaxis.h"
16 #include <iostream>
17 #include <fstream>
18 #include <vector>
19 #include <string>
20 
21 
23 {
24  // Stolen directly from EcalCommon/interface/UtilsClient.h
25  public:
26 
34  template<class T> static T getHisto( const MonitorElement* me, bool clone = false, T ret = 0,int debug=0) {
35  if( me ) {
36  if (debug>0) std::cout << "Found '" << me->getName() <<"'" << std::endl;
37  TObject* ob = const_cast<MonitorElement*>(me)->getRootObject();
38  if( ob ) {
39  if( clone ) {
40  if( ret ) {
41  delete ret;
42  }
43  std::string s = "ME " + me->getName();
44  ret = dynamic_cast<T>(ob->Clone(s.c_str()));
45  if( ret ) {
46  ret->SetDirectory(0);
47  }
48  } else {
49  ret = dynamic_cast<T>(ob);
50  }
51  } else {
52  ret = 0;
53  }
54  } else {
55  if( !clone ) {
56  ret = 0;
57  }
58  }
59  return ret;
60  }
61 
62 }; // class HcalUtilsClient
63 
64 
65 
66 
67 void resetME(const char* name, DQMStore* dbe);
68 
69 bool isValidGeom(std::string type, int depth);
70 bool isValidGeom(int subdet, int iEta, int iPhi, int depth);
71 
72 TH2F* getHisto2(std::string name, std::string process, DQMStore* dbe_, bool verb=false, bool clone=false);
73 TH1F* getHisto(std::string name, std::string process, DQMStore* dbe_, bool verb=false, bool clone=false);
74 
75 TH2F* getHisto2(const MonitorElement* me, bool verb=false, bool clone=false);
76 TH1F* getHisto(const MonitorElement* me, bool verb=false, bool clone=false);
77 
78 std::string getIMG(int runNo,TH1F* hist, int size, std::string htmlDir, const char* xlab, const char* ylab);
79 std::string getIMG2(int runNo,TH2F* hist, int size, std::string htmlDir, const char* xlab, const char* ylab, bool color=false);
80 
81 void histoHTML(int runNo,TH1F* hist, const char* xlab, const char* ylab, int width, ofstream& htmlFile, std::string htmlDir);
82 void histoHTML2(int runNo,TH2F* hist, const char* xlab, const char* ylab, int width, ofstream& htmlFile, std::string htmlDir, bool color=false);
83 
84 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);
85 
86 void createXRangeTest(DQMStore* dbe, std::vector<std::string>& params);
87 void createYRangeTest(DQMStore* dbe, std::vector<std::string>& params);
88 void createMeanValueTest(DQMStore* dbe, std::vector<std::string>& params);
89 void createH2CompTest(DQMStore* dbe, std::vector<std::string>& params, TH2F* ref);
90 void createH2ContentTest(DQMStore* dbe, std::vector<std::string>& params);
91 
92 void dumpHisto(TH1F* hist, std::vector<std::string> &names,
93  std::vector<double> &meanX, std::vector<double> &meanY,
94  std::vector<double> &rmsX, std::vector<double> &rmsY);
95 void dumpHisto2(TH2F* hist, std::vector<std::string> &names,
96  std::vector<double> &meanX, std::vector<double> &meanY,
97  std::vector<double> &rmsX, std::vector<double> &rmsY);
98 
99 
100 // There's got to be a better way than just creating a separate method for each histogram type!
101 // But so far, template functions haven't worked!
102 TProfile* getHistoTProfile(std::string name, std::string process, DQMStore* dbe_, bool verb=false, bool clone=false);
103 TProfile* getHistoTProfile(const MonitorElement* me, bool verb=false, bool clone=false);
104 //getIMG, histoHTML are now deprecated by tools in HcalHistoUtils.h
105 // Eventually, the getHisto algorithms will become deprecated as well
106 std::string getIMGTProfile(int runNo,TProfile* hist, int size, std::string htmlDir, const char* xlab, const char* ylab,std::string opts="NONE");
107 void histoHTMLTProfile(int runNo,TProfile* hist, const char* xlab, const char* ylab, int width, ofstream& htmlFile, std::string htmlDir, std::string opts="NONE");
108 
109 
110 
111 TProfile2D* getHistoTProfile2D(std::string name, std::string process, DQMStore* dbe_, bool verb=false, bool clone=false);
112 TProfile2D* getHistoTProfile2D(const MonitorElement* me, bool verb=false, bool clone=false);
113 TH3F* getHistoTH3F(std::string name, std::string process, DQMStore* dbe_, bool verb=false, bool clone=false);
114 TH3F* getHistoTH3F(const MonitorElement* me, bool verb=false, bool clone=false);
115 
116 
117 
118 
119 #endif
120 
type
Definition: HCALResponse.h:22
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)
static T getHisto(const MonitorElement *me, bool clone=false, T ret=0, int debug=0)
Returns the histogram contained by the Monitor Element.
static const HistoName names[]
void createXRangeTest(DQMStore *dbe, std::vector< std::string > &params)
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)
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 histoHTML(int runNo, TH1F *hist, const char *xlab, const char *ylab, int width, ofstream &htmlFile, std::string htmlDir)
void histoHTMLTProfile(int runNo, TProfile *hist, const char *xlab, const char *ylab, int width, ofstream &htmlFile, std::string htmlDir, std::string opts="NONE")
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)
void createMeanValueTest(DQMStore *dbe, std::vector< std::string > &params)
DQMStore * dbe_
void createYRangeTest(DQMStore *dbe, std::vector< std::string > &params)
std::string getIMG2(int runNo, TH2F *hist, int size, std::string htmlDir, const char *xlab, const char *ylab, bool color=false)
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
void createH2CompTest(DQMStore *dbe, std::vector< std::string > &params, TH2F *ref)
tuple cout
Definition: gather_cfg.py:121
void createH2ContentTest(DQMStore *dbe, std::vector< std::string > &params)
#define debug
Definition: MEtoEDMFormat.h:34
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)
void histoHTML2(int runNo, TH2F *hist, const char *xlab, const char *ylab, int width, ofstream &htmlFile, std::string htmlDir, bool color=false)
long double T
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)