85 fLowerEndcap(0), fUpperEndcap(0), fSide0(0),
86 fSide90(0), fSide180(0), fSide270(0),
107 fDxDown = ( fDx1 > fDx2 ? fDx1 : fDx2 ) ;
108 fDxUp = ( fDx3 > fDx4 ? fDx3 : fDx4 ) ;
109 fDx = ( fDxUp > fDxDown ? fDxUp : fDxDown ) ;
110 fDy = ( fDy1 > fDy2 ? fDy1 : fDy2 ) ;
114 if ( fDx1 != fDx2 && fDx3 != fDx4 )
116 pDytmp = fDy1 * ( fDx3 - fDx4 ) / ( fDx1 - fDx2 ) ;
119 std::ostringstream message;
120 message <<
"Not planar surface in untwisted Trapezoid: "
122 <<
"fDy2 is " << fDy2 <<
" but should be "
124 G4Exception(
"G4VTwistedFaceted::G4VTwistedFaceted()",
"GeomSolids0002",
130 if ( fDx1 == fDx2 && fDx3 == fDx4 )
137 if ( ( fDx1 == fDx2 && fDx3 != fDx4 ) || ( fDx1 != fDx2 && fDx3 == fDx4 ) )
139 std::ostringstream message;
140 message <<
"Not planar surface in untwisted Trapezoid: "
142 <<
"One endcap is rectangular, the other is a trapezoid." <<
G4endl
143 <<
"For planarity reasons they have to be rectangles or trapezoids "
145 G4Exception(
"G4VTwistedFaceted::G4VTwistedFaceted()",
"GeomSolids0002",
151 fPhiTwist = PhiTwist ;
156 fTAlph = std::tan(fAlph) ;
163 fdeltaX = 2 * fDz * std::tan(fTheta) * std::cos(fPhi) ;
167 fdeltaY = 2 * fDz * std::tan(fTheta) * std::sin(fPhi) ;
176 && ( std::fabs(fPhiTwist) > 2*kAngTolerance )
177 && ( std::fabs(fPhiTwist) <
pi/2 )
178 && ( std::fabs(fAlph) <
pi/2 )
179 && ( fTheta < pi/2 && fTheta >= 0 ) )
182 std::ostringstream message;
183 message <<
"Invalid dimensions. Too small, or twist angle too big: "
185 <<
"fDx 1-4 = " << fDx1/
cm <<
", " << fDx2/
cm <<
", "
186 << fDx3/
cm <<
", " << fDx4/
cm <<
" cm" <<
G4endl
187 <<
"fDy 1-2 = " << fDy1/
cm <<
", " << fDy2/
cm <<
", "
189 <<
"fDz = " << fDz/
cm <<
" cm" <<
G4endl
190 <<
" twistangle " << fPhiTwist/
deg <<
" deg" <<
G4endl
191 <<
" phi,theta = " << fPhi/
deg <<
", " << fTheta/
deg <<
" deg";
196 fCubicVolume = 2 * fDz * ( ( fDx1 + fDx2 ) * fDy1 + ( fDx3 + fDx4 ) * fDy2 );
G4bool fRebuildPolyhedron
G4GLOB_DLL std::ostream G4cout
static constexpr double cm
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4VSolid(const G4String &name)
static constexpr double pi
static constexpr double deg
G4Polyhedron * fpPolyhedron
G4double GetAngularTolerance() const
static G4GeometryTolerance * GetInstance()