Import Geant4 8.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:07:44 +02:00
parent fe73f43734
commit 75c7fd177d
764 changed files with 45230 additions and 95238 deletions
+49 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.100 2006/11/15 10:43:13 gcosmo Exp $
$Id: History,v 1.109 2007/04/26 13:27:37 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,54 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
26-Apr-2007, T.Nikitina (geom-specific-V08-02-05)
- Fix in GetPointOnSurface() for G4Polycone to consider also points laying
on rings when consecutive Z-sections are coincident.
Added method GetPointOnRing().
- Added unit test testPointOnSurfacePoly.cc.
27-Feb-2007, I.Hrivnacova (geom-specific-V08-02-04)
- Added specialised constructor for handling Z-sections in G4ExtrudedSolid.
- Cleared unecessary declaration of IsInside() methods in G4TriangularFacet
and G4QuadrangularFacet.
- Updated unit test for G4ExtrudedSolid.
26-Feb-2007, I.Hrivnacova (geom-specific-V08-02-04)
- Added specialised constructor for handling Z-sections in G4ExtrudedSolid.
- Cleared unecessary declaration of IsInside() methods in G4TriangularFacet
and G4QuadrangularFacet.
- Updated unit test for G4ExtrudedSolid.
15-Feb-2007, I.Hrivnacova (geom-specific-V08-02-03)
- Corrected caching of values in G4ExtrudedSolid.
- Bug fix in G4TriangularFacet::Intersect() to allow for correct update of
'Distance' in condition.
- Updated unit test for G4ExtrudedSolid.
09-Feb-2007, G.Cosmo (geom-specific-V08-02-02)
- Introduced new shape G4ExtrudedSolid, a solid representing the extrusion
of an arbitrary polygon with fixed outline in the two Z sections.
New files: G4ExtrudedSolid[.hh.icc.cc] and testG4ExtrudedSolid.cc
by I.Hrivnacova.
- G4TessellatedSolid:
o Made relevant solid's methods virtual, to be used as base class.
o Added implementation for GetSurfaceArea() and GetPointOnSurface() methods.
o Added protection in SurfaceNormal() method in case of facet not found.
o Check and return kOutside in Inside() if point out of solid's extent.
01-Feb-2007, G.Cosmo (geom-specific-V08-02-01)
- Fix in G4PolyconeSide::DistanceAway() for correct estimation of distance
for the case of Phi sections (T.Nikitina).
Addresses problem report #598.
- Updated unit test for G4Polycone to consider new test case.
22-Jan-2007, G.Cosmo (geom-specific-V08-02-00)
- Do not scale reducible-polygon in G4Polyhedra::Reset() method.
The 'original_parameters' structure offered as input through the accessors
are always assumed to be already scaled by the 'cos(0.5*phiTotal/theNumSide)'
factor. Addresses problem report #873.
- Fixed warning printout in G4Polycone::Reset().
15-Nov-2006, J.Allison (geom-specific-V08-01-04)
- Fixed typo in G4Polycone::CreatePolyhedron() introduced by mistake in
the last cleanup of the source code.
@@ -0,0 +1,173 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ExtrudedSolid.hh,v 1.5 2007/02/26 08:40:01 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
//
// G4ExtrudedSolid
//
// Class description:
//
// G4ExtrudedSolid is a solid which represents the extrusion of an arbitrary
// polygon with fixed outline in the defined Z sections.
// The z-sides of the solid are the scaled versions of the same polygon.
// The solid is implemented as a specification of G4TessellatedSolid.
//
// Parameters in the constructor:
// const G4String& pName - solid name
// std::vector<G4TwoVector> polygon - the vertices of the outlined polygon
// defined in clock-wise order
// std::vector<ZSection> - the z-sections defined by
// z position, offset and scale
// in increasing z-position order
//
// Parameters in the special constructor (for solid with 2 z-sections:
// G4double hz - the solid half length in Z
// G4TwoVector off1 - offset of the side in -hz
// G4double scale1 - scale of the side in -hz
// G4TwoVector off2 - offset of the side in +hz
// G4double scale2 - scale of the side in -hz
// Author:
// Ivana Hrivnacova, IPN Orsay
// --------------------------------------------------------------------
#ifndef G4ExtrudedSolid_HH
#define G4ExtrudedSolid_HH
#include <vector>
#include "G4TwoVector.hh"
#include "G4TessellatedSolid.hh"
class G4ExtrudedSolid : public G4TessellatedSolid
{
public: // without description
struct ZSection
{
ZSection(G4double z, G4TwoVector offset, G4double scale)
: fZ(z), fOffset(offset), fScale(scale) {}
G4double fZ;
G4TwoVector fOffset;
G4double fScale;
};
public: // with description
G4ExtrudedSolid( const G4String& pName,
std::vector<G4TwoVector> polygon,
std::vector<ZSection> zsections);
// General constructor
G4ExtrudedSolid( const G4String& pName,
std::vector<G4TwoVector> polygon,
G4double hz,
G4TwoVector off1, G4double scale1,
G4TwoVector off2, G4double scale2 );
// Special constructor for solid with 2 z-sections
virtual ~G4ExtrudedSolid();
// Destructor
// Accessors
inline G4int GetNofVertices() const;
inline G4TwoVector GetVertex(G4int index) const;
inline std::vector<G4TwoVector> GetPolygon() const;
inline G4int GetNofZSections() const;
inline ZSection GetZSection(G4int index) const;
inline std::vector<ZSection> GetZSections() const;
// Solid methods
EInside Inside (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;
std::ostream& StreamInfo(std::ostream &os) const;
public: // without description
G4ExtrudedSolid(__void__&);
// Fake default constructor for usage restricted to direct object
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
private:
void ComputeProjectionParameters();
G4ThreeVector GetVertex(G4int iz, G4int ind) const;
G4TwoVector ProjectPoint(const G4ThreeVector& point) const;
G4bool IsSameLine(G4TwoVector p,
G4TwoVector l1, G4TwoVector l2) const;
G4bool IsSameSide(G4TwoVector p1, G4TwoVector p2,
G4TwoVector l1, G4TwoVector l2) const;
G4bool IsPointInside(G4TwoVector a, G4TwoVector b, G4TwoVector c,
G4TwoVector p) const;
G4VFacet* MakeDownFacet(G4int ind1, G4int ind2, G4int ind3) const;
G4VFacet* MakeUpFacet(G4int ind1, G4int ind2, G4int ind3) const;
G4bool AddGeneralPolygonFacets();
G4bool MakeFacets();
G4bool IsConvex() const;
private:
G4int fNv;
G4int fNz;
std::vector<G4TwoVector> fPolygon;
std::vector<ZSection> fZSections;
std::vector< std::vector<G4int> > fTriangles;
G4bool fIsConvex;
G4GeometryType fGeometryType;
std::vector<G4double> fKScales;
std::vector<G4double> fScale0s;
std::vector<G4TwoVector> fKOffsets;
std::vector<G4TwoVector> fOffset0s;
};
#include "G4ExtrudedSolid.icc"
#endif
@@ -0,0 +1,83 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ExtrudedSolid.icc,v 1.2 2007/02/19 10:17:45 ivana Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
//
// G4ExtrudedSolid.icc
//
// Implementation of inline methods of G4ExtrudedSolid
// --------------------------------------------------------------------
inline
G4int G4ExtrudedSolid::GetNofVertices() const
{
return fNv;
}
inline G4TwoVector G4ExtrudedSolid::GetVertex(G4int index) const
{
if ( index<0 || index >= fNv )
{
G4Exception ("G4ExtrudedSolid::GetVertex()", "InvalidInput",
FatalException, "Index outside range.");
return G4TwoVector();
}
return fPolygon[index];
}
inline
std::vector<G4TwoVector> G4ExtrudedSolid::GetPolygon() const
{
return fPolygon;
}
inline
G4int G4ExtrudedSolid::GetNofZSections() const
{
return fNz;
}
inline
G4ExtrudedSolid::ZSection G4ExtrudedSolid::GetZSection(G4int index) const
{
if ( index<0 || index >= fNz )
{
G4Exception ("G4ExtrudedSolid::GetZSection()", "InvalidInput",
FatalException, "Index outside range.");
return ZSection(0.0, G4TwoVector(), 0.0);
}
return fZSections[index];
}
inline
std::vector<G4ExtrudedSolid::ZSection> G4ExtrudedSolid::GetZSections() const
{
return fZSections;
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4Polycone.hh,v 1.19 2006/06/29 18:47:12 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4Polycone.hh,v 1.20 2007/04/26 06:18:20 tnikitin Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
//
// --------------------------------------------------------------------
@@ -175,6 +175,10 @@ class G4Polycone : public G4VCSGfaceted
G4double zOne, G4double zTwo,
G4double& totArea) const;
G4ThreeVector GetPointOnRing(G4double fRMin, G4double fRMax,
G4double fRMin2, G4double fRMax2,
G4double zOne) const;
protected: // without description
// Here are our parameters
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4Polyhedra.hh,v 1.16 2006/06/29 18:47:18 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4Polyhedra.hh,v 1.17 2007/01/22 12:58:53 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
//
// --------------------------------------------------------------------
@@ -143,8 +143,13 @@ class G4Polyhedra : public G4VCSGfaceted
inline G4bool IsGeneric() const;
inline G4int GetNumRZCorner() const;
inline G4PolyhedraSideRZ GetCorner( const G4int index ) const;
inline G4PolyhedraHistorical* GetOriginalParameters() const;
// Returns internal scaled parameters.
inline void SetOriginalParameters(G4PolyhedraHistorical* pars);
// Sets internal parameters. Parameters 'Rmin' and 'Rmax' in input must
// be scaled first by a factor computed as 'cos(0.5*phiTotal/theNumSide)',
// if not already scaled.
public: // without description
@@ -155,14 +160,15 @@ class G4Polyhedra : public G4VCSGfaceted
protected: // without description
// Generic initializer, call by all constructors
inline void SetOriginalParameters();
// Sets internal parameters for the generic constructor.
void Create( G4double phiStart, // initial phi starting angle
G4double phiTotal, // total phi angle
G4int numSide, // number sides
G4ReduciblePolygon *rz ); // rz coordinates
// Generates the shape and is called by each constructor, after the
// conversion of the arguments
void CopyStuff( const G4Polyhedra &source );
void DeleteStuff();
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4Polyhedra.icc,v 1.10 2006/06/29 18:47:20 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4Polyhedra.icc,v 1.11 2007/01/22 12:58:53 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// --------------------------------------------------------------------
// GEANT 4 inline definitions file
@@ -87,8 +87,10 @@ inline
void G4Polyhedra::SetOriginalParameters(G4PolyhedraHistorical* pars)
{
if (!pars)
{
G4Exception("G4Polyhedra::SetOriginalParameters()", "InvalidSetup",
FatalException, "NULL pointer to parameters!");
}
*original_parameters = *pars;
fCubicVolume = 0.;
fpPolyhedron = 0;
@@ -24,8 +24,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4QuadrangularFacet.hh,v 1.3 2006/06/29 18:47:26 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4QuadrangularFacet.hh,v 1.5 2007/02/26 08:39:13 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
@@ -88,7 +88,7 @@ class G4QuadrangularFacet : public G4VFacet
G4QuadrangularFacet (const G4QuadrangularFacet &right);
const G4QuadrangularFacet &operator=(G4QuadrangularFacet &right);
G4VFacet *GetClone();
G4VFacet *GetClone ();
G4ThreeVector Distance (const G4ThreeVector &p);
G4double Distance (const G4ThreeVector &p, const G4double minDist);
@@ -98,8 +98,10 @@ class G4QuadrangularFacet : public G4VFacet
G4bool Intersect (const G4ThreeVector &p, const G4ThreeVector &v,
const G4bool outgoing, G4double &distance,
G4double &distFromSurface, G4ThreeVector &normal);
G4bool IsInside (const G4ThreeVector &p) const;
G4double GetArea ();
G4ThreeVector GetPointOnFace () const;
private:
G4TriangularFacet *facet1;
@@ -24,8 +24,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TessellatedSolid.hh,v 1.4 2006/10/20 13:45:20 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4TessellatedSolid.hh,v 1.7 2007/02/12 11:51:25 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
@@ -129,7 +129,7 @@ class G4TessellatedSolid : public G4VSolid
G4TessellatedSolid ();
G4TessellatedSolid (const G4String &name);
~G4TessellatedSolid ();
virtual ~G4TessellatedSolid ();
G4TessellatedSolid (const G4TessellatedSolid &s);
const G4TessellatedSolid &operator= (const G4TessellatedSolid &s);
@@ -139,45 +139,52 @@ class G4TessellatedSolid : public G4VSolid
G4VFacet *GetFacet (size_t i) const;
size_t GetNumberOfFacets () const;
G4double GetCubicVolume ();
G4double GetSurfaceArea ();
virtual G4double GetCubicVolume ();
virtual G4double GetSurfaceArea ();
//
// void ComputeDimensions (G4VPVParameterisation* p, const G4int n,
// const G4VPhysicalVolume* pRep) const;
// virtual void ComputeDimensions (G4VPVParameterisation* p, const G4int n,
// const G4VPhysicalVolume* pRep) const;
EInside Inside (const G4ThreeVector &p) const;
G4ThreeVector SurfaceNormal (const G4ThreeVector &p) const;
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const;
G4double DistanceToIn(const G4ThreeVector &p) const;
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v,
const G4bool calcNorm=false,
virtual EInside Inside (const G4ThreeVector &p) const;
virtual G4ThreeVector SurfaceNormal (const G4ThreeVector &p) const;
virtual G4double DistanceToIn(const G4ThreeVector &p,
const G4ThreeVector &v) const;
virtual G4double DistanceToIn(const G4ThreeVector &p) const;
virtual G4double DistanceToOut(const G4ThreeVector &p,
const G4ThreeVector &v,
const G4bool calcNorm=false,
G4bool *validNorm=0, G4ThreeVector *n=0) const;
G4double DistanceToOut (const G4ThreeVector &p) const;
G4GeometryType GetEntityType () const;
virtual G4double DistanceToOut (const G4ThreeVector &p) const;
virtual G4GeometryType GetEntityType () const;
void SetSolidClosed (const G4bool t);
G4bool GetSolidClosed () const;
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform, G4double& pMin,
G4double& pMax) const;
virtual G4ThreeVector GetPointOnSurface() const;
std::ostream &StreamInfo(std::ostream &os) const;
virtual G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pMin, G4double& pMax) const;
virtual std::ostream &StreamInfo(std::ostream &os) const;
// Functions for visualization
void DescribeYourselfTo (G4VGraphicsScene& scene) const;
G4VisExtent GetExtent () const;
virtual void DescribeYourselfTo (G4VGraphicsScene& scene) const;
virtual G4VisExtent GetExtent () const;
G4double GetMinXExtent () const;
G4double GetMaxXExtent () const;
G4double GetMinYExtent () const;
G4double GetMaxYExtent () const;
G4double GetMinZExtent () const;
G4double GetMaxZExtent () const;
G4Polyhedron* CreatePolyhedron () const;
G4Polyhedron* GetPolyhedron () const;
G4NURBS* CreateNURBS () const;
virtual G4Polyhedron* CreatePolyhedron () const;
virtual G4Polyhedron* GetPolyhedron () const;
virtual G4NURBS* CreateNURBS () const;
public: // without description
@@ -24,8 +24,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TriangularFacet.hh,v 1.3 2006/06/29 18:47:40 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4TriangularFacet.hh,v 1.6 2007/02/26 08:39:40 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
@@ -83,7 +83,7 @@ class G4TriangularFacet : public G4VFacet
G4TriangularFacet (const G4TriangularFacet &right);
const G4TriangularFacet &operator=(G4TriangularFacet &right);
G4VFacet *GetClone();
G4VFacet *GetClone ();
G4TriangularFacet *GetFlippedFacet ();
G4ThreeVector Distance (const G4ThreeVector &p);
@@ -94,8 +94,9 @@ class G4TriangularFacet : public G4VFacet
G4bool Intersect (const G4ThreeVector &p, const G4ThreeVector &v,
const G4bool outgoing, G4double &distance,
G4double &distFromSurface, G4ThreeVector &normal);
G4bool IsInside(const G4ThreeVector &p) const;
G4double GetArea ();
G4ThreeVector GetPointOnFace () const;
private:
G4double a;
@@ -24,8 +24,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VFacet.hh,v 1.3 2006/06/29 18:48:12 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4VFacet.hh,v 1.4 2007/02/12 09:34:44 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
@@ -72,23 +72,20 @@ class G4VFacet
G4VFacet ();
virtual ~G4VFacet ();
G4VFacet (const G4VFacet &right);
const G4VFacet &operator=(G4VFacet &right);
G4bool operator== (const G4VFacet &right) const;
size_t GetNumberOfVertices () const;
G4ThreeVector GetVertex (size_t i) const;
inline size_t GetNumberOfVertices () const;
inline G4ThreeVector GetVertex (size_t i) const;
G4GeometryType GetEntityType () const;
G4ThreeVector GetSurfaceNormal () const;
G4bool IsInside(const G4ThreeVector &p) const;
G4bool IsDefined () const;
void SetVertexIndex (const size_t i, const size_t j);
size_t GetVertexIndex (const size_t i) const;
G4ThreeVector GetCentroid () const;
G4double GetRadius () const;
G4double GetRadiusSquared() const;
inline G4GeometryType GetEntityType () const;
inline G4ThreeVector GetSurfaceNormal () const;
inline G4bool IsInside(const G4ThreeVector &p) const;
inline G4bool IsDefined () const;
inline void SetVertexIndex (const size_t i, const size_t j);
inline size_t GetVertexIndex (const size_t i) const;
inline G4ThreeVector GetCentroid () const;
inline G4double GetRadius () const;
inline G4double GetRadiusSquared() const;
void ApplyTranslation (const G4ThreeVector v);
@@ -102,6 +99,9 @@ class G4VFacet
virtual G4bool Intersect (const G4ThreeVector&, const G4ThreeVector &,
const G4bool , G4double &, G4double &,
G4ThreeVector &);
virtual G4double GetArea() = 0;
virtual G4ThreeVector GetPointOnFace() const = 0;
protected:
G4GeometryType geometryType;
@@ -117,6 +117,12 @@ class G4VFacet
G4double radiusSqr;
G4double dirTolerance;
G4double area;
private:
G4VFacet (const G4VFacet &right);
const G4VFacet &operator=(G4VFacet &right);
};
typedef std::vector<G4VFacet*>::iterator FacetI;
@@ -24,8 +24,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VFacet.icc,v 1.3 2006/06/29 18:48:15 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4VFacet.icc,v 1.4 2007/02/12 09:34:44 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
@@ -47,28 +47,6 @@
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
///////////////////////////////////////////////////////////////////////////////
//
inline G4VFacet::G4VFacet ()
{
dirTolerance = 1.0E-14;
P.clear();
E.clear();
centroid = G4ThreeVector(0.0,0.0,0.0);
radius = 0.0;
radiusSqr = 0.0;
}
///////////////////////////////////////////////////////////////////////////////
//
inline G4VFacet::~G4VFacet ()
{
P.clear();
E.clear();
}
///////////////////////////////////////////////////////////////////////////////
//
inline G4ThreeVector G4VFacet::GetSurfaceNormal () const
@@ -99,8 +77,8 @@ inline G4bool G4VFacet::IsDefined () const
//
inline size_t G4VFacet::GetVertexIndex (const size_t i) const
{
if (i < I.size()) return I[i];
else return 999999999;
if (i < I.size()) { return I[i]; }
else { return 999999999; }
}
///////////////////////////////////////////////////////////////////////////////
@@ -119,45 +97,9 @@ inline void G4VFacet::SetVertexIndex (const size_t i, const size_t j)
//
inline G4ThreeVector G4VFacet::GetVertex (size_t i) const
{
if (i == 0) return P0;
else if (i < nVertices) return P[i-1];
else return G4ThreeVector(0.0,0.0,0.0);
}
///////////////////////////////////////////////////////////////////////////////
//
inline void G4VFacet::ApplyTranslation(const G4ThreeVector v)
{
P0 += v;
for (G4ThreeVectorList::iterator it=P.begin(); it!=P.end(); it++)
(*it) += v;
}
///////////////////////////////////////////////////////////////////////////////
//
inline G4bool G4VFacet::operator== (const G4VFacet &right) const
{
G4double tolerance = kCarTolerance*kCarTolerance/4.0;
if (nVertices != right.GetNumberOfVertices())
return false;
else if ((centroid-right.GetCentroid()).mag2() > tolerance)
return false;
else if (std::fabs((right.GetSurfaceNormal()).dot(surfaceNormal)) < 0.9999999999)
return false;
G4bool coincident = true;
size_t i = 0;
do
{
coincident = false;
size_t j = 0;
do
{
coincident = (GetVertex(i)-right.GetVertex(j)).mag2() < tolerance;
} while (!coincident && j++ < nVertices);
} while (coincident && i++ < nVertices);
return coincident;
if (i == 0) { return P0; }
else if (i < nVertices) { return P[i-1]; }
else { return G4ThreeVector(0.0,0.0,0.0); }
}
///////////////////////////////////////////////////////////////////////////////
@@ -174,31 +116,3 @@ inline G4double G4VFacet::GetRadius () const
//
inline G4double G4VFacet::GetRadiusSquared () const
{return radiusSqr;}
///////////////////////////////////////////////////////////////////////////////
//
inline G4VFacet* G4VFacet::GetClone ()
{return 0;}
///////////////////////////////////////////////////////////////////////////////
//
inline G4double G4VFacet::Distance (const G4ThreeVector&, const G4double)
{return kInfinity;}
///////////////////////////////////////////////////////////////////////////////
//
inline G4double G4VFacet::Distance (const G4ThreeVector&, const G4double,
const G4bool)
{return kInfinity;}
///////////////////////////////////////////////////////////////////////////////
//
inline G4double G4VFacet::Extent (const G4ThreeVector)
{return 0.0;}
///////////////////////////////////////////////////////////////////////////////
//
inline G4bool G4VFacet::Intersect (const G4ThreeVector&, const G4ThreeVector &,
const G4bool , G4double &, G4double &,
G4ThreeVector &)
{return false;}
@@ -0,0 +1,675 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ExtrudedSolid.cc,v 1.7 2007/05/02 14:59:31 gunter Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
//
// --------------------------------------------------------------------
// GEANT 4 class source file
//
// G4ExtrudedSolid.cc
//
// Author: Ivana Hrivnacova, IPN Orsay
// --------------------------------------------------------------------
#include <set>
#include <algorithm>
#include <cmath>
#include "G4ExtrudedSolid.hh"
#include "G4TriangularFacet.hh"
#include "G4QuadrangularFacet.hh"
//_____________________________________________________________________________
G4ExtrudedSolid::G4ExtrudedSolid( const G4String& pName,
std::vector<G4TwoVector> polygon,
std::vector<ZSection> zsections)
: G4TessellatedSolid(pName),
fNv(polygon.size()),
fNz(zsections.size()),
fPolygon(),
fZSections(),
fTriangles(),
fIsConvex(false),
fGeometryType("G4ExtrudedSolid")
{
// General constructor
// First check input parameters
if ( fNv < 3 ) {
G4Exception(
"G4ExtrudedSolid::G4ExtrudedSolid()", "InvalidSetup",
FatalException, "Number of polygon vertices < 3");
}
if ( fNz < 2 ) {
G4Exception(
"G4ExtrudedSolid::G4ExtrudedSolid()", "InvalidSetup",
FatalException, "Number of z-sides < 2");
}
for ( G4int i=0; i<fNz-1; ++i )
{
if ( zsections[i].fZ > zsections[i+1].fZ )
{
G4Exception(
"G4ExtrudedSolid::G4ExtrudedSolid()", "InvalidSetup",
FatalException,
"Z-sections have to be ordered by z value (z0 < z1 < z2 ...)");
}
if ( std::fabs( zsections[i+1].fZ - zsections[i].fZ ) < kCarTolerance )
{
G4Exception(
"G4ExtrudedSolid::G4ExtrudedSolid()", "InvalidSetup",
FatalException,
"Z-sections with the same z position are not supported.");
}
}
// Copy polygon
//
for ( G4int i=0; i<fNv; ++i ) { fPolygon.push_back(polygon[i]); }
// Copy z-sections
//
for ( G4int i=0; i<fNz; ++i ) { fZSections.push_back(zsections[i]); }
G4bool result = MakeFacets();
if (!result)
{
G4Exception("G4ExtrudedSolid::G4ExtrudedSolid()", "InvalidSetup",
FatalException, "Making facets failed.");
}
fIsConvex = IsConvex();
ComputeProjectionParameters();
}
//_____________________________________________________________________________
G4ExtrudedSolid::G4ExtrudedSolid( const G4String& pName,
std::vector<G4TwoVector> polygon,
G4double dz,
G4TwoVector off1, G4double scale1,
G4TwoVector off2, G4double scale2 )
: G4TessellatedSolid(pName),
fNv(polygon.size()),
fNz(2),
fPolygon(),
fZSections(),
fTriangles(),
fIsConvex(false),
fGeometryType("G4ExtrudedSolid")
{
// Special constructor for solid with 2 z-sections
// First check input parameters
//
if ( fNv < 3 )
{
G4Exception("G4ExtrudedSolid::G4ExtrudedSolid()", "InvalidSetup",
FatalException, "Number of polygon vertices < 3");
}
// Copy polygon
//
for ( G4int i=0; i<fNv; ++i ) { fPolygon.push_back(polygon[i]); }
// Copy z-sections
//
fZSections.push_back(ZSection(-dz, off1, scale1));
fZSections.push_back(ZSection( dz, off2, scale2));
G4bool result = MakeFacets();
if (!result)
{
G4Exception("G4ExtrudedSolid::G4ExtrudedSolid()", "InvalidSetup",
FatalException, "Making facets failed.");
}
fIsConvex = IsConvex();
ComputeProjectionParameters();
}
//_____________________________________________________________________________
G4ExtrudedSolid::G4ExtrudedSolid( __void__& a )
: G4TessellatedSolid(a)
{
// Fake default constructor - sets only member data and allocates memory
// for usage restricted to object persistency.
}
//_____________________________________________________________________________
G4ExtrudedSolid::~G4ExtrudedSolid()
{
// Destructor
}
//_____________________________________________________________________________
void G4ExtrudedSolid::ComputeProjectionParameters()
{
// Compute parameters for point projections p(z)
// to the polygon scale & offset:
// scale(z) = k*z + scale0
// offset(z) = l*z + offset0
// p(z) = scale(z)*p0 + offset(z)
// p0 = (p(z) - offset(z))/scale(z);
//
for ( G4int iz=0; iz<fNz-1; ++iz)
{
G4double z1 = fZSections[iz].fZ;
G4double z2 = fZSections[iz+1].fZ;
G4double scale1 = fZSections[iz].fScale;
G4double scale2 = fZSections[iz+1].fScale;
G4TwoVector off1 = fZSections[iz].fOffset;
G4TwoVector off2 = fZSections[iz+1].fOffset;
G4double kscale = (scale2 - scale1)/(z2 - z1);
G4double scale0 = scale2 - kscale*(z2 - z1)/2.0;
G4TwoVector koff = (off2 - off1)/(z2 - z1);
G4TwoVector off0 = off2 - koff*(z2 - z1)/2.0;
fKScales.push_back(kscale);
fScale0s.push_back(scale0);
fKOffsets.push_back(koff);
fOffset0s.push_back(off0);
}
}
//_____________________________________________________________________________
G4ThreeVector G4ExtrudedSolid::GetVertex(G4int iz, G4int ind) const
{
// Shift and scale vertices
return G4ThreeVector( fPolygon[ind].x() * fZSections[iz].fScale
+ fZSections[iz].fOffset.x(),
fPolygon[ind].y() * fZSections[iz].fScale
+ fZSections[iz].fOffset.y(), fZSections[iz].fZ);
}
//_____________________________________________________________________________
G4TwoVector G4ExtrudedSolid::ProjectPoint(const G4ThreeVector& point) const
{
// Project point in the polygon scale
// scale(z) = k*z + scale0
// offset(z) = l*z + offset0
// p(z) = scale(z)*p0 + offset(z)
// p0 = (p(z) - offset(z))/scale(z);
// Select projection (z-segment of the solid) according to p.z()
//
G4int iz = 0;
while ( point.z() > fZSections[iz+1].fZ && iz < fNz-2 ) { ++iz; }
G4double z0 = ( fZSections[iz+1].fZ + fZSections[iz].fZ )/2.0;
G4TwoVector p2(point.x(), point.y());
G4double pscale = fKScales[iz]*(point.z()-z0) + fScale0s[iz];
G4TwoVector poffset = fKOffsets[iz]*(point.z()-z0) + fOffset0s[iz];
// G4cout << point << " projected to "
// << iz << "-th z-segment polygon as "
// << (p2 - poffset)/pscale << G4endl;
// pscale is always >0 as it is an interpolation between two
// positive scale values
//
return (p2 - poffset)/pscale;
}
//_____________________________________________________________________________
G4bool G4ExtrudedSolid::IsSameLine(G4TwoVector p,
G4TwoVector l1, G4TwoVector l2) const
{
// Return true if p is on the line through l1, l2
if ( l1.x() == l2.x() )
{
return std::fabs(p.x() - l1.x()) < kCarTolerance;
}
return std::fabs (p.y() - l1.y() - ((l2.y() - l1.y())/(l2.x() - l1.x()))
*(p.x() - l1.x())) < kCarTolerance;
}
//_____________________________________________________________________________
G4bool G4ExtrudedSolid::IsSameSide(G4TwoVector p1, G4TwoVector p2,
G4TwoVector l1, G4TwoVector l2) const
{
// Return true if p1 and p2 are on the same side of the line through l1, l2
return ( (p1.x() - l1.x()) * (l2.y() - l1.y())
- (l2.x() - l1.x()) * (p1.y() - l1.y()) )
* ( (p2.x() - l1.x()) * (l2.y() - l1.y())
- (l2.x() - l1.x()) * (p2.y() - l1.y()) ) > 0;
}
//_____________________________________________________________________________
G4bool G4ExtrudedSolid::IsPointInside(G4TwoVector a, G4TwoVector b,
G4TwoVector c, G4TwoVector p) const
{
// Return true if p is inside of triangle abc, else returns false
// Check extent first
//
if ( ( p.x() < a.x() && p.x() < b.x() && p.x() < c.x() ) ||
( p.x() > a.x() && p.x() > b.x() && p.x() > c.x() ) ||
( p.y() < a.y() && p.y() < b.y() && p.y() < c.y() ) ||
( p.y() > a.y() && p.y() > b.y() && p.y() > c.y() ) ) return false;
return IsSameSide(p, a, b, c)
&& IsSameSide(p, b, a, c)
&& IsSameSide(p, c, a, b);
}
//_____________________________________________________________________________
G4VFacet*
G4ExtrudedSolid::MakeDownFacet(G4int ind1, G4int ind2, G4int ind3) const
{
// Create a triangular facet from the polygon points given by indices
// forming the down side ( the normal goes in -z)
std::vector<G4ThreeVector> vertices;
vertices.push_back(GetVertex(0, ind1));
vertices.push_back(GetVertex(0, ind2));
vertices.push_back(GetVertex(0, ind3));
// first vertex most left
//
G4ThreeVector cross
= (vertices[1]-vertices[0]).cross(vertices[2]-vertices[1]);
if ( cross.z() > 0.0 )
{
// vertices ardered clock wise has to be reordered
// G4cout << "G4ExtrudedSolid::MakeDownFacet: reordering vertices "
// << ind1 << ", " << ind2 << ", " << ind3 << G4endl;
G4ThreeVector tmp = vertices[1];
vertices[1] = vertices[2];
vertices[2] = tmp;
}
return new G4TriangularFacet(vertices[0], vertices[1],
vertices[2], ABSOLUTE);
}
//_____________________________________________________________________________
G4VFacet*
G4ExtrudedSolid::MakeUpFacet(G4int ind1, G4int ind2, G4int ind3) const
{
// Creates a triangular facet from the polygon points given by indices
// forming the upper side ( z>0 )
std::vector<G4ThreeVector> vertices;
vertices.push_back(GetVertex(fNz-1, ind1));
vertices.push_back(GetVertex(fNz-1, ind2));
vertices.push_back(GetVertex(fNz-1, ind3));
// first vertex most left
//
G4ThreeVector cross
= (vertices[1]-vertices[0]).cross(vertices[2]-vertices[1]);
if ( cross.z() < 0.0 )
{
// vertices ordered clock wise has to be reordered
// G4cout << "G4ExtrudedSolid::MakeUpFacet: reordering vertices "
// << ind1 << ", " << ind2 << ", " << ind3 << G4endl;
G4ThreeVector tmp = vertices[1];
vertices[1] = vertices[2];
vertices[2] = tmp;
}
return new G4TriangularFacet(vertices[0], vertices[1],
vertices[2], ABSOLUTE);
}
//_____________________________________________________________________________
G4bool G4ExtrudedSolid::AddGeneralPolygonFacets()
{
// Decompose polygonal sides in triangular facets
typedef std::pair < G4TwoVector, G4int > Vertex;
// Fill one more vector
//
std::vector< Vertex > verticesToBeDone;
for ( G4int i=0; i<fNv; ++i )
{
verticesToBeDone.push_back(Vertex(fPolygon[i], i));
}
std::vector< Vertex > ears;
std::vector< Vertex >::iterator c1 = verticesToBeDone.begin();
std::vector< Vertex >::iterator c2 = c1+1;
std::vector< Vertex >::iterator c3 = c1+2;
while ( verticesToBeDone.size()>2 )
{
// G4cout << "Looking at triangle : "
// << c1->second << " " << c2->second
// << " " << c3->second << G4endl;
G4bool good = true;
std::vector< Vertex >::iterator it;
for ( it=verticesToBeDone.begin(); it != verticesToBeDone.end(); ++it )
{
// skip vertices of tested triangle
//
if ( it == c1 || it == c2 || it == c3 ) { continue; }
if ( IsPointInside(c1->first, c2->first, c3->first, it->first) )
{
// G4cout << "Point " << it->second << " is inside" << G4endl;
good = false;
// try next three consecutive vertices
//
c1 = c2;
c2 = c3;
++c3;
if ( c3 == verticesToBeDone.end() ) { c3 = verticesToBeDone.begin(); }
break;
}
// else
// { G4cout << "Point " << it->second << " is outside" << G4endl; }
}
if ( good )
{
// all points are outside triangle, we can make a facet
// G4cout << "Found triangle : "
// << c1->second << " " << c2->second
// << " " << c3->second << G4endl;
G4bool result;
result = AddFacet( MakeDownFacet(c1->second, c2->second, c3->second) );
if ( ! result ) { return false; }
result = AddFacet( MakeUpFacet(c1->second, c2->second, c3->second) );
if ( ! result ) { return false; }
std::vector<G4int> triangle(3);
triangle[0] = c1->second;
triangle[1] = c2->second;
triangle[2] = c3->second;
fTriangles.push_back(triangle);
// remove the ear point from verticesToBeDone
//
verticesToBeDone.erase(c2);
c1 = verticesToBeDone.begin();
c2 = c1+1;
c3 = c1+2;
}
}
return true;
}
//_____________________________________________________________________________
G4bool G4ExtrudedSolid::MakeFacets()
{
// Define facets
G4bool good;
// The quadrangular sides
//
for ( G4int iz = 0; iz < fNz-1; ++iz )
{
for ( G4int i = 0; i < fNv; ++i )
{
G4int j = (i+1) % fNv;
good = AddFacet( new G4QuadrangularFacet
( GetVertex(iz, j), GetVertex(iz, i),
GetVertex(iz+1, i), GetVertex(iz+1, j), ABSOLUTE) );
if ( ! good ) { return false; }
}
}
// Decomposition of polygonal sides in the facets
//
if ( fNv == 3 )
{
good = AddFacet( new G4TriangularFacet( GetVertex(0, 0), GetVertex(0, 1),
GetVertex(0, 2), ABSOLUTE) );
if ( ! good ) { return false; }
good = AddFacet( new G4TriangularFacet( GetVertex(fNz-1, 2), GetVertex(fNz-1, 1),
GetVertex(fNz-1, 0), ABSOLUTE) );
if ( ! good ) { return false; }
}
else if ( fNv == 4 )
{
good = AddFacet( new G4QuadrangularFacet( GetVertex(0, 0),GetVertex(0, 1),
GetVertex(0, 2),GetVertex(0, 3),
ABSOLUTE) );
if ( ! good ) { return false; }
good = AddFacet( new G4QuadrangularFacet( GetVertex(fNz-1, 3), GetVertex(fNz-1, 2),
GetVertex(fNz-1, 1), GetVertex(1, 0),
ABSOLUTE) );
if ( ! good ) { return false; }
}
else
{
good = AddGeneralPolygonFacets();
if ( ! good ) { return false; }
}
SetSolidClosed(true);
return good;
}
//_____________________________________________________________________________
G4bool G4ExtrudedSolid::IsConvex() const
{
// Get polygon convexity (polygon is convex if all vertex angles are < pi )
for ( G4int i=0; i< fNv; ++i )
{
G4int j = ( i + 1 ) % fNv;
G4int k = ( i + 2 ) % fNv;
G4TwoVector v1 = fPolygon[i]-fPolygon[j];
G4TwoVector v2 = fPolygon[k]-fPolygon[j];
G4double dphi = v2.phi() - v1.phi();
if ( dphi < 0. ) { dphi += 2.*pi; }
if ( dphi >= pi ) { return false; }
}
return true;
}
//_____________________________________________________________________________
G4GeometryType G4ExtrudedSolid::GetEntityType () const
{
// Return entity type
return fGeometryType;
}
//_____________________________________________________________________________
EInside G4ExtrudedSolid::Inside (const G4ThreeVector &p) const
{
// Override the base class function as it fails in case of concave polygon.
// Project the point in the original polygon scale and check if it is inside
// for each triangle.
// Check first if outside extent
//
if ( p.x() < GetMinXExtent() - kCarTolerance ||
p.x() > GetMaxXExtent() + kCarTolerance ||
p.y() < GetMinYExtent() - kCarTolerance ||
p.y() > GetMaxYExtent() + kCarTolerance ||
p.z() < GetMinZExtent() - kCarTolerance ||
p.z() > GetMaxZExtent() + kCarTolerance )
{
// G4cout << "G4ExtrudedSolid::Outside extent: " << p << G4endl;
return kOutside;
}
// Project point p(z) to the polygon scale p0
//
G4TwoVector pscaled = ProjectPoint(p);
// Check if on surface of polygon
//
for ( G4int i=0; i<fNv; ++i )
{
G4int j = (i+1) % fNv;
if ( IsSameLine(pscaled, fPolygon[i], fPolygon[j]) )
{
// G4cout << "G4ExtrudedSolid::Inside return Surface (on polygon) "
// << G4endl;
return kSurface;
}
}
// Now check if inside triangles
//
std::vector< std::vector<G4int> >::const_iterator it = fTriangles.begin();
G4bool inside = false;
do
{
if ( IsPointInside(fPolygon[(*it)[0]], fPolygon[(*it)[1]],
fPolygon[(*it)[2]], pscaled) ) { inside = true; }
++it;
} while ( (inside == false) && (it != fTriangles.end()) );
if ( inside )
{
// Check if on surface of z sides
//
if ( std::fabs( p.z() - fZSections[0].fZ ) < kCarTolerance ||
std::fabs( p.z() - fZSections[fNz-1].fZ ) < kCarTolerance )
{
// G4cout << "G4ExtrudedSolid::Inside return Surface (on z side)"
// << G4endl;
return kSurface;
}
// G4cout << "G4ExtrudedSolid::Inside return Inside" << G4endl;
return kInside;
}
// G4cout << "G4ExtrudedSolid::Inside return Outside " << G4endl;
return kOutside;
}
//_____________________________________________________________________________
G4double G4ExtrudedSolid::DistanceToOut (const G4ThreeVector &p,
const G4ThreeVector &v,
const G4bool calcNorm,
G4bool *validNorm,
G4ThreeVector *n) const
{
// Override the base class function to redefine validNorm
// (the solid can be concave)
G4double distOut =
G4TessellatedSolid::DistanceToOut(p, v, calcNorm, validNorm, n);
if (validNorm) { *validNorm = fIsConvex; }
return distOut;
}
//_____________________________________________________________________________
G4double G4ExtrudedSolid::DistanceToOut (const G4ThreeVector &p) const
{
// Override the overloaded base class function
return G4TessellatedSolid::DistanceToOut(p);
}
//_____________________________________________________________________________
std::ostream& G4ExtrudedSolid::StreamInfo(std::ostream &os) const
{
os << "-----------------------------------------------------------\n"
<< " *** Dump for solid - " << GetName() << " ***\n"
<< " ===================================================\n"
<< " Solid geometry type: " << fGeometryType << G4endl;
if ( fIsConvex)
{ os << " Convex polygon; list of vertices:" << G4endl; }
else
{ os << " Concave polygon; list of vertices:" << G4endl; }
for ( G4int i=0; i<fNv; ++i )
{
os << " vx = " << fPolygon[i].x()/mm << " mm"
<< " vy = " << fPolygon[i].y()/mm << " mm" << G4endl;
}
os << " Sections:" << G4endl;
for ( G4int iz=0; iz<fNz; ++iz )
{
os << " z = " << fZSections[iz].fZ/mm << " mm "
<< " x0= " << fZSections[iz].fOffset.x()/mm << " mm "
<< " y0= " << fZSections[iz].fOffset.y()/mm << " mm "
<< " scale= " << fZSections[iz].fScale << G4endl;
}
return os;
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4Polycone.cc,v 1.34 2006/11/15 10:40:38 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4Polycone.cc,v 1.37 2007/04/26 13:34:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
//
// --------------------------------------------------------------------
@@ -411,7 +411,7 @@ G4bool G4Polycone::Reset()
if (genericPcon)
{
G4cerr << "Solid " << GetName() << " built using generic construct."
<< G4endl << "Specify original parameters first !" << G4endl;
<< G4endl << "Not applicable to the generic construct !" << G4endl;
G4Exception("G4Polycone::Reset()", "NotApplicableConstruct",
JustWarning, "Parameters NOT resetted.");
return 1;
@@ -567,7 +567,7 @@ G4ThreeVector G4Polycone::GetPointOnCone(G4double fRmin1, G4double fRmax1,
G4double fRmin2, G4double fRmax2,
G4double zOne, G4double zTwo,
G4double& totArea) const
{
{
// declare working variables
//
G4double Aone, Atwo, Afive, phi, zRand, fDPhi, fSPhi, cosu, sinu;
@@ -576,12 +576,16 @@ G4ThreeVector G4Polycone::GetPointOnCone(G4double fRmin1, G4double fRmax1,
G4ThreeVector point, offset;
offset = G4ThreeVector(0.,0.,0.5*(zTwo+zOne));
fSPhi = startPhi; fDPhi = endPhi - startPhi;
rone = (fRmax1-fRmax2)/(2.*fDz);
rtwo = (fRmin1-fRmin2)/(2.*fDz);
qone = fDz*(fRmax1+fRmax2)/(fRmax1-fRmax2);
qtwo = fDz*(fRmin1+fRmin2)/(fRmin1-fRmin2);
if(fRmax1==fRmax2){qone=0.;}
else{
qone = fDz*(fRmax1+fRmax2)/(fRmax1-fRmax2);
}
if(fRmin1==fRmin2){qtwo=0.;}
else{
qtwo = fDz*(fRmin1+fRmin2)/(fRmin1-fRmin2);
}
Aone = 0.5*fDPhi*(fRmax2 + fRmax1)*(sqr(fRmin1-fRmin2)+sqr(zTwo-zOne));
Atwo = 0.5*fDPhi*(fRmin2 + fRmin1)*(sqr(fRmax1-fRmax2)+sqr(zTwo-zOne));
Afive = fDz*(fRmax1-fRmin1+fRmax2-fRmin2);
@@ -590,10 +594,10 @@ G4ThreeVector G4Polycone::GetPointOnCone(G4double fRmin1, G4double fRmax1,
phi = RandFlat::shoot(startPhi,endPhi);
cosu = std::cos(phi);
sinu = std::sin(phi);
if( (startPhi == 0) && (endPhi == twopi) ) { Afive = 0; }
chose = RandFlat::shoot(0.,Aone+Atwo+2.*Afive);
if( (chose >= 0) && (chose < Aone) )
{
if(fRmax1 != fRmax2)
@@ -601,25 +605,30 @@ G4ThreeVector G4Polycone::GetPointOnCone(G4double fRmin1, G4double fRmax1,
zRand = RandFlat::shoot(-1.*fDz,fDz);
point = G4ThreeVector (rone*cosu*(qone-zRand),
rone*sinu*(qone-zRand), zRand);
}
else
{
point = G4ThreeVector(fRmax1*cosu, fRmax1*sinu,
RandFlat::shoot(-1.*fDz,fDz));
}
}
else if(chose >= Aone && chose < Aone + Atwo)
{
if(fRmin1 != fRmin2)
{
{
zRand = RandFlat::shoot(-1.*fDz,fDz);
point = G4ThreeVector (rtwo*cosu*(qtwo-zRand),
rtwo*sinu*(qtwo-zRand), zRand);
}
else
{
point = G4ThreeVector(fRmin1*cosu, fRmin1*sinu,
RandFlat::shoot(-1.*fDz,fDz));
}
}
else if( (chose >= Aone + Atwo + Afive) && (chose < Aone + Atwo + 2.*Afive) )
@@ -629,6 +638,7 @@ G4ThreeVector G4Polycone::GetPointOnCone(G4double fRmin1, G4double fRmax1,
fRmax2-((zRand-fDz)/(2.*fDz))*(fRmax1-fRmax2));
point = G4ThreeVector (rRand1*std::cos(startPhi),
rRand1*std::sin(startPhi), zRand);
G4cout<<"Point3="<<point<<G4endl;
}
else
{
@@ -637,6 +647,7 @@ G4ThreeVector G4Polycone::GetPointOnCone(G4double fRmin1, G4double fRmax1,
fRmax2-((zRand-fDz)/(2.*fDz))*(fRmax1-fRmax2));
point = G4ThreeVector (rRand1*std::cos(endPhi),
rRand1*std::sin(endPhi), zRand);
}
return point+offset;
}
@@ -650,7 +661,7 @@ G4ThreeVector G4Polycone::GetPointOnCone(G4double fRmin1, G4double fRmax1,
G4ThreeVector G4Polycone::GetPointOnTubs(G4double fRMin, G4double fRMax,
G4double zOne, G4double zTwo,
G4double& totArea) const
{
{
G4double xRand,yRand,zRand,phi,cosphi,sinphi,chose,
aOne,aTwo,aFou,rRand,fDz,fSPhi,fDPhi;
fDz = std::fabs(0.5*(zTwo-zOne));
@@ -661,7 +672,6 @@ G4ThreeVector G4Polycone::GetPointOnTubs(G4double fRMin, G4double fRMax,
aTwo = 2.*fDz*fDPhi*fRMin;
aFou = 2.*fDz*(fRMax-fRMin);
totArea = aOne+aTwo+2.*aFou;
phi = RandFlat::shoot(startPhi,endPhi);
cosphi = std::cos(phi);
sinphi = std::sin(phi);
@@ -702,6 +712,50 @@ G4ThreeVector G4Polycone::GetPointOnTubs(G4double fRMin, G4double fRMax,
}
//
// GetPointOnRing
//
// Auxiliary method for GetPoint On Surface
//
G4ThreeVector G4Polycone::GetPointOnRing(G4double fRMin1, G4double fRMax1,
G4double fRMin2,G4double fRMax2,
G4double zOne) const
{
G4double xRand,yRand,phi,cosphi,sinphi,rRand1,rRand2,A1,Atot,rCh;
phi = RandFlat::shoot(startPhi,endPhi);
cosphi = std::cos(phi);
sinphi = std::sin(phi);
if(fRMin1==fRMin2)
{
rRand1 = fRMin1; A1=0.;
}
else
{
rRand1 = RandFlat::shoot(fRMin1,fRMin2);
A1=std::abs(fRMin2*fRMin2-fRMin1*fRMin1);
}
if(fRMax1==fRMax2)
{
rRand2=fRMax1; Atot=A1;
}
else
{
rRand2 = RandFlat::shoot(fRMax1,fRMax2);
Atot = A1+std::abs(fRMax2*fRMax2-fRMax1*fRMax1);
}
rCh = RandFlat::shoot(0.,Atot);
if(rCh>A1) { rRand1=rRand2; }
xRand = rRand1*cosphi;
yRand = rRand1*sinphi;
return G4ThreeVector(xRand, yRand, zOne);
}
//
// GetPointOnCut
//
@@ -711,12 +765,15 @@ G4ThreeVector G4Polycone::GetPointOnCut(G4double fRMin1, G4double fRMax1,
G4double fRMin2, G4double fRMax2,
G4double zOne, G4double zTwo,
G4double& totArea) const
{
if( (fRMin1 == fRMin2) && (fRMax1 == fRMax2) )
{
return GetPointOnTubs(fRMin1, fRMax1,zOne,zTwo,totArea);
}
return GetPointOnCone(fRMin1,fRMax1,fRMin2,fRMax2,zOne,zTwo,totArea);
{ if(zOne==zTwo)
{
return GetPointOnRing(fRMin1, fRMax1,fRMin2,fRMax2,zOne);
}
if( (fRMin1 == fRMin2) && (fRMax1 == fRMax2) )
{
return GetPointOnTubs(fRMin1, fRMax1,zOne,zTwo,totArea);
}
return GetPointOnCone(fRMin1,fRMax1,fRMin2,fRMax2,zOne,zTwo,totArea);
}
@@ -724,7 +781,7 @@ G4ThreeVector G4Polycone::GetPointOnCut(G4double fRMin1, G4double fRMax1,
// GetPointOnSurface
//
G4ThreeVector G4Polycone::GetPointOnSurface() const
{
{
G4double Area=0,totArea=0,Achose1=0,Achose2=0,phi,cosphi,sinphi,rRand;
G4int i=0;
G4int numPlanes = original_parameters->Num_z_planes;
@@ -788,7 +845,7 @@ G4ThreeVector G4Polycone::GetPointOnSurface() const
Achose1 += areas[i];
Achose2 = (Achose1+areas[i+1]);
if(chose>=Achose1 && chose<Achose2)
{
{// G4cout<<"will return Point On Cut"<<G4endl;
return GetPointOnCut(original_parameters->Rmin[i],
original_parameters->Rmax[i],
original_parameters->Rmin[i+1],
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4PolyconeSide.cc,v 1.13 2006/06/29 18:48:44 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4PolyconeSide.cc,v 1.14 2007/02/01 09:20:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
//
// --------------------------------------------------------------------
@@ -930,7 +930,10 @@ G4double G4PolyconeSide::DistanceAway( const G4ThreeVector &p,
G4double dist = d1*rx;
distOutside2 += dist*dist;
if (edgeRZnorm) *edgeRZnorm = std::max(*edgeRZnorm,std::fabs(dist));
if (edgeRZnorm)
{
*edgeRZnorm = std::max(std::fabs(*edgeRZnorm),std::fabs(dist));
}
}
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4Polyhedra.cc,v 1.32 2006/11/08 09:49:51 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4Polyhedra.cc,v 1.33 2007/01/22 12:58:53 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
//
// --------------------------------------------------------------------
@@ -100,7 +100,7 @@ G4Polyhedra::G4Polyhedra( const G4String& name,
//
G4double phiTotal = thePhiTotal;
if ( (phiTotal <=0) || (phiTotal >= twopi*(1-DBL_EPSILON)) )
phiTotal = twopi;
{ phiTotal = twopi; }
G4double convertRad = std::cos(0.5*phiTotal/theNumSide);
//
@@ -176,7 +176,7 @@ G4Polyhedra::G4Polyhedra( const G4String& name,
// Set original_parameters struct for consistency
//
SetOriginalParameters(); // In .icc; looks dodgy to me (J.Allison). Ignore.
SetOriginalParameters();
delete rz;
}
@@ -459,17 +459,17 @@ void G4Polyhedra::CopyStuff( const G4Polyhedra &source )
//
// Reset
//
// Recalculates and reshapes the solid, given pre-assigned
// Recalculates and reshapes the solid, given pre-assigned scaled
// original_parameters.
//
G4bool G4Polyhedra::Reset()
{
if (genericPgon)
{
G4cerr << "Solid " << GetName() << " built using generic construct."
<< G4endl << "Not applicable to the generic construct !" << G4endl;
G4Exception("G4Polyhedra::Reset()", "NotApplicableConstruct",
JustWarning, "Parameters NOT resetted.");
G4cerr << "Solid " << GetName() << " built using generic construct."
<< G4endl << "Specify original parameters first !" << G4endl;
return 1;
}
@@ -488,16 +488,8 @@ G4bool G4Polyhedra::Reset()
original_parameters->Rmax,
original_parameters->Z_values,
original_parameters->Num_z_planes );
//
// Calculate conversion factor
//
G4double phiTotal = original_parameters->Opening_angle;
if ( (phiTotal <=0) || (phiTotal >= twopi*(1-DBL_EPSILON)) )
phiTotal = twopi;
G4double convertRad = std::cos(0.5*phiTotal/original_parameters->numSide);
rz->ScaleA( 1/convertRad );
Create( original_parameters->Start_angle, phiTotal,
Create( original_parameters->Start_angle,
original_parameters->Opening_angle,
original_parameters->numSide, rz );
delete rz;
@@ -24,8 +24,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4QuadrangularFacet.cc,v 1.3 2006/06/29 18:48:51 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4QuadrangularFacet.cc,v 1.5 2007/02/15 17:04:10 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
@@ -48,6 +48,7 @@
#include "G4QuadrangularFacet.hh"
#include "globals.hh"
#include "Randomize.hh"
///////////////////////////////////////////////////////////////////////////////
//
@@ -255,8 +256,9 @@ G4bool G4QuadrangularFacet::Intersect (const G4ThreeVector &p,
G4bool intersect =
facet1->Intersect(p,v,outgoing,distance,distFromSurface,normal);
if (!intersect)
intersect =
facet2->Intersect(p,v,outgoing,distance,distFromSurface,normal);
{
intersect = facet2->Intersect(p,v,outgoing,distance,distFromSurface,normal);
}
if (!intersect)
{
@@ -267,3 +269,38 @@ G4bool G4QuadrangularFacet::Intersect (const G4ThreeVector &p,
return intersect;
}
////////////////////////////////////////////////////////////////////////
//
// GetPointOnFace
//
// Auxiliary method for get a random point on surface
G4ThreeVector G4QuadrangularFacet::GetPointOnFace() const
{
G4ThreeVector pr;
if ( G4UniformRand() < 0.5 )
{
pr = facet1->GetPointOnFace();
}
else
{
pr = facet2->GetPointOnFace();
}
return pr;
}
////////////////////////////////////////////////////////////////////////
//
// GetArea
//
// Auxiliary method for returning the surface area
G4double G4QuadrangularFacet::GetArea()
{
if (!area) { area = facet1->GetArea() + facet2->GetArea(); }
return area;
}
@@ -24,8 +24,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TessellatedSolid.cc,v 1.5 2006/10/20 13:45:21 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4TessellatedSolid.cc,v 1.9 2007/02/12 12:08:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
@@ -54,6 +54,7 @@
#include "G4TessellatedSolid.hh"
#include "G4PolyhedronArbitrary.hh"
#include "globals.hh"
#include "Randomize.hh"
#include <iostream>
@@ -123,14 +124,26 @@ G4TessellatedSolid::~G4TessellatedSolid ()
DeleteObjects ();
}
///////////////////////////////////////////////////////////////////////////////
//
// Define copy constructor.
//
G4TessellatedSolid::G4TessellatedSolid (const G4TessellatedSolid &s)
: G4VSolid(s)
{
if (&s == this) { return; }
CopyObjects (s);
}
///////////////////////////////////////////////////////////////////////////////
//
// Define assignment operator.
//
const G4TessellatedSolid &G4TessellatedSolid::operator=
(const G4TessellatedSolid &s)
const G4TessellatedSolid &
G4TessellatedSolid::operator= (const G4TessellatedSolid &s)
{
if (&s == this) return *this;
if (&s == this) { return *this; }
DeleteObjects ();
CopyObjects (s);
@@ -142,8 +155,10 @@ const G4TessellatedSolid &G4TessellatedSolid::operator=
//
void G4TessellatedSolid::DeleteObjects ()
{
for (std::vector<G4VFacet *>::iterator f=facets.begin();
f!=facets.end(); f++) delete *f;
for (std::vector<G4VFacet *>::iterator f=facets.begin(); f!=facets.end(); f++)
{
delete *f;
}
facets.clear();
}
@@ -321,6 +336,16 @@ size_t G4TessellatedSolid::GetNumberOfFacets () const
//
EInside G4TessellatedSolid::Inside (const G4ThreeVector &p) const
{
if ( p.x() < xMinExtent - kCarTolerance ||
p.x() > xMaxExtent + kCarTolerance ||
p.y() < yMinExtent - kCarTolerance ||
p.y() > yMaxExtent + kCarTolerance ||
p.z() < zMinExtent - kCarTolerance ||
p.z() > zMaxExtent + kCarTolerance )
{
return kOutside;
}
G4double minDist = kInfinity;
G4double dist = 0.0;
typedef std::multimap< G4double, FacetCI, std::less<G4double> > DistMapType;
@@ -372,6 +397,7 @@ G4ThreeVector G4TessellatedSolid::SurfaceNormal (const G4ThreeVector &p) const
FacetCI minFacet;
G4double minDist = kInfinity;
G4double dist = 0.0;
G4ThreeVector normal;
for (FacetCI f=facets.begin(); f!=facets.end(); f++)
{
@@ -383,7 +409,23 @@ G4ThreeVector G4TessellatedSolid::SurfaceNormal (const G4ThreeVector &p) const
}
}
return (*minFacet)->GetSurfaceNormal();
if (minDist != kInfinity)
{
normal = (*minFacet)->GetSurfaceNormal();
}
else
{
#ifdef G4VERBOSE
G4cout << "WARNING - G4TessellatedSolid::SurfaceNormal(p)" << G4endl
<< " No facets found for point: " << p << " !" << G4endl
<< " Returning approximated value for normal." << G4endl;
G4Exception("G4TessellatedSolid::SurfaceNormal(p)", "Notification",
JustWarning, "Point p is not on surface !?" );
#endif
normal = (p.z()>0 ? G4ThreeVector(0,0,1) : G4ThreeVector(0,0,-1));
}
return normal;
}
///////////////////////////////////////////////////////////////////////////////
@@ -747,7 +789,21 @@ G4double G4TessellatedSolid::GetCubicVolume ()
//
G4double G4TessellatedSolid::GetSurfaceArea ()
{
if(surfaceArea != 0.) {;}
else { surfaceArea = G4VSolid::GetSurfaceArea(); }
if(surfaceArea != 0.) { return surfaceArea; }
for (FacetI f=facets.begin(); f!=facets.end(); f++)
{
surfaceArea += (*f)->GetArea();
}
return surfaceArea;
}
///////////////////////////////////////////////////////////////////////////////
//
G4ThreeVector G4TessellatedSolid::GetPointOnSurface() const
{
// Select randomly a facet and return a random point on it
G4int i = CLHEP::RandFlat::shootInt(facets.size());
return facets[i]->GetPointOnFace();
}
@@ -24,8 +24,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TriangularFacet.cc,v 1.5 2006/06/29 18:49:02 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4TriangularFacet.cc,v 1.7 2007/02/15 17:03:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
@@ -48,6 +48,7 @@
#include "G4TriangularFacet.hh"
#include "globals.hh"
#include "Randomize.hh"
///////////////////////////////////////////////////////////////////////////////
//
@@ -451,8 +452,8 @@ G4bool G4TriangularFacet::Intersect (const G4ThreeVector &p,
if (intersect)
{
if (dist > kCarTolerance * 0.5) distance = dist;
else dist = 0.0;
if (dist < kCarTolerance * 0.5) { dist = 0.0; }
distance = dist;
distFromSurface = dist * normalComp;
normal = surfaceNormal;
}
@@ -465,3 +466,42 @@ G4bool G4TriangularFacet::Intersect (const G4ThreeVector &p,
return intersect;
}
////////////////////////////////////////////////////////////////////////
//
// GetPointOnFace
//
// Auxiliary method for get a random point on surface
G4ThreeVector G4TriangularFacet::GetPointOnFace() const
{
G4double lambda1,lambda2;
G4ThreeVector v, w;
v = P[1] - P[0];
w = P[0] - P0;
lambda1 = CLHEP::RandFlat::shoot(0.,1.);
lambda2 = CLHEP::RandFlat::shoot(0.,lambda1);
return (P0 + lambda1*w + lambda2*v);
}
////////////////////////////////////////////////////////////////////////
//
// GetArea
//
// Auxiliary method for returning the surface area
G4double G4TriangularFacet::GetArea()
{
if (area) { return area; }
G4ThreeVector v, w;
v = P[1] - P[0];
w = P[0] - P0;
area = 0.5*(v.cross(w)).mag();
return area;
}
@@ -24,8 +24,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VFacet.cc,v 1.3 2006/06/29 18:49:31 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4VFacet.cc,v 1.4 2007/02/12 09:34:45 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
//
@@ -49,6 +49,67 @@
#include "G4VFacet.hh"
#include "globals.hh"
///////////////////////////////////////////////////////////////////////////////
//
G4VFacet::G4VFacet ()
{
dirTolerance = 1.0E-14;
P.clear();
E.clear();
centroid = G4ThreeVector(0.0,0.0,0.0);
radius = 0.0;
radiusSqr = 0.0;
area = 0.0;
}
///////////////////////////////////////////////////////////////////////////////
//
G4VFacet::~G4VFacet ()
{
P.clear();
E.clear();
}
///////////////////////////////////////////////////////////////////////////////
//
G4bool G4VFacet::operator== (const G4VFacet &right) const
{
G4double tolerance = kCarTolerance*kCarTolerance/4.0;
if (nVertices != right.GetNumberOfVertices())
{ return false; }
else if ((centroid-right.GetCentroid()).mag2() > tolerance)
{ return false; }
else if (std::fabs((right.GetSurfaceNormal()).dot(surfaceNormal)) < 0.9999999999)
{ return false; }
G4bool coincident = true;
size_t i = 0;
do
{
coincident = false;
size_t j = 0;
do
{
coincident = (GetVertex(i)-right.GetVertex(j)).mag2() < tolerance;
} while (!coincident && j++ < nVertices);
} while (coincident && i++ < nVertices);
return coincident;
}
///////////////////////////////////////////////////////////////////////////////
//
void G4VFacet::ApplyTranslation(const G4ThreeVector v)
{
P0 += v;
for (G4ThreeVectorList::iterator it=P.begin(); it!=P.end(); it++)
{
(*it) += v;
}
}
///////////////////////////////////////////////////////////////////////////////
//
std::ostream &G4VFacet::StreamInfo(std::ostream &os) const
@@ -71,3 +132,31 @@ std::ostream &G4VFacet::StreamInfo(std::ostream &os) const
return os;
}
///////////////////////////////////////////////////////////////////////////////
//
G4VFacet* G4VFacet::GetClone ()
{return 0;}
///////////////////////////////////////////////////////////////////////////////
//
G4double G4VFacet::Distance (const G4ThreeVector&, const G4double)
{return kInfinity;}
///////////////////////////////////////////////////////////////////////////////
//
G4double G4VFacet::Distance (const G4ThreeVector&, const G4double,
const G4bool)
{return kInfinity;}
///////////////////////////////////////////////////////////////////////////////
//
G4double G4VFacet::Extent (const G4ThreeVector)
{return 0.0;}
///////////////////////////////////////////////////////////////////////////////
//
G4bool G4VFacet::Intersect (const G4ThreeVector&, const G4ThreeVector &,
const G4bool , G4double &, G4double &,
G4ThreeVector &)
{return false;}