00001
00002
00004 #ifndef __GwollumPlot__
00005 #define __GwollumPlot__
00006
00007 #include "CUtils.h"
00008 #include "TStyle.h"
00009 #include "TMultiGraph.h"
00010 #include "TGraph.h"
00011 #include "TF1.h"
00012 #include "TH1.h"
00013 #include "TH2.h"
00014 #include "TPad.h"
00015 #include "TCanvas.h"
00016 #include "TLegend.h"
00017 #include "TText.h"
00018
00019 using namespace std;
00020
00033 class GwollumPlot{
00034
00035 public:
00036
00054 GwollumPlot(const string aName, const string aStyleName="GWOLLUM");
00055
00059 virtual ~GwollumPlot(void);
00060
00075 void AddText(const string aText, const double aX, const double aY, const double aSize, const int aPadIndex=0);
00076
00082 void UpdateText(const string aText);
00083
00090 void AddLegendEntry(const TObject *aObj, const string aLabel, const string aStyle="LPF");
00091
00096 void AddLegendHeader(const string aLabel);
00097
00101 void DrawLegend(void);
00102
00106 void ResetLegend(void){ Wleg->Clear(); Wpad->SetPad(0,0,1,1); Wpad->Modified(1); Wpad->Update();};
00107
00114 inline void Draw(TObject *aObj, const string aOptions="", const int aPadIndex=0){ Wpad->cd(aPadIndex); aObj->Draw(aOptions.c_str()); gPad->Modified(); gPad->Update();};
00115
00120 inline void Print(const string aFileName){ Wcan->cd(); Wcan->Print(aFileName.c_str()); };
00121
00130 void Print(const string aFileName, const double aScaleFactor);
00131
00140 inline void SetLogx(const int aValue, const int aPadIndex=0){ Wpad->cd(aPadIndex); gPad->SetLogx(aValue); gPad->Modified(); gPad->Update(); };
00141
00150 inline void SetLogy(const int aValue, const int aPadIndex=0){ Wpad->cd(aPadIndex); gPad->SetLogy(aValue); gPad->Modified(); gPad->Update(); };
00151
00160 inline void SetLogz(const int aValue, const int aPadIndex=0){ Wpad->cd(aPadIndex); gPad->SetLogz(aValue); gPad->Modified(); gPad->Update(); };
00161
00167 inline void SetGridx(const int aValue=1, const int aPadIndex=0){ Wpad->cd(aPadIndex); gPad->SetGridx(aValue); gPad->Modified(); gPad->Update(); };
00168
00174 inline void SetGridy(const int aValue=1, const int aPadIndex=0){ Wpad->cd(aPadIndex); gPad->SetGridy(aValue); gPad->Modified(); gPad->Update(); };
00175
00184 inline void ResizePlot(const int aWidth, const int aHeight){ Wcan->SetCanvasSize(aWidth,aHeight); Wcan->Modified(); Wcan->Update(); };
00185
00190 inline void DivideCanvas(const int aNpads){ Wpad->DivideSquare(aNpads); };
00191
00195 inline string GetCurrentStyle(void){ return stylename; };
00196
00197
00198 protected:
00199
00200 int randid;
00201 string srandid;
00202
00203
00204 TStyle *Wstyle;
00205 string stylename;
00206
00207
00208 TCanvas *Wcan;
00209 TPad *Wpad;
00210
00211
00212 TLegend *Wleg;
00213 TText *Wtext;
00214
00215 private:
00216
00217 void SetGwollumStyle(void);
00218 void SetFireStyle(void);
00219 void SetStandardStyle(void);
00220
00221
00222
00223 ClassDef(GwollumPlot,0)
00224 };
00225
00226 #endif
00227
00228