GeFiCa
Germanium detector Field Calculator
Public Member Functions | Protected Member Functions | List of all members
GeFiCa::XYZ Class Reference

3D Cartesian coordinates. More...

#include <XYZ.h>

Inheritance diagram for GeFiCa::XYZ:
Inheritance graph
[legend]
Collaboration diagram for GeFiCa::XYZ:
Collaboration graph
[legend]

Public Member Functions

 XYZ (size_t n1=50, size_t n2=50, size_t n3=50)
 
void SetupWith (Detector &detector)
 Fix potentials on boundaries based on. More...
 
double GetC ()
 
- Public Member Functions inherited from GeFiCa::Grid
 Grid (size_t n1=0, size_t n2=0, size_t n3=0)
 Default constructor. More...
 
virtual ~Grid ()
 
void SuccessiveOverRelax ()
 Successively over-relax potentials on grid points. More...
 
void SolveAnalytically ()
 Solve Poisson's Equation analytically. More...
 
double GetV (double c1, double c2=0, double c3=0) const
 Get potential at (c1,c2,c3) by interpolation. More...
 
double GetE (double c1, double c2=0, double c3=0) const
 
double GetE1 (double c1, double c2=0, double c3=0) const
 
double GetE2 (double c1, double c2=0, double c3=0) const
 
double GetE3 (double c1, double c2=0, double c3=0) const
 
double GetC ()
 Get detector capacitance. More...
 
TTree * GetTree (bool createNew=false)
 Create &/or return a TTree with field data. More...
 
bool IsDepleted ()
 Check if every grid point is depleted. More...
 
Gridoperator*= (double scale)
 Potentials at all points are multiplied by. More...
 
Gridoperator+= (Grid &other)
 Potentials of this grid are summed with those of. More...
 
virtual FieldLineGetFieldLineFrom (double c1, double c2, bool positive=true)
 Propogate a field line from (c1,c2,c3). More...
 
virtual FieldLineGetFieldLineFrom (double c1, double c2, double c3, bool positive=true)
 
- Public Member Functions inherited from GeFiCa::Points
size_t GetN ()
 total number of points More...
 

Protected Member Functions

void OverRelaxAt (size_t idx)
 Over relax potential Vp[. More...
 
void GetInfoFrom (SquarePointContact &detector)
 
void CalculateE ()
 Calculate Et, E1, E2, E3 from Vp. More...
 
 ClassDef (XYZ, 1)
 
- Protected Member Functions inherited from GeFiCa::Grid
size_t GetIdxOfPointToTheRightOf (double c1, size_t begin, size_t end) const
 Get index of point near. More...
 
size_t GetIdxOfPointToTheRightOf (double c1, double c2, size_t begin, size_t end) const
 
size_t GetIdxOfPointToTheRightOf (double c1, double c2, double c3, size_t begin, size_t end) const
 
virtual double GetData (const std::vector< double > &data, double c1, double c2, double c3) const
 Interpolate grid data at (c1,c2,c3). More...
 
size_t GetIdxOfMaxV ()
 Get index of the grid point with max potential. More...
 
size_t GetIdxOfMinV ()
 Get index of the grid point with min potential. More...
 
double twopoint (double dataset[2], double tarlocationset, double pointxset[2]) const
 Calculate interpolation value between two point. More...
 
double threepoint (double dataset[3], double tarlocationset[2], double pointxset[3], double pointyset[3]) const
 Calculate interpolation value between three point (triangle) More...
 
double fourpoint (double dataset[4], double tarlocationset[2], double pointxset[4], double pointyset[4]) const
 Calculate interpolation value between four point (rectangle) More...
 
 ClassDef (Grid, 1)
 

Additional Inherited Members

- Public Attributes inherited from GeFiCa::Grid
size_t N1
 number of points along the 1st coordinate More...
 
size_t N2
 number of points along the 2nd coordinate More...
 
size_t N3
 number of points along the 3rd coordinate More...
 
std::vector< double > Src
 -(net impurity concentration)x|Qe|/epsilon More...
 
size_t MaxIterations
 maximal iterations of SOR to be performed More...
 
double RelaxationFactor
 within (0,2), used to speed up convergence More...
 
double Tolerance
 SOR stops when error<Tolerance. More...
 
size_t Iterations
 number of iterations of SOR performed More...
 
- Public Attributes inherited from GeFiCa::Points
std::vector< double > C1
 the 1st coordinates of the points More...
 
std::vector< double > C2
 the 2nd coordinates of the points More...
 
std::vector< double > C3
 the 3rd coordinates of the points More...
 
std::vector< double > Vp
 potential at each point More...
 
std::vector< double > Et
 total electric field strength More...
 
std::vector< double > E1
 projection of Et on C1 More...
 
std::vector< double > E2
 projection of Et on C2 More...
 
std::vector< double > E3
 projection of Et on C3 More...
 
std::vector< double > dC1p
 step length to next point alone C1 More...
 
std::vector< double > dC1m
 step length to previous point alone C1 More...
 
std::vector< double > dC2p
 step length to next point along C2 More...
 
std::vector< double > dC2m
 step length to previous point along C2 More...
 
std::vector< double > dC3p
 step length to next point alone C3 More...
 
std::vector< double > dC3m
 step length to previous point alone C3 More...
 
- Protected Attributes inherited from GeFiCa::Grid
std::vector< bool > fIsFixed
 true if field values are fixed More...
 
std::vector< bool > fIsDepleted
 true if a grid point is depleted More...
 
TTree * fTree
 ! ROOT tree to visualize fields More...
 
DetectorfDetector
 ! Pointer to associated detector object More...
 

Detailed Description

3D Cartesian coordinates.

Definition at line 10 of file XYZ.h.

Constructor & Destructor Documentation

◆ XYZ()

GeFiCa::XYZ::XYZ ( size_t  n1 = 50,
size_t  n2 = 50,
size_t  n3 = 50 
)
inline

Definition at line 13 of file XYZ.h.

13  : Grid(n1, n2, n3) {
14  fName="xyz", fTitle="3D Cartecian coordinates"; }
Grid(size_t n1=0, size_t n2=0, size_t n3=0)
Default constructor.
Definition: Grid.cc:26

Member Function Documentation

◆ CalculateE()

void XYZ::CalculateE ( )
protectedvirtual

Calculate Et, E1, E2, E3 from Vp.

Reimplemented from GeFiCa::Grid.

Definition at line 173 of file XYZ.cc.

174 {
175  for (size_t idx=0; idx<GetN(); idx++) {
176  double dxm=dC1m[idx];
177  double dxp=dC1p[idx];
178  double dym=dC2m[idx];
179  double dyp=dC2p[idx];
180  double dzm=dC3m[idx];
181  double dzp=dC3p[idx];
182  double vym,vyp,vxm,vxp,vzp,vzm;
183  if (idx<N1*N2) vzm=Vp[idx];
184  else vzm=Vp[idx-N1*N2];
185  if (idx>=N1*N2*N3-N1*N2) vzp=Vp[idx];
186  else vzp=Vp[idx+N1*N2];
187  if (idx%(N1*N2)>(N1*N2)-N1-1) vyp=Vp[idx];
188  else vyp=Vp[idx+N1];
189  if (idx%(N1*N2)<N1) vym=Vp[idx];
190  else vym=Vp[idx-N1];
191  if ((idx%(N1*N2))%N1==N1-1) vxp=Vp[idx];
192  else vxp=Vp[idx+1];
193  if ((idx%(N1*N2))%N1==0) vxm=Vp[idx];
194  else vxm=Vp[idx-1];
195  E1[idx]=(vxp-vxm)/(dxm+dxp);
196  E2[idx]=(vyp-vym)/(dym+dyp);
197  E3[idx]=(vzp-vzm)/(dzm+dzp);
198 
199  Et[idx]=sqrt(E1[idx]*E1[idx]+E2[idx]*E2[idx]+E3[idx]*E3[idx]);
200  }
201 }
std::vector< double > dC1m
step length to previous point alone C1
Definition: Grid.h:21
std::vector< double > E3
projection of Et on C3
Definition: Grid.h:19
std::vector< double > E1
projection of Et on C1
Definition: Grid.h:17
size_t N2
number of points along the 2nd coordinate
Definition: Grid.h:54
std::vector< double > dC3p
step length to next point alone C3
Definition: Grid.h:24
size_t N1
number of points along the 1st coordinate
Definition: Grid.h:53
std::vector< double > dC1p
step length to next point alone C1
Definition: Grid.h:20
size_t GetN()
total number of points
Definition: Grid.h:26
std::vector< double > dC2m
step length to previous point along C2
Definition: Grid.h:23
std::vector< double > dC2p
step length to next point along C2
Definition: Grid.h:22
size_t N3
number of points along the 3rd coordinate
Definition: Grid.h:55
std::vector< double > Vp
potential at each point
Definition: Grid.h:15
std::vector< double > dC3m
step length to previous point alone C3
Definition: Grid.h:25
std::vector< double > Et
total electric field strength
Definition: Grid.h:16
std::vector< double > E2
projection of Et on C2
Definition: Grid.h:18

◆ ClassDef()

GeFiCa::XYZ::ClassDef ( XYZ  ,
 
)
protected

◆ GetC()

double XYZ::GetC ( )

Definition at line 83 of file XYZ.cc.

84 {
85  //FIXME:function of integration need to be update for xyz
86  return -1;
87 
88  Grid::GetC(); // calculate field excluding undepleted region
89 
90  // calculate C based on CV^2/2 = epsilon int E^2 dx^3 / 2
92  double dV=spc.Bias[0]-spc.Bias[1]; if(dV<0)dV=-dV;
93  double SumofElectricField=0;
94  for(size_t i=0;i<GetN();i++) {
95  double e1=E1[i];
96  double e2=E2[i];
97  double dr=dC1p[i];
98  double dz=dC2p[i];
99  SumofElectricField+=(e1*e1+e2*e2)*C1[i]*dr*dz;
100  }
101  double c=SumofElectricField*2*3.14159*epsilon/dV/dV;
102  Info("GetC","%.2f pF",c/pF);
103  return c;
104 }
std::vector< double > Bias
bias on electrodes
Definition: Detector.h:35
std::vector< double > E1
projection of Et on C1
Definition: Grid.h:17
Configuration of squre point contact detectors.
std::vector< double > dC1p
step length to next point alone C1
Definition: Grid.h:20
size_t GetN()
total number of points
Definition: Grid.h:26
static const double epsilon
permittivity of Ge [C/volt/cm]
Definition: Units.h:27
Detector * fDetector
! Pointer to associated detector object
Definition: Grid.h:132
std::vector< double > dC2p
step length to next point along C2
Definition: Grid.h:22
static const double pF
pico farad
Definition: Units.h:22
double GetC()
Get detector capacitance.
Definition: Grid.cc:198
std::vector< double > E2
projection of Et on C2
Definition: Grid.h:18
std::vector< double > C1
the 1st coordinates of the points
Definition: Grid.h:12

◆ GetInfoFrom()

void XYZ::GetInfoFrom ( SquarePointContact detector)
protected

Definition at line 107 of file XYZ.cc.

108 {
109  double dx=spc.Width/(N1-1), dy=spc.Length/(N2-1), dz=spc.Height/(N3-1);
110 
111  for (size_t i=0; i<N3; i++) {
112  for (size_t j=0; j<N2; j++) {
113  for (size_t k=0; k<N1; k++) {
114  C1.push_back(k*dx); C2.push_back(j*dy); C3.push_back(i*dz);
115  dC1p.push_back(dx); dC1m.push_back(dx);
116  dC2p.push_back(dy); dC2m.push_back(dy);
117  dC3p.push_back(dz); dC3m.push_back(dz);
118  E1.push_back(0); E2.push_back(0); E3.push_back(0);
119  Et.push_back(0); Vp.push_back(0);
120  fIsFixed.push_back(false); fIsDepleted.push_back(false);
121  Src.push_back(-spc.GetImpurity(C3.back())*Qe/epsilon);
122 
123  if (k==0) { // left most surface
124  dC1m.back()=0; E2.back()=0; E3.back()=0; Vp.back()=spc.Bias[1];
125  fIsFixed.back()=true; fIsDepleted.back()=true;
126  }
127  if (k==N1-1) { // right most surface
128  dC1p.back()=0; E2.back()=0; E3.back()=0; Vp.back()=spc.Bias[1];
129  fIsFixed.back()=true; fIsDepleted.back()=true;
130  }
131  if (j==0) { // front most surface
132  dC2m.back()=0; E1.back()=0; E3.back()=0; Vp.back()=spc.Bias[1];
133  fIsFixed.back()=true; fIsDepleted.back()=true;
134  }
135  if (j==N2-1) { // back most surface
136  dC2p.back()=0; E1.back()=0; E3.back()=0; Vp.back()=spc.Bias[1];
137  fIsFixed.back()=true; fIsDepleted.back()=true;
138  }
139  if (i==0) { // top surface
140  dC3m.push_back(0);
141  // wrap around
142  if (C1.back()<=(spc.Width-spc.WrapAroundW)/2
143  || C1.back()>=(spc.Width+spc.WrapAroundW)/2) {
144  E1.back()=0; E2.back()=0; Vp.back()=spc.Bias[1];
145  fIsFixed.back()=true; fIsDepleted.back()=true;
146  }
147  if (C2.back()<=(spc.Length-spc.WrapAroundL)/2
148  || C2.back()>=(spc.Length+spc.WrapAroundL)/2) {
149  E1.back()=0; E2.back()=0; Vp.back()=spc.Bias[1];
150  fIsFixed.back()=true; fIsDepleted.back()=true;
151  }
152  // point contact
153  if (C3.back()<=spc.PointContactH
154  && C1.back()>=(spc.Width-spc.PointContactW)/2
155  && C1.back()<=(spc.Width+spc.PointContactW)/2
156  && C2.back()>=(spc.Length-spc.PointContactL)/2
157  && C2.back()<=(spc.Length+spc.PointContactL)/2) {
158  fIsFixed.back()=true; fIsDepleted.back()=true;
159  Vp.back()=spc.Bias[0];
160  }
161  }
162  if (i==N3-1) { // bottom electrode
163  dC3p.push_back(0);
164  E1.back()=0; E2.back()=0; Vp.back()=spc.Bias[1];
165  fIsFixed.back()=true; fIsDepleted.back()=true;
166  }
167  }
168  }
169  }
170 }
std::vector< double > dC1m
step length to previous point alone C1
Definition: Grid.h:21
std::vector< double > E3
projection of Et on C3
Definition: Grid.h:19
std::vector< bool > fIsFixed
true if field values are fixed
Definition: Grid.h:129
std::vector< double > E1
projection of Et on C1
Definition: Grid.h:17
size_t N2
number of points along the 2nd coordinate
Definition: Grid.h:54
std::vector< double > dC3p
step length to next point alone C3
Definition: Grid.h:24
std::vector< double > Src
-(net impurity concentration)x|Qe|/epsilon
Definition: Grid.h:56
size_t N1
number of points along the 1st coordinate
Definition: Grid.h:53
std::vector< double > C2
the 2nd coordinates of the points
Definition: Grid.h:13
std::vector< double > dC1p
step length to next point alone C1
Definition: Grid.h:20
std::vector< double > dC2m
step length to previous point along C2
Definition: Grid.h:23
static const double epsilon
permittivity of Ge [C/volt/cm]
Definition: Units.h:27
std::vector< bool > fIsDepleted
true if a grid point is depleted
Definition: Grid.h:130
std::vector< double > dC2p
step length to next point along C2
Definition: Grid.h:22
size_t N3
number of points along the 3rd coordinate
Definition: Grid.h:55
std::vector< double > Vp
potential at each point
Definition: Grid.h:15
static const double Qe
electron charge in Coulomb [C]
Definition: Units.h:24
std::vector< double > dC3m
step length to previous point alone C3
Definition: Grid.h:25
std::vector< double > Et
total electric field strength
Definition: Grid.h:16
std::vector< double > E2
projection of Et on C2
Definition: Grid.h:18
std::vector< double > C1
the 1st coordinates of the points
Definition: Grid.h:12
std::vector< double > C3
the 3rd coordinates of the points
Definition: Grid.h:14

◆ OverRelaxAt()

void XYZ::OverRelaxAt ( size_t  idx)
protectedvirtual

Over relax potential Vp[.

Parameters
idx].

Reimplemented from GeFiCa::Grid.

Definition at line 25 of file XYZ.cc.

26 {
27  if (fIsFixed[idx]) return; // no need to calculate on boundaries
28 
29  double dxp=dC1p[idx]!=0?dC1p[idx]:dC1m[idx];
30  double dxm=dC1m[idx]!=0?dC1m[idx]:dC1p[idx];
31  double dyp=dC2p[idx]!=0?dC2p[idx]:dC2m[idx];
32  double dym=dC2m[idx]!=0?dC2m[idx]:dC2p[idx];
33  double dzp=dC3p[idx]!=0?dC3p[idx]:dC3m[idx];
34  double dzm=dC3m[idx]!=0?dC3m[idx]:dC3p[idx];
35 
36  double vxp,vxm,vyp,vym,vzp,vzm;
37  if (idx<N1*N2) vzm=Vp[idx]; // bottom boundary
38  else vzm=Vp[idx-N1*N2];
39  if (idx>=N1*N2*N3-N1*N2) vzp=Vp[idx]; // top boundary
40  else vzp=Vp[idx+N1*N2];
41  if (idx%(N1*N2)>(N1*N2)-N1-1) vyp=Vp[idx]; // back boundary
42  else vyp=Vp[idx+N1];
43  if (idx%(N1*N2)<N1) vym=Vp[idx]; // front boundary
44  else vym=Vp[idx-N1];
45  if ((idx%(N1*N2))%N1==N1-1) vxp=Vp[idx]; // right boundary
46  else vxp=Vp[idx+1];
47  if ((idx%(N1*N2))%N1==0) vxm=Vp[idx]; // left boundary
48  else vxm=Vp[idx-1];
49 
50  // update potential
51  double vnew = ( Src[idx]/2 + (vxp/dxp+vxm/dxm)/(dxm+dxp)
52  + (vyp/dyp+vym/dym)/(dym+dyp) + (vzp/dzp+vzm/dzm)/(dzp+dzm) )
53  / ( (1/dxp+1/dxm)/(dxp+dxm)
54  + (1/dyp+1/dym)/(dyp+dym) + (1/dzp+1/dzm)/(dzp+dzm) );
55  vnew = RelaxationFactor*(vnew-Vp[idx])+Vp[idx]; // over relax
56 
57  // update Vp for impurity-only case even if the point is undepleted
58  if (fDetector->Bias[0]==fDetector->Bias[1]) { Vp[idx]=vnew; return; }
59 
60  //check depletion
61  fIsDepleted[idx]=false; // default
62  //find minimal potential in all neighboring points
63  double vmin=vxp; // minimal Vp around point[idx]
64  if (vmin>vxm)vmin=vxm;
65  if (vmin>vyp)vmin=vyp;
66  if (vmin>vym)vmin=vym;
67  if (vmin>vzp)vmin=vzp;
68  if (vmin>vzm)vmin=vzm;
69  //find maximal potential in all neighboring points
70  double vmax=vxp; // maximal Vp around point[idx]
71  if (vmax<vxm)vmax=vxm;
72  if (vmax<vyp)vmax=vyp;
73  if (vmax<vym)vmax=vym;
74  if (vmax<vzp)vmax=vzp;
75  if (vmax<vzm)vmax=vzm;
76  //if vnew is greater or smaller than max and min, set vnew to it.
77  if (vnew<vmin) Vp[idx]=vmin;
78  else if(vnew>vmax) Vp[idx]=vmax;
79  else { Vp[idx]=vnew; fIsDepleted[idx]=true; } // vmin<vnew<vmax
80 }
std::vector< double > dC1m
step length to previous point alone C1
Definition: Grid.h:21
std::vector< double > Bias
bias on electrodes
Definition: Detector.h:35
std::vector< bool > fIsFixed
true if field values are fixed
Definition: Grid.h:129
size_t N2
number of points along the 2nd coordinate
Definition: Grid.h:54
std::vector< double > dC3p
step length to next point alone C3
Definition: Grid.h:24
std::vector< double > Src
-(net impurity concentration)x|Qe|/epsilon
Definition: Grid.h:56
size_t N1
number of points along the 1st coordinate
Definition: Grid.h:53
std::vector< double > dC1p
step length to next point alone C1
Definition: Grid.h:20
std::vector< double > dC2m
step length to previous point along C2
Definition: Grid.h:23
std::vector< bool > fIsDepleted
true if a grid point is depleted
Definition: Grid.h:130
Detector * fDetector
! Pointer to associated detector object
Definition: Grid.h:132
std::vector< double > dC2p
step length to next point along C2
Definition: Grid.h:22
size_t N3
number of points along the 3rd coordinate
Definition: Grid.h:55
std::vector< double > Vp
potential at each point
Definition: Grid.h:15
std::vector< double > dC3m
step length to previous point alone C3
Definition: Grid.h:25
double RelaxationFactor
within (0,2), used to speed up convergence
Definition: Grid.h:58

◆ SetupWith()

void XYZ::SetupWith ( Detector detector)
virtual

Fix potentials on boundaries based on.

Parameters
detectorgeometry. It fills Points data based on
detectorgeometry and N1, N2 and/or N3, and raises the flag fIsFixed for points on/outside electrodes. It has to be called before SuccessiveOverRelax().

Reimplemented from GeFiCa::Grid.

Definition at line 6 of file XYZ.cc.

7 {
8  Grid::SetupWith(detector); // check number of calls
9 
10  TString type(detector.ClassName());
11  if (type.Contains("SquarePointContact")) {
12  SquarePointContact& spc = (SquarePointContact&) detector;
13  spc.CheckConfigurations();
14  GetInfoFrom(spc);
15  } else {
16  Error("SetupWith", "%s is not expected.", type.Data());
17  Error("SetupWith", "Please use SquarePointContact detector.");
18  abort();
19  }
20 
21  fDetector = &detector; // for GetC to use fDetector->Bias[]
22 }
Configuration of squre point contact detectors.
virtual void SetupWith(Detector &detector)
Fix potentials on boundaries based on.
Definition: Grid.cc:111
Detector * fDetector
! Pointer to associated detector object
Definition: Grid.h:132
void GetInfoFrom(SquarePointContact &detector)
Definition: XYZ.cc:107

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