1 | #ifndef ShapeOfLens_HH |
---|
2 | #define ShapeOfLens_HH |
---|
3 | |
---|
4 | #include "FresnelOutput_defs.h" |
---|
5 | #include "CylindricSurface.h" |
---|
6 | #include "LensUtils.h" |
---|
7 | |
---|
8 | #include <G4VSolid.hh> |
---|
9 | #include <geomdefs.hh> |
---|
10 | |
---|
11 | #define SLANTWALLS |
---|
12 | |
---|
13 | class G4Tubs; |
---|
14 | namespace G4FresnelLens{ |
---|
15 | class SSurface; |
---|
16 | class ShapeOfLens: public G4VSolid __INHERITSTRING |
---|
17 | { |
---|
18 | public: // with description |
---|
19 | |
---|
20 | ShapeOfLens(const G4String& pName, |
---|
21 | G4double pDz, |
---|
22 | G4double pR, |
---|
23 | SSurface* upsurf, SSurface* downsurf); |
---|
24 | |
---|
25 | virtual ~ShapeOfLens(); |
---|
26 | |
---|
27 | inline G4double GetCubicVolume(); |
---|
28 | inline G4double GetSurfaceArea(); |
---|
29 | // inline G4double CalculateSurfaceArea() const; |
---|
30 | // |
---|
31 | // // Modifiers functions |
---|
32 | // |
---|
33 | // inline void SetZHalfLength(G4double dz); |
---|
34 | // inline void SetRadiusMinusZ(G4double R1); |
---|
35 | // inline void SetRadiusPlusZ(G4double R2); |
---|
36 | |
---|
37 | // Solid standard methods |
---|
38 | |
---|
39 | //void ComputeDimensions( G4VPVParamerisation p, |
---|
40 | // const G4Int n, |
---|
41 | // const G4VPhysicalVolume* pRep ); |
---|
42 | G4bool CalculateExtent(const EAxis pAxis, |
---|
43 | const G4VoxelLimits& pVoxelLimit, |
---|
44 | const G4AffineTransform& pTransform, |
---|
45 | G4double& pmin, G4double& pmax) const; |
---|
46 | EInside Inside(const G4ThreeVector& p) const; |
---|
47 | G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const; |
---|
48 | G4double DistanceToIn(const G4ThreeVector& p, |
---|
49 | const G4ThreeVector& v) const; |
---|
50 | G4double DistanceToIn(const G4ThreeVector& p) const; |
---|
51 | G4double DistanceToOut(const G4ThreeVector& p, |
---|
52 | const G4ThreeVector& v, |
---|
53 | const G4bool calcNorm=G4bool(false), |
---|
54 | G4bool *validNorm=0, |
---|
55 | G4ThreeVector *n=0) const; |
---|
56 | G4double DistanceToOut(const G4ThreeVector& p) const; |
---|
57 | |
---|
58 | G4GeometryType GetEntityType() const; |
---|
59 | std::ostream& StreamInfo(std::ostream& os) const; |
---|
60 | |
---|
61 | G4ThreeVector GetPointOnSurface() const; |
---|
62 | // Visualisation functions |
---|
63 | |
---|
64 | void DescribeYourselfTo(G4VGraphicsScene& scene) const; |
---|
65 | /* G4Polyhedron* CreatePolyhedron() const; |
---|
66 | G4Polyhedron* GetPolyhedron () const; |
---|
67 | G4NURBS* CreateNURBS() const;*/ |
---|
68 | |
---|
69 | void GetCylinderLimits(double& r, double& z1, double& z2) { r=fR; z1=fZ1; z2=fZ2; } |
---|
70 | |
---|
71 | public: // without description |
---|
72 | ShapeOfLens(__void__&); |
---|
73 | // Fake default constructor for usage restricted to direct object |
---|
74 | // persistency for clients requiring preallocation of memory for |
---|
75 | // persistifiable objects. |
---|
76 | |
---|
77 | protected: // without description |
---|
78 | |
---|
79 | // mutable G4Polyhedron* fpPolyhedron; |
---|
80 | |
---|
81 | private: |
---|
82 | EInside Inside(const G4ThreeVector& p, int* surface, FSIntersectedSegment* intseg=0) const; |
---|
83 | |
---|
84 | mutable G4double fSurfaceArea; |
---|
85 | G4double fCubicVolume; |
---|
86 | |
---|
87 | double fZ1, fZ2; |
---|
88 | G4double fDz, fR; |
---|
89 | G4Tubs* top_volume; |
---|
90 | |
---|
91 | double kTolerance; |
---|
92 | double kHalfTolerance; |
---|
93 | |
---|
94 | SSurface* fUpSurface; |
---|
95 | SSurface* fDownSurface; |
---|
96 | mutable CylindricSurface fCylinder; |
---|
97 | |
---|
98 | // save last position to calculate Normal after DistanceToIn faster |
---|
99 | mutable G4ThreeVector theLastPositionOnSurface; // last position on surface, for normal calculation |
---|
100 | mutable FSIntersectedSegment theLastSurfaceSegment; // for normal calculation |
---|
101 | mutable int theLastSurface; // for normal calculation |
---|
102 | |
---|
103 | mutable G4ThreeVector theLastPosition; // last position, for "inside" definition |
---|
104 | mutable EInside theLastInside; // last inside definition |
---|
105 | mutable FSIntersectedSegment theLastInsideSegment; // for normal calculation |
---|
106 | |
---|
107 | #ifdef SLANTWALLS |
---|
108 | private: |
---|
109 | void CorrectCylinderNormal(G4ThreeVector* normal) const; |
---|
110 | bool isSlant; |
---|
111 | double theSlantSigma; |
---|
112 | |
---|
113 | public: |
---|
114 | void SetSlant(bool slant=true) { isSlant=slant; } |
---|
115 | void SetSlantSigma(double sigma) { theSlantSigma=sigma; } |
---|
116 | #endif |
---|
117 | }; |
---|
118 | |
---|
119 | //__________________________________________________________________________________ |
---|
120 | inline EInside ShapeOfLens::Inside(const G4ThreeVector& p) const { |
---|
121 | return Inside(p, 0); |
---|
122 | } |
---|
123 | |
---|
124 | //__________________________________________________________________________________ |
---|
125 | inline G4GeometryType ShapeOfLens::GetEntityType() const { |
---|
126 | return "FresnelLens"; |
---|
127 | } |
---|
128 | |
---|
129 | //__________________________________________________________________________________ |
---|
130 | inline std::ostream& ShapeOfLens::StreamInfo(std::ostream& os) const { |
---|
131 | return os; |
---|
132 | } |
---|
133 | |
---|
134 | }; |
---|
135 | #endif |
---|