Garfield 0.3
Toolkit for the detailed simulation of particle detectors based on ionization measurement in gases and semiconductors
Loading...
Searching...
No Matches
Garfield::ViewBase Class Reference

Base class for visualization classes. More...

#include <ViewBase.hh>

Inheritance diagram for Garfield::ViewBase:
Garfield::ViewCell Garfield::ViewDrift Garfield::ViewFEMesh Garfield::ViewField Garfield::ViewGeometry Garfield::ViewIsochrons Garfield::ViewMedium Garfield::ViewSignal

Public Member Functions

 ViewBase ()=delete
 Default constructor.
 ViewBase (const std::string &name)
 Constructor.
virtual ~ViewBase ()=default
 Destructor.
void SetCanvas (TPad *pad)
 Set the canvas to be painted on.
void SetCanvas ()
 Unset an external canvas.
TPad * GetCanvas ()
 Retrieve the canvas.
void SetArea (const double xmin, const double ymin, const double xmax, const double ymax)
 Set the x- and y-axis limits (in local coordinates of the current viewing plane, if applicable).
virtual void SetArea (const double xmin, const double ymin, const double zmin, const double xmax, const double ymax, const double zmax)
 Set a bounding box (if applicable).
void SetArea ()
 Use default x- and y-axis limits (based on the bounding box of the sensor/component, if applicable).
virtual void SetPlane (const double fx, const double fy, const double fz, const double x0, const double y0, const double z0)
 Set the projection (viewing plane), if applicable.
virtual void SetPlane (const double fx, const double fy, const double fz, const double x0, const double y0, const double z0, const double hx, const double hy, const double hz)
 Set the projection plane specifying a hint for the in-plane x axis.
void Rotate (const double angle)
 Rotate the viewing plane (angle in radian).
void SetPlaneXY ()
 Set the viewing plane to x-y.
void SetPlaneXZ ()
 Set the viewing plane to x-z.
void SetPlaneYZ ()
 Set the viewing plane to y-z.
void SetPlaneZX ()
 Set the viewing plane to z-x.
void SetPlaneZY ()
 Set the viewing plane to z-y.
void EnableDebugging (const bool on=true)
 Switch on/off debugging output.

Static Public Member Functions

static std::string FindUnusedFunctionName (const std::string &s)
 Find an unused function name.
static std::string FindUnusedHistogramName (const std::string &s)
 Find an unused histogram name.
static std::string FindUnusedCanvasName (const std::string &s)
 Find an unused canvas name.

Protected Member Functions

void UpdateProjectionMatrix ()
template<typename T>
void ToPlane (const T x, const T y, const T z, T &xp, T &yp) const
template<typename T>
bool InBox (const std::array< T, 3 > &x) const
void Clip (const std::array< float, 3 > &x0, const std::array< float, 3 > &x1, std::array< float, 3 > &xc) const
void DrawLine (const std::vector< std::array< float, 3 > > &xl, const short col, const short lw)
std::string LabelX ()
std::string LabelY ()
std::string PlaneDescription ()
bool PlotLimits (Sensor *sensor, double &xmin, double &ymin, double &xmax, double &ymax) const
bool PlotLimits (Component *cmp, double &xmin, double &ymin, double &xmax, double &ymax) const
bool PlotLimitsFromUserBox (double &xmin, double &ymin, double &xmax, double &ymax) const
bool PlotLimits (std::array< double, 3 > &bbmin, std::array< double, 3 > &bbmax, double &xmin, double &ymin, double &xmax, double &ymax) const

Static Protected Member Functions

static bool RangeSet (TVirtualPad *)
static void SetRange (TVirtualPad *pad, const double x0, const double y0, const double x1, const double y1)

Protected Attributes

std::string m_className = "ViewBase"
bool m_debug = false
bool m_userPlotLimits = false
double m_xMinPlot = -1.
double m_xMaxPlot = 1.
double m_yMinPlot = -1.
double m_yMaxPlot = 1.
bool m_userBox = false
double m_xMinBox = -1.
double m_xMaxBox = 1.
double m_yMinBox = -1.
double m_yMaxBox = 1.
double m_zMinBox = -1.
double m_zMaxBox = 1.
std::array< std::array< double, 3 >, 3 > m_proj
std::array< double, 4 > m_plane {{0, 0, 1, 0}}
std::array< std::array< double, 3 >, 3 > m_prmat

Private Attributes

TPad * m_pad = nullptr
std::unique_ptr< TCanvas > m_canvas

Detailed Description

Base class for visualization classes.

Definition at line 21 of file ViewBase.hh.

Constructor & Destructor Documentation

◆ ViewBase() [1/2]

Garfield::ViewBase::ViewBase ( )
delete

Default constructor.

◆ ViewBase() [2/2]

Garfield::ViewBase::ViewBase ( const std::string & name)

Constructor.

◆ ~ViewBase()

virtual Garfield::ViewBase::~ViewBase ( )
virtualdefault

Destructor.

Member Function Documentation

◆ Clip()

void Garfield::ViewBase::Clip ( const std::array< float, 3 > & x0,
const std::array< float, 3 > & x1,
std::array< float, 3 > & xc ) const
protected

◆ DrawLine()

void Garfield::ViewBase::DrawLine ( const std::vector< std::array< float, 3 > > & xl,
const short col,
const short lw )
protected

◆ EnableDebugging()

void Garfield::ViewBase::EnableDebugging ( const bool on = true)
inline

Switch on/off debugging output.

Definition at line 75 of file ViewBase.hh.

75{ m_debug = on; }

◆ FindUnusedCanvasName()

std::string Garfield::ViewBase::FindUnusedCanvasName ( const std::string & s)
static

Find an unused canvas name.

◆ FindUnusedFunctionName()

std::string Garfield::ViewBase::FindUnusedFunctionName ( const std::string & s)
static

Find an unused function name.

◆ FindUnusedHistogramName()

std::string Garfield::ViewBase::FindUnusedHistogramName ( const std::string & s)
static

Find an unused histogram name.

◆ GetCanvas()

TPad * Garfield::ViewBase::GetCanvas ( )

Retrieve the canvas.

◆ InBox()

template<typename T>
bool Garfield::ViewBase::InBox ( const std::array< T, 3 > & x) const
inlineprotected

Definition at line 120 of file ViewBase.hh.

120 {
121 if (!m_userBox) return true;
122 if (x[0] < m_xMinBox || x[0] > m_xMaxBox || x[1] < m_yMinBox ||
123 x[1] > m_yMaxBox || x[2] < m_yMinBox || x[2] > m_zMaxBox)
124 return false;
125 return true;
126 }

◆ LabelX()

std::string Garfield::ViewBase::LabelX ( )
protected

◆ LabelY()

std::string Garfield::ViewBase::LabelY ( )
protected

◆ PlaneDescription()

std::string Garfield::ViewBase::PlaneDescription ( )
protected

◆ PlotLimits() [1/3]

bool Garfield::ViewBase::PlotLimits ( Component * cmp,
double & xmin,
double & ymin,
double & xmax,
double & ymax ) const
protected

◆ PlotLimits() [2/3]

bool Garfield::ViewBase::PlotLimits ( Sensor * sensor,
double & xmin,
double & ymin,
double & xmax,
double & ymax ) const
protected

◆ PlotLimits() [3/3]

bool Garfield::ViewBase::PlotLimits ( std::array< double, 3 > & bbmin,
std::array< double, 3 > & bbmax,
double & xmin,
double & ymin,
double & xmax,
double & ymax ) const
protected

◆ PlotLimitsFromUserBox()

bool Garfield::ViewBase::PlotLimitsFromUserBox ( double & xmin,
double & ymin,
double & xmax,
double & ymax ) const
protected

◆ RangeSet()

bool Garfield::ViewBase::RangeSet ( TVirtualPad * )
staticprotected

◆ Rotate()

void Garfield::ViewBase::Rotate ( const double angle)

Rotate the viewing plane (angle in radian).

◆ SetArea() [1/3]

void Garfield::ViewBase::SetArea ( )
inline

Use default x- and y-axis limits (based on the bounding box of the sensor/component, if applicable).

Definition at line 46 of file ViewBase.hh.

46 {
47 m_userBox = false;
48 m_userPlotLimits = false;
49 }

◆ SetArea() [2/3]

void Garfield::ViewBase::SetArea ( const double xmin,
const double ymin,
const double xmax,
const double ymax )

Set the x- and y-axis limits (in local coordinates of the current viewing plane, if applicable).

◆ SetArea() [3/3]

virtual void Garfield::ViewBase::SetArea ( const double xmin,
const double ymin,
const double zmin,
const double xmax,
const double ymax,
const double zmax )
virtual

Set a bounding box (if applicable).

◆ SetCanvas() [1/2]

void Garfield::ViewBase::SetCanvas ( )
inline

Unset an external canvas.

Definition at line 33 of file ViewBase.hh.

33{ m_pad = nullptr; }

◆ SetCanvas() [2/2]

void Garfield::ViewBase::SetCanvas ( TPad * pad)
inline

Set the canvas to be painted on.

Definition at line 31 of file ViewBase.hh.

31{ m_pad = pad; }

◆ SetPlane() [1/2]

virtual void Garfield::ViewBase::SetPlane ( const double fx,
const double fy,
const double fz,
const double x0,
const double y0,
const double z0 )
virtual

Set the projection (viewing plane), if applicable.

Parameters
fx,fy,fznormal vector
x0,y0,z0in-plane point

Reimplemented in Garfield::ViewFEMesh.

◆ SetPlane() [2/2]

virtual void Garfield::ViewBase::SetPlane ( const double fx,
const double fy,
const double fz,
const double x0,
const double y0,
const double z0,
const double hx,
const double hy,
const double hz )
virtual

Set the projection plane specifying a hint for the in-plane x axis.

Reimplemented in Garfield::ViewFEMesh.

◆ SetPlaneXY()

void Garfield::ViewBase::SetPlaneXY ( )

Set the viewing plane to x-y.

◆ SetPlaneXZ()

void Garfield::ViewBase::SetPlaneXZ ( )

Set the viewing plane to x-z.

◆ SetPlaneYZ()

void Garfield::ViewBase::SetPlaneYZ ( )

Set the viewing plane to y-z.

◆ SetPlaneZX()

void Garfield::ViewBase::SetPlaneZX ( )

Set the viewing plane to z-x.

◆ SetPlaneZY()

void Garfield::ViewBase::SetPlaneZY ( )

Set the viewing plane to z-y.

◆ SetRange()

void Garfield::ViewBase::SetRange ( TVirtualPad * pad,
const double x0,
const double y0,
const double x1,
const double y1 )
staticprotected

◆ ToPlane()

template<typename T>
void Garfield::ViewBase::ToPlane ( const T x,
const T y,
const T z,
T & xp,
T & yp ) const
inlineprotected

Definition at line 114 of file ViewBase.hh.

114 {
115 xp = m_prmat[0][0] * x + m_prmat[0][1] * y + m_prmat[0][2] * z;
116 yp = m_prmat[1][0] * x + m_prmat[1][1] * y + m_prmat[1][2] * z;
117 }
std::array< std::array< double, 3 >, 3 > m_prmat
Definition ViewBase.hh:107

◆ UpdateProjectionMatrix()

void Garfield::ViewBase::UpdateProjectionMatrix ( )
protected

Member Data Documentation

◆ m_canvas

std::unique_ptr<TCanvas> Garfield::ViewBase::m_canvas
private

Definition at line 157 of file ViewBase.hh.

◆ m_className

std::string Garfield::ViewBase::m_className = "ViewBase"
protected

Definition at line 85 of file ViewBase.hh.

◆ m_debug

bool Garfield::ViewBase::m_debug = false
protected

Definition at line 88 of file ViewBase.hh.

◆ m_pad

TPad* Garfield::ViewBase::m_pad = nullptr
private

Definition at line 156 of file ViewBase.hh.

◆ m_plane

std::array<double, 4> Garfield::ViewBase::m_plane {{0, 0, 1, 0}}
protected

Definition at line 105 of file ViewBase.hh.

105{{0, 0, 1, 0}};

◆ m_prmat

std::array<std::array<double, 3>, 3> Garfield::ViewBase::m_prmat
protected
Initial value:
{
{{{1, 0, 0}}, {{0, 1, 0}}, {{0, 0, 1}}}}

Definition at line 107 of file ViewBase.hh.

107 {
108 {{{1, 0, 0}}, {{0, 1, 0}}, {{0, 0, 1}}}};

◆ m_proj

std::array<std::array<double, 3>, 3> Garfield::ViewBase::m_proj
protected
Initial value:
{
{{{1, 0, 0}}, {{0, 1, 0}}, {{0, 0, 0}}}}

Definition at line 103 of file ViewBase.hh.

103 {
104 {{{1, 0, 0}}, {{0, 1, 0}}, {{0, 0, 0}}}};

◆ m_userBox

bool Garfield::ViewBase::m_userBox = false
protected

Definition at line 96 of file ViewBase.hh.

◆ m_userPlotLimits

bool Garfield::ViewBase::m_userPlotLimits = false
protected

Definition at line 91 of file ViewBase.hh.

◆ m_xMaxBox

double Garfield::ViewBase::m_xMaxBox = 1.
protected

Definition at line 97 of file ViewBase.hh.

◆ m_xMaxPlot

double Garfield::ViewBase::m_xMaxPlot = 1.
protected

Definition at line 92 of file ViewBase.hh.

◆ m_xMinBox

double Garfield::ViewBase::m_xMinBox = -1.
protected

Definition at line 97 of file ViewBase.hh.

◆ m_xMinPlot

double Garfield::ViewBase::m_xMinPlot = -1.
protected

Definition at line 92 of file ViewBase.hh.

◆ m_yMaxBox

double Garfield::ViewBase::m_yMaxBox = 1.
protected

Definition at line 98 of file ViewBase.hh.

◆ m_yMaxPlot

double Garfield::ViewBase::m_yMaxPlot = 1.
protected

Definition at line 93 of file ViewBase.hh.

◆ m_yMinBox

double Garfield::ViewBase::m_yMinBox = -1.
protected

Definition at line 98 of file ViewBase.hh.

◆ m_yMinPlot

double Garfield::ViewBase::m_yMinPlot = -1.
protected

Definition at line 93 of file ViewBase.hh.

◆ m_zMaxBox

double Garfield::ViewBase::m_zMaxBox = 1.
protected

Definition at line 99 of file ViewBase.hh.

◆ m_zMinBox

double Garfield::ViewBase::m_zMinBox = -1.
protected

Definition at line 99 of file ViewBase.hh.


The documentation for this class was generated from the following file:
  • /builds/garfield/docs/source/Include/Garfield/ViewBase.hh