SatAndLight  2.2.2-hubble
Simulation toolkit for space telescopes
Loading...
Searching...
No Matches
SatPlot.h
Go to the documentation of this file.
1
2// Author : florent robinet (IJCLab - Orsay): florent.robinet@ijclab.in2p3.fr
4#ifndef __SatPlot__
5#define __SatPlot__
6
13#include "CUtils.h"
14#include <TStyle.h>
15#include <TLine.h>
16#include <TMultiGraph.h>
17#include <TGraph.h>
18#include <TGraph2D.h>
19#include <TFile.h>
20#include <TF1.h>
21#include <TH1.h>
22#include <TH2.h>
23#include <TH3.h>
24#include <TPad.h>
25#include <TCanvas.h>
26#include <TLegend.h>
27#include <TText.h>
28
29using namespace std;
30
34#define SPL_NPADMAX (10)
35
41class SatPlot{
42
43 public:
44
51
58 SatPlot(const string aName, const int aNx=800, const int aNy=494);
59
61
64 virtual ~SatPlot(void);
65
71
75 inline void UseCurrentStyle(const int aPadIndex=0){
76 Wpad[aPadIndex]->UseCurrentStyle();
77 Wpad[aPadIndex]->Modified();
78 Wpad[aPadIndex]->Update();
79 };
80
82
88 inline void Draw(TObject *aObj, const string aOptions="", const int aPadIndex=0){
89 Wpad[aPadIndex]->cd();
90 aObj->Draw(aOptions.c_str());
91 Wpad[aPadIndex]->UseCurrentStyle();
92 Wpad[aPadIndex]->Modified();
93 Wpad[aPadIndex]->Update();
94 };
95
97
102 void Print(const string aFileName, const double aScaleFactor=1.0);
103
105
115 inline void SetLogx(const int aValue, const int aPadIndex=0){
116 Wpad[aPadIndex]->SetLogx(aValue);
117 Wpad[aPadIndex]->Modified();
118 Wpad[aPadIndex]->Update();
119 };
120
122
132 inline void SetLogy(const int aValue, const int aPadIndex=0){
133 Wpad[aPadIndex]->SetLogy(aValue);
134 Wpad[aPadIndex]->Modified();
135 Wpad[aPadIndex]->Update();
136 };
137
139
149 inline void SetLogz(const int aValue, const int aPadIndex=0){
150 Wpad[aPadIndex]->SetLogz(aValue);
151 Wpad[aPadIndex]->Modified();
152 Wpad[aPadIndex]->Update();
153 };
154
156
161 inline void SetGridx(const int aValue=1, const int aPadIndex=0){
162 Wpad[aPadIndex]->SetGridx(aValue);
163 Wpad[aPadIndex]->Modified();
164 Wpad[aPadIndex]->Update();
165 };
166
168
173 inline void SetGridy(const int aValue=1, const int aPadIndex=0){
174 Wpad[aPadIndex]->SetGridy(aValue);
175 Wpad[aPadIndex]->Modified();
176 Wpad[aPadIndex]->Update();
177 };
178
180
188 int AddPad(const double aX0, const double aY0, const double aRx, const double aRy);
189
191
199 inline void ResizePad(const double aX0, const double aY0, const double aX1, const double aY1, const int aPadIndex=0){
200 Wpad[aPadIndex]->SetPad(aX0, aY0, aX1, aY1);
201 Wpad[aPadIndex]->Modified();
202 Wpad[aPadIndex]->Update();
203 };
204
206
210 inline void Clear(const int aPadIndex=0){ Wpad[aPadIndex]->Clear(); };
211
213
218 inline double GetPadXmax(const int aPadIndex=0){ return Wpad[aPadIndex]->GetUxmax(); };
219
221
226 inline double GetPadXmin(const int aPadIndex=0){ return Wpad[aPadIndex]->GetUxmin(); };
227
229
234 inline double GetPadYmax(const int aPadIndex=0){ return Wpad[aPadIndex]->GetUymax(); };
235
237
242 inline double GetPadYmin(const int aPadIndex=0){ return Wpad[aPadIndex]->GetUymin(); };
243
244 private:
245
246 int randid;
247 string srandid;
248
249 // STYLE
250 TStyle *Wstyle;
251
252 // CANVAS/PAD
253 TCanvas *Wcan;
254 int npads;
256
260 void SetStyle(void);
261
262 ClassDef(SatPlot,0)
263};
264
265#endif
266
267
This module offers C++ utility functions.
#define SPL_NPADMAX
Maximum number of working pads.
Definition SatPlot.h:34
Draw and print ROOT graphical objects.
Definition SatPlot.h:41
TStyle * Wstyle
working style.
Definition SatPlot.h:250
int npads
number of working pads.
Definition SatPlot.h:254
void Draw(TObject *aObj, const string aOptions="", const int aPadIndex=0)
Draws a ROOT object.
Definition SatPlot.h:88
void SetGridx(const int aValue=1, const int aPadIndex=0)
Sets/Unsets grid for X.
Definition SatPlot.h:161
TPad * Wpad[SPL_NPADMAX]
working pads.
Definition SatPlot.h:255
double GetPadXmin(const int aPadIndex=0)
Returns the minimum x-coordinate value visible on the pad.
Definition SatPlot.h:226
void SetStyle(void)
Sets the plotting style.
Definition SatPlot.cc:86
void UseCurrentStyle(const int aPadIndex=0)
Force a copy of current style for all objects in canvas.
Definition SatPlot.h:75
void Clear(const int aPadIndex=0)
Clears pad.
Definition SatPlot.h:210
virtual ~SatPlot(void)
Destructor of the SatPlot class.
Definition SatPlot.cc:42
void SetLogy(const int aValue, const int aPadIndex=0)
Sets Linear/Log scale for Y.
Definition SatPlot.h:132
void SetLogz(const int aValue, const int aPadIndex=0)
Sets Linear/Log scale for Z.
Definition SatPlot.h:149
int AddPad(const double aX0, const double aY0, const double aRx, const double aRy)
Adds a new pad (up to SPL_NPADMAX).
Definition SatPlot.cc:67
int randid
random integer id.
Definition SatPlot.h:246
void SetGridy(const int aValue=1, const int aPadIndex=0)
Sets/Unsets grid for Y.
Definition SatPlot.h:173
void ResizePad(const double aX0, const double aY0, const double aX1, const double aY1, const int aPadIndex=0)
Resizes a pad.
Definition SatPlot.h:199
string srandid
random string id.
Definition SatPlot.h:247
double GetPadXmax(const int aPadIndex=0)
Returns the maximum x-coordinate value visible on the pad.
Definition SatPlot.h:218
void Print(const string aFileName, const double aScaleFactor=1.0)
Prints current canvas in a file.
Definition SatPlot.cc:51
SatPlot(const string aName, const int aNx=800, const int aNy=494)
Constructor of the SatPlot class.
TCanvas * Wcan
working canvas.
Definition SatPlot.h:253
void SetLogx(const int aValue, const int aPadIndex=0)
Sets Linear/Log scale for the X axis.
Definition SatPlot.h:115
double GetPadYmin(const int aPadIndex=0)
Returns the minimum y-coordinate value visible on the pad.
Definition SatPlot.h:242
double GetPadYmax(const int aPadIndex=0)
Returns the maximum y-coordinate value visible on the pad.
Definition SatPlot.h:234