GeFiCa
Germanium detector Field Calculator
X.cc
Go to the documentation of this file.
1 #include "X.h"
2 #include "Units.h"
3 #include "Planar.h"
4 using namespace GeFiCa;
5 
6 void X::SetupWith(Detector &detector)
7 {
8  Grid::SetupWith(detector); // check number of calls
9 
10  TString type(detector.ClassName());
11  if (type.Contains("Planar")==false) {
12  Error("SetupWith", "%s is not expected. "
13  "Please pass in a Planar detector.", type.Data());
14  abort();
15  }
16  Planar& planar = (Planar&) detector;
17  planar.CheckConfigurations();
18  fDetector = &detector; // for GetC to use fDetector->Bias[]
19 
20  for (size_t i=0; i<N1; i++) {
21  dC1p.push_back(planar.Height/(N1-1));
22  dC1m.push_back(planar.Height/(N1-1));
23  C1.push_back(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(-planar.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 = (planar.Bias[1]-planar.Bias[0])/(N1-1);
33  for (size_t i=0; i<N1; i++) Vp.push_back(planar.Bias[0]+slope*i);
34  Vp[N1-1]=planar.Bias[1];
35 }
36 //______________________________________________________________________________
37 //
39 {
40  Grid::SolveAnalytically(); // check if impurity is constant
41  double h=C1[N1-1]-C1[0];
42  double a=-Src[0]/2;
43  double b=(Vp[N1-1]-Vp[0]-a*h*h)/h;
44  double c=Vp[0];
45  for (size_t i=0; i<N1; i++) Vp[i] = a*C1[i]*C1[i]+b*C1[i]+c;
46  CalculateE();
47 }
48 //______________________________________________________________________________
49 //
50 double X::GetC()
51 {
52  Grid::GetC(); // calculate field excluding undepleted region
53 
54  double dV = fDetector->Bias[1]-fDetector->Bias[0]; if (dV<0) dV=-dV;
55  double integral=0;
56  for (size_t i=0; i<GetN(); i++) {
57  integral+=E1[i]*E1[i]*dC1p[i];
58  if (!fIsDepleted[i]) fIsFixed[i]=false; // release undepleted points
59  }
60  double c=integral*epsilon/dV/dV;
61  Info("GetC","%.2f pF/cm2",c/pF*cm2);
62  return c;
63 }
64 //______________________________________________________________________________
65 //
66 void X::OverRelaxAt(size_t idx)
67 {
68  if (fIsFixed[idx]) return; // no need to calculate on boundaries
69 
70  // calculate Vp[idx] from Vp[idx-1] and Vp[idx+1]
71  double vnew = Src[idx]*dC1m[idx]*dC1p[idx]/2 +
72  (dC1p[idx]*Vp[idx-1]+dC1m[idx]*Vp[idx+1])/(dC1m[idx]+dC1p[idx]);
73  vnew = RelaxationFactor*(vnew-Vp[idx]) + Vp[idx]; // over relax
74 
75  // check depletion and update Vp[idx] accordingly
76  double min=Vp[idx-1], max=Vp[idx-1];
77  if (min>Vp[idx+1]) min=Vp[idx+1];
78  if (max<Vp[idx+1]) max=Vp[idx+1];
79  if (vnew<min) {
80  fIsDepleted[idx]=false; Vp[idx]=min;
81  } else if (vnew>max) {
82  fIsDepleted[idx]=false; Vp[idx]=max;
83  } else {
84  fIsDepleted[idx]=true; Vp[idx]=vnew;
85  }
86 
87  // update Vp for impurity-only case even if the point is undepleted
88  if (Vp[0]==Vp[N1-1]) Vp[idx]=vnew;
89 }
std::vector< double > dC1m
step length to previous point alone C1
Definition: Grid.h:21
Configuration of planar detectors.
Definition: Planar.h:9
void OverRelaxAt(size_t idx)
Over relax potential Vp[.
Definition: X.cc:66
void CheckConfigurations()
Definition: Planar.cc:10
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
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
void SolveAnalytically()
Solve Poisson&#39;s Equation analytically.
Definition: Grid.cc:154
virtual void SetupWith(Detector &detector)
Fix potentials on boundaries based on.
Definition: Grid.cc:111
double GetC()
Definition: X.cc:50
Detector & crystal properties.
Definition: Detector.h:32
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
double Height
height of crystal
Definition: Detector.h:13
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
Detector * fDetector
! Pointer to associated detector object
Definition: Grid.h:132
void SolveAnalytically()
Definition: X.cc:38
A file defining commonly used units & constants.
static const double pF
pico farad
Definition: Units.h:22
static const double cm2
centimeter squared
Definition: Units.h:13
double GetImpurity(double height)
Return net impurity concentration at.
Definition: Detector.h:20
virtual void CalculateE()
Calculate Et, E1, E2, E3 from Vp.
Definition: Grid.cc:551
void SetupWith(Detector &detector)
Fix potentials on boundaries based on.
Definition: X.cc:6
double GetC()
Get detector capacitance.
Definition: Grid.cc:198
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
The only namespace in GeFiCa.
Definition: Detector.h:6
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
double RelaxationFactor
within (0,2), used to speed up convergence
Definition: Grid.h:58