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

2D cylindrical coordinates in rho-z plane. More...

#include <RhoZ.h>

Inheritance diagram for GeFiCa::RhoZ:
GeFiCa::Grid GeFiCa::Points

Public Member Functions

 RhoZ (size_t n1=200, size_t n2=201)
 
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, 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

void OverRelaxAt (size_t idx)
 Over relax potential Vp[. More...
 
void GetInfoFrom (Segmented &detector)
 
void GetInfoFrom (PointContact &detector)
 
void ReallocateGridPointsNearBoundaries (PointContact &detector)
 
void CalculateE ()
 Calculate Et, E1, E2, E3 from Vp. More...
 
 ClassDef (RhoZ, 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 cylindrical coordinates in rho-z plane.

Examples:
pointContact/calculateFields.cc, pointContact/checkInitialization.cc, pointContact/drawFields.cc, and pointContact/optimizeRelaxationFactor.cc.

Definition at line 9 of file RhoZ.h.

Constructor & Destructor Documentation

§ RhoZ()

GeFiCa::RhoZ::RhoZ ( size_t  n1 = 200,
size_t  n2 = 201 
)
inline

Definition at line 12 of file RhoZ.h.

12  : Grid(n1, n2) {
13  fName="rhoz"; fTitle="2D cylindrical coordinates in rho-z"; }
Grid(size_t n1=0, size_t n2=0, size_t n3=0)
Default constructor.
Definition: Grid.cc:26

Member Function Documentation

§ CalculateE()

void RhoZ::CalculateE ( )
protectedvirtual

Calculate Et, E1, E2, E3 from Vp.

Reimplemented from GeFiCa::Grid.

Definition at line 292 of file RhoZ.cc.

293 {
294  Grid::CalculateE(); // deal with E1
295  for (size_t i=0; i<GetN(); i++) { // deal with E2
296  if (i<N1) E2[i]=-(Vp[i+N1]-Vp[i])/dC2p[i]; // lower boundary
297  else if (i>GetN()-N1) E2[i]=-(Vp[i]-Vp[i-N1])/dC2m[i]; // upper boundary
298  else E2[i]=-(Vp[i+N1]-Vp[i-N1])/(dC2p[i]+dC2m[i]); // the rest
299  if (i%N1==0) E1[i]=-(Vp[i+1]-Vp[i])/dC1p[i]; // left boundary
300  if ((i+1)%N1==0) E1[i]=-(Vp[i]-Vp[i-1])/dC1m[i]; // right boundary
301  Et[i]=sqrt(E1[i]*E1[i]+E2[i]*E2[i]);
302  }
303 }
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 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
virtual void CalculateE()
Calculate Et, E1, E2, E3 from Vp.
Definition: Grid.cc:551
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

§ ClassDef()

GeFiCa::RhoZ::ClassDef ( RhoZ  ,
 
)
protected

§ GetC()

double RhoZ::GetC ( )

Definition at line 90 of file RhoZ.cc.

91 {
92  Grid::GetC(); // calculate field excluding undepleted region
93 
94  // calculate C based on CV^2/2 = epsilon int E^2 dx^3 / 2
96  double dV=pc.Bias[0]-pc.Bias[1]; if(dV<0)dV=-dV;
97  double SumofElectricField=0;
98  for(size_t i=0;i<GetN();i++) {
99  double e1=E1[i];
100  double e2=E2[i];
101  double dr=dC1p[i];
102  double dz=dC2p[i];
103  SumofElectricField+=(e1*e1+e2*e2)*C1[i]*dr*dz;
104  }
105  double c=SumofElectricField*2*3.14159*epsilon/dV/dV;
106  Info("GetC","%.2f pF",c/pF);
107  return c;
108 }
std::vector< double > Bias
bias on electrodes
Definition: Detector.h:35
Configuration of point contact detectors.
Definition: PointContact.h:9
std::vector< double > E1
projection of Et on C1
Definition: Grid.h:17
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:131
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() [1/2]

void GeFiCa::RhoZ::GetInfoFrom ( Segmented detector)
inlineprotected

Definition at line 18 of file RhoZ.h.

18 {};

§ GetInfoFrom() [2/2]

void RhoZ::GetInfoFrom ( PointContact detector)
protected

Definition at line 111 of file RhoZ.cc.

112 {
113  // set positions of grid points
114  for (size_t i=0; i<N1; i++) { // bottom line
115  dC1p.push_back(2*pc.Radius/(N1-1)); dC1m.push_back(2*pc.Radius/(N1-1));
116  dC2p.push_back(pc.Height/(N2-1));
117  dC2m.push_back(pc.Height/(N2-1)); // there are mirrored points below
118  C1.push_back(-pc.Radius+i*dC1p[i]); C2.push_back(0);
119  E1.push_back(0); E2.push_back(0); Et.push_back(0); Vp.push_back(0);
120  fIsFixed.push_back(false); fIsDepleted.push_back(false);
121  Src.push_back(-pc.GetImpurity(C2[i])*Qe/epsilon);
122  }
123  for (size_t i=N1; i<N1*N2; i++) { // the rest
124  dC1p.push_back(2*pc.Radius/(N1-1)); dC1m.push_back(2*pc.Radius/(N1-1));
125  dC2p.push_back(pc.Height/(N2-1)); dC2m.push_back(pc.Height/(N2-1));
126  C1.push_back(C1[i-N1]); C2.push_back(C2[i-N1]+dC2p[i-N1]);
127  E1.push_back(0); E2.push_back(0); Et.push_back(0); Vp.push_back(0);
128  fIsFixed.push_back(false); fIsDepleted.push_back(false);
129  Src.push_back(-pc.GetImpurity(C2[i])*Qe/epsilon);
130  }
131  // set impurity in groove and potentials of grid points
132  size_t npc=0; // number of grid points in PC
133  for (size_t i=N1*N2; i-->0;) {
134  if (C1[i]>=-pc.PointContactR && C1[i]<=pc.PointContactR
135  && C2[i]<=pc.PointContactH) { // point contact
136  Vp[i]=pc.Bias[0]; fIsFixed[i]=true; npc++;
137  } else if (C1[i]<=pc.BoreR && C1[i]>=-pc.BoreR
138  && C2[i]>=pc.Height-pc.BoreH) { // bore hole
139  Vp[i]=pc.Bias[1]; fIsFixed[i]=true;
140  } else if (((C1[i]>pc.WrapAroundR-pc.GrooveW && C1[i]<pc.WrapAroundR)
141  || (C1[i]>-pc.WrapAroundR && C1[i]<-pc.WrapAroundR+pc.GrooveW))
142  && C2[i]<pc.GrooveH) { // groove
143  Vp[i]=pc.Bias[1]/4; Src[i]=0;
144  } else // bulk
145  Vp[i]=(pc.Bias[0]+pc.Bias[1])/2;
146  double slope, intercept;
147  if (pc.CornerW>0) { // has top taper
148  slope=-pc.CornerH/pc.CornerW;
149  intercept=pc.Height-slope*(pc.Radius-pc.CornerW);
150  if (C2[i]>-slope*C1[i]+intercept||C2[i]>slope*C1[i]+intercept) {
151  Vp[i]=pc.Bias[1]; fIsFixed[i]=true;
152  }
153  }
154  if (pc.TaperW>0) { // has bottom taper
155  slope=pc.TaperH/(pc.TaperW);
156  intercept=-(pc.Radius-pc.TaperW)*slope;
157  if (C2[i]<=C1[i]*slope+intercept || C2[i]<=-C1[i]*slope+intercept) {
158  Vp[i]=pc.Bias[1]; fIsFixed[i]=true;
159  }
160  }
161  if (pc.BoreTaperW>0) { // has bore taper
162  slope=pc.BoreTaperH/pc.BoreTaperW;
163  intercept=pc.Height-slope*(pc.BoreR+pc.BoreTaperW);
164  if ((C2[i]>-slope*C1[i]+intercept && C1[i]<=-pc.BoreR) ||
165  (C2[i]>slope*C1[i]+intercept && C1[i]>=pc.BoreR)) {
166  Vp[i]=pc.Bias[1]; fIsFixed[i]=true;
167  }
168  }
169  }
170  if (npc<1) { Error("GetInfoFrom", "no point in point contact!"); abort(); }
171  for (size_t i=N1*N2-1; i>=N1*N2-N1; i--) { // top boundary
172  Vp[i]=pc.Bias[1]; fIsFixed[i]=true; dC2p[i]=0;
173  }
174  for (size_t i=0; i<=N1*N2-N1; i=i+N1) { // left & right boundaries
175  Vp[i]=pc.Bias[1]; Vp[i+N1-1]=pc.Bias[1];
176  fIsFixed[i]=true; fIsFixed[i+N1-1]=true;
177  dC1m[i]=0; dC1p[i+N1-1]=0;
178  }
179  for (size_t i=0; i<N1; i++) { // bottom boundary
180  dC2m[i]=0;
181  if (C1[i]>=pc.WrapAroundR||C1[i]<=-pc.WrapAroundR) {// wrap arround
182  fIsFixed[i]=true;
183  Vp[i]=pc.Bias[1];
184  }
185  }
186 
188 }
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 > 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 > 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:129
std::vector< double > dC2p
step length to next point along C2
Definition: Grid.h:22
void ReallocateGridPointsNearBoundaries(PointContact &detector)
Definition: RhoZ.cc:191
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 > E2
projection of Et on C2
Definition: Grid.h:18
std::vector< double > C1
the 1st coordinates of the points
Definition: Grid.h:12

§ OverRelaxAt()

void RhoZ::OverRelaxAt ( size_t  idx)
protectedvirtual

Over relax potential Vp[.

Parameters
idx].

Reimplemented from GeFiCa::Grid.

Definition at line 45 of file RhoZ.cc.

46 {
47  if (fIsFixed[idx]) return; // no need to calculate on boundaries
48 
49  // setup potential differences
50  double drm=dC1m[idx]!=0?dC1m[idx]:dC1p[idx]; // dr_minus
51  double drp=dC1p[idx]!=0?dC1p[idx]:dC1m[idx];
52  double dzm=dC2m[idx]!=0?dC2m[idx]:dC2p[idx];
53  double dzp=dC2p[idx]!=0?dC2p[idx]:dC2m[idx]; // dz_plus
54 
55  // setup potential for boundary points
56  double vzm,vzp,vrm,vrp; // vzm: v_z_minus
57  if (idx>=N1) vzm=Vp[idx-N1];
58  else vzm=Vp[idx+N1]; // mirroring potential for bottom boundary points
59  if (idx>=N1*N2-N1) vzp=Vp[idx]; // set potential for top boundary points
60  else vzp=Vp[idx+N1];
61  if (idx%N1==0) vrm=Vp[idx]; // set potential for left boundary points
62  else vrm=Vp[idx-1];
63  if (idx%N1==N1-1) vrp=Vp[idx]; // set potential for right boundary points
64  else vrp=Vp[idx+1];
65 
66  // update potential
67  double vnew = (Src[idx] + 1/C1[idx]*(vrp-vrm)/(drm+drp)
68  + (vrp/drp+vrm/drm)*2/(drm+drp) + (vzp/dzp+vzm/dzm)*2/(dzp+dzm))
69  /((1/drm+1/drp)*2/(drm+drp) + (1/dzp+1/dzm)*2/(dzp+dzm));
70  vnew = RelaxationFactor*(vnew-Vp[idx])+Vp[idx]; // over relax
71 
72  // update Vp for impurity-only case even if the point is undepleted
73  if (fDetector->Bias[0]==fDetector->Bias[1]) { Vp[idx]=vnew; return; }
74 
75  // check depletion
76  fIsDepleted[idx]=false; // default
77  //find minimal potential in all neighboring points
78  double vmin=vrm; // minimal Vp around point[idx]
79  if (vmin>vrp) vmin=vrp; if (vmin>vzp) vmin=vzp; if (vmin>vzm) vmin=vzm;
80  //find maximal potential in all neighboring points
81  double vmax=vrm; // maximal Vp around point[idx]
82  if (vmax<vrp) vmax=vrp; if (vmax<vzp) vmax=vzp; if (vmax<vzm) vmax=vzm;
83  //if vnew is greater or smaller than vmax and vmin, set vnew to it.
84  if (vnew<vmin) Vp[idx]=vmin;
85  else if(vnew>vmax) Vp[idx]=vmax;
86  else { Vp[idx]=vnew; fIsDepleted[idx]=true; } // vmin<vnew<vmax
87 }
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:128
size_t N2
number of points along the 2nd coordinate
Definition: Grid.h:54
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:129
Detector * fDetector
! Pointer to associated detector object
Definition: Grid.h:131
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 > 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

§ ReallocateGridPointsNearBoundaries()

void RhoZ::ReallocateGridPointsNearBoundaries ( PointContact detector)
protected

Definition at line 191 of file RhoZ.cc.

192 {
193  double slope, intercept;
194  for (size_t i=0; i<GetN(); i++) {
195  if (C2[i]-pc.PointContactH<dC2m[i] && C2[i]>pc.PointContactH
196  && C1[i]<(pc.PointContactR+1e-4*mm) && C1[i]>-(pc.PointContactR+1e-4*mm)) {
197  dC2m[i]=C2[i]-pc.PointContactH; // top of point contact
198  // since C2[i] is too close to boundary, we regard it as on the boundary
199  // Fixme: same protection should be applied to other boundaries
200  if (dC2m[i]<1e-4*mm) { Vp[i]=pc.Bias[0]; fIsFixed[i]=true; }
201  }
202  if (C1[i]-pc.PointContactR<dC1m[i]&&C1[i]>pc.PointContactR
203  &&C2[i]<pc.PointContactH+1e-4*mm) {
204  dC1m[i]=C1[i]-pc.PointContactR; // right of point contact
205  if (dC1m[i]<1e-4*mm) { Vp[i]=pc.Bias[0]; fIsFixed[i]=true; }
206  }
207  if (-C1[i]-pc.PointContactR<dC1p[i]&&C1[i]<-pc.PointContactR
208  &&C2[i]<pc.PointContactH+1e-4*mm) {
209  dC1p[i]=-C1[i]-pc.PointContactR; // left of point contact
210  if (dC1p[i]<1e-4*mm) { Vp[i]=pc.Bias[0]; fIsFixed[i]=true; }
211  }
212  if (C1[i]-pc.BoreR>0&&C1[i]-pc.BoreR<dC1m[i]
213  &&C2[i]>pc.Height-pc.BoreH-1e-4*mm){ //right side of bore
214  dC1m[i]=C1[i]-pc.BoreR;
215  if (dC1m[i]<1e-4*mm) { Vp[i]=pc.Bias[0]; fIsFixed[i]=true; }
216  }
217  if (-C1[i]-pc.BoreR>0&&-C1[i]-pc.BoreR<dC1p[i]
218  &&C2[i]>=pc.Height-pc.BoreH-1e-4*mm){ //left side of bore
219  dC1p[i]=-C1[i]-pc.BoreR;
220  if (dC1p[i]<1e-4*mm) { Vp[i]=pc.Bias[0]; fIsFixed[i]=true; }
221  }
222  //down side of bore
223  if (pc.Height-pc.BoreH-1e-4*mm-C2[i]>0 && pc.Height-pc.BoreH-C2[i]<dC2p[i]
224  && C1[i]>-pc.BoreR-1e-4*mm && C1[i]<pc.BoreR+1e-4*mm) {
225  dC2p[i]=pc.Height-pc.BoreH-C2[i];
226  if (dC2p[i]<1e-4*mm) { Vp[i]=pc.Bias[1]; fIsFixed[i]=true; }
227  }
228  // Fixme: V around groove bounaries are all changable,
229  // which should be reallocated?
230  if (pc.WrapAroundR-C1[i]<dC1p[i]&&C1[i]<pc.WrapAroundR&&i<N1)
231  dC1p[i]=pc.WrapAroundR-C1[i];
232  if (pc.WrapAroundR+C1[i]<dC1p[i]&&C1[i]>-pc.WrapAroundR&&i<N1)
233  dC1m[i]=pc.WrapAroundR+C1[i];
234  if (pc.CornerW>0) { // has top taper
235  slope=-pc.CornerH/pc.CornerW;
236  intercept=pc.Height-slope*(pc.Radius-pc.CornerW);
237  if (C1[i]+C2[i]/slope-intercept/slope>0 &&
238  C1[i]+C2[i]/slope-intercept/slope<dC1m[i] &&
239  C2[i]>pc.Height-pc.CornerH) // left
240  dC1m[i]=C1[i]+C2[i]/slope-intercept/slope;
241  if (-C1[i]+C2[i]/slope-intercept/slope>0 &&
242  -C1[i]+C2[i]/slope-intercept/slope<dC1p[i] &&
243  C2[i]>pc.Height-pc.CornerH) // right
244  dC1p[i]=-C1[i]+C2[i]/slope-intercept/slope;
245  if((C1[i]*slope+intercept)-C2[i]<dC2p[i] &&
246  C1[i]>pc.Radius-pc.CornerW&&(C1[i]*slope+intercept)-C2[i]>0)
247  dC2p[i]=(C1[i]*slope+intercept)-C2[i];
248  if((-C1[i]*slope+intercept)-C2[i]<dC2p[i] &&
249  C1[i]<-pc.Radius+pc.CornerW&&(-C1[i]*slope+intercept)-C2[i]>0)
250  dC2p[i]=(-C1[i]*slope+intercept)-C2[i];
251  }
252  if (pc.TaperW>0) { // has bottom taper
253  slope=pc.TaperH/pc.TaperW;
254  intercept=-(pc.Radius-pc.TaperW)*slope;
255  if (C2[i]-(slope*C1[i]+intercept)<dC2m[i]
256  && C2[i]-(slope*C1[i]+intercept)>0 && i>=N1-1) // right side, C2
257  dC2m[i]=C2[i]-(slope*C1[i]+intercept );
258  if ((C2[i]-intercept)/slope-C1[i]<dC1p[i]
259  && (C2[i]-intercept)/slope-C1[i]>0) // right side, C1
260  dC1p[i]=(C2[i]-intercept)/slope-C1[i];
261  if (C2[i]-(-slope*C1[i]+intercept)<dC2m[i]
262  && C2[i]-(-slope*C1[i]+intercept)>0 && i>=N1-1) // left side, C2
263  dC2m[i]=C2[i]-(-slope*C1[i]+intercept);
264  if (C1[i]+(C2[i]-intercept)/slope<dC1m[i]
265  && C1[i]+(C2[i]-intercept)/slope>0) // left side, C1
266  dC1m[i]=C1[i]+(C2[i]-intercept)/slope;
267  }
268  if (pc.BoreTaperW>0) { // has bore taper
269  slope=pc.BoreTaperH/pc.BoreTaperW;
270  intercept=pc.Height-slope*(pc.BoreR+pc.BoreTaperW);
271  if (C1[i]-C2[i]/slope+intercept/slope<dC1m[i] &&
272  C2[i]>pc.Height-pc.BoreTaperH &&
273  C1[i]-C2[i]/slope+intercept/slope>0) //right side of hole taper
274  dC1m[i]=C1[i]-C2[i]/slope+intercept/slope;
275  if (-C1[i]-C2[i]/slope+intercept/slope>0 &&
276  -C1[i]-C2[i]/slope+intercept/slope<dC1p[i] &&
277  C2[i]>pc.Height-pc.BoreTaperH) //left side of hole taper
278  dC1p[i]=-C1[i]-C2[i]/slope+intercept/slope;
279  if((C1[i]*slope+intercept)-C2[i]<dC2p[i] &&
280  C1[i]<pc.BoreR+pc.BoreTaperW && C1[i]>pc.BoreR
281  && (C1[i]*slope+intercept)-C2[i]>0) // right side of hole taper
282  dC2p[i]=(C1[i]*slope+intercept)-C2[i];
283  if((-C1[i]*slope+intercept)-C2[i]<dC2p[i] &&
284  C1[i]>-pc.BoreR-pc.BoreTaperW && C1[i]<-pc.BoreR
285  && (-C1[i]*slope+intercept)-C2[i]>0) // left side of hole taper
286  dC2p[i]=(-C1[i]*slope+intercept)-C2[i];
287  }
288  }
289 }
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
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
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 mm
minimeter
Definition: Units.h:15
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 > C1
the 1st coordinates of the points
Definition: Grid.h:12

§ SetupWith()

void RhoZ::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.

Examples:
pointContact/calculateFields.cc, pointContact/checkInitialization.cc, and pointContact/optimizeRelaxationFactor.cc.

Definition at line 7 of file RhoZ.cc.

8 {
9  Grid::SetupWith(detector); // check number of calls
10 
11  TString type(detector.ClassName());
12  if (type.Contains("PointContact")) {
13  if (N1%2==1) { // we want no grid point right on z-axis
14  Error("SetupWith",
15  "Please assign even number of grid points along radius.");
16  abort();
17  }
18  PointContact& pc = (PointContact&) detector;
20  GetInfoFrom(pc);
21  }
22  else if (type.Contains("Segmented"))
23  {
24  if (N1%2==1) { // we want no grid point right on z-axis
25  Error("SetupWith",
26  "Please assign even number of grid points along radius.");
27  abort();
28  }
29  Segmented & se = (Segmented &) detector;
31  GetInfoFrom(se);
32 
33  }
34  else {
35  Error("SetupWith", "%s is not expected.", type.Data());
36  Error("SetupWith", "Please use "
37  "PointContact or Segmented detector.");
38  abort();
39  }
40 
41  fDetector = &detector; // for GetC to use fDetector->Bias[]
42 }
Configuration of point contact detectors.
Definition: PointContact.h:9
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
Configuration of segmented true coaxial detectors.
Definition: Segmented.h:11
Detector * fDetector
! Pointer to associated detector object
Definition: Grid.h:131
void GetInfoFrom(Segmented &detector)
Definition: RhoZ.h:18
void CheckConfigurations()
Definition: Segmented.cc:11

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