GeFiCa
Germanium detector Field Calculator
RhoPhi.cc
Go to the documentation of this file.
1 #include "Units.h"
2 #include "RhoPhi.h"
3 #include "Segmented.h"
4 using namespace GeFiCa;
5 
6 void RhoPhi::SetupWith(Detector &detector)
7 {
8  Grid::SetupWith(detector); // check number of calls
9 
10  TString type(detector.ClassName());
11  if (type.Contains("Segmented")==false) {
12  Error("SetupWith", "%s is not expected. "
13  "Please pass in a Segmented detector.", type.Data());
14  abort();
15  }
16  Segmented& sip = (Segmented&) detector;
17  sip.CheckConfigurations();
18  fDetector = &detector; // for GetC to use fDetector->Bias[]
19 
20  double dR=sip.Radius-sip.BoreR;
21  for (size_t i=0; i<N1*N2; i++) {
22  dC1p.push_back(dR/(N1-1)); dC1m.push_back(dR/(N1-1));
23  dC2p.push_back(2*Pi/N2); dC2m.push_back(2*Pi/N2);
24  C1.push_back(sip.BoreR+i%N1*dC1p[i]); C2.push_back(i/N1*2*Pi/N2);
25  E1.push_back(0); E2.push_back(0); Et.push_back(0); Vp.push_back(0);
26  fIsFixed.push_back(false); fIsDepleted.push_back(false);
27  Src.push_back(-sip.TopImpurity*Qe/epsilon);
28  // fine tuning
29  if (i%N1==0) { // inner surface
30  dC1m[i]=0; fIsFixed[i]=true; Vp[i]=sip.Bias[0];
31  } else if ((i+1)%N1==0) { // outer surface
32  dC1p[i]=0; fIsFixed[i]=true;
33  if (C2[i]>=2*Pi/sip.Nphi*(sip.SegmentId-1)
34  && C2[i]<=2*Pi/sip.Nphi*sip.SegmentId)
35  Vp[i]=sip.Bias[1]; // weighting potential for the selected segment
36  else Vp[i]=sip.Bias[0]; // weighting potential for other segments
37  } else
38  Vp[i]=(sip.Bias[0]+sip.Bias[1])/2;
39  }
40 }
41 //______________________________________________________________________________
42 //
43 void RhoPhi::OverRelaxAt(size_t idx)
44 {
45  if (fIsFixed[idx]) return; // no need to calculate on boundaries
46 
47  double vphip=Vp[idx+N1],vphim=Vp[idx-N1]; // v_phi_+/-
48  double vrhop=Vp[idx+1],vrhom=Vp[idx-1]; // v_rho_+/-
49  if (idx<N1) vphim=Vp[idx+GetN()-N1]; // phi==0 line
50  if (idx>=GetN()-N1) vphip=Vp[idx-GetN()+N1]; // phi==2pi line
51  double vnew = (vrhop/(dC1p[idx]*(dC1m[idx]+dC1p[idx]))
52  +vrhom/(dC1m[idx]*(dC1m[idx]+dC1p[idx]))
53  +vphip/C1[idx]/C1[idx]/dC2m[idx]/(dC2p[idx]+dC2m[idx])
54  +vphim/C1[idx]/C1[idx]/dC2p[idx]/(dC2p[idx]+dC2m[idx])
55  -Src[idx]/2+(vrhop-vrhom)/2/C1[idx]/(dC1m[idx]+dC1p[idx]))
56  /(1/dC1p[idx]/(dC1m[idx]+dC1p[idx])+1/dC1m[idx]/(dC1m[idx]+dC1p[idx])
57  +1/C1[idx]/C1[idx]/dC2p[idx]/(dC2p[idx]+dC2m[idx])
58  +1/C1[idx]/C1[idx]/dC2m[idx]/(dC2p[idx]+dC2m[idx]));
59  vnew=RelaxationFactor*(vnew-Vp[idx])+Vp[idx]; // over relex
60 
61  double vmin=vrhom; // minimal Vp around point[idx]
62  if (vmin>vrhop) vmin=vrhop;
63  if (vmin>vphip) vmin=vphip;
64  if (vmin>vphim) vmin=vphim;
65 
66  double vmax=vrhom; // maximal Vp around point[idx]
67  if (vmax<vrhop) vmax=vrhop;
68  if (vmax<vphip) vmax=vphip;
69  if (vmax<vphim) vmax=vphim;
70 
71  if (vnew<vmin) {
72  Vp[idx]=vmin; fIsDepleted[idx]=false;
73  } else if (vnew>vmax) {
74  Vp[idx]=vmax; fIsDepleted[idx]=false;
75  } else {
76  Vp[idx]=vnew; fIsDepleted[idx]=true;
77  }
78  // update Vp for impurity-only case even if the point is undepleted
79  if (fDetector->Bias[0]==fDetector->Bias[1]) Vp[idx]=vnew;
80 }
81 //______________________________________________________________________________
82 //
84 {
85  Grid::CalculateE(); // deal with E1
86  for (size_t i=0; i<GetN(); i++) { // deal with E2
87  E2[i]=(Vp[i+N1]-Vp[i-N1])/(dC2p[i]+dC2m[i])/C1[i];
88  if (i<N1) E2[i]=(Vp[i+N1]-Vp[i])/dC2p[i]/C1[i]; // lower boundary
89  if (i>GetN()-N1) E2[i]=(Vp[i]-Vp[i-N1])/dC2m[i]/C1[i]; // upper boundary
90  if (i%N1==0) E1[i]=(Vp[i+1]-Vp[i])/dC1p[i]/C1[i]; // left boundary
91  if ((i+1)%N1==0) E1[i]=(Vp[i]-Vp[i-1])/dC1m[i]/C1[i]; // right boundary
92  Et[i]=sqrt(E1[i]*E1[i]+E2[i]*E2[i]);
93  }
94 }
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
size_t Nphi
total number of segments in phi
Definition: Segmented.h:16
void SetupWith(Detector &detector)
Fix potentials on boundaries based on.
Definition: RhoPhi.cc:6
static const double Pi
Definition: Units.h:29
double Radius
radius of the crystal
Definition: Segmented.h:14
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
size_t SegmentId
segment Id in [0, Nphi*Nz]
Definition: Segmented.h:18
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
virtual void SetupWith(Detector &detector)
Fix potentials on boundaries based on.
Definition: Grid.cc:111
Configuration of segmented true coaxial detectors.
Definition: Segmented.h:11
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
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
void CalculateE()
Calculate Et, E1, E2, E3 from Vp.
Definition: RhoPhi.cc:83
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
double BoreR
radius of the bore hole
Definition: Segmented.h:15
std::vector< double > dC2p
step length to next point along C2
Definition: Grid.h:22
A file defining commonly used units & constants.
void OverRelaxAt(size_t idx)
Over relax potential Vp[.
Definition: RhoPhi.cc:43
virtual void CalculateE()
Calculate Et, E1, E2, E3 from Vp.
Definition: Grid.cc:551
void CheckConfigurations()
Definition: Segmented.cc:11
std::vector< double > Vp
potential at each point
Definition: Grid.h:15
double TopImpurity
net impurity concentration at top of crystal
Definition: Detector.h:14
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 > E2
projection of Et on C2
Definition: Grid.h:18
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