Diana Software
QGPlot.hh
Go to the documentation of this file.
1 #ifndef _QG_PLOT_HH_
2 #define _QG_PLOT_HH_
3 
11 #include <list>
12 #include <string>
13 #include <vector>
14 #include "Rtypes.h"
15 
16 class QChain;
17 class QGCanvasWindow;
18 class QGPlotEditWindow;
19 class TCanvas;
20 
21 class QGPlot {
22 public:
24  QGPlot();
25 
27  QGPlot(const QGPlot&);
28 
30  virtual ~QGPlot();
31 
33  virtual void AddCut(const std::string& cut);
34 
36  virtual void AutoSetStyle();
37 
39  virtual void Display();
40 
42  virtual void DisplayEditWindow();
43 
45  virtual void Duplicate();
46 
48  virtual void Erase();
49 
51  virtual void Generate(QChain *chain = 0);
52 
54  virtual std::string GeneratePlotName(const std::string& baseName) const;
55 
57  virtual TCanvas *GetCanvas();
58 
60  virtual QGCanvasWindow *GetCanvasWindow() const {return fCanvasWindow;}
61 
63  virtual void GetCanvasWindowFromEditWindow();
64 
66  virtual const std::vector<std::string>& GetCuts() const {return fCuts;}
67 
69  virtual void GetCutsFromEditWindow();
70 
73 
75  virtual const char *GetName() const;
76 
78  virtual void GetParametersFromEditWindow();
79 
81  static QGPlot *GetPlotByName(const std::string& name);
82 
84  static const std::list<QGPlot*>& GetPlots() {return fPlots;}
85 
87  virtual const std::string& GetXUnits() const {return fXUnits;}
88 
90  virtual const std::string& GetXVariable() const {return fXVariable;}
91 
93  virtual const std::string& GetYUnits() const {return fYUnits;}
94 
96  virtual const std::string& GetYVariable() const {return fYVariable;}
97 
99  virtual bool IsNameInUse(const std::string& name) const;
100 
102  virtual bool IsSuperimposeSet() const {return fSuperimpose;}
103 
105  virtual void MakeCutsString();
106 
108  virtual bool NeedsRegeneration() const {return fNeedsRegeneration;}
109 
111  virtual void Plot();
112 
114  virtual void SetCanvasWindow(QGCanvasWindow *window);
115 
117  virtual void SetCuts(const std::vector<std::string>& cuts);
118 
120  virtual void SetName(const char *name = 0);
121 
123  virtual void SetPlotEditWindow(QGPlotEditWindow *window) {fPlotEditWindow = window;}
124 
126  virtual void SetProperty(const std::string& key, const std::string& value);
127 
129  virtual void SetRegenerate(bool flag = true) {fNeedsRegeneration = flag;}
130 
132  virtual void SetSuperimpose(bool flag = false) {fSuperimpose = flag;}
133 
135  virtual void SetXVariable(const std::string& x);
136 
138  virtual void SetXUnits(const std::string& units) {fXUnits = units;}
139 
141  virtual void SetYVariable(const std::string& y);
142 
144  virtual void SetYUnits(const std::string& units) {fYUnits = units;}
145 
147  static void ShowPlotsList();
148 
149 protected:
152 
154  std::vector<std::string> fCuts;
155 
157  std::string fCutsString;
158 
161 
164 
166  static std::list<QGPlot*> fPlots;
167 
170 
172  std::string fXVariable;
173 
175  std::string fXUnits;
176 
178  std::string fYVariable;
179 
181  std::string fYUnits;
182 
183  ClassDef(QGPlot, 0)
184 };
185 
186 #endif
TChain used in diana.
Definition: QChain.hh:23
Window containing a ROOT canvas.
Base class for plot edit windows.
Base class for GUI plots including histograms, scatter plots, pulses, and graphical cuts.
Definition: QGPlot.hh:21
bool fNeedsRegeneration
Indicates whether plot needs to be regenerated because settings have changed.
Definition: QGPlot.hh:160
virtual void SetCuts(const std::vector< std::string > &cuts)
Set cuts to apply in generating the plot.
Definition: QGPlot.cc:231
std::string fXUnits
X-axis units.
Definition: QGPlot.hh:175
virtual void SetSuperimpose(bool flag=false)
Set whether the plot should be superimposed.
Definition: QGPlot.hh:132
virtual std::string GeneratePlotName(const std::string &baseName) const
Generate a name for the plot.
Definition: QGPlot.cc:98
virtual const std::string & GetYUnits() const
Get y-axis units.
Definition: QGPlot.hh:93
virtual bool IsNameInUse(const std::string &name) const
Check whether string is the name of any plot.
Definition: QGPlot.cc:168
std::string fXVariable
X-axis variable.
Definition: QGPlot.hh:172
virtual void GetCutsFromEditWindow()
Get cuts from edit window.
Definition: QGPlot.cc:137
std::string fYUnits
Y-axis units.
Definition: QGPlot.hh:181
virtual ~QGPlot()
Destructor.
Definition: QGPlot.cc:46
QGPlot()
Default constructor.
Definition: QGPlot.cc:28
virtual const char * GetName() const
Get plot name, should be overridden by derived classes.
Definition: QGPlot.cc:144
virtual void Duplicate()
Duplicate the plot, should be overridden by derived classes.
Definition: QGPlot.cc:82
static const std::list< QGPlot * > & GetPlots()
Get collection of plots.
Definition: QGPlot.hh:84
virtual void GetCanvasWindowFromEditWindow()
Get canvas window from edit window.
Definition: QGPlot.cc:116
static void ShowPlotsList()
Show plots list.
Definition: QGPlot.cc:286
virtual TCanvas * GetCanvas()
Get pointer to the associated canvas.
Definition: QGPlot.cc:111
virtual void Generate(QChain *chain=0)
Generate plot from chain of data files, should be overridden by derived classes.
Definition: QGPlot.cc:93
virtual void Plot()
Plot this in the associated canvas window, generating it if necessary.
Definition: QGPlot.cc:195
static std::list< QGPlot * > fPlots
Collection of pointers to all QGPlots.
Definition: QGPlot.hh:166
QGPlotEditWindow * fPlotEditWindow
Pointer to plot edit window.
Definition: QGPlot.hh:163
static QGPlot * GetPlotByName(const std::string &name)
Get plot by name.
Definition: QGPlot.cc:155
virtual void SetRegenerate(bool flag=true)
Set whether the plot needs to be regenerated.
Definition: QGPlot.hh:129
virtual void SetCanvasWindow(QGCanvasWindow *window)
Set the canvas window to which the plot is associated.
Definition: QGPlot.cc:216
virtual QGCanvasWindow * GetCanvasWindow() const
Get pointer to the canvas window to which the plot is associated.
Definition: QGPlot.hh:60
virtual bool NeedsRegeneration() const
Check whether plot needs to be regenerated.
Definition: QGPlot.hh:108
virtual bool IsSuperimposeSet() const
Return true if plot is set to be superimposed.
Definition: QGPlot.hh:102
virtual const std::string & GetXUnits() const
Get x-axis units.
Definition: QGPlot.hh:87
std::vector< std::string > fCuts
Cuts applied to make the plot.
Definition: QGPlot.hh:154
virtual void SetProperty(const std::string &key, const std::string &value)
Set property (used for opening a session)
Definition: QGPlot.cc:245
virtual void AutoSetStyle()
Automatically set the plot style, should be overridden by derived classes.
Definition: QGPlot.cc:67
virtual const std::vector< std::string > & GetCuts() const
Get cuts applied to make the plot.
Definition: QGPlot.hh:66
virtual void AddCut(const std::string &cut)
Add cut.
Definition: QGPlot.cc:60
virtual void SetName(const char *name=0)
Set plot name.
Definition: QGPlot.cc:240
virtual QGPlotEditWindow * GetEditWindow()
Get pointer to edit window.
Definition: QGPlot.hh:72
std::string fCutsString
Cuts in a single string.
Definition: QGPlot.hh:157
virtual void SetXVariable(const std::string &x)
Set X-axis variable.
Definition: QGPlot.cc:270
virtual void DisplayEditWindow()
Display edit window for the plot, should be overridden by derived classes.
Definition: QGPlot.cc:77
virtual void SetYVariable(const std::string &y)
Set Y-axis variable.
Definition: QGPlot.cc:278
virtual void GetParametersFromEditWindow()
Get parameters from edit window, should be overridden by derived classes.
Definition: QGPlot.cc:150
std::string fYVariable
Y-axis variable.
Definition: QGPlot.hh:178
virtual void Erase()
Erase plot, should be overridden by derived classes.
Definition: QGPlot.cc:88
virtual void MakeCutsString()
Make cuts string.
Definition: QGPlot.cc:181
virtual const std::string & GetXVariable() const
Get x-axis variable.
Definition: QGPlot.hh:90
virtual const std::string & GetYVariable() const
Get y-axis variable.
Definition: QGPlot.hh:96
bool fSuperimpose
Indicates whether plot should be superimposed on existing plot.
Definition: QGPlot.hh:169
QGCanvasWindow * fCanvasWindow
Canvas window to which plot is associated.
Definition: QGPlot.hh:151
virtual void SetXUnits(const std::string &units)
Set X-axis units.
Definition: QGPlot.hh:138
virtual void SetYUnits(const std::string &units)
Set Y-axis units.
Definition: QGPlot.hh:144
virtual void Display()
Display plot, should be overridden by derived classes.
Definition: QGPlot.cc:72
virtual void SetPlotEditWindow(QGPlotEditWindow *window)
Set plot edit window.
Definition: QGPlot.hh:123