79 fLowerEndcap(0), fUpperEndcap(0), fLatterTwisted(0),
80 fFormerTwisted(0), fInnerHype(0), fOuterHype(0),
81 fCubicVolume(0.), fSurfaceArea(0.),
82 fRebuildPolyhedron(false), fpPolyhedron(0)
86 G4Exception(
"G4TwistedTubs::G4TwistedTubs()",
"GeomSolids0002",
90 G4double sinhalftwist = std::sin(0.5 * twistedangle);
92 G4double endinnerradX = endinnerrad * sinhalftwist;
93 G4double innerrad = std::sqrt( endinnerrad * endinnerrad
94 - endinnerradX * endinnerradX );
96 G4double endouterradX = endouterrad * sinhalftwist;
97 G4double outerrad = std::sqrt( endouterrad * endouterrad
98 - endouterradX * endouterradX );
101 SetFields(twistedangle, innerrad, outerrad, -halfzlen, halfzlen);
113 fLowerEndcap(0), fUpperEndcap(0), fLatterTwisted(0),
114 fFormerTwisted(0), fInnerHype(0), fOuterHype(0),
115 fCubicVolume(0.), fSurfaceArea(0.),
116 fRebuildPolyhedron(false), fpPolyhedron(0)
122 message <<
"Invalid number of segments." <<
G4endl
123 <<
" nseg = " << nseg;
124 G4Exception(
"G4TwistedTubs::G4TwistedTubs()",
"GeomSolids0002",
129 G4Exception(
"G4TwistedTubs::G4TwistedTubs()",
"GeomSolids0002",
133 G4double sinhalftwist = std::sin(0.5 * twistedangle);
135 G4double endinnerradX = endinnerrad * sinhalftwist;
136 G4double innerrad = std::sqrt( endinnerrad * endinnerrad
137 - endinnerradX * endinnerradX );
139 G4double endouterradX = endouterrad * sinhalftwist;
140 G4double outerrad = std::sqrt( endouterrad * endouterrad
141 - endouterradX * endouterradX );
144 fDPhi = totphi / nseg;
145 SetFields(twistedangle, innerrad, outerrad, -halfzlen, halfzlen);
157 fLowerEndcap(0), fUpperEndcap(0), fLatterTwisted(0),
158 fFormerTwisted(0), fInnerHype(0), fOuterHype(0),
159 fCubicVolume(0.), fSurfaceArea(0.),
160 fRebuildPolyhedron(false), fpPolyhedron(0)
164 G4Exception(
"G4TwistedTubs::G4TwistedTubs()",
"GeomSolids0002",
168 SetFields(twistedangle, innerrad, outerrad, negativeEndz, positiveEndz);
181 fLowerEndcap(0), fUpperEndcap(0), fLatterTwisted(0),
182 fFormerTwisted(0), fInnerHype(0), fOuterHype(0),
183 fCubicVolume(0.), fSurfaceArea(0.),
184 fRebuildPolyhedron(false), fpPolyhedron(0)
189 message <<
"Invalid number of segments." <<
G4endl
190 <<
" nseg = " << nseg;
191 G4Exception(
"G4TwistedTubs::G4TwistedTubs()",
"GeomSolids0002",
196 G4Exception(
"G4TwistedTubs::G4TwistedTubs()",
"GeomSolids0002",
200 fDPhi = totphi / nseg;
201 SetFields(twistedangle, innerrad, outerrad, negativeEndz, positiveEndz);
209 :
G4VSolid(a), fPhiTwist(0.), fInnerRadius(0.), fOuterRadius(0.), fDPhi(0.),
210 fZHalfLength(0.), fInnerStereo(0.), fOuterStereo(0.), fTanInnerStereo(0.),
211 fTanOuterStereo(0.), fKappa(0.), fInnerRadius2(0.), fOuterRadius2(0.),
212 fTanInnerStereo2(0.), fTanOuterStereo2(0.), fLowerEndcap(0), fUpperEndcap(0),
213 fLatterTwisted(0), fFormerTwisted(0), fInnerHype(0), fOuterHype(0),
214 fCubicVolume(0.), fSurfaceArea(0.),
215 fRebuildPolyhedron(false), fpPolyhedron(0)
237 :
G4VSolid(rhs), fPhiTwist(rhs.fPhiTwist),
238 fInnerRadius(rhs.fInnerRadius), fOuterRadius(rhs.fOuterRadius),
239 fDPhi(rhs.fDPhi), fZHalfLength(rhs.fZHalfLength),
240 fInnerStereo(rhs.fInnerStereo), fOuterStereo(rhs.fOuterStereo),
241 fTanInnerStereo(rhs.fTanInnerStereo), fTanOuterStereo(rhs.fTanOuterStereo),
242 fKappa(rhs.fKappa), fInnerRadius2(rhs.fInnerRadius2),
243 fOuterRadius2(rhs.fOuterRadius2), fTanInnerStereo2(rhs.fTanInnerStereo2),
244 fTanOuterStereo2(rhs.fTanOuterStereo2),
245 fLowerEndcap(0), fUpperEndcap(0), fLatterTwisted(0), fFormerTwisted(0),
246 fInnerHype(0), fOuterHype(0),
247 fCubicVolume(rhs.fCubicVolume), fSurfaceArea(rhs.fSurfaceArea),
248 fRebuildPolyhedron(false), fpPolyhedron(0),
249 fLastInside(rhs.fLastInside), fLastNormal(rhs.fLastNormal),
250 fLastDistanceToIn(rhs.fLastDistanceToIn),
251 fLastDistanceToOut(rhs.fLastDistanceToOut),
252 fLastDistanceToInWithV(rhs.fLastDistanceToInWithV),
253 fLastDistanceToOutWithV(rhs.fLastDistanceToOutWithV)
255 for (
size_t i=0; i<2; ++i)
274 if (
this == &rhs) {
return *
this; }
299 for (
size_t i=0; i<2; ++i)
324 "G4TwistedTubs does not support Parameterisation.");
341 if (pMin.
x() >= pMax.
x() || pMin.
y() >= pMax.
y() || pMin.
z() >= pMax.
z())
344 message <<
"Bad bounding box (min >= max) for solid: "
346 <<
"\npMin = " << pMin
347 <<
"\npMax = " << pMax;
348 G4Exception(
"G4TwistedTubs::BoundingLimits()",
"GeomMgt0001",
397 tmpp->
set(p.
x(), p.
y(), p.
z());
404 if ((outerhypearea ==
kOutside) || (distanceToOut < -halftol))
414 if (distanceToOut <= halftol)
449 tmpp->
set(p.
x(), p.
y(), p.
z());
468 if (tmpdistance < distance)
470 distance = tmpdistance;
476 tmpsurface[0] = surfaces[besti];
477 *tmpnormal = tmpsurface[0]->
GetNormal(bestxx,
true);
511 tmpp->
set(p.
x(), p.
y(), p.
z());
512 tmpv->
set(v.
x(), v.
y(), v.
z());
562 if (tmpdistance < distance)
564 distance = tmpdistance;
596 tmpp->
set(p.
x(), p.
y(), p.
z());
634 if (tmpdistance < distance)
636 distance = tmpdistance;
645 G4Exception(
"G4TwistedTubs::DistanceToIn(p)",
"GeomSolids0003",
684 tmpp->
set(p.
x(), p.
y(), p.
z());
685 tmpv->
set(v.
x(), v.
y(), v.
z());
710 *norm = (blockedsurface->
GetNormal(p,
true));
742 if (tmpdistance < distance)
744 distance = tmpdistance;
754 *norm = (surfaces[besti]->
GetNormal(p,
true));
788 tmpp->
set(p.
x(), p.
y(), p.
z());
827 if (tmpdistance < distance)
829 distance = tmpdistance;
839 G4Exception(
"G4TwistedTubs::DistanceToOut(p)",
"GeomSolids0003",
855 G4int oldprc = os.precision(16);
856 os <<
"-----------------------------------------------------------\n"
857 <<
" *** Dump for solid - " <<
GetName() <<
" ***\n"
858 <<
" ===================================================\n"
859 <<
" Solid type: G4TwistedTubs\n"
861 <<
" -ve end Z : " <<
fEndZ[0]/
mm <<
" mm \n"
862 <<
" +ve end Z : " <<
fEndZ[1]/
mm <<
" mm \n"
872 <<
" phi-width of a piece : " <<
fDPhi/
degree <<
" degrees \n"
873 <<
"-----------------------------------------------------------\n";
874 os.precision(oldprc);
897 return G4VisExtent( -maxEndOuterRad, maxEndOuterRad,
898 -maxEndOuterRad, maxEndOuterRad,
916 const G4int nnodes = 4*(k-1)*(n-2) + 2*k*k ;
917 const G4int nfaces = 4*(k-1)*(n-1) + 2*(k-1)*(k-1) ;
921 typedef G4int G4int4[4];
922 G4double3* xyz =
new G4double3[nnodes];
923 G4int4* faces =
new G4int4[nfaces] ;
1086 else if ( (chose >= a1) && (chose < a1 + a2 ) )
1096 else if ( (chose >= a1 + a2 ) && (chose < a1 + a2 + a3 ) )
1106 else if ( (chose >= a1 + a2 + a3 ) && (chose < a1 + a2 + a3 + a4 ) )
1115 else if( (chose >= a1 + a2 + a3 + a4 )&&(chose < a1 + a2 + a3 + a4 + a5 ) )
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimits, const G4Transform3D &pTransform3D, G4double &pMin, G4double &pMax) const
void set(double x, double y, double z)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
void ComputeDimensions(G4VPVParameterisation *, const G4int, const G4VPhysicalVolume *)
G4Polyhedron * fpPolyhedron
G4double GetEndOuterRadius() const
G4int createPolyhedron(G4int Nnodes, G4int Nfaces, const G4double xyz[][3], const G4int faces[][4])
LastValue fLastDistanceToOut
std::vector< ExP01TrackerHit * > a
G4Polyhedron * GetPolyhedron() const
virtual void AddSolid(const G4Box &)=0
G4double GetSurfaceArea()
static const G4double kInfinity
G4VTwistSurface * fInnerHype
void DescribeYourselfTo(G4VGraphicsScene &scene) const
G4double fTanOuterStereo2
static constexpr double mm
G4bool fRebuildPolyhedron
G4TwistedTubs(const G4String &pname, G4double twistedangle, G4double endinnerrad, G4double endouterrad, G4double halfzlen, G4double dphi)
void message(RunManager *runmanager)
virtual G4double GetSurfaceArea()
G4VTwistSurface * fLatterTwisted
G4double fTanInnerStereo2
static double normal(HepRandomEngine *eptr)
G4double GetRadialTolerance() const
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcnorm=G4bool(false), G4bool *validnorm=0, G4ThreeVector *n=0) const
G4bool IsValidNorm() const
G4VTwistSurface * fLowerEndcap
G4GeometryType GetEntityType() const
virtual G4double GetSurfaceArea()=0
virtual G4ThreeVector GetNormal(const G4ThreeVector &xx, G4bool isGlobal)=0
G4VisExtent GetExtent() const
G4VSolid & operator=(const G4VSolid &rhs)
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
G4VTwistSurface * fFormerTwisted
#define G4MUTEX_INITIALIZER
virtual G4double DistanceTo(const G4ThreeVector &gp, G4ThreeVector &gxx)
static constexpr double twopi
G4double GetCubicVolume()
virtual G4double DistanceToIn(const G4ThreeVector &gp, const G4ThreeVector &gv, G4ThreeVector &gxxbest)
EInside Inside(const G4ThreeVector &p) const
virtual G4double GetBoundaryMax(G4double)=0
virtual G4double GetBoundaryMin(G4double)=0
G4VTwistSurface * fUpperEndcap
G4TwistedTubs & operator=(const G4TwistedTubs &rhs)
LastValue fLastDistanceToIn
ThreeVector shoot(const G4int Ap, const G4int Af)
G4double fEndOuterRadius[2]
static G4int GetNumberOfRotationSteps()
G4Polyhedron * CreatePolyhedron() const
G4double GetEndInnerRadius() const
G4VTwistSurface ** surface
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
void SetNeighbours(G4VTwistSurface *axis0min, G4VTwistSurface *axis1min, G4VTwistSurface *axis0max, G4VTwistSurface *axis1max)
std::ostream & StreamInfo(std::ostream &os) const
G4int GetNumberOfRotationStepsAtTimeOfCreation() const
LastValueWithDoubleVector fLastDistanceToInWithV
G4VTwistSurface * fOuterHype
G4ThreeVector GetPointOnSurface() const
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
void SetFields(G4double phitwist, G4double innerrad, G4double outerrad, G4double negativeEndz, G4double positiveEndz)
HepRotation & rotateZ(double delta)
G4double fEndInnerRadius[2]
static constexpr double degree
virtual G4ThreeVector SurfacePoint(G4double, G4double, G4bool isGlobal=false)=0
static G4GeometryTolerance * GetInstance()
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
virtual G4double DistanceToOut(const G4ThreeVector &gp, const G4ThreeVector &gv, G4ThreeVector &gxxbest)
LastValueWithDoubleVector fLastDistanceToOutWithV
virtual void GetFacets(G4int m, G4int n, G4double xyz[][3], G4int faces[][4], G4int iside)=0