Import Geant4 7.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 11:11:55 +02:00
parent e083ffb441
commit 516dbf1a58
5914 changed files with 202605 additions and 71141 deletions
@@ -0,0 +1,67 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
//
// G4ApproxPolySolver
//
// Class description:
//
// Polynomial solver for equations of the type:
// c0 + c1 x + c2 x^2 + c3 x^3 + c4 x^4
// Author:
// Oliver Link (Oliver.Link@cern.ch)
//
// --------------------------------------------------------------------
#ifndef __G4APPROXPOLYSOLVER__
#define __G4APPROXPOLYSOLVER__
#include "G4Types.hh"
#include "G4String.hh"
#include "geomdefs.hh"
class G4ApproxPolySolver
{
// c0 + c1 x + c2 x^2 + c3 x^3 + c4 x^4
public:
G4ApproxPolySolver(){}
~G4ApproxPolySolver(){}
public:
G4int SolveBiQuadratic( G4double c[], G4double s[] ) const ;
G4int SolveCubic( G4double c[], G4double s[] ) const ;
G4int SolveBiQuadraticNew( G4double c[], G4double s[] ) const ;
G4int SolveCubicNew( G4double c[], G4double s[],
G4double& cubic_discr ) const ;
G4int SolveQuadratic( G4double c[], G4double s[] ) const ;
};
#endif
@@ -22,7 +22,7 @@
//
//
// $Id: G4ClippablePolygon.hh,v 1.9 2003/11/03 18:39:54 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// --------------------------------------------------------------------
@@ -22,7 +22,7 @@
//
//
// $Id: G4ClippablePolygon.icc,v 1.3 2001/07/11 10:00:14 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4EllipticalTube.hh,v 1.11 2003/06/16 16:53:51 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4EllipticalTube.hh,v 1.13 2004/10/10 10:39:11 johna Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// --------------------------------------------------------------------
// GEANT 4 class header file
@@ -54,67 +54,76 @@ class G4EllipticalTube : public G4VSolid
{
public: // with description
G4EllipticalTube( const G4String &name,
G4double theDx,
G4double theDy,
G4double theDz );
G4EllipticalTube( const G4String &name,
G4double theDx,
G4double theDy,
G4double theDz );
virtual ~G4EllipticalTube();
// Standard solid methods
virtual ~G4EllipticalTube();
virtual G4bool CalculateExtent( const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pmin, G4double& pmax ) const;
// Standard solid methods
G4bool CalculateExtent( const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pmin, G4double& pmax ) const;
virtual EInside Inside( const G4ThreeVector& p ) const;
EInside Inside( const G4ThreeVector& p ) const;
virtual G4ThreeVector SurfaceNormal( const G4ThreeVector& p ) const;
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;
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;
G4GeometryType GetEntityType() const;
G4GeometryType GetEntityType() const;
std::ostream& StreamInfo(std::ostream& os) const;
std::ostream& StreamInfo(std::ostream& os) const;
// Visualisation methods
G4double GetCubicVolume();
virtual G4Polyhedron* CreatePolyhedron() const;
virtual void DescribeYourselfTo( G4VGraphicsScene& scene ) const;
virtual G4VisExtent GetExtent() const;
// Visualisation methods
// Accessors
G4Polyhedron* CreatePolyhedron() const;
void DescribeYourselfTo( G4VGraphicsScene& scene ) const;
G4VisExtent GetExtent() const;
virtual G4Polyhedron* GetPolyhedron () const;
inline G4double GetDx() const;
inline G4double GetDy() const;
inline G4double GetDz() const;
inline void SetDx( const G4double newDx );
inline void SetDy( const G4double newDy );
inline void SetDz( const G4double newDz );
// Accessors
inline G4double GetDx() const;
inline G4double GetDy() const;
inline G4double GetDz() const;
inline void SetDx( const G4double newDx );
inline void SetDy( const G4double newDy );
inline void SetDz( const G4double newDz );
protected: // without description
G4double dx, dy, dz;
G4double dx, dy, dz;
// Utility
// Utility
inline G4double CheckXY( const G4double x,
const G4double y,
const G4double toler ) const;
inline G4double CheckXY( const G4double x, const G4double y ) const;
inline G4double CheckXY( const G4double x,
const G4double y,
const G4double toler ) const;
inline G4double CheckXY( const G4double x, const G4double y ) const;
G4int IntersectXY( const G4ThreeVector &p,
const G4ThreeVector &v, G4double s[2] ) const;
private:
G4double fCubicVolume;
mutable G4Polyhedron* fpPolyhedron;
G4int IntersectXY( const G4ThreeVector &p,
const G4ThreeVector &v, G4double s[2] ) const;
};
#include "G4EllipticalTube.icc"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4EllipticalTube.icc,v 1.1 2002/10/28 11:47:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4EllipticalTube.icc,v 1.3 2004/10/10 10:39:16 johna Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
@@ -54,18 +54,24 @@ inline
void G4EllipticalTube::SetDx( const G4double newDx )
{
dx = newDx;
fCubicVolume = 0.;
fpPolyhedron = 0;
}
inline
void G4EllipticalTube::SetDy( const G4double newDy )
{
dy = newDy;
fCubicVolume = 0.;
fpPolyhedron = 0;
}
inline
void G4EllipticalTube::SetDz( const G4double newDz )
{
dz = newDz;
fCubicVolume = 0.;
fpPolyhedron = 0;
}
inline
@@ -22,7 +22,7 @@
//
//
// $Id: G4EnclosingCylinder.hh,v 1.6 2003/11/03 18:39:54 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// --------------------------------------------------------------------
@@ -0,0 +1,94 @@
//
// ********************************************************************
// * 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: G4FlatBoxSide.hh,v 1.2 2004/11/13 18:26:24 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
//
// G4FlatSurface
//
// Class description:
//
// Class describing a flat boundary surface for a box.
// Author:
//
// 27-Oct-2004 - O.Link (Oliver.Link@cern.ch)
//
// --------------------------------------------------------------------
#ifndef __G4FLATBOXSIDE__
#define __G4FLATBOXSIDE__
#include "G4VSurface.hh"
class G4FlatBoxSide : public G4VSurface
{
public: // with description
G4FlatBoxSide( const G4String& name,
G4double PhiTwist,
G4double pDx,
G4double pDy,
G4double pDz,
G4int handedness );
virtual ~G4FlatBoxSide();
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[]);
protected: // with description
virtual G4int GetAreaCode(const G4ThreeVector &xx,
G4bool withTol = true) ;
private:
virtual void SetCorners();
virtual void SetBoundaries();
private:
G4double fDx ;
G4double fDy ;
G4double fDz ;
G4double fPhiTwist ;
};
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4FlatSurface.hh,v 1.4 2004/05/24 12:09:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// $Id: G4FlatSurface.hh,v 1.6 2004/11/13 18:26:24 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// --------------------------------------------------------------------
@@ -33,7 +33,7 @@
//
// Class description:
//
// Class describing a flat boundary surface for G4VSolid.
// Class describing a flat boundary surface for a cylinder.
// Author:
// 01-Aug-2002 - Kotoyo Hoshina (hoshina@hepburn.s.chiba-u.ac.jp)
@@ -47,8 +47,6 @@
#include "G4VSurface.hh"
// class G4TwistedTubs;
class G4FlatSurface : public G4VSurface
{
public: // with description
@@ -0,0 +1,95 @@
//
// ********************************************************************
// * 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: G4FlatTrapSide.hh,v 1.3 2004/11/13 18:26:24 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
//
// G4FlatTrapSurface
//
// Class description:
//
// Class describing a flat boundary surface for a trapezoid.
// Author:
//
// 27-Oct-2004 - O.Link (Oliver.Link@cern.ch)
//
// --------------------------------------------------------------------
#ifndef __G4FLATTRAPSIDE__
#define __G4FLATTRAPSIDE__
#include "G4VSurface.hh"
class G4FlatTrapSide : public G4VSurface
{
public: // with description
G4FlatTrapSide( const G4String& name,
G4double PhiTwist,
G4double pDx1,
G4double pDx2,
G4double pDy,
G4double pDz,
G4int handedness );
virtual ~G4FlatTrapSide();
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[]);
protected: // with description
virtual G4int GetAreaCode(const G4ThreeVector &xx,
G4bool withTol = true) ;
private:
virtual void SetCorners();
virtual void SetBoundaries();
private:
G4double fDx1 ;
G4double fDx2 ;
G4double fDy ;
G4double fDz ;
G4double fPhiTwist ;
};
#endif
@@ -21,9 +21,9 @@
// ********************************************************************
//
//
// $Id: G4Hype.hh,v 1.7 2003/06/16 16:53:52 gunter Exp $
// $Id: G4Hype.hh,v 1.9 2004/10/10 10:39:19 johna Exp $
// $Original: G4Hype.hh,v 1.0 1998/06/09 16:57:50 safai Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// --------------------------------------------------------------------
@@ -140,10 +140,13 @@ class G4Hype : public G4VSolid
std::ostream& StreamInfo(std::ostream& os) const;
G4double GetCubicVolume();
void DescribeYourselfTo (G4VGraphicsScene& scene) const;
G4VisExtent GetExtent () const;
G4Polyhedron* CreatePolyhedron () const;
G4NURBS* CreateNURBS () const;
G4Polyhedron* GetPolyhedron () const;
protected: // without description
@@ -196,6 +199,12 @@ class G4Hype : public G4VSolid
// Used by distanceToOut
enum ESide {outerFace,innerFace,leftCap, rightCap};
private:
G4double fCubicVolume;
mutable G4Polyhedron* fpPolyhedron;
};
#include "G4Hype.icc"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Hype.icc,v 1.3 2002/10/28 11:47:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4Hype.icc,v 1.6 2004/12/02 09:31:30 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
@@ -68,7 +68,9 @@ void G4Hype::SetInnerRadius (G4double newIRad)
innerRadius= newIRad;
innerRadius2= newIRad*newIRad;
endInnerRadius2=HypeInnerRadius2(halfLenZ);
endInnerRadius=sqrt(endInnerRadius2);
endInnerRadius=std::sqrt(endInnerRadius2);
fCubicVolume = 0.;
fpPolyhedron = 0;
}
inline
@@ -77,33 +79,41 @@ void G4Hype::SetOuterRadius (G4double newORad)
outerRadius= newORad;
outerRadius2=newORad*newORad;
endOuterRadius2=HypeOuterRadius2(halfLenZ);
endOuterRadius=sqrt(endOuterRadius2);
endOuterRadius=std::sqrt(endOuterRadius2);
fCubicVolume = 0.;
fpPolyhedron = 0;
}
inline
void G4Hype::SetZHalfLength (G4double newHLZ)
{
halfLenZ = newHLZ ;
fCubicVolume = 0.;
fpPolyhedron = 0;
}
inline
void G4Hype::SetInnerStereo (G4double newISte)
{
innerStereo= fabs(newISte);
tanInnerStereo=tan(innerStereo);
innerStereo= std::fabs(newISte);
tanInnerStereo=std::tan(innerStereo);
tanInnerStereo2=tanInnerStereo*tanInnerStereo;
endInnerRadius2=HypeInnerRadius2(halfLenZ);
endInnerRadius=sqrt(endInnerRadius2);
endInnerRadius=std::sqrt(endInnerRadius2);
fCubicVolume = 0.;
fpPolyhedron = 0;
}
inline
void G4Hype::SetOuterStereo (G4double newOSte)
{
outerStereo= fabs(newOSte);
tanOuterStereo=tan(outerStereo);
outerStereo= std::fabs(newOSte);
tanOuterStereo=std::tan(outerStereo);
tanOuterStereo2=tanOuterStereo*tanOuterStereo;
endOuterRadius2=HypeOuterRadius2(halfLenZ);
endOuterRadius=sqrt(endOuterRadius2);
endOuterRadius=std::sqrt(endOuterRadius2);
fCubicVolume = 0.;
fpPolyhedron = 0;
}
inline
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4HyperbolicSurface.hh,v 1.4 2004/05/24 12:09:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// $Id: G4HyperbolicSurface.hh,v 1.7 2004/12/02 09:31:30 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
//
// --------------------------------------------------------------------
@@ -33,7 +33,7 @@
//
// Class description:
//
// Class describing a hyperbolic boundary surface for G4VSolid.
// Class describing a hyperbolic boundary surface for a cylinder.
// Author:
// 01-Aug-2002 - Kotoyo Hoshina (hoshina@hepburn.s.chiba-u.ac.jp)
@@ -55,8 +55,8 @@ class G4HyperbolicSurface : public G4VSurface
const G4RotationMatrix &rot, // 0.5*(phi-width segment)
const G4ThreeVector &tlate,
const G4int handedness,// R-hand = 1, L-hand = -1
const G4double kappa, // tan(TwistAngle/2)/fZHalfLen
const G4double tanstereo, // tan(stereo angle)
const G4double kappa, // std::tan(TwistAngle/2)/fZHalfLen
const G4double tanstereo, // std::tan(stereo angle)
const G4double r0, // radius at z = 0
const EAxis axis0 = kPhi,
const EAxis axis1 = kZAxis,
@@ -117,9 +117,9 @@ class G4HyperbolicSurface : public G4VSurface
private:
G4double fKappa; // tan(TwistedAngle/2)/HalfLenZ;
G4double fTanStereo; // tan(StereoAngle)
G4double fTan2Stereo; // tan(StereoAngle)**2
G4double fKappa; // std::tan(TwistedAngle/2)/HalfLenZ;
G4double fTanStereo; // std::tan(StereoAngle)
G4double fTan2Stereo; // std::tan(StereoAngle)**2
G4double fR0; // radius at z = 0
G4double fR02; // radius**2 at z = 0
class Insidetype
@@ -146,7 +146,7 @@ G4double G4HyperbolicSurface::GetRhoAtPZ(const G4ThreeVector &p,
} else {
tmpp = p;
}
return sqrt(fR02 + tmpp.z() * tmpp.z() * fTan2Stereo);
return std::sqrt(fR02 + tmpp.z() * tmpp.z() * fTan2Stereo);
}
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4IntersectingCone.hh,v 1.6 2003/11/03 18:39:54 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4IntersectingCone.hh,v 1.7 2004/12/02 09:31:30 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
//
// --------------------------------------------------------------------
@@ -69,7 +69,7 @@ class G4IntersectingCone
G4double zLo, zHi, // Z bounds of side
rLo, rHi; // R bounds of side
G4bool type1; // True if cone is type 1 (abs(z1-z2)>abs(r1-r2))
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
@@ -22,7 +22,7 @@
//
//
// $Id: G4PolyPhiFace.hh,v 1.5 2002/10/28 11:47:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// --------------------------------------------------------------------
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PolyPhiFace.icc,v 1.4 2002/10/28 11:47:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4PolyPhiFace.icc,v 1.5 2004/12/02 09:31:30 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
//
// --------------------------------------------------------------------
@@ -59,7 +59,7 @@ G4double G4PolyPhiFace::ExactZOrder( G4double z,
const G4PolyPhiFaceVertex *vert ) const
{
G4double answer = vert->z - z;
if (fabs(answer) < kCarTolerance)
if (std::fabs(answer) < kCarTolerance)
{
G4ThreeVector qa( qx - vert->x + radial.x(),
qy - vert->y + radial.y(), qz - vert->z ),
@@ -22,7 +22,7 @@
//
//
// $Id: G4Polycone.hh,v 1.12 2003/11/05 17:41:24 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// --------------------------------------------------------------------
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Polycone.icc,v 1.4 2003/11/05 17:41:24 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4Polycone.icc,v 1.6 2004/10/10 10:39:27 johna Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
@@ -74,4 +74,6 @@ void G4Polycone::SetOriginalParameters(G4PolyconeHistorical* pars)
G4Exception("G4Polycone::SetOriginalParameters()", "InvalidSetup",
FatalException, "NULL pointer to parameters!");
*original_parameters = *pars;
fCubicVolume = 0.;
fpPolyhedron = 0;
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4PolyconeSide.hh,v 1.5 2002/10/28 11:47:50 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// --------------------------------------------------------------------
@@ -22,7 +22,7 @@
//
//
// $Id: G4Polyhedra.hh,v 1.11 2003/11/05 17:41:24 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// --------------------------------------------------------------------
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Polyhedra.icc,v 1.4 2003/11/05 17:41:24 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4Polyhedra.icc,v 1.6 2004/10/10 10:39:32 johna Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
@@ -81,4 +81,6 @@ void G4Polyhedra::SetOriginalParameters(G4PolyhedraHistorical* pars)
G4Exception("G4Polyhedra::SetOriginalParameters()", "InvalidSetup",
FatalException, "NULL pointer to parameters!");
*original_parameters = *pars;
fCubicVolume = 0.;
fpPolyhedron = 0;
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4PolyhedraSide.hh,v 1.5 2002/10/28 11:47:51 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// --------------------------------------------------------------------
@@ -22,7 +22,7 @@
//
//
// $Id: G4ReduciblePolygon.hh,v 1.6 2003/11/03 18:39:55 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// --------------------------------------------------------------------
@@ -22,7 +22,7 @@
//
//
// $Id: G4SolidExtentList.hh,v 1.6 2003/11/03 18:39:55 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// --------------------------------------------------------------------
@@ -0,0 +1,243 @@
//
// ********************************************************************
// * 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: G4TwistedBox.hh,v 1.3 2004/11/13 18:26:24 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
//
// G4TwistedBox
//
// Class description:
//
// G4TwistedBox is a box twisted along the Z axis.
// Author:
// O.Link (Oliver.Link@cern.ch)
//
// --------------------------------------------------------------------
#ifndef __G4TWISTEDBOX__
#define __G4TWISTEDBOX__
#include "G4VSolid.hh"
#include "G4TwistedBoxSide.hh"
#include "G4FlatBoxSide.hh"
class G4SolidExtentList;
class G4ClippablePolygon;
class G4TwistedBox : public G4VSolid
{
public: // with description
G4TwistedBox(const G4String &pname, // Name of instance
G4double twistedangle, // Twisted angle
G4double pDx, // half length in x
G4double pDy, // half length in y
G4double pDz) ; // half z length
virtual ~G4TwistedBox();
void ComputeDimensions(G4VPVParameterisation* ,
const G4int ,
const G4VPhysicalVolume* );
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits &pVoxelLimit,
const G4AffineTransform &pTransform,
G4double &pMin,
G4double &pMax ) 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;
EInside Inside (const G4ThreeVector &p) const;
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const;
inline G4double GetCubicVolume() ;
void DescribeYourselfTo (G4VGraphicsScene &scene) const;
G4Polyhedron *CreatePolyhedron () const;
G4NURBS *CreateNURBS () const;
std::ostream &StreamInfo(std::ostream& os) const;
// accessors
inline G4double GetPhiTwist () const { return fPhiTwist ; }
inline G4double GetfDx () const { return fDx ; }
inline G4double GetfDy () const { return fDy ; }
inline G4double GetfDz () const { return fDz ; }
G4VisExtent GetExtent () const;
G4GeometryType GetEntityType() const;
protected: // with description
G4ThreeVectorList*
CreateRotatedVertices(const G4AffineTransform& pTransform) const;
// Create the List of transformed vertices in the format required
// for G4VSolid:: ClipCrossSection and ClipBetweenSections.
public: // without description
private:
inline void SetFields(G4double phitwist,
G4double pDx, G4double pDy, G4double pDz);
void CreateSurfaces();
private:
G4double fPhiTwist; // Twist angle from -fDz to +fDz
G4double fDx ;
G4double fDy ;
G4double fDz ;
G4VSurface *fLowerEndcap ; // surface of -ve z
G4VSurface *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
G4double fCubicVolume ; // volume of the twisted trapezoid
class LastState // last Inside result
{
public:
LastState()
{
p.set(kInfinity,kInfinity,kInfinity);
inside = kOutside;
}
~LastState(){}
public:
G4ThreeVector p;
EInside inside;
};
class LastVector // last SurfaceNormal result
{
public:
LastVector()
{
p.set(kInfinity,kInfinity,kInfinity);
vec.set(kInfinity,kInfinity,kInfinity);
surface = new G4VSurface*[1];
}
~LastVector()
{
delete [] surface;
}
public:
G4ThreeVector p;
G4ThreeVector vec;
G4VSurface **surface;
};
class LastValue // last G4double value
{
public:
LastValue()
{
p.set(kInfinity,kInfinity,kInfinity);
value = DBL_MAX;
}
~LastValue(){}
public:
G4ThreeVector p;
G4double value;
};
class LastValueWithDoubleVector // last G4double value
{
public:
LastValueWithDoubleVector()
{
p.set(kInfinity,kInfinity,kInfinity);
vec.set(kInfinity,kInfinity,kInfinity);
value = DBL_MAX;
}
~LastValueWithDoubleVector(){}
public:
G4ThreeVector p;
G4ThreeVector vec;
G4double value;
};
LastState fLastInside;
LastVector fLastNormal;
LastValue fLastDistanceToIn;
LastValue fLastDistanceToOut;
LastValueWithDoubleVector fLastDistanceToInWithV;
LastValueWithDoubleVector fLastDistanceToOutWithV;
};
//=====================================================================
//---------------------
// inline functions
//---------------------
inline
void G4TwistedBox::SetFields(G4double phitwist, G4double pDx, G4double pDy, G4double pDz)
{
fPhiTwist = phitwist;
fDx = pDx ;
fDy = pDy ;
fDz = pDz ;
}
inline
G4double G4TwistedBox::GetCubicVolume()
{
if(fCubicVolume != 0.) ;
else fCubicVolume = 8*fDx*fDy*fDz;
return fCubicVolume;
}
#endif
@@ -0,0 +1,129 @@
//
// ********************************************************************
// * 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: G4TwistedBoxSide.hh,v 1.4 2004/12/08 10:20:33 link Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
//
// G4TwistedTrapSide
//
// Class description:
//
// Class describing a twisted boundary surface for a box.
// Author:
//
// Oliver Link (Oliver.Link@cern.ch)
//
// --------------------------------------------------------------------
#ifndef __G4TWISTEDBOXSIDE__
#define __G4TWISTEDBOXSIDE__
#include "G4VSurface.hh"
#include <vector>
class G4TwistedBoxSide : public G4VSurface
{
public: // with description
G4TwistedBoxSide(const G4String &name,
G4double PhiTwist,
G4double fDx,
G4double fDy,
G4double fDz,
G4double AngleSide);
virtual ~G4TwistedBoxSide();
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 );
private:
G4double fDx ;
G4double fDy ;
G4double fDz ;
G4double fPhiTwist ;
G4double fAngleSide ;
};
//========================================================
// inline functions
//========================================================
inline
G4ThreeVector G4TwistedBoxSide::SurfacePoint( G4double phi, G4double u )
{
// function to calculate a point on the surface, given by parameters phi,u
G4ThreeVector SurfPoint ( fDx * std::cos(phi) - u * std::sin(phi),
fDx * std::sin(phi) + u * std::cos(phi),
2*fDz*phi/fPhiTwist );
return SurfPoint ;
}
inline
G4ThreeVector G4TwistedBoxSide::NormAng( G4double phi, G4double u )
{
// function to calculate the norm at a given point on the surface
G4double L = 2*fDz ;
G4ThreeVector nvec( L*std::cos(phi), L*std::sin(phi), fPhiTwist*u);
return nvec.unit() ;
}
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4TwistedSurface.hh,v 1.4 2004/05/24 12:09:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// $Id: G4TwistedSurface.hh,v 1.7 2004/12/02 09:31:31 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
//
// --------------------------------------------------------------------
@@ -33,7 +33,7 @@
//
// Class description:
//
// Class describing a twisted boundary surface for G4VSolid.
// Class describing a twisted boundary surface for a cylinder.
// Author:
// 01-Aug-2002 - Kotoyo Hoshina (hoshina@hepburn.s.chiba-u.ac.jp)
@@ -55,7 +55,7 @@ class G4TwistedSurface : public G4VSurface
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 G4double kappa, // std::tan(TwistAngle/2)/fZHalfLen
const EAxis axis0 = kXAxis,
const EAxis axis1 = kZAxis,
G4double axis0min = -kInfinity,
@@ -120,7 +120,7 @@ class G4TwistedSurface : public G4VSurface
private:
G4double fKappa; // tan(TwistedAngle/2)/HalfLenZ;
G4double fKappa; // std::tan(TwistedAngle/2)/HalfLenZ;
};
@@ -0,0 +1,252 @@
//
// ********************************************************************
// * 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: G4TwistedTrap.hh,v 1.3 2004/11/13 18:26:24 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
//
// G4TwistedTrap
//
// Class description:
//
// G4TwistedTrap is a trapezoid defined with caps of the sames shape
// and size, an twisted along the Z axis.
// Author:
// O.Link (Oliver.Link@cern.ch)
//
// --------------------------------------------------------------------
#ifndef __G4TWISTEDTRAP__
#define __G4TWISTEDTRAP__
#include "G4VSolid.hh"
#include "G4TwistedTrapSide.hh"
#include "G4TwistedBoxSide.hh"
#include "G4FlatTrapSide.hh"
class G4SolidExtentList;
class G4ClippablePolygon;
class G4TwistedTrap: public G4VSolid
{
public: // with description
G4TwistedTrap(const G4String &pname, // Name of instance
G4double twistedangle, // Twisted angle
G4double pDx1, // half length in x at y=-pDy
G4double pDx2, // half length in x at y=+pDy
G4double pDy, // half length in y
G4double pDz) ; // half z length
virtual ~G4TwistedTrap();
void ComputeDimensions(G4VPVParameterisation* ,
const G4int ,
const G4VPhysicalVolume* );
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits &pVoxelLimit,
const G4AffineTransform &pTransform,
G4double &pMin,
G4double &pMax ) 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;
EInside Inside (const G4ThreeVector &p) const;
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const;
inline G4double GetCubicVolume() ;
void DescribeYourselfTo (G4VGraphicsScene &scene) const;
G4Polyhedron *CreatePolyhedron () const;
G4NURBS *CreateNURBS () const;
std::ostream &StreamInfo(std::ostream& os) const;
// accessors
inline G4double GetPhiTwist () const { return fPhiTwist ; }
inline G4double GetDx1 () const { return fDx1 ; }
inline G4double GetDx2 () const { return fDx2 ; }
inline G4double GetDy () const { return fDy ; }
inline G4double GetDz () const { return fDz; }
G4VisExtent GetExtent () const;
G4GeometryType GetEntityType() const;
protected: // with description
G4ThreeVectorList*
CreateRotatedVertices(const G4AffineTransform& pTransform) const;
// Create the List of transformed vertices in the format required
// for G4VSolid:: ClipCrossSection and ClipBetweenSections.
public: // without description
private:
inline void SetFields(G4double phitwist, G4double pDx1, G4double pDx2, G4double pDy, G4double pDz);
void CreateSurfaces();
private:
G4double fPhiTwist; // Twist angle from -fZHalfLength to fZHalfLength
G4double fDx ; // temp
G4double fDx1; // Half-length along x of the side at y=-fDy1 (d in surface equation)
G4double fDx2; // Half-length along x of the side at y=+fDy1 (a in surface equation)
G4double fDy; // Half-length along y of the face (b in surface equation)
G4double fDz ; // Half-length along the z axis (L in surface equation)
G4VSurface *fLowerEndcap ; // surface of -ve z
G4VSurface *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
G4double fCubicVolume ; // volume of the twisted trapezoid
class LastState // last Inside result
{
public:
LastState()
{
p.set(kInfinity,kInfinity,kInfinity);
inside = kOutside;
}
~LastState(){}
public:
G4ThreeVector p;
EInside inside;
};
class LastVector // last SurfaceNormal result
{
public:
LastVector()
{
p.set(kInfinity,kInfinity,kInfinity);
vec.set(kInfinity,kInfinity,kInfinity);
surface = new G4VSurface*[1];
}
~LastVector()
{
delete [] surface;
}
public:
G4ThreeVector p;
G4ThreeVector vec;
G4VSurface **surface;
};
class LastValue // last G4double value
{
public:
LastValue()
{
p.set(kInfinity,kInfinity,kInfinity);
value = DBL_MAX;
}
~LastValue(){}
public:
G4ThreeVector p;
G4double value;
};
class LastValueWithDoubleVector // last G4double value
{
public:
LastValueWithDoubleVector()
{
p.set(kInfinity,kInfinity,kInfinity);
vec.set(kInfinity,kInfinity,kInfinity);
value = DBL_MAX;
}
~LastValueWithDoubleVector(){}
public:
G4ThreeVector p;
G4ThreeVector vec;
G4double value;
};
LastState fLastInside;
LastVector fLastNormal;
LastValue fLastDistanceToIn;
LastValue fLastDistanceToOut;
LastValueWithDoubleVector fLastDistanceToInWithV;
LastValueWithDoubleVector fLastDistanceToOutWithV;
};
//=====================================================================
//---------------------
// inline functions
//---------------------
inline
void G4TwistedTrap::SetFields(G4double phitwist,
G4double pDx1, G4double pDx2, G4double pDy , G4double pDz)
{
fPhiTwist = phitwist;
fDx1 = pDx1 ;
fDx2 = pDx2 ;
fDy = pDy ;
fDz = pDz ;
}
inline
G4double G4TwistedTrap::GetCubicVolume()
{
if(fCubicVolume != 0.) ;
else fCubicVolume = 8 * ( fDx1 + fDx2 ) / 2 * fDy * fDz ;
return fCubicVolume;
}
#endif
@@ -0,0 +1,162 @@
//
// ********************************************************************
// * 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: G4TwistedTrapSide.hh,v 1.7 2004/12/08 10:20:34 link Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
//
// G4TwistedTrapSide
//
// Class description:
//
// Class describing a twisted boundary surface for a trapezoid.
// Author:
//
// Oliver Link (Oliver.Link@cern.ch)
//
// --------------------------------------------------------------------
#ifndef __G4TWISTEDTRAPSIDE__
#define __G4TWISTEDTRAPSIDE__
#include "G4VSurface.hh"
#include <vector>
class G4TwistedTrapSide : public G4VSurface
{
public: // with description
G4TwistedTrapSide(const G4String &name,
G4double PhiTwist,
G4double pDx1,
G4double pDx2,
G4double pDy,
G4double pDz,
G4double AngleSide);
virtual ~G4TwistedTrapSide();
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); // to calculate the w(u) function
private:
G4double fDx1; // Half-length along x of the side at y=-fDy1
// (d in surface equation)
G4double fDx2; // Half-length along x of the side at y=+fDy1
// (a in surface equation)
G4double fDy; // Half-length along y of the face
// (b in surface equation)
G4double fDz; // Half-length along the z axis
// (L in surface equation)
G4double fPhiTwist; // twist angle ( dphi in surface equation)
G4double fAngleSide;
};
//========================================================
// inline functions
//========================================================
inline
G4double G4TwistedTrapSide::Xcoef(G4double u)
{
// attention a = 2 fDx1
// d = 2 fDx2
// b = 2 fDy
// L = 2 fDz
return fDx2 + ( fDx1-fDx2)/2 - u * (fDx1-fDx2)/(2*fDy) ;
}
inline
G4ThreeVector G4TwistedTrapSide::SurfacePoint( G4double phi, G4double u )
{
// function to calculate a point on the surface, given by parameters phi,u
G4ThreeVector SurfPoint ( Xcoef(u) * std::cos(phi) - u * std::sin(phi),
Xcoef(u) * std::sin(phi) + u * std::cos(phi),
2*fDz*phi/fPhiTwist );
return SurfPoint ;
}
inline
G4ThreeVector G4TwistedTrapSide::NormAng( G4double phi, G4double u )
{
// function to calculate the norm at a given point on the surface
G4double L = 2*fDz ;
G4double a = 2*fDx2 ;
G4double d = 2*fDx1 ;
G4double b = 2*fDy ;
G4double dphi = fPhiTwist ;
G4double b2 = b*b ;
G4double d2 = d*d ;
G4double a2 = a*a ;
G4ThreeVector nvec( ( L * (2*b*std::cos(phi) + (a-d)*std::sin(phi)))/2.,
-(L*((a-d)*std::cos(phi) - 2*b*std::sin(phi)))/2.,
(dphi*(-b*d2 + 8*b2*u - 4*a*d*u + 2*d2*u + a2*(b + 2*u)))
/(8.*b) ) ;
return nvec.unit();
}
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4TwistedTubs.hh,v 1.3 2004/05/24 12:09:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// $Id: G4TwistedTubs.hh,v 1.7 2004/12/02 09:31:31 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
//
// --------------------------------------------------------------------
@@ -163,6 +163,10 @@ class G4TwistedTubs : public G4VSolid
G4VisExtent GetExtent () const;
G4GeometryType GetEntityType() const;
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
#ifdef G4SPECSDEBUG
@@ -195,9 +199,9 @@ class G4TwistedTubs : public G4VSolid
G4double fInnerStereo; // Inner-hype stereo angle
G4double fOuterStereo; // Outer-hype stereo angle
G4double fTanInnerStereo; // tan(innerStereoAngle)
G4double fTanOuterStereo; // tan(outerStereoAngle)
G4double fKappa; // tan(fPhiTwist/2)/fZHalfLen;
G4double fTanInnerStereo; // std::tan(innerStereoAngle)
G4double fTanOuterStereo; // std::tan(outerStereoAngle)
G4double fKappa; // std::tan(fPhiTwist/2)/fZHalfLen;
G4double fEndInnerRadius[2]; // Inner-hype radii endcaps [0] -ve z, [1] +ve z
G4double fEndOuterRadius[2]; // Outer-hype radii endcaps [0] -ve z, [1] +ve z
G4double fEndPhi[2]; // Phi endcaps, [0] = -ve z, [1] = +ve z
@@ -214,7 +218,9 @@ class G4TwistedTubs : public G4VSolid
G4VSurface *fFormerTwisted; // Surface of +ve phi
G4VSurface *fInnerHype; // Surface of -ve r
G4VSurface *fOuterHype; // Surface of +ve r
G4double fCubicVolume; // Cached value for cubic volume
class LastState // last Inside result
{
public:
@@ -298,6 +304,7 @@ void G4TwistedTubs::SetFields(G4double phitwist, G4double innerrad,
G4double outerrad, G4double negativeEndz,
G4double positiveEndz)
{
fCubicVolume = 0.;
fPhiTwist = phitwist;
fEndZ[0] = negativeEndz;
fEndZ[1] = positiveEndz;
@@ -309,33 +316,33 @@ void G4TwistedTubs::SetFields(G4double phitwist, G4double innerrad,
fOuterRadius2 = fOuterRadius * fOuterRadius;
G4int maxi;
if (fabs(fEndZ[0]) >= fabs(fEndZ[1])) {
fZHalfLength = fabs(fEndZ[0]);
if (std::fabs(fEndZ[0]) >= std::fabs(fEndZ[1])) {
fZHalfLength = std::fabs(fEndZ[0]);
maxi = 0;
} else {
fZHalfLength = fabs(fEndZ[1]);
fZHalfLength = std::fabs(fEndZ[1]);
maxi = 1;
}
G4double parity = (fPhiTwist > 0 ? 1 : -1);
G4double tanHalfTwist = tan(0.5 * fPhiTwist);
G4double innerNumerator = fabs(fInnerRadius * tanHalfTwist) * parity;
G4double outerNumerator = fabs(fOuterRadius * tanHalfTwist) * parity;
G4double tanHalfTwist = std::tan(0.5 * fPhiTwist);
G4double innerNumerator = std::fabs(fInnerRadius * tanHalfTwist) * parity;
G4double outerNumerator = std::fabs(fOuterRadius * tanHalfTwist) * parity;
fTanInnerStereo = innerNumerator / fZHalfLength;
fTanOuterStereo = outerNumerator / fZHalfLength;
fTanInnerStereo2 = fTanInnerStereo * fTanInnerStereo;
fTanOuterStereo2 = fTanOuterStereo * fTanOuterStereo;
fInnerStereo = atan2(innerNumerator, fZHalfLength);
fOuterStereo = atan2(outerNumerator, fZHalfLength);
fEndInnerRadius[0] = sqrt(fInnerRadius2 + fEndZ2[0] * fTanInnerStereo2);
fEndInnerRadius[1] = sqrt(fInnerRadius2 + fEndZ2[1] * fTanInnerStereo2);
fEndOuterRadius[0] = sqrt(fOuterRadius2 + fEndZ2[0] * fTanOuterStereo2);
fEndOuterRadius[1] = sqrt(fOuterRadius2 + fEndZ2[1] * fTanOuterStereo2);
fInnerStereo = std::atan2(innerNumerator, fZHalfLength);
fOuterStereo = std::atan2(outerNumerator, fZHalfLength);
fEndInnerRadius[0] = std::sqrt(fInnerRadius2 + fEndZ2[0] * fTanInnerStereo2);
fEndInnerRadius[1] = std::sqrt(fInnerRadius2 + fEndZ2[1] * fTanInnerStereo2);
fEndOuterRadius[0] = std::sqrt(fOuterRadius2 + fEndZ2[0] * fTanOuterStereo2);
fEndOuterRadius[1] = std::sqrt(fOuterRadius2 + fEndZ2[1] * fTanOuterStereo2);
fKappa = tanHalfTwist / fZHalfLength;
fEndPhi[0] = atan2(fEndZ[0] * tanHalfTwist, fZHalfLength);
fEndPhi[1] = atan2(fEndZ[1] * tanHalfTwist, fZHalfLength);
fEndPhi[0] = std::atan2(fEndZ[0] * tanHalfTwist, fZHalfLength);
fEndPhi[1] = std::atan2(fEndZ[1] * tanHalfTwist, fZHalfLength);
#ifdef G4SPECSDEBUG
G4cout << "/********* G4TwistedTubs::SetFields() Field Parameters ***************** " << G4endl;
@@ -22,7 +22,7 @@
//
//
// $Id: G4VCSGface.hh,v 1.6 2003/11/03 18:39:55 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// --------------------------------------------------------------------
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VCSGfaceted.hh,v 1.8 2003/06/16 16:53:56 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4VCSGfaceted.hh,v 1.10 2004/10/10 10:39:46 johna Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// --------------------------------------------------------------------
@@ -87,16 +87,36 @@ class G4VCSGfaceted : public G4VSolid
virtual G4VisExtent GetExtent() const;
virtual G4Polyhedron* GetPolyhedron () const;
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.
protected: // without description
G4int numFace;
G4VCSGface **faces;
G4double fCubicVolume;
mutable G4Polyhedron* fpPolyhedron;
virtual G4double DistanceTo( const G4ThreeVector &p,
const G4bool outgoing ) const;
void CopyStuff( const G4VCSGfaceted &source );
void DeleteStuff();
private:
G4int fCubVolStatistics;
G4double fCubVolEpsilon;
// Statistics, error accuracy for volume estimation.
};
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VSurface.hh,v 1.8 2004/05/28 18:19:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// $Id: G4VSurface.hh,v 1.10 2004/12/08 10:20:35 link Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
//
// --------------------------------------------------------------------
@@ -204,10 +204,10 @@ class G4VSurface
static const G4int sInside ;
static const G4int sBoundary;
static const G4int sCorner;
static const G4int sCMin1Min;
static const G4int sCMax1Min;
static const G4int sCMax1Max;
static const G4int sCMin1Max;
static const G4int sC0Min1Min;
static const G4int sC0Max1Min;
static const G4int sC0Max1Max;
static const G4int sC0Min1Max;
static const G4int sAxisMin;
static const G4int sAxisMax;
static const G4int sAxisX;
@@ -256,10 +256,10 @@ class G4VSurface
private:
G4double fDistance[2];
G4ThreeVector fXX[2];
G4int fAreacode[2];
G4bool fIsValid[2];
G4double fDistance[4];
G4ThreeVector fXX[4];
G4int fAreacode[4];
G4bool fIsValid[4];
G4int fNXX;
G4ThreeVector fLastp;
G4ThreeVector fLastv;
@@ -332,6 +332,24 @@ class G4VSurface
// inline functions
//========================================================
struct Intersection {
G4double phi ; // parameter phi
G4double u ; // parameter u
G4ThreeVector xx ; // intersection point in cartesian
G4double distance ; // distance to intersection
G4int areacode; // the areacode of the intersection
G4bool isvalid ; // valid intersection ??
} ;
inline
G4bool DistanceSort( const Intersection &a, const Intersection &b)
{
return a.distance < b.distance ;
}
#include "G4VSurface.icc"
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VSurface.icc,v 1.2 2004/05/28 13:13:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// $Id: G4VSurface.icc,v 1.6 2004/12/02 09:31:31 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
//
// --------------------------------------------------------------------
@@ -77,7 +77,7 @@ G4double G4VSurface::DistanceToPlane(const G4ThreeVector &p,
// xx = p - t*n
//
// where
// t = n * (p - x0) / abs(n)
// t = n * (p - x0) / std::abs(n)
//
G4double t;
G4ThreeVector n = n0.unit();
@@ -304,7 +304,7 @@ void G4VSurface::SetNeighbours(G4VSurface* axis0min, G4VSurface* axis1min,
fNeighbours[0] = axis0min;
fNeighbours[1] = axis1min;
fNeighbours[2] = axis0max;
fNeighbours[4] = axis1max;
fNeighbours[3] = axis1max;
}
//=====================================================================
@@ -313,29 +313,38 @@ void G4VSurface::SetNeighbours(G4VSurface* axis0min, G4VSurface* axis1min,
inline
G4int G4VSurface::GetNeighbours(G4int areacode, G4VSurface** surfaces)
{
int sAxis0Min = sAxis0 & sAxisMin ;
int sAxis1Min = sAxis1 & sAxisMin ;
int sAxis0Max = sAxis0 & sAxisMax ;
int sAxis1Max = sAxis1 & sAxisMax ;
G4int i = 0;
if (areacode & (sAxis0 | sAxisMin)) {
surfaces[i] = fNeighbours[0];
i++;
}
if (areacode & (sAxis1 | sAxisMin)) {
surfaces[i] = fNeighbours[1];
i++;
if (i == 2) return i;
}
if (areacode & (sAxis0 | sAxisMax)) {
surfaces[i] = fNeighbours[2];
i++;
if (i == 2) return i;
}
if (areacode & (sAxis1 | sAxisMax)) {
surfaces[i] = fNeighbours[3];
i++;
if (i == 2) return i;
}
return i;
if ( (areacode & sAxis0Min ) == sAxis0Min ) {
surfaces[i] = fNeighbours[0] ;
i++ ;
}
if ( ( areacode & sAxis1Min ) == sAxis1Min ) {
surfaces[i] = fNeighbours[1] ;
i++ ;
if ( i == 2 ) return i ;
}
if ( ( areacode & sAxis0Max ) == sAxis0Max ) {
surfaces[i] = fNeighbours[2] ;
i++ ;
if ( i == 2 ) return i ;
}
if ( ( areacode & sAxis1Max ) == sAxis1Max ) {
surfaces[i] = fNeighbours[3] ;
i++ ;
if ( i == 2 ) return i ;
}
return i ;
}
//=====================================================================
@@ -351,13 +360,13 @@ G4ThreeVector G4VSurface::GetCorner(G4int areacode) const
FatalException, "Area code must represent corner.");
}
if ((areacode & sCMin1Min) == sCMin1Min) {
if ((areacode & sC0Min1Min) == sC0Min1Min) {
return fCorners[0];
} else if ((areacode & sCMax1Min) == sCMax1Min) {
} else if ((areacode & sC0Max1Min) == sC0Max1Min) {
return fCorners[1];
} else if ((areacode & sCMax1Max) == sCMax1Max) {
} else if ((areacode & sC0Max1Max) == sC0Max1Max) {
return fCorners[2];
} else if ((areacode & sCMin1Max) == sCMin1Max) {
} else if ((areacode & sC0Min1Max) == sC0Min1Max) {
return fCorners[3];
} else {
G4cerr << "ERROR - G4VSurface::GetCorner()" << G4endl