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

3D coordinates. More...

#include <XYZ.h>

Inheritance diagram for GeFiCa::XYZ:
GeFiCa::Grid GeFiCa::Points

Public Member Functions

 XYZ (int N1=50, int N2=50, int N3=50)
 Default constructor. More...
 
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 (SquarePointContact &detector)
 
void CalculateE ()
 Calculate Et, E1, E2, E3 from Vp. More...
 
void GeneralSetup (SquarePointContact &idetector)
 
 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 coordinates.

Definition at line 12 of file XYZ.h.

Constructor & Destructor Documentation

§ XYZ()

GeFiCa::XYZ::XYZ ( int  N1 = 50,
int  N2 = 50,
int  N3 = 50 
)
inline

Default constructor.

Definition at line 18 of file XYZ.h.

18  :Grid(N1,N2,N3) {fName="xyz",
19  fTitle="3D coordinates";}
Grid(size_t n1=0, size_t n2=0, size_t n3=0)
Default constructor.
Definition: Grid.cc:26
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
size_t N3
number of points along the 3rd coordinate
Definition: Grid.h:55

Member Function Documentation

§ CalculateE()

void XYZ::CalculateE ( )
protectedvirtual

Calculate Et, E1, E2, E3 from Vp.

Reimplemented from GeFiCa::Grid.

Definition at line 202 of file XYZ.cc.

203 {
204  for (size_t idx=0; idx<GetN(); idx++) {
205  double dxm=dC1m[idx];
206  double dxp=dC1p[idx];
207  double dym=dC2m[idx];
208  double dyp=dC2p[idx];
209  double dzm=dC3m[idx];
210  double dzp=dC3p[idx];
211  double pym,pyp,pxm,pxp,pzp,pzm;
212  if(idx<N1*N2)pzm=Vp[idx];
213  else pzm=Vp[idx-N1*N2];
214  if(idx>=N1*N2*N3-N1*N2)pzp=Vp[idx];
215  else pzp=Vp[idx+N1*N2];
216  if(idx%(N1*N2)>(N1*N2)-N1-1) pyp=Vp[idx];
217  else pyp=Vp[idx+N1];
218  if(idx%(N1*N2)<N1)pym=Vp[idx];
219  else pym=Vp[idx-N1];
220  if((idx%(N1*N2))%N1==N1-1)pxp=Vp[idx];
221  else pxp=Vp[idx+1];
222  if((idx%(N1*N2))%N1==0)pxm=Vp[idx];
223  else pxm=Vp[idx-1];
224  E1[idx]=(pxp-pxm)/(dxm+dxp);
225  E2[idx]=(pyp-pym)/(dym+dyp);
226  E3[idx]=(pzp-pzm)/(dzm+dzp);
227 
228  Et[idx]=sqrt(E1[idx]*E1[idx]+E2[idx]*E2[idx]+E3[idx]*E3[idx]);//overall E
229  }
230 }
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

§ GeneralSetup()

void XYZ::GeneralSetup ( SquarePointContact idetector)
protected

Definition at line 133 of file XYZ.cc.

134 {
135  double dx=detector.Width/(N1-1);
136  double dy=detector.Length/(N2-1);
137  double dz=detector.Height/(N3-1);
138 
139  //general setup
140  for(size_t i=0;i<N3;i++)
141  {
142  for(size_t j=0;j<N2;j++)
143  {
144  for(size_t k=0;k<N1;k++)
145  {
146  dC1p.push_back(dx);dC1m.push_back(dx);
147  dC2p.push_back(dy);dC2m.push_back(dy);
148  dC3p.push_back(dz);dC3m.push_back(dz);
149  C1.push_back(k*dx);
150  C2.push_back(j*dy);
151  C3.push_back(i*dz);
152  E1.push_back(0); E2.push_back(0); E3.push_back(0); Et.push_back(0);
153  Vp.push_back(0);
154  fIsFixed.push_back(false); fIsDepleted.push_back(false);
155  }
156  }
157  }
158  for(int i=0;i<N1*N2*N3;i++)
159  {
160  Src.push_back(-detector.GetImpurity(C3[i])*Qe/epsilon);
161  }
162 }
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: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 > 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:129
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

§ GetC()

double XYZ::GetC ( )

Definition at line 108 of file XYZ.cc.

109 {
110  //FIXME:function of integration need to be update for xyz
111  return -1;
112 
113 
114  Grid::GetC(); // calculate field excluding undepleted region
115 
116  // calculate C based on CV^2/2 = epsilon int E^2 dx^3 / 2
118  double dV=spc.Bias[0]-spc.Bias[1]; if(dV<0)dV=-dV;
119  double SumofElectricField=0;
120  for(size_t i=0;i<GetN();i++) {
121  double e1=E1[i];
122  double e2=E2[i];
123  double dr=dC1p[i];
124  double dz=dC2p[i];
125  SumofElectricField+=(e1*e1+e2*e2)*C1[i]*dr*dz;
126  }
127  double c=SumofElectricField*2*3.14159*epsilon/dV/dV;
128  Info("GetC","%.2f pF",c/pF);
129  return c;
130 }
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: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()

void XYZ::GetInfoFrom ( SquarePointContact detector)
protected

Definition at line 165 of file XYZ.cc.

166 {
167  //TODO
168  GeneralSetup(spc);
169  //boundary
170  for(size_t i=0;i<N1*N2*N3;i++)
171  {
172  if (C1[i]<=0+1e-5||C1[i]>=spc.Width-1e-5//outer contact
173  ||C2[i]<=0+1e-5||C2[i]>=spc.Length-1e-5
174  ||C3[i]>=spc.Height-1e-5)
175  {
176  fIsDepleted[i]=true;
177  fIsFixed[i]=true;
178  Vp[i]=spc.Bias[0];
179  continue;
180  }
181  //point contact
182  if(C3[i]>=0&&C3[i]<=spc.PointContactH&&
183  C1[i]>=(spc.Width-spc.PointContactW)/2&&
184  C1[i]<=(spc.Width+spc.PointContactW)/2&&
185  C2[i]>=(spc.Length-spc.PointContactL)/2&&
186  C2[i]<=(spc.Length+spc.PointContactL)/2)
187  {
188  fIsDepleted[i]=true;
189  fIsFixed[i]=true;
190  Vp[i]=spc.Bias[1];
191  continue;
192 
193  }
194 
195 
196  }
197 
198 
199 }
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
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< bool > fIsDepleted
true if a grid point is depleted
Definition: Grid.h:129
void GeneralSetup(SquarePointContact &idetector)
Definition: XYZ.cc:133
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 > 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 28 of file XYZ.cc.

29 {
30  if (fIsFixed[idx])return;
31  //double density=Src[idx];
32  double dxm=dC1m[idx];
33  double dxp=dC1p[idx];
34  double dym=dC2m[idx];
35  double dyp=dC2p[idx];
36  double dzm=dC3m[idx];
37  double dzp=dC3p[idx];
38  double pym,pyp,pxm,pxp,pzp,pzm;
39  if(idx<N1*N2)pzm=Vp[idx];
40  else pzm=Vp[idx-N1*N2];
41  if(idx>=N1*N2*N3-N1*N2)pzp=Vp[idx];
42  else pzp=Vp[idx+N1*N2];
43  if(idx%(N1*N2)>(N1*N2)-N1-1) pyp=Vp[idx];
44  else pyp=Vp[idx+N1];
45  if(idx%(N1*N2)<N1)pym=Vp[idx];
46  else pym=Vp[idx-N1];
47  if((idx%(N1*N2))%N1==N1-1)pxp=Vp[idx];
48  else pxp=Vp[idx+1];
49  if((idx%(N1*N2))%N1==0)pxm=Vp[idx];
50  else pxm=Vp[idx-1];
51  double tmp=(Src[idx]
52  +(pxp/dxp+pxm/dxm)/(dxp+dxm)
53  +(pyp/dyp+pym/dym)/(dyp+dym)
54  +(pzp/dzp+pzm/dzm)/(dzp+dzm)
55  )/(
56  (1/dxp+1/dxm)/(dxp+dxm)
57  +(1/dyp+1/dym)/(dyp+dym)
58  +(1/dzp+1/dzm)/(dzp+dzm)
59  );
60 
61 /* double tmp= (
62  density*h0*h1*h2*h3*h4*h5*(h1+h4)*(h2+h3)*(h0+h5)/2
63  +(pxp*h3+pxm*h2)*h0*h1*h4*h5*(h1+h4)*(h0+h5)
64  +(pyp*h4+pym*h1)*h0*h2*h3*h5*(h0+h5)*(h2+h3)
65  +(pzp*h5+pzm*h0)*h1*h2*h3*h4*(h1+h4)*(h2+h3)
66  )
67  /((h0+h5)*(h1+h4)*(h2+h3)*(h0*h1*h4*h5+h0*h2*h3*h5+h1*h2*h3*h4));
68  */
69  double oldP=Vp[idx];
70  tmp=RelaxationFactor*(tmp-oldP)+oldP;
71  Vp[idx]=tmp;
72  return;
73  // update Vp for impurity-only case even if the point is undepleted
74  if (fDetector->Bias[0]==fDetector->Bias[1]) { Vp[idx]=tmp; return; }
75 
76 
77  //check depletion
78  double min=pxm;
79  double max=pxm;
80  if(min>pxp)min=pxp;
81  if (min>pyp)min=pyp;
82  if (min>pym)min=pym;
83  if (min>pzm)min=pzm;
84  if (min>pzm)min=pzm;
85 
86  //find max
87  if(max<pxp)max=pxp;
88  if (max<pyp)min=pyp;
89  if (max<pym)max=pym;
90  if (max<pzm)max=pzm;
91  if (max<pzm)max=pzm;
92  //if tmp is greater or smaller than max and min, set tmp to it.
93  //Vp[idx]=RelaxationFactor*(tmp-Vp[idx])+Vp[idx];
94  //if need calculate depleted voltage
95  if(tmp<min) {
96  Vp[idx]=min;
97  fIsDepleted[idx]=false;
98  } else if(tmp>max) {
99  Vp[idx]=max;
100  fIsDepleted[idx]=false;
101  } else {
102  Vp[idx]=tmp;
103  fIsDepleted[idx]=true;
104  }
105 }
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 > 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: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
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  }
16  else {
17  //maybe add auto configure name list
18  Error("SetupWith", "%s is not expected.", type.Data());
19  Error("SetupWith", "Please use "
20  "PointContact detector.");
21  abort();
22  }
23 
24  fDetector = &detector; // for GetC to use fDetector->Bias[]
25 }
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:131
void GetInfoFrom(SquarePointContact &detector)
Definition: XYZ.cc:165

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