Import Geant4 9.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:58:43 +02:00
parent 96c8bcd0af
commit b79225fb37
7544 changed files with 245407 additions and 91099 deletions
+55 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.99 2007/11/23 09:32:28 gcosmo Exp $
$Id: History,v 1.109 2008/11/21 09:50:20 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,60 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
Nov 21, 2008 G.Cosmo geom-csg-V09-01-08
- G4Sphere: defined Get/SetInnerRadius() accessors to be compliant with
other CSG solids and allow consistent treatment in persistency code...
Nov 06, 2008 G.Cosmo geom-csg-V09-01-07
- G4Tubs, G4Cons: implemented caching of trigonometric values, now directly
computed inside modifiers for Phi angles and required for parametrised
cases. Improvement bringing up to 20% speedup in normal tracking for
tube/cone-sections placements.
Nov 05, 2008 G.Cosmo geom-csg-V09-01-06
- G4Cons: implemented first speed improvements and corrections from joint
code review of G4Cons class. Cached computation for half-tolerance and
use of Boolean flag for identifying if full-cone or section.
- G4Tubs: more refinements to previous review; corrected implementation
of constructor to conform to implementation as in G4Cons. Fixed issue in
SetDeltaPhi() method after changes introduced in the previous tag.
Sep 18, 2008 T.Nikitina geom-csg-V09-01-05
- G4Tubs: implemented first speed improvements and corrections from joint
code review of G4Tubs class. Cached computation for half-tolerance and
use of Boolean flag for identifying if full-tube or section.
Jul 07, 2008 V.Grichine geom-csg-V09-01-04
- G4Sphere: fixed bug in DistanceToOut(p, v, ...) for normal 'fSTheta'
greater than 90*deg, and use of tangent giving negative value.
Completes series of corrections introduced in previous tag.
Jun 23, 2008 T.Nikitina geom-csg-V09-01-03
- G4Tubs: fix in DistanceToIn(p,v, ...) in case of point on surface with
very small tangent direction; now returning kInfinity and no longer zero.
It fixes rare observed cases of zero value returned by both DistanceToIn()
and DistanceToOut(), causing stuck tracks with zero step length.
Jun 20, 2008 V.Grichine
- G4Sphere: fixed calculation of roots in DistanceToOut(p,v,...) for
theta-conical surfaces interserctions and for sTheta<=90 degree intersection.
Addresses issue reported when running PET application with optical photons
about mis-computation of distance on half-sphere constructs.
- Updated unit test for sphere.
Apr 22, 2008 V.Grichine geom-csg-V09-01-02
- G4Trap: corrections for arithmetic operations in 8-point constructor.
Addressing problem report #934.
Mar 13, 2008 G.Cosmo geom-csg-V09-01-01
- Cleared compilation warnings in G4Sphere on gcc-4.3.0 for
ambiguous use of parentheses in condition statements.
Feb 20, 2008 T.Nikitina geom-csg-V09-01-00
- G4Cons:
o Added protection against NaN in GetPointOnSurface() in the case the
check is run for Rmax1==Rmax2.
Nov 23, 2007 T.Nikitina geom-csg-V09-00-02
- Fixed problem of undefined side for valid surface normal in case of Phi
section and direction through the center of either A G4Tubs or G4Cons shape.
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4Box.hh,v 1.17 2006/10/19 15:33:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// --------------------------------------------------------------------
// GEANT 4 class header file
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4Box.icc,v 1.6 2006/10/19 15:33:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
@@ -25,7 +25,7 @@
//
//
// $Id: G4CSGSolid.hh,v 1.12 2006/10/19 15:33:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
+94 -78
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4Cons.hh,v 1.18 2007/05/18 07:38:00 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4Cons.hh,v 1.21 2008/11/06 11:04:00 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -53,6 +53,8 @@
// fSPhi starting angle of the segment in radians
// fDPhi delta angle of the segment in radians
//
// fPhiFullCone Boolean variable used for indicate the Phi Section
//
// Note:
// Internally fSPhi & fDPhi are adjusted so that fDPhi<=2PI,
// and fDPhi+fSPhi<=2PI. This enables simpler comparisons to be
@@ -72,123 +74,137 @@ class G4Cons : public G4CSGSolid
{
public: // with description
G4Cons(const G4String& pName,
G4double pRmin1, G4double pRmax1,
G4double pRmin2, G4double pRmax2,
G4double pDz,
G4double pSPhi, G4double pDPhi);
G4Cons(const G4String& pName,
G4double pRmin1, G4double pRmax1,
G4double pRmin2, G4double pRmax2,
G4double pDz,
G4double pSPhi, G4double pDPhi);
virtual ~G4Cons() ;
virtual ~G4Cons() ;
// Accessors
// Accessors
inline G4double GetInnerRadiusMinusZ() const;
inline G4double GetOuterRadiusMinusZ() const;
inline G4double GetInnerRadiusPlusZ() const;
inline G4double GetOuterRadiusPlusZ() const;
inline G4double GetInnerRadiusMinusZ() const;
inline G4double GetOuterRadiusMinusZ() const;
inline G4double GetInnerRadiusPlusZ() const;
inline G4double GetOuterRadiusPlusZ() const;
inline G4double GetZHalfLength() const;
inline G4double GetZHalfLength() const;
inline G4double GetStartPhiAngle () const;
inline G4double GetDeltaPhiAngle () const;
inline G4double GetStartPhiAngle () const;
inline G4double GetDeltaPhiAngle () const;
// Modifiers
// Modifiers
inline void SetInnerRadiusMinusZ( G4double Rmin1 );
inline void SetOuterRadiusMinusZ( G4double Rmax1 );
inline void SetInnerRadiusPlusZ ( G4double Rmin2 );
inline void SetOuterRadiusPlusZ ( G4double Rmax2 );
inline void SetInnerRadiusMinusZ( G4double Rmin1 );
inline void SetOuterRadiusMinusZ( G4double Rmax1 );
inline void SetInnerRadiusPlusZ ( G4double Rmin2 );
inline void SetOuterRadiusPlusZ ( G4double Rmax2 );
inline void SetZHalfLength ( G4double newDz );
inline void SetStartPhiAngle ( G4double newSPhi);
inline void SetDeltaPhiAngle ( G4double newDPhi);
inline void SetZHalfLength ( G4double newDz );
inline void SetStartPhiAngle ( G4double newSPhi);
inline void SetDeltaPhiAngle ( G4double newDPhi);
// Other methods for solid
// Other methods for solid
inline G4double GetCubicVolume();
inline G4double GetSurfaceArea();
inline G4double GetCubicVolume();
inline G4double GetSurfaceArea();
void ComputeDimensions(G4VPVParameterisation* p,
const G4int n,
const G4VPhysicalVolume* pRep);
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;
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pmin, G4double& pmax) const;
EInside Inside(const G4ThreeVector& p) const;
EInside Inside(const G4ThreeVector& p) const;
G4ThreeVector SurfaceNormal(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;
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;
G4GeometryType GetEntityType() const;
G4ThreeVector GetPointOnSurface() const;
G4ThreeVector GetPointOnSurface() const;
std::ostream& StreamInfo(std::ostream& os) const;
std::ostream& StreamInfo(std::ostream& os) const;
// Visualisation functions
// Visualisation functions
void DescribeYourselfTo( G4VGraphicsScene& scene ) const;
G4Polyhedron* CreatePolyhedron() const;
G4NURBS* CreateNURBS() const;
void DescribeYourselfTo( G4VGraphicsScene& scene ) const;
G4Polyhedron* CreatePolyhedron() const;
G4NURBS* CreateNURBS() const;
public: // without description
G4Cons(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
G4Cons(__void__&);
//
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
// Old access functions
// Old access functions
inline G4double GetRmin1() const;
inline G4double GetRmax1() const;
inline G4double GetRmin2() const;
inline G4double GetRmax2() const;
inline G4double GetRmin1() const;
inline G4double GetRmax1() const;
inline G4double GetRmin2() const;
inline G4double GetRmax2() const;
inline G4double GetDz() const;
inline G4double GetDz() const;
inline G4double GetSPhi() const;
inline G4double GetDPhi() const;
inline G4double GetSPhi() const;
inline G4double GetDPhi() const;
protected:
G4ThreeVectorList*
CreateRotatedVertices(const G4AffineTransform& pTransform) const;
G4ThreeVectorList*
CreateRotatedVertices(const G4AffineTransform& pTransform) const;
// Used by distanceToOut
G4double fRmin1, fRmin2, fRmax1, fRmax2, fDz, fSPhi, fDPhi;
G4bool fPhiFullCone;
// Used by distanceToOut
enum ESide {kNull,kRMin,kRMax,kSPhi,kEPhi,kPZ,kMZ};
enum ESide {kNull,kRMin,kRMax,kSPhi,kEPhi,kPZ,kMZ};
// used by normal
// used by normal
enum ENorm {kNRMin,kNRMax,kNSPhi,kNEPhi,kNZ};
enum ENorm {kNRMin,kNRMax,kNSPhi,kNEPhi,kNZ};
private:
G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector& p) const;
// Algorithm for SurfaceNormal() following the original
// specification for points not on the surface
inline void Initialise();
// Reset relevant values to zero
inline void InitializeTrigonometry();
//
// Recompute relevant trigonometric values and cache them
G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector& p) const;
//
// Algorithm for SurfaceNormal() following the original
// specification for points not on the surface
private:
G4double kRadTolerance, kAngTolerance;
G4double kRadTolerance, kAngTolerance;
//
// Radial and angular tolerances
G4double fRmin1,fRmin2,
fRmax1,fRmax2,
fDz,
fSPhi,fDPhi;
G4double sinCPhi, cosCPhi, cosHDPhiOT, cosHDPhiIT,
sinSPhi, cosSPhi, sinEPhi, cosEPhi;
//
// Cached trigonometric values
};
#include "G4Cons.icc"
+52 -24
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4Cons.icc,v 1.6 2006/10/19 15:33:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4Cons.icc,v 1.8 2008/11/06 10:55:40 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
@@ -35,6 +35,31 @@
// Implementation of inline methods of G4Cons
// --------------------------------------------------------------------
inline
void G4Cons::Initialise()
{
fCubicVolume= 0.;
fSurfaceArea= 0.;
fpPolyhedron = 0;
}
inline
void G4Cons::InitializeTrigonometry()
{
G4double hDPhi = 0.5*fDPhi; // half delta phi
G4double cPhi = fSPhi + hDPhi;
G4double ePhi = fSPhi + fDPhi;
sinCPhi = std::sin(cPhi);
cosCPhi = std::cos(cPhi);
cosHDPhiIT = std::cos(hDPhi - 0.5*kAngTolerance); // inner/outer tol half dphi
cosHDPhiOT = std::cos(hDPhi + 0.5*kAngTolerance);
sinSPhi = std::sin(fSPhi);
cosSPhi = std::cos(fSPhi);
sinEPhi = std::sin(ePhi);
cosEPhi = std::cos(ePhi);
}
inline
G4double G4Cons::GetInnerRadiusMinusZ() const
{
@@ -81,62 +106,65 @@ inline
void G4Cons::SetInnerRadiusMinusZ( G4double Rmin1 )
{
fRmin1= Rmin1 ;
fCubicVolume= 0.;
fSurfaceArea= 0.;
fpPolyhedron = 0;
Initialise();
}
inline
void G4Cons::SetOuterRadiusMinusZ( G4double Rmax1 )
{
fRmax1= Rmax1 ;
fCubicVolume= 0.;
fSurfaceArea= 0.;
fpPolyhedron = 0;
Initialise();
}
inline
void G4Cons::SetInnerRadiusPlusZ ( G4double Rmin2 )
{
fRmin2= Rmin2 ;
fCubicVolume= 0.;
fSurfaceArea= 0.;
fpPolyhedron = 0;
Initialise();
}
inline
void G4Cons::SetOuterRadiusPlusZ ( G4double Rmax2 )
{
fRmax2= Rmax2 ;
fCubicVolume= 0.;
fSurfaceArea= 0.;
fpPolyhedron = 0;
Initialise();
}
inline
void G4Cons::SetZHalfLength ( G4double newDz )
{
fDz= newDz ;
fCubicVolume= 0.;
fSurfaceArea= 0.;
fpPolyhedron = 0;
Initialise();
}
inline
void G4Cons::SetStartPhiAngle ( G4double newSPhi )
{
fSPhi= newSPhi;
fCubicVolume= 0.;
fSurfaceArea= 0.;
fpPolyhedron = 0;
Initialise();
InitializeTrigonometry();
}
void G4Cons::SetDeltaPhiAngle ( G4double newDPhi )
{
if ( newDPhi >= twopi-kAngTolerance*0.5 )
{
fPhiFullCone = true;
}
else if ( newDPhi > 0 )
{
fPhiFullCone = false;
}
else
{
G4cerr << "ERROR - G4Cons()::SetDeltaPhiAngle() : " << GetName() << G4endl
<< " Negative delta-Phi ! - " << newDPhi << G4endl;
G4Exception("G4Cons::SetDeltaPhiAngle()", "InvalidSetup",
FatalException, "Invalid dphi.");
}
fDPhi= newDPhi;
fCubicVolume= 0.;
fSurfaceArea= 0.;
fpPolyhedron = 0;
Initialise();
InitializeTrigonometry();
}
// Old access methods ...
@@ -219,7 +247,7 @@ G4double G4Cons::GetSurfaceArea()
+ mmax * std::sqrt(dmax*dmax+4*fDz*fDz)
+ 0.5*(fRmax1*fRmax1-fRmin1*fRmin1
+fRmax2*fRmax2-fRmin2*fRmin2 ));
if(fDPhi < twopi )
if(!fPhiFullCone)
{
fSurfaceArea = fSurfaceArea+4*fDz*(mmax-mmin);
}
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4Orb.hh,v 1.11 2006/10/19 15:33:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4Orb.icc,v 1.5 2006/10/19 15:33:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4Para.hh,v 1.18 2006/10/19 15:33:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -25,7 +25,7 @@
//
//
// $Id: G4Para.icc,v 1.7 2006/10/19 15:33:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4Sphere.hh,v 1.20 2007/05/18 07:38:00 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4Sphere.hh,v 1.21 2008/11/21 09:50:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -87,7 +87,7 @@ class G4Sphere : public G4CSGSolid
// Accessors
inline G4double GetInsideRadius () const;
inline G4double GetInnerRadius () const;
inline G4double GetOuterRadius () const;
inline G4double GetStartPhiAngle () const;
inline G4double GetDeltaPhiAngle () const;
@@ -96,7 +96,7 @@ class G4Sphere : public G4CSGSolid
// Modifiers
inline void SetInsideRadius (G4double newRmin);
inline void SetInnerRadius (G4double newRMin);
inline void SetOuterRadius (G4double newRmax);
inline void SetStartPhiAngle (G4double newSphi);
inline void SetDeltaPhiAngle (G4double newDphi);
@@ -161,6 +161,8 @@ class G4Sphere : public G4CSGSolid
inline G4double GetDPhi() const;
inline G4double GetSTheta() const;
inline G4double GetDTheta() const;
inline G4double GetInsideRadius() const;
inline void SetInsideRadius(G4double newRmin);
protected:
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4Sphere.icc,v 1.7 2006/10/19 15:33:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4Sphere.icc,v 1.8 2008/11/21 09:50:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
@@ -41,6 +41,12 @@ G4double G4Sphere::GetInsideRadius() const
return fRmin;
}
inline
G4double G4Sphere::GetInnerRadius() const
{
return fRmin;
}
inline
G4double G4Sphere::GetOuterRadius() const
{
@@ -79,6 +85,15 @@ void G4Sphere::SetInsideRadius(G4double newRmin)
fpPolyhedron = 0;
}
inline
void G4Sphere::SetInnerRadius(G4double newRmin)
{
fRmin= newRmin;
fCubicVolume= 0.;
fSurfaceArea= 0.;
fpPolyhedron = 0;
}
inline
void G4Sphere::SetOuterRadius(G4double newRmax)
{
@@ -25,7 +25,7 @@
//
//
// $Id: G4Torus.hh,v 1.27 2007/05/18 07:38:00 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -25,7 +25,7 @@
//
//
// $Id: G4Torus.icc,v 1.6 2006/10/19 15:33:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4Trap.hh,v 1.17 2006/10/19 15:33:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -25,7 +25,7 @@
//
//
// $Id: G4Trap.icc,v 1.8 2006/10/19 15:33:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4Trd.hh,v 1.16 2006/10/19 15:33:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4Trd.icc,v 1.7 2006/10/19 15:33:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
+28 -9
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4Tubs.hh,v 1.17 2007/05/18 07:38:00 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4Tubs.hh,v 1.21 2008/11/06 10:55:40 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// --------------------------------------------------------------------
@@ -38,9 +38,9 @@
//
// A tube or tube segment with curved sides parallel to
// the z-axis. The tube has a specified half-length along
// the z axis, about which it is centred, and a given
// the z-axis, about which it is centered, and a given
// minimum and maximum radius. A minimum radius of 0
// signifies a filled tube /cylinder. The tube segment is
// corresponds to filled tube /cylinder. The tube segment is
// specified by starting and delta angles for phi, with 0
// being the +x axis, PI/2 the +y axis.
// A delta angle of 2PI signifies a complete, unsegmented
@@ -56,6 +56,8 @@
// adjusted such that fSPhi+fDPhi<=2PI, fSPhi>-2PI
//
// fDPhi Delta angle of the segment.
//
// fPhiFullTube Boolean variable used for indicate the Phi Section
// History:
// 10.08.95 P.Kent: General cleanup, use G4VSolid extent helper functions
@@ -102,7 +104,7 @@ class G4Tubs : public G4CSGSolid
inline void SetZHalfLength (G4double newDz);
inline void SetStartPhiAngle (G4double newSPhi);
inline void SetDeltaPhiAngle (G4double newDPhi);
// Methods for solid
inline G4double GetCubicVolume();
@@ -143,6 +145,7 @@ class G4Tubs : public G4CSGSolid
public: // without description
G4Tubs(__void__&);
//
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
@@ -163,26 +166,42 @@ class G4Tubs : public G4CSGSolid
// Creates the List of transformed vertices in the format required
// for G4VSolid:: ClipCrossSection and ClipBetweenSections
G4double fRMin,fRMax,fDz,fSPhi,fDPhi;
// Used by distanceToOut
G4double fRMin, fRMax, fDz, fSPhi, fDPhi;
G4bool fPhiFullTube;
// Used by distanceToOut
enum ESide {kNull,kRMin,kRMax,kSPhi,kEPhi,kPZ,kMZ};
// used by normal
// Used by normal
enum ENorm {kNRMin,kNRMax,kNSPhi,kNEPhi,kNZ};
private:
inline void Initialize();
//
// Reset relevant values to zero
inline void InitializeTrigonometry();
//
// Recompute relevant trigonometric values and cache them
G4ThreeVector ApproxSurfaceNormal( const G4ThreeVector& p ) const;
//
// Algorithm for SurfaceNormal() following the original
// specification for points not on the surface
private:
G4double kRadTolerance, kAngTolerance;
//
// Radial and angular tolerances
G4double sinCPhi, cosCPhi, cosHDPhiOT, cosHDPhiIT,
sinSPhi, cosSPhi, sinEPhi, cosEPhi;
//
// Cached trigonometric values
};
#include "G4Tubs.icc"
+50 -18
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4Tubs.icc,v 1.7 2006/10/19 15:33:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4Tubs.icc,v 1.11 2008/11/06 10:55:40 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
@@ -65,49 +65,81 @@ G4double G4Tubs::GetDeltaPhiAngle () const
return fDPhi;
}
inline
void G4Tubs::Initialize()
{
fCubicVolume = 0.;
fSurfaceArea = 0.;
fpPolyhedron = 0;
}
inline
void G4Tubs::InitializeTrigonometry()
{
G4double hDPhi = 0.5*fDPhi; // half delta phi
G4double cPhi = fSPhi + hDPhi;
G4double ePhi = fSPhi + fDPhi;
sinCPhi = std::sin(cPhi);
cosCPhi = std::cos(cPhi);
cosHDPhiIT = std::cos(hDPhi - 0.5*kAngTolerance); // inner/outer tol half dphi
cosHDPhiOT = std::cos(hDPhi + 0.5*kAngTolerance);
sinSPhi = std::sin(fSPhi);
cosSPhi = std::cos(fSPhi);
sinEPhi = std::sin(ePhi);
cosEPhi = std::cos(ePhi);
}
inline
void G4Tubs::SetInnerRadius (G4double newRMin)
{
fRMin= newRMin;
fCubicVolume= 0.;
fSurfaceArea= 0.;
fpPolyhedron = 0;
Initialize();
}
inline
void G4Tubs::SetOuterRadius (G4double newRMax)
{
fRMax= newRMax;
fCubicVolume= 0.;
fSurfaceArea= 0.;
fpPolyhedron = 0;
Initialize();
}
inline
void G4Tubs::SetZHalfLength (G4double newDz)
{
fDz= newDz;
fCubicVolume= 0.;
fSurfaceArea= 0.;
fpPolyhedron = 0;
Initialize();
}
inline
void G4Tubs::SetStartPhiAngle (G4double newSPhi)
{
fSPhi= newSPhi;
fCubicVolume= 0.;
fSurfaceArea= 0.;
fpPolyhedron = 0;
Initialize();
InitializeTrigonometry();
}
inline
void G4Tubs::SetDeltaPhiAngle (G4double newDPhi)
{
if ( newDPhi >= twopi-kAngTolerance*0.5 )
{
fPhiFullTube = true;
}
else if ( newDPhi > 0 )
{
fPhiFullTube = false;
}
else
{
G4cerr << "ERROR - G4Tubs()::SetDeltaPhiAngle() : " << GetName() << G4endl
<< " Negative delta-Phi ! - " << newDPhi << G4endl;
G4Exception("G4Tubs::SetDeltaPhiAngle()", "InvalidSetup",
FatalException, "Invalid dphi.");
}
fDPhi= newDPhi;
fCubicVolume= 0.;
fSurfaceArea= 0.;
fpPolyhedron = 0;
Initialize();
InitializeTrigonometry();
}
// Older names for access functions
@@ -157,7 +189,7 @@ G4double G4Tubs::GetSurfaceArea()
else
{
fSurfaceArea = fDPhi*(fRMin+fRMax)*(2*fDz+fRMax-fRMin);
if (fDPhi < twopi)
if (!fPhiFullTube)
{
fSurfaceArea = fSurfaceArea + 4*fDz*(fRMax-fRMin);
}
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4Box.cc,v 1.44 2006/10/19 15:33:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
//
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4CSGSolid.cc,v 1.13 2006/10/19 15:33:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// --------------------------------------------------------------------
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4Orb.cc,v 1.24 2007/05/18 07:38:01 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// class G4Orb
//
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4Para.cc,v 1.39 2006/10/19 15:33:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
// class G4Para
//
+389 -74
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4Sphere.cc,v 1.57 2007/05/18 07:38:01 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4Sphere.cc,v 1.68 2008/07/07 09:35:16 grichine Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// class G4Sphere
//
@@ -33,6 +33,7 @@
//
// History:
//
// 12.06.08 V.Grichine: fix for theta intersections in DistanceToOut(p,v,...)
// 22.07.05 O.Link : Added check for intersection with double cone
// 03.05.05 V.Grichine: SurfaceNormal(p) according to J. Apostolakis proposal
// 16.09.04 V.Grichine: bug fixed in SurfaceNormal(p), theta normals
@@ -46,7 +47,7 @@
// 18.11.99 V.Grichine: side = kNull in Distance ToOut(p,v,...)
// 25.11.98 V.Grichine: bug fixed in DistanceToIn(p,v), phi intersections
// 12.11.98 V.Grichine: bug fixed in DistanceToIn(p,v), theta intersections
// 09.10.98 V.Grichine: modifications in Distance ToOut(p,v,...)
// 09.10.98 V.Grichine: modifications in DistanceToOut(p,v,...)
// 17.09.96 V.Grichine: final modifications to commit
// 28.03.94 P.Kent: old C++ code converted to tolerant geometry
// --------------------------------------------------------------------
@@ -607,17 +608,26 @@ G4ThreeVector G4Sphere::SurfaceNormal( const G4ThreeVector& p ) const
distSTheta = std::fabs(pTheta-fSTheta);
distETheta = std::fabs(pTheta-fSTheta-fDTheta);
nTs = G4ThreeVector(-std::cos(fSTheta)*std::cos(pPhi),
-std::cos(fSTheta)*std::sin(pPhi),
std::sin(fSTheta) );
nTe = G4ThreeVector( std::cos(fSTheta+fDTheta)*std::cos(pPhi),
std::cos(fSTheta+fDTheta)*std::sin(pPhi),
-std::sin(fSTheta+fDTheta) );
nTs = G4ThreeVector(-std::cos(fSTheta)*p.x()/rho, // *std::cos(pPhi),
-std::cos(fSTheta)*p.y()/rho, // *std::sin(pPhi),
std::sin(fSTheta) );
nTe = G4ThreeVector( std::cos(fSTheta+fDTheta)*p.x()/rho, // *std::cos(pPhi),
std::cos(fSTheta+fDTheta)*p.y()/rho, // *std::sin(pPhi),
-std::sin(fSTheta+fDTheta) );
}
else if( !fRmin )
{
if ( fSTheta ) distSTheta = 0.;
if ( fSTheta + fDTheta < pi ) distETheta = 0.;
if ( fSTheta )
{
distSTheta = 0.;
nTs = G4ThreeVector(0.,0.,-1.);
}
if ( fSTheta + fDTheta < pi ) // distETheta = 0.;
{
distETheta = 0.;
nTe = G4ThreeVector(0.,0.,1.);
}
}
}
if( rad ) nR = G4ThreeVector(p.x()/rad,p.y()/rad,p.z()/rad);
@@ -1422,18 +1432,19 @@ G4double G4Sphere::DistanceToIn( const G4ThreeVector& p,
{
d = std::sqrt(d2) ;
s = -b - d ; // First root
zi = p.z() + s*v.z();
if ( s < 0 )
if ( s < 0 || zi*(fSTheta - halfpi) > 0 )
{
s=-b+d; // Second root
s = -b+d; // Second root
}
if (s >= 0 && s < snxt)
{
xi = p.x() + s*v.x() ;
yi = p.y() + s*v.y() ;
zi = p.z() + s*v.z() ;
rhoi2 = xi*xi + yi*yi ;
radi2 = rhoi2 + zi*zi ;
xi = p.x() + s*v.x();
yi = p.y() + s*v.y();
zi = p.z() + s*v.z();
rhoi2 = xi*xi + yi*yi;
radi2 = rhoi2 + zi*zi;
if ( (radi2 <= tolORMax2)
&& (radi2 >= tolORMin2)
&& (zi*(fSTheta - halfpi) <= 0) )
@@ -1500,9 +1511,10 @@ G4double G4Sphere::DistanceToIn( const G4ThreeVector& p,
}
}
}
else if (pTheta > tolETheta)
{ // dist2ETheta<-kRadTolerance*0.5 && dist2STheta>0)
// Inside (theta>etheta+tol) e theta cone
else if ( pTheta > tolETheta )
{
// dist2ETheta<-kRadTolerance*0.5 && dist2STheta>0)
// Inside (theta > etheta+tol) e-theta cone
// First root of etheta cone, second if first root `imaginary'
t1 = 1 - v.z()*v.z()*(1 + tanETheta2) ;
@@ -1516,7 +1528,9 @@ G4double G4Sphere::DistanceToIn( const G4ThreeVector& p,
{
d = std::sqrt(d2) ;
s = -b - d ; // First root
if (s < 0)
zi = p.z() + s*v.z();
if (s < 0 || zi*(fSTheta + fDTheta - halfpi) > 0)
{
s = -b + d ; // second root
}
@@ -1958,25 +1972,25 @@ G4double G4Sphere::DistanceToOut( const G4ThreeVector& p,
G4double cosHDPhiOT,cosHDPhiIT;
G4bool segTheta; // Theta flag and precals
G4double tanSTheta=0.,tanETheta, rhoSecTheta;
G4double tanSTheta=0.,tanETheta=0., rhoSecTheta;
G4double tanSTheta2=0.,tanETheta2=0.;
G4double dist2STheta,dist2ETheta;
G4double dist2STheta, dist2ETheta, distTheta;
G4double d2,s;
// General Precalcs
rho2=p.x()*p.x()+p.y()*p.y();
rad2=rho2+p.z()*p.z();
rho2 = p.x()*p.x()+p.y()*p.y();
rad2 = rho2+p.z()*p.z();
// G4double rad=std::sqrt(rad2);
pTheta=std::atan2(std::sqrt(rho2),p.z());
pTheta = std::atan2(std::sqrt(rho2),p.z());
pDotV2d=p.x()*v.x()+p.y()*v.y();
pDotV3d=pDotV2d+p.z()*v.z();
pDotV2d = p.x()*v.x()+p.y()*v.y();
pDotV3d = pDotV2d+p.z()*v.z();
// Set phi divided flag and precalcs
if(fDPhi<twopi)
if( fDPhi < twopi )
{
segPhi=true;
hDPhi=0.5*fDPhi; // half delta phi
@@ -1995,16 +2009,14 @@ G4double G4Sphere::DistanceToOut( const G4ThreeVector& p,
// Theta precalcs
if (fDTheta < pi)
if ( fDTheta < pi )
{
segTheta=true;
tolSTheta=fSTheta-kAngTolerance*0.5;
tolETheta=fSTheta+fDTheta+kAngTolerance*0.5;
}
else
{
segTheta=false;
segTheta = true;
tolSTheta = fSTheta - kAngTolerance*0.5;
tolETheta = fSTheta + fDTheta + kAngTolerance*0.5;
}
else segTheta = false;
// Radial Intersections from G4Sphere::DistanceToIn
//
@@ -2023,12 +2035,15 @@ G4double G4Sphere::DistanceToOut( const G4ThreeVector& p,
// => s=-pDotV3d+-std::sqrt(pDotV3d^2-(rad2-R^2))
//
// const G4double fractionTolerance = 1.0e-12;
const G4double flexRadMaxTolerance = // kRadTolerance;
const G4double flexRadMaxTolerance = // kRadTolerance;
std::max(kRadTolerance, fEpsilon * fRmax);
const G4double Rmax_plus = fRmax + flexRadMaxTolerance*0.5;
const G4double flexRadMinTolerance = std::max(kRadTolerance,
fEpsilon * fRmin);
const G4double Rmin_minus= (fRmin > 0) ? fRmin-flexRadMinTolerance*0.5 : 0 ;
if(rad2 <= Rmax_plus*Rmax_plus && rad2 >= Rmin_minus*Rmin_minus)
@@ -2062,8 +2077,8 @@ G4double G4Sphere::DistanceToOut( const G4ThreeVector& p,
}
else
{
snxt=-pDotV3d+std::sqrt(d2); // second root since inside Rmax
side = kRMax ;
snxt = -pDotV3d+std::sqrt(d2); // second root since inside Rmax
side = kRMax ;
}
}
@@ -2076,23 +2091,21 @@ G4double G4Sphere::DistanceToOut( const G4ThreeVector& p,
c = rad2 - fRmin*fRmin;
d2 = pDotV3d*pDotV3d - c;
if (c >- flexRadMinTolerance*fRmin) // 2.0 * (0.5*kRadTolerance) * fRmin
if ( c >- flexRadMinTolerance*fRmin ) // 2.0 * (0.5*kRadTolerance) * fRmin
{
if( c < flexRadMinTolerance*fRmin &&
d2 >= flexRadMinTolerance*fRmin && pDotV3d < 0 ) // leaving from Rmin
{
if(calcNorm)
{
*validNorm = false ; // Rmin surface is concave
}
return snxt = 0 ;
if(calcNorm) *validNorm = false ; // Rmin surface is concave
return snxt = 0 ;
}
else
{
if (d2 >= 0)
if ( d2 >= 0. )
{
s = -pDotV3d-std::sqrt(d2) ;
if (s>=0) // Always intersect Rmin first
s = -pDotV3d-std::sqrt(d2);
if ( s >= 0. ) // Always intersect Rmin first
{
snxt = s ;
side = kRMin ;
@@ -2128,6 +2141,9 @@ G4double G4Sphere::DistanceToOut( const G4ThreeVector& p,
//
// => s^2(1-vz^2(1+tan^2(t))+2s(pdotv2d-pzvztan^2(t))+(rho2-pz^2tan^2(t))=0
//
/* ////////////////////////////////////////////////////////
tanSTheta=std::tan(fSTheta);
tanSTheta2=tanSTheta*tanSTheta;
tanETheta=std::tan(fSTheta+fDTheta);
@@ -2287,16 +2303,309 @@ G4double G4Sphere::DistanceToOut( const G4ThreeVector& p,
{
s = kInfinity ; // wrong cone
}
if (s < stheta)
{
stheta = s ;
sidetheta = kETheta ;
}
}
if (s < stheta)
{
stheta = s ;
sidetheta = kETheta ;
}
}
}
}
}
*/ ////////////////////////////////////////////////////////////
if(fSTheta) // intersection with first cons
{
tanSTheta = std::tan(fSTheta);
if( std::fabs(tanSTheta) > 5./kAngTolerance ) // kons is plane z=0
{
if( v.z() > 0. )
{
if ( std::fabs( p.z() ) <= flexRadMaxTolerance*0.5 )
{
if(calcNorm)
{
*validNorm = true;
*n = G4ThreeVector(0.,0.,1.);
}
return snxt = 0 ;
}
// s = -p.z()/v.z();
stheta = -p.z()/v.z();
sidetheta = kSTheta;
}
}
else // kons is not plane
{
tanSTheta2 = tanSTheta*tanSTheta;
t1 = 1-v.z()*v.z()*(1+tanSTheta2);
t2 = pDotV2d-p.z()*v.z()*tanSTheta2; // ~vDotN if p on cons
dist2STheta = rho2-p.z()*p.z()*tanSTheta2; // t3
// distTheta = std::sqrt(std::fabs(dist2STheta/(1+tanSTheta2)));
distTheta = std::sqrt(rho2)-p.z()*tanSTheta;
if( std::fabs(t1) < 0.5*kAngTolerance ) // 1st order equation, v parallel to kons
{
if( v.z() > 0. )
{
if(std::fabs(distTheta) < flexRadMaxTolerance*0.5) // p on surface
{
if( fSTheta < halfpi && p.z() > 0. )
{
if( calcNorm ) *validNorm = false;
return snxt = 0.;
}
else if( fSTheta > halfpi && p.z() <= 0)
{
if( calcNorm )
{
*validNorm = true;
if (rho2)
{
rhoSecTheta = std::sqrt(rho2*(1+tanSTheta2));
*n = G4ThreeVector( p.x()/rhoSecTheta,
p.y()/rhoSecTheta,
std::sin(fSTheta) );
}
else *n = G4ThreeVector(0.,0.,1.);
}
return snxt = 0.;
}
}
// s = -0.5*dist2STheta/t2;
stheta = -0.5*dist2STheta/t2;
sidetheta = kSTheta;
}
}
else // 2nd order equation, 1st root of fSTheta cone, 2nd if 1st root -ve
{
if( std::fabs(distTheta) < flexRadMaxTolerance*0.5) // && t2 >= 0.) surface
{
if( fSTheta > halfpi && t2 >= 0. ) // leave
{
if( calcNorm )
{
*validNorm = true;
if (rho2)
{
rhoSecTheta = std::sqrt(rho2*(1+tanSTheta2));
*n = G4ThreeVector( p.x()/rhoSecTheta,
p.y()/rhoSecTheta,
std::sin(fSTheta) );
}
else *n = G4ThreeVector(0.,0.,1.);
}
return snxt = 0.;
}
else if( fSTheta < halfpi && t2 < 0. && p.z() >=0. ) // leave
{
if( calcNorm ) *validNorm = false;
return snxt = 0.;
}
}
b = t2/t1;
c = dist2STheta/t1;
d2 = b*b - c ;
if ( d2 >= 0. )
{
d = std::sqrt(d2);
if( fSTheta > halfpi )
{
s = -b - d; // First root
if( (std::fabs(s) < flexRadMaxTolerance*0.5 && t2 < 0.) ||
s < 0. ||
( s > 0. && p.z() + s*v.z() > 0.) )
{
s = -b + d ; // 2nd root
}
if( s > flexRadMaxTolerance*0.5 && p.z() + s*v.z() <= 0.)
{
stheta = s;
sidetheta = kSTheta;
}
}
else // sTheta < pi/2, concave surface, no normal
{
s = -b - d; // First root
if( (std::fabs(s) < flexRadMaxTolerance*0.5 && t2 >= 0.) ||
s < 0. ||
( s > 0. && p.z() + s*v.z() < 0.) )
{
s = -b + d ; // 2nd root
}
if( s > flexRadMaxTolerance*0.5 && p.z() + s*v.z() >= 0.)
{
stheta = s;
sidetheta = kSTheta;
}
}
}
}
}
}
if (fSTheta + fDTheta < pi) // intersection with second cons
{
tanETheta = std::tan(fSTheta+fDTheta);
if( std::fabs(tanETheta) > 5./kAngTolerance ) // kons is plane z=0
{
if( v.z() < 0. )
{
if ( std::fabs( p.z() ) <= flexRadMaxTolerance*0.5 )
{
if(calcNorm)
{
*validNorm = true;
*n = G4ThreeVector(0.,0.,-1.);
}
return snxt = 0 ;
}
s = -p.z()/v.z();
if( s < stheta)
{
stheta = s;
sidetheta = kETheta;
}
}
}
else // kons is not plane
{
tanETheta2 = tanETheta*tanETheta;
t1 = 1-v.z()*v.z()*(1+tanETheta2);
t2 = pDotV2d-p.z()*v.z()*tanETheta2; // ~vDotN if p on cons
dist2ETheta = rho2-p.z()*p.z()*tanETheta2; // t3
// distTheta = std::sqrt(std::fabs(dist2ETheta/(1+tanETheta2)));
distTheta = std::sqrt(rho2)-p.z()*tanETheta;
if( std::fabs(t1) < 0.5*kAngTolerance ) // 1st order equation, v parallel to kons
{
if( v.z() < 0. )
{
if(std::fabs(distTheta) < flexRadMaxTolerance*0.5) // p on surface
{
if( fSTheta+fDTheta > halfpi && p.z() < 0. )
{
if( calcNorm ) *validNorm = false;
return snxt = 0.;
}
else if( fSTheta+fDTheta < halfpi && p.z() >= 0)
{
if( calcNorm )
{
*validNorm = true;
if (rho2)
{
rhoSecTheta = std::sqrt(rho2*(1+tanETheta2));
*n = G4ThreeVector( p.x()/rhoSecTheta,
p.y()/rhoSecTheta,
-std::sin(fSTheta+fDTheta) );
}
else *n = G4ThreeVector(0.,0.,-1.);
}
return snxt = 0.;
}
}
s = -0.5*dist2ETheta/t2;
if( s < stheta)
{
stheta = s;
sidetheta = kETheta;
}
}
}
else // 2nd order equation, 1st root of fSTheta cone, 2nd if 1st root -ve
{
if( std::fabs(distTheta) < flexRadMaxTolerance*0.5) // && t2 >= 0.) surface
{
if( fSTheta+fDTheta < halfpi && t2 >= 0. ) // leave
{
if( calcNorm )
{
*validNorm = true;
if (rho2)
{
rhoSecTheta = std::sqrt(rho2*(1+tanETheta2));
*n = G4ThreeVector( p.x()/rhoSecTheta,
p.y()/rhoSecTheta,
-std::sin(fSTheta+fDTheta) );
}
else *n = G4ThreeVector(0.,0.,-1.);
}
return snxt = 0.;
}
else if( fSTheta+fDTheta > halfpi && t2 < 0. && p.z() <=0. ) // leave
{
if( calcNorm ) *validNorm = false;
return snxt = 0.;
}
}
b = t2/t1;
c = dist2ETheta/t1;
d2 = b*b - c ;
if ( d2 >= 0. )
{
d = std::sqrt(d2);
if( fSTheta+fDTheta < halfpi )
{
s = -b - d; // First root
if( (std::fabs(s) < flexRadMaxTolerance*0.5 && t2 < 0.) ||
s < 0. )
{
s = -b + d ; // 2nd root
}
if( s > flexRadMaxTolerance*0.5 )
{
if( s < stheta )
{
stheta = s;
sidetheta = kETheta;
}
}
}
else // sTheta+fDTheta > pi/2, concave surface, no normal
{
s = -b - d; // First root
if( (std::fabs(s) < flexRadMaxTolerance*0.5 && t2 >= 0.) ||
s < 0. ||
( s > 0. && p.z() + s*v.z() > 0.) )
{
s = -b + d ; // 2nd root
}
if( s > flexRadMaxTolerance*0.5 && p.z() + s*v.z() <= 0.)
{
if( s < stheta )
{
stheta = s;
sidetheta = kETheta;
}
}
}
}
}
}
}
} // end theta intersections
// Phi Intersection
@@ -2577,61 +2886,67 @@ G4double G4Sphere::DistanceToOut( const G4ThreeVector& p,
*n=G4ThreeVector(xi/fRmax,yi/fRmax,zi/fRmax);
*validNorm=true;
break;
case kRMin:
*validNorm=false; // Rmin is concave
break;
case kSPhi:
if (fDPhi<=pi) // Normal to Phi-
if ( fDPhi <= pi ) // Normal to Phi-
{
*n=G4ThreeVector(std::sin(fSPhi),-std::cos(fSPhi),0);
*validNorm=true;
}
else *validNorm=false;
break ;
case kEPhi:
if (fDPhi<=pi) // Normal to Phi+
if ( fDPhi <= pi ) // Normal to Phi+
{
*n=G4ThreeVector(-std::sin(fSPhi+fDPhi),std::cos(fSPhi+fDPhi),0);
*validNorm=true;
}
else *validNorm=false;
break;
case kSTheta:
if( fSTheta == pi*0.5 )
if( fSTheta == halfpi )
{
*n=G4ThreeVector(0,0,1);
*n=G4ThreeVector(0.,0.,1.);
*validNorm=true;
}
else if ( fSTheta > pi )
else if ( fSTheta > halfpi )
{
xi=p.x()+snxt*v.x();
yi=p.y()+snxt*v.y();
rhoSecTheta = std::sqrt((xi*xi+yi*yi)*(1+tanSTheta2)) ;
*n = G4ThreeVector(-xi/rhoSecTheta, // N-
-yi/rhoSecTheta,
tanSTheta/std::sqrt(1+tanSTheta2)) ;
xi = p.x() + snxt*v.x();
yi = p.y() + snxt*v.y();
rhoSecTheta = std::sqrt((xi*xi+yi*yi)*(1+tanSTheta2));
*n = G4ThreeVector( xi/rhoSecTheta, // N-
yi/rhoSecTheta,
-tanSTheta/std::sqrt(1+tanSTheta2));
*validNorm=true;
}
else *validNorm=false; // Concave STheta cone
break;
case kETheta:
if( ( fSTheta + fDTheta ) == pi*0.5 )
if( ( fSTheta + fDTheta ) == halfpi )
{
*n = G4ThreeVector(0,0,-1);
*validNorm = true ;
*n = G4ThreeVector(0.,0.,-1.);
*validNorm = true;
}
else if ( ( fSTheta + fDTheta ) < pi )
else if ( ( fSTheta + fDTheta ) < halfpi)
{
xi=p.x()+snxt*v.x();
yi=p.y()+snxt*v.y();
rhoSecTheta = std::sqrt((xi*xi+yi*yi)*(1+tanETheta2)) ;
rhoSecTheta = std::sqrt((xi*xi+yi*yi)*(1+tanETheta2));
*n = G4ThreeVector( xi/rhoSecTheta, // N+
yi/rhoSecTheta,
-tanSTheta/std::sqrt(1+tanSTheta2) ) ;
-tanETheta/std::sqrt(1+tanETheta2) );
*validNorm=true;
}
else *validNorm=false; // Concave ETheta cone
break;
default:
G4cout.precision(16);
G4cout << G4endl;
@@ -2974,7 +3289,7 @@ G4ThreeVector G4Sphere::GetPointOnSurface() const
costheta = std::cos(theta);
sintheta = std::sqrt(1.-sqr(costheta));
if( (fSPhi==0) && (fDPhi==2.*pi) || (fDPhi==2.*pi) ) {aFiv = 0;}
if( ((fSPhi==0) && (fDPhi==2.*pi)) || (fDPhi==2.*pi) ) {aFiv = 0;}
if(fSTheta == 0) {aThr=0;}
if(fDTheta + fSTheta == pi) {aFou = 0;}
if(fSTheta == 0.5*pi) {aThr = pi*(fRmax*fRmax-fRmin*fRmin);}
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4Torus.cc,v 1.63 2007/10/02 09:34:17 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// class G4Torus
+10 -8
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4Trap.cc,v 1.42 2006/10/19 15:33:38 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// $Id: G4Trap.cc,v 1.45 2008/04/23 09:49:57 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-02 $
//
// class G4Trap
//
@@ -137,15 +137,17 @@ G4Trap::G4Trap( const G4String& pName,
// should cross the origin of frame
if ( pt[0].z() < 0
&& pt[0].z() == pt[1].z() && pt[0].z() == pt[2].z() && pt[0].z() == pt[3].z()
&& pt[0].z() == pt[1].z() && pt[0].z() == pt[2].z()
&& pt[0].z() == pt[3].z()
&& pt[4].z() > 0
&& pt[4].z() == pt[5].z() && pt[4].z() == pt[6].z() && pt[4].z() == pt[7].z()
&& ( pt[0].z() + pt[4].z() ) == 0
&& pt[4].z() == pt[5].z() && pt[4].z() == pt[6].z()
&& pt[4].z() == pt[7].z()
&& std::fabs( pt[0].z() + pt[4].z() ) < kCarTolerance
&& pt[0].y() == pt[1].y() && pt[2].y() == pt[3].y()
&& pt[4].y() == pt[5].y() && pt[6].y() == pt[7].y()
&& ( pt[0].y() + pt[2].y() + pt[4].y() + pt[6].y() ) == 0
&& ( pt[0].x() + pt[1].x() + pt[4].x() + pt[5].x() +
pt[2].x() + pt[3].x() + pt[6].x() + pt[7].x() ) == 0 )
&& std::fabs( pt[0].y() + pt[2].y() + pt[4].y() + pt[6].y() ) < kCarTolerance
&& std::fabs( pt[0].x() + pt[1].x() + pt[4].x() + pt[5].x() +
pt[2].x() + pt[3].x() + pt[6].x() + pt[7].x() ) < kCarTolerance )
{
G4bool good;
+1 -1
View File
@@ -25,7 +25,7 @@
//
//
// $Id: G4Trd.cc,v 1.34 2006/10/19 15:33:38 gcosmo Exp $
// GEANT4 tag $Name: geant4-09-01 $
// GEANT4 tag $Name: geant4-09-02 $
//
//
// Implementation for G4Trd class
File diff suppressed because it is too large Load Diff