54 #ifndef __G4TWISTEDTUBS__
55 #define __G4TWISTEDTUBS__
134 std::ostream &
StreamInfo(std::ostream& os)
const;
155 {
return fEndInnerRadius[i]; }
157 {
return fEndOuterRadius[i]; }
159 {
return (fEndInnerRadius[0] > fEndInnerRadius[1] ?
160 fEndInnerRadius[0] : fEndInnerRadius[1]); }
162 {
return (fEndOuterRadius[0] > fEndOuterRadius[1] ?
163 fEndOuterRadius[0] : fEndOuterRadius[1]); }
199 void CreateSurfaces();
249 p.
set(kInfinity,kInfinity,kInfinity);
253 LastState(
const LastState&
r) : p(r.p), inside(r.inside){}
256 if (
this == &r) {
return *
this; }
257 p = r.p; inside = r.inside;
270 p.
set(kInfinity,kInfinity,kInfinity);
271 vec.set(kInfinity,kInfinity,kInfinity);
278 LastVector(
const LastVector&
r) : p(r.p), vec(r.vec)
281 surface[0] = r.surface[0];
285 if (&r ==
this) {
return *
this; }
286 p = r.p; vec = r.vec;
288 surface[0] = r.surface[0];
302 p.
set(kInfinity,kInfinity,kInfinity);
306 LastValue(
const LastValue&
r) : p(r.p),
value(r.
value){}
309 if (
this == &r) {
return *
this; }
310 p = r.p;
value = r.value;
318 class LastValueWithDoubleVector
321 LastValueWithDoubleVector()
323 p.
set(kInfinity,kInfinity,kInfinity);
324 vec.set(kInfinity,kInfinity,kInfinity);
327 ~LastValueWithDoubleVector(){}
328 LastValueWithDoubleVector(
const LastValueWithDoubleVector&
r)
330 LastValueWithDoubleVector&
operator=(
const LastValueWithDoubleVector&
r)
332 if (
this == &r) {
return *
this; }
333 p = r.p; vec = r.vec;
value = r.value;
342 LastState fLastInside;
343 LastVector fLastNormal;
344 LastValue fLastDistanceToIn;
345 LastValue fLastDistanceToOut;
346 LastValueWithDoubleVector fLastDistanceToInWithV;
347 LastValueWithDoubleVector fLastDistanceToOutWithV;
363 fPhiTwist = phitwist;
364 fEndZ[0] = negativeEndz;
365 fEndZ[1] = positiveEndz;
366 fEndZ2[0] = fEndZ[0] * fEndZ[0];
367 fEndZ2[1] = fEndZ[1] * fEndZ[1];
368 fInnerRadius = innerrad;
369 fOuterRadius = outerrad;
370 fInnerRadius2 = fInnerRadius * fInnerRadius;
371 fOuterRadius2 = fOuterRadius * fOuterRadius;
373 if (std::fabs(fEndZ[0]) >= std::fabs(fEndZ[1])) {
374 fZHalfLength = std::fabs(fEndZ[0]);
376 fZHalfLength = std::fabs(fEndZ[1]);
379 G4double parity = (fPhiTwist > 0 ? 1 : -1);
380 G4double tanHalfTwist = std::tan(0.5 * fPhiTwist);
381 G4double innerNumerator = std::fabs(fInnerRadius * tanHalfTwist) * parity;
382 G4double outerNumerator = std::fabs(fOuterRadius * tanHalfTwist) * parity;
384 fTanInnerStereo = innerNumerator / fZHalfLength;
385 fTanOuterStereo = outerNumerator / fZHalfLength;
386 fTanInnerStereo2 = fTanInnerStereo * fTanInnerStereo;
387 fTanOuterStereo2 = fTanOuterStereo * fTanOuterStereo;
388 fInnerStereo = std::atan2(innerNumerator, fZHalfLength);
389 fOuterStereo = std::atan2(outerNumerator, fZHalfLength);
390 fEndInnerRadius[0] = std::sqrt(fInnerRadius2 + fEndZ2[0] * fTanInnerStereo2);
391 fEndInnerRadius[1] = std::sqrt(fInnerRadius2 + fEndZ2[1] * fTanInnerStereo2);
392 fEndOuterRadius[0] = std::sqrt(fOuterRadius2 + fEndZ2[0] * fTanOuterStereo2);
393 fEndOuterRadius[1] = std::sqrt(fOuterRadius2 + fEndZ2[1] * fTanOuterStereo2);
395 fKappa = tanHalfTwist / fZHalfLength;
396 fEndPhi[0] = std::atan2(fEndZ[0] * tanHalfTwist, fZHalfLength);
397 fEndPhi[1] = std::atan2(fEndZ[1] * tanHalfTwist, fZHalfLength);
400 G4cout <<
"/********* G4TwistedTubs::SetFields() Field Parameters ***************** " <<
G4endl;
402 G4cout <<
"/* fEndZ(0, 1) : " << fEndZ[0] <<
" , " << fEndZ[1] <<
G4endl;
403 G4cout <<
"/* fEndPhi(0, 1) : " << fEndPhi[0] <<
" , " << fEndPhi[1] <<
G4endl;
404 G4cout <<
"/* fInnerRadius, fOuterRadius : " << fInnerRadius <<
" , " << fOuterRadius <<
G4endl;
405 G4cout <<
"/* fEndInnerRadius(0, 1) : " << fEndInnerRadius[0] <<
" , "
406 << fEndInnerRadius[1] <<
G4endl;
407 G4cout <<
"/* fEndOuterRadius(0, 1) : " << fEndOuterRadius[0] <<
" , "
408 << fEndOuterRadius[1] <<
G4endl;
409 G4cout <<
"/* fInnerStereo, fOuterStereo : " << fInnerStereo <<
" , " << fOuterStereo <<
G4endl;
410 G4cout <<
"/* tanHalfTwist, fKappa : " << tanHalfTwist <<
" , " << fKappa <<
G4endl;
411 G4cout <<
"/*********************************************************************** " <<
G4endl;
void set(double x, double y, double z)
G4double GetEndInnerRadius() const
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
G4double GetEndOuterRadius() const
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
G4double GetPhiTwist() const
G4GLOB_DLL std::ostream G4cout
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
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
const XML_Char int const XML_Char * value
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
G4bool CalculateExtent(const EAxis paxis, const G4VoxelLimits &pvoxellimit, const G4AffineTransform &ptransform, G4double &pmin, G4double &pmax) const
G4TwistedTubs & operator=(const G4TwistedTubs &rhs)