GeFiCa
Germanium detector Field Calculator
Grid.h
Go to the documentation of this file.
1 #ifndef GeFiCa_Grid
2 #define GeFiCa_Grid
3 namespace GeFiCa { class Points; class FieldLine; class Grid; class Detector; }
4 #include <stdlib.h>
5 #include <vector>
10 {
11  public:
12  std::vector<double> C1;
13  std::vector<double> C2;
14  std::vector<double> C3;
15  std::vector<double> Vp;
16  std::vector<double> Et;
17  std::vector<double> E1;
18  std::vector<double> E2;
19  std::vector<double> E3;
20  std::vector<double> dC1p;
21  std::vector<double> dC1m;
22  std::vector<double> dC2p;
23  std::vector<double> dC2m;
24  std::vector<double> dC3p;
25  std::vector<double> dC3m;
26  size_t GetN() { return C1.size(); }
27 };
28 #include <TNamed.h>
29 class TGraph;
35 class GeFiCa::FieldLine : public Points, public TNamed
36 {
37  public:
38  FieldLine() : Points(), TNamed("fl", "electric field line"), fGl(0) {};
39  TGraph* GetGraph();
40  private:
41  TGraph* fGl;
42  ClassDef(FieldLine,1);
43 };
44 class TTree;
50 class GeFiCa::Grid : public Points, public TNamed
51 {
52  public:
53  size_t N1;
54  size_t N2;
55  size_t N3;
56  std::vector<double> Src;
57  size_t MaxIterations;
59  double Tolerance;
60  size_t Iterations;
61 
65  Grid(size_t n1=0, size_t n2=0, size_t n3=0);
66  virtual ~Grid() {};
73  virtual void SetupWith(Detector &detector);
77  void SuccessiveOverRelax();
82  void SolveAnalytically();
86  double GetV(double c1, double c2=0, double c3=0) const
87  {return GetData(Vp,c1,c2,c3); }
88  double GetE(double c1, double c2=0, double c3=0) const
89  { return GetData(Et,c1,c2,c3); }
90  double GetE1(double c1, double c2=0, double c3=0) const
91  { return GetData(E1,c1,c2,c3); }
92  double GetE2(double c1, double c2=0, double c3=0) const
93  { return GetData(E2,c1,c2,c3); }
94  double GetE3(double c1, double c2=0, double c3=0) const
95  { return GetData(E3,c1,c2,c3); }
101  double GetC();
110  TTree* GetTree(bool createNew=false);
114  bool IsDepleted();
118  Grid& operator*=(double scale);
122  Grid& operator+=(Grid& other);
126  virtual FieldLine* GetFieldLineFrom(double c1, double c2, bool positive=true);
127  virtual FieldLine* GetFieldLineFrom(double c1, double c2, double c3,bool positive=true);
128  protected:
129  std::vector<bool> fIsFixed;
130  std::vector<bool> fIsDepleted;
131  TTree* fTree;
133 
136  virtual void OverRelaxAt(size_t idx) {};
140  size_t GetIdxOfPointToTheRightOf(double c1,
141  size_t begin, size_t end) const;
142  size_t GetIdxOfPointToTheRightOf(double c1, double c2,
143  size_t begin, size_t end) const;
144  size_t GetIdxOfPointToTheRightOf(double c1, double c2, double c3,
145  size_t begin, size_t end) const;
149  virtual double GetData(const std::vector<double> &data,
150  double c1, double c2, double c3) const;
154  size_t GetIdxOfMaxV();
158  size_t GetIdxOfMinV();
162  virtual void CalculateE();
166  double twopoint(double dataset[2],double tarlocationset,double pointxset[2])const;
170  double threepoint(double dataset[3],double tarlocationset[2],double pointxset[3],double pointyset[3])const;
174  double fourpoint(double dataset[4],double tarlocationset[2],double pointxset[4],double pointyset[4])const;
175  ClassDef(Grid,1);
176 };
177 #endif
std::vector< double > dC1m
step length to previous point alone C1
Definition: Grid.h:21
size_t Iterations
number of iterations of SOR performed
Definition: Grid.h:60
double GetE1(double c1, double c2=0, double c3=0) const
Definition: Grid.h:90
std::vector< double > E3
projection of Et on C3
Definition: Grid.h:19
Data structure of a electric field grid.
Definition: Grid.h:50
double GetE2(double c1, double c2=0, double c3=0) const
Definition: Grid.h:92
std::vector< bool > fIsFixed
true if field values are fixed
Definition: Grid.h:129
double Tolerance
SOR stops when error<Tolerance.
Definition: Grid.h:59
double GetE(double c1, double c2=0, double c3=0) const
Definition: Grid.h:88
double GetV(double c1, double c2=0, double c3=0) const
Get potential at (c1,c2,c3) by interpolation.
Definition: Grid.h:86
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
TTree * fTree
! ROOT tree to visualize fields
Definition: Grid.h:131
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 OverRelaxAt(size_t idx)
Over relax potential Vp[.
Definition: Grid.h:136
Detector & crystal properties.
Definition: Detector.h:32
std::vector< double > dC1p
step length to next point alone C1
Definition: Grid.h:20
A group of discrete points.
Definition: Grid.h:9
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
size_t MaxIterations
maximal iterations of SOR to be performed
Definition: Grid.h:57
double GetE3(double c1, double c2=0, double c3=0) const
Definition: Grid.h:94
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
std::vector< double > dC2p
step length to next point along C2
Definition: Grid.h:22
Electric field line data.
Definition: Grid.h:35
size_t N3
number of points along the 3rd coordinate
Definition: Grid.h:55
virtual ~Grid()
Definition: Grid.h:66
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
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
std::vector< double > C3
the 3rd coordinates of the points
Definition: Grid.h:14
double RelaxationFactor
within (0,2), used to speed up convergence
Definition: Grid.h:58