Import Geant4 8.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 14:36:02 +02:00
parent d93e1e39a9
commit 8a51e0bc40
5471 changed files with 99628 additions and 55248 deletions
@@ -22,7 +22,7 @@
//
//
// $Id: G4ClippablePolygon.hh,v 1.9 2003/11/03 18:39:54 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
@@ -22,7 +22,7 @@
//
//
// $Id: G4ClippablePolygon.icc,v 1.3 2001/07/11 10:00:14 gunter Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
@@ -0,0 +1,132 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4Ellipsoid.hh,v 1.9 2005/11/09 15:04:28 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
// G4Ellipsoid
//
// Class description:
//
// A G4Ellipsoid is an ellipsoidal solid, optionally cut at a given z.
//
// Member Data:
//
// xSemiAxis semi-axis, x
// ySemiAxis semi-axis, y
// zSemiAxis semi-axis, z
// zBottomCut lower cut plane level, z (solid lies above this plane)
// zTopCut upper cut plane level, z (solid lies below this plane)
// History:
// -------
// 10.11.1999 G.Horton-Smith (Caltech, USA) - First implementation
// 10.02.2005 G.Guerrieri (INFN Genova, Italy) - Revision
// --------------------------------------------------------------------
#ifndef G4Ellipsoid_HH
#define G4Ellipsoid_HH
#include "G4VSolid.hh"
class G4Ellipsoid : public G4VSolid
{
public: // with description
G4Ellipsoid(const G4String& pName,
G4double pxSemiAxis,
G4double pySemiAxis,
G4double pzSemiAxis,
G4double pzBottomCut=0,
G4double pzTopCut=0);
virtual ~G4Ellipsoid();
// Access functions
inline G4double GetSemiAxisMax (G4int i) const;
inline G4double GetZBottomCut() const;
inline G4double GetZTopCut() const;
inline void SetSemiAxis (G4double x, G4double y, G4double z);
inline void SetZCuts (G4double newzBottomCut, G4double newzTopCut);
inline G4double GetCubicVolume();
// Solid standard methods
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pmin, G4double& pmax) const;
EInside Inside(const G4ThreeVector& p) const;
G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const;
G4double DistanceToIn(const G4ThreeVector& p,
const G4ThreeVector& v) const;
G4double DistanceToIn(const G4ThreeVector& p) const;
G4double DistanceToOut(const G4ThreeVector& p,
const G4ThreeVector& v,
const G4bool calcNorm=G4bool(false),
G4bool *validNorm=0,
G4ThreeVector *n=0) const;
G4double DistanceToOut(const G4ThreeVector& p) const;
G4GeometryType GetEntityType() const;
std::ostream& StreamInfo(std::ostream& os) const;
G4ThreeVector GetPointOnSurface() const;
// Visualisation functions
G4Polyhedron* GetPolyhedron () const;
void DescribeYourselfTo(G4VGraphicsScene& scene) const;
G4VisExtent GetExtent() const;
G4Polyhedron* CreatePolyhedron() const;
G4NURBS* CreateNURBS() const;
public: // without description
G4Ellipsoid(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
protected: // without description
G4ThreeVectorList* CreateRotatedVertices(const G4AffineTransform& pT,
G4int& noPV) const;
mutable G4Polyhedron* fpPolyhedron;
private:
G4double fCubicVolume;
G4double xSemiAxis, ySemiAxis, zSemiAxis,
semiAxisMax, zBottomCut, zTopCut;
};
#include "G4Ellipsoid.icc"
#endif
@@ -0,0 +1,91 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4Ellipsoid.icc,v 1.3 2005/07/04 13:32:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
//
// G4Ellipsoid.icc
//
// Implementation of inline methods of G4Ellipsoid
// --------------------------------------------------------------------
G4double G4Ellipsoid::GetSemiAxisMax (G4int i) const
{
return (i==0) ? xSemiAxis
: (i==1) ? ySemiAxis
: zSemiAxis;
}
G4double G4Ellipsoid::GetZBottomCut() const
{
return zBottomCut;
}
G4double G4Ellipsoid::GetZTopCut() const
{
return zTopCut;
}
void G4Ellipsoid::SetSemiAxis (G4double newxSemiAxis,
G4double newySemiAxis,
G4double newzSemiAxis)
{
xSemiAxis= newxSemiAxis; ySemiAxis= newySemiAxis; zSemiAxis= newzSemiAxis;
semiAxisMax = xSemiAxis > ySemiAxis ? xSemiAxis : ySemiAxis;
if (zSemiAxis > semiAxisMax) { semiAxisMax= zSemiAxis; }
if (zBottomCut < -zSemiAxis) { zBottomCut = -zSemiAxis; }
if (zTopCut > +zSemiAxis) { zTopCut = +zSemiAxis; }
}
void G4Ellipsoid::SetZCuts (G4double newzBottomCut, G4double newzTopCut)
{
zBottomCut = newzBottomCut;
zTopCut = newzTopCut;
if (zBottomCut < -zSemiAxis) { zBottomCut = -zSemiAxis; }
if (zTopCut > +zSemiAxis) { zTopCut = +zSemiAxis; }
}
inline
G4double G4Ellipsoid::GetCubicVolume()
{
if(fCubicVolume != 0 ) {;}
else
{
if ((zTopCut > +zSemiAxis && zBottomCut < -zSemiAxis)
|| (zTopCut == 0 && zBottomCut == 0) )
{
fCubicVolume = (4./3.)*pi*xSemiAxis*ySemiAxis*zSemiAxis;
}
else
{
fCubicVolume = pi*xSemiAxis*ySemiAxis
* ((zTopCut-std::pow(zTopCut,3.)/(3.*sqr(zSemiAxis)))
- (zBottomCut-std::pow(zBottomCut,3.)/(3.*sqr(zSemiAxis))));
}
}
return fCubicVolume;
}
@@ -0,0 +1,146 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4EllipticalCone.hh,v 1.5 2005/11/09 15:04:28 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
// G4EllipticalCone
//
// Class description:
//
// G4EllipticalCone is a full cone with elliptical base which can be cut in Z.
//
// Member Data:
//
// xSemiAxis semi-axis, x
// ySemiAxis semi-axis, y
// zheight height, z
// zTopCut upper cut plane level, z
//
// The height in Z corresponds to where the elliptical cone hits the
// Z-axis if it had no Z cut. Also the cone is centered at zero having a
// base at zTopCut and another at -zTopCut. The semi-major axes at the Z=0
// plane are given by xSemiAxis*zheight and ySemiAxis*zheight so that the
// curved surface of our cone satisfies the equation:
//
// ***************************************************************************
// * *
// * (x/xSemiAxis)^2 + (y/ySemiAxis)^2 = (zheight - z)^2 *
// * *
// ***************************************************************************
//
// Author:
// Dionysios Anninos, 8.9.2005
//
// --------------------------------------------------------------------
#ifndef G4EllipticalCone_HH
#define G4EllipticalCone_HH
#include "G4VSolid.hh"
class G4EllipticalCone : public G4VSolid
{
public: // with description
G4EllipticalCone(const G4String& pName,
G4double pxSemiAxis,
G4double pySemiAxis,
G4double zMax,
G4double pzTopCut);
virtual ~G4EllipticalCone();
// Access functions
//
inline G4double GetSemiAxisMax () const;
inline G4double GetZTopCut() const;
inline void SetSemiAxis (G4double x, G4double y, G4double z);
inline void SetZCut (G4double newzTopCut);
inline G4double GetCubicVolume();
// Solid standard methods
//
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pmin, G4double& pmax) const;
EInside Inside(const G4ThreeVector& p) const;
G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const;
G4double DistanceToIn(const G4ThreeVector& p,
const G4ThreeVector& v) const;
G4double DistanceToIn(const G4ThreeVector& p) const;
G4double DistanceToOut(const G4ThreeVector& p,
const G4ThreeVector& v,
const G4bool calcNorm=G4bool(false),
G4bool *validNorm=0,
G4ThreeVector *n=0) const;
G4double DistanceToOut(const G4ThreeVector& p) const;
G4GeometryType GetEntityType() const;
G4ThreeVector GetPointOnSurface() const;
std::ostream& StreamInfo(std::ostream& os) const;
// Visualisation functions
//
G4Polyhedron* GetPolyhedron () const;
void DescribeYourselfTo(G4VGraphicsScene& scene) const;
G4VisExtent GetExtent() const;
G4Polyhedron* CreatePolyhedron() const;
G4NURBS* CreateNURBS() const;
public: // without description
G4EllipticalCone(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
protected: // without description
G4ThreeVectorList* CreateRotatedVertices(const G4AffineTransform& pT,
G4int& noPV) const;
mutable G4Polyhedron* fpPolyhedron;
private:
G4double fCubicVolume;
G4double xSemiAxis, ySemiAxis, zheight,
semiAxisMax, zTopCut;
};
#include "G4EllipticalCone.icc"
#endif
@@ -0,0 +1,82 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4EllipticalCone.icc,v 1.3 2005/08/16 13:27:33 danninos Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
//
// G4EllipticalCone.icc
//
// Implementation of inline methods of G4EllipticalCone
// --------------------------------------------------------------------
// Author: Dionysios Anninos
// --------------------------------------------------------------------
G4double G4EllipticalCone::GetSemiAxisMax () const
{
return ySemiAxis > xSemiAxis ? ySemiAxis : xSemiAxis;
}
G4double G4EllipticalCone::GetZTopCut() const
{
return zTopCut;
}
void G4EllipticalCone::SetSemiAxis (G4double newxSemiAxis,
G4double newySemiAxis,
G4double newzMax)
{
xSemiAxis = newxSemiAxis;
ySemiAxis = newySemiAxis;
zheight = newzMax;
semiAxisMax = xSemiAxis > ySemiAxis ? xSemiAxis : ySemiAxis;
if (zTopCut > +zheight) { zTopCut = +zheight; }
}
void G4EllipticalCone::SetZCut (G4double newzTopCut)
{
zTopCut = newzTopCut;
if (zTopCut > +zheight) { zTopCut = +zheight; }
}
inline
G4double G4EllipticalCone::GetCubicVolume()
{
if(fCubicVolume != 0 ) {;}
else
{
if (zTopCut > +zheight )
{
fCubicVolume = (8./3.)*pi*xSemiAxis*ySemiAxis*zheight*zheight*zheight;
}
else
{
fCubicVolume = pi*xSemiAxis*ySemiAxis*
(2./3.*std::pow(zTopCut,3.)+2.*sqr(zheight)*zTopCut);
}
}
return fCubicVolume;
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4EllipticalTube.hh,v 1.13 2004/10/10 10:39:11 johna Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4EllipticalTube.hh,v 1.16 2005/11/09 15:04:28 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// --------------------------------------------------------------------
// GEANT 4 class header file
@@ -88,12 +88,14 @@ class G4EllipticalTube : public G4VSolid
G4double GetCubicVolume();
G4ThreeVector GetPointOnSurface() const;
// Visualisation methods
G4Polyhedron* CreatePolyhedron() const;
G4Polyhedron* GetPolyhedron () const;
void DescribeYourselfTo( G4VGraphicsScene& scene ) const;
G4VisExtent GetExtent() const;
virtual G4Polyhedron* GetPolyhedron () const;
// Accessors
@@ -105,6 +107,13 @@ class G4EllipticalTube : public G4VSolid
inline void SetDy( const G4double newDy );
inline void SetDz( const G4double newDz );
public: // without description
G4EllipticalTube(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
protected: // without description
G4double dx, dy, dz;
@@ -22,7 +22,7 @@
//
//
// $Id: G4EllipticalTube.icc,v 1.3 2004/10/10 10:39:16 johna Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4EnclosingCylinder.hh,v 1.6 2003/11/03 18:39:54 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4EnclosingCylinder.hh,v 1.7 2005/11/09 15:04:28 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
@@ -52,34 +52,41 @@ class G4EnclosingCylinder
{
public: // with description
G4EnclosingCylinder( const G4ReduciblePolygon *rz,
G4bool phiIsOpen,
G4double startPhi, G4double totalPhi );
~G4EnclosingCylinder();
G4EnclosingCylinder( const G4ReduciblePolygon *rz,
G4bool phiIsOpen,
G4double startPhi, G4double totalPhi );
~G4EnclosingCylinder();
G4bool MustBeOutside( const G4ThreeVector &p ) const;
// Decide very rapidly if the point is outside the cylinder.
// If one is not certain, return false.
G4bool MustBeOutside( const G4ThreeVector &p ) const;
// Decide very rapidly if the point is outside the cylinder.
// If one is not certain, return false.
G4bool ShouldMiss( const G4ThreeVector &p, const G4ThreeVector &v ) const;
// Decide very rapidly if the trajectory is going to miss the cylinder.
// If one is not sure, return false.
G4bool ShouldMiss( const G4ThreeVector &p, const G4ThreeVector &v ) const;
// Decide very rapidly if the trajectory is going to miss the cylinder.
// If one is not sure, return false.
public: // without description
G4EnclosingCylinder(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
protected:
G4double radius; // radius of our cylinder
G4double zLo, zHi; // z extent
G4double radius; // radius of our cylinder
G4double zLo, zHi; // z extent
G4bool phiIsOpen; // true if there is a phi segment
G4double startPhi, // for isPhiOpen==true, starting of phi segment
totalPhi; // for isPhiOpen==true, size of phi segment
G4bool phiIsOpen; // true if there is a phi segment
G4double startPhi, // for isPhiOpen==true, starting of phi segment
totalPhi; // for isPhiOpen==true, size of phi segment
G4double rx1, ry1,
dx1, dy1;
G4double rx2, ry2,
dx2, dy2;
G4double rx1, ry1,
dx1, dy1;
G4double rx2, ry2,
dx2, dy2;
G4bool concave; // true, if x/y cross section is concave
G4bool concave; // true, if x/y cross section is concave
};
@@ -21,9 +21,9 @@
// ********************************************************************
//
//
// $Id: G4Hype.hh,v 1.9 2004/10/10 10:39:19 johna Exp $
// $Id: G4Hype.hh,v 1.13 2005/11/17 16:59:23 link Exp $
// $Original: G4Hype.hh,v 1.0 1998/06/09 16:57:50 safai Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
@@ -34,54 +34,24 @@
//
// Class description:
//
// This class implements in G4 the volume equivalent to the
// HYPE volume in Geant 3.21, i.e. a tube with hyperbolic profile.
// This class implements a tube with hyperbolic profile.
//
// For further informations, please read G4Hype.history and G4Hype.doc.
//
// An hyperbolic volume with curved sides parallel to the z-axis.
// The Hype has a specified half-length along the z axis, about which
// it is centred, and a given minimum and maximum radius.
// It describes an hyperbolic volume with curved sides parallel to
// the z-axis. The solid has a specified half-length along the z axis,
// about which it is centered, and a given minimum and maximum radius.
// A minimum radius of 0 signifies a filled Hype (with hyperbolical
// inner surface). To have a filled Hype the user must specify
// inner radius = 0 AND inner stereo angle = 0.
//
// The inner and outer hyperbolical surfaces can have different
// stereo angles. A stereo angle of 0 gives a cylindrical surface.
//
// Member functions:
//
// As inherited from G4VSolid,
//
// G4Hype(const G4String& pName
// const G4double innerRadius
// const G4double outerRadius
// const G4double innerStereo
// const G4double outerStereo
// const G4double halfLenZ )
//
// Construct an hype with the given name and dimensions.
// The provided angles are in radians.
//
//
// Protected:
//
// G4ThreeVectorList*
// CreateRotatedVertices(const G4AffineTransform& pTransform) const
//
// Create the List of transformed vertices in the format required
// for G4VSolid::ClipCrossSection and ClipBetweenSections.
// Authors:
// Ernesto Lamanna (Ernesto.Lamanna@roma1.infn.it) &
// Francesco Safai Tehrani (Francesco.SafaiTehrani@roma1.infn.it)
// Rome, INFN & University of Rome "La Sapienza", 9 June 1998.
//
// History:
// Updated Feb 2000 D.C. Williams
//
// --------------------------------------------------------------------
#ifndef G4HYPE_HH
#define G4HYPE_HH
@@ -95,12 +65,12 @@ class G4Hype : public G4VSolid
{
public: // with description
G4Hype(const G4String &pName,
G4double newInnerRadius,
G4double newOuterRadius,
G4double newInnerStereo,
G4double newOuterStereo,
G4double newHalfLenZ);
G4Hype(const G4String& pName,
G4double newInnerRadius,
G4double newOuterRadius,
G4double newInnerStereo,
G4double newOuterStereo,
G4double newHalfLenZ);
virtual ~G4Hype();
@@ -139,15 +109,24 @@ class G4Hype : public G4VSolid
G4GeometryType GetEntityType() const;
std::ostream& StreamInfo(std::ostream& os) const;
G4double GetCubicVolume();
G4ThreeVector GetPointOnSurface() const;
void DescribeYourselfTo (G4VGraphicsScene& scene) const;
G4VisExtent GetExtent () const;
G4Polyhedron* CreatePolyhedron () const;
G4NURBS* CreateNURBS () const;
G4Polyhedron* GetPolyhedron () const;
public: // without description
G4Hype(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
protected: // without description
inline G4bool InnerSurfaceExists() const;
@@ -202,7 +181,12 @@ class G4Hype : public G4VSolid
private:
G4double asinh(G4double arg);
private:
G4double fCubicVolume;
mutable G4Polyhedron* fpPolyhedron;
};
@@ -22,7 +22,7 @@
//
//
// $Id: G4Hype.icc,v 1.6 2004/12/02 09:31:30 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4IntersectingCone.hh,v 1.7 2004/12/02 09:31:30 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4IntersectingCone.hh,v 1.8 2005/11/09 15:04:28 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
@@ -50,34 +50,42 @@ class G4IntersectingCone
{
public:
G4IntersectingCone( const G4double r[2], const G4double z[2] );
virtual ~G4IntersectingCone();
G4IntersectingCone( const G4double r[2], const G4double z[2] );
virtual ~G4IntersectingCone();
G4int LineHitsCone( const G4ThreeVector &p, const G4ThreeVector &v,
G4double *s1, G4double *s2 );
G4int LineHitsCone( const G4ThreeVector &p, const G4ThreeVector &v,
G4double *s1, G4double *s2 );
G4bool HitOn( const G4double r, const G4double z );
inline G4double RLo() const { return rLo; }
inline G4double RHi() const { return rHi; }
inline G4double ZLo() const { return zLo; }
inline G4double ZHi() const { return zHi; }
G4bool HitOn( const G4double r, const G4double z );
inline G4double RLo() const { return rLo; }
inline G4double RHi() const { return rHi; }
inline G4double ZLo() const { return zLo; }
inline G4double ZHi() const { return zHi; }
public: // without description
G4IntersectingCone(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
protected:
G4double zLo, zHi, // Z bounds of side
rLo, rHi; // R bounds of side
G4double zLo, zHi, // Z bounds of side
rLo, rHi; // R bounds of side
G4bool type1; // True if cone is type 1 (std::abs(z1-z2)>std::abs(r1-r2))
G4double A, B; // Cone radius parameter:
// type 1: r = A + B*z
// type 2: z = A + B*r
G4bool type1; // True if cone is type 1
// (std::abs(z1-z2)>std::abs(r1-r2))
G4double A, B; // Cone radius parameter:
// type 1: r = A + B*z
// type 2: z = A + B*r
G4int LineHitsCone1( const G4ThreeVector &p, const G4ThreeVector &v,
G4double *s1, G4double *s2 );
G4int LineHitsCone2( const G4ThreeVector &p, const G4ThreeVector &v,
G4double *s1, G4double *s2 );
G4int LineHitsCone1( const G4ThreeVector &p, const G4ThreeVector &v,
G4double *s1, G4double *s2 );
G4int LineHitsCone2( const G4ThreeVector &p, const G4ThreeVector &v,
G4double *s1, G4double *s2 );
};
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PolyPhiFace.hh,v 1.5 2002/10/28 11:47:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4PolyPhiFace.hh,v 1.8 2005/11/30 10:33:42 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
@@ -57,106 +57,113 @@
class G4ReduciblePolygon;
typedef struct
struct G4PolyPhiFaceVertex
{
G4double x, y, r, z; // position
G4double rNorm,
zNorm; // r/z normal
G4ThreeVector norm3D; // 3D normal
} G4PolyPhiFaceVertex;
};
typedef struct
struct G4PolyPhiFaceEdge
{
G4PolyPhiFaceEdge(): v0(0), v1(0) {}
G4PolyPhiFaceVertex *v0, *v1; // Corners
G4double tr, tz, // Unit vector along edge
length; // Length of edge
G4ThreeVector norm3D; // 3D edge normal vector
} G4PolyPhiFaceEdge;
};
class G4PolyPhiFace : public G4VCSGface
{
public: // with description
G4PolyPhiFace( const G4ReduciblePolygon *rz,
G4double phi, G4double deltaPhi, G4double phiOther );
// Constructor.
// Points r,z should be supplied in clockwise order in r,z.
// For example:
// [1]---------[2] ^ R
// | | |
// | | +--> z
// [0]---------[3]
G4PolyPhiFace( const G4ReduciblePolygon *rz,
G4double phi, G4double deltaPhi, G4double phiOther );
// Constructor.
// Points r,z should be supplied in clockwise order in r,z.
// For example:
// [1]---------[2] ^ R
// | | |
// | | +--> z
// [0]---------[3]
virtual ~G4PolyPhiFace();
// Destructor. Removes edges and corners.
virtual ~G4PolyPhiFace();
// Destructor. Removes edges and corners.
G4PolyPhiFace( const G4PolyPhiFace &source );
G4PolyPhiFace& operator=( const G4PolyPhiFace &source );
// Copy constructor and assgnment operator.
G4PolyPhiFace( const G4PolyPhiFace &source );
G4PolyPhiFace& operator=( const G4PolyPhiFace &source );
// Copy constructor and assgnment operator.
G4bool Intersect( const G4ThreeVector &p, const G4ThreeVector &v,
G4bool outgoing, G4double surfTolerance,
G4double &distance, G4double &distFromSurface,
G4ThreeVector &normal, G4bool &allBehind );
G4bool Intersect( const G4ThreeVector &p, const G4ThreeVector &v,
G4bool outgoing, G4double surfTolerance,
G4double &distance, G4double &distFromSurface,
G4ThreeVector &normal, G4bool &allBehind );
G4double Distance( const G4ThreeVector &p, G4bool outgoing );
G4double Distance( const G4ThreeVector &p, G4bool outgoing );
EInside Inside( const G4ThreeVector &p, G4double tolerance,
G4double *bestDistance );
EInside Inside( const G4ThreeVector &p, G4double tolerance,
G4double *bestDistance );
G4ThreeVector Normal( const G4ThreeVector &p, G4double *bestDistance );
G4ThreeVector Normal( const G4ThreeVector &p, G4double *bestDistance );
G4double Extent( const G4ThreeVector axis );
G4double Extent( const G4ThreeVector axis );
void CalculateExtent( const EAxis axis,
const G4VoxelLimits &voxelLimit,
const G4AffineTransform &tranform,
G4SolidExtentList &extentList );
void CalculateExtent( const EAxis axis,
const G4VoxelLimits &voxelLimit,
const G4AffineTransform &tranform,
G4SolidExtentList &extentList );
inline G4VCSGface *Clone();
// Allocates on the heap a clone of this face.
inline G4VCSGface *Clone();
// Allocates on the heap a clone of this face.
public: // without description
void Diagnose( G4VSolid *solid );
// Throw an exception if something is found inconsistent with
// the solid. For debugging purposes only
G4PolyPhiFace(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
void Diagnose( G4VSolid *solid );
// Throw an exception if something is found inconsistent with
// the solid. For debugging purposes only
protected:
G4PolyPhiFaceEdge *edges; // The edges of the face
G4PolyPhiFaceVertex *corners; // And the corners
G4int numEdges; // Number of edges
G4ThreeVector normal; // Normal unit vector
G4ThreeVector radial; // Unit vector along radial direction
G4ThreeVector surface; // Point on surface
G4double rMin, rMax, // Extent in r
zMin, zMax; // Extent in z
G4bool allBehind; // True if the polycone/polyhedra
// is behind the place of this face
G4bool InsideEdgesExact( G4double r, G4double z, G4double normSign,
const G4ThreeVector &p, const G4ThreeVector &v );
// Decide if the point in r,z is inside the edges of our face,
// **but** do so consistently with other faces.
G4bool InsideEdgesExact( G4double r, G4double z, G4double normSign,
const G4ThreeVector &p, const G4ThreeVector &v );
// Decide if the point in r,z is inside the edges of our face,
// **but** do so consistently with other faces.
G4bool InsideEdges( G4double r, G4double z );
G4bool InsideEdges( G4double r, G4double z, G4double *distRZ2,
G4PolyPhiFaceVertex **base3Dnorm=0,
G4ThreeVector **head3Dnorm=0 );
// Decide if the point in r,z is inside the edges of our face.
G4bool InsideEdges( G4double r, G4double z );
G4bool InsideEdges( G4double r, G4double z, G4double *distRZ2,
G4PolyPhiFaceVertex **base3Dnorm=0,
G4ThreeVector **head3Dnorm=0 );
// Decide if the point in r,z is inside the edges of our face.
inline G4double ExactZOrder( G4double z,
G4double qx, G4double qy, G4double qz,
const G4ThreeVector &v,
G4double normSign,
const G4PolyPhiFaceVertex *vert ) const;
// Decide precisely whether a trajectory passes to the left, right,
// or exactly passes through the z position of a vertex point in face.
inline G4double ExactZOrder( G4double z,
G4double qx, G4double qy, G4double qz,
const G4ThreeVector &v,
G4double normSign,
const G4PolyPhiFaceVertex *vert ) const;
// Decide precisely whether a trajectory passes to the left, right,
// or exactly passes through the z position of a vertex point in face.
void CopyStuff( const G4PolyPhiFace &source );
void CopyStuff( const G4PolyPhiFace &source );
protected:
G4int numEdges; // Number of edges
G4PolyPhiFaceEdge *edges; // The edges of the face
G4PolyPhiFaceVertex *corners; // And the corners
G4ThreeVector normal; // Normal unit vector
G4ThreeVector radial; // Unit vector along radial direction
G4ThreeVector surface; // Point on surface
G4double rMin, rMax, // Extent in r
zMin, zMax; // Extent in z
G4bool allBehind; // True if the polycone/polyhedra
// is behind the place of this face
};
#include "G4PolyPhiFace.icc"
@@ -22,7 +22,7 @@
//
//
// $Id: G4PolyPhiFace.icc,v 1.5 2004/12/02 09:31:30 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Polycone.hh,v 1.12 2003/11/05 17:41:24 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4Polycone.hh,v 1.18 2005/11/09 15:04:28 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
@@ -82,7 +82,8 @@ class G4PolyconeHistorical
class G4Polycone : public G4VCSGfaceted
{
public: // with description
public: // with description
G4Polycone( const G4String& name,
G4double phiStart, // initial phi starting angle
@@ -109,6 +110,8 @@ class G4Polycone : public G4VCSGfaceted
EInside Inside( const G4ThreeVector &p ) const;
G4double DistanceToIn( const G4ThreeVector &p, const G4ThreeVector &v ) const;
G4double DistanceToIn( const G4ThreeVector &p ) const;
G4ThreeVector GetPointOnSurface() const;
void ComputeDimensions( G4VPVParameterisation* p,
const G4int n,
@@ -128,18 +131,55 @@ class G4Polycone : public G4VCSGfaceted
inline G4double GetStartPhi() const;
inline G4double GetEndPhi() const;
inline G4bool IsOpen() const;
inline G4bool IsGeneric() const;
inline G4int GetNumRZCorner() const;
inline G4PolyconeSideRZ GetCorner(G4int index) const;
inline G4PolyconeHistorical* GetOriginalParameters() const;
inline void SetOriginalParameters(G4PolyconeHistorical* pars);
protected: // without description
public: // without description
G4Polycone(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
protected: // without description
// Generic initializer, called by all constructors
inline void SetOriginalParameters();
void Create( G4double phiStart, // initial phi starting angle
G4double phiTotal, // total phi angle
G4ReduciblePolygon *rz ); // r/z coordinate of these corners
void CopyStuff( const G4Polycone &source );
// Methods for random point generation
G4ThreeVector GetPointOnCone(G4double fRmin1, G4double fRmax1,
G4double fRmin2, G4double fRmax2,
G4double zOne, G4double zTwo,
G4double& totArea) const;
G4ThreeVector GetPointOnTubs(G4double fRMin, G4double fRMax,
G4double zOne, G4double zTwo,
G4double& totArea) const;
G4ThreeVector GetPointOnCut(G4double fRMin1, G4double fRMax1,
G4double fRMin2, G4double fRMax2,
G4double zOne, G4double zTwo,
G4double& totArea) const;
protected: // without description
// Here are our parameters
G4double startPhi; // Starting phi value (0 < phiStart < 2pi)
G4double endPhi; // end phi value (0 < endPhi-phiStart < 2pi)
G4bool phiIsOpen; // true if there is a phi segment
G4bool genericPcon; // true if created through the 2nd generic constructor
G4int numCorner; // number RZ points
G4PolyconeSideRZ *corners; // corner r,z points
G4PolyconeHistorical *original_parameters; // original input parameters
@@ -147,14 +187,7 @@ class G4Polycone : public G4VCSGfaceted
// Our quick test
G4EnclosingCylinder *enclosingCylinder;
// Generic initializer, called by all constructors
void Create( G4double phiStart, // initial phi starting angle
G4double phiTotal, // total phi angle
G4ReduciblePolygon *rz ); // r/z coordinate of these corners
void CopyStuff( const G4Polycone &source );
};
#include "G4Polycone.icc"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Polycone.icc,v 1.6 2004/10/10 10:39:27 johna Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4Polycone.icc,v 1.9 2005/11/02 15:59:14 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
@@ -44,11 +44,18 @@ G4double G4Polycone::GetEndPhi() const
return endPhi;
}
inline G4bool G4Polycone::IsOpen() const
inline
G4bool G4Polycone::IsOpen() const
{
return phiIsOpen;
}
inline
G4bool G4Polycone::IsGeneric() const
{
return genericPcon;
}
inline
G4int G4Polycone::GetNumRZCorner() const
{
@@ -77,3 +84,27 @@ void G4Polycone::SetOriginalParameters(G4PolyconeHistorical* pars)
fCubicVolume = 0.;
fpPolyhedron = 0;
}
inline
void G4Polycone::SetOriginalParameters()
{
G4int numPlanes = (G4int)numCorner/2;
original_parameters = new G4PolyconeHistorical;
original_parameters->Z_values = new G4double[numPlanes];
original_parameters->Rmin = new G4double[numPlanes];
original_parameters->Rmax = new G4double[numPlanes];
for(G4int j=0; j < numPlanes; j++)
{
original_parameters->Z_values[j] = corners[numPlanes+j].z;
original_parameters->Rmax[j] = corners[numPlanes+j].r;
original_parameters->Rmin[j] = corners[numPlanes-1-j].r;
}
original_parameters->Start_angle = startPhi;
original_parameters->Opening_angle = endPhi-startPhi;
original_parameters->Num_z_planes = numPlanes;
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PolyconeSide.hh,v 1.5 2002/10/28 11:47:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4PolyconeSide.hh,v 1.7 2005/11/17 14:08:00 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
@@ -57,82 +57,89 @@
class G4IntersectingCone;
typedef struct
struct G4PolyconeSideRZ
{
G4double r, z; // start of vector
} G4PolyconeSideRZ;
};
class G4PolyconeSide : public G4VCSGface
{
public:
G4PolyconeSide( const G4PolyconeSideRZ *prevRZ,
const G4PolyconeSideRZ *tail,
const G4PolyconeSideRZ *head,
const G4PolyconeSideRZ *nextRZ,
G4double phiStart, G4double deltaPhi,
G4bool phiIsOpen, G4bool isAllBehind=false );
virtual ~G4PolyconeSide();
G4PolyconeSide( const G4PolyconeSideRZ *prevRZ,
const G4PolyconeSideRZ *tail,
const G4PolyconeSideRZ *head,
const G4PolyconeSideRZ *nextRZ,
G4double phiStart, G4double deltaPhi,
G4bool phiIsOpen, G4bool isAllBehind=false );
virtual ~G4PolyconeSide();
G4PolyconeSide( const G4PolyconeSide &source );
G4PolyconeSide& operator=( const G4PolyconeSide &source );
G4PolyconeSide( const G4PolyconeSide &source );
G4PolyconeSide& operator=( const G4PolyconeSide &source );
G4bool Intersect( const G4ThreeVector &p, const G4ThreeVector &v,
G4bool outgoing, G4double surfTolerance,
G4double &distance, G4double &distFromSurface,
G4ThreeVector &normal, G4bool &isAllBehind );
G4bool Intersect( const G4ThreeVector &p, const G4ThreeVector &v,
G4bool outgoing, G4double surfTolerance,
G4double &distance, G4double &distFromSurface,
G4ThreeVector &normal, G4bool &isAllBehind );
G4double Distance( const G4ThreeVector &p, G4bool outgoing );
G4double Distance( const G4ThreeVector &p, G4bool outgoing );
EInside Inside( const G4ThreeVector &p, G4double tolerance,
G4double *bestDistance );
EInside Inside( const G4ThreeVector &p, G4double tolerance,
G4double *bestDistance );
G4ThreeVector Normal( const G4ThreeVector &p, G4double *bestDistance );
G4ThreeVector Normal( const G4ThreeVector &p, G4double *bestDistance );
G4double Extent( const G4ThreeVector axis );
G4double Extent( const G4ThreeVector axis );
void CalculateExtent( const EAxis axis,
const G4VoxelLimits &voxelLimit,
const G4AffineTransform &tranform,
G4SolidExtentList &extentList );
void CalculateExtent( const EAxis axis,
const G4VoxelLimits &voxelLimit,
const G4AffineTransform &tranform,
G4SolidExtentList &extentList );
G4VCSGface *Clone() { return new G4PolyconeSide( *this ); }
G4VCSGface *Clone() { return new G4PolyconeSide( *this ); }
public: // without description
G4PolyconeSide(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
protected:
G4double r[2], z[2]; // r, z parameters, in specified order
G4double startPhi, // Start phi (0 to 2pi), if phiIsOpen
deltaPhi; // Delta phi (0 to 2pi), if phiIsOpen
G4bool phiIsOpen; // True if there is a phi slice
G4bool allBehind; // True if the entire solid is "behind" this face
G4double r[2], z[2]; // r, z parameters, in specified order
G4double startPhi, // Start phi (0 to 2pi), if phiIsOpen
deltaPhi; // Delta phi (0 to 2pi), if phiIsOpen
G4bool phiIsOpen; // True if there is a phi slice
G4bool allBehind; // True if the entire solid is "behind" this face
G4IntersectingCone *cone; // Our intersecting utility class
G4IntersectingCone *cone; // Our intersecting utility class
G4double rNorm, zNorm; // Normal to surface in r,z space
G4double rS, zS; // Unit vector along surface in r,z space
G4double length; // Length of face in r,z space
G4double prevRS,
prevZS; // Unit vector along previous polyconeSide
G4double nextRS,
nextZS; // Unit vector along next polyconeSide
G4double rNorm, zNorm; // Normal to surface in r,z space
G4double rS, zS; // Unit vector along surface in r,z space
G4double length; // Length of face in r,z space
G4double prevRS,
prevZS; // Unit vector along previous polyconeSide
G4double nextRS,
nextZS; // Unit vector along next polyconeSide
G4double rNormEdge[2],
zNormEdge[2]; // Normal to edges
G4double rNormEdge[2],
zNormEdge[2]; // Normal to edges
G4ThreeVector *corners; // The coordinates of the corners (if phiIsOpen)
G4ThreeVector *corners; // The coordinates of the corners (if phiIsOpen)
G4double DistanceAway( const G4ThreeVector &p, G4bool opposite,
G4double &distOutside2, G4double *rzNorm=0 );
G4double DistanceAway( const G4ThreeVector &p, G4bool opposite,
G4double &distOutside2, G4double *rzNorm=0 );
G4bool PointOnCone( const G4ThreeVector &hit, G4double normSign,
const G4ThreeVector &p,
const G4ThreeVector &v, G4ThreeVector &normal );
G4bool PointOnCone( const G4ThreeVector &hit, G4double normSign,
const G4ThreeVector &p,
const G4ThreeVector &v, G4ThreeVector &normal );
void CopyStuff( const G4PolyconeSide &source );
void CopyStuff( const G4PolyconeSide &source );
static void FindLineIntersect( G4double x1, G4double y1,
G4double tx1, G4double ty1,
G4double x2, G4double y2,
static void FindLineIntersect( G4double x1, G4double y1,
G4double tx1, G4double ty1,
G4double x2, G4double y2,
G4double tx2, G4double ty2,
G4double &x, G4double &y );
};
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Polyhedra.hh,v 1.11 2003/11/05 17:41:24 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4Polyhedra.hh,v 1.15 2005/11/09 15:04:28 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
@@ -85,7 +85,7 @@ class G4PolyhedraHistorical
class G4Polyhedra : public G4VCSGfaceted
{
public: // with description
public: // with description
G4Polyhedra( const G4String& name,
G4double phiStart, // initial phi starting angle
@@ -122,6 +122,8 @@ class G4Polyhedra : public G4VCSGfaceted
G4GeometryType GetEntityType() const;
G4ThreeVector GetPointOnSurface() const;
std::ostream& StreamInfo( std::ostream& os ) const;
G4Polyhedron* CreatePolyhedron() const;
@@ -135,29 +137,25 @@ class G4Polyhedra : public G4VCSGfaceted
inline G4double GetStartPhi() const;
inline G4double GetEndPhi() const;
inline G4bool IsOpen() const;
inline G4bool IsGeneric() const;
inline G4int GetNumRZCorner() const;
inline G4PolyhedraSideRZ GetCorner( const G4int index ) const;
inline G4PolyhedraHistorical* GetOriginalParameters() const;
inline void SetOriginalParameters(G4PolyhedraHistorical* pars);
protected: // without description
public: // without description
// Here are our parameters
G4Polyhedra(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4int numSide; // Number of sides
G4double startPhi; // Starting phi value (0 < phiStart < 2pi)
G4double endPhi; // end phi value (0 < endPhi-phiStart < 2pi)
G4bool phiIsOpen; // true if there is a phi segment
G4int numCorner; // number RZ points
G4PolyhedraSideRZ *corners; // our corners
G4PolyhedraHistorical *original_parameters; // original input parameters
// Our quick test
G4EnclosingCylinder *enclosingCylinder;
protected: // without description
// Generic initializer, call by all constructors
inline void SetOriginalParameters();
void Create( G4double phiStart, // initial phi starting angle
G4double phiTotal, // total phi angle
G4int numSide, // number sides
@@ -165,6 +163,28 @@ class G4Polyhedra : public G4VCSGfaceted
void CopyStuff( const G4Polyhedra &source );
void DeleteStuff();
// Methods for generation of random points on surface
G4ThreeVector GetPointOnPlane(G4ThreeVector p0, G4ThreeVector p1,
G4ThreeVector p2, G4ThreeVector p3) const;
G4ThreeVector GetPointOnTriangle(G4ThreeVector p0, G4ThreeVector p1,
G4ThreeVector p2) const;
G4ThreeVector GetPointOnSurfaceCorners() const;
protected: // without description
G4int numSide; // Number of sides
G4double startPhi; // Starting phi value (0 < phiStart < 2pi)
G4double endPhi; // end phi value (0 < endPhi-phiStart < 2pi)
G4bool phiIsOpen; // true if there is a phi segment
G4bool genericPgon; // true if created through the 2nd generic constructor
G4int numCorner; // number RZ points
G4PolyhedraSideRZ *corners; // our corners
G4PolyhedraHistorical *original_parameters; // original input parameters
G4EnclosingCylinder *enclosingCylinder;
};
#include "G4Polyhedra.icc"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Polyhedra.icc,v 1.6 2004/10/10 10:39:32 johna Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4Polyhedra.icc,v 1.9 2005/11/02 15:59:14 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
@@ -56,6 +56,12 @@ G4bool G4Polyhedra::IsOpen() const
return phiIsOpen;
}
inline
G4bool G4Polyhedra::IsGeneric() const
{
return genericPgon;
}
inline
G4int G4Polyhedra::GetNumRZCorner() const
{
@@ -84,3 +90,28 @@ void G4Polyhedra::SetOriginalParameters(G4PolyhedraHistorical* pars)
fCubicVolume = 0.;
fpPolyhedron = 0;
}
inline
void G4Polyhedra::SetOriginalParameters()
{
G4int numPlanes = (G4int) numCorner/2;
original_parameters = new G4PolyhedraHistorical;
original_parameters->Z_values = new G4double[numPlanes];
original_parameters->Rmin = new G4double[numPlanes];
original_parameters->Rmax = new G4double[numPlanes];
for(G4int j=0; j < numPlanes; j++)
{
original_parameters->Z_values[j] = corners[numPlanes+j].z;
original_parameters->Rmax[j] = corners[numPlanes+j].r;
original_parameters->Rmin[j] = corners[numPlanes-1-j].r;
}
original_parameters->Start_angle = startPhi;
original_parameters->Opening_angle = endPhi-startPhi;
original_parameters->Num_z_planes = numPlanes;
original_parameters->numSide = numSide;
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PolyhedraSide.hh,v 1.5 2002/10/28 11:47:51 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4PolyhedraSide.hh,v 1.7 2005/11/17 14:08:00 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
@@ -58,115 +58,124 @@
class G4IntersectingCone;
typedef struct
struct G4PolyhedraSideRZ
{
G4double r, z; // start of vector
} G4PolyhedraSideRZ;
};
class G4PolyhedraSide : public G4VCSGface
{
public:
G4PolyhedraSide( const G4PolyhedraSideRZ *prevRZ,
const G4PolyhedraSideRZ *tail,
const G4PolyhedraSideRZ *head,
const G4PolyhedraSideRZ *nextRZ,
G4int numSide,
G4double phiStart, G4double phiTotal,
G4bool phiIsOpen, G4bool isAllBehind=false );
virtual ~G4PolyhedraSide();
G4PolyhedraSide( const G4PolyhedraSideRZ *prevRZ,
const G4PolyhedraSideRZ *tail,
const G4PolyhedraSideRZ *head,
const G4PolyhedraSideRZ *nextRZ,
G4int numSide,
G4double phiStart, G4double phiTotal,
G4bool phiIsOpen, G4bool isAllBehind=false );
virtual ~G4PolyhedraSide();
G4PolyhedraSide( const G4PolyhedraSide &source );
G4PolyhedraSide& operator=( const G4PolyhedraSide &source );
G4PolyhedraSide( const G4PolyhedraSide &source );
G4PolyhedraSide& operator=( const G4PolyhedraSide &source );
G4bool Intersect( const G4ThreeVector &p, const G4ThreeVector &v,
G4bool outgoing, G4double surfTolerance,
G4double &distance, G4double &distFromSurface,
G4ThreeVector &normal, G4bool &allBehind );
G4bool Intersect( const G4ThreeVector &p, const G4ThreeVector &v,
G4bool outgoing, G4double surfTolerance,
G4double &distance, G4double &distFromSurface,
G4ThreeVector &normal, G4bool &allBehind );
G4double Distance( const G4ThreeVector &p, G4bool outgoing );
G4double Distance( const G4ThreeVector &p, G4bool outgoing );
EInside Inside( const G4ThreeVector &p, G4double tolerance,
G4double *bestDistance );
EInside Inside( const G4ThreeVector &p, G4double tolerance,
G4double *bestDistance );
G4ThreeVector Normal( const G4ThreeVector &p, G4double *bestDistance );
G4ThreeVector Normal( const G4ThreeVector &p, G4double *bestDistance );
G4double Extent( const G4ThreeVector axis );
G4double Extent( const G4ThreeVector axis );
void CalculateExtent( const EAxis axis,
const G4VoxelLimits &voxelLimit,
const G4AffineTransform &tranform,
G4SolidExtentList &extentList );
void CalculateExtent( const EAxis axis,
const G4VoxelLimits &voxelLimit,
const G4AffineTransform &tranform,
G4SolidExtentList &extentList );
G4VCSGface *Clone() { return new G4PolyhedraSide( *this ); }
G4VCSGface *Clone() { return new G4PolyhedraSide( *this ); }
public: // without description
G4PolyhedraSide(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
protected:
//
// A couple internal data structures
//
struct sG4PolyhedraSideVec; // Secret recipe for allowing
friend struct sG4PolyhedraSideVec; // protected nested structures
//
// A couple internal data structures
//
struct sG4PolyhedraSideVec; // Secret recipe for allowing
friend struct sG4PolyhedraSideVec; // protected nested structures
typedef struct sG4PolyhedraSideEdge
{
G4ThreeVector normal; // Unit normal to this edge
G4ThreeVector corner[2]; // The two corners of this phi edge
G4ThreeVector cornNorm[2]; // The normals of these corners
} G4PolyhedraSideEdge;
typedef struct sG4PolyhedraSideEdge
{
G4ThreeVector normal; // Unit normal to this edge
G4ThreeVector corner[2]; // The two corners of this phi edge
G4ThreeVector cornNorm[2]; // The normals of these corners
} G4PolyhedraSideEdge;
typedef struct sG4PolyhedraSideVec
{
G4ThreeVector normal, // Normal (point out of the shape)
center, // Point in center of side
surfPhi, // Unit vector on surface pointing along phi
surfRZ; // Unit vector on surface pointing along R/Z
G4PolyhedraSideEdge *edges[2]; // The phi boundary edges to this side
// [0]=low phi [1]=high phi
G4ThreeVector edgeNorm[2]; // RZ edge normals [i] at {r[i],z[i]}
} G4PolyhedraSideVec;
typedef struct sG4PolyhedraSideVec
{
G4ThreeVector normal, // Normal (point out of the shape)
center, // Point in center of side
surfPhi, // Unit vector on surface pointing along phi
surfRZ; // Unit vector on surface pointing along R/Z
G4PolyhedraSideEdge *edges[2]; // The phi boundary edges to this side
// [0]=low phi [1]=high phi
G4ThreeVector edgeNorm[2]; // RZ edge normals [i] at {r[i],z[i]}
} G4PolyhedraSideVec;
G4int numSide; // Number sides
G4double r[2], z[2]; // r, z parameters, in specified order
G4double startPhi, // Start phi (0 to 2pi), if phiIsOpen
deltaPhi, // Delta phi (0 to 2pi), if phiIsOpen
endPhi; // End phi (>startPhi), if phiIsOpen
G4bool phiIsOpen; // True if there is a phi slice
G4bool allBehind; // True if the entire solid is "behind" this face
G4IntersectingCone *cone; // Our intersecting cone
G4PolyhedraSideVec *vecs; // Vector set for each facet of our face
G4PolyhedraSideEdge *edges; // The edges belong to vecs
G4double lenRZ, // RZ length of each side
lenPhi[2]; // Phi dimensions of each side
G4double edgeNorm; // Normal in RZ/Phi space to each side
G4bool IntersectSidePlane( const G4ThreeVector &p, const G4ThreeVector &v,
const G4PolyhedraSideVec vec,
G4double normSign,
G4double surfTolerance,
G4double &distance,
G4double &distFromSurface );
G4bool IntersectSidePlane( const G4ThreeVector &p, const G4ThreeVector &v,
const G4PolyhedraSideVec vec,
G4double normSign,
G4double surfTolerance,
G4double &distance,
G4double &distFromSurface );
G4int LineHitsSegments( const G4ThreeVector &p,
const G4ThreeVector &v,
G4int *i1, G4int *i2 );
G4int LineHitsSegments( const G4ThreeVector &p,
const G4ThreeVector &v,
G4int *i1, G4int *i2 );
G4int ClosestPhiSegment( G4double phi );
G4int ClosestPhiSegment( G4double phi );
G4int PhiSegment( G4double phi );
G4int PhiSegment( G4double phi );
G4double DistanceToOneSide( const G4ThreeVector &p,
const G4PolyhedraSideVec &vec,
G4double *normDist );
G4double DistanceToOneSide( const G4ThreeVector &p,
const G4PolyhedraSideVec &vec,
G4double *normDist );
G4double DistanceAway( const G4ThreeVector &p,
const G4PolyhedraSideVec &vec,
G4double *normDist );
G4double DistanceAway( const G4ThreeVector &p,
const G4PolyhedraSideVec &vec,
G4double *normDist );
void CopyStuff( const G4PolyhedraSide &source );
void CopyStuff( const G4PolyhedraSide &source );
protected:
G4int numSide; // Number sides
G4double r[2], z[2]; // r, z parameters, in specified order
G4double startPhi, // Start phi (0 to 2pi), if phiIsOpen
deltaPhi, // Delta phi (0 to 2pi), if phiIsOpen
endPhi; // End phi (>startPhi), if phiIsOpen
G4bool phiIsOpen; // True if there is a phi slice
G4bool allBehind; // True if the entire solid is "behind" this face
G4IntersectingCone *cone; // Our intersecting cone
G4PolyhedraSideVec *vecs; // Vector set for each facet of our face
G4PolyhedraSideEdge *edges; // The edges belong to vecs
G4double lenRZ, // RZ length of each side
lenPhi[2]; // Phi dimensions of each side
G4double edgeNorm; // Normal in RZ/Phi space to each side
};
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ReduciblePolygon.hh,v 1.6 2003/11/03 18:39:55 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4ReduciblePolygon.hh,v 1.8 2005/11/17 14:08:00 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
@@ -61,87 +61,95 @@ class G4ReduciblePolygon
friend class G4ReduciblePolygonIterator;
public:
//
// Creator: via simple a/b arrays
//
G4ReduciblePolygon( const G4double a[], const G4double b[], G4int n );
//
// Creator: via simple a/b arrays
//
G4ReduciblePolygon( const G4double a[], const G4double b[], G4int n );
//
// Creator: a special version for G4Polygon and G4Polycone
// that takes two a points at planes of b
// (where a==r and b==z for the GEANT3 classic PCON and PGON)
//
G4ReduciblePolygon( const G4double rmin[], const G4double rmax[],
const G4double z[], G4int n );
//
// Creator: a special version for G4Polygon and G4Polycone
// that takes two a points at planes of b
// (where a==r and b==z for the GEANT3 classic PCON and PGON)
//
G4ReduciblePolygon( const G4double rmin[], const G4double rmax[],
const G4double z[], G4int n );
virtual ~G4ReduciblePolygon();
virtual ~G4ReduciblePolygon();
//
// Queries
//
inline G4int NumVertices() const { return numVertices; }
//
// Queries
//
inline G4int NumVertices() const { return numVertices; }
inline G4double Amin() const { return aMin; }
inline G4double Amax() const { return aMax; }
inline G4double Bmin() const { return bMin; }
inline G4double Bmax() const { return bMax; }
inline G4double Amin() const { return aMin; }
inline G4double Amax() const { return aMax; }
inline G4double Bmin() const { return bMin; }
inline G4double Bmax() const { return bMax; }
void CopyVertices( G4double a[], G4double b[] ) const;
void CopyVertices( G4double a[], G4double b[] ) const;
//
// Manipulations
//
void ScaleA( G4double scale );
void ScaleB( G4double scale );
//
// Manipulations
//
void ScaleA( G4double scale );
void ScaleB( G4double scale );
G4bool RemoveDuplicateVertices( G4double tolerance );
G4bool RemoveRedundantVertices( G4double tolerance );
G4bool RemoveDuplicateVertices( G4double tolerance );
G4bool RemoveRedundantVertices( G4double tolerance );
void ReverseOrder();
void ReverseOrder();
//
// Tests
//
G4double Area();
G4bool CrossesItself( G4double tolerance );
G4bool BisectedBy( G4double a1, G4double b1,
G4double a2, G4double b2, G4double tolerance );
//
// Tests
//
G4double Area();
G4bool CrossesItself( G4double tolerance );
G4bool BisectedBy( G4double a1, G4double b1,
G4double a2, G4double b2, G4double tolerance );
void Print(); // Debugging only
void Print(); // Debugging only
public: // without description
G4ReduciblePolygon(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
protected:
void Create( const G4double a[], const G4double b[], G4int n );
void Create( const G4double a[], const G4double b[], G4int n );
void CalculateMaxMin();
void CalculateMaxMin();
//
// Below are member values that are *always* kept up to date (please!)
//
G4double aMin, aMax, bMin, bMax;
G4int numVertices;
//
// Below are member values that are *always* kept up to date (please!)
//
G4double aMin, aMax, bMin, bMax;
G4int numVertices;
//
// A subclass which holds the vertices in a single-linked list
//
// Yeah, call me an old-fashioned c hacker, but I cannot make
// myself use the rogue tools for this trivial list.
//
struct ABVertex;
friend struct ABVertex;
struct ABVertex
{
G4double a, b;
ABVertex *next;
};
//
// A subclass which holds the vertices in a single-linked list
//
// Yeah, call me an old-fashioned c hacker, but I cannot make
// myself use the rogue tools for this trivial list.
//
struct ABVertex; // Secret recipe for allowing
friend struct ABVertex; // protected nested structures
struct ABVertex
{
ABVertex() { next = 0; }
G4double a, b;
ABVertex *next;
};
ABVertex *vertexHead;
ABVertex *vertexHead;
private:
private:
G4ReduciblePolygon(const G4ReduciblePolygon&);
G4ReduciblePolygon& operator=(const G4ReduciblePolygon&);
// Private copy constructor and assignment operator.
G4ReduciblePolygon(const G4ReduciblePolygon&);
G4ReduciblePolygon& operator=(const G4ReduciblePolygon&);
// Private copy constructor and assignment operator.
};
@@ -153,21 +161,21 @@ class G4ReduciblePolygonIterator
{
public:
G4ReduciblePolygonIterator( const G4ReduciblePolygon *theSubject )
{ subject = theSubject; current=0; }
G4ReduciblePolygonIterator( const G4ReduciblePolygon *theSubject )
{ subject = theSubject; current=0; }
void Begin() { current = subject->vertexHead; }
G4bool Next() { if (current) current=current->next; return Valid(); }
void Begin() { current = subject->vertexHead; }
G4bool Next() { if (current) current=current->next; return Valid(); }
G4bool Valid() const { return current!=0; }
G4bool Valid() const { return current!=0; }
G4double GetA() const { return current->a; }
G4double GetB() const { return current->b; }
G4double GetA() const { return current->a; }
G4double GetB() const { return current->b; }
protected:
const G4ReduciblePolygon *subject; // Who are we iterating over
G4ReduciblePolygon::ABVertex *current; // Current vertex
const G4ReduciblePolygon *subject; // Who are we iterating over
G4ReduciblePolygon::ABVertex *current; // Current vertex
};
#endif
@@ -22,7 +22,7 @@
//
//
// $Id: G4SolidExtentList.hh,v 1.6 2003/11/03 18:39:55 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
@@ -0,0 +1,154 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * Vanderbilt University Free Electron Laser Center *
// * Vanderbilt University, Nashville, TN, USA *
// * Development supported by: *
// * United States MFEL program under grant FA9550-04-1-0045 *
// * and NASA under contract number NNG04CT05P. *
// * Written by Marcus H. Mendenhall and Robert A. Weller. *
// * *
// * Contributed to the Geant4 Core, January, 2005. *
// * *
// ********************************************************************
//
//
// $Id: G4Tet.hh,v 1.5 2005/11/10 15:59:19 allison Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
// G4Tet
//
// Class description:
//
// A G4Tet is a tetrahedrasolid.
//
// History:
// -------
// 03.09.2004 - M.H.Mendenhall & R.A.Weller (Vanderbilt University, USA)
// 10.02.2005 - D.Anninos (CERN) - Added GetPointOnSurface() method.
// --------------------------------------------------------------------
#ifndef G4TET_HH
#define G4TET_HH
#include "G4VSolid.hh"
class G4Tet : public G4VSolid
{
public: // with description
G4Tet(const G4String& pName,
G4ThreeVector anchor,
G4ThreeVector p2,
G4ThreeVector p3,
G4ThreeVector p4,
G4bool *degeneracyFlag=0);
virtual ~G4Tet();
void ComputeDimensions(G4VPVParameterisation* p,
const G4int n,
const G4VPhysicalVolume* pRep);
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pmin, G4double& pmax) const;
// Methods for solid
EInside Inside(const G4ThreeVector& p) const;
G4ThreeVector SurfaceNormal( const G4ThreeVector& p) const;
G4double DistanceToIn(const G4ThreeVector& p, const G4ThreeVector& v) const;
G4double DistanceToIn(const G4ThreeVector& p) const;
G4double DistanceToOut(const G4ThreeVector& p, const G4ThreeVector& v,
const G4bool calcNorm=false,
G4bool *validNorm=0, G4ThreeVector *n=0) const;
G4double DistanceToOut(const G4ThreeVector& p) const;
G4double GetCubicVolume() {return fCubicVolume;}
G4GeometryType GetEntityType() const;
std::ostream& StreamInfo(std::ostream& os) const;
G4ThreeVector GetPointOnSurface() const;
// Functions for visualization
void DescribeYourselfTo (G4VGraphicsScene& scene) const;
G4VisExtent GetExtent () const;
G4Polyhedron* CreatePolyhedron () const;
G4NURBS* CreateNURBS () const;
G4Polyhedron* GetPolyhedron () const;
public: // without description
G4Tet(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
const char* CVSHeaderVers()
{ return "$Id: G4Tet.hh,v 1.5 2005/11/10 15:59:19 allison Exp $"; }
const char* CVSFileVers()
{ return CVSVers; }
void PrintWarnings(G4bool flag)
{ warningFlag=flag; }
static G4bool CheckDegeneracy(G4ThreeVector anchor,
G4ThreeVector p2,
G4ThreeVector p3,
G4ThreeVector p4);
protected: // with description
G4ThreeVectorList*
CreateRotatedVertices(const G4AffineTransform& pTransform) const;
// Create the List of transformed vertices in the format required
// for G4VSolid:: ClipCrossSection and ClipBetweenSections.
private:
G4double fCubicVolume;
mutable G4Polyhedron* fpPolyhedron;
G4ThreeVector GetPointOnFace(G4ThreeVector p1, G4ThreeVector p2,
G4ThreeVector p3, G4double& area) const;
static const char CVSVers[];
private:
G4ThreeVector fAnchor, fP2, fP3, fP4, fMiddle;
G4ThreeVector fNormal123, fNormal142, fNormal134, fNormal234;
G4bool warningFlag;
G4double fCdotN123, fCdotN142, fCdotN134, fCdotN234;
G4double fXMin, fXMax, fYMin, fYMax, fZMin, fZMax;
G4double fDx, fDy, fDz, fTol, fMaxSize;
};
#endif
@@ -0,0 +1,229 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4TwistBoxSide.hh,v 1.4 2005/12/06 18:21:15 gcosmo Exp $
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
//
// G4TwistBoxSide
//
// Class description:
//
// Class describing a twisted boundary surface for a trapezoid.
// Author:
//
// 27-Oct-2004 - O.Link (Oliver.Link@cern.ch)
//
// --------------------------------------------------------------------
#ifndef __G4TWISTBOXSIDE__
#define __G4TWISTBOXSIDE__
#include "G4VTwistSurface.hh"
#include <vector>
class G4TwistBoxSide : public G4VTwistSurface
{
public: // with description
G4TwistBoxSide(const G4String &name,
G4double PhiTwist, // twist angle
G4double pDz, // half z lenght
G4double pTheta, // direction between end planes
G4double pPhi, // by polar and azimutal angles
G4double pDy1, // half y length at -pDz
G4double pDx1, // half x length at -pDz,-pDy
G4double pDx2, // half x length at -pDz,+pDy
G4double pDy2, // half y length at +pDz
G4double pDx3, // half x length at +pDz,-pDy
G4double pDx4, // half x length at +pDz,+pDy
G4double pAlph, // tilt angle at +pDz
G4double AngleSide // parity
);
virtual ~G4TwistBoxSide();
virtual G4ThreeVector GetNormal(const G4ThreeVector &xx,
G4bool isGlobal = false) ;
virtual G4int DistanceToSurface(const G4ThreeVector &gp,
const G4ThreeVector &gv,
G4ThreeVector gxx[],
G4double distance[],
G4int areacode[],
G4bool isvalid[],
EValidate validate = kValidateWithTol);
virtual G4int DistanceToSurface(const G4ThreeVector &gp,
G4ThreeVector gxx[],
G4double distance[],
G4int areacode[]);
public: // without description
G4TwistBoxSide(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
private:
virtual G4int GetAreaCode(const G4ThreeVector &xx,
G4bool withTol = true);
virtual void SetCorners();
virtual void SetBoundaries();
void GetPhiUAtX(G4ThreeVector p, G4double &phi, G4double &u);
G4ThreeVector ProjectPoint(const G4ThreeVector &p,
G4bool isglobal = false);
virtual G4ThreeVector SurfacePoint(G4double phi, G4double u,
G4bool isGlobal = false);
virtual G4double GetBoundaryMin(G4double phi);
virtual G4double GetBoundaryMax(G4double phi);
virtual G4double GetSurfaceArea();
virtual void GetFacets( G4int m, G4int n, G4double xyz[][3],
G4int faces[][4], G4int iside );
inline G4double GetValueA(G4double phi);
inline G4double GetValueB(G4double phi);
inline G4ThreeVector NormAng(G4double phi, G4double u);
inline G4double Xcoef(G4double u,G4double phi);
// To calculate the w(u) function
private:
G4double fTheta;
G4double fPhi ;
G4double fDy1;
G4double fDx1;
G4double fDx2;
G4double fDy2;
G4double fDx3;
G4double fDx4;
G4double fDz; // Half-length along the z axis
G4double fAlph;
G4double fTAlph; // std::tan(fAlph)
G4double fPhiTwist; // twist angle ( dphi in surface equation)
G4double fAngleSide;
G4double fdeltaX;
G4double fdeltaY;
G4double fDx4plus2; // fDx4 + fDx2 == a2/2 + a1/2
G4double fDx4minus2; // fDx4 - fDx2 -
G4double fDx3plus1; // fDx3 + fDx1 == d2/2 + d1/2
G4double fDx3minus1; // fDx3 - fDx1 -
G4double fDy2plus1; // fDy2 + fDy1 == b2/2 + b1/2
G4double fDy2minus1; // fDy2 - fDy1 -
G4double fa1md1; // 2 fDx2 - 2 fDx1 == a1 - d1
G4double fa2md2; // 2 fDx4 - 2 fDx3
};
//========================================================
// inline functions
//========================================================
inline
G4double G4TwistBoxSide::GetValueA(G4double phi)
{
return ( fDx4plus2 + fDx4minus2 * ( 2 * phi ) / fPhiTwist ) ;
}
inline
G4double G4TwistBoxSide::GetValueB(G4double phi)
{
return ( fDy2plus1 + fDy2minus1 * ( 2 * phi ) / fPhiTwist ) ;
}
inline
G4double G4TwistBoxSide::Xcoef(G4double u, G4double phi)
{
return GetValueA(phi)/2. + u*fTAlph ;
}
inline G4ThreeVector
G4TwistBoxSide::SurfacePoint( G4double phi, G4double u, G4bool isGlobal )
{
// function to calculate a point on the surface, given by parameters phi,u
G4ThreeVector SurfPoint ( Xcoef(u,phi) * std::cos(phi)
- u * std::sin(phi) + fdeltaX*phi/fPhiTwist,
Xcoef(u,phi) * std::sin(phi)
+ u * std::cos(phi) + fdeltaY*phi/fPhiTwist,
2*fDz*phi/fPhiTwist );
if (isGlobal) { return (fRot * SurfPoint + fTrans); }
return SurfPoint;
}
inline
G4double G4TwistBoxSide::GetBoundaryMin(G4double phi)
{
return -0.5*GetValueB(phi) ;
}
inline
G4double G4TwistBoxSide::GetBoundaryMax(G4double phi)
{
return 0.5*GetValueB(phi) ;
}
inline
G4double G4TwistBoxSide::GetSurfaceArea()
{
return (fDz*(std::sqrt(16*fDy1*fDy1
+ (fa1md1 + 4*fDy1*fTAlph)*(fa1md1 + 4*fDy1*fTAlph))
+ std::sqrt(16*fDy1*fDy1 + (fa2md2 + 4*fDy1*fTAlph)
* (fa2md2 + 4*fDy1*fTAlph))))/2. ;
}
inline
G4ThreeVector G4TwistBoxSide::NormAng( G4double phi, G4double u )
{
// function to calculate the norm at a given point on the surface
// replace a1-d1
G4ThreeVector nvec( 4*fDz*(std::cos(phi) + fTAlph*std::sin(phi)) ,
4*fDz*(-(fTAlph*std::cos(phi)) + std::sin(phi)),
(fDx2 + fDx4)*fPhiTwist*fTAlph
+ 2*fDx4minus2*(-1 + fTAlph*phi)
+ 2*fPhiTwist*(1 + fTAlph*fTAlph)*u
- 2*(fdeltaX - fdeltaY*fTAlph)*std::cos(phi)
- 2*(fdeltaY + fdeltaX*fTAlph)*std::sin(phi) );
return nvec.unit();
}
#endif
@@ -0,0 +1,246 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4TwistTrapAlphaSide.hh,v 1.4 2005/12/06 18:21:15 gcosmo Exp $
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
//
// G4TwistTrapAlphaSide
//
// Class description:
//
// Class describing a twisted boundary surface for a trapezoid.
// Author:
//
// 27-Oct-2004 - O.Link (Oliver.Link@cern.ch)
//
// --------------------------------------------------------------------
#ifndef __G4TWISTTRAPALPHASIDE__
#define __G4TWISTTRAPALPHASIDE__
#include "G4VTwistSurface.hh"
#include <vector>
class G4TwistTrapAlphaSide : public G4VTwistSurface
{
public: // with description
G4TwistTrapAlphaSide(const G4String &name,
G4double PhiTwist, // twist angle
G4double pDz, // half z lenght
G4double pTheta, // direction between end planes
G4double pPhi, // by polar and azimutal angles
G4double pDy1, // half y length at -pDz
G4double pDx1, // half x length at -pDz,-pDy
G4double pDx2, // half x length at -pDz,+pDy
G4double pDy2, // half y length at +pDz
G4double pDx3, // half x length at +pDz,-pDy
G4double pDx4, // half x length at +pDz,+pDy
G4double pAlph, // tilt angle at +pDz
G4double AngleSide // parity
);
virtual ~G4TwistTrapAlphaSide();
virtual G4ThreeVector GetNormal(const G4ThreeVector &xx,
G4bool isGlobal = false) ;
virtual G4int DistanceToSurface(const G4ThreeVector &gp,
const G4ThreeVector &gv,
G4ThreeVector gxx[],
G4double distance[],
G4int areacode[],
G4bool isvalid[],
EValidate validate = kValidateWithTol);
virtual G4int DistanceToSurface(const G4ThreeVector &gp,
G4ThreeVector gxx[],
G4double distance[],
G4int areacode[]);
public: // without description
G4TwistTrapAlphaSide(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
private:
virtual G4int GetAreaCode(const G4ThreeVector &xx,
G4bool withTol = true);
virtual void SetCorners();
virtual void SetBoundaries();
void GetPhiUAtX(G4ThreeVector p, G4double &phi, G4double &u);
G4ThreeVector ProjectPoint(const G4ThreeVector &p,
G4bool isglobal = false);
virtual G4ThreeVector SurfacePoint(G4double phi, G4double u,
G4bool isGlobal = false );
virtual G4double GetBoundaryMin(G4double phi);
virtual G4double GetBoundaryMax(G4double phi);
virtual G4double GetSurfaceArea();
virtual void GetFacets( G4int m, G4int n, G4double xyz[][3],
G4int faces[][4], G4int iside );
inline G4ThreeVector NormAng(G4double phi, G4double u);
inline G4double GetValueA(G4double phi);
inline G4double GetValueB(G4double phi);
inline G4double GetValueD(G4double phi);
inline G4double Xcoef(G4double u,G4double phi);
// To calculate the w(u) function
private:
G4double fTheta;
G4double fPhi ;
G4double fDy1;
G4double fDx1;
G4double fDx2;
G4double fDy2;
G4double fDx3;
G4double fDx4;
G4double fDz; // Half-length along the z axis
G4double fAlph;
G4double fTAlph; // std::tan(fAlph)
G4double fPhiTwist; // twist angle (dphi in surface equation)
G4double fAngleSide;
G4double fDx4plus2; // fDx4 + fDx2 == a2/2 + a1/2
G4double fDx4minus2; // fDx4 - fDx2 -
G4double fDx3plus1; // fDx3 + fDx1 == d2/2 + d1/2
G4double fDx3minus1; // fDx3 - fDx1 -
G4double fDy2plus1; // fDy2 + fDy1 == b2/2 + b1/2
G4double fDy2minus1; // fDy2 - fDy1 -
G4double fa1md1; // 2 fDx2 - 2 fDx1 == a1 - d1
G4double fa2md2; // 2 fDx4 - 2 fDx3
G4double fdeltaX;
G4double fdeltaY;
};
//========================================================
// inline functions
//========================================================
inline
G4double G4TwistTrapAlphaSide::GetValueA(G4double phi)
{
return ( fDx4plus2 + fDx4minus2 * ( 2 * phi ) / fPhiTwist ) ;
}
inline
G4double G4TwistTrapAlphaSide::GetValueD(G4double phi)
{
return ( fDx3plus1 + fDx3minus1 * ( 2 * phi) / fPhiTwist ) ;
}
inline
G4double G4TwistTrapAlphaSide::GetValueB(G4double phi)
{
return ( fDy2plus1 + fDy2minus1 * ( 2 * phi ) / fPhiTwist ) ;
}
inline
G4double G4TwistTrapAlphaSide::Xcoef(G4double u, G4double phi)
{
return GetValueA(phi)/2. + (GetValueD(phi)-GetValueA(phi))/4.
- u*( ( GetValueD(phi)-GetValueA(phi) )/( 2 * GetValueB(phi) ) - fTAlph );
}
inline G4ThreeVector
G4TwistTrapAlphaSide::SurfacePoint(G4double phi, G4double u , G4bool isGlobal)
{
// function to calculate a point on the surface, given by parameters phi,u
G4ThreeVector SurfPoint ( Xcoef(u,phi) * std::cos(phi)
- u * std::sin(phi) + fdeltaX*phi/fPhiTwist,
Xcoef(u,phi) * std::sin(phi)
+ u * std::cos(phi) + fdeltaY*phi/fPhiTwist,
2*fDz*phi/fPhiTwist );
if (isGlobal) { return (fRot * SurfPoint + fTrans); }
return SurfPoint;
}
inline
G4double G4TwistTrapAlphaSide::GetBoundaryMin(G4double phi)
{
return -0.5*GetValueB(phi) ;
}
inline
G4double G4TwistTrapAlphaSide::GetBoundaryMax(G4double phi)
{
return 0.5*GetValueB(phi) ;
}
inline
G4double G4TwistTrapAlphaSide::GetSurfaceArea()
{
return (fDz*(std::sqrt(16*fDy1*fDy1
+ (fa1md1 + 4*fDy1*fTAlph)*(fa1md1 + 4*fDy1*fTAlph))
+ std::sqrt(16*fDy2*fDy2 + (fa2md2 + 4*fDy2*fTAlph)
* (fa2md2 + 4*fDy2*fTAlph))))/2. ;
}
inline
G4ThreeVector G4TwistTrapAlphaSide::NormAng( G4double phi, G4double u )
{
// function to calculate the norm at a given point on the surface
// replace a1-d1
G4ThreeVector nvec ( fDy1* fDz*(4*fDy1*std::cos(phi)
+ (fa1md1 + 4*fDy1*fTAlph)*std::sin(phi)),
-(fDy1* fDz*((fa1md1 + 4*fDy1*fTAlph)*std::cos(phi)
- 4*fDy1*std::sin(phi))),
(fDy1*(-8*(fDx3minus1 + fDx4minus2)*fDy1
+ fa1md1*(fDx2 + fDx3plus1 + fDx4)*fPhiTwist
+ 4*(fDx2 + fDx3plus1 + fDx4)*fDy1*fPhiTwist
*fTAlph + 2*(fDx3minus1 + fDx4minus2)
*(fa1md1 + 4*fDy1*fTAlph)*phi)
+ fPhiTwist*(16*fDy1*fDy1
+ (fa1md1 + 4*fDy1*fTAlph)
*(fa1md1 + 4*fDy1*fTAlph))*u
+ 4*fDy1*(fa1md1*fdeltaY - 4*fdeltaX*fDy1
+ 4*fdeltaY*fDy1*fTAlph)* std::cos(phi)
- 4*fDy1*(fa1md1*fdeltaX + 4*fDy1*(fdeltaY
+ fdeltaX*fTAlph))*std::sin(phi))/ 8. ) ;
return nvec.unit();
}
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4FlatTrapSide.hh,v 1.4 2005/03/11 16:03:57 link Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4TwistTrapFlatSide.hh,v 1.4 2005/12/06 18:21:15 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
@@ -40,26 +40,26 @@
// 27-Oct-2004 - O.Link (Oliver.Link@cern.ch)
//
// --------------------------------------------------------------------
#ifndef __G4FLATTRAPSIDE__
#define __G4FLATTRAPSIDE__
#ifndef __G4TWISTTRAPFLATSIDE__
#define __G4TWISTTRAPFLATSIDE__
#include "G4VSurface.hh"
#include "G4VTwistSurface.hh"
class G4FlatTrapSide : public G4VSurface
class G4TwistTrapFlatSide : public G4VTwistSurface
{
public: // with description
G4FlatTrapSide( const G4String& name,
G4double PhiTwist,
G4double pDx1,
G4double pDx2,
G4double pDy,
G4double pDz,
G4double pAlpha,
G4double pPhi,
G4double pTheta,
G4int handedness );
virtual ~G4FlatTrapSide();
G4TwistTrapFlatSide( const G4String& name,
G4double PhiTwist,
G4double pDx1,
G4double pDx2,
G4double pDy,
G4double pDz,
G4double pAlpha,
G4double pPhi,
G4double pTheta,
G4int handedness );
virtual ~G4TwistTrapFlatSide();
virtual G4ThreeVector GetNormal(const G4ThreeVector & /* xx */ ,
G4bool isGlobal = false);
@@ -70,46 +70,90 @@ class G4FlatTrapSide : public G4VSurface
G4int areacode[],
G4bool isvalid[],
EValidate validate = kValidateWithTol);
virtual G4int DistanceToSurface(const G4ThreeVector &gp,
G4ThreeVector gxx[],
G4double distance[],
G4int areacode[]);
virtual G4ThreeVector SurfacePoint(G4double x, G4double y,
G4bool isGlobal = false);
virtual G4double GetBoundaryMin(G4double u);
virtual G4double GetBoundaryMax(G4double u);
virtual G4double GetSurfaceArea();
virtual void GetFacets( G4int m, G4int n, G4double xyz[][3],
G4int faces[][4], G4int iside );
public: // without description
G4TwistTrapFlatSide(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
protected: // with description
virtual G4int GetAreaCode(const G4ThreeVector &xx,
G4bool withTol = true) ;
G4bool withTol = true);
private:
virtual void SetCorners();
virtual void SetBoundaries();
inline double xAxisMax(G4double u, G4double fTanAlpha) const ;
inline double xAxisMax(G4double u, G4double fTanAlpha) const;
private:
G4double fDx1 ;
G4double fDx2 ;
G4double fDy ;
G4double fDz ;
G4double fPhiTwist ;
G4double fAlpha ;
G4double fTAlph ;
G4double fPhi ;
G4double fTheta ;
G4double fdeltaX ;
G4double fdeltaY ;
G4double fDx1;
G4double fDx2;
G4double fDy;
G4double fDz;
G4double fPhiTwist;
G4double fAlpha;
G4double fTAlph;
G4double fPhi;
G4double fTheta;
G4double fdeltaX;
G4double fdeltaY;
};
//========================================================
// inline functions
//========================================================
inline
G4double G4FlatTrapSide::xAxisMax(G4double u, G4double fTanAlpha) const
G4double G4TwistTrapFlatSide::xAxisMax(G4double u, G4double fTanAlpha) const
{
return ( ( fDx2 + fDx1 )/2. + u*(fDx2 - fDx1)/(2.*fDy) - u *fTanAlpha ) ;
return ( ( fDx2 + fDx1 )/2. + u*(fDx2 - fDx1)/(2.*fDy) + u *fTanAlpha ) ;
}
inline G4ThreeVector
G4TwistTrapFlatSide::SurfacePoint(G4double x, G4double y, G4bool isGlobal)
{
G4ThreeVector SurfPoint ( x,y,0);
if (isGlobal) { return (fRot*SurfPoint + fTrans); }
return SurfPoint;
}
inline
G4double G4TwistTrapFlatSide::GetBoundaryMin(G4double y )
{
return -xAxisMax(y, -fTAlph ) ;
}
inline
G4double G4TwistTrapFlatSide::GetBoundaryMax(G4double y )
{
return xAxisMax(y, fTAlph ) ;
}
inline
G4double G4TwistTrapFlatSide::GetSurfaceArea()
{
return 2*(fDx1 + fDx2)*fDy ;
}
#endif
@@ -21,13 +21,13 @@
// ********************************************************************
//
//
// $Id: G4TwistedTrapParallelSide.hh,v 1.3 2005/03/18 17:11:53 gcosmo Exp $
// $Id: G4TwistTrapParallelSide.hh,v 1.4 2005/12/06 18:21:15 gcosmo Exp $
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
//
// G4TwistedTrapParallelSide
// G4TwistTrapParallelSide
//
// Class description:
//
@@ -35,36 +35,36 @@
// Author:
//
// Oliver Link (Oliver.Link@cern.ch)
// 27-Oct-2004 - O.Link (Oliver.Link@cern.ch)
//
// --------------------------------------------------------------------
#ifndef __G4TWISTEDTRAPPARALLELSIDE__
#define __G4TWISTEDTRAPPARALLELSIDE__
#ifndef __G4TWISTTRAPPARALLELSIDE__
#define __G4TWISTTRAPPARALLELSIDE__
#include "G4VSurface.hh"
#include "G4VTwistSurface.hh"
#include <vector>
class G4TwistedTrapParallelSide : public G4VSurface
class G4TwistTrapParallelSide : public G4VTwistSurface
{
public: // with description
G4TwistedTrapParallelSide(const G4String &name,
G4double PhiTwist, // twist angle
G4double pDz, // half z lenght
G4double pTheta, // direction between end planes
G4double pPhi, // defined by polar and azimutal angles.
G4double pDy1, // half y length at -pDz
G4double pDx1, // half x length at -pDz,-pDy
G4double pDx2, // half x length at -pDz,+pDy
G4double pDy2, // half y length at +pDz
G4double pDx3, // half x length at +pDz,-pDy
G4double pDx4, // half x length at +pDz,+pDy
G4double pAlph, // tilt angle at +pDz
G4double AngleSide // parity
);
G4TwistTrapParallelSide(const G4String &name,
G4double PhiTwist, // twist angle
G4double pDz, // half z lenght
G4double pTheta, // direction between end planes
G4double pPhi, // by polar and azimutal angles
G4double pDy1, // half y length at -pDz
G4double pDx1, // half x length at -pDz,-pDy
G4double pDx2, // half x length at -pDz,+pDy
G4double pDy2, // half y length at +pDz
G4double pDx3, // half x length at +pDz,-pDy
G4double pDx4, // half x length at +pDz,+pDy
G4double pAlph, // tilt angle at +pDz
G4double AngleSide // parity
);
virtual ~G4TwistedTrapParallelSide();
virtual ~G4TwistTrapParallelSide();
virtual G4ThreeVector GetNormal(const G4ThreeVector &xx,
G4bool isGlobal = false) ;
@@ -82,7 +82,12 @@ class G4TwistedTrapParallelSide : public G4VSurface
G4double distance[],
G4int areacode[]);
public: // without description
G4TwistTrapParallelSide(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
private:
@@ -95,12 +100,18 @@ class G4TwistedTrapParallelSide : public G4VSurface
G4ThreeVector ProjectPoint(const G4ThreeVector &p,
G4bool isglobal = false);
inline G4ThreeVector SurfacePoint(G4double phi, G4double u);
virtual G4ThreeVector SurfacePoint(G4double phi, G4double u,
G4bool isGlobal = false);
virtual G4double GetBoundaryMin(G4double phi);
virtual G4double GetBoundaryMax(G4double phi);
virtual G4double GetSurfaceArea();
virtual void GetFacets( G4int m, G4int n, G4double xyz[][3],
G4int faces[][4], G4int iside );
inline G4ThreeVector NormAng(G4double phi, G4double u);
inline G4double Xcoef(G4double u); // to calculate the w(u) function
inline G4double GetValueB(G4double phi) ;
inline G4double GetUmin(G4double phi) ;
inline G4double GetUmax(G4double phi) ;
inline G4double Xcoef(G4double u);
// To calculate the w(u) function
private:
@@ -117,24 +128,26 @@ class G4TwistedTrapParallelSide : public G4VSurface
G4double fDz; // Half-length along the z axis
G4double fAlph ;
G4double fTAlph ; // std::tan(fAlph)
G4double fAlph;
G4double fTAlph; // std::tan(fAlph)
G4double fPhiTwist; // twist angle ( dphi in surface equation)
G4double fAngleSide;
G4double fa1md1 ; // 2 fDx2 - 2 fDx1 == a1 - d1
G4double fa2md2 ; // 2 fDx4 - 2 fDx3
G4double fdeltaX;
G4double fdeltaY;
G4double fdeltaX ;
G4double fdeltaY ;
G4double fDx4plus2; // fDx4 + fDx2 == a2/2 + a1/2
G4double fDx4minus2; // fDx4 - fDx2 -
G4double fDx3plus1; // fDx3 + fDx1 == d2/2 + d1/2
G4double fDx3minus1; // fDx3 - fDx1 -
G4double fDy2plus1; // fDy2 + fDy1 == b2/2 + b1/2
G4double fDy2minus1; // fDy2 - fDy1 -
G4double fa1md1; // 2 fDx2 - 2 fDx1 == a1 - d1
G4double fa2md2; // 2 fDx4 - 2 fDx3
G4double fDy2plus1 ; // fDy2 + fDy1 == b2/2 + b1/2
G4double fDy2minus1 ; // fDy2 - fDy1 -
// temporary
G4double fDy ;
G4double fDy ; // temporary
};
@@ -142,62 +155,66 @@ class G4TwistedTrapParallelSide : public G4VSurface
// inline functions
//========================================================
inline
G4double G4TwistedTrapParallelSide::GetUmin(G4double phi)
{
return ( - (2*fDx2*(fPhiTwist - 2*phi) + 2*fDx4*(fPhiTwist + 2*phi) + (2*fDy1*(fPhiTwist - 2*phi) + 2*fDy2*(fPhiTwist + 2*phi))*fTAlph)/(4.*fPhiTwist) ) ;
}
inline
G4double G4TwistedTrapParallelSide::GetUmax(G4double phi)
{
return (2*fDx2*(fPhiTwist - 2*phi) + 2*fDx4*(fPhiTwist + 2*phi) - (2*fDy1*(fPhiTwist - 2*phi) + 2*fDy2*(fPhiTwist + 2*phi))*fTAlph)/(4.*fPhiTwist) ;
}
inline
G4double G4TwistedTrapParallelSide::GetValueB(G4double phi)
G4double G4TwistTrapParallelSide::GetValueB(G4double phi)
{
return ( fDy2plus1 + fDy2minus1 * ( 2 * phi ) / fPhiTwist ) ;
}
inline
G4double G4TwistedTrapParallelSide::Xcoef(G4double phi)
G4double G4TwistTrapParallelSide::Xcoef(G4double phi)
{
return GetValueB(phi)/2. ;
}
inline
G4ThreeVector G4TwistedTrapParallelSide::SurfacePoint( G4double phi, G4double u )
inline G4ThreeVector
G4TwistTrapParallelSide::
SurfacePoint( G4double phi, G4double u, G4bool isGlobal )
{
// function to calculate a point on the surface, given by parameters phi,u
G4ThreeVector SurfPoint ( ( u + fdeltaX*phi/fPhiTwist ) * std::cos(phi)
- ( Xcoef(phi) + fdeltaY*phi/fPhiTwist ) * std::sin(phi),
( u + fdeltaX*phi/fPhiTwist ) * std::sin(phi)
+ ( Xcoef(phi) + fdeltaY*phi/fPhiTwist ) * std::cos(phi),
2*fDz*phi/fPhiTwist );
return SurfPoint ;
G4ThreeVector SurfPoint ( u*std::cos(phi) - Xcoef(phi)*std::sin(phi)
+ fdeltaX*phi/fPhiTwist,
u*std::sin(phi) + Xcoef(phi)*std::cos(phi)
+ fdeltaY*phi/fPhiTwist,
2*fDz*phi/fPhiTwist );
if (isGlobal) { return (fRot * SurfPoint + fTrans); }
return SurfPoint;
}
inline
G4double G4TwistTrapParallelSide::GetBoundaryMin(G4double phi)
{
return -(fPhiTwist*(fDx2 + fDx4 - fDy2plus1*fTAlph)
+ 2*fDx4minus2*phi - 2*fDy2minus1*fTAlph*phi)/(2.*fPhiTwist) ;
}
inline
G4ThreeVector G4TwistedTrapParallelSide::NormAng( G4double phi, G4double u )
G4double G4TwistTrapParallelSide::GetBoundaryMax(G4double phi)
{
return (fDx2 + fDx4 + fDy2plus1*fTAlph)/ 2.
+ ((fDx4minus2 + fDy2minus1*fTAlph)*phi)/fPhiTwist ;
}
inline
G4double G4TwistTrapParallelSide::GetSurfaceArea()
{
return 2*fDx4plus2*fDz ;
}
inline
G4ThreeVector G4TwistTrapParallelSide::NormAng( G4double phi, G4double u )
{
// function to calculate the norm at a given point on the surface
// replace a1-d1
G4ThreeVector nvec(
-2*fDz*std::sin(phi),
2*fDz*std::cos(phi),
fDy1 - fDy2 - fdeltaY - fdeltaX*phi - fPhiTwist*u
) ;
G4ThreeVector nvec(-2*fDz*std::sin(phi) ,
2*fDz*std::cos(phi) ,
-(fDy2minus1 + fPhiTwist*u + fdeltaY*std::cos(phi)
-fdeltaX*std::sin(phi))) ;
return nvec.unit();
}
#endif
@@ -21,15 +21,15 @@
// ********************************************************************
//
//
// $Id: G4FlatSurface.hh,v 1.6 2004/11/13 18:26:24 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4TwistTubsFlatSide.hh,v 1.4 2005/12/06 18:21:15 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
//
// G4FlatSurface
// G4TwistTubsFlatSide
//
// Class description:
//
@@ -42,16 +42,16 @@
// 13-Nov-2003 - O.Link (Oliver.Link@cern.ch), Integration in Geant4
// from original version in Jupiter-2.5.02 application.
// --------------------------------------------------------------------
#ifndef __G4FLATSURFACE__
#define __G4FLATSURFACE__
#ifndef __G4TWISTTUBSFLATSIDE__
#define __G4TWISTTUBSFLATSIDE__
#include "G4VSurface.hh"
#include "G4VTwistSurface.hh"
class G4FlatSurface : public G4VSurface
class G4TwistTubsFlatSide : public G4VTwistSurface
{
public: // with description
G4FlatSurface(const G4String &name,
G4TwistTubsFlatSide(const G4String &name,
const G4RotationMatrix &rot,
const G4ThreeVector &tlate,
const G4ThreeVector &n,
@@ -62,7 +62,7 @@ class G4FlatSurface : public G4VSurface
G4double axis0max = kInfinity,
G4double axis1max = kInfinity );
G4FlatSurface( const G4String &name,
G4TwistTubsFlatSide( const G4String &name,
G4double EndInnerRadius[2],
G4double EndOuterRadius[2],
G4double DPhi,
@@ -70,7 +70,7 @@ class G4FlatSurface : public G4VSurface
G4double EndZ[2],
G4int handedness ) ;
virtual ~G4FlatSurface();
virtual ~G4TwistTubsFlatSide();
virtual G4ThreeVector GetNormal(const G4ThreeVector & /* xx */ ,
G4bool isGlobal = false);
virtual G4int DistanceToSurface(const G4ThreeVector &gp,
@@ -86,6 +86,23 @@ class G4FlatSurface : public G4VSurface
G4double distance[],
G4int areacode[]);
virtual G4ThreeVector SurfacePoint(G4double, G4double,
G4bool isGlobal = false ) ;
virtual G4double GetBoundaryMin(G4double phi) ;
virtual G4double GetBoundaryMax(G4double phi) ;
virtual G4double GetSurfaceArea() { return fSurfaceArea ; }
virtual void GetFacets( G4int m, G4int n, G4double xyz[][3],
G4int faces[][4], G4int iside ) ;
G4double fSurfaceArea ;
public: // without description
G4TwistTubsFlatSide(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
protected: // with description
virtual G4int GetAreaCode(const G4ThreeVector &xx,
@@ -98,4 +115,27 @@ class G4FlatSurface : public G4VSurface
};
inline G4ThreeVector G4TwistTubsFlatSide::
SurfacePoint(G4double phi , G4double rho , G4bool isGlobal )
{
G4ThreeVector SurfPoint (rho*std::cos(phi) , rho*std::sin(phi) , 0);
if (isGlobal) { return (fRot * SurfPoint + fTrans); }
return SurfPoint;
}
inline
G4double G4TwistTubsFlatSide::GetBoundaryMin(G4double)
{
G4ThreeVector dphimin = GetCorner(sC0Max1Min);
return std::atan2( dphimin.y(), dphimin.x() );
}
inline
G4double G4TwistTubsFlatSide::GetBoundaryMax(G4double)
{
G4ThreeVector dphimax = GetCorner(sC0Max1Max);
return std::atan2( dphimax.y(), dphimax.x() );
}
#endif
@@ -21,15 +21,15 @@
// ********************************************************************
//
//
// $Id: G4HyperbolicSurface.hh,v 1.7 2004/12/02 09:31:30 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4TwistTubsHypeSide.hh,v 1.4 2005/12/06 18:21:15 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
//
// G4HyperbolicSurface
// G4TwistTubsHypeSide
//
// Class description:
//
@@ -42,21 +42,23 @@
// 13-Nov-2003 - O.Link (Oliver.Link@cern.ch), Integration in Geant4
// from original version in Jupiter-2.5.02 application.
// --------------------------------------------------------------------
#ifndef __G4HYPERBOLICSURFACE__
#define __G4HYPERBOLICSURFACE__
#ifndef __G4TWISTTUBSHYPESIDE__
#define __G4TWISTTUBSHYPESIDE__
#include "G4VSurface.hh"
#include "G4VTwistSurface.hh"
#include "G4Integrator.hh"
#include "G4SimpleIntegration.hh"
class G4HyperbolicSurface : public G4VSurface
class G4TwistTubsHypeSide : public G4VTwistSurface
{
public: // with description
G4HyperbolicSurface(const G4String &name,
G4TwistTubsHypeSide(const G4String &name,
const G4RotationMatrix &rot, // 0.5*(phi-width segment)
const G4ThreeVector &tlate,
const G4int handedness,// R-hand = 1, L-hand = -1
const G4double kappa, // std::tan(TwistAngle/2)/fZHalfLen
const G4double tanstereo, // std::tan(stereo angle)
const G4double kappa, // tan(TwistAngle/2)/fZHalfLen
const G4double tanstereo, // tan(stereo angle)
const G4double r0, // radius at z = 0
const EAxis axis0 = kPhi,
const EAxis axis1 = kZAxis,
@@ -65,7 +67,7 @@ class G4HyperbolicSurface : public G4VSurface
G4double axis0max = kInfinity,
G4double axis1max = kInfinity);
G4HyperbolicSurface(const G4String &name,
G4TwistTubsHypeSide(const G4String &name,
G4double EndInnerRadius[2],
G4double EndOuterRadius[2],
G4double DPhi,
@@ -78,7 +80,7 @@ class G4HyperbolicSurface : public G4VSurface
G4double TanOuterStereo,
G4int handedness) ;
virtual ~G4HyperbolicSurface();
virtual ~G4TwistTubsHypeSide();
virtual G4int DistanceToSurface(const G4ThreeVector &gp,
const G4ThreeVector &gv,
@@ -97,9 +99,24 @@ class G4HyperbolicSurface : public G4VSurface
G4bool isGlobal = false) ;
virtual EInside Inside(const G4ThreeVector &gp) ;
inline virtual G4double GetRhoAtPZ(const G4ThreeVector &p,
G4bool isglobal = false) const ;
virtual G4double GetRhoAtPZ(const G4ThreeVector &p,
G4bool isglobal = false) const ;
virtual G4ThreeVector SurfacePoint(G4double, G4double,
G4bool isGlobal = false) ;
virtual G4double GetBoundaryMin(G4double phi) ;
virtual G4double GetBoundaryMax(G4double phi) ;
virtual G4double GetSurfaceArea() ;
virtual void GetFacets( G4int m, G4int n, G4double xyz[][3],
G4int faces[][4], G4int iside ) ;
public: // without description
G4TwistTubsHypeSide(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
private:
virtual G4int GetAreaCode(const G4ThreeVector &xx,
@@ -122,6 +139,8 @@ class G4HyperbolicSurface : public G4VSurface
G4double fTan2Stereo; // std::tan(StereoAngle)**2
G4double fR0; // radius at z = 0
G4double fR02; // radius**2 at z = 0
G4double fDPhi ; // segment
class Insidetype
{
public:
@@ -136,7 +155,7 @@ class G4HyperbolicSurface : public G4VSurface
//========================================================
inline
G4double G4HyperbolicSurface::GetRhoAtPZ(const G4ThreeVector &p,
G4double G4TwistTubsHypeSide::GetRhoAtPZ(const G4ThreeVector &p,
G4bool isglobal) const
{
// Get Rho at p.z() on Hyperbolic Surface.
@@ -149,4 +168,42 @@ G4double G4HyperbolicSurface::GetRhoAtPZ(const G4ThreeVector &p,
return std::sqrt(fR02 + tmpp.z() * tmpp.z() * fTan2Stereo);
}
inline
G4ThreeVector G4TwistTubsHypeSide::
SurfacePoint(G4double phi , G4double z , G4bool isGlobal)
{
G4double rho = std::sqrt(fR02 + z * z * fTan2Stereo) ;
G4ThreeVector SurfPoint (rho*std::cos(phi), rho*std::sin(phi), z) ;
if (isGlobal) { return (fRot * SurfPoint + fTrans); }
return SurfPoint;
}
inline
G4double G4TwistTubsHypeSide::GetBoundaryMin(G4double z)
{
G4ThreeVector ptmp(0,0,z) ; // temporary point with z Komponent only
G4ThreeVector lowerlimit; // lower phi-boundary limit at z = ptmp.z()
lowerlimit = GetBoundaryAtPZ(sAxis0 & sAxisMin, ptmp);
return std::atan2( lowerlimit.y(), lowerlimit.x() ) ;
}
inline
G4double G4TwistTubsHypeSide::GetBoundaryMax(G4double z )
{
G4ThreeVector ptmp(0,0,z) ; // temporary point with z Komponent only
G4ThreeVector upperlimit; // upper phi-boundary limit at z = ptmp.z()
upperlimit = GetBoundaryAtPZ(sAxis0 & sAxisMax, ptmp);
return std::atan2( upperlimit.y(), upperlimit.x() ) ;
}
inline
G4double G4TwistTubsHypeSide::GetSurfaceArea()
{
// approximation with tube surface
return ( fAxisMax[1] - fAxisMin[1] ) * fR0 * fDPhi ;
}
#endif
@@ -21,15 +21,15 @@
// ********************************************************************
//
//
// $Id: G4TwistedSurface.hh,v 1.7 2004/12/02 09:31:31 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4TwistTubsSide.hh,v 1.4 2005/12/06 18:21:15 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
//
// G4TwistedSurface
// G4TwistTubsSide
//
// Class description:
//
@@ -42,39 +42,39 @@
// 13-Nov-2003 - O.Link (Oliver.Link@cern.ch), Integration in Geant4
// from original version in Jupiter-2.5.02 application.
// --------------------------------------------------------------------
#ifndef __G4TWISTEDSURFACE__
#define __G4TWISTEDSURFACE__
#ifndef __G4TWISTTUBSSIDE__
#define __G4TWISTTUBSSIDE__
#include "G4VSurface.hh"
#include "G4VTwistSurface.hh"
class G4TwistedSurface : public G4VSurface
class G4TwistTubsSide : public G4VTwistSurface
{
public: // with description
G4TwistedSurface(const G4String &name,
const G4RotationMatrix &rot, // 0.5*(phi-width segment)
const G4ThreeVector &tlate,
G4int handedness, // R-hand = 1, L-hand = -1
const G4double kappa, // std::tan(TwistAngle/2)/fZHalfLen
const EAxis axis0 = kXAxis,
const EAxis axis1 = kZAxis,
G4double axis0min = -kInfinity,
G4double axis1min = -kInfinity,
G4double axis0max = kInfinity,
G4double axis1max = kInfinity );
G4TwistTubsSide(const G4String &name,
const G4RotationMatrix &rot, // 0.5*(phi-width segment)
const G4ThreeVector &tlate,
G4int handedness, // R-hand = 1, L-hand = -1
const G4double kappa, // tan(TwistAngle/2)/fZHalfLen
const EAxis axis0 = kXAxis,
const EAxis axis1 = kZAxis,
G4double axis0min = -kInfinity,
G4double axis1min = -kInfinity,
G4double axis0max = kInfinity,
G4double axis1max = kInfinity );
G4TwistedSurface(const G4String &name,
G4double EndInnerRadius[2],
G4double EndOuterRadius[2],
G4double DPhi,
G4double EndPhi[2],
G4double EndZ[2],
G4double InnerRadius,
G4double OuterRadius,
G4double Kappa,
G4int handedness);
G4TwistTubsSide(const G4String &name,
G4double EndInnerRadius[2],
G4double EndOuterRadius[2],
G4double DPhi,
G4double EndPhi[2],
G4double EndZ[2],
G4double InnerRadius,
G4double OuterRadius,
G4double Kappa,
G4int handedness);
virtual ~G4TwistedSurface();
virtual ~G4TwistTubsSide();
virtual G4ThreeVector GetNormal(const G4ThreeVector &xx,
G4bool isGlobal = false) ;
@@ -95,6 +95,21 @@ class G4TwistedSurface : public G4VSurface
inline G4ThreeVector ProjectAtPXPZ(const G4ThreeVector &p,
G4bool isglobal = false) const ;
virtual G4ThreeVector SurfacePoint(G4double, G4double,
G4bool isGlobal = false) ;
virtual G4double GetBoundaryMin(G4double phi) ;
virtual G4double GetBoundaryMax(G4double phi) ;
virtual G4double GetSurfaceArea() ;
virtual void GetFacets( G4int m, G4int n, G4double xyz[][3],
G4int faces[][4], G4int iside ) ;
public: // without description
G4TwistTubsSide(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
private:
virtual G4double DistanceToPlane(const G4ThreeVector &p,
@@ -129,8 +144,8 @@ class G4TwistedSurface : public G4VSurface
//========================================================
inline
G4ThreeVector G4TwistedSurface::ProjectAtPXPZ(const G4ThreeVector &p,
G4bool isglobal) const
G4ThreeVector G4TwistTubsSide::ProjectAtPXPZ(const G4ThreeVector &p,
G4bool isglobal) const
{
// Get Rho at p.z() on Hyperbolic Surface.
G4ThreeVector tmpp;
@@ -140,11 +155,37 @@ G4ThreeVector G4TwistedSurface::ProjectAtPXPZ(const G4ThreeVector &p,
tmpp = p;
}
G4ThreeVector xx(p.x(), p.x() * fKappa * p.z(), p.z());
if (isglobal) {
return (fRot * xx + fTrans);
} else {
return xx;
}
if (isglobal) { return (fRot * xx + fTrans); }
return xx;
}
inline
G4ThreeVector
G4TwistTubsSide::SurfacePoint(G4double x, G4double z, G4bool isGlobal)
{
G4ThreeVector SurfPoint( x , x * fKappa * z , z ) ;
if (isGlobal) { return (fRot * SurfPoint + fTrans); }
return SurfPoint;
}
inline
G4double G4TwistTubsSide::GetBoundaryMin(G4double)
{
return fAxisMin[0] ; // inner radius at z = 0
}
inline
G4double G4TwistTubsSide::GetBoundaryMax(G4double)
{
return fAxisMax[0] ; // outer radius at z = 0
}
inline
G4double G4TwistTubsSide::GetSurfaceArea()
{
// approximation only
return ( fAxisMax[0] - fAxisMin[0] ) * ( fAxisMax[1] - fAxisMin[1] ) ;
}
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4TwistedBox.hh,v 1.5 2005/04/04 11:56:59 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4TwistedBox.hh,v 1.9 2005/12/06 09:22:13 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
@@ -46,7 +46,7 @@
// Author:
//
// Oliver Link (Oliver.Link@cern.ch)
// 27-Oct-2004 - O.Link (Oliver.Link@cern.ch)
//
// --------------------------------------------------------------------
#ifndef __G4TWISTEDBOX__
@@ -56,28 +56,33 @@
class G4TwistedBox : public G4VTwistedFaceted
{
public: // with description
public: // with description
G4TwistedBox(const G4String& pName,
G4double pPhiTwist,
G4double pDx,
G4double pDy,
G4double pDz );
G4TwistedBox(const G4String& pName,
G4double pPhiTwist,
G4double pDx,
G4double pDy,
G4double pDz );
virtual ~G4TwistedBox();
virtual ~G4TwistedBox();
// accessors
// accessors
inline G4double GetXHalfLength() const { return GetDx1() ; }
inline G4double GetYHalfLength() const { return GetDy1() ; }
inline G4double GetZHalfLength() const { return GetDz() ; }
inline G4double GetPhiTwist() const { return GetTwistAngle() ; }
inline G4double GetXHalfLength() const { return GetDx1() ; }
inline G4double GetYHalfLength() const { return GetDy1() ; }
inline G4double GetZHalfLength() const { return GetDz() ; }
inline G4double GetPhiTwist() const { return GetTwistAngle() ; }
G4GeometryType GetEntityType() const;
G4Polyhedron* CreatePolyhedron() const;
G4GeometryType GetEntityType() const;
std::ostream& StreamInfo(std::ostream& os) const;
std::ostream& StreamInfo(std::ostream& os) const;
public: // without description
G4TwistedBox(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
};
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4TwistedTrap.hh,v 1.5 2005/04/04 11:56:59 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4TwistedTrap.hh,v 1.9 2005/12/06 09:22:13 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
@@ -58,7 +58,7 @@
// Author:
//
// Oliver Link (Oliver.Link@cern.ch)
// 27-Oct-2004 - O.Link (Oliver.Link@cern.ch)
//
// --------------------------------------------------------------------
#ifndef __G4TWISTEDTRAP__
@@ -68,50 +68,56 @@
class G4TwistedTrap : public G4VTwistedFaceted
{
public: // with description
public: // with description
G4TwistedTrap(const G4String &pName,
G4double pPhiTwist,
G4double pDx1, // half x length at -pDz,-pDy
G4double pDx2, // half x length at -pDz,+pDy
G4double pDy,
G4double pDz);
G4TwistedTrap(const G4String &pName,
G4double pPhiTwist,
G4double pDx1, // half x length at -pDz,-pDy
G4double pDx2, // half x length at -pDz,+pDy
G4double pDy,
G4double pDz);
G4TwistedTrap(const G4String &pName, // Name of instance
G4double pPhiTwist, // twist angle
G4double pDz, // half z length
G4double pTheta, // direction between end planes
G4double pPhi, // defined by polar and azim. angles
G4double pDy1, // half y length at -pDz
G4double pDx1, // half x length at -pDz,-pDy
G4double pDx2, // half x length at -pDz,+pDy
G4double pDy2, // half y length at +pDz
G4double pDx3, // half x length at +pDz,-pDy
G4double pDx4, // half x length at +pDz,+pDy
G4double pAlph // tilt angle
);
G4TwistedTrap(const G4String &pName, // Name of instance
G4double pPhiTwist, // twist angle
G4double pDz, // half z length
G4double pTheta, // direction between end planes
G4double pPhi, // defined by polar and azim. angles
G4double pDy1, // half y length at -pDz
G4double pDx1, // half x length at -pDz,-pDy
G4double pDx2, // half x length at -pDz,+pDy
G4double pDy2, // half y length at +pDz
G4double pDx3, // half x length at +pDz,-pDy
G4double pDx4, // half x length at +pDz,+pDy
G4double pAlph // tilt angle
);
virtual ~G4TwistedTrap();
virtual ~G4TwistedTrap();
// accessors
// accessors
inline G4double GetY1HalfLength() const { return GetDy1() ; }
inline G4double GetX1HalfLength() const { return GetDx1() ; }
inline G4double GetX2HalfLength() const { return GetDx2() ; }
inline G4double GetY2HalfLength() const { return GetDy2() ; }
inline G4double GetX3HalfLength() const { return GetDx3() ; }
inline G4double GetX4HalfLength() const { return GetDx4() ; }
inline G4double GetZHalfLength() const { return GetDz() ; }
inline G4double GetPhiTwist() const { return GetTwistAngle() ; }
inline G4double GetTiltAngleAlpha() const { return GetAlpha() ; }
inline G4double GetPolarAngleTheta() const { return GetTheta() ; }
inline G4double GetAzimuthalAnglePhi() const { return GetPhi() ; }
inline G4double GetY1HalfLength() const { return GetDy1() ; }
inline G4double GetX1HalfLength() const { return GetDx1() ; }
inline G4double GetX2HalfLength() const { return GetDx2() ; }
inline G4double GetY2HalfLength() const { return GetDy2() ; }
inline G4double GetX3HalfLength() const { return GetDx3() ; }
inline G4double GetX4HalfLength() const { return GetDx4() ; }
inline G4double GetZHalfLength() const { return GetDz() ; }
inline G4double GetPhiTwist() const { return GetTwistAngle() ; }
inline G4double GetTiltAngleAlpha() const { return GetAlpha() ; }
inline G4double GetPolarAngleTheta() const { return GetTheta() ; }
inline G4double GetAzimuthalAnglePhi() const { return GetPhi() ; }
G4GeometryType GetEntityType() const;
G4Polyhedron* CreatePolyhedron() const;
G4GeometryType GetEntityType() const;
std::ostream &StreamInfo(std::ostream& os) const;
std::ostream &StreamInfo(std::ostream& os) const;
public: // without description
G4TwistedTrap(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
} ;
@@ -1,210 +0,0 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4TwistedTrapAlphaSide.hh,v 1.5 2005/03/18 17:11:53 gcosmo Exp $
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
//
// G4TwistedTrapAlphaSide
//
// Class description:
//
// Class describing a twisted boundary surface for a trapezoid.
// Author:
//
// Oliver Link (Oliver.Link@cern.ch)
//
// --------------------------------------------------------------------
#ifndef __G4TWISTEDTRAPALPHASIDE__
#define __G4TWISTEDTRAPALPHASIDE__
#include "G4VSurface.hh"
#include <vector>
class G4TwistedTrapAlphaSide : public G4VSurface
{
public: // with description
G4TwistedTrapAlphaSide(const G4String &name,
G4double PhiTwist, // twist angle
G4double pDz, // half z lenght
G4double pTheta, // direction between end planes
G4double pPhi, // defined by polar and azimutal angles.
G4double pDy1, // half y length at -pDz
G4double pDx1, // half x length at -pDz,-pDy
G4double pDx2, // half x length at -pDz,+pDy
G4double pDy2, // half y length at +pDz
G4double pDx3, // half x length at +pDz,-pDy
G4double pDx4, // half x length at +pDz,+pDy
G4double pAlph, // tilt angle at +pDz
G4double AngleSide // parity
);
virtual ~G4TwistedTrapAlphaSide();
virtual G4ThreeVector GetNormal(const G4ThreeVector &xx,
G4bool isGlobal = false) ;
virtual G4int DistanceToSurface(const G4ThreeVector &gp,
const G4ThreeVector &gv,
G4ThreeVector gxx[],
G4double distance[],
G4int areacode[],
G4bool isvalid[],
EValidate validate = kValidateWithTol);
virtual G4int DistanceToSurface(const G4ThreeVector &gp,
G4ThreeVector gxx[],
G4double distance[],
G4int areacode[]);
private:
virtual G4int GetAreaCode(const G4ThreeVector &xx,
G4bool withTol = true);
virtual void SetCorners();
virtual void SetBoundaries();
void GetPhiUAtX(G4ThreeVector p, G4double &phi, G4double &u);
G4ThreeVector ProjectPoint(const G4ThreeVector &p,
G4bool isglobal = false);
inline G4ThreeVector SurfacePoint(G4double phi, G4double u);
inline G4ThreeVector NormAng(G4double phi, G4double u);
inline G4double Xcoef(G4double u,G4double phi); // to calculate the w(u) function
inline G4double GetValueA(G4double phi) ;
inline G4double GetValueB(G4double phi) ;
inline G4double GetValueD(G4double phi) ;
private:
G4double fTheta;
G4double fPhi ;
G4double fDy1;
G4double fDx1;
G4double fDx2;
G4double fDy2;
G4double fDx3;
G4double fDx4;
G4double fDz; // Half-length along the z axis
G4double fAlph ;
G4double fTAlph ; // std::tan(fAlph)
G4double fPhiTwist; // twist angle ( dphi in surface equation)
G4double fAngleSide;
G4double fDx4plus2 ; // fDx4 + fDx2 == a2/2 + a1/2
G4double fDx4minus2 ; // fDx4 - fDx2 -
G4double fDx3plus1 ; // fDx3 + fDx1 == d2/2 + d1/2
G4double fDx3minus1 ; // fDx3 - fDx1 -
G4double fDy2plus1 ; // fDy2 + fDy1 == b2/2 + b1/2
G4double fDy2minus1 ; // fDy2 - fDy1 -
G4double fa1md1 ; // 2 fDx2 - 2 fDx1 == a1 - d1
G4double fa2md2 ; // 2 fDx4 - 2 fDx3
G4double fdeltaX ;
G4double fdeltaY ;
};
//========================================================
// inline functions
//========================================================
inline
G4double G4TwistedTrapAlphaSide::GetValueA(G4double phi)
{
return ( fDx4plus2 + fDx4minus2 * ( 2 * phi ) / fPhiTwist ) ;
}
inline
G4double G4TwistedTrapAlphaSide::GetValueD(G4double phi)
{
return ( fDx3plus1 + fDx3minus1 * ( 2 * phi) / fPhiTwist ) ;
}
inline
G4double G4TwistedTrapAlphaSide::GetValueB(G4double phi)
{
return ( fDy2plus1 + fDy2minus1 * ( 2 * phi ) / fPhiTwist ) ;
}
inline
G4double G4TwistedTrapAlphaSide::Xcoef(G4double u, G4double phi)
{
return GetValueA(phi)/2. + (GetValueD(phi)-GetValueA(phi))/4.
- u*( ( GetValueD(phi)-GetValueA(phi) ) / ( 2 * GetValueB(phi) ) + fTAlph ) ;
}
inline
G4ThreeVector G4TwistedTrapAlphaSide::SurfacePoint( G4double phi, G4double u )
{
// function to calculate a point on the surface, given by parameters phi,u
G4ThreeVector SurfPoint ( ( Xcoef(u,phi) + fdeltaX*phi/fPhiTwist ) * std::cos(phi)
- ( u + fdeltaY*phi/fPhiTwist ) * std::sin(phi),
( Xcoef(u,phi) + fdeltaX*phi/fPhiTwist ) * std::sin(phi)
+ ( u + fdeltaY*phi/fPhiTwist ) * std::cos(phi),
2*fDz*phi/fPhiTwist );
return SurfPoint ;
}
inline
G4ThreeVector G4TwistedTrapAlphaSide::NormAng( G4double phi, G4double u )
{
// function to calculate the norm at a given point on the surface
// replace a1-d1
G4ThreeVector nvec( 16*fDy1*2*fDz*(4*fDy1*(std::cos(phi)-std::sin(phi)*fTAlph) + fa1md1*std::sin(phi)),
16*fDy1*2*fDz*(4*fDy1*std::sin(phi) + std::cos(phi)*(-fa1md1 + 4*fDy1*fTAlph)),
2*fDy1*(-16*fDy1*(fDx4minus2 + fDx3minus1) + 4*fDx2*fDx4plus2*fPhiTwist -
(fDx4+fDx1)*4*fDx1*fPhiTwist + 2*fa1md1*fDx3*fPhiTwist -
32*fDy1*fdeltaX + 8*fa1md1*fdeltaY +
2*(-(fa1md1*(-2*(fDx4minus2 + fDx3minus1) - 4*fdeltaX)) + 16*fDy1*fdeltaY)*phi) +
4*(16*fDy1*fDy1 + (fa1md1)*(fa1md1))*fPhiTwist*u -
4*fDy1*fTAlph*(2*fDy1*(2*(fDx4plus2+fDx3plus1)*fPhiTwist
+ 8*fdeltaY - 2*(-2*(fDx4minus2+fDx3minus1) - 4*fdeltaX)*phi)
+ 8*(fa1md1)*fPhiTwist*u - 16*fDy1*fPhiTwist*u*fTAlph) ) ;
return nvec.unit();
}
#endif
@@ -1,183 +0,0 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4TwistedTrapBoxSide.hh,v 1.2 2005/03/18 17:11:53 gcosmo Exp $
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
//
// G4TwistedTrapBoxSide
//
// Class description:
//
// Class describing a twisted boundary surface for a trapezoid.
// Author:
//
// Oliver Link (Oliver.Link@cern.ch)
//
// --------------------------------------------------------------------
#ifndef __G4TWISTEDTRAPBOXSIDE__
#define __G4TWISTEDTRAPBOXASIDE__
#include "G4VSurface.hh"
#include <vector>
class G4TwistedTrapBoxSide : public G4VSurface
{
public: // with description
G4TwistedTrapBoxSide(const G4String &name,
G4double PhiTwist, // twist angle
G4double pDz, // half z lenght
G4double pTheta, // direction between end planes
G4double pPhi, // defined by polar and azimutal angles.
G4double pDy1, // half y length at -pDz
G4double pDx1, // half x length at -pDz,-pDy
G4double pDy2, // half y length at +pDz
G4double pDx2, // half x length at +pDz,-pDy
G4double pAlph, // tilt angle at +pDz
G4double AngleSide // parity
);
virtual ~G4TwistedTrapBoxSide();
virtual G4ThreeVector GetNormal(const G4ThreeVector &xx,
G4bool isGlobal = false) ;
virtual G4int DistanceToSurface(const G4ThreeVector &gp,
const G4ThreeVector &gv,
G4ThreeVector gxx[],
G4double distance[],
G4int areacode[],
G4bool isvalid[],
EValidate validate = kValidateWithTol);
virtual G4int DistanceToSurface(const G4ThreeVector &gp,
G4ThreeVector gxx[],
G4double distance[],
G4int areacode[]);
private:
virtual G4int GetAreaCode(const G4ThreeVector &xx,
G4bool withTol = true);
virtual void SetCorners();
virtual void SetBoundaries();
void GetPhiUAtX(G4ThreeVector p, G4double &phi, G4double &u);
G4ThreeVector ProjectPoint(const G4ThreeVector &p,
G4bool isglobal = false);
inline G4ThreeVector SurfacePoint(G4double phi, G4double u);
inline G4ThreeVector NormAng(G4double phi, G4double u);
inline G4double Xcoef(G4double u,G4double phi); // to calculate the w(u) function
inline G4double GetValueA(G4double phi) ;
inline G4double GetValueB(G4double phi) ;
private:
G4double fTheta;
G4double fPhi ;
G4double fDy1;
G4double fDy2;
G4double fDx1;
G4double fDx2;
G4double fDz; // Half-length along the z axis
G4double fAlph ;
G4double fTAlph ; // std::tan(fAlph)
G4double fPhiTwist; // twist angle ( dphi in surface equation)
G4double fAngleSide;
G4double fdeltaX ;
G4double fdeltaY ;
};
//========================================================
// inline functions
//========================================================
inline
G4double G4TwistedTrapBoxSide::GetValueA(G4double phi)
{
return ( fDx1 + fDx2 - (2*(fDx1 - fDx2)*phi)/fPhiTwist ) ;
}
inline
G4double G4TwistedTrapBoxSide::GetValueB(G4double phi)
{
return ( fDy1 + fDy2 - (2*(fDy1 - fDy2)*phi)/fPhiTwist ) ;
}
inline
G4double G4TwistedTrapBoxSide::Xcoef(G4double u, G4double phi)
{
return GetValueA(phi)/2. - u*fTAlph ;
}
inline
G4ThreeVector G4TwistedTrapBoxSide::SurfacePoint( G4double phi, G4double u )
{
// function to calculate a point on the surface, given by parameters phi,u
G4ThreeVector SurfPoint ( ( Xcoef(u,phi) + fdeltaX*phi/fPhiTwist ) * std::cos(phi)
- ( u + fdeltaY*phi/fPhiTwist ) * std::sin(phi),
( Xcoef(u,phi) + fdeltaX*phi/fPhiTwist ) * std::sin(phi)
+ ( u + fdeltaY*phi/fPhiTwist ) * std::cos(phi),
2*fDz*phi/fPhiTwist );
return SurfPoint ;
}
inline
G4ThreeVector G4TwistedTrapBoxSide::NormAng( G4double phi, G4double u )
{
// function to calculate the norm at a given point on the surface
// replace a1-d1
G4ThreeVector
nvec(
8*fDz*(std::cos(phi) - fTAlph*std::sin(phi)),
8*fDz*(fTAlph*std::cos(phi) + std::sin(phi)),
2*fDx1*(2 - fTAlph*(fPhiTwist - 2*phi)) - 2*fDx2*(2 + fTAlph*(fPhiTwist + 2*phi))
- 4*(fdeltaX + fdeltaY*(fTAlph - phi) + fdeltaX*fTAlph*phi) + 4*fPhiTwist*(1 + fTAlph*fTAlph)*u) ;
return nvec.unit();
}
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4TwistedTrd.hh,v 1.2 2005/04/04 11:56:59 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4TwistedTrd.hh,v 1.5 2005/12/05 17:03:34 link Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
@@ -58,31 +58,37 @@
class G4TwistedTrd : public G4VTwistedFaceted
{
public: // with description
public: // with description
G4TwistedTrd( const G4String& pName,
G4double pDx1,
G4double pDx2,
G4double pDy1,
G4double pDy2,
G4double pDz,
G4double pPhiTwist );
G4TwistedTrd( const G4String& pName,
G4double pDx1,
G4double pDx2,
G4double pDy1,
G4double pDy2,
G4double pDz,
G4double pPhiTwist );
virtual ~G4TwistedTrd();
virtual ~G4TwistedTrd();
// accessors
// accessors
inline G4double GetX1HalfLength() const { return GetDx1() ; }
inline G4double GetX2HalfLength() const { return GetDx3() ; }
inline G4double GetY1HalfLength() const { return GetDy1() ; }
inline G4double GetY2HalfLength() const { return GetDy2() ; }
inline G4double GetZHalfLength() const { return GetDz() ; }
inline G4double GetPhiTwist() const { return GetTwistAngle() ; }
inline G4double GetX1HalfLength() const { return GetDx1() ; }
inline G4double GetX2HalfLength() const { return GetDx3() ; }
inline G4double GetY1HalfLength() const { return GetDy1() ; }
inline G4double GetY2HalfLength() const { return GetDy2() ; }
inline G4double GetZHalfLength() const { return GetDz() ; }
inline G4double GetPhiTwist() const { return GetTwistAngle() ; }
G4GeometryType GetEntityType() const;
G4Polyhedron* CreatePolyhedron () const;
G4GeometryType GetEntityType() const;
std::ostream& StreamInfo(std::ostream& os) const;
std::ostream& StreamInfo(std::ostream& os) const;
public: // without description
G4TwistedTrd(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
} ;
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4TwistedTubs.hh,v 1.8 2005/04/04 11:56:59 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4TwistedTubs.hh,v 1.11 2005/11/18 16:48:01 link Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
@@ -53,9 +53,9 @@
#define __G4TWISTEDTUBS__
#include "G4VSolid.hh"
#include "G4FlatSurface.hh"
#include "G4TwistedSurface.hh"
#include "G4HyperbolicSurface.hh"
#include "G4TwistTubsFlatSide.hh"
#include "G4TwistTubsSide.hh"
#include "G4TwistTubsHypeSide.hh"
class G4SolidExtentList;
class G4ClippablePolygon;
@@ -168,10 +168,17 @@ class G4TwistedTubs : public G4VSolid
// Returns an estimation of the geometrical cubic volume of the
// solid. Caches the computed value once computed the first time.
G4ThreeVector GetPointOnSurface() const ;
public: // without description
G4TwistedTubs(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
#ifdef G4SPECSDEBUG
G4VSurface * GetOuterHype() const { return fOuterHype; }
G4VTwistSurface * GetOuterHype() const { return fOuterHype; }
#endif
private:
@@ -213,12 +220,12 @@ class G4TwistedTubs : public G4VSolid
G4double fTanOuterStereo2; // fInnerRadius * fInnerRadius
G4double fEndZ2[2]; // fEndZ * fEndZ
G4VSurface *fLowerEndcap; // Surface of -ve z
G4VSurface *fUpperEndcap; // Surface of +ve z
G4VSurface *fLatterTwisted; // Surface of -ve phi
G4VSurface *fFormerTwisted; // Surface of +ve phi
G4VSurface *fInnerHype; // Surface of -ve r
G4VSurface *fOuterHype; // Surface of +ve r
G4VTwistSurface *fLowerEndcap; // Surface of -ve z
G4VTwistSurface *fUpperEndcap; // Surface of +ve z
G4VTwistSurface *fLatterTwisted; // Surface of -ve phi
G4VTwistSurface *fFormerTwisted; // Surface of +ve phi
G4VTwistSurface *fInnerHype; // Surface of -ve r
G4VTwistSurface *fOuterHype; // Surface of +ve r
G4double fCubicVolume; // Cached value for cubic volume
@@ -245,7 +252,7 @@ class G4TwistedTubs : public G4VSolid
{
p.set(kInfinity,kInfinity,kInfinity);
vec.set(kInfinity,kInfinity,kInfinity);
surface = new G4VSurface*[1];
surface = new G4VTwistSurface*[1];
}
~LastVector()
{
@@ -254,7 +261,7 @@ class G4TwistedTubs : public G4VSolid
public:
G4ThreeVector p;
G4ThreeVector vec;
G4VSurface **surface;
G4VTwistSurface **surface;
};
class LastValue // last G4double value
@@ -22,7 +22,7 @@
//
//
// $Id: G4VCSGface.hh,v 1.6 2003/11/03 18:39:55 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VCSGfaceted.hh,v 1.10 2004/10/10 10:39:46 johna Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4VCSGfaceted.hh,v 1.11 2005/11/09 15:04:28 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
@@ -52,70 +52,77 @@ class G4VCSGfaceted : public G4VSolid
{
public: // with description
G4VCSGfaceted( G4String name );
virtual ~G4VCSGfaceted();
G4VCSGfaceted( G4String name );
virtual ~G4VCSGfaceted();
G4VCSGfaceted( const G4VCSGfaceted &source );
const G4VCSGfaceted &operator=( const G4VCSGfaceted &source );
G4VCSGfaceted( const G4VCSGfaceted &source );
const G4VCSGfaceted &operator=( const G4VCSGfaceted &source );
virtual G4bool CalculateExtent( const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pmin, G4double& pmax ) const;
virtual G4bool CalculateExtent( const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pmin,G4double& pmax ) const;
virtual EInside Inside( const G4ThreeVector& p ) const;
virtual EInside Inside( const G4ThreeVector& p ) const;
virtual G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const;
virtual G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const;
virtual G4double DistanceToIn( const G4ThreeVector& p,
const G4ThreeVector& v ) const;
virtual G4double DistanceToIn( const G4ThreeVector& p ) const;
virtual G4double DistanceToOut( const G4ThreeVector& p,
const G4ThreeVector& v,
const G4bool calcNorm=false,
G4bool *validNorm=0,
G4ThreeVector *n=0 ) const;
virtual G4double DistanceToOut( const G4ThreeVector& p ) const;
virtual G4double DistanceToIn( const G4ThreeVector& p,
const G4ThreeVector& v ) const;
virtual G4double DistanceToIn( const G4ThreeVector& p ) const;
virtual G4double DistanceToOut( const G4ThreeVector& p,
const G4ThreeVector& v,
const G4bool calcNorm=false,
G4bool *validNorm=0,
G4ThreeVector *n=0 ) const;
virtual G4double DistanceToOut( const G4ThreeVector& p ) const;
virtual G4GeometryType GetEntityType() const;
virtual G4GeometryType GetEntityType() const;
virtual std::ostream& StreamInfo(std::ostream& os) const;
virtual std::ostream& StreamInfo(std::ostream& os) const;
virtual G4Polyhedron* CreatePolyhedron() const = 0;
virtual G4Polyhedron* CreatePolyhedron() const = 0;
virtual void DescribeYourselfTo( G4VGraphicsScene& scene ) const;
virtual void DescribeYourselfTo( G4VGraphicsScene& scene ) const;
virtual G4VisExtent GetExtent() const;
virtual G4VisExtent GetExtent() const;
virtual G4Polyhedron* GetPolyhedron () const;
virtual G4Polyhedron* GetPolyhedron () const;
G4int GetCubVolStatistics() const;
G4double GetCubVolEpsilon() const;
void SetCubVolStatistics(G4int st);
void SetCubVolEpsilon(G4double ep);
G4int GetCubVolStatistics() const;
G4double GetCubVolEpsilon() const;
void SetCubVolStatistics(G4int st);
void SetCubVolEpsilon(G4double ep);
virtual G4double GetCubicVolume();
// Returns an estimation of the geometrical cubic volume of the
// solid. Caches the computed value once computed the first time.
virtual G4double GetCubicVolume();
// Returns an estimation of the geometrical cubic volume of the
// solid. Caches the computed value once computed the first time.
public: // without description
G4VCSGfaceted(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
protected: // without description
G4int numFace;
G4VCSGface **faces;
G4double fCubicVolume;
mutable G4Polyhedron* fpPolyhedron;
G4int numFace;
G4VCSGface **faces;
G4double fCubicVolume;
mutable G4Polyhedron* fpPolyhedron;
virtual G4double DistanceTo( const G4ThreeVector &p,
const G4bool outgoing ) const;
virtual G4double DistanceTo( const G4ThreeVector &p,
const G4bool outgoing ) const;
void CopyStuff( const G4VCSGfaceted &source );
void DeleteStuff();
void CopyStuff( const G4VCSGfaceted &source );
void DeleteStuff();
private:
G4int fCubVolStatistics;
G4double fCubVolEpsilon;
// Statistics, error accuracy for volume estimation.
G4int fCubVolStatistics;
G4double fCubVolEpsilon;
// Statistics, error accuracy for volume estimation.
};
@@ -21,15 +21,15 @@
// ********************************************************************
//
//
// $Id: G4VSurface.hh,v 1.11 2004/12/17 16:34:56 link Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4VTwistSurface.hh,v 1.3 2005/12/06 09:22:13 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
//
// G4VSurface
// G4VTwistSurface
//
// Class description:
//
@@ -42,8 +42,8 @@
// 13-Nov-2003 - O.Link (Oliver.Link@cern.ch), Integration in Geant4
// from original version in Jupiter-2.5.02 application.
// --------------------------------------------------------------------
#ifndef __G4VSURFACE__
#define __G4VSURFACE__
#ifndef __G4VTWISTSURFACE__
#define __G4VTWISTSURFACE__
#include "G4VSolid.hh"
#include "geomdefs.hh"
@@ -52,7 +52,7 @@
#define G4VSURFACENXX 10
class G4VSurface
class G4VTwistSurface
{
public: // without description
@@ -61,8 +61,8 @@ class G4VSurface
public: // with description
G4VSurface (const G4String &name);
G4VSurface (const G4String &name,
G4VTwistSurface (const G4String &name);
G4VTwistSurface (const G4String &name,
const G4RotationMatrix &rot,
const G4ThreeVector &tlate,
G4int handedness,
@@ -73,7 +73,7 @@ class G4VSurface
G4double axis0max = kInfinity,
G4double axis1max = kInfinity);
virtual ~G4VSurface();
virtual ~G4VTwistSurface();
virtual G4int AmIOnLeftSide(const G4ThreeVector &me,
const G4ThreeVector &vec,
@@ -150,8 +150,8 @@ class G4VSurface
inline G4bool IsBoundary (G4int areacode, G4bool testbitmode = false) const;
inline G4bool IsCorner (G4int areacode, G4bool testbitmode = false) const;
inline G4bool IsValidNorm() const { return fIsValidNorm; }
G4bool IsSameBoundary (G4VSurface *surface1, G4int areacode1,
G4VSurface *surface2, G4int areacode2 ) const;
G4bool IsSameBoundary (G4VTwistSurface *surface1, G4int areacode1,
G4VTwistSurface *surface2, G4int areacode2 ) const;
inline G4int GetAxisType(G4int areacode, G4int whichaxis) const;
inline G4ThreeVector ComputeGlobalPoint (const G4ThreeVector &lp) const;
@@ -162,15 +162,33 @@ class G4VSurface
// set methods
inline void SetAxis(G4int i, const EAxis axis) { fAxis[i] = axis; }
inline void SetNeighbours(G4VSurface* axis0min, G4VSurface* axis1min,
G4VSurface* axis0max, G4VSurface* axis1max);
inline void SetNeighbours(G4VTwistSurface* axis0min, G4VTwistSurface* axis1min,
G4VTwistSurface* axis0max, G4VTwistSurface* axis1max);
virtual G4ThreeVector SurfacePoint(G4double , G4double,
G4bool isGlobal = false ) = 0 ;
virtual G4double GetBoundaryMin(G4double) = 0 ;
virtual G4double GetBoundaryMax(G4double) = 0 ;
virtual G4double GetSurfaceArea() = 0 ;
virtual void GetFacets(G4int m, G4int n, G4double xyz[][3],
G4int faces[][4], G4int iside) = 0 ;
G4int GetNode( G4int i, G4int j, G4int m, G4int n, G4int iside ) ;
G4int GetFace( G4int i, G4int j, G4int m, G4int n, G4int iside ) ;
public: // without description
G4VTwistSurface(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
protected: // with description
// get methods
inline G4VSurface** GetNeighbours() { return fNeighbours; }
inline G4int GetNeighbours(G4int areacode, G4VSurface* surfaces[]);
inline G4VTwistSurface** GetNeighbours() { return fNeighbours; }
inline G4int GetNeighbours(G4int areacode, G4VTwistSurface* surfaces[]);
inline G4ThreeVector GetCorner(G4int areacode) const;
void GetBoundaryAxis(G4int areacode, EAxis axis[]) const;
void GetBoundaryLimit(G4int areacode, G4double limit[]) const;
@@ -313,7 +331,7 @@ class G4VSurface
private:
G4VSurface *fNeighbours[4]; // {0,1,2,3} = sAxis0min, sAxis1min,
G4VTwistSurface *fNeighbours[4]; // {0,1,2,3} = sAxis0min, sAxis1min,
// sAxis0max, sAxis1max
G4ThreeVector fCorners[4]; // corners of the surface in local coordinate
Boundary fBoundaries[4]; // boundaries of the surface.
@@ -334,8 +352,8 @@ class G4VSurface
// inline functions
//========================================================
struct Intersection {
struct Intersection
{
G4double phi ; // parameter phi
G4double u ; // parameter u
G4ThreeVector xx ; // intersection point in cartesian
@@ -343,8 +361,7 @@ struct Intersection {
G4int areacode; // the areacode of the intersection
G4bool isvalid ; // valid intersection ??
} ;
};
inline
G4bool DistanceSort( const Intersection &a, const Intersection &b)
@@ -358,7 +375,6 @@ G4bool EqualIntersection( const Intersection &a, const Intersection &b)
return ( ( a.xx - b.xx ).mag() < kCarTolerance ) ;
}
#include "G4VSurface.icc"
#include "G4VTwistSurface.icc"
#endif
@@ -21,12 +21,12 @@
// ********************************************************************
//
//
// $Id: G4VSurface.icc,v 1.6 2004/12/02 09:31:31 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4VTwistSurface.icc,v 1.2 2005/12/08 13:44:06 link Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
//
// --------------------------------------------------------------------
// G4VSurface class inline methods
// G4VTwistSurface class inline methods
//
// Author:
// 01-Aug-2002 - Kotoyo Hoshina (hoshina@hepburn.s.chiba-u.ac.jp)
@@ -40,7 +40,7 @@
//* DistanceToPlaneWithV ----------------------------------------------
inline
G4double G4VSurface::DistanceToPlaneWithV(const G4ThreeVector &p,
G4double G4VTwistSurface::DistanceToPlaneWithV(const G4ThreeVector &p,
const G4ThreeVector &v,
const G4ThreeVector &x0,
const G4ThreeVector &n0,
@@ -55,7 +55,7 @@ G4double G4VSurface::DistanceToPlaneWithV(const G4ThreeVector &p,
//* DistanceToPlane ---------------------------------------------------
inline
G4double G4VSurface::DistanceToPlane(const G4ThreeVector &p,
G4double G4VTwistSurface::DistanceToPlane(const G4ThreeVector &p,
const G4ThreeVector &x0,
const G4ThreeVector &n0,
G4ThreeVector &xx)
@@ -90,7 +90,7 @@ G4double G4VSurface::DistanceToPlane(const G4ThreeVector &p,
//* DistanceToPlane ---------------------------------------------------
inline
G4double G4VSurface::DistanceToPlane(const G4ThreeVector &p,
G4double G4VTwistSurface::DistanceToPlane(const G4ThreeVector &p,
const G4ThreeVector &x0,
const G4ThreeVector &t1,
const G4ThreeVector &t2,
@@ -111,7 +111,7 @@ G4double G4VSurface::DistanceToPlane(const G4ThreeVector &p,
//* DistanceToLine ----------------------------------------------------
inline
G4double G4VSurface::DistanceToLine(const G4ThreeVector &p,
G4double G4VTwistSurface::DistanceToLine(const G4ThreeVector &p,
const G4ThreeVector &x0,
const G4ThreeVector &d,
G4ThreeVector &xx)
@@ -152,7 +152,7 @@ G4double G4VSurface::DistanceToLine(const G4ThreeVector &p,
//* IsAxis0 -----------------------------------------------------------
inline
G4bool G4VSurface::IsAxis0(G4int areacode) const
G4bool G4VTwistSurface::IsAxis0(G4int areacode) const
{
if (areacode & sAxis0) return true;
return false;
@@ -162,7 +162,7 @@ G4bool G4VSurface::IsAxis0(G4int areacode) const
//* IsAxis1 -----------------------------------------------------------
inline
G4bool G4VSurface::IsAxis1(G4int areacode) const
G4bool G4VTwistSurface::IsAxis1(G4int areacode) const
{
if (areacode & sAxis1) return true;
return false;
@@ -172,7 +172,7 @@ G4bool G4VSurface::IsAxis1(G4int areacode) const
//* IsOutside ---------------------------------------------------------
inline
G4bool G4VSurface::IsOutside(G4int areacode) const
G4bool G4VTwistSurface::IsOutside(G4int areacode) const
{
if (areacode & sInside) return false;
return true;
@@ -182,7 +182,7 @@ G4bool G4VSurface::IsOutside(G4int areacode) const
//* IsInside ----------------------------------------------------------
inline
G4bool G4VSurface::IsInside(G4int areacode, G4bool testbitmode) const
G4bool G4VTwistSurface::IsInside(G4int areacode, G4bool testbitmode) const
{
if (areacode & sInside) {
if (testbitmode) {
@@ -198,7 +198,7 @@ G4bool G4VSurface::IsInside(G4int areacode, G4bool testbitmode) const
//* IsBoundary --------------------------------------------------------
inline
G4bool G4VSurface::IsBoundary(G4int areacode, G4bool testbitmode) const
G4bool G4VTwistSurface::IsBoundary(G4int areacode, G4bool testbitmode) const
{
if ((areacode & sBoundary) == sBoundary) {
if (testbitmode) {
@@ -214,7 +214,7 @@ G4bool G4VSurface::IsBoundary(G4int areacode, G4bool testbitmode) const
//* IsCorner ----------------------------------------------------------
inline
G4bool G4VSurface::IsCorner(G4int areacode, G4bool testbitmode) const
G4bool G4VTwistSurface::IsCorner(G4int areacode, G4bool testbitmode) const
{
if ((areacode & sCorner) == sCorner) {
if (testbitmode) {
@@ -230,7 +230,7 @@ G4bool G4VSurface::IsCorner(G4int areacode, G4bool testbitmode) const
//* GetAxisType -------------------------------------------------------
inline
G4int G4VSurface::GetAxisType(G4int areacode, G4int whichaxis) const
G4int G4VTwistSurface::GetAxisType(G4int areacode, G4int whichaxis) const
{
G4int axiscode = areacode & sAxisMask & whichaxis;
@@ -250,9 +250,9 @@ G4int G4VSurface::GetAxisType(G4int areacode, G4int whichaxis) const
axiscode == (sAxisPhi & sAxis1)) {
return sAxisPhi;
} else {
G4cerr << "ERROR - G4VSurface::GetAxisType()" << G4endl
G4cerr << "ERROR - G4VTwistSurface::GetAxisType()" << G4endl
<< " areacode = " << areacode << G4endl;
G4Exception("G4VSurface::GetAxisType()","NotSupported",
G4Exception("G4VTwistSurface::GetAxisType()","NotSupported",
FatalException, "Configuration not supported.");
}
return 1;
@@ -262,7 +262,7 @@ G4int G4VSurface::GetAxisType(G4int areacode, G4int whichaxis) const
//* ComputeGlobalPoint ------------------------------------------------
inline
G4ThreeVector G4VSurface::ComputeGlobalPoint(const G4ThreeVector &lp) const
G4ThreeVector G4VTwistSurface::ComputeGlobalPoint(const G4ThreeVector &lp) const
{
return fRot * G4ThreeVector(lp) + fTrans;
}
@@ -271,16 +271,16 @@ G4ThreeVector G4VSurface::ComputeGlobalPoint(const G4ThreeVector &lp) const
//* ComputeGlobalPoint ------------------------------------------------
inline
G4ThreeVector G4VSurface::ComputeLocalPoint(const G4ThreeVector &gp) const
G4ThreeVector G4VTwistSurface::ComputeLocalPoint(const G4ThreeVector &gp) const
{
return fRot.inverse() * G4ThreeVector(gp) - fTrans;
return fRot.inverse() * ( G4ThreeVector(gp) - fTrans ) ;
}
//=====================================================================
//* ComputeGlobalDirection --------------------------------------------
inline
G4ThreeVector G4VSurface::ComputeGlobalDirection(const G4ThreeVector &lp) const
G4ThreeVector G4VTwistSurface::ComputeGlobalDirection(const G4ThreeVector &lp) const
{
return fRot * G4ThreeVector(lp);
}
@@ -289,7 +289,7 @@ G4ThreeVector G4VSurface::ComputeGlobalDirection(const G4ThreeVector &lp) const
//* ComputeLocalDirection ---------------------------------------------
inline
G4ThreeVector G4VSurface::ComputeLocalDirection(const G4ThreeVector &gp) const
G4ThreeVector G4VTwistSurface::ComputeLocalDirection(const G4ThreeVector &gp) const
{
return fRot.inverse() * G4ThreeVector(gp);
}
@@ -298,8 +298,8 @@ G4ThreeVector G4VSurface::ComputeLocalDirection(const G4ThreeVector &gp) const
//* SetNeighbours -----------------------------------------------------
inline
void G4VSurface::SetNeighbours(G4VSurface* axis0min, G4VSurface* axis1min,
G4VSurface* axis0max, G4VSurface* axis1max)
void G4VTwistSurface::SetNeighbours(G4VTwistSurface* axis0min, G4VTwistSurface* axis1min,
G4VTwistSurface* axis0max, G4VTwistSurface* axis1max)
{
fNeighbours[0] = axis0min;
fNeighbours[1] = axis1min;
@@ -311,7 +311,7 @@ void G4VSurface::SetNeighbours(G4VSurface* axis0min, G4VSurface* axis1min,
//* GetNeighbours -----------------------------------------------------
inline
G4int G4VSurface::GetNeighbours(G4int areacode, G4VSurface** surfaces)
G4int G4VTwistSurface::GetNeighbours(G4int areacode, G4VTwistSurface** surfaces)
{
int sAxis0Min = sAxis0 & sAxisMin ;
@@ -351,12 +351,12 @@ G4int G4VSurface::GetNeighbours(G4int areacode, G4VSurface** surfaces)
//* GetCorner ---------------------------------------------------------
inline
G4ThreeVector G4VSurface::GetCorner(G4int areacode) const
G4ThreeVector G4VTwistSurface::GetCorner(G4int areacode) const
{
if (!(areacode & sCorner)){
G4cerr << "ERROR - G4VSurface::GetCorner()" << G4endl
G4cerr << "ERROR - G4VTwistSurface::GetCorner()" << G4endl
<< " areacode = " << areacode << G4endl;
G4Exception("G4VSurface::GetCorner()","InvalidSetup",
G4Exception("G4VTwistSurface::GetCorner()","InvalidSetup",
FatalException, "Area code must represent corner.");
}
@@ -369,9 +369,9 @@ G4ThreeVector G4VSurface::GetCorner(G4int areacode) const
} else if ((areacode & sC0Min1Max) == sC0Min1Max) {
return fCorners[3];
} else {
G4cerr << "ERROR - G4VSurface::GetCorner()" << G4endl
G4cerr << "ERROR - G4VTwistSurface::GetCorner()" << G4endl
<< " areacode = " << areacode << G4endl;
G4Exception("G4VSurface::GetCorner()", "NotSupported",
G4Exception("G4VTwistSurface::GetCorner()", "NotSupported",
FatalException, "Configuration not supported.");
}
return fCorners[0];
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VTwistedFaceted.hh,v 1.3 2005/04/04 11:56:59 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
// $Id: G4VTwistedFaceted.hh,v 1.8 2005/12/06 09:22:13 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// --------------------------------------------------------------------
// GEANT 4 class header file
@@ -35,7 +35,9 @@
// G4VTwistedFaceted is an abstract base class for twisted boxoids:
// G4TwistedTrd, G4TwistedTrap and G4TwistedBox
// Author: O.Link (Oliver.Link@cern.ch)
// Author:
//
// 27-Oct-2004 - O.Link (Oliver.Link@cern.ch)
//
// --------------------------------------------------------------------
@@ -43,10 +45,10 @@
#define __G4VTWISTEDFACETED__
#include "G4VSolid.hh"
#include "G4TwistedTrapAlphaSide.hh"
#include "G4TwistedTrapParallelSide.hh"
#include "G4TwistedTrapBoxSide.hh"
#include "G4FlatTrapSide.hh"
#include "G4TwistTrapAlphaSide.hh"
#include "G4TwistTrapParallelSide.hh"
#include "G4TwistBoxSide.hh"
#include "G4TwistTrapFlatSide.hh"
class G4SolidExtentList;
class G4ClippablePolygon;
@@ -98,10 +100,13 @@ class G4VTwistedFaceted: public G4VSolid
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const;
G4ThreeVector GetPointOnSurface() const;
G4ThreeVector GetPointInSolid(G4double z) const;
virtual inline G4double GetCubicVolume() ;
virtual void DescribeYourselfTo (G4VGraphicsScene &scene) const;
virtual G4Polyhedron *CreatePolyhedron () const = 0 ;
virtual G4Polyhedron *CreatePolyhedron () const ;
virtual G4NURBS *CreateNURBS () const;
virtual G4Polyhedron *GetPolyhedron () const;
@@ -132,6 +137,13 @@ class G4VTwistedFaceted: public G4VSolid
virtual G4VisExtent GetExtent () const;
virtual G4GeometryType GetEntityType() const;
public: // without description
G4VTwistedFaceted(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
protected: // with description
G4ThreeVectorList*
@@ -171,13 +183,13 @@ class G4VTwistedFaceted: public G4VSolid
G4double fAngleSide;
G4VSurface *fLowerEndcap ; // surface of -ve z
G4VSurface *fUpperEndcap ; // surface of +ve z
G4VTwistSurface *fLowerEndcap ; // surface of -ve z
G4VTwistSurface *fUpperEndcap ; // surface of +ve z
G4VSurface *fSide0 ; // Twisted Side at phi = 0 deg
G4VSurface *fSide90 ; // Twisted Side at phi = 90 deg
G4VSurface *fSide180 ; // Twisted Side at phi = 180 deg
G4VSurface *fSide270 ; // Twisted Side at phi = 270 deg
G4VTwistSurface *fSide0 ; // Twisted Side at phi = 0 deg
G4VTwistSurface *fSide90 ; // Twisted Side at phi = 90 deg
G4VTwistSurface *fSide180 ; // Twisted Side at phi = 180 deg
G4VTwistSurface *fSide270 ; // Twisted Side at phi = 270 deg
G4double fCubicVolume ; // volume of the twisted trapezoid
@@ -204,7 +216,7 @@ class G4VTwistedFaceted: public G4VSolid
{
p.set(kInfinity,kInfinity,kInfinity);
vec.set(kInfinity,kInfinity,kInfinity);
surface = new G4VSurface*[1];
surface = new G4VTwistSurface*[1];
}
~LastVector()
{
@@ -213,7 +225,7 @@ class G4VTwistedFaceted: public G4VSolid
public:
G4ThreeVector p;
G4ThreeVector vec;
G4VSurface **surface;
G4VTwistSurface **surface;
};
class LastValue // last G4double value
@@ -290,7 +302,7 @@ inline
G4double G4VTwistedFaceted::Xcoef(G4double u, G4double phi, G4double ftg) const
{
return GetValueA(phi)/2. + (GetValueD(phi)-GetValueA(phi))/4.
- u*( ( GetValueD(phi)-GetValueA(phi) ) / ( 2 * GetValueB(phi) ) + ftg );
- u*( ( GetValueD(phi)-GetValueA(phi) ) / ( 2 * GetValueB(phi) ) - ftg );
}
#endif