1 | #ifndef __SSURFACE__ |
---|
2 | #define __SSURFACE__ |
---|
3 | |
---|
4 | #include "FresnelOutput_defs.h" |
---|
5 | |
---|
6 | //#define DEBUG |
---|
7 | #define FRESNEL_MAXSTEPS 100 |
---|
8 | #define USE_ROOT |
---|
9 | |
---|
10 | #include <geomdefs.hh> |
---|
11 | #include <G4ThreeVector.hh> |
---|
12 | class G4PhysicalVolume; |
---|
13 | |
---|
14 | namespace G4FresnelLens{ |
---|
15 | class FSIntersectedSegment; |
---|
16 | class SSurface __INHERITSTRING1 { |
---|
17 | public: |
---|
18 | SSurface(double zpos=0., double rhomax=0.); |
---|
19 | virtual ~SSurface(){}; |
---|
20 | |
---|
21 | // |
---|
22 | // Pure virtual methods |
---|
23 | virtual double PointOnSurf(double x)=0; |
---|
24 | virtual double DistanceToSurf(const G4ThreeVector& p, const G4ThreeVector& v)=0; |
---|
25 | virtual double DistanceToSurf(const G4ThreeVector& p, const G4ThreeVector& v,FSIntersectedSegment* is)=0; |
---|
26 | virtual double DistanceToSurfSafe(const G4ThreeVector& p)=0; |
---|
27 | virtual double FindNearestIntersection(const G4ThreeVector& p1, const G4ThreeVector& v, FSIntersectedSegment* intSeg=0)=0; |
---|
28 | virtual double TestEdgeTolerance(int dir, const G4ThreeVector& p, const G4ThreeVector& v)=0; |
---|
29 | virtual EInside Inside(double rho, double z, FSIntersectedSegment* intSeg=0)=0; |
---|
30 | virtual bool Normal(const G4ThreeVector& p, bool up, G4ThreeVector* norm) { AbstractMethod(); return false; } |
---|
31 | virtual bool Normal(FSIntersectedSegment* ints, const G4ThreeVector& p, double up, G4ThreeVector* norm) { AbstractMethod(); return false; } |
---|
32 | virtual bool Point(int i, double step, double& rho, double& z)=0; |
---|
33 | |
---|
34 | // |
---|
35 | // redefinable virtual methods |
---|
36 | virtual double DistanceToSurfSafeUp(const G4ThreeVector& p) { return DistanceToSurfSafe(p); } |
---|
37 | virtual double DistanceToSurfSafeDown(const G4ThreeVector& p) { return DistanceToSurfSafe(p); } |
---|
38 | virtual double GetUpperZ(double rho) { return PointOnSurf(rho); } |
---|
39 | virtual double GetBottomZ(double rho) { return PointOnSurf(rho); } |
---|
40 | virtual double GetEdgeZ() { return PointOnSurf(fR); } |
---|
41 | virtual void print() { printf("abstract surface R=%g, z=%g\n", fR, fZpos); } |
---|
42 | |
---|
43 | virtual bool operator==(SSurface&) { AbstractMethod(); return false; } |
---|
44 | |
---|
45 | #ifdef USE_ROOT |
---|
46 | virtual void draw(const char* rootfile=0, const char* canvasfile=0, double shift=0., const char* prefix="", const char* option="RECREATE"); |
---|
47 | #endif |
---|
48 | |
---|
49 | // getters |
---|
50 | double GetR() { return fR; } |
---|
51 | double GetR1() { return fR1; } |
---|
52 | double GetR2() { return fR; } |
---|
53 | double GetZpos() { return fZpos; } |
---|
54 | double GetZ1() { return fZ1; } |
---|
55 | double GetZ2() { return fZ2; } |
---|
56 | virtual double GetMinZ() { return fZmin; } |
---|
57 | virtual double GetMaxZ() { return fZmax; } |
---|
58 | |
---|
59 | // plug for temporarily unimplemented methods |
---|
60 | void AbstractMethod() { fprintf(stderr, "Error, calling the unimplemented method"); exit(1); } |
---|
61 | protected: |
---|
62 | double fR1; |
---|
63 | double fR; |
---|
64 | double fZpos; |
---|
65 | double fZ1; |
---|
66 | double fZ2; |
---|
67 | double fZmin; |
---|
68 | double fZmax; |
---|
69 | |
---|
70 | static double kTolerance; |
---|
71 | static double kHalfTolerance; |
---|
72 | |
---|
73 | #ifdef DEBUG |
---|
74 | public: |
---|
75 | void setDebug(bool d=true) { theDebugSwitch=d; } |
---|
76 | bool getDebug() { return theDebugSwitch; } |
---|
77 | protected: |
---|
78 | bool theDebugSwitch; |
---|
79 | #endif |
---|
80 | }; |
---|
81 | |
---|
82 | }; |
---|
83 | #endif |
---|