Garfield++ v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
ViewField.hh
Go to the documentation of this file.
1#ifndef G_VIEW_FIELD
2#define G_VIEW_FIELD
3
4#include <TCanvas.h>
5#include <TF2.h>
6#include <TF1.h>
7
8namespace Garfield {
9
10class Sensor;
11class ComponentBase;
12
13class ViewField {
14
15 public:
16 // Constructor
17 ViewField();
18 // Destructor
19 ~ViewField();
20
21 void SetSensor(Sensor* s);
23 void SetCanvas(TCanvas* c);
24
25 // Range of the plot
26 void SetVoltageRange(const double minval, const double maxval);
27 void SetElectricFieldRange(const double minval, const double maxval);
28 void SetWeightingFieldRange(const double minval, const double maxval);
29
30 // Establish area, normal vector, in-plane vector ...
31 void SetArea(double xmin, double ymin, double xmax, double ymax);
32 void SetNumberOfContours(const int n);
34 void SetPlane(double fx, double fy, double fz, double x0, double y0,
35 double z0);
36 void SetNumberOfSamples1d(const int n);
37 void SetNumberOfSamples2d(const int nx, const int ny);
38
39 // Rotate the viewing plane
40 void Rotate(double angle);
41
42 void PlotContour(const std::string option = "v");
43 void PlotSurface(const std::string option = "v");
44 void PlotProfile(const double x0, const double y0, const double z0,
45 const double x1, const double y1, const double z1,
46 const std::string option = "v");
47 void PlotContourWeightingField(const std::string label,
48 const std::string option);
49 void PlotSurfaceWeightingField(const std::string label,
50 const std::string option);
51
52 double EvaluatePotential(double* pos, double* par);
53 double EvaluatePotentialProfile(double* pos, double* par);
54 double EvaluateWeightingField(double* pos, double* par);
55
56 void EnableAcknowledgeStatus(const double v0 = 0.) {
57 useStatus = true;
58 vBkg = v0;
59 }
60 void DisableAcknowledgeStatus() { useStatus = false; }
61
62 void EnableDebugging() { debug = true; }
63 void DisableDebugging() { debug = false; }
64
65 private:
66 std::string className;
67
68 static const int nMaxContours = 50;
69
70 // Options
71 bool debug;
72
73 bool useStatus;
74 double vBkg;
75
76 // Sensor
77 Sensor* sensor;
78 ComponentBase* component;
79
80 // Projection for viewing
81 double project[3][3];
82 double plane[4];
83 char xLabel[50], yLabel[50], description[50];
84
85 // Box dimensions
86 double pxmin, pymin, pzmin, pxmax, pymax, pzmax;
87 // Function range
88 double fmin, fmax;
89 double emin, emax;
90 double wmin, wmax;
91
92 // Number of contours
93 int nContours;
94 // Number of points used to draw the functions
95 int nSamples1d;
96 int nSamples2dX, nSamples2dY;
97 // Weighting field label
98 std::string electrode;
99
100 // Canvas
101 TCanvas* canvas;
102 bool hasExternalCanvas;
103
104 // Potential function
105 TF2* fPot;
106 TF2* fWfield;
107 TF1* fPotProfile;
108
109 void Labels();
110 void CreateFunction();
111 void CreateProfileFunction();
112 void CreateFunctionWeightingField();
113};
114}
115#endif
void SetNumberOfContours(const int n)
Definition: ViewField.cc:152
void EnableAcknowledgeStatus(const double v0=0.)
Definition: ViewField.hh:56
void SetElectricFieldRange(const double minval, const double maxval)
Definition: ViewField.cc:138
double EvaluatePotentialProfile(double *pos, double *par)
Definition: ViewField.cc:714
void SetNumberOfSamples2d(const int nx, const int ny)
Definition: ViewField.cc:177
void PlotContourWeightingField(const std::string label, const std::string option)
Definition: ViewField.cc:512
void SetArea(double xmin, double ymin, double xmax, double ymax)
Definition: ViewField.cc:116
void DisableAcknowledgeStatus()
Definition: ViewField.hh:60
void SetComponent(ComponentBase *c)
Definition: ViewField.cc:81
void DisableDebugging()
Definition: ViewField.hh:63
double EvaluatePotential(double *pos, double *par)
Definition: ViewField.cc:669
void Rotate(double angle)
Definition: ViewField.cc:1085
void PlotSurface(const std::string option="v")
Definition: ViewField.cc:291
double EvaluateWeightingField(double *pos, double *par)
Definition: ViewField.cc:761
void SetSensor(Sensor *s)
Definition: ViewField.cc:57
void SetVoltageRange(const double minval, const double maxval)
Definition: ViewField.cc:132
void SetDefaultProjection()
Definition: ViewField.cc:646
void EnableDebugging()
Definition: ViewField.hh:62
void PlotSurfaceWeightingField(const std::string label, const std::string option)
Definition: ViewField.cc:455
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")
Definition: ViewField.cc:357
void SetWeightingFieldRange(const double minval, const double maxval)
Definition: ViewField.cc:145
void SetCanvas(TCanvas *c)
Definition: ViewField.cc:105
void SetPlane(double fx, double fy, double fz, double x0, double y0, double z0)
Definition: ViewField.cc:1044
void SetNumberOfSamples1d(const int n)
Definition: ViewField.cc:162
void PlotContour(const std::string option="v")
Definition: ViewField.cc:198