Import Geant4 7.1.0 source tree
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ClippablePolygon.hh,v 1.9 2003/11/03 18:39:54 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ClippablePolygon.icc,v 1.3 2001/07/11 10:00:14 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 inline definitions file
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4EllipticalTube.hh,v 1.13 2004/10/10 10:39:11 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4EllipticalTube.icc,v 1.3 2004/10/10 10:39:16 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 inline definitions file
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4EnclosingCylinder.hh,v 1.6 2003/11/03 18:39:54 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4FlatBoxSide.hh,v 1.2 2004/11/13 18:26:24 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
//
|
||||
// G4FlatSurface
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// Class describing a flat boundary surface for a box.
|
||||
|
||||
// Author:
|
||||
//
|
||||
// 27-Oct-2004 - O.Link (Oliver.Link@cern.ch)
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#ifndef __G4FLATBOXSIDE__
|
||||
#define __G4FLATBOXSIDE__
|
||||
|
||||
#include "G4VSurface.hh"
|
||||
|
||||
class G4FlatBoxSide : public G4VSurface
|
||||
{
|
||||
public: // with description
|
||||
|
||||
G4FlatBoxSide( const G4String& name,
|
||||
G4double PhiTwist,
|
||||
G4double pDx,
|
||||
G4double pDy,
|
||||
G4double pDz,
|
||||
G4int handedness );
|
||||
virtual ~G4FlatBoxSide();
|
||||
|
||||
virtual G4ThreeVector GetNormal(const G4ThreeVector & /* xx */ ,
|
||||
G4bool isGlobal = false);
|
||||
virtual G4int DistanceToSurface(const G4ThreeVector &gp,
|
||||
const G4ThreeVector &gv,
|
||||
G4ThreeVector gxx[],
|
||||
G4double distance[],
|
||||
G4int areacode[],
|
||||
G4bool isvalid[],
|
||||
EValidate validate=kValidateWithTol);
|
||||
|
||||
virtual G4int DistanceToSurface(const G4ThreeVector &gp,
|
||||
G4ThreeVector gxx[],
|
||||
G4double distance[],
|
||||
G4int areacode[]);
|
||||
|
||||
protected: // with description
|
||||
|
||||
virtual G4int GetAreaCode(const G4ThreeVector &xx,
|
||||
G4bool withTol = true) ;
|
||||
|
||||
private:
|
||||
|
||||
virtual void SetCorners();
|
||||
virtual void SetBoundaries();
|
||||
|
||||
private:
|
||||
|
||||
G4double fDx ;
|
||||
G4double fDy ;
|
||||
G4double fDz ;
|
||||
G4double fPhiTwist ;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4FlatSurface.hh,v 1.6 2004/11/13 18:26:24 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4FlatTrapSide.hh,v 1.3 2004/11/13 18:26:24 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// $Id: G4FlatTrapSide.hh,v 1.4 2005/03/11 16:03:57 link Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
@@ -55,6 +55,9 @@ class G4FlatTrapSide : public G4VSurface
|
||||
G4double pDx2,
|
||||
G4double pDy,
|
||||
G4double pDz,
|
||||
G4double pAlpha,
|
||||
G4double pPhi,
|
||||
G4double pTheta,
|
||||
G4int handedness );
|
||||
virtual ~G4FlatTrapSide();
|
||||
|
||||
@@ -83,6 +86,8 @@ class G4FlatTrapSide : public G4VSurface
|
||||
virtual void SetCorners();
|
||||
virtual void SetBoundaries();
|
||||
|
||||
inline double xAxisMax(G4double u, G4double fTanAlpha) const ;
|
||||
|
||||
private:
|
||||
|
||||
G4double fDx1 ;
|
||||
@@ -90,6 +95,21 @@ class G4FlatTrapSide : public G4VSurface
|
||||
G4double fDy ;
|
||||
G4double fDz ;
|
||||
G4double fPhiTwist ;
|
||||
G4double fAlpha ;
|
||||
G4double fTAlph ;
|
||||
G4double fPhi ;
|
||||
G4double fTheta ;
|
||||
G4double fdeltaX ;
|
||||
G4double fdeltaY ;
|
||||
|
||||
};
|
||||
|
||||
|
||||
inline
|
||||
G4double G4FlatTrapSide::xAxisMax(G4double u, G4double fTanAlpha) const
|
||||
{
|
||||
return ( ( fDx2 + fDx1 )/2. + u*(fDx2 - fDx1)/(2.*fDy) - u *fTanAlpha ) ;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
//
|
||||
// $Id: G4Hype.hh,v 1.9 2004/10/10 10:39:19 johna Exp $
|
||||
// $Original: G4Hype.hh,v 1.0 1998/06/09 16:57:50 safai Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Hype.icc,v 1.6 2004/12/02 09:31:30 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 inline definitions file
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4HyperbolicSurface.hh,v 1.7 2004/12/02 09:31:30 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4IntersectingCone.hh,v 1.7 2004/12/02 09:31:30 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4PolyPhiFace.hh,v 1.5 2002/10/28 11:47:50 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4PolyPhiFace.icc,v 1.5 2004/12/02 09:31:30 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Polycone.hh,v 1.12 2003/11/05 17:41:24 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Polycone.icc,v 1.6 2004/10/10 10:39:27 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 inline definitions file
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4PolyconeSide.hh,v 1.5 2002/10/28 11:47:50 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Polyhedra.hh,v 1.11 2003/11/05 17:41:24 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Polyhedra.icc,v 1.6 2004/10/10 10:39:32 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 inline definitions file
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4PolyhedraSide.hh,v 1.5 2002/10/28 11:47:51 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4ReduciblePolygon.hh,v 1.6 2003/11/03 18:39:55 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4SolidExtentList.hh,v 1.6 2003/11/03 18:39:55 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4TwistedBox.hh,v 1.3 2004/11/13 18:26:24 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// $Id: G4TwistedBox.hh,v 1.5 2005/04/04 11:56:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
@@ -33,211 +33,51 @@
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// G4TwistedBox is a box twisted along the Z axis.
|
||||
// A G4TwistedBox is a twisted cuboid of given half lengths pDx,pDy,pDz
|
||||
// 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
|
||||
// pDy Half-length along y asis
|
||||
// pDz Half-length along z axis
|
||||
// pPhiTwist Twist angle
|
||||
|
||||
// Author:
|
||||
// O.Link (Oliver.Link@cern.ch)
|
||||
//
|
||||
// Oliver Link (Oliver.Link@cern.ch)
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef __G4TWISTEDBOX__
|
||||
#define __G4TWISTEDBOX__
|
||||
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4TwistedBoxSide.hh"
|
||||
#include "G4FlatBoxSide.hh"
|
||||
#include "G4VTwistedFaceted.hh"
|
||||
|
||||
|
||||
class G4SolidExtentList;
|
||||
class G4ClippablePolygon;
|
||||
|
||||
class G4TwistedBox : public G4VSolid
|
||||
class G4TwistedBox : public G4VTwistedFaceted
|
||||
{
|
||||
public: // with description
|
||||
|
||||
G4TwistedBox(const G4String &pname, // Name of instance
|
||||
G4double twistedangle, // Twisted angle
|
||||
G4double pDx, // half length in x
|
||||
G4double pDy, // half length in y
|
||||
G4double pDz) ; // half z length
|
||||
|
||||
public: // with description
|
||||
|
||||
G4TwistedBox(const G4String& pName,
|
||||
G4double pPhiTwist,
|
||||
G4double pDx,
|
||||
G4double pDy,
|
||||
G4double pDz );
|
||||
|
||||
virtual ~G4TwistedBox();
|
||||
|
||||
void ComputeDimensions(G4VPVParameterisation* ,
|
||||
const G4int ,
|
||||
const G4VPhysicalVolume* );
|
||||
|
||||
G4bool CalculateExtent(const EAxis pAxis,
|
||||
const G4VoxelLimits &pVoxelLimit,
|
||||
const G4AffineTransform &pTransform,
|
||||
G4double &pMin,
|
||||
G4double &pMax ) const;
|
||||
|
||||
G4double DistanceToIn (const G4ThreeVector &p,
|
||||
const G4ThreeVector &v ) const;
|
||||
|
||||
G4double DistanceToIn (const G4ThreeVector &p ) const;
|
||||
|
||||
G4double DistanceToOut(const G4ThreeVector &p,
|
||||
const G4ThreeVector &v,
|
||||
const G4bool calcnorm=G4bool(false),
|
||||
G4bool *validnorm=0,
|
||||
G4ThreeVector *n=0 ) const;
|
||||
|
||||
G4double DistanceToOut(const G4ThreeVector &p) const;
|
||||
|
||||
EInside Inside (const G4ThreeVector &p) const;
|
||||
|
||||
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const;
|
||||
|
||||
inline G4double GetCubicVolume() ;
|
||||
|
||||
void DescribeYourselfTo (G4VGraphicsScene &scene) const;
|
||||
G4Polyhedron *CreatePolyhedron () const;
|
||||
G4NURBS *CreateNURBS () const;
|
||||
|
||||
std::ostream &StreamInfo(std::ostream& os) const;
|
||||
|
||||
// accessors
|
||||
|
||||
inline G4double GetPhiTwist () const { return fPhiTwist ; }
|
||||
|
||||
inline G4double GetXHalfLength() const { return GetDx1() ; }
|
||||
inline G4double GetYHalfLength() const { return GetDy1() ; }
|
||||
inline G4double GetZHalfLength() const { return GetDz() ; }
|
||||
inline G4double GetPhiTwist() const { return GetTwistAngle() ; }
|
||||
|
||||
inline G4double GetfDx () const { return fDx ; }
|
||||
inline G4double GetfDy () const { return fDy ; }
|
||||
inline G4double GetfDz () const { return fDz ; }
|
||||
|
||||
G4VisExtent GetExtent () const;
|
||||
G4GeometryType GetEntityType() const;
|
||||
G4GeometryType GetEntityType() const;
|
||||
G4Polyhedron* CreatePolyhedron() const;
|
||||
|
||||
protected: // with description
|
||||
|
||||
G4ThreeVectorList*
|
||||
CreateRotatedVertices(const G4AffineTransform& pTransform) const;
|
||||
// Create the List of transformed vertices in the format required
|
||||
// for G4VSolid:: ClipCrossSection and ClipBetweenSections.
|
||||
|
||||
public: // without description
|
||||
|
||||
private:
|
||||
|
||||
inline void SetFields(G4double phitwist,
|
||||
G4double pDx, G4double pDy, G4double pDz);
|
||||
void CreateSurfaces();
|
||||
|
||||
private:
|
||||
|
||||
G4double fPhiTwist; // Twist angle from -fDz to +fDz
|
||||
|
||||
G4double fDx ;
|
||||
G4double fDy ;
|
||||
G4double fDz ;
|
||||
|
||||
G4VSurface *fLowerEndcap ; // surface of -ve z
|
||||
G4VSurface *fUpperEndcap ; // surface of +ve z
|
||||
|
||||
G4VSurface *fSide0 ; // Twisted Side at phi = 0 deg
|
||||
G4VSurface *fSide90 ; // Twisted Side at phi = 90 deg
|
||||
G4VSurface *fSide180 ; // Twisted Side at phi = 180 deg
|
||||
G4VSurface *fSide270 ; // Twisted Side at phi = 270 deg
|
||||
|
||||
G4double fCubicVolume ; // volume of the twisted trapezoid
|
||||
|
||||
class LastState // last Inside result
|
||||
{
|
||||
public:
|
||||
LastState()
|
||||
{
|
||||
p.set(kInfinity,kInfinity,kInfinity);
|
||||
inside = kOutside;
|
||||
}
|
||||
~LastState(){}
|
||||
public:
|
||||
G4ThreeVector p;
|
||||
EInside inside;
|
||||
};
|
||||
|
||||
class LastVector // last SurfaceNormal result
|
||||
{
|
||||
public:
|
||||
LastVector()
|
||||
{
|
||||
p.set(kInfinity,kInfinity,kInfinity);
|
||||
vec.set(kInfinity,kInfinity,kInfinity);
|
||||
surface = new G4VSurface*[1];
|
||||
}
|
||||
~LastVector()
|
||||
{
|
||||
delete [] surface;
|
||||
}
|
||||
public:
|
||||
G4ThreeVector p;
|
||||
G4ThreeVector vec;
|
||||
G4VSurface **surface;
|
||||
};
|
||||
|
||||
class LastValue // last G4double value
|
||||
{
|
||||
public:
|
||||
LastValue()
|
||||
{
|
||||
p.set(kInfinity,kInfinity,kInfinity);
|
||||
value = DBL_MAX;
|
||||
}
|
||||
~LastValue(){}
|
||||
public:
|
||||
G4ThreeVector p;
|
||||
G4double value;
|
||||
};
|
||||
|
||||
class LastValueWithDoubleVector // last G4double value
|
||||
{
|
||||
public:
|
||||
LastValueWithDoubleVector()
|
||||
{
|
||||
p.set(kInfinity,kInfinity,kInfinity);
|
||||
vec.set(kInfinity,kInfinity,kInfinity);
|
||||
value = DBL_MAX;
|
||||
}
|
||||
~LastValueWithDoubleVector(){}
|
||||
public:
|
||||
G4ThreeVector p;
|
||||
G4ThreeVector vec;
|
||||
G4double value;
|
||||
};
|
||||
|
||||
LastState fLastInside;
|
||||
LastVector fLastNormal;
|
||||
LastValue fLastDistanceToIn;
|
||||
LastValue fLastDistanceToOut;
|
||||
LastValueWithDoubleVector fLastDistanceToInWithV;
|
||||
LastValueWithDoubleVector fLastDistanceToOutWithV;
|
||||
|
||||
};
|
||||
|
||||
//=====================================================================
|
||||
|
||||
//---------------------
|
||||
// inline functions
|
||||
//---------------------
|
||||
|
||||
inline
|
||||
void G4TwistedBox::SetFields(G4double phitwist, G4double pDx, G4double pDy, G4double pDz)
|
||||
{
|
||||
fPhiTwist = phitwist;
|
||||
|
||||
fDx = pDx ;
|
||||
fDy = pDy ;
|
||||
fDz = pDz ;
|
||||
|
||||
}
|
||||
|
||||
inline
|
||||
G4double G4TwistedBox::GetCubicVolume()
|
||||
{
|
||||
if(fCubicVolume != 0.) ;
|
||||
else fCubicVolume = 8*fDx*fDy*fDz;
|
||||
return fCubicVolume;
|
||||
}
|
||||
std::ostream& StreamInfo(std::ostream& os) const;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,129 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4TwistedBoxSide.hh,v 1.4 2004/12/08 10:20:33 link Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
//
|
||||
// G4TwistedTrapSide
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// Class describing a twisted boundary surface for a box.
|
||||
|
||||
// Author:
|
||||
//
|
||||
// Oliver Link (Oliver.Link@cern.ch)
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef __G4TWISTEDBOXSIDE__
|
||||
#define __G4TWISTEDBOXSIDE__
|
||||
|
||||
#include "G4VSurface.hh"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class G4TwistedBoxSide : public G4VSurface
|
||||
{
|
||||
public: // with description
|
||||
|
||||
G4TwistedBoxSide(const G4String &name,
|
||||
G4double PhiTwist,
|
||||
G4double fDx,
|
||||
G4double fDy,
|
||||
G4double fDz,
|
||||
G4double AngleSide);
|
||||
|
||||
virtual ~G4TwistedBoxSide();
|
||||
|
||||
virtual G4ThreeVector GetNormal(const G4ThreeVector &xx,
|
||||
G4bool isGlobal = false) ;
|
||||
|
||||
virtual G4int DistanceToSurface(const G4ThreeVector &gp,
|
||||
const G4ThreeVector &gv,
|
||||
G4ThreeVector gxx[],
|
||||
G4double distance[],
|
||||
G4int areacode[],
|
||||
G4bool isvalid[],
|
||||
EValidate validate=kValidateWithTol);
|
||||
|
||||
virtual G4int DistanceToSurface(const G4ThreeVector &gp,
|
||||
G4ThreeVector gxx[],
|
||||
G4double distance[],
|
||||
G4int areacode[]);
|
||||
|
||||
private:
|
||||
|
||||
virtual G4int GetAreaCode(const G4ThreeVector &xx,
|
||||
G4bool withTol = true);
|
||||
virtual void SetCorners();
|
||||
virtual void SetBoundaries();
|
||||
|
||||
void GetPhiUAtX( G4ThreeVector p, G4double &phi, G4double &u);
|
||||
G4ThreeVector ProjectPoint(const G4ThreeVector &p,
|
||||
G4bool isglobal = false);
|
||||
|
||||
inline G4ThreeVector SurfacePoint( G4double phi, G4double u);
|
||||
inline G4ThreeVector NormAng( G4double phi, G4double u );
|
||||
|
||||
private:
|
||||
|
||||
G4double fDx ;
|
||||
G4double fDy ;
|
||||
G4double fDz ;
|
||||
G4double fPhiTwist ;
|
||||
G4double fAngleSide ;
|
||||
};
|
||||
|
||||
//========================================================
|
||||
// inline functions
|
||||
//========================================================
|
||||
|
||||
inline
|
||||
G4ThreeVector G4TwistedBoxSide::SurfacePoint( G4double phi, G4double u )
|
||||
{
|
||||
// function to calculate a point on the surface, given by parameters phi,u
|
||||
|
||||
G4ThreeVector SurfPoint ( fDx * std::cos(phi) - u * std::sin(phi),
|
||||
fDx * std::sin(phi) + u * std::cos(phi),
|
||||
2*fDz*phi/fPhiTwist );
|
||||
return SurfPoint ;
|
||||
}
|
||||
|
||||
inline
|
||||
G4ThreeVector G4TwistedBoxSide::NormAng( G4double phi, G4double u )
|
||||
{
|
||||
// function to calculate the norm at a given point on the surface
|
||||
|
||||
G4double L = 2*fDz ;
|
||||
G4ThreeVector nvec( L*std::cos(phi), L*std::sin(phi), fPhiTwist*u);
|
||||
|
||||
return nvec.unit() ;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4TwistedSurface.hh,v 1.7 2004/12/02 09:31:31 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4TwistedTrap.hh,v 1.3 2004/11/13 18:26:24 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// $Id: G4TwistedTrap.hh,v 1.5 2005/04/04 11:56:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
@@ -33,220 +33,86 @@
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// G4TwistedTrap is a trapezoid defined with caps of the sames shape
|
||||
// and size, an twisted along the Z axis.
|
||||
|
||||
// A G4TwistedTrap is a general twisted trapezoid: The faces perpendicular to the
|
||||
// z planes are trapezia, and their centres are not necessarily on
|
||||
// a line parallel to the z axis.
|
||||
//
|
||||
// pDz Half-length along the z-axis
|
||||
// pTheta Polar angle of the line joining the centres of the faces
|
||||
// at -/+pDz
|
||||
// pPhi Azimuthal angle of the line joing the centre of the face at
|
||||
// -pDz to the centre of the face at +pDz
|
||||
// pDy1 Half-length along y of the face at -pDz
|
||||
// pDx1 Half-length along x of the side at y=-pDy1 of the face at -pDz
|
||||
// pDx2 Half-length along x of the side at y=+pDy1 of the face at -pDz
|
||||
//
|
||||
// pDy2 Half-length along y of the face at +pDz
|
||||
// pDx3 Half-length along x of the side at y=-pDy2 of the face at +pDz
|
||||
// pDx4 Half-length along x of the side at y=+pDy2 of the face at +pDz
|
||||
// pAlph Angle with respect to the y axis from the centre of the side
|
||||
//
|
||||
//
|
||||
// A special regular case of a trapezoid with equal endcaps is available,
|
||||
// with polar,azimuthal and tilt angles set to zero.
|
||||
//
|
||||
|
||||
// Author:
|
||||
// O.Link (Oliver.Link@cern.ch)
|
||||
//
|
||||
// Oliver Link (Oliver.Link@cern.ch)
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#ifndef __G4TWISTEDTRAP__
|
||||
#define __G4TWISTEDTRAP__
|
||||
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4TwistedTrapSide.hh"
|
||||
#include "G4TwistedBoxSide.hh"
|
||||
#include "G4FlatTrapSide.hh"
|
||||
#include "G4VTwistedFaceted.hh"
|
||||
|
||||
class G4SolidExtentList;
|
||||
class G4ClippablePolygon;
|
||||
|
||||
class G4TwistedTrap: public G4VSolid
|
||||
class G4TwistedTrap : public G4VTwistedFaceted
|
||||
{
|
||||
public: // with description
|
||||
public: // with description
|
||||
|
||||
G4TwistedTrap(const G4String &pName,
|
||||
G4double pPhiTwist,
|
||||
G4double pDx1, // half x length at -pDz,-pDy
|
||||
G4double pDx2, // half x length at -pDz,+pDy
|
||||
G4double pDy,
|
||||
G4double pDz);
|
||||
|
||||
|
||||
G4TwistedTrap(const G4String &pName, // Name of instance
|
||||
G4double pPhiTwist, // twist angle
|
||||
G4double pDz, // half z length
|
||||
G4double pTheta, // direction between end planes
|
||||
G4double pPhi, // defined by polar and azim. angles
|
||||
G4double pDy1, // half y length at -pDz
|
||||
G4double pDx1, // half x length at -pDz,-pDy
|
||||
G4double pDx2, // half x length at -pDz,+pDy
|
||||
G4double pDy2, // half y length at +pDz
|
||||
G4double pDx3, // half x length at +pDz,-pDy
|
||||
G4double pDx4, // half x length at +pDz,+pDy
|
||||
G4double pAlph // tilt angle
|
||||
);
|
||||
|
||||
G4TwistedTrap(const G4String &pname, // Name of instance
|
||||
G4double twistedangle, // Twisted angle
|
||||
G4double pDx1, // half length in x at y=-pDy
|
||||
G4double pDx2, // half length in x at y=+pDy
|
||||
G4double pDy, // half length in y
|
||||
G4double pDz) ; // half z length
|
||||
|
||||
virtual ~G4TwistedTrap();
|
||||
|
||||
void ComputeDimensions(G4VPVParameterisation* ,
|
||||
const G4int ,
|
||||
const G4VPhysicalVolume* );
|
||||
|
||||
G4bool CalculateExtent(const EAxis pAxis,
|
||||
const G4VoxelLimits &pVoxelLimit,
|
||||
const G4AffineTransform &pTransform,
|
||||
G4double &pMin,
|
||||
G4double &pMax ) const;
|
||||
|
||||
G4double DistanceToIn (const G4ThreeVector &p,
|
||||
const G4ThreeVector &v ) const;
|
||||
// accessors
|
||||
|
||||
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;
|
||||
inline G4double GetY1HalfLength() const { return GetDy1() ; }
|
||||
inline G4double GetX1HalfLength() const { return GetDx1() ; }
|
||||
inline G4double GetX2HalfLength() const { return GetDx2() ; }
|
||||
inline G4double GetY2HalfLength() const { return GetDy2() ; }
|
||||
inline G4double GetX3HalfLength() const { return GetDx3() ; }
|
||||
inline G4double GetX4HalfLength() const { return GetDx4() ; }
|
||||
inline G4double GetZHalfLength() const { return GetDz() ; }
|
||||
inline G4double GetPhiTwist() const { return GetTwistAngle() ; }
|
||||
inline G4double GetTiltAngleAlpha() const { return GetAlpha() ; }
|
||||
inline G4double GetPolarAngleTheta() const { return GetTheta() ; }
|
||||
inline G4double GetAzimuthalAnglePhi() const { return GetPhi() ; }
|
||||
|
||||
G4double DistanceToOut(const G4ThreeVector &p) const;
|
||||
|
||||
EInside Inside (const G4ThreeVector &p) const;
|
||||
|
||||
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const;
|
||||
|
||||
inline G4double GetCubicVolume() ;
|
||||
|
||||
void DescribeYourselfTo (G4VGraphicsScene &scene) const;
|
||||
G4Polyhedron *CreatePolyhedron () const;
|
||||
G4NURBS *CreateNURBS () const;
|
||||
G4GeometryType GetEntityType() const;
|
||||
G4Polyhedron* CreatePolyhedron() const;
|
||||
|
||||
std::ostream &StreamInfo(std::ostream& os) const;
|
||||
|
||||
// accessors
|
||||
|
||||
inline G4double GetPhiTwist () const { return fPhiTwist ; }
|
||||
|
||||
inline G4double GetDx1 () const { return fDx1 ; }
|
||||
inline G4double GetDx2 () const { return fDx2 ; }
|
||||
inline G4double GetDy () const { return fDy ; }
|
||||
inline G4double GetDz () const { return fDz; }
|
||||
|
||||
G4VisExtent GetExtent () const;
|
||||
G4GeometryType GetEntityType() const;
|
||||
|
||||
protected: // with description
|
||||
|
||||
G4ThreeVectorList*
|
||||
CreateRotatedVertices(const G4AffineTransform& pTransform) const;
|
||||
// Create the List of transformed vertices in the format required
|
||||
// for G4VSolid:: ClipCrossSection and ClipBetweenSections.
|
||||
|
||||
|
||||
public: // without description
|
||||
|
||||
private:
|
||||
|
||||
inline void SetFields(G4double phitwist, G4double pDx1, G4double pDx2, G4double pDy, G4double pDz);
|
||||
|
||||
void CreateSurfaces();
|
||||
|
||||
private:
|
||||
|
||||
G4double fPhiTwist; // Twist angle from -fZHalfLength to fZHalfLength
|
||||
|
||||
G4double fDx ; // temp
|
||||
|
||||
G4double fDx1; // Half-length along x of the side at y=-fDy1 (d in surface equation)
|
||||
G4double fDx2; // Half-length along x of the side at y=+fDy1 (a in surface equation)
|
||||
G4double fDy; // Half-length along y of the face (b in surface equation)
|
||||
G4double fDz ; // Half-length along the z axis (L in surface equation)
|
||||
|
||||
G4VSurface *fLowerEndcap ; // surface of -ve z
|
||||
G4VSurface *fUpperEndcap ; // surface of +ve z
|
||||
|
||||
G4VSurface *fSide0 ; // Twisted Side at phi = 0 deg
|
||||
G4VSurface *fSide90 ; // Twisted Side at phi = 90 deg
|
||||
G4VSurface *fSide180 ; // Twisted Side at phi = 180 deg
|
||||
G4VSurface *fSide270 ; // Twisted Side at phi = 270 deg
|
||||
|
||||
G4double fCubicVolume ; // volume of the twisted trapezoid
|
||||
|
||||
class LastState // last Inside result
|
||||
{
|
||||
public:
|
||||
LastState()
|
||||
{
|
||||
p.set(kInfinity,kInfinity,kInfinity);
|
||||
inside = kOutside;
|
||||
}
|
||||
~LastState(){}
|
||||
public:
|
||||
G4ThreeVector p;
|
||||
EInside inside;
|
||||
};
|
||||
|
||||
class LastVector // last SurfaceNormal result
|
||||
{
|
||||
public:
|
||||
LastVector()
|
||||
{
|
||||
p.set(kInfinity,kInfinity,kInfinity);
|
||||
vec.set(kInfinity,kInfinity,kInfinity);
|
||||
surface = new G4VSurface*[1];
|
||||
}
|
||||
~LastVector()
|
||||
{
|
||||
delete [] surface;
|
||||
}
|
||||
public:
|
||||
G4ThreeVector p;
|
||||
G4ThreeVector vec;
|
||||
G4VSurface **surface;
|
||||
};
|
||||
|
||||
class LastValue // last G4double value
|
||||
{
|
||||
public:
|
||||
LastValue()
|
||||
{
|
||||
p.set(kInfinity,kInfinity,kInfinity);
|
||||
value = DBL_MAX;
|
||||
}
|
||||
~LastValue(){}
|
||||
public:
|
||||
G4ThreeVector p;
|
||||
G4double value;
|
||||
};
|
||||
|
||||
class LastValueWithDoubleVector // last G4double value
|
||||
{
|
||||
public:
|
||||
LastValueWithDoubleVector()
|
||||
{
|
||||
p.set(kInfinity,kInfinity,kInfinity);
|
||||
vec.set(kInfinity,kInfinity,kInfinity);
|
||||
value = DBL_MAX;
|
||||
}
|
||||
~LastValueWithDoubleVector(){}
|
||||
public:
|
||||
G4ThreeVector p;
|
||||
G4ThreeVector vec;
|
||||
G4double value;
|
||||
};
|
||||
|
||||
LastState fLastInside;
|
||||
LastVector fLastNormal;
|
||||
LastValue fLastDistanceToIn;
|
||||
LastValue fLastDistanceToOut;
|
||||
LastValueWithDoubleVector fLastDistanceToInWithV;
|
||||
LastValueWithDoubleVector fLastDistanceToOutWithV;
|
||||
|
||||
};
|
||||
|
||||
//=====================================================================
|
||||
|
||||
//---------------------
|
||||
// inline functions
|
||||
//---------------------
|
||||
|
||||
inline
|
||||
void G4TwistedTrap::SetFields(G4double phitwist,
|
||||
G4double pDx1, G4double pDx2, G4double pDy , G4double pDz)
|
||||
{
|
||||
fPhiTwist = phitwist;
|
||||
|
||||
fDx1 = pDx1 ;
|
||||
fDx2 = pDx2 ;
|
||||
fDy = pDy ;
|
||||
fDz = pDz ;
|
||||
|
||||
}
|
||||
|
||||
inline
|
||||
G4double G4TwistedTrap::GetCubicVolume()
|
||||
{
|
||||
if(fCubicVolume != 0.) ;
|
||||
else fCubicVolume = 8 * ( fDx1 + fDx2 ) / 2 * fDy * fDz ;
|
||||
return fCubicVolume;
|
||||
}
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,210 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4TwistedTrapAlphaSide.hh,v 1.5 2005/03/18 17:11:53 gcosmo Exp $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
//
|
||||
// G4TwistedTrapAlphaSide
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// Class describing a twisted boundary surface for a trapezoid.
|
||||
|
||||
// Author:
|
||||
//
|
||||
// Oliver Link (Oliver.Link@cern.ch)
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef __G4TWISTEDTRAPALPHASIDE__
|
||||
#define __G4TWISTEDTRAPALPHASIDE__
|
||||
|
||||
#include "G4VSurface.hh"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class G4TwistedTrapAlphaSide : public G4VSurface
|
||||
{
|
||||
public: // with description
|
||||
|
||||
G4TwistedTrapAlphaSide(const G4String &name,
|
||||
G4double PhiTwist, // twist angle
|
||||
G4double pDz, // half z lenght
|
||||
G4double pTheta, // direction between end planes
|
||||
G4double pPhi, // defined by polar and azimutal angles.
|
||||
G4double pDy1, // half y length at -pDz
|
||||
G4double pDx1, // half x length at -pDz,-pDy
|
||||
G4double pDx2, // half x length at -pDz,+pDy
|
||||
G4double pDy2, // half y length at +pDz
|
||||
G4double pDx3, // half x length at +pDz,-pDy
|
||||
G4double pDx4, // half x length at +pDz,+pDy
|
||||
G4double pAlph, // tilt angle at +pDz
|
||||
G4double AngleSide // parity
|
||||
);
|
||||
|
||||
virtual ~G4TwistedTrapAlphaSide();
|
||||
|
||||
virtual G4ThreeVector GetNormal(const G4ThreeVector &xx,
|
||||
G4bool isGlobal = false) ;
|
||||
|
||||
virtual G4int DistanceToSurface(const G4ThreeVector &gp,
|
||||
const G4ThreeVector &gv,
|
||||
G4ThreeVector gxx[],
|
||||
G4double distance[],
|
||||
G4int areacode[],
|
||||
G4bool isvalid[],
|
||||
EValidate validate = kValidateWithTol);
|
||||
|
||||
virtual G4int DistanceToSurface(const G4ThreeVector &gp,
|
||||
G4ThreeVector gxx[],
|
||||
G4double distance[],
|
||||
G4int areacode[]);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
virtual G4int GetAreaCode(const G4ThreeVector &xx,
|
||||
G4bool withTol = true);
|
||||
virtual void SetCorners();
|
||||
virtual void SetBoundaries();
|
||||
|
||||
void GetPhiUAtX(G4ThreeVector p, G4double &phi, G4double &u);
|
||||
G4ThreeVector ProjectPoint(const G4ThreeVector &p,
|
||||
G4bool isglobal = false);
|
||||
|
||||
inline G4ThreeVector SurfacePoint(G4double phi, G4double u);
|
||||
inline G4ThreeVector NormAng(G4double phi, G4double u);
|
||||
inline G4double Xcoef(G4double u,G4double phi); // to calculate the w(u) function
|
||||
inline G4double GetValueA(G4double phi) ;
|
||||
inline G4double GetValueB(G4double phi) ;
|
||||
inline G4double GetValueD(G4double phi) ;
|
||||
|
||||
private:
|
||||
|
||||
G4double fTheta;
|
||||
G4double fPhi ;
|
||||
|
||||
G4double fDy1;
|
||||
G4double fDx1;
|
||||
G4double fDx2;
|
||||
|
||||
G4double fDy2;
|
||||
G4double fDx3;
|
||||
G4double fDx4;
|
||||
|
||||
G4double fDz; // Half-length along the z axis
|
||||
|
||||
G4double fAlph ;
|
||||
G4double fTAlph ; // std::tan(fAlph)
|
||||
|
||||
G4double fPhiTwist; // twist angle ( dphi in surface equation)
|
||||
|
||||
G4double fAngleSide;
|
||||
|
||||
G4double fDx4plus2 ; // fDx4 + fDx2 == a2/2 + a1/2
|
||||
G4double fDx4minus2 ; // fDx4 - fDx2 -
|
||||
G4double fDx3plus1 ; // fDx3 + fDx1 == d2/2 + d1/2
|
||||
G4double fDx3minus1 ; // fDx3 - fDx1 -
|
||||
G4double fDy2plus1 ; // fDy2 + fDy1 == b2/2 + b1/2
|
||||
G4double fDy2minus1 ; // fDy2 - fDy1 -
|
||||
G4double fa1md1 ; // 2 fDx2 - 2 fDx1 == a1 - d1
|
||||
G4double fa2md2 ; // 2 fDx4 - 2 fDx3
|
||||
|
||||
G4double fdeltaX ;
|
||||
G4double fdeltaY ;
|
||||
|
||||
|
||||
};
|
||||
|
||||
//========================================================
|
||||
// inline functions
|
||||
//========================================================
|
||||
|
||||
inline
|
||||
G4double G4TwistedTrapAlphaSide::GetValueA(G4double phi)
|
||||
{
|
||||
return ( fDx4plus2 + fDx4minus2 * ( 2 * phi ) / fPhiTwist ) ;
|
||||
}
|
||||
|
||||
inline
|
||||
G4double G4TwistedTrapAlphaSide::GetValueD(G4double phi)
|
||||
{
|
||||
return ( fDx3plus1 + fDx3minus1 * ( 2 * phi) / fPhiTwist ) ;
|
||||
}
|
||||
|
||||
inline
|
||||
G4double G4TwistedTrapAlphaSide::GetValueB(G4double phi)
|
||||
{
|
||||
return ( fDy2plus1 + fDy2minus1 * ( 2 * phi ) / fPhiTwist ) ;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
G4double G4TwistedTrapAlphaSide::Xcoef(G4double u, G4double phi)
|
||||
{
|
||||
|
||||
return GetValueA(phi)/2. + (GetValueD(phi)-GetValueA(phi))/4.
|
||||
- u*( ( GetValueD(phi)-GetValueA(phi) ) / ( 2 * GetValueB(phi) ) + fTAlph ) ;
|
||||
|
||||
}
|
||||
|
||||
inline
|
||||
G4ThreeVector G4TwistedTrapAlphaSide::SurfacePoint( G4double phi, G4double u )
|
||||
{
|
||||
// function to calculate a point on the surface, given by parameters phi,u
|
||||
|
||||
G4ThreeVector SurfPoint ( ( Xcoef(u,phi) + fdeltaX*phi/fPhiTwist ) * std::cos(phi)
|
||||
- ( u + fdeltaY*phi/fPhiTwist ) * std::sin(phi),
|
||||
( Xcoef(u,phi) + fdeltaX*phi/fPhiTwist ) * std::sin(phi)
|
||||
+ ( u + fdeltaY*phi/fPhiTwist ) * std::cos(phi),
|
||||
2*fDz*phi/fPhiTwist );
|
||||
return SurfPoint ;
|
||||
|
||||
}
|
||||
|
||||
inline
|
||||
G4ThreeVector G4TwistedTrapAlphaSide::NormAng( G4double phi, G4double u )
|
||||
{
|
||||
// function to calculate the norm at a given point on the surface
|
||||
// replace a1-d1
|
||||
|
||||
G4ThreeVector nvec( 16*fDy1*2*fDz*(4*fDy1*(std::cos(phi)-std::sin(phi)*fTAlph) + fa1md1*std::sin(phi)),
|
||||
16*fDy1*2*fDz*(4*fDy1*std::sin(phi) + std::cos(phi)*(-fa1md1 + 4*fDy1*fTAlph)),
|
||||
2*fDy1*(-16*fDy1*(fDx4minus2 + fDx3minus1) + 4*fDx2*fDx4plus2*fPhiTwist -
|
||||
(fDx4+fDx1)*4*fDx1*fPhiTwist + 2*fa1md1*fDx3*fPhiTwist -
|
||||
32*fDy1*fdeltaX + 8*fa1md1*fdeltaY +
|
||||
2*(-(fa1md1*(-2*(fDx4minus2 + fDx3minus1) - 4*fdeltaX)) + 16*fDy1*fdeltaY)*phi) +
|
||||
4*(16*fDy1*fDy1 + (fa1md1)*(fa1md1))*fPhiTwist*u -
|
||||
4*fDy1*fTAlph*(2*fDy1*(2*(fDx4plus2+fDx3plus1)*fPhiTwist
|
||||
+ 8*fdeltaY - 2*(-2*(fDx4minus2+fDx3minus1) - 4*fdeltaX)*phi)
|
||||
+ 8*(fa1md1)*fPhiTwist*u - 16*fDy1*fPhiTwist*u*fTAlph) ) ;
|
||||
|
||||
|
||||
return nvec.unit();
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
+68
-47
@@ -21,15 +21,13 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4TwistedTrapSide.hh,v 1.7 2004/12/08 10:20:34 link Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
// $Id: G4TwistedTrapBoxSide.hh,v 1.2 2005/03/18 17:11:53 gcosmo Exp $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
//
|
||||
// G4TwistedTrapSide
|
||||
// G4TwistedTrapBoxSide
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
@@ -40,26 +38,31 @@
|
||||
// Oliver Link (Oliver.Link@cern.ch)
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef __G4TWISTEDTRAPSIDE__
|
||||
#define __G4TWISTEDTRAPSIDE__
|
||||
#ifndef __G4TWISTEDTRAPBOXSIDE__
|
||||
#define __G4TWISTEDTRAPBOXASIDE__
|
||||
|
||||
#include "G4VSurface.hh"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class G4TwistedTrapSide : public G4VSurface
|
||||
class G4TwistedTrapBoxSide : public G4VSurface
|
||||
{
|
||||
public: // with description
|
||||
|
||||
G4TwistedTrapSide(const G4String &name,
|
||||
G4double PhiTwist,
|
||||
G4double pDx1,
|
||||
G4double pDx2,
|
||||
G4double pDy,
|
||||
G4double pDz,
|
||||
G4double AngleSide);
|
||||
G4TwistedTrapBoxSide(const G4String &name,
|
||||
G4double PhiTwist, // twist angle
|
||||
G4double pDz, // half z lenght
|
||||
G4double pTheta, // direction between end planes
|
||||
G4double pPhi, // defined by polar and azimutal angles.
|
||||
G4double pDy1, // half y length at -pDz
|
||||
G4double pDx1, // half x length at -pDz,-pDy
|
||||
G4double pDy2, // half y length at +pDz
|
||||
G4double pDx2, // half x length at +pDz,-pDy
|
||||
G4double pAlph, // tilt angle at +pDz
|
||||
G4double AngleSide // parity
|
||||
);
|
||||
|
||||
virtual ~G4TwistedTrapSide();
|
||||
virtual ~G4TwistedTrapBoxSide();
|
||||
|
||||
virtual G4ThreeVector GetNormal(const G4ThreeVector &xx,
|
||||
G4bool isGlobal = false) ;
|
||||
@@ -92,22 +95,33 @@ class G4TwistedTrapSide : public G4VSurface
|
||||
|
||||
inline G4ThreeVector SurfacePoint(G4double phi, G4double u);
|
||||
inline G4ThreeVector NormAng(G4double phi, G4double u);
|
||||
inline G4double Xcoef(G4double u); // to calculate the w(u) function
|
||||
inline G4double Xcoef(G4double u,G4double phi); // to calculate the w(u) function
|
||||
inline G4double GetValueA(G4double phi) ;
|
||||
inline G4double GetValueB(G4double phi) ;
|
||||
|
||||
private:
|
||||
|
||||
G4double fDx1; // Half-length along x of the side at y=-fDy1
|
||||
// (d in surface equation)
|
||||
G4double fDx2; // Half-length along x of the side at y=+fDy1
|
||||
// (a in surface equation)
|
||||
G4double fDy; // Half-length along y of the face
|
||||
// (b in surface equation)
|
||||
G4double fTheta;
|
||||
G4double fPhi ;
|
||||
|
||||
G4double fDy1;
|
||||
G4double fDy2;
|
||||
|
||||
G4double fDx1;
|
||||
G4double fDx2;
|
||||
|
||||
G4double fDz; // Half-length along the z axis
|
||||
// (L in surface equation)
|
||||
|
||||
G4double fAlph ;
|
||||
G4double fTAlph ; // std::tan(fAlph)
|
||||
|
||||
G4double fPhiTwist; // twist angle ( dphi in surface equation)
|
||||
|
||||
G4double fAngleSide;
|
||||
|
||||
G4double fdeltaX ;
|
||||
G4double fdeltaY ;
|
||||
|
||||
};
|
||||
|
||||
//========================================================
|
||||
@@ -115,46 +129,53 @@ class G4TwistedTrapSide : public G4VSurface
|
||||
//========================================================
|
||||
|
||||
inline
|
||||
G4double G4TwistedTrapSide::Xcoef(G4double u)
|
||||
|
||||
G4double G4TwistedTrapBoxSide::GetValueA(G4double phi)
|
||||
{
|
||||
// attention a = 2 fDx1
|
||||
// d = 2 fDx2
|
||||
// b = 2 fDy
|
||||
// L = 2 fDz
|
||||
return ( fDx1 + fDx2 - (2*(fDx1 - fDx2)*phi)/fPhiTwist ) ;
|
||||
}
|
||||
|
||||
inline
|
||||
G4double G4TwistedTrapBoxSide::GetValueB(G4double phi)
|
||||
{
|
||||
return ( fDy1 + fDy2 - (2*(fDy1 - fDy2)*phi)/fPhiTwist ) ;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
G4double G4TwistedTrapBoxSide::Xcoef(G4double u, G4double phi)
|
||||
{
|
||||
|
||||
return GetValueA(phi)/2. - u*fTAlph ;
|
||||
|
||||
return fDx2 + ( fDx1-fDx2)/2 - u * (fDx1-fDx2)/(2*fDy) ;
|
||||
}
|
||||
|
||||
inline
|
||||
G4ThreeVector G4TwistedTrapSide::SurfacePoint( G4double phi, G4double u )
|
||||
G4ThreeVector G4TwistedTrapBoxSide::SurfacePoint( G4double phi, G4double u )
|
||||
{
|
||||
// function to calculate a point on the surface, given by parameters phi,u
|
||||
|
||||
G4ThreeVector SurfPoint ( Xcoef(u) * std::cos(phi) - u * std::sin(phi),
|
||||
Xcoef(u) * std::sin(phi) + u * std::cos(phi),
|
||||
2*fDz*phi/fPhiTwist );
|
||||
G4ThreeVector SurfPoint ( ( Xcoef(u,phi) + fdeltaX*phi/fPhiTwist ) * std::cos(phi)
|
||||
- ( u + fdeltaY*phi/fPhiTwist ) * std::sin(phi),
|
||||
( Xcoef(u,phi) + fdeltaX*phi/fPhiTwist ) * std::sin(phi)
|
||||
+ ( u + fdeltaY*phi/fPhiTwist ) * std::cos(phi),
|
||||
2*fDz*phi/fPhiTwist );
|
||||
return SurfPoint ;
|
||||
|
||||
}
|
||||
|
||||
inline
|
||||
G4ThreeVector G4TwistedTrapSide::NormAng( G4double phi, G4double u )
|
||||
G4ThreeVector G4TwistedTrapBoxSide::NormAng( G4double phi, G4double u )
|
||||
{
|
||||
// function to calculate the norm at a given point on the surface
|
||||
// replace a1-d1
|
||||
|
||||
G4ThreeVector
|
||||
nvec(
|
||||
8*fDz*(std::cos(phi) - fTAlph*std::sin(phi)),
|
||||
8*fDz*(fTAlph*std::cos(phi) + std::sin(phi)),
|
||||
2*fDx1*(2 - fTAlph*(fPhiTwist - 2*phi)) - 2*fDx2*(2 + fTAlph*(fPhiTwist + 2*phi))
|
||||
- 4*(fdeltaX + fdeltaY*(fTAlph - phi) + fdeltaX*fTAlph*phi) + 4*fPhiTwist*(1 + fTAlph*fTAlph)*u) ;
|
||||
|
||||
G4double L = 2*fDz ;
|
||||
G4double a = 2*fDx2 ;
|
||||
G4double d = 2*fDx1 ;
|
||||
G4double b = 2*fDy ;
|
||||
G4double dphi = fPhiTwist ;
|
||||
G4double b2 = b*b ;
|
||||
G4double d2 = d*d ;
|
||||
G4double a2 = a*a ;
|
||||
G4ThreeVector nvec( ( L * (2*b*std::cos(phi) + (a-d)*std::sin(phi)))/2.,
|
||||
-(L*((a-d)*std::cos(phi) - 2*b*std::sin(phi)))/2.,
|
||||
(dphi*(-b*d2 + 8*b2*u - 4*a*d*u + 2*d2*u + a2*(b + 2*u)))
|
||||
/(8.*b) ) ;
|
||||
return nvec.unit();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,203 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4TwistedTrapParallelSide.hh,v 1.3 2005/03/18 17:11:53 gcosmo Exp $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
//
|
||||
// G4TwistedTrapParallelSide
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// Class describing a twisted boundary surface for a trapezoid.
|
||||
|
||||
// Author:
|
||||
//
|
||||
// Oliver Link (Oliver.Link@cern.ch)
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef __G4TWISTEDTRAPPARALLELSIDE__
|
||||
#define __G4TWISTEDTRAPPARALLELSIDE__
|
||||
|
||||
#include "G4VSurface.hh"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class G4TwistedTrapParallelSide : public G4VSurface
|
||||
{
|
||||
public: // with description
|
||||
|
||||
G4TwistedTrapParallelSide(const G4String &name,
|
||||
G4double PhiTwist, // twist angle
|
||||
G4double pDz, // half z lenght
|
||||
G4double pTheta, // direction between end planes
|
||||
G4double pPhi, // defined by polar and azimutal angles.
|
||||
G4double pDy1, // half y length at -pDz
|
||||
G4double pDx1, // half x length at -pDz,-pDy
|
||||
G4double pDx2, // half x length at -pDz,+pDy
|
||||
G4double pDy2, // half y length at +pDz
|
||||
G4double pDx3, // half x length at +pDz,-pDy
|
||||
G4double pDx4, // half x length at +pDz,+pDy
|
||||
G4double pAlph, // tilt angle at +pDz
|
||||
G4double AngleSide // parity
|
||||
);
|
||||
|
||||
virtual ~G4TwistedTrapParallelSide();
|
||||
|
||||
virtual G4ThreeVector GetNormal(const G4ThreeVector &xx,
|
||||
G4bool isGlobal = false) ;
|
||||
|
||||
virtual G4int DistanceToSurface(const G4ThreeVector &gp,
|
||||
const G4ThreeVector &gv,
|
||||
G4ThreeVector gxx[],
|
||||
G4double distance[],
|
||||
G4int areacode[],
|
||||
G4bool isvalid[],
|
||||
EValidate validate = kValidateWithTol);
|
||||
|
||||
virtual G4int DistanceToSurface(const G4ThreeVector &gp,
|
||||
G4ThreeVector gxx[],
|
||||
G4double distance[],
|
||||
G4int areacode[]);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
virtual G4int GetAreaCode(const G4ThreeVector &xx,
|
||||
G4bool withTol = true);
|
||||
virtual void SetCorners();
|
||||
virtual void SetBoundaries();
|
||||
|
||||
void GetPhiUAtX(G4ThreeVector p, G4double &phi, G4double &u);
|
||||
G4ThreeVector ProjectPoint(const G4ThreeVector &p,
|
||||
G4bool isglobal = false);
|
||||
|
||||
inline G4ThreeVector SurfacePoint(G4double phi, G4double u);
|
||||
inline G4ThreeVector NormAng(G4double phi, G4double u);
|
||||
inline G4double Xcoef(G4double u); // to calculate the w(u) function
|
||||
inline G4double GetValueB(G4double phi) ;
|
||||
inline G4double GetUmin(G4double phi) ;
|
||||
inline G4double GetUmax(G4double phi) ;
|
||||
|
||||
private:
|
||||
|
||||
G4double fTheta;
|
||||
G4double fPhi ;
|
||||
|
||||
G4double fDy1;
|
||||
G4double fDx1;
|
||||
G4double fDx2;
|
||||
|
||||
G4double fDy2;
|
||||
G4double fDx3;
|
||||
G4double fDx4;
|
||||
|
||||
G4double fDz; // Half-length along the z axis
|
||||
|
||||
G4double fAlph ;
|
||||
G4double fTAlph ; // std::tan(fAlph)
|
||||
|
||||
G4double fPhiTwist; // twist angle ( dphi in surface equation)
|
||||
|
||||
G4double fAngleSide;
|
||||
|
||||
G4double fa1md1 ; // 2 fDx2 - 2 fDx1 == a1 - d1
|
||||
G4double fa2md2 ; // 2 fDx4 - 2 fDx3
|
||||
|
||||
G4double fdeltaX ;
|
||||
G4double fdeltaY ;
|
||||
|
||||
G4double fDy2plus1 ; // fDy2 + fDy1 == b2/2 + b1/2
|
||||
G4double fDy2minus1 ; // fDy2 - fDy1 -
|
||||
|
||||
// temporary
|
||||
G4double fDy ;
|
||||
|
||||
};
|
||||
|
||||
//========================================================
|
||||
// inline functions
|
||||
//========================================================
|
||||
|
||||
inline
|
||||
G4double G4TwistedTrapParallelSide::GetUmin(G4double phi)
|
||||
{
|
||||
return ( - (2*fDx2*(fPhiTwist - 2*phi) + 2*fDx4*(fPhiTwist + 2*phi) + (2*fDy1*(fPhiTwist - 2*phi) + 2*fDy2*(fPhiTwist + 2*phi))*fTAlph)/(4.*fPhiTwist) ) ;
|
||||
}
|
||||
|
||||
inline
|
||||
G4double G4TwistedTrapParallelSide::GetUmax(G4double phi)
|
||||
{
|
||||
return (2*fDx2*(fPhiTwist - 2*phi) + 2*fDx4*(fPhiTwist + 2*phi) - (2*fDy1*(fPhiTwist - 2*phi) + 2*fDy2*(fPhiTwist + 2*phi))*fTAlph)/(4.*fPhiTwist) ;
|
||||
}
|
||||
|
||||
inline
|
||||
G4double G4TwistedTrapParallelSide::GetValueB(G4double phi)
|
||||
{
|
||||
return ( fDy2plus1 + fDy2minus1 * ( 2 * phi ) / fPhiTwist ) ;
|
||||
}
|
||||
|
||||
|
||||
inline
|
||||
G4double G4TwistedTrapParallelSide::Xcoef(G4double phi)
|
||||
{
|
||||
|
||||
return GetValueB(phi)/2. ;
|
||||
|
||||
}
|
||||
|
||||
inline
|
||||
G4ThreeVector G4TwistedTrapParallelSide::SurfacePoint( G4double phi, G4double u )
|
||||
{
|
||||
// function to calculate a point on the surface, given by parameters phi,u
|
||||
|
||||
G4ThreeVector SurfPoint ( ( u + fdeltaX*phi/fPhiTwist ) * std::cos(phi)
|
||||
- ( Xcoef(phi) + fdeltaY*phi/fPhiTwist ) * std::sin(phi),
|
||||
( u + fdeltaX*phi/fPhiTwist ) * std::sin(phi)
|
||||
+ ( Xcoef(phi) + fdeltaY*phi/fPhiTwist ) * std::cos(phi),
|
||||
2*fDz*phi/fPhiTwist );
|
||||
return SurfPoint ;
|
||||
|
||||
}
|
||||
|
||||
inline
|
||||
G4ThreeVector G4TwistedTrapParallelSide::NormAng( G4double phi, G4double u )
|
||||
{
|
||||
// function to calculate the norm at a given point on the surface
|
||||
// replace a1-d1
|
||||
|
||||
G4ThreeVector nvec(
|
||||
-2*fDz*std::sin(phi),
|
||||
2*fDz*std::cos(phi),
|
||||
fDy1 - fDy2 - fdeltaY - fdeltaX*phi - fPhiTwist*u
|
||||
) ;
|
||||
|
||||
|
||||
return nvec.unit();
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
+44
-22
@@ -21,47 +21,69 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4TwistedTrd.hh,v 1.2 2005/04/04 11:56:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
//
|
||||
// G4ApproxPolySolver
|
||||
// G4TwistedTrd
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// Polynomial solver for equations of the type:
|
||||
// c0 + c1 x + c2 x^2 + c3 x^3 + c4 x^4
|
||||
// A G4TwistedTrd is a twisted trapezoid with the x and y dimensions
|
||||
// varying along z
|
||||
//
|
||||
//
|
||||
// Member Data:
|
||||
//
|
||||
// pDx1 Half-length along x at the surface positioned at -dz
|
||||
// pDx2 Half-length along x at the surface positioned at +dz
|
||||
// pDy1 Half-length along y at the surface positioned at -dz
|
||||
// pDy2 Half-length along y at the surface positioned at +dz
|
||||
// pDz Half-length along z axis
|
||||
// pPhiTwist Twist angle
|
||||
|
||||
// Author:
|
||||
// Author:
|
||||
//
|
||||
// Oliver Link (Oliver.Link@cern.ch)
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
#ifndef __G4APPROXPOLYSOLVER__
|
||||
#define __G4APPROXPOLYSOLVER__
|
||||
#ifndef __G4TWISTEDTRD__
|
||||
#define __G4TWISTEDTRD__
|
||||
|
||||
#include "G4Types.hh"
|
||||
#include "G4String.hh"
|
||||
#include "geomdefs.hh"
|
||||
#include "G4VTwistedFaceted.hh"
|
||||
|
||||
class G4ApproxPolySolver
|
||||
class G4TwistedTrd : public G4VTwistedFaceted
|
||||
{
|
||||
public: // with description
|
||||
|
||||
// c0 + c1 x + c2 x^2 + c3 x^3 + c4 x^4
|
||||
G4TwistedTrd( const G4String& pName,
|
||||
G4double pDx1,
|
||||
G4double pDx2,
|
||||
G4double pDy1,
|
||||
G4double pDy2,
|
||||
G4double pDz,
|
||||
G4double pPhiTwist );
|
||||
|
||||
public:
|
||||
virtual ~G4TwistedTrd();
|
||||
|
||||
G4ApproxPolySolver(){}
|
||||
~G4ApproxPolySolver(){}
|
||||
// accessors
|
||||
|
||||
public:
|
||||
inline G4double GetX1HalfLength() const { return GetDx1() ; }
|
||||
inline G4double GetX2HalfLength() const { return GetDx3() ; }
|
||||
inline G4double GetY1HalfLength() const { return GetDy1() ; }
|
||||
inline G4double GetY2HalfLength() const { return GetDy2() ; }
|
||||
inline G4double GetZHalfLength() const { return GetDz() ; }
|
||||
inline G4double GetPhiTwist() const { return GetTwistAngle() ; }
|
||||
|
||||
G4int SolveBiQuadratic( G4double c[], G4double s[] ) const ;
|
||||
G4int SolveCubic( G4double c[], G4double s[] ) const ;
|
||||
G4int SolveBiQuadraticNew( G4double c[], G4double s[] ) const ;
|
||||
G4int SolveCubicNew( G4double c[], G4double s[],
|
||||
G4double& cubic_discr ) const ;
|
||||
G4int SolveQuadratic( G4double c[], G4double s[] ) const ;
|
||||
};
|
||||
G4GeometryType GetEntityType() const;
|
||||
G4Polyhedron* CreatePolyhedron () const;
|
||||
|
||||
std::ostream& StreamInfo(std::ostream& os) const;
|
||||
|
||||
} ;
|
||||
|
||||
#endif
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4TwistedTubs.hh,v 1.7 2004/12/02 09:31:31 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
// $Id: G4TwistedTubs.hh,v 1.8 2005/04/04 11:56:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
@@ -128,6 +128,7 @@ class G4TwistedTubs : public G4VSolid
|
||||
void DescribeYourselfTo (G4VGraphicsScene &scene) const;
|
||||
G4Polyhedron *CreatePolyhedron () const;
|
||||
G4NURBS *CreateNURBS () const;
|
||||
G4Polyhedron *GetPolyhedron () const;
|
||||
|
||||
std::ostream &StreamInfo(std::ostream& os) const;
|
||||
|
||||
@@ -221,6 +222,8 @@ class G4TwistedTubs : public G4VSolid
|
||||
|
||||
G4double fCubicVolume; // Cached value for cubic volume
|
||||
|
||||
mutable G4Polyhedron* fpPolyhedron; // pointer to polyhedron for vis
|
||||
|
||||
class LastState // last Inside result
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VCSGface.hh,v 1.6 2003/11/03 18:39:55 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VCSGfaceted.hh,v 1.10 2004/10/10 10:39:46 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VSurface.hh,v 1.10 2004/12/08 10:20:35 link Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
// $Id: G4VSurface.hh,v 1.11 2004/12/17 16:34:56 link Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
@@ -50,6 +50,8 @@
|
||||
|
||||
#include "G4RotationMatrix.hh"
|
||||
|
||||
#define G4VSURFACENXX 10
|
||||
|
||||
class G4VSurface
|
||||
{
|
||||
public: // without description
|
||||
@@ -256,10 +258,10 @@ class G4VSurface
|
||||
|
||||
private:
|
||||
|
||||
G4double fDistance[4];
|
||||
G4ThreeVector fXX[4];
|
||||
G4int fAreacode[4];
|
||||
G4bool fIsValid[4];
|
||||
G4double fDistance[G4VSURFACENXX];
|
||||
G4ThreeVector fXX[G4VSURFACENXX];
|
||||
G4int fAreacode[G4VSURFACENXX];
|
||||
G4bool fIsValid[G4VSURFACENXX];
|
||||
G4int fNXX;
|
||||
G4ThreeVector fLastp;
|
||||
G4ThreeVector fLastv;
|
||||
@@ -350,6 +352,13 @@ G4bool DistanceSort( const Intersection &a, const Intersection &b)
|
||||
return a.distance < b.distance ;
|
||||
}
|
||||
|
||||
inline
|
||||
G4bool EqualIntersection( const Intersection &a, const Intersection &b)
|
||||
{
|
||||
return ( ( a.xx - b.xx ).mag() < kCarTolerance ) ;
|
||||
}
|
||||
|
||||
|
||||
#include "G4VSurface.icc"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VSurface.icc,v 1.6 2004/12/02 09:31:31 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,296 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VTwistedFaceted.hh,v 1.3 2005/04/04 11:56:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class header file
|
||||
//
|
||||
//
|
||||
// G4VTwistedFaceted
|
||||
//
|
||||
// Class description:
|
||||
//
|
||||
// G4VTwistedFaceted is an abstract base class for twisted boxoids:
|
||||
// G4TwistedTrd, G4TwistedTrap and G4TwistedBox
|
||||
|
||||
// Author: O.Link (Oliver.Link@cern.ch)
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#ifndef __G4VTWISTEDFACETED__
|
||||
#define __G4VTWISTEDFACETED__
|
||||
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4TwistedTrapAlphaSide.hh"
|
||||
#include "G4TwistedTrapParallelSide.hh"
|
||||
#include "G4TwistedTrapBoxSide.hh"
|
||||
#include "G4FlatTrapSide.hh"
|
||||
|
||||
class G4SolidExtentList;
|
||||
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
|
||||
G4double pTheta, // direction between end planes
|
||||
G4double pPhi, // defined by polar & azim. angles
|
||||
G4double pDy1, // half y length at -pDz
|
||||
G4double pDx1, // half x length at -pDz,-pDy
|
||||
G4double pDx2, // half x length at -pDz,+pDy
|
||||
G4double pDy2, // half y length at +pDz
|
||||
G4double pDx3, // half x length at +pDz,-pDy
|
||||
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 G4bool CalculateExtent(const EAxis pAxis,
|
||||
const G4VoxelLimits &pVoxelLimit,
|
||||
const G4AffineTransform &pTransform,
|
||||
G4double &pMin,
|
||||
G4double &pMax ) const;
|
||||
|
||||
virtual G4double DistanceToIn (const G4ThreeVector &p,
|
||||
const G4ThreeVector &v ) const;
|
||||
|
||||
virtual G4double DistanceToIn (const G4ThreeVector &p ) const;
|
||||
|
||||
virtual G4double DistanceToOut(const G4ThreeVector &p,
|
||||
const G4ThreeVector &v,
|
||||
const G4bool calcnorm = false,
|
||||
G4bool *validnorm = 0,
|
||||
G4ThreeVector *n=0 ) const;
|
||||
|
||||
virtual G4double DistanceToOut(const G4ThreeVector &p) const;
|
||||
|
||||
virtual EInside Inside (const G4ThreeVector &p) const;
|
||||
|
||||
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const;
|
||||
|
||||
virtual inline G4double GetCubicVolume() ;
|
||||
|
||||
virtual void DescribeYourselfTo (G4VGraphicsScene &scene) const;
|
||||
virtual G4Polyhedron *CreatePolyhedron () const = 0 ;
|
||||
virtual G4NURBS *CreateNURBS () const;
|
||||
virtual G4Polyhedron *GetPolyhedron () const;
|
||||
|
||||
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 GetDz () const { return fDz ; }
|
||||
inline G4double GetPhi () const { return fPhi ; }
|
||||
inline G4double GetTheta () const { return fTheta ; }
|
||||
inline G4double GetAlpha () const { return fAlph ; }
|
||||
|
||||
inline G4double Xcoef(G4double u,G4double phi, G4double ftg) const ;
|
||||
// For calculating the w(u) function
|
||||
|
||||
inline G4double GetValueA(G4double phi) const;
|
||||
inline G4double GetValueB(G4double phi) const;
|
||||
inline G4double GetValueD(G4double phi) const;
|
||||
|
||||
virtual G4VisExtent GetExtent () const;
|
||||
virtual G4GeometryType GetEntityType() const;
|
||||
|
||||
protected: // with description
|
||||
|
||||
G4ThreeVectorList*
|
||||
CreateRotatedVertices(const G4AffineTransform& pTransform) const;
|
||||
// Create the List of transformed vertices in the format required
|
||||
// for G4VSolid:: ClipCrossSection and ClipBetweenSections.
|
||||
|
||||
private:
|
||||
|
||||
void CreateSurfaces();
|
||||
|
||||
private:
|
||||
|
||||
G4double fTheta;
|
||||
G4double fPhi ;
|
||||
|
||||
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 fDy ; // maximum side in y
|
||||
|
||||
G4double fAlph ;
|
||||
G4double fTAlph ; // std::tan(fAlph)
|
||||
|
||||
G4double fdeltaX ;
|
||||
G4double fdeltaY ;
|
||||
|
||||
G4double fPhiTwist; // twist angle ( dphi in surface equation)
|
||||
|
||||
G4double fAngleSide;
|
||||
|
||||
G4VSurface *fLowerEndcap ; // surface of -ve z
|
||||
G4VSurface *fUpperEndcap ; // surface of +ve z
|
||||
|
||||
G4VSurface *fSide0 ; // Twisted Side at phi = 0 deg
|
||||
G4VSurface *fSide90 ; // Twisted Side at phi = 90 deg
|
||||
G4VSurface *fSide180 ; // Twisted Side at phi = 180 deg
|
||||
G4VSurface *fSide270 ; // Twisted Side at phi = 270 deg
|
||||
|
||||
G4double fCubicVolume ; // volume of the twisted trapezoid
|
||||
|
||||
mutable G4Polyhedron* fpPolyhedron; // pointer to polyhedron for vis
|
||||
|
||||
class LastState // last Inside result
|
||||
{
|
||||
public:
|
||||
LastState()
|
||||
{
|
||||
p.set(kInfinity,kInfinity,kInfinity);
|
||||
inside = kOutside;
|
||||
}
|
||||
~LastState(){}
|
||||
public:
|
||||
G4ThreeVector p;
|
||||
EInside inside;
|
||||
};
|
||||
|
||||
class LastVector // last SurfaceNormal result
|
||||
{
|
||||
public:
|
||||
LastVector()
|
||||
{
|
||||
p.set(kInfinity,kInfinity,kInfinity);
|
||||
vec.set(kInfinity,kInfinity,kInfinity);
|
||||
surface = new G4VSurface*[1];
|
||||
}
|
||||
~LastVector()
|
||||
{
|
||||
delete [] surface;
|
||||
}
|
||||
public:
|
||||
G4ThreeVector p;
|
||||
G4ThreeVector vec;
|
||||
G4VSurface **surface;
|
||||
};
|
||||
|
||||
class LastValue // last G4double value
|
||||
{
|
||||
public:
|
||||
LastValue()
|
||||
{
|
||||
p.set(kInfinity,kInfinity,kInfinity);
|
||||
value = DBL_MAX;
|
||||
}
|
||||
~LastValue(){}
|
||||
public:
|
||||
G4ThreeVector p;
|
||||
G4double value;
|
||||
};
|
||||
|
||||
class LastValueWithDoubleVector // last G4double value
|
||||
{
|
||||
public:
|
||||
LastValueWithDoubleVector()
|
||||
{
|
||||
p.set(kInfinity,kInfinity,kInfinity);
|
||||
vec.set(kInfinity,kInfinity,kInfinity);
|
||||
value = DBL_MAX;
|
||||
}
|
||||
~LastValueWithDoubleVector(){}
|
||||
public:
|
||||
G4ThreeVector p;
|
||||
G4ThreeVector vec;
|
||||
G4double value;
|
||||
};
|
||||
|
||||
LastState fLastInside;
|
||||
LastVector fLastNormal;
|
||||
LastValue fLastDistanceToIn;
|
||||
LastValue fLastDistanceToOut;
|
||||
LastValueWithDoubleVector fLastDistanceToInWithV;
|
||||
LastValueWithDoubleVector fLastDistanceToOutWithV;
|
||||
|
||||
};
|
||||
|
||||
//=====================================================================
|
||||
|
||||
inline
|
||||
G4double G4VTwistedFaceted::GetCubicVolume()
|
||||
{
|
||||
|
||||
|
||||
if(fCubicVolume != 0.) ;
|
||||
else fCubicVolume = 2 * fDz
|
||||
* ( ( fDx1 + fDx2 ) * fDy1 + ( fDx3 + fDx4 ) * fDy2 );
|
||||
return fCubicVolume;
|
||||
}
|
||||
|
||||
inline
|
||||
G4double G4VTwistedFaceted::GetValueA(G4double phi) const
|
||||
{
|
||||
return ( fDx4 + fDx2 + ( fDx4 - fDx2 ) * ( 2 * phi ) / fPhiTwist ) ;
|
||||
}
|
||||
|
||||
inline
|
||||
G4double G4VTwistedFaceted::GetValueD(G4double phi) const
|
||||
{
|
||||
return ( fDx3 + fDx1 + ( fDx3 - fDx1 ) * ( 2 * phi ) / fPhiTwist ) ;
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
return GetValueA(phi)/2. + (GetValueD(phi)-GetValueA(phi))/4.
|
||||
- u*( ( GetValueD(phi)-GetValueA(phi) ) / ( 2 * GetValueB(phi) ) + ftg );
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user