GWOLLUM 4.2.0
Tools for gravitational-wave analyses
Loading...
Searching...
No Matches
GwollumPlot.h
Go to the documentation of this file.
1
6#ifndef __GwollumPlot__
7#define __GwollumPlot__
8
9#include "Monitor.h"
10#include <TStyle.h>
11#include <TLine.h>
12#include <TMultiGraph.h>
13#include <TGraph.h>
14#include <TGraph2D.h>
15#include <TF1.h>
16#include <TH1.h>
17#include <TH2.h>
18#include <TPad.h>
19#include <TCanvas.h>
20#include <TLegend.h>
21#include <TText.h>
22
23using namespace std;
24
40
41 public:
42
61 GwollumPlot(const string aName, const string aStyleName="GWOLLUM");
62
66 virtual ~GwollumPlot(void);
67
81 void AddText(const string aText,
82 const double aX, const double aY, const double aSize,
83 const int aPadIndex=0);
84
90 void UpdateText(const string aText);
91
98 void AddLegendEntry(const TObject *aObj, const string aLabel, const string aStyle="LPF");
99
104 void AddLegendHeader(const string aLabel);
105
109 void DrawLegend(void);
110
114 void UnDrawLegend(void);
115
119 inline void ResetLegend(void){
120 Wleg->Clear();
121 Wpad->SetPad(0,0,1,1);
122 Wpad->Modified(1);
123 Wpad->Update();
124 };
125
132 inline void Draw(TObject *aObj, const string aOptions="", const int aPadIndex=0){
133 Wpad->cd(aPadIndex);
134 aObj->Draw(aOptions.c_str());
135 gPad->Modified();
136 gPad->Update();
137 };
138
144 inline void UnDraw(TObject *aObj, const int aPadIndex=0){
145 Wpad->cd(aPadIndex);
146 gPad->GetListOfPrimitives()->Remove(aObj);
147 gPad->Modified();
148 gPad->Update();
149 };
150
155 inline void Clear(const int aPadIndex=0){
156 Wpad->cd(aPadIndex);
157 gPad->Clear();
158 gPad->Modified();
159 gPad->Update();
160 };
161
166 inline void Print(const string aFileName){
167 Wcan->cd();
168 Wcan->Print(aFileName.c_str());
169 };
170
179 void Print(const string aFileName, const double aScaleFactor);
180
188 void Print(const string aFileName,
189 const unsigned int aNewWidth, const unsigned int aNewHeight);
190
200 inline void SetLogx(const int aValue, const int aPadIndex=0){
201 Wpad->cd(aPadIndex);
202 gPad->SetLogx(aValue);
203 gPad->Modified();
204 gPad->Update();
205 };
206
216 inline void SetLogy(const int aValue, const int aPadIndex=0){
217 Wpad->cd(aPadIndex);
218 gPad->SetLogy(aValue);
219 gPad->Modified();
220 gPad->Update();
221 };
222
232 inline void SetLogz(const int aValue, const int aPadIndex=0){
233 Wpad->cd(aPadIndex);
234 gPad->SetLogz(aValue);
235 gPad->Modified();
236 gPad->Update();
237 };
238
244 inline void SetGridx(const int aValue=1, const int aPadIndex=0){
245 Wpad->cd(aPadIndex);
246 gPad->SetGridx(aValue);
247 gPad->Modified();
248 gPad->Update();
249 };
250
256 inline void SetGridy(const int aValue=1, const int aPadIndex=0){
257 Wpad->cd(aPadIndex);
258 gPad->SetGridy(aValue);
259 gPad->Modified();
260 gPad->Update();
261 };
262
268 inline void RedrawAxis(Option_t* option="", int aPadIndex=0){
269 Wpad->cd(aPadIndex);
270 gPad->RedrawAxis(option);
271 gPad->Modified();
272 gPad->Update();
273 };
274
283 inline void ResizePlot(const unsigned int aWidth, const unsigned int aHeight){
284 Wcan->SetWindowSize(aWidth + (aWidth- Wcan->GetWw()), aHeight + (aHeight - Wcan->GetWh()));
285 Wcan->SetCanvasSize(aWidth,aHeight);
286 Wcan->Modified(); Wcan->Update();
287 };
288
292 inline int GetWidth(void){ return Wcan->GetWw(); };
293
297 inline int GetHeight(void){ return Wcan->GetWh(); };
298
303 inline void DivideCanvas(const unsigned int aNpads){ Wpad->DivideSquare((int)aNpads); };
304
310 inline void DivideCanvas(const unsigned int aNx, const unsigned int aNy){ Wpad->Divide((int)aNx, (int)aNy); };
311
315 inline string GetCurrentStyle(void){ return stylename; };
316
320 inline unsigned int GetColorPalette(const unsigned int i){ return (unsigned int)gStyle->GetColorPalette((int)i); };
321
325 inline unsigned int GetNumberOfColors(void){ return (unsigned int)gStyle->GetNumberOfColors(); };
326
327 protected:
328
329 int randid;
330 string srandid;
331 string name;
332
333 // STYLE
334 string stylename;
335
336 // CANVAS/PAD
337 TCanvas *Wcan;
338 TPad *Wpad;
339
340 // ELEMENTS
341 TLegend *Wleg;
342 TText *Wtext;
343
344 private:
345
347
351 void SetGwollumStyle(void);
352
356 void SetPinkStyle(void);
357
361 void SetFireStyle(void);
362
366 void SetStandardStyle(void);
367
371 void SetOxStyle(void);
372
373 ClassDef(GwollumPlot,0)
374};
375
376#endif
377
378
Process monitoring.
Interface to draw and print ROOT objects.
Definition GwollumPlot.h:39
TPad * Wpad
Working pad.
Definition GwollumPlot.h:338
void SetLogz(const int aValue, const int aPadIndex=0)
Set Lin/Log scale for Z.
Definition GwollumPlot.h:232
Monitor * mon
Class monitor.
Definition GwollumPlot.h:346
string name
Name.
Definition GwollumPlot.h:331
int randid
Random integer id.
Definition GwollumPlot.h:329
void SetStandardStyle(void)
Sets STANDARD style.
Definition GwollumPlot.cc:285
void ResizePlot(const unsigned int aWidth, const unsigned int aHeight)
Resizes the global canvas to new dimensions.
Definition GwollumPlot.h:283
TLegend * Wleg
Plot legends.
Definition GwollumPlot.h:341
void Draw(TObject *aObj, const string aOptions="", const int aPadIndex=0)
Draws ROOT object.
Definition GwollumPlot.h:132
void SetLogy(const int aValue, const int aPadIndex=0)
Set Lin/Log scale for Y.
Definition GwollumPlot.h:216
void SetGridx(const int aValue=1, const int aPadIndex=0)
Set/Unset grid for X.
Definition GwollumPlot.h:244
void DrawLegend(void)
Draws current legend box.
Definition GwollumPlot.cc:107
TText * Wtext
Additional text.
Definition GwollumPlot.h:342
int GetWidth(void)
Returns the canvas width.
Definition GwollumPlot.h:292
void DivideCanvas(const unsigned int aNx, const unsigned int aNy)
Divides current canvas into sub-pads.
Definition GwollumPlot.h:310
unsigned int GetNumberOfColors(void)
Returns the number of colors in current palette.
Definition GwollumPlot.h:325
void SetGridy(const int aValue=1, const int aPadIndex=0)
Set/Unset grid for Y.
Definition GwollumPlot.h:256
int GetHeight(void)
Returns the canvas height.
Definition GwollumPlot.h:297
void AddLegendHeader(const string aLabel)
Adds a legend header.
Definition GwollumPlot.cc:98
void SetFireStyle(void)
Sets FIRE style.
Definition GwollumPlot.cc:241
void RedrawAxis(Option_t *option="", int aPadIndex=0)
Redraw the frame axis.
Definition GwollumPlot.h:268
void UnDraw(TObject *aObj, const int aPadIndex=0)
UnDraws a ROOT object.
Definition GwollumPlot.h:144
void Clear(const int aPadIndex=0)
Clear pad.
Definition GwollumPlot.h:155
virtual ~GwollumPlot(void)
Destructor of the GwollumPlot class.
Definition GwollumPlot.cc:56
void SetOxStyle(void)
Sets OX style.
Definition GwollumPlot.cc:328
GwollumPlot(const string aName, const string aStyleName="GWOLLUM")
Constructor of the GwollumPlot class.
void SetPinkStyle(void)
Sets PINK style.
Definition GwollumPlot.cc:197
void AddLegendEntry(const TObject *aObj, const string aLabel, const string aStyle="LPF")
Adds a legend entry.
Definition GwollumPlot.cc:89
string stylename
Style name.
Definition GwollumPlot.h:334
string GetCurrentStyle(void)
Returns current style name.
Definition GwollumPlot.h:315
void ResetLegend(void)
Resets and removes current legend box.
Definition GwollumPlot.h:119
void UnDrawLegend(void)
Removes the legend box from the pad.
Definition GwollumPlot.cc:117
void AddText(const string aText, const double aX, const double aY, const double aSize, const int aPadIndex=0)
Adds text in the plot.
Definition GwollumPlot.cc:66
TCanvas * Wcan
Working canvas.
Definition GwollumPlot.h:337
void DivideCanvas(const unsigned int aNpads)
Divides current canvas into sub-pads.
Definition GwollumPlot.h:303
string srandid
Random string id.
Definition GwollumPlot.h:330
void UpdateText(const string aText)
Updates text in the plot.
Definition GwollumPlot.cc:80
unsigned int GetColorPalette(const unsigned int i)
Returns color number i in current palette.
Definition GwollumPlot.h:320
void SetLogx(const int aValue, const int aPadIndex=0)
Set Lin/Log scale for X.
Definition GwollumPlot.h:200
void Print(const string aFileName)
Prints current canvas in a file.
Definition GwollumPlot.h:166
void SetGwollumStyle(void)
Sets GWOLLUM style.
Definition GwollumPlot.cc:153
Monitor a GWOLLUM processing.
Definition Monitor.h:39