68 fLowerEndcap(0), fUpperEndcap(0), fLatterTwisted(0),
69 fFormerTwisted(0), fInnerHype(0), fOuterHype(0)
73 G4Exception(
"G4TwistedTubs::G4TwistedTubs()",
"GeomSolids0002",
77 G4double sinhalftwist = std::sin(0.5 * twistedangle);
79 G4double endinnerradX = endinnerrad * sinhalftwist;
81 - endinnerradX * endinnerradX );
83 G4double endouterradX = endouterrad * sinhalftwist;
85 - endouterradX * endouterradX );
88 SetFields(twistedangle, innerrad, outerrad, -halfzlen, halfzlen);
100 fLowerEndcap(0), fUpperEndcap(0), fLatterTwisted(0),
101 fFormerTwisted(0), fInnerHype(0), fOuterHype(0)
107 message <<
"Invalid number of segments." <<
G4endl
108 <<
" nseg = " << nseg;
109 G4Exception(
"G4TwistedTubs::G4TwistedTubs()",
"GeomSolids0002",
114 G4Exception(
"G4TwistedTubs::G4TwistedTubs()",
"GeomSolids0002",
118 G4double sinhalftwist = std::sin(0.5 * twistedangle);
120 G4double endinnerradX = endinnerrad * sinhalftwist;
122 - endinnerradX * endinnerradX );
124 G4double endouterradX = endouterrad * sinhalftwist;
126 - endouterradX * endouterradX );
129 fDPhi = totphi / nseg;
130 SetFields(twistedangle, innerrad, outerrad, -halfzlen, halfzlen);
142 fLowerEndcap(0), fUpperEndcap(0), fLatterTwisted(0),
143 fFormerTwisted(0), fInnerHype(0), fOuterHype(0)
147 G4Exception(
"G4TwistedTubs::G4TwistedTubs()",
"GeomSolids0002",
151 SetFields(twistedangle, innerrad, outerrad, negativeEndz, positiveEndz);
164 fLowerEndcap(0), fUpperEndcap(0), fLatterTwisted(0),
165 fFormerTwisted(0), fInnerHype(0), fOuterHype(0)
170 message <<
"Invalid number of segments." <<
G4endl
171 <<
" nseg = " << nseg;
172 G4Exception(
"G4TwistedTubs::G4TwistedTubs()",
"GeomSolids0002",
177 G4Exception(
"G4TwistedTubs::G4TwistedTubs()",
"GeomSolids0002",
181 fDPhi = totphi / nseg;
182 SetFields(twistedangle, innerrad, outerrad, negativeEndz, positiveEndz);
190 :
G4VSolid(a), fPhiTwist(0.), fInnerRadius(0.), fOuterRadius(0.), fDPhi(0.),
191 fZHalfLength(0.), fInnerStereo(0.), fOuterStereo(0.), fTanInnerStereo(0.),
192 fTanOuterStereo(0.), fKappa(0.), fInnerRadius2(0.), fOuterRadius2(0.),
193 fTanInnerStereo2(0.), fTanOuterStereo2(0.), fLowerEndcap(0), fUpperEndcap(0),
194 fLatterTwisted(0), fFormerTwisted(0), fInnerHype(0), fOuterHype(0)
216 :
G4VSolid(rhs), fPhiTwist(rhs.fPhiTwist),
217 fInnerRadius(rhs.fInnerRadius), fOuterRadius(rhs.fOuterRadius),
218 fDPhi(rhs.fDPhi), fZHalfLength(rhs.fZHalfLength),
219 fInnerStereo(rhs.fInnerStereo), fOuterStereo(rhs.fOuterStereo),
220 fTanInnerStereo(rhs.fTanInnerStereo), fTanOuterStereo(rhs.fTanOuterStereo),
221 fKappa(rhs.fKappa), fInnerRadius2(rhs.fInnerRadius2),
222 fOuterRadius2(rhs.fOuterRadius2), fTanInnerStereo2(rhs.fTanInnerStereo2),
223 fTanOuterStereo2(rhs.fTanOuterStereo2),
224 fLowerEndcap(0), fUpperEndcap(0), fLatterTwisted(0), fFormerTwisted(0),
225 fInnerHype(0), fOuterHype(0),
226 fCubicVolume(rhs.fCubicVolume), fSurfaceArea(rhs.fSurfaceArea),
227 fLastInside(rhs.fLastInside), fLastNormal(rhs.fLastNormal),
228 fLastDistanceToIn(rhs.fLastDistanceToIn),
229 fLastDistanceToOut(rhs.fLastDistanceToOut),
230 fLastDistanceToInWithV(rhs.fLastDistanceToInWithV),
231 fLastDistanceToOutWithV(rhs.fLastDistanceToOutWithV)
233 for (
auto i=0; i<2; ++i)
252 if (
this == &rhs) {
return *
this; }
277 for (
auto i=0; i<2; ++i)
302 "G4TwistedTubs does not support Parameterisation.");
318 if (pMin.
x() >= pMax.
x() || pMin.
y() >= pMax.
y() || pMin.
z() >= pMax.
z())
321 message <<
"Bad bounding box (min >= max) for solid: "
323 <<
"\npMin = " << pMin
324 <<
"\npMax = " <<
pMax;
325 G4Exception(
"G4TwistedTubs::BoundingLimits()",
"GeomMgt0001",
373 tmpp->
set(p.
x(), p.
y(), p.
z());
380 if ((outerhypearea ==
kOutside) || (distanceToOut < -halftol))
390 if (distanceToOut <= halftol)
425 tmpp->
set(p.
x(), p.
y(), p.
z());
440 for (
auto i=0; i<6; ++i)
443 if (tmpdistance < distance)
445 distance = tmpdistance;
451 tmpsurface[0] = surfaces[besti];
452 *tmpnormal = tmpsurface[0]->
GetNormal(bestxx,
true);
486 tmpp->
set(p.
x(), p.
y(), p.
z());
487 tmpv->
set(v.
x(), v.
y(), v.
z());
533 for (
auto i=0; i<6; ++i)
536 if (tmpdistance < distance)
538 distance = tmpdistance;
570 tmpp->
set(p.
x(), p.
y(), p.
z());
604 for (
auto i=0; i<6; ++i)
607 if (tmpdistance < distance)
609 distance = tmpdistance;
618 G4Exception(
"G4TwistedTubs::DistanceToIn(p)",
"GeomSolids0003",
657 tmpp->
set(p.
x(), p.
y(), p.
z());
658 tmpv->
set(v.
x(), v.
y(), v.
z());
683 *norm = (blockedsurface->
GetNormal(p,
true));
711 for (
auto i=0; i<6; ++i)
714 if (tmpdistance < distance)
716 distance = tmpdistance;
726 *norm = (surfaces[besti]->
GetNormal(p,
true));
760 tmpp->
set(p.
x(), p.
y(), p.
z());
795 for (
auto i=0; i<6; ++i)
798 if (tmpdistance < distance)
800 distance = tmpdistance;
810 G4Exception(
"G4TwistedTubs::DistanceToOut(p)",
"GeomSolids0003",
826 G4int oldprc = os.precision(16);
827 os <<
"-----------------------------------------------------------\n"
828 <<
" *** Dump for solid - " <<
GetName() <<
" ***\n"
829 <<
" ===================================================\n"
830 <<
" Solid type: G4TwistedTubs\n"
832 <<
" -ve end Z : " <<
fEndZ[0]/
mm <<
" mm \n"
833 <<
" +ve end Z : " <<
fEndZ[1]/
mm <<
" mm \n"
843 <<
" phi-width of a piece : " <<
fDPhi/
degree <<
" degrees \n"
844 <<
"-----------------------------------------------------------\n";
845 os.precision(oldprc);
868 return G4VisExtent( -maxEndOuterRad, maxEndOuterRad,
869 -maxEndOuterRad, maxEndOuterRad,
887 const G4int nnodes = 4*(k-1)*(n-2) + 2*k*
k ;
888 const G4int nfaces = 4*(k-1)*(n-1) + 2*(k-1)*(k-1) ;
892 typedef G4int G4int4[4];
893 G4double3* xyz =
new G4double3[nnodes];
894 G4int4* faces =
new G4int4[nfaces] ;
1057 else if ( (chose >= a1) && (chose < a1 + a2 ) )
1067 else if ( (chose >= a1 + a2 ) && (chose < a1 + a2 + a3 ) )
1077 else if ( (chose >= a1 + a2 + a3 ) && (chose < a1 + a2 + a3 + a4 ) )
1086 else if( (chose >= a1 + a2 + a3 + a4 )&&(chose < a1 + a2 + a3 + a4 + a5 ) )