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

2D spherical coordinates. More...

#include <RTheta.h>

Inheritance diagram for GeFiCa::RTheta:
GeFiCa::Grid GeFiCa::Points

Public Member Functions

 RTheta (size_t n1=101, size_t n2=181)
 
void SetupWith (Detector &detector)
 Fix potentials on boundaries based on. More...
 
- 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, double c3=0, bool positive=true)
 Propogate a field line from (c1,c2,c3). More...
 
- Public Member Functions inherited from GeFiCa::Points
size_t GetN ()
 total number of points More...
 

Protected Member Functions

virtual void OverRelaxAt (size_t idx)
 Over relax potential Vp[. More...
 
void CalculateE ()
 Calculate Et, E1, E2, E3 from Vp. More...
 
 ClassDef (RTheta, 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

2D spherical coordinates.

Definition at line 9 of file RTheta.h.

Constructor & Destructor Documentation

§ RTheta()

GeFiCa::RTheta::RTheta ( size_t  n1 = 101,
size_t  n2 = 181 
)
inline

Definition at line 12 of file RTheta.h.

12  : Grid(n1, n2) {
13  fName="rt"; fTitle="2D spherical coordinate"; }
Grid(size_t n1=0, size_t n2=0, size_t n3=0)
Default constructor.
Definition: Grid.cc:26

Member Function Documentation

§ CalculateE()

void RTheta::CalculateE ( )
protectedvirtual

Calculate Et, E1, E2, E3 from Vp.

Reimplemented from GeFiCa::Grid.

Definition at line 63 of file RTheta.cc.

64 {
65  double N=N1*N2;
66  for (size_t i=1; i<N-1; i++) {
67  if(i<N1-1)
68  E2[i]=(C2[i+N1]*Vp[i+N1]-C2[i]*Vp[i])/(dC2p[i])/C2[i]/C1[i];
69  else if(i>N-N1-1)
70  E2[i]=(C2[i]*Vp[i]-C2[i-N1]*Vp[i-N1])/(dC2m[i])/C2[i]/C1[i];
71  else
72  E2[i]=(C2[i+N1]*Vp[i+N1]-C2[i-N1]*Vp[i-N1])/(dC2p[i]+dC2m[i])/C2[i]/C1[i];
73  if(i%N1==0)
74  E1[i]=(C1[i+1]*Vp[i+1]-C1[i]*Vp[i])/(dC1p[i])/C1[i];
75  else if(i%N1==N1-1)
76  E1[i]=(C1[i]*Vp[i]-C1[i-1]*Vp[i-1])/(dC1m[i])/C1[i];
77  else E1[i]=(C1[i+1]*Vp[i+1]-C1[i-1]*Vp[i-1])/(dC1p[i]+dC1m[i])/C1[i];
78  Et[i]=sqrt(E1[i]*E1[i]+E2[i]*E2[i]);
79  }
80 }
std::vector< double > dC1m
step length to previous point alone C1
Definition: Grid.h:21
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
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
std::vector< double > dC2p
step length to next point along C2
Definition: Grid.h:22
std::vector< double > Vp
potential at each point
Definition: Grid.h:15
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

§ ClassDef()

GeFiCa::RTheta::ClassDef ( RTheta  ,
 
)
protected

§ OverRelaxAt()

void RTheta::OverRelaxAt ( size_t  idx)
protectedvirtual

Over relax potential Vp[.

Parameters
idx].

Reimplemented from GeFiCa::Grid.

Definition at line 38 of file RTheta.cc.

39 {
40  if (fIsFixed[idx]) return; // no need to calculate on boundaries
41 
42  double vnew=Src[idx]*dC1m[idx]*dC1p[idx]/2+(1/C1[idx]*(Vp[idx+1]-Vp[idx-1])
43  +Vp[idx+1]/dC1p[idx]+Vp[idx-1]/dC1m[idx])/(1/dC1m[idx]+1/dC1p[idx]);
44  vnew=RelaxationFactor*(vnew-Vp[idx])+Vp[idx];
45 
46  // check depletion and update Vp[idx] accordingly
47  double min=Vp[idx-1], max=Vp[idx-1];
48  if (min>Vp[idx+1]) min=Vp[idx+1];
49  if (max<Vp[idx+1]) max=Vp[idx+1];
50  if (vnew<min) {
51  fIsDepleted[idx]=false; Vp[idx]=min;
52  } else if (vnew>max) {
53  fIsDepleted[idx]=false; Vp[idx]=max;
54  } else {
55  fIsDepleted[idx]=true; Vp[idx]=vnew;
56  }
57 
58  // update Vp for impurity-only case even if the point is undepleted
59  if (Vp[0]==Vp[N1-1]) Vp[idx]=vnew;
60 }
std::vector< double > dC1m
step length to previous point alone C1
Definition: Grid.h:21
std::vector< bool > fIsFixed
true if field values are fixed
Definition: Grid.h:128
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< bool > fIsDepleted
true if a grid point is depleted
Definition: Grid.h:129
std::vector< double > Vp
potential at each point
Definition: Grid.h:15
std::vector< double > C1
the 1st coordinates of the points
Definition: Grid.h:12
double RelaxationFactor
within (0,2), used to speed up convergence
Definition: Grid.h:58

§ SetupWith()

void RTheta::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 RTheta.cc.

7 {
8  Grid::SetupWith(detector); // check number of calls
9 
10  TString type(detector.ClassName());
11  if (type.Contains("Hemispherical")==false) {
12  Error("SetupWith", "%s is not expected. "
13  "Please pass in a Hemispherical detector.", type.Data());
14  abort();
15  }
16  Hemispherical& hemi = (Hemispherical&) detector;
17  hemi.CheckConfigurations();
18  fDetector = &detector; // for GetC to use fDetector->Bias[]
19 
20  double dR=hemi.Height-hemi.PointContactR;
21  for (size_t i=0; i<N1; i++) {
22  dC1p.push_back(dR/(N1-1)); dC1m.push_back(dR/(N1-1));
23  C1.push_back(hemi.PointContactR+i*dC1p[i]);
24  E1.push_back(0); Et.push_back(0);
25  fIsFixed.push_back(false); fIsDepleted.push_back(false);
26  Src.push_back(-hemi.GetImpurity(C1[i])*Qe/epsilon);
27  }
28  dC1m[0]=0; dC1p[N1-1]=0;
29  // fix 1st and last points
30  fIsFixed[0]=true; fIsFixed[N1-1]=true;
31  // linear interpolation between Bias[0] and Bias[1]
32  double slope = (hemi.Bias[1]-hemi.Bias[0])/(N1-1);
33  for (size_t i=0; i<N1; i++) Vp.push_back(hemi.Bias[0]+slope*i);
34  Vp[N1-1]=hemi.Bias[1];
35 }
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
Configuration of hemispherical detectors.
Definition: Hemispherical.h:9
std::vector< bool > fIsFixed
true if field values are fixed
Definition: Grid.h:128
std::vector< double > E1
projection of Et on C1
Definition: Grid.h:17
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
virtual void SetupWith(Detector &detector)
Fix potentials on boundaries based on.
Definition: Grid.cc:111
std::vector< double > dC1p
step length to next point alone C1
Definition: Grid.h:20
double Height
height of crystal
Definition: Detector.h:13
double PointContactR
radius of point contact
Definition: Hemispherical.h:12
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:129
Detector * fDetector
! Pointer to associated detector object
Definition: Grid.h:131
double GetImpurity(double height)
Return net impurity concentration at.
Definition: Detector.h:20
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 > Et
total electric field strength
Definition: Grid.h:16
std::vector< double > C1
the 1st coordinates of the points
Definition: Grid.h:12

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