Import Geant4 11.4.0 source tree
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
//
|
||||
// G4TwistBoxSide describes a twisted boundary surface for a trapezoid.
|
||||
|
||||
// Author: 27-Oct-2004 - O.Link (Oliver.Link@cern.ch)
|
||||
// Author: Oliver Link (CERN), 27.10.2004 - Created
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef G4TWISTBOXSIDE_HH
|
||||
#define G4TWISTBOXSIDE_HH
|
||||
@@ -38,15 +38,35 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
/**
|
||||
* @brief G4TwistBoxSide describes a twisted boundary surface for a trapezoid.
|
||||
*/
|
||||
|
||||
class G4TwistBoxSide : public G4VTwistSurface
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructs a trapezoid twisted boundary surface, given its parameters.
|
||||
* @param[in] name The surface name.
|
||||
* @param[in] PhiTwist The twist angle.
|
||||
* @param[in] pDz Half z length.
|
||||
* @param[in] pTheta Direction between end planes - polar angle.
|
||||
* @param[in] pPhi Direction between end planes - azimuthal angle.
|
||||
* @param[in] pDy1 Half y length at -pDz.
|
||||
* @param[in] pDx1 Half x length at -pDz,-pDy.
|
||||
* @param[in] pDx2 Half x length at -pDz,+pDy.
|
||||
* @param[in] pDy2 Half y length at +pDz.
|
||||
* @param[in] pDx3 Half x length at +pDz,-pDy.
|
||||
* @param[in] pDx4 Half x length at +pDz,+pDy.
|
||||
* @param[in] pAlph Tilt angle at +pDz.
|
||||
* @param[in] AngleSide Parity.
|
||||
*/
|
||||
G4TwistBoxSide(const G4String& name,
|
||||
G4double PhiTwist, // twist angle
|
||||
G4double pDz, // half z lenght
|
||||
G4double pDz, // half z length
|
||||
G4double pTheta, // direction between end planes
|
||||
G4double pPhi, // by polar and azimutal angles
|
||||
G4double pPhi, // by polar and azimuthal angles
|
||||
G4double pDy1, // half y length at -pDz
|
||||
G4double pDx1, // half x length at -pDz,-pDy
|
||||
G4double pDx2, // half x length at -pDz,+pDy
|
||||
@@ -57,48 +77,100 @@ class G4TwistBoxSide : public G4VTwistSurface
|
||||
G4double AngleSide // parity
|
||||
);
|
||||
|
||||
~G4TwistBoxSide() override;
|
||||
/**
|
||||
* Default destructor.
|
||||
*/
|
||||
~G4TwistBoxSide() override = default;
|
||||
|
||||
G4ThreeVector GetNormal(const G4ThreeVector& xx,
|
||||
G4bool isGlobal = false) override ;
|
||||
/**
|
||||
* Returns a normal vector at a surface (or very close to the surface)
|
||||
* point at 'p'.
|
||||
* @param[in] p The point where computing the normal.
|
||||
* @param[in] isGlobal If true, it returns the normal in global coordinates.
|
||||
* @returns The normal vector.
|
||||
*/
|
||||
G4ThreeVector GetNormal(const G4ThreeVector& p,
|
||||
G4bool isGlobal = false) override ;
|
||||
|
||||
/**
|
||||
* Returns the distance to surface, given point 'gp' and direction 'gv'.
|
||||
* @param[in] gp The point from where computing the distance.
|
||||
* @param[in] gv The direction along which computing the distance.
|
||||
* @param[out] gxx Vector of global points based on number of solutions.
|
||||
* @param[out] distance The distance vector based on number of solutions.
|
||||
* @param[out] areacode The location vector based on number of solutions.
|
||||
* @param[out] isvalid Validity vector based on number of solutions.
|
||||
* @param[in] validate Adopted validation criteria.
|
||||
* @returns The number of solutions.
|
||||
*/
|
||||
G4int DistanceToSurface(const G4ThreeVector& gp,
|
||||
const G4ThreeVector& gv,
|
||||
G4ThreeVector gxx[],
|
||||
G4double distance[],
|
||||
G4int areacode[],
|
||||
G4bool isvalid[],
|
||||
G4ThreeVector gxx[],
|
||||
G4double distance[],
|
||||
G4int areacode[],
|
||||
G4bool isvalid[],
|
||||
EValidate validate = kValidateWithTol) override;
|
||||
|
||||
/**
|
||||
* Returns the safety distance to surface, given point 'gp'.
|
||||
* @param[in] gp The point from where computing the safety distance.
|
||||
* @param[out] gxx Vector of global points based on number of solutions.
|
||||
* @param[out] distance The distance vector based on number of solutions.
|
||||
* @param[out] areacode The location vector based on number of solutions.
|
||||
* @returns The number of solutions.
|
||||
*/
|
||||
G4int DistanceToSurface(const G4ThreeVector& gp,
|
||||
G4ThreeVector gxx[],
|
||||
G4double distance[],
|
||||
G4int areacode[]) override;
|
||||
G4ThreeVector gxx[],
|
||||
G4double distance[],
|
||||
G4int areacode[]) override;
|
||||
|
||||
/**
|
||||
* Fake default constructor for usage restricted to direct object
|
||||
* persistency for clients requiring preallocation of memory for
|
||||
* persistifiable objects.
|
||||
*/
|
||||
G4TwistBoxSide(__void__&);
|
||||
// Fake default constructor for usage restricted to direct object
|
||||
// persistency for clients requiring preallocation of memory for
|
||||
// persistifiable objects.
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Returns the area code for point 'xx' using or not surface tolerance.
|
||||
*/
|
||||
G4int GetAreaCode(const G4ThreeVector& xx,
|
||||
G4bool withTol = true) override;
|
||||
|
||||
/**
|
||||
* Setters.
|
||||
*/
|
||||
void SetCorners() override;
|
||||
void SetBoundaries() override;
|
||||
|
||||
/**
|
||||
* Finds the closest point on surface for a given point 'p', returning
|
||||
* 'phi' and 'u'.
|
||||
*/
|
||||
void GetPhiUAtX(const G4ThreeVector& p, G4double& phi, G4double& u);
|
||||
|
||||
/**
|
||||
* Returns projection on surface of a given point 'p'.
|
||||
*/
|
||||
G4ThreeVector ProjectPoint(const G4ThreeVector& p,
|
||||
G4bool isglobal = false);
|
||||
|
||||
/**
|
||||
* Returns point on surface given 'phi' and 'u'.
|
||||
*/
|
||||
inline G4ThreeVector SurfacePoint(G4double phi, G4double u,
|
||||
G4bool isGlobal = false) override;
|
||||
|
||||
/**
|
||||
* Internal accessors.
|
||||
*/
|
||||
inline G4double GetBoundaryMin(G4double phi) override;
|
||||
inline G4double GetBoundaryMax(G4double phi) override;
|
||||
inline G4double GetSurfaceArea() override;
|
||||
void GetFacets( G4int m, G4int n, G4double xyz[][3],
|
||||
G4int faces[][4], G4int iside ) override;
|
||||
|
||||
inline G4double GetValueA(G4double phi);
|
||||
inline G4double GetValueB(G4double phi);
|
||||
inline G4ThreeVector NormAng(G4double phi, G4double u);
|
||||
@@ -144,77 +216,6 @@ class G4TwistBoxSide : public G4VTwistSurface
|
||||
// inline functions
|
||||
//========================================================
|
||||
|
||||
inline
|
||||
G4double G4TwistBoxSide::GetValueA(G4double phi)
|
||||
{
|
||||
return ( fDx4plus2 + fDx4minus2 * ( 2 * phi ) / fPhiTwist ) ;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
G4double G4TwistBoxSide::GetValueB(G4double phi)
|
||||
{
|
||||
return ( fDy2plus1 + fDy2minus1 * ( 2 * phi ) / fPhiTwist ) ;
|
||||
}
|
||||
|
||||
inline
|
||||
G4double G4TwistBoxSide::Xcoef(G4double u, G4double phi)
|
||||
{
|
||||
|
||||
return GetValueA(phi)/2. + u*fTAlph ;
|
||||
|
||||
}
|
||||
|
||||
inline G4ThreeVector
|
||||
G4TwistBoxSide::SurfacePoint( G4double phi, G4double u, G4bool isGlobal )
|
||||
{
|
||||
// function to calculate a point on the surface, given by parameters phi,u
|
||||
|
||||
G4ThreeVector SurfPoint ( Xcoef(u,phi) * std::cos(phi)
|
||||
- u * std::sin(phi) + fdeltaX*phi/fPhiTwist,
|
||||
Xcoef(u,phi) * std::sin(phi)
|
||||
+ u * std::cos(phi) + fdeltaY*phi/fPhiTwist,
|
||||
2*fDz*phi/fPhiTwist );
|
||||
|
||||
if (isGlobal) { return (fRot * SurfPoint + fTrans); }
|
||||
return SurfPoint;
|
||||
}
|
||||
|
||||
inline
|
||||
G4double G4TwistBoxSide::GetBoundaryMin(G4double phi)
|
||||
{
|
||||
return -0.5*GetValueB(phi) ;
|
||||
}
|
||||
|
||||
inline
|
||||
G4double G4TwistBoxSide::GetBoundaryMax(G4double phi)
|
||||
{
|
||||
return 0.5*GetValueB(phi) ;
|
||||
}
|
||||
|
||||
inline
|
||||
G4double G4TwistBoxSide::GetSurfaceArea()
|
||||
{
|
||||
return (fDz*(std::sqrt(16*fDy1*fDy1
|
||||
+ (fa1md1 + 4*fDy1*fTAlph)*(fa1md1 + 4*fDy1*fTAlph))
|
||||
+ std::sqrt(16*fDy1*fDy1 + (fa2md2 + 4*fDy1*fTAlph)
|
||||
* (fa2md2 + 4*fDy1*fTAlph))))/2. ;
|
||||
}
|
||||
|
||||
inline
|
||||
G4ThreeVector G4TwistBoxSide::NormAng( G4double phi, G4double u )
|
||||
{
|
||||
// function to calculate the norm at a given point on the surface
|
||||
// replace a1-d1
|
||||
|
||||
G4ThreeVector nvec( 4*fDz*(std::cos(phi) + fTAlph*std::sin(phi)) ,
|
||||
4*fDz*(-(fTAlph*std::cos(phi)) + std::sin(phi)),
|
||||
(fDx2 + fDx4)*fPhiTwist*fTAlph
|
||||
+ 2*fDx4minus2*(-1 + fTAlph*phi)
|
||||
+ 2*fPhiTwist*(1 + fTAlph*fTAlph)*u
|
||||
- 2*(fdeltaX - fdeltaY*fTAlph)*std::cos(phi)
|
||||
- 2*(fdeltaY + fdeltaX*fTAlph)*std::sin(phi) );
|
||||
return nvec.unit();
|
||||
}
|
||||
#include "G4TwistBoxSide.icc"
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user