Garfield++ 3.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
ViewBase.hh
Go to the documentation of this file.
1#ifndef G_VIEW_BASE
2#define G_VIEW_BASE
3
4#include <TCanvas.h>
5
6namespace Garfield {
7
8/// Base class for visualization classes.
9
10class ViewBase {
11 public:
12 /// Default constructor.
13 ViewBase() = delete;
14 /// Constructor.
15 ViewBase(const std::string& name);
16 /// Destructor.
17 virtual ~ViewBase();
18
19 /// Set the canvas to be painted on.
20 void SetCanvas(TCanvas* c);
21 /// Retrieve the canvas.
22 TCanvas* GetCanvas() { return m_canvas; }
23
24 /// Switch on/off debugging output.
25 void EnableDebugging(const bool on = true) { m_debug = on; }
26
27 protected:
28 std::string m_className = "ViewBase";
29
30 // Options
31 bool m_debug = false;
32
33 // Canvas
34 TCanvas* m_canvas = nullptr;
35 bool m_hasExternalCanvas = false;
36
37 // Viewing plane
38 double m_proj[3][3];
39
40 // Find an unused function name.
41 std::string FindUnusedFunctionName(const std::string& s) const;
42 // Find an unused histogram name.
43 std::string FindUnusedHistogramName(const std::string& s) const;
44};
45}
46#endif
Base class for visualization classes.
Definition: ViewBase.hh:10
void EnableDebugging(const bool on=true)
Switch on/off debugging output.
Definition: ViewBase.hh:25
TCanvas * GetCanvas()
Retrieve the canvas.
Definition: ViewBase.hh:22
std::string m_className
Definition: ViewBase.hh:28
std::string FindUnusedFunctionName(const std::string &s) const
Definition: ViewBase.cc:30
double m_proj[3][3]
Definition: ViewBase.hh:38
void SetCanvas(TCanvas *c)
Set the canvas to be painted on.
Definition: ViewBase.cc:20
std::string FindUnusedHistogramName(const std::string &s) const
Definition: ViewBase.cc:40
virtual ~ViewBase()
Destructor.
Definition: ViewBase.cc:16
ViewBase()=delete
Default constructor.
bool m_hasExternalCanvas
Definition: ViewBase.hh:35
TCanvas * m_canvas
Definition: ViewBase.hh:34