1 | #ifndef FresnelSurface_HH |
---|
2 | #define FresnelSurface_HH |
---|
3 | #include "SSurface.h" |
---|
4 | #include "FresnelOutput_defs.h" |
---|
5 | #include "FixedStack.h" |
---|
6 | #include "ParametricSurface.h" |
---|
7 | #include "CylindricSurface.h" |
---|
8 | |
---|
9 | #include <string.h> |
---|
10 | #include <vector> |
---|
11 | //#define DEBUG |
---|
12 | |
---|
13 | namespace G4FresnelLens{ |
---|
14 | class FresnelSurface : public SSurface { |
---|
15 | private: |
---|
16 | double fFilter; |
---|
17 | |
---|
18 | public: |
---|
19 | FresnelSurface(const std::vector<SSurface*>& surf, ParametricSurface*, ParametricSurface*); |
---|
20 | virtual ~FresnelSurface(); |
---|
21 | |
---|
22 | void setSmoothedEdges(double rad); |
---|
23 | double PointOnSurf(double x) { AbstractMethod(); return kInfinity; } |
---|
24 | double DistanceToSurf(const G4ThreeVector& p, const G4ThreeVector& v){ AbstractMethod(); return kInfinity; } |
---|
25 | double DistanceToSurf(const G4ThreeVector& p, const G4ThreeVector& v, FSIntersectedSegment*){ AbstractMethod(); return kInfinity; } |
---|
26 | double DistanceToSurfSafe(const G4ThreeVector& p){ AbstractMethod(); return kInfinity; } |
---|
27 | double DistanceToSurfSafeUp(const G4ThreeVector& p) { return fUpLimit->DistanceToSurfSafe(p); } |
---|
28 | double DistanceToSurfSafeDown(const G4ThreeVector& p) { return fDownLimit->DistanceToSurfSafe(p); } |
---|
29 | double TestEdgeTolerance(int dir, const G4ThreeVector& p, const G4ThreeVector& v) { AbstractMethod(); return kInfinity; } |
---|
30 | bool Point(int i, double step, double& rho, double& z) { AbstractMethod(); return false; } |
---|
31 | |
---|
32 | #ifdef USE_ROOT |
---|
33 | void draw(const char* rootfile=0, const char* canvasfile=0, double shift=0., const char* prefix="", const char* option="RECREATE"); |
---|
34 | #endif |
---|
35 | |
---|
36 | double GetZ(double rho); |
---|
37 | double GetUpperZ(double rho); |
---|
38 | double GetBottomZ(double rho); |
---|
39 | double GetEdgeZ() { return fSurfaces.back()->GetZ1(); } |
---|
40 | double GetMinZ() { return fDownLimit->GetMinZ(); } |
---|
41 | double GetMaxZ() { return fUpLimit->GetMaxZ(); } |
---|
42 | |
---|
43 | EInside Inside(double rho, double z, FSIntersectedSegment *intS=0); |
---|
44 | double FindNearestIntersection(const G4ThreeVector& p1, const G4ThreeVector& v, FSIntersectedSegment* intS=0); |
---|
45 | |
---|
46 | double* CopyTeeth(int& n); |
---|
47 | int GetNTeeth() { return theToothN-1; } |
---|
48 | std::vector<SSurface*>& GetTeeth() { return fSurfaces; } |
---|
49 | protected: |
---|
50 | #ifdef USE_ROOT |
---|
51 | void FillArray(const char*); |
---|
52 | #endif |
---|
53 | void FillArray(int n, double* rho, double* z); |
---|
54 | void FillArray(const std::vector<SSurface*>& surf); |
---|
55 | |
---|
56 | /// Surfaces |
---|
57 | ParametricSurface* fUpLimit; |
---|
58 | ParametricSurface* fDownLimit; |
---|
59 | CylindricSurface fCylinder; |
---|
60 | std::vector<SSurface*> fSurfaces; |
---|
61 | std::vector<SSurface*> fSurfacesIns; |
---|
62 | |
---|
63 | /// tooth indexes |
---|
64 | int theToothN; |
---|
65 | double* theToothEdges; |
---|
66 | |
---|
67 | /// points storage |
---|
68 | double fZscale; |
---|
69 | |
---|
70 | /// function parameters and chi-square |
---|
71 | double theMaximalDeviation; |
---|
72 | |
---|
73 | double fDownSafety; |
---|
74 | double fUpSafety; |
---|
75 | bool doBelieveToFit; |
---|
76 | |
---|
77 | double theLastPerp, theLastZ; // last position, for "inside" definition |
---|
78 | EInside theLastInside; // last inside definition |
---|
79 | FSIntersectedSegment theLastIntSeg; |
---|
80 | }; |
---|
81 | |
---|
82 | //__________________________________________________________________________________ |
---|
83 | inline double FresnelSurface::GetUpperZ(double rho){ |
---|
84 | return fUpLimit->PointOnSurf(rho); |
---|
85 | } |
---|
86 | |
---|
87 | //__________________________________________________________________________________ |
---|
88 | inline double FresnelSurface::GetBottomZ(double rho){ |
---|
89 | return fDownLimit->PointOnSurf(rho); |
---|
90 | } |
---|
91 | |
---|
92 | }; |
---|
93 | #endif |
---|