54 #ifndef __G4TWISTEDTUBS__
55 #define __G4TWISTEDTUBS__
136 std::ostream &
StreamInfo(std::ostream& os)
const;
157 {
return fEndInnerRadius[i]; }
159 {
return fEndOuterRadius[i]; }
161 {
return (fEndInnerRadius[0] > fEndInnerRadius[1] ?
162 fEndInnerRadius[0] : fEndInnerRadius[1]); }
164 {
return (fEndOuterRadius[0] > fEndOuterRadius[1] ?
165 fEndOuterRadius[0] : fEndOuterRadius[1]); }
201 void CreateSurfaces();
237 mutable G4bool fRebuildPolyhedron;
249 LastState(
const LastState& r) : p(r.p), inside(r.inside){}
252 if (
this == &r) {
return *
this; }
253 p = r.p; inside = r.inside;
274 LastVector(
const LastVector& r) : p(r.p), vec(r.vec)
277 surface[0] = r.surface[0];
279 LastVector&
operator=(
const LastVector& r)
281 if (&r ==
this) {
return *
this; }
282 p = r.p; vec = r.vec;
284 surface[0] = r.surface[0];
302 LastValue(
const LastValue& r) : p(r.p),
value(r.
value){}
305 if (
this == &r) {
return *
this; }
306 p = r.p;
value = r.value;
314 class LastValueWithDoubleVector
317 LastValueWithDoubleVector()
323 ~LastValueWithDoubleVector(){}
324 LastValueWithDoubleVector(
const LastValueWithDoubleVector& r)
326 LastValueWithDoubleVector&
operator=(
const LastValueWithDoubleVector& r)
328 if (
this == &r) {
return *
this; }
329 p = r.p; vec = r.vec;
value = r.value;
338 LastState fLastInside;
339 LastVector fLastNormal;
340 LastValue fLastDistanceToIn;
341 LastValue fLastDistanceToOut;
342 LastValueWithDoubleVector fLastDistanceToInWithV;
343 LastValueWithDoubleVector fLastDistanceToOutWithV;
359 fPhiTwist = phitwist;
360 fEndZ[0] = negativeEndz;
361 fEndZ[1] = positiveEndz;
362 fEndZ2[0] = fEndZ[0] * fEndZ[0];
363 fEndZ2[1] = fEndZ[1] * fEndZ[1];
364 fInnerRadius = innerrad;
365 fOuterRadius = outerrad;
366 fInnerRadius2 = fInnerRadius * fInnerRadius;
367 fOuterRadius2 = fOuterRadius * fOuterRadius;
369 if (std::fabs(fEndZ[0]) >= std::fabs(fEndZ[1])) {
370 fZHalfLength = std::fabs(fEndZ[0]);
372 fZHalfLength = std::fabs(fEndZ[1]);
376 G4double tanHalfTwist = std::tan(0.5 * fPhiTwist);
377 G4double innerNumerator = std::fabs(fInnerRadius * tanHalfTwist) *
parity;
378 G4double outerNumerator = std::fabs(fOuterRadius * tanHalfTwist) *
parity;
380 fTanInnerStereo = innerNumerator / fZHalfLength;
381 fTanOuterStereo = outerNumerator / fZHalfLength;
382 fTanInnerStereo2 = fTanInnerStereo * fTanInnerStereo;
383 fTanOuterStereo2 = fTanOuterStereo * fTanOuterStereo;
384 fInnerStereo = std::atan2(innerNumerator, fZHalfLength);
385 fOuterStereo = std::atan2(outerNumerator, fZHalfLength);
386 fEndInnerRadius[0] = std::sqrt(fInnerRadius2 + fEndZ2[0] * fTanInnerStereo2);
387 fEndInnerRadius[1] = std::sqrt(fInnerRadius2 + fEndZ2[1] * fTanInnerStereo2);
388 fEndOuterRadius[0] = std::sqrt(fOuterRadius2 + fEndZ2[0] * fTanOuterStereo2);
389 fEndOuterRadius[1] = std::sqrt(fOuterRadius2 + fEndZ2[1] * fTanOuterStereo2);
391 fKappa = tanHalfTwist / fZHalfLength;
392 fEndPhi[0] = std::atan2(fEndZ[0] * tanHalfTwist, fZHalfLength);
393 fEndPhi[1] = std::atan2(fEndZ[1] * tanHalfTwist, fZHalfLength);
396 G4cout <<
"/********* G4TwistedTubs::SetFields() Field Parameters ***************** " <<
G4endl;
398 G4cout <<
"/* fEndZ(0, 1) : " << fEndZ[0] <<
" , " << fEndZ[1] <<
G4endl;
399 G4cout <<
"/* fEndPhi(0, 1) : " << fEndPhi[0] <<
" , " << fEndPhi[1] <<
G4endl;
400 G4cout <<
"/* fInnerRadius, fOuterRadius : " << fInnerRadius <<
" , " << fOuterRadius <<
G4endl;
401 G4cout <<
"/* fEndInnerRadius(0, 1) : " << fEndInnerRadius[0] <<
" , "
402 << fEndInnerRadius[1] <<
G4endl;
403 G4cout <<
"/* fEndOuterRadius(0, 1) : " << fEndOuterRadius[0] <<
" , "
404 << fEndOuterRadius[1] <<
G4endl;
405 G4cout <<
"/* fInnerStereo, fOuterStereo : " << fInnerStereo <<
" , " << fOuterStereo <<
G4endl;
406 G4cout <<
"/* tanHalfTwist, fKappa : " << tanHalfTwist <<
" , " << fKappa <<
G4endl;
407 G4cout <<
"/*********************************************************************** " <<
G4endl;
void set(double x, double y, double z)
G4double GetEndInnerRadius() const
static const G4double kInfinity
G4ThreeVector GetPointOnSurface() const
G4double GetEndPhi(G4int i) const
std::ostream & StreamInfo(std::ostream &os) const
G4Polyhedron * CreatePolyhedron() const
G4double GetOuterStereo() const
EInside Inside(const G4ThreeVector &p) const
G4double GetKappa() const
G4double GetInnerRadius() const
void ComputeDimensions(G4VPVParameterisation *, const G4int, const G4VPhysicalVolume *)
G4double GetEndOuterRadius(G4int i) const
G4GeometryType GetEntityType() const
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
G4double GetEndOuterRadius() const
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
G4double GetPhiTwist() const
G4GLOB_DLL std::ostream G4cout
const XML_Char int const XML_Char * value
void DescribeYourselfTo(G4VGraphicsScene &scene) const
G4double GetTanInnerStereo() const
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcnorm=G4bool(false), G4bool *validnorm=0, G4ThreeVector *n=0) const
G4double GetTanInnerStereo2() const
void Extent(G4ThreeVector &pMin, G4ThreeVector &pMax) const
G4double GetSurfaceArea()
G4double GetTanOuterStereo() const
G4double GetEndInnerRadius(G4int i) const
G4double GetZHalfLength() const
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
G4double GetEndZ(G4int i) const
G4double GetTanOuterStereo2() const
G4double GetInnerStereo() const
G4TwistedTubs(const G4String &pname, G4double twistedangle, G4double endinnerrad, G4double endouterrad, G4double halfzlen, G4double dphi)
G4double GetCubicVolume()
G4VisExtent GetExtent() const
G4double GetOuterRadius() const
G4Polyhedron * GetPolyhedron() const
G4TwistedTubs & operator=(const G4TwistedTubs &rhs)