00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 inline
00038 G4double G4Trap::GetZHalfLength() const
00039 {
00040 return fDz ;
00041 }
00042
00043 inline
00044 G4ThreeVector G4Trap::GetSymAxis() const
00045 {
00046 G4double cosTheta = 1.0/std::sqrt(1+fTthetaCphi*fTthetaCphi +
00047 fTthetaSphi*fTthetaSphi) ;
00048
00049 return G4ThreeVector(fTthetaCphi*cosTheta,
00050 fTthetaSphi*cosTheta,
00051 cosTheta) ;
00052 }
00053
00054 inline
00055 G4double G4Trap::GetYHalfLength1() const
00056 {
00057 return fDy1 ;
00058 }
00059
00060 inline
00061 G4double G4Trap::GetXHalfLength1() const
00062 {
00063 return fDx1 ;
00064 }
00065
00066 inline
00067 G4double G4Trap::GetXHalfLength2() const
00068 {
00069 return fDx2 ;
00070 }
00071
00072 inline
00073 G4double G4Trap::GetTanAlpha1() const
00074 {
00075 return fTalpha1 ;
00076 }
00077
00078 inline
00079 G4double G4Trap::GetYHalfLength2() const
00080 {
00081 return fDy2 ;
00082 }
00083
00084 inline
00085 G4double G4Trap::GetXHalfLength3() const
00086 {
00087 return fDx3 ;
00088 }
00089
00090 inline
00091 G4double G4Trap::GetXHalfLength4() const
00092 {
00093 return fDx4 ;
00094 }
00095
00096 inline
00097 G4double G4Trap::GetTanAlpha2() const
00098 {
00099 return fTalpha2 ;
00100 }
00101
00102 inline
00103 TrapSidePlane G4Trap::GetSidePlane( G4int n ) const
00104 {
00105 return fPlanes[n] ;
00106 }
00107
00108 inline
00109 G4double G4Trap::GetFaceArea(const G4ThreeVector& p0, const G4ThreeVector& p1,
00110 const G4ThreeVector& p2, const G4ThreeVector& p3)
00111 {
00112 G4double area = 0.5*((p1-p0).cross(p2-p1).mag()+(p3-p2).cross(p0-p3).mag());
00113 return area;
00114 }
00115
00116 inline
00117 G4double G4Trap::GetCubicVolume()
00118 {
00119 if(fCubicVolume != 0.) {;}
00120 else { fCubicVolume = fDz*( (fDx1+fDx2+fDx3+fDx4)*(fDy1+fDy2)
00121 + (fDx4+fDx3-fDx2-fDx1)*(fDy2-fDy1)/3 ); }
00122 return fCubicVolume;
00123 }
00124
00125 inline
00126 G4double G4Trap::GetSurfaceArea()
00127 {
00128 if(fSurfaceArea != 0.) {;}
00129 else
00130 {
00131 G4ThreeVector ba(fDx1-fDx2+fTalpha1*2*fDy1,2*fDy1,0);
00132 G4ThreeVector bc(2*fDz*fTthetaCphi-(fDx4-fDx2)+fTalpha2*fDy2-fTalpha1*fDy1,
00133 2*fDz*fTthetaSphi+fDy2-fDy1, 2*fDz);
00134 G4ThreeVector dc(-fDx4+fDx3+2*fTalpha2*fDy2, 2*fDy2,0);
00135 G4ThreeVector da(-2*fDz*fTthetaCphi-(fDx1-fDx3)-fTalpha1*fDy1+fTalpha2*fDy2,
00136 -2*fDz*fTthetaSphi-fDy1+fDy2,-2*fDz);
00137
00138 G4ThreeVector ef(fDx2-fDx1+2*fTalpha1*fDy1, 2*fDy1,0);
00139 G4ThreeVector eh(2*fDz*fTthetaCphi+fDx3-fDx1+fTalpha1*fDy1-fTalpha2*fDy2,
00140 2*fDz*fTthetaSphi-fDy2+fDy1,2*fDz);
00141 G4ThreeVector gh(fDx3-fDx4-2*fTalpha2*fDy2, -2*fDy2,0);
00142 G4ThreeVector gf(-2*fDz*fTthetaCphi+fDx2-fDx4+fTalpha1*fDy1-fTalpha2*fDy2,
00143 -2*fDz*fTthetaSphi+fDy1-fDy2,-2*fDz);
00144
00145 G4ThreeVector cr;
00146 cr = ba.cross(bc);
00147 G4double babc=cr.mag();
00148 cr = dc.cross(da);
00149 G4double dcda=cr.mag();
00150 cr = ef.cross(eh);
00151 G4double efeh=cr.mag();
00152 cr = gh.cross(gf);
00153 G4double ghgf=cr.mag();
00154
00155 fSurfaceArea = 2*fDy1*(fDx1+fDx2)+2*fDy2*(fDx3+fDx4)
00156 + (fDx1+fDx3)
00157 * std::sqrt(4*fDz*fDz+std::pow(fDy2-fDy1-2*fDz*fTthetaSphi,2))
00158 + (fDx2+fDx4)
00159 * std::sqrt(4*fDz*fDz+std::pow(fDy2-fDy1+2*fDz*fTthetaSphi,2))
00160 + 0.5*(babc+dcda+efeh+ghgf);
00161 }
00162 return fSurfaceArea;
00163 }