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

Plot the signal computed by a sensor as a ROOT histogram. More...

#include <ViewSignal.hh>

Inheritance diagram for Garfield::ViewSignal:
Garfield::ViewBase

Public Member Functions

 ViewSignal ()
 Default constructor.
 ViewSignal (Sensor *sensor)
 Constructor.
 ~ViewSignal ()=default
 Destructor.
void SetSensor (Sensor *s)
 Set the sensor from which to retrieve the signal.
void PlotSignal (const std::string &label, const std::string &optTotal="t", const std::string &optPrompt="", const std::string &optDelayed="", const bool same=false)
 Plot the signal.
void SetRangeX (const double xmin, const double xmax)
 Set the x-axis limits explicitly.
void UnsetRangeX ()
 Remove the user-defined x-axis limits.
void SetRangeY (const double ymin, const double ymax)
 Set the y-axis limits explicitly.
void UnsetRangeY ()
 Remove the user-defined y-axis limits.
void SetLabelY (const std::string &label)
 Override the default y-axis label.
void EnableLegend (const bool on=true)
 Draw a legend on the plot or not.
void SetColourTotal (const short col)
 Set the (ROOT) colour with which to draw the total signal.
void SetColourElectrons (const short col)
 Set the (ROOT) colour with which to draw the electron component.
void SetColourIons (const short col)
 Set the (ROOT) colour with which to draw the hole/ion component.
void SetColourHoles (const short col)
 Set the (ROOT) colour with which to draw the hole/ion component.
void SetColourDelayed (const short colTotal, const short colElectrons=kYellow - 7, const short colIons=kRed - 9)
 Set the (ROOT) colours with which to draw the delayed signal(s).
Public Member Functions inherited from Garfield::ViewBase
 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.

Private Member Functions

TH1 * DrawHistogram (TH1D &h, const std::string &opt, const std::string &ylabel)

Private Attributes

Sensor * m_sensor = nullptr
double m_xmin = 0.
double m_xmax = 0.
bool m_userRangeX = false
double m_ymin = 0.
double m_ymax = 0.
bool m_userRangeY = false
std::string m_labelY = ""
bool m_legend = false
short m_colTotal = kBlue + 3
short m_colElectrons = kOrange - 3
short m_colIons = kRed + 1
std::array< short, 6 > m_colDelayed
std::array< short, 3 > m_colPrompt {{kAzure + 10, kRed - 4, kMagenta + 2}}

Additional Inherited Members

Static Public Member Functions inherited from Garfield::ViewBase
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 inherited from Garfield::ViewBase
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 inherited from Garfield::ViewBase
static bool RangeSet (TVirtualPad *)
static void SetRange (TVirtualPad *pad, const double x0, const double y0, const double x1, const double y1)
Protected Attributes inherited from Garfield::ViewBase
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

Detailed Description

Plot the signal computed by a sensor as a ROOT histogram.

Definition at line 20 of file ViewSignal.hh.

Constructor & Destructor Documentation

◆ ViewSignal() [1/2]

Garfield::ViewSignal::ViewSignal ( )
inline

Default constructor.

Definition at line 23 of file ViewSignal.hh.

23: ViewSignal(nullptr) {}
ViewSignal()
Default constructor.
Definition ViewSignal.hh:23

◆ ViewSignal() [2/2]

Garfield::ViewSignal::ViewSignal ( Sensor * sensor)

Constructor.

◆ ~ViewSignal()

Garfield::ViewSignal::~ViewSignal ( )
default

Destructor.

Member Function Documentation

◆ DrawHistogram()

TH1 * Garfield::ViewSignal::DrawHistogram ( TH1D & h,
const std::string & opt,
const std::string & ylabel )
private

◆ EnableLegend()

void Garfield::ViewSignal::EnableLegend ( const bool on = true)
inline

Draw a legend on the plot or not.

Definition at line 67 of file ViewSignal.hh.

67{ m_legend = on; }

◆ PlotSignal()

void Garfield::ViewSignal::PlotSignal ( const std::string & label,
const std::string & optTotal = "t",
const std::string & optPrompt = "",
const std::string & optDelayed = "",
const bool same = false )

Plot the signal.

Parameters
labelIdentifier (weighting field) of the signal to be plotted.
optTotalString containing information about the total signals you want to plot. The syntax is the first letter of the charge carrier signal component you want to plot: "t" for total, "e" for electron and "i" for ion/hole. "tei" enables all three components. The total signal is always plotted.
optPromptString containing information about the prompt signal components you want to plot. The syntax is identical to the one described above.
optDelayedString containing information about the delayed signal components you want to plot. The syntax is identical to the one described above.
sameFlag to keep existing plots on the canvas or not.

◆ SetColourDelayed()

void Garfield::ViewSignal::SetColourDelayed ( const short colTotal,
const short colElectrons = kYellow - 7,
const short colIons = kRed - 9 )
inline

Set the (ROOT) colours with which to draw the delayed signal(s).

Definition at line 79 of file ViewSignal.hh.

81 {
82 m_colDelayed = {colTotal, colElectrons, colIons};
83 }
std::array< short, 6 > m_colDelayed

◆ SetColourElectrons()

void Garfield::ViewSignal::SetColourElectrons ( const short col)
inline

Set the (ROOT) colour with which to draw the electron component.

Definition at line 72 of file ViewSignal.hh.

72{ m_colElectrons = col; }

◆ SetColourHoles()

void Garfield::ViewSignal::SetColourHoles ( const short col)
inline

Set the (ROOT) colour with which to draw the hole/ion component.

Definition at line 76 of file ViewSignal.hh.

76{ m_colIons = col; }

◆ SetColourIons()

void Garfield::ViewSignal::SetColourIons ( const short col)
inline

Set the (ROOT) colour with which to draw the hole/ion component.

Definition at line 74 of file ViewSignal.hh.

74{ m_colIons = col; }

◆ SetColourTotal()

void Garfield::ViewSignal::SetColourTotal ( const short col)
inline

Set the (ROOT) colour with which to draw the total signal.

Definition at line 70 of file ViewSignal.hh.

70{ m_colTotal = col; }

◆ SetLabelY()

void Garfield::ViewSignal::SetLabelY ( const std::string & label)
inline

Override the default y-axis label.

Definition at line 64 of file ViewSignal.hh.

64{ m_labelY = label; }
std::string m_labelY
Definition ViewSignal.hh:98

◆ SetRangeX()

void Garfield::ViewSignal::SetRangeX ( const double xmin,
const double xmax )

Set the x-axis limits explicitly.

◆ SetRangeY()

void Garfield::ViewSignal::SetRangeY ( const double ymin,
const double ymax )

Set the y-axis limits explicitly.

◆ SetSensor()

void Garfield::ViewSignal::SetSensor ( Sensor * s)

Set the sensor from which to retrieve the signal.

◆ UnsetRangeX()

void Garfield::ViewSignal::UnsetRangeX ( )
inline

Remove the user-defined x-axis limits.

Definition at line 56 of file ViewSignal.hh.

56{ m_userRangeX = false; }

◆ UnsetRangeY()

void Garfield::ViewSignal::UnsetRangeY ( )
inline

Remove the user-defined y-axis limits.

Definition at line 61 of file ViewSignal.hh.

61{ m_userRangeY = false; }

Member Data Documentation

◆ m_colDelayed

std::array<short, 6> Garfield::ViewSignal::m_colDelayed
private
Initial value:
{
{kCyan + 2, kYellow - 7, kRed - 9, kGreen + 1, kYellow - 4, kRed - 9}}

Definition at line 106 of file ViewSignal.hh.

106 {
107 {kCyan + 2, kYellow - 7, kRed - 9, kGreen + 1, kYellow - 4, kRed - 9}};

◆ m_colElectrons

short Garfield::ViewSignal::m_colElectrons = kOrange - 3
private

Definition at line 104 of file ViewSignal.hh.

◆ m_colIons

short Garfield::ViewSignal::m_colIons = kRed + 1
private

Definition at line 105 of file ViewSignal.hh.

◆ m_colPrompt

std::array<short, 3> Garfield::ViewSignal::m_colPrompt {{kAzure + 10, kRed - 4, kMagenta + 2}}
private

Definition at line 109 of file ViewSignal.hh.

109{{kAzure + 10, kRed - 4, kMagenta + 2}};

◆ m_colTotal

short Garfield::ViewSignal::m_colTotal = kBlue + 3
private

Definition at line 103 of file ViewSignal.hh.

◆ m_labelY

std::string Garfield::ViewSignal::m_labelY = ""
private

Definition at line 98 of file ViewSignal.hh.

◆ m_legend

bool Garfield::ViewSignal::m_legend = false
private

Definition at line 100 of file ViewSignal.hh.

◆ m_sensor

Sensor* Garfield::ViewSignal::m_sensor = nullptr
private

Definition at line 87 of file ViewSignal.hh.

◆ m_userRangeX

bool Garfield::ViewSignal::m_userRangeX = false
private

Definition at line 92 of file ViewSignal.hh.

◆ m_userRangeY

bool Garfield::ViewSignal::m_userRangeY = false
private

Definition at line 95 of file ViewSignal.hh.

◆ m_xmax

double Garfield::ViewSignal::m_xmax = 0.
private

Definition at line 91 of file ViewSignal.hh.

◆ m_xmin

double Garfield::ViewSignal::m_xmin = 0.
private

Definition at line 90 of file ViewSignal.hh.

◆ m_ymax

double Garfield::ViewSignal::m_ymax = 0.
private

Definition at line 94 of file ViewSignal.hh.

◆ m_ymin

double Garfield::ViewSignal::m_ymin = 0.
private

Definition at line 93 of file ViewSignal.hh.


The documentation for this class was generated from the following file: