Import Geant4 11.1.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2022-07-01 10:44:02 +02:00
parent b3bf75a2a1
commit c07cea1fe0
2172 changed files with 183300 additions and 123938 deletions
@@ -75,6 +75,7 @@ class G4ExtrudedSolid : public G4TessellatedSolid
struct ZSection
{
ZSection() : fZ(0.), fOffset(0.,0.), fScale(1.) {}
ZSection(G4double z, const G4TwoVector& offset, G4double scale)
: fZ(z), fOffset(offset), fScale(scale) {}
@@ -93,8 +94,10 @@ class G4ExtrudedSolid : public G4TessellatedSolid
G4ExtrudedSolid( const G4String& pName,
const std::vector<G4TwoVector>& polygon,
G4double halfZ,
const G4TwoVector& off1, G4double scale1,
const G4TwoVector& off2, G4double scale2 );
const G4TwoVector& off1 = G4TwoVector(0.,0.),
G4double scale1 = 1.,
const G4TwoVector& off2 = G4TwoVector(0.,0.),
G4double scale2 = 1. );
// Special constructor for solid with 2 z-sections
virtual ~G4ExtrudedSolid();
@@ -181,18 +181,8 @@ class G4GenericTrap : public G4VSolid
G4ThreeVector NormalToPlane(const G4ThreeVector& p,
const G4int ipl) const;
G4double SafetyToFace(const G4ThreeVector& p, const G4int iseg) const;
G4double GetFaceSurfaceArea(const G4ThreeVector& p0,
const G4ThreeVector& p1,
const G4ThreeVector& p2,
const G4ThreeVector& p3) const;
G4double GetTwistedFaceSurfaceArea(const G4ThreeVector& p0,
const G4ThreeVector& p1,
const G4ThreeVector& p2,
const G4ThreeVector& p3) const;
G4double GetFaceCubicVolume(const G4ThreeVector& p0,
const G4ThreeVector& p1,
const G4ThreeVector& p2,
const G4ThreeVector& p3) const;
G4double GetLateralFaceArea(G4int iface) const;
protected:
mutable G4bool fRebuildPolyhedron = false;
@@ -28,12 +28,12 @@
// Class description:
//
// A G4TwistedBox is a twisted cuboid of given half lengths pDx,pDy,pDz
// and twist angle pPhiTwist.
// and twist angle pPhiTwist.
// The Box is centred on the origin with sides parallel to the x/y/z axes.
//
// Member Data:
//
// pDx Half-length along x axis
// pDx Half-length along x axis
// pDy Half-length along y asis
// pDz Half-length along z axis
// pPhiTwist Twist angle
@@ -52,7 +52,7 @@ class G4TwistedBox : public G4VTwistedFaceted
G4TwistedBox(const G4String& pName,
G4double pPhiTwist,
G4double pDx,
G4double pDy,
G4double pDy,
G4double pDz );
virtual ~G4TwistedBox();
@@ -66,6 +66,9 @@ class G4TwistedBox : public G4VTwistedFaceted
G4GeometryType GetEntityType() const;
G4double GetCubicVolume();
G4double GetSurfaceArea();
G4VSolid* Clone() const;
std::ostream& StreamInfo(std::ostream& os) const;
@@ -78,7 +81,7 @@ class G4TwistedBox : public G4VTwistedFaceted
// persistifiable objects.
G4TwistedBox(const G4TwistedBox& rhs);
G4TwistedBox& operator=(const G4TwistedBox& rhs);
G4TwistedBox& operator=(const G4TwistedBox& rhs);
// Copy constructor and assignment operator.
};
@@ -27,9 +27,9 @@
//
// Class description:
//
// A G4TwistedTrd is a twisted trapezoid with the x and y dimensions
// varying along z
//
// A G4TwistedTrd is a twisted trapezoid with the x and y dimensions
// varying along z
//
//
// Member Data:
//
@@ -54,7 +54,7 @@ class G4TwistedTrd : public G4VTwistedFaceted
G4TwistedTrd( const G4String& pName,
G4double pDx1,
G4double pDx2,
G4double pDy1,
G4double pDy1,
G4double pDy2,
G4double pDz,
G4double pPhiTwist );
@@ -72,6 +72,9 @@ class G4TwistedTrd : public G4VTwistedFaceted
G4GeometryType GetEntityType() const;
G4double GetCubicVolume();
G4double GetSurfaceArea();
G4VSolid* Clone() const;
std::ostream& StreamInfo(std::ostream& os) const;
@@ -84,7 +87,7 @@ class G4TwistedTrd : public G4VTwistedFaceted
// persistifiable objects.
G4TwistedTrd(const G4TwistedTrd& rhs);
G4TwistedTrd& operator=(const G4TwistedTrd& rhs);
G4TwistedTrd& operator=(const G4TwistedTrd& rhs);
// Copy constructor and assignment operator.
} ;
@@ -162,8 +162,8 @@ class G4TwistedTubs : public G4VSolid
// Returns an estimation of the geometrical cubic volume of the
// solid. Caches the computed value once computed the first time.
G4double GetSurfaceArea();
// Returns an estimation of the geometrical surface area of the
// solid. Caches the computed value once computed the first time.
// Returns the geometrical surface area of the solid.
// Caches the computed value once computed the first time.
G4ThreeVector GetPointOnSurface() const ;
@@ -184,11 +184,12 @@ class G4TwistedTubs : public G4VSolid
private:
inline void SetFields(G4double phitwist, G4double innerrad,
G4double outerrad,
G4double negativeEndz, G4double positiveEndz);
inline void SetFields(G4double phitwist, G4double innerrad,
G4double outerrad,
G4double negativeEndz, G4double positiveEndz);
void CreateSurfaces();
G4double GetLateralArea(G4double a, G4double r, G4double z) const;
G4double GetPhiCutArea(G4double a, G4double r, G4double z) const;
private:
@@ -52,6 +52,7 @@ class G4UExtrudedSolid : public G4UAdapter<vecgeom::UnplacedExtruded>
struct ZSection
{
ZSection() : fZ(0.), fOffset(0.,0.), fScale(1.) {}
ZSection(G4double z, G4TwoVector offset, G4double scale)
: fZ(z), fOffset(offset), fScale(scale) {}
@@ -70,8 +71,10 @@ class G4UExtrudedSolid : public G4UAdapter<vecgeom::UnplacedExtruded>
G4UExtrudedSolid(const G4String& pName,
const std::vector<G4TwoVector>& polygon,
G4double halfZ,
const G4TwoVector& off1, G4double scale1,
const G4TwoVector& off2, G4double scale2);
const G4TwoVector& off1 = G4TwoVector(0.,0.),
G4double scale1 = 1.,
const G4TwoVector& off2 = G4TwoVector(0.,0.),
G4double scale2 = 1. );
// Special constructor for solid with 2 z-sections
~G4UExtrudedSolid();
@@ -36,10 +36,11 @@
#define G4VTWISTEDFACETED_HH
#include "G4VSolid.hh"
#include "G4TwoVector.hh"
#include "G4TwistTrapAlphaSide.hh"
#include "G4TwistTrapParallelSide.hh"
#include "G4TwistBoxSide.hh"
#include "G4TwistTrapFlatSide.hh"
#include "G4TwistTrapFlatSide.hh"
class G4SolidExtentList;
class G4ClippablePolygon;
@@ -47,7 +48,7 @@ class G4ClippablePolygon;
class G4VTwistedFaceted: public G4VSolid
{
public: // with description
G4VTwistedFaceted(const G4String& pname, // Name of instance
G4double PhiTwist, // twist angle
G4double pDz, // half z lenght
@@ -61,13 +62,13 @@ class G4VTwistedFaceted: public G4VSolid
G4double pDx4, // half x length at +pDz,+pDy
G4double pAlph // tilt angle at +pDz
);
virtual ~G4VTwistedFaceted();
virtual void ComputeDimensions(G4VPVParameterisation*,
const G4int,
const G4VPhysicalVolume* );
virtual void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const;
virtual G4bool CalculateExtent(const EAxis pAxis,
@@ -80,24 +81,24 @@ class G4VTwistedFaceted: public G4VSolid
const G4ThreeVector& v ) const;
virtual G4double DistanceToIn (const G4ThreeVector& p ) const;
virtual G4double DistanceToOut(const G4ThreeVector& p,
virtual G4double DistanceToOut(const G4ThreeVector& p,
const G4ThreeVector& v,
const G4bool calcnorm = false,
G4bool* validnorm = nullptr,
G4bool* validnorm = nullptr,
G4ThreeVector* n = nullptr ) const;
virtual G4double DistanceToOut(const G4ThreeVector& p) const;
virtual EInside Inside (const G4ThreeVector& p) const;
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector& p) const;
G4ThreeVector GetPointOnSurface() const;
G4ThreeVector GetPointInSolid(G4double z) const;
virtual inline G4double GetCubicVolume();
virtual inline G4double GetSurfaceArea();
virtual G4double GetCubicVolume();
virtual G4double GetSurfaceArea();
virtual void DescribeYourselfTo (G4VGraphicsScene& scene) const;
virtual G4Polyhedron* CreatePolyhedron () const;
@@ -106,15 +107,15 @@ class G4VTwistedFaceted: public G4VSolid
virtual std::ostream &StreamInfo(std::ostream& os) const;
// accessors
inline G4double GetTwistAngle() const { return fPhiTwist; }
inline G4double GetDx1 () const { return fDx1 ; }
inline G4double GetDx2 () const { return fDx2 ; }
inline G4double GetDx3 () const { return fDx3 ; }
inline G4double GetDx4 () const { return fDx4 ; }
inline G4double GetDy1 () const { return fDy1 ; }
inline G4double GetDy2 () const { return fDy2 ; }
inline G4double GetDx1 () const { return fDx1 ; }
inline G4double GetDx2 () const { return fDx2 ; }
inline G4double GetDx3 () const { return fDx3 ; }
inline G4double GetDx4 () const { return fDx4 ; }
inline G4double GetDy1 () const { return fDy1 ; }
inline G4double GetDy2 () const { return fDy2 ; }
inline G4double GetDz () const { return fDz ; }
inline G4double GetPhi () const { return fPhi ; }
inline G4double GetTheta () const { return fTheta ; }
@@ -138,7 +139,7 @@ class G4VTwistedFaceted: public G4VSolid
// persistifiable objects.
G4VTwistedFaceted(const G4VTwistedFaceted& rhs);
G4VTwistedFaceted& operator=(const G4VTwistedFaceted& rhs);
G4VTwistedFaceted& operator=(const G4VTwistedFaceted& rhs);
// Copy constructor and assignment operator.
protected: // with description
@@ -147,25 +148,29 @@ class G4VTwistedFaceted: public G4VSolid
mutable G4Polyhedron* fpPolyhedron = nullptr; // polyhedron for vis
private:
double GetLateralFaceArea(const G4TwoVector& p1,
const G4TwoVector& p2,
const G4TwoVector& p3,
const G4TwoVector& p4) const;
void CreateSurfaces();
private:
G4double fTheta;
G4double fTheta;
G4double fPhi ;
G4double fDy1;
G4double fDx1;
G4double fDx2;
G4double fDy2;
G4double fDx3;
G4double fDx4;
G4double fDy1;
G4double fDx1;
G4double fDx2;
G4double fDy2;
G4double fDx3;
G4double fDx4;
G4double fDz; // Half-length along the z axis
G4double fDx ; // maximum side in x
G4double fDx ; // maximum side in x
G4double fDy ; // maximum side in y
G4double fAlph ;
@@ -173,20 +178,24 @@ class G4VTwistedFaceted: public G4VSolid
G4double fdeltaX ;
G4double fdeltaY ;
G4double fPhiTwist; // twist angle ( dphi in surface equation)
G4VTwistSurface* fLowerEndcap ; // surface of -ve z
G4VTwistSurface* fUpperEndcap ; // surface of +ve z
G4VTwistSurface* fSide0 ; // Twisted Side at phi = 0 deg
G4VTwistSurface* fSide90 ; // Twisted Side at phi = 90 deg
G4VTwistSurface* fSide180 ; // Twisted Side at phi = 180 deg
G4VTwistSurface* fSide270 ; // Twisted Side at phi = 270 deg
protected:
G4double fCubicVolume = 0.0; // volume of the solid
G4double fSurfaceArea = 0.0; // area of the solid
private:
class LastState // last Inside result
{
public:
@@ -206,7 +215,7 @@ class G4VTwistedFaceted: public G4VSolid
G4ThreeVector p;
EInside inside;
};
class LastVector // last SurfaceNormal result
{
public:
@@ -259,7 +268,7 @@ class G4VTwistedFaceted: public G4VSolid
G4ThreeVector p;
G4double value;
};
class LastValueWithDoubleVector // last G4double value
{
public:
@@ -283,7 +292,7 @@ class G4VTwistedFaceted: public G4VSolid
G4ThreeVector vec;
G4double value;
};
LastState fLastInside;
LastVector fLastNormal;
LastValue fLastDistanceToIn;
@@ -294,25 +303,6 @@ class G4VTwistedFaceted: public G4VSolid
//=====================================================================
inline
G4double G4VTwistedFaceted::GetCubicVolume()
{
if(fCubicVolume == 0.)
{
fCubicVolume = ((fDx1 + fDx2 + fDx3 + fDx4)*(fDy1 + fDy2) +
(fDx4 + fDx3 - fDx2 - fDx1)*(fDy2 - fDy1)/3)*fDz;
}
return fCubicVolume;
}
inline
G4double G4VTwistedFaceted::GetSurfaceArea()
{
if(fSurfaceArea != 0.) ;
else fSurfaceArea = G4VSolid::GetSurfaceArea();
return fSurfaceArea;
}
inline
G4double G4VTwistedFaceted::GetValueA(G4double phi) const
{
@@ -323,18 +313,18 @@ inline
G4double G4VTwistedFaceted::GetValueD(G4double phi) const
{
return ( fDx3 + fDx1 + ( fDx3 - fDx1 ) * ( 2 * phi ) / fPhiTwist ) ;
}
}
inline
inline
G4double G4VTwistedFaceted::GetValueB(G4double phi) const
{
return ( fDy2 + fDy1 + ( fDy2 - fDy1 ) * ( 2 * phi ) / fPhiTwist ) ;
}
inline
G4double G4VTwistedFaceted::Xcoef(G4double u, G4double phi, G4double ftg) const
G4double G4VTwistedFaceted::Xcoef(G4double u, G4double phi, G4double ftg) const
{
return GetValueA(phi)/2. + (GetValueD(phi)-GetValueA(phi))/4.
return GetValueA(phi)/2. + (GetValueD(phi)-GetValueA(phi))/4.
- u*( ( GetValueD(phi)-GetValueA(phi) ) / ( 2 * GetValueB(phi) ) - ftg );
}