Garfield++ 4.0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
Garfield::ViewField Class Reference

Visualize the potential or electric field of a component or sensor. More...

#include <ViewField.hh>

+ Inheritance diagram for Garfield::ViewField:

Public Member Functions

 ViewField ()
 Constructor.
 
 ~ViewField ()=default
 Destructor.
 
void SetSensor (Sensor *s)
 Set the sensor for which to plot the field.
 
void SetComponent (Component *c)
 Set the component for which to plot the field.
 
void SetVoltageRange (const double vmin, const double vmax)
 Set the plot limits for the potential.
 
void SetElectricFieldRange (const double emin, const double emax)
 Set the plot limits for the electric field.
 
void SetWeightingFieldRange (const double wmin, const double wmax)
 Set the plot limits for the weighting field.
 
void SetNumberOfContours (const unsigned int n)
 Set the number of contour levels.
 
void SetNumberOfSamples1d (const unsigned int n)
 Set the number of points used for drawing 1D functions.
 
void SetNumberOfSamples2d (const unsigned int nx, const unsigned int ny)
 Set the number of points used for drawing 2D functions.
 
void PlotContour (const std::string &option="v")
 
void Plot (const std::string &option="v", const std::string &drawopt="arr")
 
void PlotProfile (const double x0, const double y0, const double z0, const double x1, const double y1, const double z1, const std::string &option="v", const bool normalised=true)
 
void PlotContourWeightingField (const std::string &label, const std::string &option)
 
void PlotWeightingField (const std::string &label, const std::string &option, const std::string &drawopt)
 
void PlotProfileWeightingField (const std::string &label, const double x0, const double y0, const double z0, const double x1, const double y1, const double z1, const std::string &option="v", const bool normalised=true)
 
void EnableAutoRange (const bool on=true, const bool samplePotential=true)
 
void AcknowledgeStatus (const bool on, const double v0=0.)
 
void PlotFieldLines (const std::vector< double > &x0, const std::vector< double > &y0, const std::vector< double > &z0, const bool electron=true, const bool axis=true, const short col=kOrange - 3)
 Draw electric field lines from a set of starting points.
 
bool EqualFluxIntervals (const double x0, const double y0, const double z0, const double x1, const double y1, const double z1, std::vector< double > &xf, std::vector< double > &yf, std::vector< double > &zf, const unsigned int nPoints=20) const
 Generates point along a line, spaced by equal flux intervals.
 
bool FixedFluxIntervals (const double x0, const double y0, const double z0, const double x1, const double y1, const double z1, std::vector< double > &xf, std::vector< double > &yf, std::vector< double > &zf, const double interval=10.) const
 Generate points along a line, spaced by a given flux interval.
 
- 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)
 
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 ()
 
virtual void SetPlane (const double fx, const double fy, const double fz, const double x0, const double y0, const double z0)
 
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 EnableDebugging (const bool on=true)
 Switch on/off debugging output.
 

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
 
bool RangeSet (TPad *)
 
void SetRange (TPad *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

Visualize the potential or electric field of a component or sensor.

Definition at line 15 of file ViewField.hh.

Constructor & Destructor Documentation

◆ ViewField()

Garfield::ViewField::ViewField ( )

Constructor.

Definition at line 70 of file ViewField.cc.

70: ViewBase("ViewField") { }
ViewBase()=delete
Default constructor.

◆ ~ViewField()

Garfield::ViewField::~ViewField ( )
default

Destructor.

Member Function Documentation

◆ AcknowledgeStatus()

void Garfield::ViewField::AcknowledgeStatus ( const bool  on,
const double  v0 = 0. 
)
inline

Make use (or not) of the status flag returned by the sensor/component.

Parameters
onTake status flag into account (true) or ignore it (false).
v0Value to be used for regions with status != 0.

Definition at line 106 of file ViewField.hh.

106 {
107 m_useStatus = on;
108 m_vBkg = v0;
109 }

◆ EnableAutoRange()

void Garfield::ViewField::EnableAutoRange ( const bool  on = true,
const bool  samplePotential = true 
)
inline

Determine the range of the potential/field automatically (true) or set it explicitly (false).

Definition at line 96 of file ViewField.hh.

97 {
98 m_useAutoRange = on;
99 m_samplePotential = samplePotential;
100 }

◆ EqualFluxIntervals()

bool Garfield::ViewField::EqualFluxIntervals ( const double  x0,
const double  y0,
const double  z0,
const double  x1,
const double  y1,
const double  z1,
std::vector< double > &  xf,
std::vector< double > &  yf,
std::vector< double > &  zf,
const unsigned int  nPoints = 20 
) const

Generates point along a line, spaced by equal flux intervals.

Definition at line 642 of file ViewField.cc.

647 {
648
649 if (nPoints < 2) {
650 std::cerr << m_className << "::EqualFluxIntervals:\n"
651 << " Number of flux lines must be > 1.\n";
652 return false;
653 }
654
655 // Set integration intervals.
656 constexpr unsigned int nV = 5;
657 // Compute the inplane vector normal to the track.
658 const double xp = (y1 - y0) * m_plane[2] - (z1 - z0) * m_plane[1];
659 const double yp = (z1 - z0) * m_plane[0] - (x1 - x0) * m_plane[2];
660 const double zp = (x1 - x0) * m_plane[1] - (y1 - y0) * m_plane[0];
661 // Compute the total flux, accepting positive and negative parts.
662 double q = 0.;
663 if (m_component) {
664 q = m_component->IntegrateFluxLine(x0, y0, z0, x1, y1, z1,
665 xp, yp, zp, 20 * nV, 0);
666 } else {
667 q = m_sensor->IntegrateFluxLine(x0, y0, z0, x1, y1, z1,
668 xp, yp, zp, 20 * nV, 0);
669 }
670 const int isign = q > 0 ? +1 : -1;
671 if (m_debug) {
672 std::cout << m_className << "::EqualFluxIntervals:\n";
673 std::printf(" Total flux: %15.e8\n", q);
674 }
675 // Compute the 1-sided flux in a number of steps.
676 double fsum = 0.;
677 unsigned int nOtherSign = 0;
678 double s0 = -1.;
679 double s1 = -1.;
680 constexpr size_t nSteps = 1000;
681 std::array<double, nSteps> sTab;
682 std::array<double, nSteps> fTab;
683 constexpr double ds = 1. / nSteps;
684 const double dx = (x1 - x0) * ds;
685 const double dy = (y1 - y0) * ds;
686 const double dz = (z1 - z0) * ds;
687 for (size_t i = 0; i < nSteps; ++i) {
688 const double x = x0 + i * dx;
689 const double y = y0 + i * dy;
690 const double z = z0 + i * dz;
691 if (m_component) {
692 q = m_component->IntegrateFluxLine(x, y, z, x + dx, y + dy, z + dz,
693 xp, yp, zp, nV, isign);
694 } else {
695 q = m_sensor->IntegrateFluxLine(x, y, z, x + dx, y + dy, z + dz,
696 xp, yp, zp, nV, isign);
697 }
698 sTab[i] = (i + 1) * ds;
699 if (q > 0) {
700 fsum += q;
701 if (s0 < -0.5) s0 = i * ds;
702 s1 = (i + 1) * ds;
703 }
704 if (q < 0) ++nOtherSign;
705 fTab[i] = fsum;
706 }
707 if (m_debug) {
708 std::printf(" Used flux: %15.8e V. Start: %10.3f End: %10.3f\n",
709 fsum, s0, s1);
710 }
711 // Make sure that the sum is positive.
712 if (fsum <= 0) {
713 std::cerr << m_className << "::EqualFluxIntervals:\n"
714 << " 1-Sided flux integral is not > 0.\n";
715 return false;
716 } else if (s0 < -0.5 || s1 < -0.5 || s1 <= s0) {
717 std::cerr << m_className << "::EqualFluxIntervals:\n"
718 << " No flux interval without sign change found.\n";
719 return false;
720 } else if (nOtherSign > 0) {
721 std::cerr << m_className << "::EqualFluxIntervals:\n"
722 << " The flux changes sign over the line.\n";
723 }
724 // Normalise the flux.
725 const double scale = (nPoints - 1) / fsum;
726 for (size_t i = 0; i < nSteps; ++i) fTab[i] *= scale;
727
728 // Compute new cluster position.
729 for (size_t i = 0; i < nPoints; ++i) {
730 double s = std::min(s1, std::max(s0, Interpolate(sTab, fTab, i)));
731 xf.push_back(x0 + s * (x1 - x0));
732 yf.push_back(y0 + s * (y1 - y0));
733 zf.push_back(z0 + s * (z1 - z0));
734 }
735 return true;
736}
double IntegrateFluxLine(const double x0, const double y0, const double z0, const double x1, const double y1, const double z1, const double xp, const double yp, const double zp, const unsigned int nI, const int isign=0)
Definition: Component.cc:320
double IntegrateFluxLine(const double x0, const double y0, const double z0, const double x1, const double y1, const double z1, const double xp, const double yp, const double zp, const unsigned int nI, const int isign=0)
Definition: Sensor.cc:301
std::array< double, 4 > m_plane
Definition: ViewBase.hh:99
std::string m_className
Definition: ViewBase.hh:78

◆ FixedFluxIntervals()

bool Garfield::ViewField::FixedFluxIntervals ( const double  x0,
const double  y0,
const double  z0,
const double  x1,
const double  y1,
const double  z1,
std::vector< double > &  xf,
std::vector< double > &  yf,
std::vector< double > &  zf,
const double  interval = 10. 
) const

Generate points along a line, spaced by a given flux interval.

Definition at line 738 of file ViewField.cc.

742 {
743
744 if (interval <= 0.) {
745 std::cerr << m_className << "::FixedFluxIntervals:\n"
746 << " Flux interval must be > 0.\n";
747 return false;
748 }
749
750 // Set integration intervals.
751 constexpr unsigned int nV = 5;
752 // Compute the inplane vector normal to the track.
753 const double xp = (y1 - y0) * m_plane[2] - (z1 - z0) * m_plane[1];
754 const double yp = (z1 - z0) * m_plane[0] - (x1 - x0) * m_plane[2];
755 const double zp = (x1 - x0) * m_plane[1] - (y1 - y0) * m_plane[0];
756 // Compute the total flux, accepting positive and negative parts.
757 double q = 0.;
758 if (m_component) {
759 q = m_component->IntegrateFluxLine(x0, y0, z0, x1, y1, z1,
760 xp, yp, zp, 20 * nV, 0);
761 } else {
762 q = m_sensor->IntegrateFluxLine(x0, y0, z0, x1, y1, z1,
763 xp, yp, zp, 20 * nV, 0);
764 }
765 const int isign = q > 0 ? +1 : -1;
766 if (m_debug) {
767 std::cout << m_className << "::FixedFluxIntervals:\n";
768 std::printf(" Total flux: %15.8e V\n", q);
769 }
770 // Compute the 1-sided flux in a number of steps.
771 double fsum = 0.;
772 unsigned int nOtherSign = 0;
773 double s0 = -1.;
774 constexpr size_t nSteps = 1000;
775 std::array<double, nSteps> sTab;
776 std::array<double, nSteps> fTab;
777 constexpr double ds = 1. / nSteps;
778 const double dx = (x1 - x0) * ds;
779 const double dy = (y1 - y0) * ds;
780 const double dz = (z1 - z0) * ds;
781 for (size_t i = 0; i < nSteps; ++i) {
782 const double x = x0 + i * dx;
783 const double y = y0 + i * dy;
784 const double z = z0 + i * dz;
785 if (m_component) {
786 q = m_component->IntegrateFluxLine(x, y, z, x + dx, y + dy, z + dz,
787 xp, yp, zp, nV, isign);
788 } else {
789 q = m_sensor->IntegrateFluxLine(x, y, z, x + dx, y + dy, z + dz,
790 xp, yp, zp, nV, isign);
791 }
792 sTab[i] = (i + 1) * ds;
793 if (q > 0) {
794 fsum += q;
795 if (s0 < -0.5) s0 = i * ds;
796 }
797 if (q < 0) ++nOtherSign;
798 fTab[i] = fsum;
799 }
800 // Make sure that the sum is positive.
801 if (m_debug) {
802 std::printf(" Used flux: %15.8e V. Start offset: %10.3f\n", fsum, s0);
803 }
804 if (fsum <= 0) {
805 std::cerr << m_className << "::FixedFluxIntervals:\n"
806 << " 1-Sided flux integral is not > 0.\n";
807 return false;
808 } else if (s0 < -0.5) {
809 std::cerr << m_className << "::FixedFluxIntervals:\n"
810 << " No flux interval without sign change found.\n";
811 return false;
812 } else if (nOtherSign > 0) {
813 std::cerr << m_className << "::FixedFluxIntervals:\n"
814 << " Warning: The flux changes sign over the line.\n";
815 }
816
817 double f = 0.;
818 while (f < fsum) {
819 const double s = Interpolate(sTab, fTab, f);
820 f += interval;
821 xf.push_back(x0 + s * (x1 - x0));
822 yf.push_back(y0 + s * (y1 - y0));
823 zf.push_back(z0 + s * (z1 - z0));
824 }
825 return true;
826}

◆ Plot()

void Garfield::ViewField::Plot ( const std::string &  option = "v",
const std::string &  drawopt = "arr" 
)

Make a 2D plot of the electric potential or field.

Parameters
optionquantity to be plotted (see PlotContour)
drawoptoption string passed to TF2::Draw

Definition at line 126 of file ViewField.cc.

126 {
127 std::string opt1;
128 std::transform(drawopt.begin(), drawopt.end(),
129 std::back_inserter(opt1), toupper);
130 if (opt1.find("CONT") != std::string::npos) {
131 Draw2d(option, true, false, "", drawopt);
132 } else {
133 Draw2d(option, false, false, "", drawopt);
134 }
135}

Referenced by main().

◆ PlotContour()

void Garfield::ViewField::PlotContour ( const std::string &  option = "v")

Make a contour plot of the electric potential or field.

Parameters
optionquantity to be plotted
  • potential: "v", "voltage", "p", "potential"
  • magnitude of the electric field: "e", "field"
  • x-component of the electric field: "ex"
  • y-component of the electric field: "ey"
  • z-component of the electric field: "ez"

Definition at line 122 of file ViewField.cc.

122 {
123 Draw2d(option, true, false, "", "CONT1Z");
124}

Referenced by main().

◆ PlotContourWeightingField()

void Garfield::ViewField::PlotContourWeightingField ( const std::string &  label,
const std::string &  option 
)

Make a contour plot of the weighting potential or field.

Parameters
labelidentifier of the electrode
optionquantity to be plotted (see PlotContour)

Definition at line 149 of file ViewField.cc.

150 {
151 Draw2d(option, true, true, label, "CONT1Z");
152}

◆ PlotFieldLines()

void Garfield::ViewField::PlotFieldLines ( const std::vector< double > &  x0,
const std::vector< double > &  y0,
const std::vector< double > &  z0,
const bool  electron = true,
const bool  axis = true,
const short  col = kOrange - 3 
)

Draw electric field lines from a set of starting points.

Definition at line 572 of file ViewField.cc.

576 {
577
578 if (x0.empty() || y0.empty() || z0.empty()) return;
579 const size_t nLines = x0.size();
580 if (y0.size() != nLines || x0.size() != nLines) {
581 std::cerr << m_className << "::PlotLines:\n"
582 << " Mismatch in number of x/y/z coordinates.\n";
583 return;
584 }
585
586 if (!m_sensor && !m_component) {
587 std::cerr << m_className << "::PlotFieldLines:\n"
588 << " Neither sensor nor component are defined.\n";
589 return;
590 }
591
592 auto pad = GetCanvas();
593 pad->cd();
594 pad->SetTitle("Field lines");
595 // Determine the x-y range.
596 const bool rangeSet = RangeSet(pad);
597 if (axis || !rangeSet) {
598 // Determine the plot limits.
599 if (!SetPlotLimits()) {
600 std::cerr << m_className << "::PlotFieldLines:\n"
601 << " Could not determine the plot limits.\n";
602 return;
603 }
604 }
605 if (axis) {
606 auto frame = pad->DrawFrame(m_xMinPlot, m_yMinPlot,
608 frame->GetXaxis()->SetTitle(LabelX().c_str());
609 frame->GetYaxis()->SetTitle(LabelY().c_str());
610 pad->Update();
611 } else if (!rangeSet) {
613 }
614
615 DriftLineRKF drift;
616 Sensor sensor;
617 if (m_sensor) {
618 drift.SetSensor(m_sensor);
619 } else {
620 double xmin = 0., ymin = 0., zmin = 0.;
621 double xmax = 0., ymax = 0., zmax = 0.;
622 if (!m_component->GetBoundingBox(xmin, ymin, zmin, xmax, ymax, zmax)) {
623 if (m_userBox) {
624 sensor.SetArea(m_xMinBox, m_yMinBox, m_zMinBox,
626 }
627 }
628 sensor.AddComponent(m_component);
629 drift.SetSensor(&sensor);
630 }
631 const double lx = 0.1 * fabs(m_xMaxPlot - m_xMinPlot);
632 const double ly = 0.1 * fabs(m_yMaxPlot - m_yMinPlot);
633 drift.SetMaximumStepSize(std::min(lx, ly));
634 for (size_t i = 0; i < nLines; ++i) {
635 std::vector<std::array<float, 3> > xl;
636 if (!drift.FieldLine(x0[i], y0[i], z0[i], xl, electron)) continue;
637 DrawLine(xl, col, 1);
638 }
639 pad->Update();
640}
virtual bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax)
Get the bounding box coordinates.
Definition: Component.cc:99
std::string LabelY()
Definition: ViewBase.cc:483
std::string LabelX()
Definition: ViewBase.cc:420
void DrawLine(const std::vector< std::array< float, 3 > > &xl, const short col, const short lw)
Definition: ViewBase.cc:371
bool RangeSet(TPad *)
Definition: ViewBase.cc:83
TPad * GetCanvas()
Retrieve the canvas.
Definition: ViewBase.cc:74
void SetRange(TPad *pad, const double x0, const double y0, const double x1, const double y1)
Definition: ViewBase.cc:93
DoubleAc fabs(const DoubleAc &f)
Definition: DoubleAc.h:615

◆ PlotProfile()

void Garfield::ViewField::PlotProfile ( const double  x0,
const double  y0,
const double  z0,
const double  x1,
const double  y1,
const double  z1,
const std::string &  option = "v",
const bool  normalised = true 
)

Make a 1D plot of the electric potential or field along a line.

Parameters
x0,y0,z0starting point
x1,y1,z1end point
optionquantity to be plotted (see PlotContour)
normalisedflag whether to use normalised x-axis coordinates

Definition at line 137 of file ViewField.cc.

139 {
140 DrawProfile(x0, y0, z0, x1, y1, z1, option, false, "", normalised);
141}

◆ PlotProfileWeightingField()

void Garfield::ViewField::PlotProfileWeightingField ( const std::string &  label,
const double  x0,
const double  y0,
const double  z0,
const double  x1,
const double  y1,
const double  z1,
const std::string &  option = "v",
const bool  normalised = true 
)

Make a 1D plot of the weighting potential or field along a line.

Parameters
labelidentifier of the electrode
x0,y0,z0starting point
x1,y1,z1end point
optionquantity to be plotted (see PlotContour)
normalisedflag whether to use normalised x-axis coordinates

Definition at line 154 of file ViewField.cc.

159 {
160 DrawProfile(x0, y0, z0, x1, y1, z1, option, true, label, normalised);
161}

◆ PlotWeightingField()

void Garfield::ViewField::PlotWeightingField ( const std::string &  label,
const std::string &  option,
const std::string &  drawopt 
)

Make a 2D plot of the weighting potential or field.

Parameters
labelidentifier of the electrode
optionquantity to be plotted (see PlotContour)
drawoptoption string passed to TF2::Draw

Definition at line 143 of file ViewField.cc.

145 {
146 Draw2d(option, false, true, label, drawopt);
147}

◆ SetComponent()

void Garfield::ViewField::SetComponent ( Component c)

Set the component for which to plot the field.

Definition at line 81 of file ViewField.cc.

81 {
82 if (!c) {
83 std::cerr << m_className << "::SetComponent: Null pointer.\n";
84 return;
85 }
86 m_component = c;
87 m_sensor = nullptr;
88}

◆ SetElectricFieldRange()

void Garfield::ViewField::SetElectricFieldRange ( const double  emin,
const double  emax 
)

Set the plot limits for the electric field.

Definition at line 96 of file ViewField.cc.

96 {
97 m_emin = std::min(emin, emax);
98 m_emax = std::max(emin, emax);
99 m_useAutoRange = false;
100}

◆ SetNumberOfContours()

void Garfield::ViewField::SetNumberOfContours ( const unsigned int  n)

Set the number of contour levels.

Definition at line 108 of file ViewField.cc.

108 {
109 if (n > 0) m_nContours = n;
110}

Referenced by main().

◆ SetNumberOfSamples1d()

void Garfield::ViewField::SetNumberOfSamples1d ( const unsigned int  n)

Set the number of points used for drawing 1D functions.

Definition at line 112 of file ViewField.cc.

112 {
113 m_nSamples1d = std::max(4u, n);
114}

◆ SetNumberOfSamples2d()

void Garfield::ViewField::SetNumberOfSamples2d ( const unsigned int  nx,
const unsigned int  ny 
)

Set the number of points used for drawing 2D functions.

Definition at line 116 of file ViewField.cc.

117 {
118 m_nSamples2dX = std::max(4u, nx);
119 m_nSamples2dY = std::max(4u, ny);
120}

Referenced by main().

◆ SetSensor()

void Garfield::ViewField::SetSensor ( Sensor s)

Set the sensor for which to plot the field.

Definition at line 72 of file ViewField.cc.

72 {
73 if (!s) {
74 std::cerr << m_className << "::SetSensor: Null pointer.\n";
75 return;
76 }
77 m_sensor = s;
78 m_component = nullptr;
79}

Referenced by main().

◆ SetVoltageRange()

void Garfield::ViewField::SetVoltageRange ( const double  vmin,
const double  vmax 
)

Set the plot limits for the potential.

Definition at line 90 of file ViewField.cc.

90 {
91 m_vmin = std::min(vmin, vmax);
92 m_vmax = std::max(vmin, vmax);
93 m_useAutoRange = false;
94}

◆ SetWeightingFieldRange()

void Garfield::ViewField::SetWeightingFieldRange ( const double  wmin,
const double  wmax 
)

Set the plot limits for the weighting field.

Definition at line 102 of file ViewField.cc.

102 {
103 m_wmin = std::min(wmin, wmax);
104 m_wmax = std::max(wmin, wmax);
105 m_useAutoRange = false;
106}

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