Import Geant4 0.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-01 15:25:35 +02:00
parent 54d6b71f95
commit b97f8d0df7
3237 changed files with 807095 additions and 0 deletions
@@ -0,0 +1,174 @@
// This code implementation is the intellectual property of
// the RD44 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: G4AffineTransform.hh,v 2.1 1998/11/11 11:34:06 japost Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// class G4AffineTransform Header File
//
// A class for geometric affine transformations [see, eg. Foley & Van Dam]
// Supports efficient arbitrary rotation & transformation of vectors and the
// computation of compound & inverse transformations. A `rotation flag' is
// maintained internally for greater computational efficiency for transforms
// that do not involve rotation.
//
// Interfaces to the GEANT4 modified CLHEP classes G4ThreeVector &
// G4RotationMatrix
//
// For member function descriptions, see comments by declarations. For
// additional clarification, also check the `const' declarations for
// functions & their parameters.
//
// Private Member data:
//
// G4double rxx,rxy,rxz;
// G4double ryx,ryy,ryz; A 3x3 rotation matrix - net rotation
// G4double rzx,rzy,rzz;
// G4double tx,ty,tz; Net translation
//
// History:
// Paul R C Kent 6 Aug 1996 - initial version
//
// 19.09.96 E.Chernyaev:
// - direct access to the protected members of the G4RotationMatrix class
// replaced by access via public access functions
// - conversion of the rotation matrix to angle & axis used to get
// a possibility to remove "friend" from the G4RotationMatrix class
#ifndef G4AFFINETRANSFORM_HH
#define G4AFFINETRANSFORM_HH
#include "globals.hh"
#include "G4ThreeVector.hh"
#include "G4RotationMatrix.hh"
class G4AffineTransform
{
public:
G4AffineTransform();
// Translation only: Under t'form translate point at origin by tlate
G4AffineTransform(const G4ThreeVector &tlate);
// Rotation only: Under t'form rotate by rot
G4AffineTransform(const G4RotationMatrix &rot);
// Under t'form: Rotate by rot then translate by tlate
G4AffineTransform(const G4RotationMatrix &rot,
const G4ThreeVector &tlate);
// Optionally rotate by *rot then translate by tlate - rot may be null
G4AffineTransform(const G4RotationMatrix *rot,
const G4ThreeVector &tlate);
// NOTE: Compound Transforms
//
// tf2=tf2*tf1 equivalent to tf2*=tf1
//
// Returns compound transformation of self*tf
G4AffineTransform operator * (const G4AffineTransform &tf) const;
// (Modifying) Multiplies self by tf; Returns self reference
// ie. A=AB for a*=b
G4AffineTransform& operator *= (const G4AffineTransform &tf);
// 'Products' for avoiding (potential) temporaries
//
// c.Product(a,b) equivalent to c=a*b
//
// c.InverseProduct(a*b,b ) equivalent to c=a
//
// (Modifying) Sets self=tf1*tf2; Returns self reference
G4AffineTransform& Product(const G4AffineTransform &tf1,
const G4AffineTransform &tf2);
// (Modifying) Sets self=tf1*(tf2^-1); Returns self reference
G4AffineTransform& InverseProduct(const G4AffineTransform &tf1,
const G4AffineTransform &tf2);
// Transform the specified point: returns vec*rot+tlate
G4ThreeVector TransformPoint(const G4ThreeVector &vec) const;
// Transform the specified axis: returns
G4ThreeVector TransformAxis(const G4ThreeVector &axis) const;
// Transform the specified point (in place): sets vec=vec*rot+tlate
void ApplyPointTransform(G4ThreeVector &vec) const;
// Transform the specified axis (in place): sets axis=axis*rot;
void ApplyAxisTransform(G4ThreeVector &axis) const;
// Return inverse of current transform
G4AffineTransform Inverse() const;
// (Modifying) Sets self=inverse of self; Returns self reference
G4AffineTransform& Invert();
// (Modifying) Adjust net translation by given vector; Returns self reference
G4AffineTransform& operator +=(const G4ThreeVector &tlate);
G4AffineTransform& operator -=(const G4ThreeVector &tlate);
G4bool operator == (const G4AffineTransform &tf) const;
G4bool operator != (const G4AffineTransform &tf) const;
G4double operator [] (const G4int n) const;
// True if transform includes rotation
G4bool IsRotated() const;
// Ture if transform includes translation
G4bool IsTranslated() const;
G4RotationMatrix NetRotation() const;
G4ThreeVector NetTranslation() const;
void SetNetRotation(const G4RotationMatrix &rot);
void SetNetTranslation(const G4ThreeVector &tlate);
private:
G4AffineTransform( const G4double prxx,const G4double prxy,const G4double prxz,
const G4double pryx,const G4double pryy,const G4double pryz,
const G4double przx,const G4double przy,const G4double przz,
const G4double ptx,const G4double pty,const G4double ptz ) ;
G4double rxx,rxy,rxz;
G4double ryx,ryy,ryz;
G4double rzx,rzy,rzz;
G4double tx,ty,tz;
};
#include "G4AffineTransform.icc"
#endif
@@ -0,0 +1,377 @@
// This code implementation is the intellectual property of
// the RD44 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: G4AffineTransform.icc,v 2.1 1998/11/11 11:34:07 japost Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// G4AffineTransformation Inline implementation
//
inline G4AffineTransform::G4AffineTransform() :
rxx(1),rxy(0),rxz(0),
ryx(0),ryy(1),ryz(0),
rzx(0),rzy(0),rzz(1),
tx(0),ty(0),tz(0)
{}
inline G4AffineTransform::G4AffineTransform(const G4ThreeVector& tlate) :
rxx(1),rxy(0),rxz(0),
ryx(0),ryy(1),ryz(0),
rzx(0),rzy(0),rzz(1),
tx(tlate.x()),ty(tlate.y()),tz(tlate.z())
{}
inline G4AffineTransform::G4AffineTransform(const G4RotationMatrix& rot) :
rxx(rot.xx()),rxy(rot.xy()),rxz(rot.xz()),
ryx(rot.yx()),ryy(rot.yy()),ryz(rot.yz()),
rzx(rot.zx()),rzy(rot.zy()),rzz(rot.zz()),
tx(0),ty(0),tz(0)
{}
inline G4AffineTransform::G4AffineTransform( const G4RotationMatrix& rot,
const G4ThreeVector& tlate ) :
rxx(rot.xx()),rxy(rot.xy()),rxz(rot.xz()),
ryx(rot.yx()),ryy(rot.yy()),ryz(rot.yz()),
rzx(rot.zx()),rzy(rot.zy()),rzz(rot.zz()),
tx(tlate.x()),ty(tlate.y()),tz(tlate.z())
{}
inline G4AffineTransform::G4AffineTransform( const G4RotationMatrix *rot,
const G4ThreeVector& tlate) :
tx(tlate.x()),ty(tlate.y()),tz(tlate.z())
{
if (rot)
{
rxx=rot->xx();rxy=rot->xy();rxz=rot->xz();
ryx=rot->yx();ryy=rot->yy();ryz=rot->yz();
rzx=rot->zx();rzy=rot->zy();rzz=rot->zz();
}
else
{
rxx=1; rxy=0; rxz=0;
ryx=0; ryy=1; ryz=0;
rzx=0; rzy=0; rzz=1;
}
}
inline
G4AffineTransform::
G4AffineTransform( const G4double prxx,const G4double prxy,const G4double prxz,
const G4double pryx,const G4double pryy,const G4double pryz,
const G4double przx,const G4double przy,const G4double przz,
const G4double ptx,const G4double pty,const G4double ptz) :
rxx(prxx),rxy(prxy),rxz(prxz),
ryx(pryx),ryy(pryy),ryz(pryz),
rzx(przx),rzy(przy),rzz(przz),
tx(ptx),ty(pty),tz(ptz)
{}
inline G4AffineTransform G4AffineTransform::operator * (const G4AffineTransform& tf) const
{
return G4AffineTransform(
rxx*tf.rxx+rxy*tf.ryx+rxz*tf.rzx,
rxx*tf.rxy+rxy*tf.ryy+rxz*tf.rzy,
rxx*tf.rxz+rxy*tf.ryz+rxz*tf.rzz,
ryx*tf.rxx+ryy*tf.ryx+ryz*tf.rzx,
ryx*tf.rxy+ryy*tf.ryy+ryz*tf.rzy,
ryx*tf.rxz+ryy*tf.ryz+ryz*tf.rzz,
rzx*tf.rxx+rzy*tf.ryx+rzz*tf.rzx,
rzx*tf.rxy+rzy*tf.ryy+rzz*tf.rzy,
rzx*tf.rxz+rzy*tf.ryz+rzz*tf.rzz,
tx*tf.rxx+ty*tf.ryx+tz*tf.rzx+tf.tx,
tx*tf.rxy+ty*tf.ryy+tz*tf.rzy+tf.ty,
tx*tf.rxz+ty*tf.ryz+tz*tf.rzz+tf.tz);
}
inline G4AffineTransform& G4AffineTransform::operator *= (const G4AffineTransform& tf)
{
// Use temporaries for `in place' compound transform computation
G4double nrxx=rxx*tf.rxx+rxy*tf.ryx+rxz*tf.rzx;
G4double nrxy=rxx*tf.rxy+rxy*tf.ryy+rxz*tf.rzy;
G4double nrxz=rxx*tf.rxz+rxy*tf.ryz+rxz*tf.rzz;
G4double nryx=ryx*tf.rxx+ryy*tf.ryx+ryz*tf.rzx;
G4double nryy=ryx*tf.rxy+ryy*tf.ryy+ryz*tf.rzy;
G4double nryz=ryx*tf.rxz+ryy*tf.ryz+ryz*tf.rzz;
G4double nrzx=rzx*tf.rxx+rzy*tf.ryx+rzz*tf.rzx;
G4double nrzy=rzx*tf.rxy+rzy*tf.ryy+rzz*tf.rzy;
G4double nrzz=rzx*tf.rxz+rzy*tf.ryz+rzz*tf.rzz;
G4double ntx=tx*tf.rxx+ty*tf.ryx+tz*tf.rzx+tf.tx;
G4double nty=tx*tf.rxy+ty*tf.ryy+tz*tf.rzy+tf.ty;
G4double ntz=tx*tf.rxz+ty*tf.ryz+tz*tf.rzz+tf.tz;
tx=ntx; ty=nty; tz=ntz;
rxx=nrxx; rxy=nrxy; rxz=nrxz;
ryx=nryx; ryy=nryy; ryz=nryz;
rzx=nrzx; rzy=nrzy; rzz=nrzz;
return *this;
}
inline G4AffineTransform& G4AffineTransform::Product(const G4AffineTransform& tf1,
const G4AffineTransform& tf2)
{
rxx=tf1.rxx*tf2.rxx + tf1.rxy*tf2.ryx + tf1.rxz*tf2.rzx;
rxy=tf1.rxx*tf2.rxy + tf1.rxy*tf2.ryy + tf1.rxz*tf2.rzy;
rxz=tf1.rxx*tf2.rxz + tf1.rxy*tf2.ryz + tf1.rxz*tf2.rzz;
ryx=tf1.ryx*tf2.rxx + tf1.ryy*tf2.ryx + tf1.ryz*tf2.rzx;
ryy=tf1.ryx*tf2.rxy + tf1.ryy*tf2.ryy + tf1.ryz*tf2.rzy;
ryz=tf1.ryx*tf2.rxz + tf1.ryy*tf2.ryz + tf1.ryz*tf2.rzz;
rzx=tf1.rzx*tf2.rxx + tf1.rzy*tf2.ryx + tf1.rzz*tf2.rzx;
rzy=tf1.rzx*tf2.rxy + tf1.rzy*tf2.ryy + tf1.rzz*tf2.rzy;
rzz=tf1.rzx*tf2.rxz + tf1.rzy*tf2.ryz + tf1.rzz*tf2.rzz;
tx=tf1.tx*tf2.rxx + tf1.ty*tf2.ryx + tf1.tz*tf2.rzx + tf2.tx;
ty=tf1.tx*tf2.rxy + tf1.ty*tf2.ryy + tf1.tz*tf2.rzy + tf2.ty;
tz=tf1.tx*tf2.rxz + tf1.ty*tf2.ryz + tf1.tz*tf2.rzz + tf2.tz;
return *this;
}
inline G4AffineTransform&
G4AffineTransform::InverseProduct( const G4AffineTransform& tf1,
const G4AffineTransform& tf2)
{
G4double itf2tx = - tf2.tx*tf2.rxx - tf2.ty*tf2.rxy - tf2.tz*tf2.rxz;
G4double itf2ty = - tf2.tx*tf2.ryx - tf2.ty*tf2.ryy - tf2.tz*tf2.ryz;
G4double itf2tz = - tf2.tx*tf2.rzx - tf2.ty*tf2.rzy - tf2.tz*tf2.rzz;
rxx=tf1.rxx*tf2.rxx+tf1.rxy*tf2.rxy+tf1.rxz*tf2.rxz;
rxy=tf1.rxx*tf2.ryx+tf1.rxy*tf2.ryy+tf1.rxz*tf2.ryz;
rxz=tf1.rxx*tf2.rzx+tf1.rxy*tf2.rzy+tf1.rxz*tf2.rzz;
ryx=tf1.ryx*tf2.rxx+tf1.ryy*tf2.rxy+tf1.ryz*tf2.rxz;
ryy=tf1.ryx*tf2.ryx+tf1.ryy*tf2.ryy+tf1.ryz*tf2.ryz;
ryz=tf1.ryx*tf2.rzx+tf1.ryy*tf2.rzy+tf1.ryz*tf2.rzz;
rzx=tf1.rzx*tf2.rxx+tf1.rzy*tf2.rxy+tf1.rzz*tf2.rxz;
rzy=tf1.rzx*tf2.ryx+tf1.rzy*tf2.ryy+tf1.rzz*tf2.ryz;
rzz=tf1.rzx*tf2.rzx+tf1.rzy*tf2.rzy+tf1.rzz*tf2.rzz;
tx=tf1.tx*tf2.rxx+tf1.ty*tf2.rxy+tf1.tz*tf2.rxz+itf2tx;
ty=tf1.tx*tf2.ryx+tf1.ty*tf2.ryy+tf1.tz*tf2.rzy+itf2ty;
tz=tf1.tx*tf2.rzx+tf1.ty*tf2.rzy+tf1.tz*tf2.rzz+itf2tz;
return *this;
}
inline
G4ThreeVector G4AffineTransform::TransformPoint(const G4ThreeVector& vec) const
{
return G4ThreeVector( vec.x()*rxx + vec.y()*ryx + vec.z()*rzx + tx,
vec.x()*rxy + vec.y()*ryy + vec.z()*rzy + ty,
vec.x()*rxz + vec.y()*ryz + vec.z()*rzz + tz );
}
inline
G4ThreeVector G4AffineTransform::TransformAxis(const G4ThreeVector& axis) const
{
return G4ThreeVector( axis.x()*rxx + axis.y()*ryx + axis.z()*rzx,
axis.x()*rxy + axis.y()*ryy + axis.z()*rzy,
axis.x()*rxz + axis.y()*ryz + axis.z()*rzz );
}
inline
void G4AffineTransform::ApplyPointTransform(G4ThreeVector& vec) const
{
G4double x = vec.x()*rxx + vec.y()*ryx + vec.z()*rzx + tx;
G4double y = vec.x()*rxy + vec.y()*ryy + vec.z()*rzy + ty;
G4double z = vec.x()*rxz + vec.y()*ryz + vec.z()*rzz + tz;
vec.setX(x);
vec.setY(y);
vec.setZ(z);
}
inline
void G4AffineTransform::ApplyAxisTransform(G4ThreeVector& axis) const
{
G4double x = axis.x()*rxx + axis.y()*ryx + axis.z()*rzx;
G4double y = axis.x()*rxy + axis.y()*ryy + axis.z()*rzy;
G4double z = axis.x()*rxz + axis.y()*ryz + axis.z()*rzz;
axis.setX(x);
axis.setY(y);
axis.setZ(z);
}
inline
G4AffineTransform G4AffineTransform::Inverse() const
{
return G4AffineTransform( rxx, ryx, rzx,
rxy, ryy, rzy,
rxz, ryz, rzz,
-tx*rxx - ty*rxy - tz*rxz,
-tx*ryx - ty*ryy - tz*ryz,
-tx*rzx - ty*rzy - tz*rzz );
}
inline
G4AffineTransform& G4AffineTransform::Invert()
{
G4double v1 = -tx*rxx - ty*rxy - tz*rxz;
G4double v2 = -tx*ryx - ty*ryy - tz*ryz;
G4double v3 = -tx*rzx - ty*rzy - tz*rzz;
tx=v1; ty=v2; tz=v3;
G4double tmp1=ryx; ryx=rxy; rxy=tmp1;
G4double tmp2=rzx; rzx=rxz; rxz=tmp2;
G4double tmp3=rzy; rzy=ryz; ryz=tmp3;
return *this;
}
inline
G4AffineTransform& G4AffineTransform::operator +=(const G4ThreeVector& tlate)
{
tx += tlate.x();
ty += tlate.y();
tz += tlate.z();
return *this;
}
inline
G4AffineTransform& G4AffineTransform::operator -=(const G4ThreeVector& tlate)
{
tx -= tlate.x();
ty -= tlate.y();
tz -= tlate.z();
return *this;
}
inline
G4bool G4AffineTransform::operator == (const G4AffineTransform& tf) const
{
return (tx==tf.tx&&ty==tf.ty&&tz==tf.tz&&
rxx==tf.rxx&&rxy==tf.rxy&&rxz==tf.rxz&&
ryx==tf.ryx&&ryy==tf.ryy&&ryz==tf.ryz&&
rzx==tf.rzx&&rzy==tf.rzy&&rzz==tf.rzz) ? true : false;
}
inline
G4bool G4AffineTransform::operator != (const G4AffineTransform& tf) const
{
return (tx!=tf.tx||ty!=tf.ty||tz!=tf.tz||
rxx!=tf.rxx||rxy!=tf.rxy||rxz!=tf.rxz||
ryx!=tf.ryx||ryy!=tf.ryy||ryz!=tf.ryz||
rzx!=tf.rzx||rzy!=tf.rzy||rzz!=tf.rzz) ? true : false;
}
inline
G4double G4AffineTransform::operator [] (const G4int n) const
{
G4double v;
switch(n)
{
case 0:
v=rxx;
break;
case 1:
v=rxy;
break;
case 2:
v=rxz;
break;
case 4:
v=ryx;
break;
case 5:
v=ryy;
break;
case 6:
v=ryz;
break;
case 8:
v=rzx;
break;
case 9:
v=rzy;
break;
case 10:
v=rzz;
break;
case 12:
v=tx;
break;
case 13:
v=ty;
break;
case 14:
v=tz;
break;
case 3:
case 7:
case 11:
v=0;
break;
case 15:
v=1;
break;
}
return v;
}
inline
G4bool G4AffineTransform::IsRotated() const
{
return (rxx==1.0 && ryy==1.0 && rzz==1.0) ? false : true;
}
inline
G4bool G4AffineTransform::IsTranslated() const
{
return (tx || ty || tz) ? true:false;
}
inline G4RotationMatrix G4AffineTransform::NetRotation() const {
G4RotationMatrix m;
return m.rotateAxes(G4ThreeVector(rxx,ryx,rzx),
G4ThreeVector(rxy,ryy,rzy),
G4ThreeVector(rxz,ryz,rzz));
}
inline
G4ThreeVector G4AffineTransform::NetTranslation() const
{
return G4ThreeVector(tx,ty,tz);
}
inline
void G4AffineTransform::SetNetRotation(const G4RotationMatrix& rot)
{
rxx=rot.xx();
rxy=rot.xy();
rxz=rot.xz();
ryx=rot.yx();
ryy=rot.yy();
ryz=rot.yz();
rzx=rot.zx();
rzy=rot.zy();
rzz=rot.zz();
}
inline
void G4AffineTransform::SetNetTranslation(const G4ThreeVector& tlate)
{
tx=tlate.x();
ty=tlate.y();
tz=tlate.z();
}
@@ -0,0 +1,71 @@
// This code implementation is the intellectual property of
// the RD44 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: G4GeometryManager.hh,v 2.2 1998/07/13 16:51:17 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
// class G4GeometryManager
//
// A class resposible for high level geometrical functions, and for
// high level objects in the geometry subdomain.
// The class is `singleton', with access via G4GeometryManager::GetInstance
//
// Member functions:
//
// G4bool CloseGeometry(G4bool pOptimise=true);
// Close (`lock') the geometry: perform sanity and `completion' checks
// and optionally [default=yes] Build optimisation information.
//
// void OpenGeometry();
// Open (`unlock') the geometry and remove optimisation information if
// present.
//
// static G4GeometryManager* GetInstance()
// Return ptr to singleton instance of the class.
//
// Member data:
//
// static G4GeometryManager* fgInstance
// Ptr to the unique instance of class
//
// History:
// 26.07.95 P.Kent Initial version, incuding optimisation Build
#ifndef G4GEOMETRYMANAGER_HH
#define G4GEOMETRYMANAGER_HH
#include "globals.hh"
// Needed for building optimisations
#include "geomdefs.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4LogicalVolume.hh"
#include "G4SmartVoxelHeader.hh"
#ifdef G4GEOMETRY_VOXELDEBUG
#include "G4ios.hh"
#endif
class G4GeometryManager
{
public:
G4bool CloseGeometry(G4bool pOptimise=true);
void OpenGeometry();
static G4GeometryManager* GetInstance();
protected:
G4GeometryManager();
private:
void BuildOptimisations(const G4bool allOpt);
void DeleteOptimisations();
static G4GeometryManager* fgInstance;
G4bool fIsClosed;
};
#endif
@@ -0,0 +1,116 @@
// This code implementation is the intellectual property of
// the RD44 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: G4LogicalSurface.hh,v 2.0 1998/07/02 16:56:49 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
////////////////////////////////////////////////////////////////////////
// G4LogicalSurface Definition
////////////////////////////////////////////////////////////////////////
//
// File: G4LogicalSurface.hh
// Description: An abstraction of a geometrical surface, it is an abstract
// base class for different implementations of surfaces.
// Its primary function is to hold pointers
// to objects that describe the surface's physical properties.
// For example it holds a pointer to a surface's optical
// properties, and because of this it is used in processes like
// G4OpBoundaryProcess.
//
// Version: 1.0
// Created: 1997, June, 4th to 17th
// Author: John Apostolakis, (with help of Peter Gumplinger)
// mail: japost@mail.cern.ch
// Modified: 1997, June 26th John Apostolakis
//
// Id tag:
////////////////////////////////////////////////////////////////////////
#ifndef G4LogicalSurface_h
#define G4LogicalSurface_h 1
/////////////
// Includes
/////////////
#include "globals.hh"
#include "templates.hh"
class G4OpticalSurface;
class G4TransitionRadiationSurface;
/////////////////////
// Class Definition
/////////////////////
class G4LogicalSurface
{
////////////
// Methods
////////////
public:
G4OpticalSurface* GetOpticalSurface() const
{ return theOpticalSurface; }
void SetOpticalSurface(G4OpticalSurface* ptrOpticalSurface)
{ theOpticalSurface= ptrOpticalSurface; }
G4String GetName() const { return theName; }
void SetName(const G4String& name){theName = name;}
G4TransitionRadiationSurface* GetTransitionRadiationSurface() const
{ return theTransRadSurface; }
void SetTransitionRadiationSurface( G4TransitionRadiationSurface* transRadSurf )
{ theTransRadSurface= transRadSurf; }
////////////////////////////////
// Constructors and Destructor
////////////////////////////////
protected:
// There should be no instances of this class
G4LogicalSurface(const G4String& name,
G4OpticalSurface* opticalSurface);
// Is the name more meaningful for the properties or the logical
// surface ?
public:
virtual ~G4LogicalSurface();
private:
G4LogicalSurface(const G4LogicalSurface &right); // Copying restricted
//////////////
// Operators
//////////////
public:
G4int operator==(const G4LogicalSurface &right) const;
G4int operator!=(const G4LogicalSurface &right) const;
private:
const G4LogicalSurface& operator=(const G4LogicalSurface& right);
// ------------------
// Basic data members ( To define a 'logical' surface)
// ------------------
private:
G4String theName; // Surface name
G4OpticalSurface* theOpticalSurface;
G4TransitionRadiationSurface* theTransRadSurface;
};
////////////////////
// Inline methods
////////////////////
#include "G4LogicalSurface.icc"
#endif /* G4LogicalSurface_h */
@@ -0,0 +1,66 @@
// This code implementation is the intellectual property of
// the RD44 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: G4LogicalSurface.icc,v 2.1 1998/07/13 16:51:19 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
////////////////////////////////////////////////////////////////////////
// Surface Class Inline Methods
////////////////////////////////////////////////////////////////////////
//
// File: G4LogicalSurface.icc
// Description: A Surface class
// Version: 1.0
// Created: 1997-06-26
// Author: John Apostolakis
//
////////////////////////////////////////////////////////////////////////
// #include "G4ios.hh"
/////////////////////////
// Class Inline Methods
/////////////////////////
//////////////
// Operators
//////////////
inline const G4LogicalSurface & G4LogicalSurface::operator=(const G4LogicalSurface &right)
{
return right;
}
inline G4int G4LogicalSurface::operator==(const G4LogicalSurface &right) const
{
return (this == (G4LogicalSurface *) &right);
}
inline G4int G4LogicalSurface::operator!=(const G4LogicalSurface &right) const
{
return (this != (G4LogicalSurface *) &right);
}
/////////////////
// Constructors
/////////////////
inline G4LogicalSurface::G4LogicalSurface(const G4String& name,
G4OpticalSurface* opticalSurface)
: theName(name),
theOpticalSurface(opticalSurface)
{
}
inline G4LogicalSurface::G4LogicalSurface(const G4LogicalSurface &right)
{
*this = right;
}
inline G4LogicalSurface::~G4LogicalSurface()
{
}
@@ -0,0 +1,263 @@
// This code implementation is the intellectual property of
// the RD44 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: G4LogicalVolume.hh,v 2.1 1998/11/11 11:20:28 japost Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// class G4LogicalVolume
//
// Represents a leaf node or unpositioned subtree in the geometry hierarchy.
// Logical volumes are named, and may have daughters ascribed to them.
// They are responsible for retrieval of the physical and tracking attributes
// of the physical volume that it represents: Solid, material, magnetic field,
// and optionally: user limits, sensitive detectors.
//
// Get and Set functionality is provided for all atributes, but note that
// most set functions should not be used when the geometry is `closed'.
// As a further development, `Guard' checks can be added to ensure
// only legal operations at tracking time.
//
// On construction, solid, material and name must be specified
//
//
// Daughters are ascribed and managed by means of a simple
// GetNoDaughters,Get&SetDaughter(n),AddDaughter interface
//
// Smart voxels as used for tracking optimisation are also an attribute.
//
// Logical volumes self register to the logical volume Store on construction,
// and deregister on destruction.
//
// NOTE: This class is currently *NOT* subclassed. If subclassed make
// destructor virtual.
//
// Member functions:
//
// G4LogicalVolume(const G4VSolid *pSolid, const G4Material *pMaterial,
// const G4String& name,
// const G4MagneticField *pField=0,
// const G4VSensitiveDetector *pSDetector=0,
// const G4UserLimits *pULimits=0)
//
// Constructor. The solid and material pointer must be non null. The
// parameters for field, detector and user limits are optional.
// The volume also enters itself into the logical volume Store.
//
// ~G4LogicalVolume()
// Destructor. Removes the logical volume from the logical volume Store.
//
// G4String GetName() const
// Returns name of logical volume
// void SetName(const G4String& pName)
// Sets name of logical volume
//
// G4int GetNoDaughters() const
// Returns the number of daughters (0 to n)
// G4VPhysicalVolume* GetDaughter(const G4int i) const
// Return the ith daughter. Note numbering starts from 0, and no bounds
// checkingis performed.
// void SetDaughter(const G4int i,G4VPhysicalVolume* p)
// Set the ith daughter to be p, where 0<=i<GetNoDaughters(). Intended
// for UI use only
// void AddDaughter(G4VPhysicalVolume* p)
// Add the volume p as a daughter of the current logical volume.
// G4bool IsDaughter(const G4VPhsyicalVolume* p) const
// Returns true is the volume p is a daughter of the current logical volume
// void RemoveDaughter(const G4VPhysicalVolume* p )
// Remove the volume p from the List of daughter of the current logical
// volume.
//
// G4VSolid* GetSolid() const
// Gets current solid.
// void SetSolid(G4VSolid *pSolid)
// Sets solid.
//
// G4Material* GetMaterial() const
// Gets current Material.
// void SetMaterial(G4Material *pMaterial)
// Sets Material.
//
// G4FieldManager* GetFieldManager() const
// Gets current FieldManager.
// void SetFieldManager(G4FieldManager *pField, G4bool forceToAllDaughters)
// Sets FieldManager and propagates it
// i) only to daughters with G4FieldManager = 0 if forceToAllDaughters=false
// ii) to all daughters if forceToAllDaughters=true
//
// G4VSensitiveDetector* GetSensitiveDetector() const
// Gets current SensitiveDetector.
// void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)
// Sets SensitiveDetector (can be NULL)
//
// G4UserLimits* GetUserLimits() const
// Gets current UserLimits.
// void SetUserLimits(G4UserLimits *pULimits)
// Sets UserLimits.
//
// G4VoxelHeader* GetVoxelHeader() const
// Gets current VoxelHeader.
// void SetVoxelHeader(G4VoxelHeader *pVoxel)
// Sets VoxelHeader.
//
// void BecomeEnvelopeForFastSimulation(G4FastSimulationManager* );
// Makes this an Envelope for given FastSimulationManager.
// Ensures that all its daughter volumes get it too - unless they
// have one already.
// G4FastSimulationManager* GetFastSimulationManager () const;
// Gets current FastSimulationManager pointer.
// void ClearEnvelopeForFastSimulation(G4LogicalVolume* motherLogVol);
// Erase volume's Envelope status and propagate the FastSimulationManager
// of its mother volume to itself and its daughters.
//
// void SetFastSimulationManager (G4FastSimulationManager* pPA,
// G4bool IsEnvelope);
// Sets the fast simulation manager. Private method called by the
// public SetIsEnvelope method with IsEnvelope = TRUE. It is
// then called recursivaly to the daughters to propagate the
// FastSimulationManager pointer with IsEnvelope = FALSE.
//
// void SetBiasWeight (G4double w);
// Sets the bias weight
// G4double GetBiasWeight() const;
// Gets the bias weight
//
// Operators:
//
// G4bool operator == (G4LogicalVolume,G4LogicalVolume)
// Equality defined by address only- return true if objects are at
// same address, else false
//
//
// Member data:
//
// RWTPtrOrderedVector<G4VPhysicalVolume> fDaughters
// Vector of daughters. Given initial size of 0.
// G4FieldManager *fFieldManager
// Pointer (possibly NULL) to (magnetic or other) field manager object
// G4Material *fMaterial
// Pointer to material at this node
// G4String fName
// Name of logical volume
// G4SensitiveDetector *fSensitiveDetector
// Pointer (possibly NULL) to `Hit' object
// G4VSolid *fSolid
// Pointer to solid
// G4UserLimits *fUserLimits
// Pointer (possibly NULL) to user Step limit object for this node
// G4VoxelHeader *fVoxel
// Pointer (possibly NULL) to optimisation info objects
// G4FastSimulationManager *fFastSimulationManager
// Pointer (possibly NULL) to G4FastSimulationManager object
// G4bool fIsEnvelope
// Flags if the Logical Volume is an envelope for a FastSimulationManager.
// G4double fBiasWeight
// weight used in the event biasing technique
//
// History:
// 09.11.98 J. Apostolakis: Changed G4MagneticField to G4FieldManager
// 09.11.98 M. Verderi & JA. : added BiasWeight member and Get/Set methods
// 10.20.97 P. MoraDeFreitas : added pointer to a FastSimulation
// (J.Apostolakis) & flag to indicate if it is an Envelope for it
// 19.11.96 J.Allison Replaced G4Visible with explicit const G4VisAttributes*.
// 19.08.96 P.Kent Split -> hh/icc/cc files; G4VSensitiveDetector change
// 11.07.95 P.Kent Initial version.
#ifndef G4LOGICALVOLUME_HH
#define G4LOGICALVOLUME_HH
#include "globals.hh"
#include "G4VPhysicalVolume.hh" // Need operator == for vector fdaughters
#include <rw/tpordvec.h>
#include <assert.h>
// Forward declarations
class G4FieldManager;
class G4Material;
class G4VSensitiveDetector;
class G4VSolid;
class G4UserLimits;
class G4SmartVoxelHeader;
class G4VisAttributes;
class G4FastSimulationManager;
class G4LogicalVolume
{
public:
G4LogicalVolume(G4VSolid *pSolid, G4Material *pMaterial,
const G4String& name,
G4FieldManager *pFieldMgr=0,
G4VSensitiveDetector *pSDetector=0,
G4UserLimits *pULimits=0);
~G4LogicalVolume();
G4String GetName() const;
void SetName(const G4String& pName);
G4int GetNoDaughters() const;
G4VPhysicalVolume* GetDaughter(const G4int i) const;
void AddDaughter(G4VPhysicalVolume* p);
G4bool IsDaughter(const G4VPhysicalVolume* p) const;
void RemoveDaughter(const G4VPhysicalVolume* p);
G4VSolid* GetSolid() const;
void SetSolid(G4VSolid *pSolid);
G4Material* GetMaterial() const;
void SetMaterial(G4Material *pMaterial);
G4FieldManager* GetFieldManager() const;
void SetFieldManager(G4FieldManager *pFieldMgr, G4bool forceToAllDaughters);
G4VSensitiveDetector* GetSensitiveDetector() const;
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector);
G4UserLimits* GetUserLimits() const;
void SetUserLimits(G4UserLimits *pULimits);
G4SmartVoxelHeader* GetVoxelHeader() const;
void SetVoxelHeader(G4SmartVoxelHeader *pVoxel);
G4bool operator == ( const G4LogicalVolume& lv) const;
const G4VisAttributes* GetVisAttributes () const;
void SetVisAttributes (const G4VisAttributes* pVA);
void SetVisAttributes (const G4VisAttributes& VA);
void BecomeEnvelopeForFastSimulation(G4FastSimulationManager* );
void ClearEnvelopeForFastSimulation(G4LogicalVolume* motherLV= 0);
G4FastSimulationManager* GetFastSimulationManager () const;
void SetBiasWeight (G4double w);
G4double GetBiasWeight() const;
private:
void SetFastSimulationManager (G4FastSimulationManager* pPA,
G4bool IsEnvelope);
G4LogicalVolume* FindMotherLogicalVolumeForEnvelope();
//
// Data members:
private:
RWTPtrOrderedVector<G4VPhysicalVolume> fDaughters;
G4FieldManager *fFieldManager;
G4Material *fMaterial;
G4String fName;
G4VSensitiveDetector *fSensitiveDetector;
G4VSolid *fSolid;
G4UserLimits *fUserLimits;
G4SmartVoxelHeader *fVoxel;
const G4VisAttributes* fVisAttributes;
G4FastSimulationManager *fFastSimulationManager;
G4bool fIsEnvelope;
G4double fBiasWeight;
};
#include "G4LogicalVolume.icc"
#endif
@@ -0,0 +1,180 @@
// This code implementation is the intellectual property of
// the RD44 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: G4LogicalVolume.icc,v 2.1 1998/11/18 13:58:59 japost Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// class G4LogicalVolume Inline Implementation file
//
// 10.20.97 - P. MoraDeFreitas : Added SetFastSimulation method.
// 05.11.98 - M. Verderi: Add Get/Set methods for fBiasWeight
// 09.11.98 - J. Apostolakis: Changed MagneticField to FieldManager
inline G4String G4LogicalVolume::GetName() const
{
return fName;
}
inline void G4LogicalVolume::SetName(const G4String& pName)
{
fName=pName;
}
inline G4FieldManager* G4LogicalVolume::GetFieldManager() const
{
return fFieldManager;
}
inline G4int G4LogicalVolume::GetNoDaughters() const
{
return fDaughters.entries();
}
inline G4VPhysicalVolume* G4LogicalVolume::GetDaughter(const G4int i) const
{
return fDaughters(i);
}
inline G4FastSimulationManager*
G4LogicalVolume::GetFastSimulationManager () const
{
return fFastSimulationManager;
}
inline void G4LogicalVolume::AddDaughter(G4VPhysicalVolume* pNewDaughter)
{
// manual resize operation to avoid Rogue grabbing RW_DEFAULT
fDaughters.resize(fDaughters.entries()+1);
fDaughters.insert(pNewDaughter);
// Propagates the mother's FastSimulationManager pointer. If we are in
// the World logical volume, propagates only if pointer != 0.
// (perhaps someone would like to parametrize all the World volume
// for a particle type, why not ?).
G4VPhysicalVolume *myPhysical= pNewDaughter->GetMother();
G4VPhysicalVolume *pMotherPhys;
G4LogicalVolume *pDaughterLogical;
if( myPhysical !=0 ){
pMotherPhys= myPhysical->GetMother();
pDaughterLogical = pNewDaughter->GetLogicalVolume();
if( (pMotherPhys!=0) ||
( pMotherPhys==0) && (fFastSimulationManager!=0))
{
if(pDaughterLogical->GetFastSimulationManager() != fFastSimulationManager)
pDaughterLogical->
SetFastSimulationManager(fFastSimulationManager,FALSE);
}
else {
pDaughterLogical->SetFastSimulationManager(NULL,FALSE);
}
}
// Propagate the Field Manager, if the daughter has no field Manager.
pDaughterLogical = pNewDaughter->GetLogicalVolume();
G4FieldManager* pDaughterFieldManager = pDaughterLogical->GetFieldManager();
if( pDaughterFieldManager == 0 ){
pDaughterLogical->SetFieldManager(fFieldManager,
true);
}
}
inline G4bool G4LogicalVolume::IsDaughter(const G4VPhysicalVolume* p) const
{
return fDaughters.contains(p);
}
inline void G4LogicalVolume::RemoveDaughter(const G4VPhysicalVolume* p)
{
fDaughters.remove(p);
fDaughters.resize(fDaughters.entries());
}
inline G4VSolid* G4LogicalVolume::GetSolid() const
{
return fSolid;
}
inline void G4LogicalVolume::SetSolid(G4VSolid *pSolid)
{
assert(pSolid != 0);
fSolid=pSolid;
}
inline G4Material* G4LogicalVolume::GetMaterial() const
{
return fMaterial;
}
inline void G4LogicalVolume::SetMaterial(G4Material *pMaterial)
{
// assert(pMaterial != 0);
fMaterial=pMaterial;
}
inline G4VSensitiveDetector* G4LogicalVolume::GetSensitiveDetector() const
{
return fSensitiveDetector;
}
inline void G4LogicalVolume::SetSensitiveDetector(G4VSensitiveDetector *pSDetector)
{
fSensitiveDetector=pSDetector;
}
inline G4UserLimits* G4LogicalVolume::GetUserLimits() const
{
return fUserLimits;
}
inline void G4LogicalVolume::SetUserLimits(G4UserLimits *pULimits)
{
fUserLimits=pULimits;
}
inline G4SmartVoxelHeader* G4LogicalVolume::GetVoxelHeader() const
{
return fVoxel;
}
inline void G4LogicalVolume::SetVoxelHeader(G4SmartVoxelHeader *pVoxel)
{
fVoxel=pVoxel;
}
inline G4bool G4LogicalVolume::operator == ( const G4LogicalVolume& lv) const
{
return (this==&lv) ? true : false;
}
inline const G4VisAttributes* G4LogicalVolume::GetVisAttributes () const {
return fVisAttributes;
}
inline void G4LogicalVolume::SetVisAttributes (const G4VisAttributes* pVA) {
fVisAttributes = pVA;
}
inline void G4LogicalVolume::SetVisAttributes (const G4VisAttributes& VA) {
fVisAttributes = &VA;
}
inline void
G4LogicalVolume::BecomeEnvelopeForFastSimulation(G4FastSimulationManager* pPA) {
SetFastSimulationManager(pPA,TRUE);
}
inline void G4LogicalVolume::SetBiasWeight(G4double w)
{ fBiasWeight = w; }
inline G4double G4LogicalVolume::GetBiasWeight() const
{ return fBiasWeight; }
@@ -0,0 +1,68 @@
// This code implementation is the intellectual property of
// the RD44 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: G4LogicalVolumeStore.hh,v 2.0 1998/07/02 16:56:53 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
// class G4LogicalVolumeStore
//
// Container for all LogicalVolumes, with functionality derived from
// RWTPtrOrderedVector<T>. The class is `singleton', in that only
// one can exist, and access is facillitated via G4LogicalVolumeStore::GetInstance()
//
// All LogicalVolumes should be registered with G4LogicalVolumeStore, and removed on their
// destruction. Intended principally for UI browser. The underlying
// container initially has a capacity of 100.
//
// If much additional functionality is added, should consider containment
// instead of inheritance for RWTPtrOrderedVector<T>
//
// Class member functions:
//
// static void Register(G4LogicalVolume* pVolume)
// Add the logical volume to the collection
// static void DeRegister(G4LogicalVolume* pVolume)
// REmove the logical volume from the collection
// static G4LogicalVolumeStore* GetInstance()
// Get a ptr to the unique G4LogicalVolumeStore, creting it if necessary
//
// Member functions:
//
// [as per RWTPtrOrderedvector]
//
// NOTE: Constructor is protected - creation and subsequent access is via
// GetInstance
//
// Member data:
//
// static G4LogicalVolumeStore* fgInstance
// Ptr to the single G4LogicalVolumeStore
//
// History:
// 10.07.95 P.Kent Initial version
#ifndef G4VLOGICALVOLUMESTORE_HH
#define G4VLOGICALVOLUMESTORE_HH
#include <rw/tpordvec.h>
#include "G4LogicalVolume.hh"
class G4LogicalVolumeStore : public RWTPtrOrderedVector<G4LogicalVolume>
{
public:
static void Register(G4LogicalVolume* pVolume);
static void DeRegister(G4LogicalVolume* pVolume);
static G4LogicalVolumeStore* GetInstance();
virtual ~G4LogicalVolumeStore();
protected:
G4LogicalVolumeStore();
private:
static G4LogicalVolumeStore* fgInstance;
};
#endif
@@ -0,0 +1,79 @@
// This code implementation is the intellectual property of
// the RD44 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: G4PVParameterised.hh,v 2.1 1998/07/12 02:55:33 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// class G4PVParameterised
//
// Represents many touchable detector elements differing in their
// positioning and dimensions. Both are calculated by means
// of a G4VParameterisation object. The positioning is assumed to
// be dominant along a cartesian axis (specified).
//
// G4PVParameterised(const G4String& pName,
// G4LogicalVolume *pLogical,
// G4VPhysicalVolume *pMother,
// const EAxis pAxis,
// const G4int nReplicas,
// G4VPVParameteriastion *pParam)
//
// Replicate the volume nReplicas Times using the paramaterisation pParam,
// withing the mother volume pMother. The positioning of the replicas
// is dominant along the specified axis
//
// G4PVParameterised(const G4String& pName,
// G4LogicalVolume *pLogical,
// G4LogicalVolume *pMotherLogical,
// const EAxis pAxis,
// const G4int nReplicas,
// G4VPVParameteriastion *pParam)
//
// Almost exactly similar to first constructor, changing only mother
// pointer's type to LogicalVolume.
//
// History:
// 29.07.95 P.Kent First non-stub version
#ifndef G4PVPARAMETERISED_HH
#define G4PVPARAMETERISED_HH
#include "G4PVReplica.hh"
class G4PVParameterised : public G4PVReplica
{
public:
G4PVParameterised(const G4String& pName,
G4LogicalVolume* pLogical,
G4VPhysicalVolume* pMother,
const EAxis pAxis,
const G4int nReplicas,
G4VPVParameterisation *pParam);
G4PVParameterised(const G4String& pName,
G4LogicalVolume* pLogical,
G4LogicalVolume* pMotherLogical,
const EAxis pAxis,
const G4int nReplicas,
G4VPVParameterisation *pParam);
virtual G4VPVParameterisation* GetParameterisation() const;
virtual void GetReplicationData(EAxis& axis,
G4int& nReplicas,
G4double& width,
G4double& offset,
G4bool& consuming) const;
private:
G4VPVParameterisation *fparam;
};
#endif
@@ -0,0 +1,155 @@
// This code implementation is the intellectual property of
// the RD44 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: G4PVPlacement.hh,v 2.1 1998/07/12 02:55:33 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// class G4PVPlacement
//
// Class representing a single volume positioned within and relative
// to a mother volume.
//
//
// G4PVPlacement(G4RotationMatrix *pRot, // 1st constructor
// const G4Threevector &tlate,
// const G4String& pName,
// G4LogicalVolume *pLogical,
// G4VPhysicalVolume *pMother,
// G4bool pMany,
// G4int pCopyNo)
//
// Initialise a single volume, positioned in a frame which is rotated by
// *pFrameRot, relative to the coordinate system of the mother volume pMother.
// The center of the object is then placed at volumeCenterCrd in
// the new coordinates.
// If pRot=0 the volume is unrotated with respect to its mother.
// The physical volume is added to the mother's logical volume.
// (The above are exactly the arguments of G4VPhysicalVolume)
// Arguments particular to G4PVPlacement:
// pMany must be true if the volume is MANY in the GEANT 3 sense, else false
// pCopyNo should be set to 0 for the first volume of a given type
//
//
// G4PVPlacement(const G4Transform3D &Transform3D, // 2nd constructor
// const G4String &pName,
// G4LogicalVolume *pLogical,
// G4VPhysicalVolume *pMother,
// G4bool pMany,
// G4int pCopyNo);
//
// Additional constructor, which expects a G4Transform3D that represents
// the direct rotation and translation of the solid (NOT of the frame).
// To repeat: the G4Transform3D argument should be constructed by
// i) First rotating it to align the solid to the system of
// reference of its mother volume *pMother, and
// ii) Then placing the solid at the location Transform3D.getTranslation(),
// with respect to the origin of the system of coordinates of the
// mother volume.
// ( This is useful for the people who prefer to think in terms
// of moving objects in a given reference frame. )
// All other arguments are the same as for the previous constructor.
//
//
// G4PVPlacement::G4PVPlacement(G4RotationMatrix *pRot, // 3rd constructor
// const G4ThreeVector &tlate,
// G4LogicalVolume *pCurrentLogical,
// const G4String& pName,
// G4LogicalVolume *pMotherLogical,
// G4bool pMany,
// G4int pCopyNo);
//
// A simple variation of the 1st constructor, only specifying the
// mother volume as a pointer to its logical volume instead of its physical
// volume. [ This is a very natural way of defining a physical volume, and
// is especially useful when creating subdetectors: the mother volumes is
// not placed until a later stage of the assembly program. ]
//
//
// G4PVPlacement(const G4Transform3D &Transform3D, // 4th constructor
// G4LogicalVolume *pCurrentLogical,
// const G4String& pName,
// G4LogicalVolume *pMotherLogical,
// G4bool pMany,
// G4int pCopyNo);
//
// Utilises both variations above (from 2nd and 3rd constructor).
//
// History:
// 24.07.95 P.Kent First non-stub version
// 25.07.96 P.Kent Modified interface for new `Replica' capable geometry
// 28.08.96 P.Kent Tidied + transform replaced by rotmat+vector
// 28.02.97 J.Apostolakis Added 2nd constructor with G4Transform3D of solid.
// 11.07.97 J.Apostolakis Added 3rd constructor with pMotherLogical
// 11.05.98 J.Apostolakis Added 4th constructor with G4Transform3D & pMotherLV
#ifndef G4PVPLACEMENT_HH
#define G4PVPLACEMENT_HH
#include "G4VPhysicalVolume.hh"
// class G4Transform3D;
#include "G4Transform3D.hh"
class G4PVPlacement : public G4VPhysicalVolume
{
public:
G4PVPlacement(G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
const G4String &pName,
G4LogicalVolume *pLogical,
G4VPhysicalVolume *pMother,
G4bool pMany,
G4int pCopyNo);
G4PVPlacement(const G4Transform3D &Transform3D,
const G4String &pName,
G4LogicalVolume *pLogical,
G4VPhysicalVolume *pMother,
G4bool pMany,
G4int pCopyNo);
G4PVPlacement(G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
G4LogicalVolume *pCurrentLogical,
const G4String& pName,
G4LogicalVolume *pMotherLogical,
G4bool pMany,
G4int pCopyNo);
G4PVPlacement(const G4Transform3D &Transform3D,
G4LogicalVolume *pCurrentLogical,
const G4String& pName,
G4LogicalVolume *pMotherLogical,
G4bool pMany,
G4int pCopyNo);
~G4PVPlacement();
virtual G4bool IsMany() const;
virtual G4int GetCopyNo() const;
virtual void SetCopyNo(G4int CopyNo);
virtual G4bool IsReplicated() const;
virtual G4VPVParameterisation* GetParameterisation() const;
virtual void GetReplicationData(EAxis& axis,
G4int& nReplicas,
G4double& width,
G4double& offset,
G4bool& consuming) const;
virtual void Setup(G4VPhysicalVolume *pMother);
private:
G4bool fmany; // flag for booleans
G4bool fallocatedRotM; // flag for allocation of Rotation Matrix
G4int fcopyNo; // for identification
// Auxiliary function for 2nd constructor (one with G4Transform3D)
// Creates a new RotMatrix on the heap (using "new") and copies
// its argument into it.
static G4RotationMatrix* NewPtrRotMatrix(const G4RotationMatrix &RotMat);
};
#endif
@@ -0,0 +1,116 @@
// This code implementation is the intellectual property of
// the RD44 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: G4PVReplica.hh,v 2.0 1998/07/02 16:56:55 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// class G4PVReplica
//
// Represents many touchable detector elements differing only in their
// positioning. The elements' positions are calculated by means of a simple
// linear formula, and the elements completely fill the containing mother
// volume.
//
// G4PVReplica(const G4String& pName,
// G4LogicalVolume *pLogical,
// G4VPhysicalVolume *pMother,
// const EAxis pAxis,
// const G4int nReplicas,
// const G4double width,
// const G4double offset=0);
//
// G4PVReplica(const G4String& pName,
// G4LogicalVolume *pLogical,
// G4LogicalVolume *pMother,
// const EAxis pAxis,
// const G4int nReplicas,
// const G4double width,
// const G4double offset=0);
//
// Replication may occur along:
//
// o Cartesian axes (kXAxis,kYAxis,kZAxis)
//
// The replications, of specified width have coordinates of
// form (-width*(nReplicas-1)*0.5+n*width,0,0) where n=0.. nReplicas-1
// for the case of kXAxis, and are unrotated.
//
// o Radial axis (cylindrical polar) (kRho)
//
// The replications are cons/tubs sections, centred on the origin
// and are unrotated.
// They have radii of width*n+offset to width*(n+1)+offset
// where n=0..nReplicas-1
//
// o Phi axis (cylindrical polar) (kPhi)
// The replications are `phi sections' or wedges, and of cons/tubs form
// They have phi of offset+n*width to offset+(n+1)*width where
// n=0..nReplicas-1
//
// History:
// 29.07.95 P.Kent First non-stub version
// 26.10.97 J.Apostolakis Added constructor that takes mother logical volume
// 16.02.98 J.Apostolakis Added copy number
#ifndef G4PVREPLICA_HH
#define G4PVREPLICA_HH
#include "G4VPhysicalVolume.hh"
#include "G4RotationMatrix.hh"
class G4PVReplica : public G4VPhysicalVolume
{
public:
G4PVReplica(const G4String& pName,
G4LogicalVolume* pLogical,
G4VPhysicalVolume* pMother,
const EAxis pAxis,
const G4int nReplicas,
const G4double width,
const G4double offset=0);
G4PVReplica(const G4String& pName,
G4LogicalVolume* pLogical,
G4LogicalVolume* pMother,
const EAxis pAxis,
const G4int nReplicas,
const G4double width,
const G4double offset=0);
~G4PVReplica();
virtual G4bool IsMany() const;
virtual G4int GetCopyNo() const;
virtual void SetCopyNo(G4int CopyNo);
virtual G4bool IsReplicated() const;
virtual G4VPVParameterisation* GetParameterisation() const;
virtual void GetReplicationData(EAxis& axis,
G4int& nReplicas,
G4double& width,
G4double& offset,
G4bool& consuming) const;
virtual void Setup(G4VPhysicalVolume *pMother);
private:
void CheckAndSetParameters(
const EAxis pAxis,
const G4int nReplicas,
const G4double width,
const G4double offset);
protected:
EAxis faxis;
G4int fnReplicas;
G4double fwidth,foffset;
G4int fcopyNo;
};
#endif
@@ -0,0 +1,76 @@
// This code implementation is the intellectual property of
// the RD44 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: G4PhysicalVolumeStore.hh,v 2.0 1998/07/02 16:57:02 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
// class G4PhysicalVolume
//
// Container for all solids, with functionality derived from
// RWTPtrOrderedVector<T>. The class is `singleton', in that only
// one can exist, and access is facillitated via
// G4PhysicalVolumeStore::GetInstance()
//
// All solids should be registered with G4PhysicalVolumeStore, and removed on
// their destruction. Intended principally for UI browser. The underlying
// container initially has a capacity of 100.
//
// If much additional functionality is added, should consider containment
// instead of inheritance for RWTPtrOrderedVector<T>
//
// Class member functions:
//
// static void Register(G4VPhysicalVolume* pVolume)
// Add the volume to the collection
// static void DeRegister(G4VPhysicalVolume* pVolume)
// Remove the volume from the collection
// static G4PhysicalVolumeStore* GetInstance()
// Get a ptr to the unique G4PhysicalVolumeStore, creating it if necessary
//
// Member functions:
//
// [as per RWTPtrOrderedvector]
//
// NOTE: Constructor is protected - creation and subsequent access is via
// GetInstance
//
// Member data:
//
// static G4PhysicalVolumeStore*
// Ptr to the single G4PhysicalVolumeStore
//
// History:
// 25.07.95 P.Kent Initial version
#ifndef G4PHYSICALVOLUMESTORE_HH
#define G4PHYSICALVOLUMESTORE_HH
#include <rw/tpordvec.h>
#include "G4VPhysicalVolume.hh"
class G4PhysicalVolumeStore : public RWTPtrOrderedVector<G4VPhysicalVolume>
{
public:
static void Register(G4VPhysicalVolume* pSolid);
static void DeRegister(G4VPhysicalVolume* pSolid);
static G4PhysicalVolumeStore* GetInstance();
virtual ~G4PhysicalVolumeStore();
protected:
G4PhysicalVolumeStore();
private:
static G4PhysicalVolumeStore* fgInstance;
};
#endif
@@ -0,0 +1,239 @@
// This code implementation is the intellectual property of
// the RD44 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: G4SmartVoxelHeader.hh,v 2.1 1998/11/11 11:34:07 japost Exp $
// GEANT4 tag $Name: geant4-00 $
//
// class G4SmartVoxelHeader
//
// Represents set of voxels, created by a single axis of virtual division.
// Contains the individual voxels, which are potentially further divided
// along different axes
//
// Member functions:
//
// G4SmartVoxelHeader(G4LogicalVolume* pVolume,const G4int pSlice=0)
// Constructor for topmost header, to begin voxel construction at a
// given logical volume. pSlice is used to set max and min equivalent slice
// nos for the header - they apply to the level of the header, not its nodes.
//
// ~G4SmartVoxelHeader()
// Delete all referenced nodes [but *not* referenced physical volumes]
//
// EAxis GetAxis() const
// Return the current division axis
//
// G4double GetMaxExtent() const
// Return the maximum coordinate limit along the current axis
// G4double GetMinExtent() const
// Return the minimum coordinate limit along the current axis
//
// G4int GetNoSlices() const
// Return the no of slices along the current axis
// G4SmartVoxelProxy* GetSlice(const G4int n) const
// Return ptr to the proxy for the nth slice (numbering from 0, no
// bounds checking)
//
//
// Private functions:
//
// G4SmartVoxelHeader(G4LogicalVolume* pVolume,G4VoxelLimits& pLimits,
// RWTValOrderedVector<G4int>& pCandidates,
// const G4int pSlice=0)
// Build and refine voxels between specified limits, considering only
// the physical volumes numbered `pCandidates'. pSlice is used to set max
// and min equivalent slice nos for the header - they apply to the level
// of the header, not its nodes.
//
// extra functions...
// Member data:
//
// EAxis faxis
// The (cartesian) slicing/division axis
// G4double fmaxExtent
// G4double fminExtent
// Minimum and maximum coordiantes along the axis
// RWTPtrOrderedVector<G4SmartVoxelProxy> fslices
// The slices along the axis
//
// G4int fminEquivalent
// G4int fmaxEquivalent
// Minimum and maximum equivalent slice nos. [Applies to the level of
// the header, not its nodes]
//
// History:
// 13.07.95 P.Kent Initial version
#ifndef G4SMARTVOXELHEADER_HH
#define G4SMARTVOXELHEADER_HH
#include "globals.hh"
#include "geomdefs.hh"
#include "voxeldefs.hh"
#include "G4SmartVoxelProxy.hh"
#include "G4SmartVoxelNode.hh"
#include "G4ios.hh"
#include <rw/tvvector.h>
#include <rw/tpordvec.h>
#include <rw/tvordvec.h>
// Forward declarations
class G4LogicalVolume;
class G4VoxelLimits;
class G4VPhysicalVolume;
typedef RWTPtrOrderedVector<G4SmartVoxelProxy> G4ProxyVector;
typedef RWTPtrOrderedVector<G4SmartVoxelNode> G4NodeVector;
typedef RWTValOrderedVector<G4int> G4VolumeNosVector;
typedef RWTValVector<G4double> G4VolumeExtentVector;
class G4SmartVoxelHeader
{
public:
// Constructor for topmost header, to begin voxel construction at a
// given logical volume
G4SmartVoxelHeader(G4LogicalVolume* pVolume,const G4int pSlice=0);
~G4SmartVoxelHeader();
// Access functions for min/max equivalent slices (nodes & headers)
G4int GetMaxEquivalentSliceNo() const
{
return fmaxEquivalent;
}
void SetMaxEquivalentSliceNo(const G4int pMax)
{
fmaxEquivalent=pMax;
}
G4int GetMinEquivalentSliceNo() const
{
return fminEquivalent;
}
void SetMinEquivalentSliceNo(const G4int pMin)
{
fminEquivalent=pMin;
}
// Axis enquiry
EAxis GetAxis() const
{
return faxis;
}
// Extent enquiry functions
G4double GetMaxExtent() const
{
return fmaxExtent;
}
G4double GetMinExtent() const
{
return fminExtent;
}
// Slice enquiry functions
G4int GetNoSlices() const
{
return fslices.entries();
}
// Slice access
G4SmartVoxelProxy* GetSlice(const G4int n) const
{
return fslices(n);
}
// True if all slices equal (after collection)
G4bool AllSlicesEqual() const;
G4bool operator == (const G4SmartVoxelHeader& pHead) const;
friend ostream& operator << (ostream&s, const G4SmartVoxelHeader& h);
protected:
G4SmartVoxelHeader(G4LogicalVolume* pVolume,
const G4VoxelLimits& pLimits,
const G4VolumeNosVector* pCandidates,
const G4int pSlice=0);
// `Worker' / operation functions:
// Build and refine voxels for daughters of specified volume which
// DOES NOT contain a REPLICATED daughter
void BuildVoxels(G4LogicalVolume* pVolume);
// Build voxels for specified volume containing a single
// replicated volume
void BuildReplicaVoxels(G4LogicalVolume* pVolume);
// Construct nodes in simple consuming case
void BuildConsumedNodes(const G4int nReplicas);
// Build and refine voxels between specified limits, considering only
// the physical volumes `pCandidates'. Main entry point for "construction"
// Hardwired to stop at third level of refinement, using the xyz cartesian
// axes in any order
void BuildVoxelsWithinLimits(G4LogicalVolume* pVolume,
G4VoxelLimits pLimits,
const G4VolumeNosVector* pCandidates);
// Calculate and Store the minimum and maximum equivalent neighbour
// values for all slices
void BuildEquivalentSliceNos();
// Collect common nodes, deleting all but one to save memory, and adjusting
// stored slice ptrs appropriately.
void CollectEquivalentNodes();
// Collect common headers, deleting all but one to save memory, and adjusting
// stored slice ptrs appropriately.
void CollectEquivalentHeaders();
// Build the nodes corresponding to the specified axis, within
// the specified limits, considering the daughters numbered pCandidates
// of the logical volume
G4ProxyVector* BuildNodes(G4LogicalVolume* pVolume,
G4VoxelLimits pLimits,
const G4VolumeNosVector* pCandidates,
EAxis pAxis);
// Calculate a "quality value" for the specified vector of voxels
// The value returned should be >0 and such that the smaller the
// number the higher the quality of the slice.
//
// pSlice must consist of smartvoxelnodeproxies only
G4double CalculateQuality(G4ProxyVector *pSlice);
// Examined each contained node, refine (create a replacement additional
// dimension of voxels) when there is more than one voxel in the slice
void RefineNodes(G4LogicalVolume* pVolume,G4VoxelLimits pLimits);
// Min and max equivalent slice nos for previous level
G4int fminEquivalent;
G4int fmaxEquivalent;
// Axis for slices
EAxis faxis;
// Max and min coordinate along faxis
G4double fmaxExtent;
G4double fminExtent;
// Slices along axis
G4ProxyVector fslices;
};
#endif
@@ -0,0 +1,141 @@
// This code implementation is the intellectual property of
// the RD44 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: G4SmartVoxelNode.hh,v 2.1 1998/11/11 11:34:08 japost Exp $
// GEANT4 tag $Name: geant4-00 $
//
// class G4SmartVoxelNode
//
// A node in the smart voxel hierarchy - a `slice' of space along a given
// axis between given minima and maxima. Note that the node is not aware
// of its position - this information being available/derivable by the
// node's owner(s) (voxelheaders).
//
//
// Member functions:
//
// G4SmartVoxelNode(const G4int pSlice=0)
// Constructor. Create an empty node with slice number pSlice. THis number
// is not stored, but used to provide defaults for the minimum and maximum
// equivalent node numbers
// ~G4SmartVoxelNode()
// Destructor. No actions.
//
// RWTValOrderedVector<G4int>* GetContents()
// Return ptr to vector of volume no.s in the node. Use with care.
// Intended for inspection by navigator at tracking time only.
//
// G4int GetVolume(const G4int pVolumeNo) const
// Return the pVolumeNo'th contained volume. Note: Starts from 0,
// no bounds checking.
//
// void Insert(G4int pVolumeNo)
// Add the specified volume no. to the node's contents
//
// G4int GetNoContained() const
// Returns the number of volumes contained
//
// G4int GetMaxEquivalenSliceNo() const
// Return the maximum slice (node/header) no with the same contents, and
// with all intermediate slice also having the same contents
// void SetMaxEquivalentSliceNo(const G4int pMax)
// Set the maximum slice no (as above)
// G4int GetMinEquivalentSliceNo() const
// Return the minimum slice (node/header) no with the same contents, and
// with all intermediate nodes also having the same contents
// void SetMinEquivalentSliceNo(const G4int pMin)
// Set the maximum slice no (as above)
//
// Member Data:
//
// G4int fminEquivalent
// G4int fmaxEquivalent
// Min and maximum nodes with same contents. Set by constructor
// and set methods.
// RWTValOrderedVector<G4int>(1) fcontents
// Vector of no.s of volumes inside the node
//
// History:
// 12.07.95 P.Kent Initial version
#ifndef G4SMARTVOXELNODE_HH
#define G4SMARTVOXELNODE_HH
#include "globals.hh"
#include "voxeldefs.hh"
#include "G4VPhysicalVolume.hh"
#include <rw/tvordvec.h>
typedef RWTValOrderedVector<G4int> G4SliceVector;
class G4SmartVoxelNode
{
public:
// Constructor. Set min and max equivalent nodes to default.
G4SmartVoxelNode(const G4int pSlice=0) : fminEquivalent(pSlice),
fmaxEquivalent(pSlice)
{
}
// Destructor. No actions necessary
~G4SmartVoxelNode()
{
}
// Access functions for contents
// Return contained volume no pVolumeNo.
// No bounds checking
G4int GetVolume(const G4int pVolumeNo) const
{
return fcontents(pVolumeNo);
}
// Add the speicifed volume no to the contents
void Insert(G4int pVolumeNo)
{
fcontents.insert(pVolumeNo);
}
// Return the no of volumes inside the node
G4int GetNoContained() const
{
return fcontents.entries();
}
// Access functions for min/max equivalent slices (nodes & headers)
G4int GetMaxEquivalentSliceNo() const
{
return fmaxEquivalent;
}
void SetMaxEquivalentSliceNo(const G4int pMax)
{
fmaxEquivalent=pMax;
}
G4int GetMinEquivalentSliceNo() const
{
return fminEquivalent;
}
void SetMinEquivalentSliceNo(const G4int pMin)
{
fminEquivalent=pMin;
}
G4bool operator == (const G4SmartVoxelNode& v) const;
private:
G4int fminEquivalent;
G4int fmaxEquivalent;
G4SliceVector fcontents;
};
#endif
@@ -0,0 +1,109 @@
// This code implementation is the intellectual property of
// the RD44 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: G4SmartVoxelProxy.hh,v 2.1 1998/11/11 11:34:08 japost Exp $
// GEANT4 tag $Name: geant4-00 $
//
// class G4SmartVoxelProxy
//
// Class for proxying smart voxels. The class
// represents either a header (in turn refering to more VoxelProxies)
// or a node. If created as a node, calls to GetHeader cause an exception,
// and likewise GetNode when a header.
//
// Note that the proxy does NOT gain deletion responsibility for proxied
// objects.
//
// Member functions:
//
// G4SmartVoxelProxy(G4SmartVoxelHeader *pHeader);
// Proxy for the specified header
// G4SmartVoxelProxy(G4SmartVoxelNode *pNode)
// Proxy for the specified node
// G4bool IsHeader() const
// Return true if proxying for a header, else false
// G4bool IsNode() const
// Return true if proxying for a node, else false
// G4SmartVoxelNode* GetNode() const
// Return ptr to proxied node, else call G4Exception
// G4SmartVoxelHeader* GetHeader() const
// Return ptr to proxied header, else call G4Exception
//
//
// operator == (const G4SmartVoxelProxy& v)
// True when objects share same address.
//
// History:
// 12.07.95 P.Kent Initial version
// 03.08.95 P.Kent Updated to become non abstract class, removing
// HeaderProxy and NodeProxy derived classes
#ifndef G4SMARTVOXELPROXY_HH
#define G4SMARTVOXELPROXY_HH
#include "globals.hh"
#include <assert.h>
class G4SmartVoxelNode;
class G4SmartVoxelHeader;
class G4SmartVoxelProxy
{
public:
G4SmartVoxelProxy(G4SmartVoxelHeader *pHeader)
{
fHeader=pHeader;
fNode=0;
}
G4SmartVoxelProxy(G4SmartVoxelNode *pNode)
{
fHeader=0;
fNode=pNode;
}
// Destructor - do nothing. Not responsible for proxied objects
~G4SmartVoxelProxy() {;}
G4bool IsHeader() const
{
return (fHeader) ? true:false;
}
G4bool IsNode() const
{
return (fNode) ? true:false;
}
G4SmartVoxelNode* GetNode() const
{
assert(fNode != 0);
return fNode;
}
G4SmartVoxelHeader* GetHeader() const
{
assert(fHeader != 0);
return fHeader;
}
G4bool operator == (const G4SmartVoxelProxy& v) const
{
return (this==&v) ? true : false;
}
private:
G4SmartVoxelNode* fNode;
G4SmartVoxelHeader* fHeader;
};
#endif
@@ -0,0 +1,68 @@
// This code implementation is the intellectual property of
// the RD44 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: G4SolidStore.hh,v 2.0 1998/07/02 16:56:57 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
// class G4SolidStore
//
// Container for all solids, with functionality derived from
// RWTPtrOrderedVector<T>. The class is `singleton', in that only
// one can exist, and access is facillitated via G4SolidStore::GetInstance()
//
// All solids should be registered with G4SolidStore, and removed on their
// destruction. Intended principally for UI browser. The underlying
// container initially has a capacity of 100.
//
// If much additional functionality is added, should consider containment
// instead of inheritance for RWTPtrOrderedVector<T>
//
// Class member functions:
//
// static void Register(G4G4VSolid* pSolid)
// Add the solid to the collection
// static void DeRegister(G4G4VSolid* pSolid)
// Remove the solid from the collection
// static G4SolidStore* GetInstance()
// Get a ptr to the unique G4SolidStore, creting it if necessary
//
// Member functions:
//
// [as per RWTPtrOrderedvector]
//
// NOTE: Constructor is protected - creation and subsequent access is via
// GetInstance
//
// Member data:
//
// static G4SolidStore*
// Ptr to the single G4SolidStore
//
// History:
// 10.07.95 P.Kent Initial version
#ifndef G4VSOLIDSTORE_HH
#define G4VSOLIDSTORE_HH
#include <rw/tpordvec.h>
#include "G4VSolid.hh"
class G4SolidStore : public RWTPtrOrderedVector<G4VSolid>
{
public:
static void Register(G4VSolid* pSolid);
static void DeRegister(G4VSolid* pSolid);
static G4SolidStore* GetInstance();
virtual ~G4SolidStore();
protected:
G4SolidStore();
private:
static G4SolidStore* fgInstance;
};
#endif
@@ -0,0 +1,109 @@
// This code implementation is the intellectual property of
// the RD44 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: G4VPVParameterisation.hh,v 2.0 1998/07/02 16:57:04 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
// class G4VPVParamterisation
//
// Parameterisation class, able to compute the transformation and
// (indirectly) the dimensions of parameterised volumes, given a
// replication number.
//
// History:
// 25.07.96 P.Kent Initial stub version
// 20.09.96 V.Grichine Modifications for G4Trap/Cons/Sphere
// 31.10.96 V.Grichine Modifications for G4Torus/Para
// 17.02.98 J.Apostolakis Allowing the parameterisation of Solid type
#ifndef G4VPVPARAMETERISATION_HH
#define G4VPVPARAMETERISATION_HH
#include "globals.hh"
class G4VPhysicalVolume;
// CSG Entities which may be parameterised/replicated
class G4Box;
class G4Tubs;
class G4Trd;
class G4Trap;
class G4Cons;
class G4Sphere;
class G4Torus;
class G4Para;
class G4Hype;
class G4VSolid;
class G4Material;
class G4VPVParameterisation
{
public:
virtual void ComputeTransformation(const G4int,
G4VPhysicalVolume *) const = 0;
virtual G4VSolid* ComputeSolid(const G4int,
G4VPhysicalVolume *);
virtual G4Material* ComputeMaterial(const G4int,
G4VPhysicalVolume *);
virtual void ComputeDimensions(G4Box &,
const G4int,
const G4VPhysicalVolume *) const
{
}
virtual void ComputeDimensions(G4Tubs &,
const G4int,
const G4VPhysicalVolume *) const
{
}
virtual void ComputeDimensions(G4Trd &,
const G4int,
const G4VPhysicalVolume *) const
{
}
virtual void ComputeDimensions(G4Trap &,
const G4int,
const G4VPhysicalVolume *) const
{
}
virtual void ComputeDimensions(G4Cons &,
const G4int,
const G4VPhysicalVolume *) const
{
}
virtual void ComputeDimensions(G4Sphere &,
const G4int,
const G4VPhysicalVolume *) const
{
}
virtual void ComputeDimensions(G4Torus &,
const G4int,
const G4VPhysicalVolume *) const
{
}
virtual void ComputeDimensions(G4Para &,
const G4int,
const G4VPhysicalVolume *) const
{
}
virtual void ComputeDimensions(G4Hype &,
const G4int,
const G4VPhysicalVolume *) const
{
}
};
#endif
@@ -0,0 +1,194 @@
// This code implementation is the intellectual property of
// the RD44 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: G4VPhysicalVolume.hh,v 2.1 1998/07/12 02:55:34 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// class G4VPhysicalVolume
//
// Base class for representation of one or many volumes positioned within
// and relative to a mother volume
//
// Member functions:
//
// G4VPhysicalVolume(G4RotationMatrix *pFrameRot,
// const G4ThreeVector &volumeCenterCrd, // "tlate"
// const G4String &pName,
// G4LogicalVolume *pLogical,
// G4VPhysicalVolume *pMother)
//
// Initialise volume, positioned in a frame which is rotated by *pFrameRot,
// relative to the coordinate system of the mother volume pMother. The center
// of the object is then placed at volumeCenterCrd in the new coordinates.
// If pRot=0 the volume is unrotated with respect to its mother.
// The physical volume is added to the mother's logical volume.
//
// Must be called by all subclasses. pMother must point to a valid parent
// volume, except in the case of the world/top volume, when it =0.
//
// Constructor also registers volume with physical volume Store. Note
// that the Store may be removed or dynamically built in future because
// of memory constraints
//
// virtual ~G4VPhysicalVolume()
// Destructor. Remove volume from volume Store.
//
// G4bool operator == (const G4VPhysicalVolume& p) const
// Define equality by equal addresses only.
//
// G4LogicalVolume* GetLogicalVolume() const
// Return the associated logical volume
// G4VPhysicalVolume* GetMother() const
// Return the current mother pointer
// G4String GetName() const
// Return the volume's name
//
// void SetLogicalVolume(G4LogicalVolume *pLogical)
// Set the logical volume. Must not be called when geometry closed
// void SetMother(G4VPhysicalVolume *pMother)
// Set the mother volume. Must not be called when geometry closed
// void SetName(const G4String& pName)
// Set the volume name
//
// Accessor functions that make a distinction between whether
// the rotation/translation is being made for the frame or the object/volume
// that is being placed. (They are the inverse of each other).
//
// G4RotationMatrix* GetObjectRotation() const
// G4ThreeVector GetObjectTranslation() const
// Return the rotation/translation of the Object relative to the mother
//
// const G4RotationMatrix* GetFrameRotation() const
// G4ThreeVector GetFrameTranslation() const
// Return the rotation/translation of the Frame used to position
// this volume in its mother volume (opposite of object rot/trans).
//
// Older version:
//
// const G4ThreeVector& GetTranslation() const
// const G4RotationMatrix* GetRotation() const
// Return the translation/rotation of the volume
//
// void SetTranslation(const G4ThreeVector &v)
// G4RotationMatrix* GetRotation()
// void SetRotation(G4RotationMatrix*)
// NOT INTENDED FOR GENERAL USE.
// Non constant versions of above. Used to change transformation
// for replication/paramterisation mechanism.
//
// To be provided by subclasses:
//
// virtual G4int GetCopyNo() const = 0
// Return the volumes copy number
// virtual G4bool IsMany() const = 0
// Return true if the volume is MANY
// virtual G4Bool IsReplicated() const = 0
// Return true if replicated (single object instance represents
// many real volumes), else false.
// virtual G4VPVParameterisation* GetParameterisation() const = 0;
// Return replicas parameterisation object (able to compute dimensions
// and transformations of replicas), or NULL if not applicable
//
// virtual void GetRelicationData(EAxis& axis,
// G4int& nReplicas,
// G4double& width,
// G4double& offset,
// G4bool& consuming) const = 0;
//
// Return replication information. No-op for no replicated volumes.
//
// virtual void Setup(G4VPhysicalVolume * pMother) = 0
// Perform any initialisation/setup necessary for the given volume.
// [Set the current mother pointer to refer to the specified mother, by
// calling SetMother]
//
//
// History:
// 28.08.96 P.Kent Replaced transform by rotmat + vector
// 25.07.96 P.Kent Modified interface for new `Replica' capable geometry
// 24.07.95 P.Kent First non-stub version
#ifndef G4VPHYSICALVOLUME_HH
#define G4VPHYSICALVOLUME_HH
#include "globals.hh"
#include "geomdefs.hh"
#include "G4RotationMatrix.hh"
#include "G4ThreeVector.hh"
class G4LogicalVolume;
class G4VPVParameterisation;
class G4VPhysicalVolume
{
public:
G4VPhysicalVolume(G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
const G4String &pName,
G4LogicalVolume *pLogical,
G4VPhysicalVolume *pMother);
// Destructor - will be subclassed
virtual ~G4VPhysicalVolume();
// Define equality by equal addresses only.
G4bool operator == (const G4VPhysicalVolume& p) const;
// Access functions
G4RotationMatrix* GetObjectRotation() const;
G4ThreeVector GetObjectTranslation() const;
const G4RotationMatrix* GetFrameRotation() const;
G4ThreeVector GetFrameTranslation() const;
// Older access functions, that do not distinguish between frame/object!
const G4ThreeVector& GetTranslation() const;
const G4RotationMatrix* GetRotation() const;
// Set functions
void SetTranslation(const G4ThreeVector &v);
G4RotationMatrix* GetRotation();
void SetRotation(G4RotationMatrix*);
G4LogicalVolume* GetLogicalVolume() const;
void SetLogicalVolume(G4LogicalVolume *pLogical);
G4VPhysicalVolume* GetMother() const;
void SetMother(G4VPhysicalVolume *pMother);
G4String GetName() const;
void SetName(const G4String& pName);
// Functions required of subclasses
virtual G4bool IsMany() const = 0;
virtual G4int GetCopyNo() const = 0;
virtual void SetCopyNo(G4int CopyNo) = 0;
virtual G4bool IsReplicated() const = 0;
virtual G4VPVParameterisation* GetParameterisation() const = 0;
virtual void GetReplicationData(EAxis& axis,
G4int& nReplicas,
G4double& width,
G4double& offset,
G4bool& consuming) const = 0;
virtual void Setup(G4VPhysicalVolume *pMother) = 0;
protected:
G4RotationMatrix *frot;
G4ThreeVector ftrans;
private:
G4LogicalVolume *flogical; // The logical volume representing the
// physical and tracking attributes of
// the volume
G4String fname; // name of the volume
G4VPhysicalVolume *fmother; // The current moher volume
};
#include "G4VPhysicalVolume.icc"
#endif
@@ -0,0 +1,102 @@
// This code implementation is the intellectual property of
// the RD44 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: G4VPhysicalVolume.icc,v 2.0 1998/07/02 16:57:12 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// class G4VPhysicalVolume Inline Implementation
//
// Define equality by equal addresses only.
inline G4bool G4VPhysicalVolume::operator == (const G4VPhysicalVolume& p) const
{
return (this==&p) ? true : false;
}
// Access functions
inline const G4ThreeVector& G4VPhysicalVolume::GetTranslation() const
{
return ftrans;
}
inline void G4VPhysicalVolume::SetTranslation(const G4ThreeVector &v)
{
ftrans=v;
}
inline const G4RotationMatrix* G4VPhysicalVolume::GetRotation() const
{
return frot;
}
inline G4RotationMatrix* G4VPhysicalVolume::GetRotation()
{
return frot;
}
inline void G4VPhysicalVolume::SetRotation(G4RotationMatrix *pRot)
{
frot=pRot;
}
inline G4LogicalVolume* G4VPhysicalVolume::GetLogicalVolume() const
{
return flogical;
}
inline void G4VPhysicalVolume::SetLogicalVolume(G4LogicalVolume *pLogical)
{
flogical=pLogical;
}
inline G4VPhysicalVolume* G4VPhysicalVolume::GetMother() const
{
return fmother;
}
inline void G4VPhysicalVolume::SetMother(G4VPhysicalVolume *pMother)
{
fmother=pMother;
}
inline G4String G4VPhysicalVolume::GetName() const
{
return fname;
}
inline void G4VPhysicalVolume::SetName(const G4String& pName)
{
fname=pName;
}
inline G4RotationMatrix* G4VPhysicalVolume::GetObjectRotation() const
{
static G4RotationMatrix aRotM;
static G4RotationMatrix IdentityRM; // Never changed (from "1")
G4RotationMatrix* retval;
// Insure against frot being a null pointer
if(frot)
{
aRotM= frot->inverse();
retval= &aRotM;
}
else
{
retval= &IdentityRM;
}
return retval;
}
inline G4ThreeVector G4VPhysicalVolume::GetObjectTranslation() const
{
return ftrans;
}
inline const G4RotationMatrix* G4VPhysicalVolume::GetFrameRotation() const
{
return frot;
}
inline G4ThreeVector G4VPhysicalVolume::GetFrameTranslation() const
{
return -ftrans;
}
@@ -0,0 +1,349 @@
// This code implementation is the intellectual property of
// the RD44 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: G4VSolid.hh,v 2.1 1998/07/12 02:55:35 urbi Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// class G4VSolid
//
// Abstract base class solids, physical shapes that can be tracked through.
//
// Each solid has a name, and the constructors and destructors automatically
// add and subtract them from the G4SolidStore, a singleton `master' List
// of available solids.
//
// This class defines, but does not implement, functions to compute
// distances to/from the shape. Functions are also defined
// to check whether a point is inside the shape, to return the
// surface normal of the shape at a given point, and to compute
// the extent of the shape. [see descriptions below]
//
// Some protected/private utility functions are implemented for the
// clipping of regions for the computation of a solid's extent. Note that
// the clipping mechanism is presently inefficient.
//
// Some visualization/graphics functions are also defined.
//
//
// Member Functions:
//
// G4VSolid(G4String& name)
// Creates a new shape, with the supplied name
// No provision is made for sharing a common name amoungst multiple classes.
//
// G4String GetName() const
// Returns the current shape's name
// SetName(const G4String& s)
// Sets the current shape's name
//
// (All remaining functions are pure virtual)
//
// G4bool CalculateExtent(const EAxis pAxis,
// const G4VoxelLimit& pVoxelLimit,
// const G4AffineTransform& pTransform,
// G4double& min, G4double& max)
//
// Calculate the minimum and maximum extent of the solid, when under the
// specified transform, and within the specified limits. If the solid does
// is not intersected by the region, return false, else return true.
//
// EInside Inside(const G4ThreeVector& p)
// Returns kOutside if the point at offset p is outside the shapes boundaries
// plus Tolerance/2, kSurface if the point is <=Tolerance/2 from a surface,
// otherwise kInside.
//
// G4ThreeVector SurfaceNormal(const G4ThreeVector& p)
// Returns the outwards pointing unit normal of the shape for the
// surface closest to the point at offset p.
//
// G4double DistanceToIn(const G4ThreeVector& p)
// Calculate distance to nearest surface of shape from an outside point
// The distance can be an underestimate.
//
// G4double DistanceToIn(const G4ThreeVector& p, constG4ThreeVector& v)
// Return distance along the normalised vector v to the shape, from the
// point at offset p. If there is no intersection, return kInifinity.
// The first intersection resulting from `leaving' a surface/volume is
// discarded. Hence, tolerant of points on surface of shape.
//
// G4double DistanceToOut(const G4ThreeVector& p)
// Calculate distance to nearest surface of shape from an inside point
// The distance can be an underestimate.
//
// G4double DistanceToOut(const G4ThreeVector& p,const G4ThreeVector& v,
// const G4bool calcNorm=false,
// G4bool *validNorm=0,G4ThreeVector *n=0;
// Return distance along the normalised vector v to the shape, from a point
// at an offset p inside or on the surface of the shape. Intersections with
// surfaces, when the point is <Tolerance/2 from a surface must be ignored.
//
// If calcNorm==true:
// validNorm set true if the solid lies entirely behind or on the
// exiting surface.
// n set to exiting outwards normal vector(undefined Magnitude)
// validNorm=false if the solid does not lie entirely behind or on the
// exiting surface
// calcNorm==false:
// validNorm and n are unused.
//
// Call as solid.DistanceToOut(p,v) or by specifying all parameters.
//
//
// Type identification
// (required for persistency and STEP interface)
//
// virtual G4GeometryType GetEntityType() const = 0;
// Provide identification of the class of an object.
//
//
// Visualization functions:
//
// virtual void DescribeYourselfTo (G4VGraphicsScene& scene) const = 0;
// A "double dispatch" function which identifies the solid
// to the graphics scene.
// virtual G4VisExtent GetExtent() const = 0;
// Provides extent (bounding box) as possible hint to graphics view.
// virtual G4Polyhedron* CreatePolyhedron () const;
// virtual G4NURBS* CreateNURBS () const;
// Creates a G4Polyhedron/G4NURBS/... (It is the caller's reponsibility
// to delete it.) A null pointer means "not created".
//
// Protected functions:
//
// void CalculateClippedPolygonExtent(G4ThreeVectorList& pPolygon,
// const G4VoxelLimits& pVoxelLimit,
// const EAxis pAxis,
// G4double& pMin, G4double& pMax) const;
// Calculate the maximum and minimum extents of the convex polygon pPolygon
// along the axis pAxis, within the limits pVoxelLimit
//
// If the minimum is <pMin pMin is set to the new minimum
// If the maximum is >pMax pMax is set to the new maximum
//
// Modifications to pPolygon are made - it is left in an undefined state
//
//
// void ClipCrossSection(G4ThreeVectorList* pVertices,
// const G4int pSectionIndex,
// const G4VoxelLimits& pVoxelLimit,
// const EAxis pAxis,
// G4double& pMin, G4double& pMax) const;
//
// Calculate the maximum and minimum extents of the polygon described
// by the vertices: pSectionIndex->pSectionIndex+1->
// pSectionIndex+2->pSectionIndex+3->pSectionIndex
// in the List pVertices
//
// If the minimum is <pMin pMin is set to the new minimum
// If the maximum is >pMax pMax is set to the new maximum
//
// No modifications are made to pVertices
//
//
// void ClipBetweenSections(G4ThreeVectorList* pVertices,
// const G4int pSectionIndex,
// const G4VoxelLimits& pVoxelLimit,
// const EAxis pAxis,
// G4double& pMin, G4double& pMax) const;
//
// Calculate the maximum and minimum extents of the polygons
// joining the CrossSections at pSectionIndex->pSectionIndex+3 and
// pSectionIndex+4->pSectionIndex7
//
// in the List pVertices, within the boundaries of the voxel limits.
//
// If the minimum is <pMin pMin is set to the new minimum
// If the maximum is >pMax pMax is set to the new maximum
//
// No modifications are made to pVertices
//
//
// void ClipPolygon(G4ThreeVectorList& pPolygon,
// const G4VoxelLimits& pVoxelLimit) const;
//
// Clip the specified convex polygon to the given limits, where
// the polygon is described by the vertices at (0),(1),...,(n),(0) in
// pPolygon. If the polygon is completely clipped away, the polygon is
// cleared.
//
//
//
//
// Private functions:
//
// void ClipPolygonToSimpleLimits(G4ThreeVectorList& pPolygon,
// G4ThreeVectorList& outputPolygon,
// const G4VoxelLimits& pVoxelLimit) const;
//
// Clip the specified convex polygon to the given limits, storing the
// result in outputPolygon. The voxel limits must be limited in one
// *plane* only: This is achieved by having only x or y or z limits,
// and either the minimum or maximum limit set to -+kInfinity respectively.
//
//
//
//
// Operators:
//
// G4bool operator==(const G4VSolid& s) const
// Return true only if addresses are the same
//
// Member Data:
//
// G4String fshapeName
// Name for this solid.
//
// History:
// 17.06.98 J.Apostolakis Added pure virtual function GetEntityType()
// 24.10.96 J.Allison Added const G4VisAttributes* fpVisAttributes; and
// associated access functions.
// 26.07.96 P.Kent Added ComputeDimensions for replication mechanism.
// 22.07.96 J.Allison Renamed CreatePolyhedon, G4VGraphicsScene.
// 27.03.96 J.Allison Changed names to: DescribeYourselfTo and
// SendWireframeTo (G4VGraphicsModel&).
// 10.07.95 P.Kent Added == operator
// 30.06.95 P.Kent Initial version, no scoping or visualisation functions
#ifndef G4VSOLID_HH
#define G4VSOLID_HH
#include "globals.hh"
#include "geomdefs.hh"
class G4AffineTransform;
class G4VoxelLimits;
class G4VPVParameterisation;
class G4VPhysicalVolume;
class G4VGraphicsScene;
class G4Polyhedron;
class G4NURBS;
class G4VisExtent;
#include "G4ThreeVector.hh"
#include <rw/tvordvec.h>
typedef RWTValOrderedVector<G4ThreeVector> G4ThreeVectorList;
typedef G4String G4GeometryType;
class G4VSolid {
public:
G4VSolid(const G4String& name);
virtual ~G4VSolid();
G4bool operator==( const G4VSolid& s) const
{
return (this==&s) ? true : false;
}
G4String GetName() const;
void SetName(const G4String& name);
virtual G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pMin, G4double& pMax) const = 0;
virtual EInside Inside(const G4ThreeVector& p) const = 0;
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector& p) const = 0;
virtual G4double DistanceToIn(const G4ThreeVector& p,
const G4ThreeVector& v) const = 0;
virtual G4double DistanceToIn(const G4ThreeVector& p) const = 0;
virtual G4double DistanceToOut(const G4ThreeVector& p,
const G4ThreeVector& v,
const G4bool calcNorm=false,
G4bool *validNorm=0,
G4ThreeVector *n=0) const = 0;
virtual G4double DistanceToOut(const G4ThreeVector& p) const = 0;
virtual void ComputeDimensions(G4VPVParameterisation* p,
const G4int n,
const G4VPhysicalVolume* pRep);
virtual G4GeometryType GetEntityType() const = 0;
virtual void DescribeYourselfTo (G4VGraphicsScene& scene) const = 0;
virtual G4VisExtent GetExtent () const = 0;
virtual G4Polyhedron* CreatePolyhedron () const;
virtual G4NURBS* CreateNURBS () const;
protected:
// Calculate the maximum and minimum extents of the convex polygon pPolygon
// along the axis pAxis, within the limits pVoxelLimit
//
// If the minimum is <pMin pMin is set to the new minimum
// If the maximum is >pMax pMax is set to the new maximum
//
// Modifications to pPolygon are made - it is left in an undefined state
void CalculateClippedPolygonExtent(G4ThreeVectorList& pPolygon,
const G4VoxelLimits& pVoxelLimit,
const EAxis pAxis,
G4double& pMin, G4double& pMax) const;
// Calculate the maximum and minimum extents of the polygon described
// by the vertices: pSectionIndex->pSectionIndex+1->
// pSectionIndex+2->pSectionIndex+3->pSectionIndex
// in the List pVertices
//
// If the minimum is <pMin pMin is set to the new minimum
// If the maximum is >pMax pMax is set to the new maximum
//
// No modifications are made to pVertices
void ClipCrossSection(G4ThreeVectorList* pVertices,
const G4int pSectionIndex,
const G4VoxelLimits& pVoxelLimit,
const EAxis pAxis,
G4double& pMin, G4double& pMax) const;
// Calculate the maximum and minimum extents of the polygons
// joining the CrossSections at pSectionIndex->pSectionIndex+3 and
// pSectionIndex+4->pSectionIndex7
//
// in the List pVertices, within the boundaries of the voxel limits pVoxelLimit
//
// If the minimum is <pMin pMin is set to the new minimum
// If the maximum is >pMax pMax is set to the new maximum
//
// No modifications are made to pVertices
void ClipBetweenSections(G4ThreeVectorList* pVertices,
const G4int pSectionIndex,
const G4VoxelLimits& pVoxelLimit,
const EAxis pAxis,
G4double& pMin, G4double& pMax) const;
// Clip the specified convex polygon to the given limits, where
// the polygon is described by the vertices at (0),(1),...,(n),(0) in pPolygon.
//
// If the polygon is completely clipped away, the polygon is cleared.
void ClipPolygon(G4ThreeVectorList& pPolygon,
const G4VoxelLimits& pVoxelLimit) const;
private:
// Clip the specified convex polygon to the given limits, storing the
// result in outputPolygon. The voxel limits must be limited in one
// *plane* only: This is achieved by having only x or y or z limits,
// and either the minimum or maximum limit set to -+kInfinity respectively.
void ClipPolygonToSimpleLimits(G4ThreeVectorList& pPolygon,
G4ThreeVectorList& outputPolygon,
const G4VoxelLimits& pVoxelLimit) const;
G4String fshapeName; // Name
};
#include "G4VSolid.icc"
#endif
@@ -0,0 +1,19 @@
// This code implementation is the intellectual property of
// the RD44 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: G4VSolid.icc,v 2.0 1998/07/02 16:57:14 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
inline G4Polyhedron* G4VSolid::CreatePolyhedron () const {
return 0;
}
inline G4NURBS* G4VSolid::CreateNURBS () const {
return 0;
}
@@ -0,0 +1,117 @@
// This code implementation is the intellectual property of
// the RD44 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: G4VTouchable.hh,v 2.3 1998/07/19 05:50:49 japost Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// class G4VTouchable Paul Kent August 1996
//
// Modified: John Apostolakis, July 1997: new methods to Retrieve replica
// and history information
// (intention is to hide NavigHistory)
// Motivation:
// ----------
// Base class for `touchable' objects capable of maintaining an
// association between parts of the geometrical hierarchy (volumes
// &/or solids) and their resultant transformation
//
// Utilisation:
// -----------
//
// A touchable is a geometrical volume (solid) which has a unique
// placement in a detector description. It an abstract base class which
// can be implemented in a variety of ways. Each way must provide the
// capabilities of obtaining the transformation and solid that is described by
// the touchable.
//
// All G4VTouchable implementations must respond to the two following
// "requests":
//
// 1) GetTranslation and GetRotation that return the components of the
// volume's transformation
//
// 2) GetSolid that gives the solid of this touchable.
//
//
// Additional capabilities are available from implementations with more
// information. These have a default implementation that causes an exception.
//
// Several capabilities are available from touchables with physical volumes:
//
// 3) GetVolume gives the physical volume
//
// 4) GetReplicaNumber gives the replica number of the physical volume,
// if it is replicated.
//
// Touchables that Store volume hierarchy (history) have the whole stack of
// parent volumes available. Thus it is possible to add a little more state
// in order to extend its functionality. We add a "pointer" to a level and a
// member function to move the level in this stack. Then
// calling the above member functions for another level the information for
// that level can be retrieved.
//
// The top of the history tree is, by convention, the world volume.
//
// 5) GetHistoryDepth gives the depth of the history tree
//
// 6) GetReplicaNumber, GetVolume, GetTranslation and GetRotation call
// each be called with a depth argument. They return the value of the
// respective level of the touchable.
//
// 7) MoveUpHistory( num ) moves the current pointer inside the
// touchable to point "num" levels up the history tree. Thus, eg, calling
// it with num=1 will cause the internal pointer to move to the mother
// of the current volume.
// -------> THIS method MODIFIES the touchable <--------
//
// An update method, with different arguments is available, so
// that the information in a touchable can be updated:
//
// 8) UpdateYourself takes a physical volume pointer and can additionally
// take a NavigationHistory.
#ifndef G4VTOUCHABLE_HH
#define G4VTOUCHABLE_HH
#include "globals.hh"
class G4VPhysicalVolume;
class G4VSolid;
class G4NavigationHistory;
#include "G4RotationMatrix.hh"
#include "G4ThreeVector.hh"
class G4VTouchable
{
public:
G4VTouchable();
virtual ~G4VTouchable();
virtual const G4ThreeVector& GetTranslation(G4int depth=0) const = 0;
virtual const G4RotationMatrix* GetRotation(G4int depth=0) const = 0;
virtual G4VPhysicalVolume* GetVolume(G4int depth=0) const;
virtual G4VSolid* GetSolid(G4int depth=0) const;
// Methods for touchables with history
virtual G4int GetReplicaNumber(G4int depth=0) const;
virtual G4int GetHistoryDepth() const;
virtual G4int MoveUpHistory( G4int num_levels = 1 );
// virtual void ResetLevel();
// Update method
virtual void UpdateYourself( G4VPhysicalVolume* pPhysVol,
const G4NavigationHistory* history=NULL);
// Should this method be depricated ? It is used in G4Navigator!
virtual const G4NavigationHistory* GetHistory() const;
};
#include "G4VTouchable.icc"
#endif
@@ -0,0 +1,74 @@
// This code implementation is the intellectual property of
// the RD44 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: G4VTouchable.icc,v 2.2 1998/07/21 08:16:32 japost Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// class G4VTouchable Inline implementation
inline G4VTouchable::G4VTouchable()
{
}
inline G4VTouchable::~G4VTouchable()
{
}
inline G4VPhysicalVolume* G4VTouchable::GetVolume(G4int) const
{
G4Exception("G4VTouchable::GetVolume(G4int depth) undefined");
return NULL;
}
inline G4VSolid* G4VTouchable::GetSolid(G4int) const
{
G4Exception("G4VTouchable::GetSolid(G4int depth) undefined");
return NULL;
}
inline G4int G4VTouchable::GetReplicaNumber(G4int) const
{
G4Exception("G4VTouchable::GetReplicaNumber(G4int depth) undefined");
return 0;
}
inline G4int G4VTouchable::MoveUpHistory( G4int )
{
G4Exception("G4VTouchable::MoveUpHistory(G4int) undefined ");
return 0; // for this touchable subclass
}
inline void G4VTouchable::UpdateYourself( G4VPhysicalVolume* ,
const G4NavigationHistory* )
{
G4Exception("G4VTouchable::UpdateYourself( G4VPhysicalVolume*, const G4NavigationHistory* ) undefined ");
}
inline G4int G4VTouchable::GetHistoryDepth() const
{
G4Exception("G4VTouchable::GetHistoryDepth() undefined ");
return 0;
}
inline const G4NavigationHistory* G4VTouchable::GetHistory() const
{
G4Exception("G4VTouchable::GetHistory() undefined");
return NULL;
}
#if 0
inline void G4VTouchable::ResetLevel()
{
G4Exception("G4VTouchable::ResetLevel() undefined");
}
#endif
@@ -0,0 +1,252 @@
// This code implementation is the intellectual property of
// the RD44 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: G4VoxelLimits.hh,v 2.1 1998/11/11 11:31:01 japost Exp $
// GEANT4 tag $Name: geant4-00 $
//
// class G4VoxelLimits
//
// Represents limitation/restrictions of space , where restrictions
// are only made perpendicular to the cartesian axes.
//
//
// Member functions:
//
// G4VoxelLimits()
// Construct, with volume unrestricted
// ~G4VoxelLimits()
// No actions.
// AddLimit(const EAxis pAxis, const G4double pMin,const G4double pMax)
// Restict the volume to between specified min and max along the given axis.
// Cartesian axes only, pMin<=pMax.
// G4double GetMaxXExtent() const
// Return maximum x extent
// G4double GetMaxYExtent() const
// Return maximum y extent
// G4double GetMaxZExtent() const
// Return maximum z extent
// G4double GetMinXExtent() const
// Return minimum x extent
// G4double GetMinYExtent() const
// Return minimum y extent
// G4double GetMinZExtent() const
// Return minimum z extent
// G4double GetMaxExtent(const EAxis pAxis) const
// Return maximum extent of volume along specified axis.
// G4double GetMinExtent(const EAxis pAxis) const
// Return maximum extent of volume along specified axis.
// G4bool IsLimited() const
// Return true if limited along any axis
// G4bool IsLimited(const EAxis pAxis) const
// Return true if the specified axis is resticted/limited.
// G4bool IsXLimited() const
// Return true if the x axis is limited
// G4bool IsYLimited() const
// Return true if the y axis is limited
// G4bool IsZLimited() const
// Return true if the z axis is limited
//
// G4bool ClipToLimits(G4ThreeVector& pStart,G4ThreeVector& pEnd)
// Clip the line segment pStart->pEnd to the volume described by the
// current limits. Return true if the line remains after clipping,
// else false, and leave the vectors in an undefined state.
//
// G4bool Inside(const G4ThreeVector& pVec) const
// Return true if the specified vector is inside/on boundaries
// of limits
//
// G4int OutCode(const G4ThreeVector& pVec) const
// Calculate the `outcode' for the specified vector.
// Intended for use during clipping against the limits
// The bits are set given following conditions:
// 0 pVec.x()<fxAxisMin && IsXLimited()
// 1 pVec.x()>fxAxisMax && IsXLimited()
// 2 pVec.y()<fyAxisMin && IsYLimited()
// 3 pVec.y()>fyAxisMax && IsYLimited()
// 4 pVec.z()<fzAxisMin && IsZLimited()
// 5 pVec.z()>fzAxisMax && IsZLimited()
//
// Member data:
//
// G4double fxAxisMin,fxAxisMax
// G4double fyAxisMin,fyAxisMax
// G4double fzAxisMin,fzAxisMax
// The min and max values along each axis. +-kInfinity if not restricted
//
//
// operators:
//
// ostream& operator << (ostream& os, const G4VoxelLimits& pLim);
//
// Print the limits to the stream in the form:
// "{(xmin,xmax) (ymin,ymax) (zmin,zmax)}" Replace (xmin,xmax) by (-,-)
// when not limited.
//
// Notes:
//
// Beware no break statements after returns in switch(pAxis)s
//
// History:
// 13.07.95 P.Kent Initial version.
#ifndef G4VOXELLIMITS_HH
#define G4VOXELLIMITS_HH
#include "globals.hh"
#include "geomdefs.hh"
#include "G4ThreeVector.hh"
#include <assert.h>
class ostream;
class G4VoxelLimits
{
public:
// Constructor - initialise to be unlimited
G4VoxelLimits() : fxAxisMin(-kInfinity),fxAxisMax(kInfinity),
fyAxisMin(-kInfinity),fyAxisMax(kInfinity),
fzAxisMin(-kInfinity),fzAxisMax(kInfinity)
{;}
// G4VoxelLimits(const G4VoxelLimits& v);
// Destructor
~G4VoxelLimits() {;}
// Further restict limits
void AddLimit(const EAxis pAxis, const G4double pMin,const G4double pMax);
// Return appropriate max limit
G4double GetMaxXExtent() const
{
return fxAxisMax;
}
G4double GetMaxYExtent() const
{
return fyAxisMax;
}
G4double GetMaxZExtent() const
{
return fzAxisMax;
}
// Return appropriate min limit
G4double GetMinXExtent() const
{
return fxAxisMin;
}
G4double GetMinYExtent() const
{
return fyAxisMin;
}
G4double GetMinZExtent() const
{
return fzAxisMin;
}
// Return specified max limit
G4double GetMaxExtent(const EAxis pAxis) const
{
if (pAxis==kXAxis)
{
return GetMaxXExtent();
}
else if (pAxis==kYAxis)
{
return GetMaxYExtent();
}
else
{
assert(pAxis==kZAxis);
return GetMaxZExtent();
}
}
//Return min limit
G4double GetMinExtent(const EAxis pAxis) const
{
if (pAxis==kXAxis)
{
return GetMinXExtent();
}
else if (pAxis==kYAxis)
{
return GetMinYExtent();
}
else
{
assert(pAxis==kZAxis);
return GetMinZExtent();
}
}
// Return true if x axis is limited
G4bool IsXLimited() const
{
return (fxAxisMin==-kInfinity&&fxAxisMax==kInfinity) ? false : true;
}
// Return true if y axis is limited
G4bool IsYLimited() const
{
return (fyAxisMin==-kInfinity&&fyAxisMax==kInfinity) ? false : true;
}
// Return true if z axis is limited
G4bool IsZLimited() const
{
return (fzAxisMin==-kInfinity&&fzAxisMax==kInfinity) ? false : true;
}
// Return true if limited along any axis
G4bool IsLimited() const
{
return (IsXLimited()||IsYLimited()||IsZLimited());
}
// Return true if specified axis is limited
G4bool IsLimited(const EAxis pAxis) const
{
if (pAxis==kXAxis)
{
return IsXLimited();
}
else if (pAxis==kYAxis)
{
return IsYLimited();
}
else
{
assert(pAxis==kZAxis);
return IsZLimited();
}
}
G4bool ClipToLimits(G4ThreeVector& pStart,G4ThreeVector& pEnd) const;
// Return true if specified vector is inside/on boundaries of limits
G4bool Inside(const G4ThreeVector& pVec) const
{
return ((GetMinXExtent()<=pVec.x()) &&
(GetMaxXExtent()>=pVec.x()) &&
(GetMinYExtent()<=pVec.y()) &&
(GetMaxYExtent()>=pVec.y()) &&
(GetMinZExtent()<=pVec.z()) &&
(GetMaxZExtent()>=pVec.z()) ) ? true : false;
}
G4int OutCode(const G4ThreeVector& pVec) const;
private:
G4double fxAxisMin,fxAxisMax;
G4double fyAxisMin,fyAxisMax;
G4double fzAxisMin,fzAxisMax;
};
ostream& operator << (ostream& os, const G4VoxelLimits& pLim);
#endif
@@ -0,0 +1,34 @@
// This code implementation is the intellectual property of
// the RD44 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: meshdefs.hh,v 2.0 1998/07/02 16:57:08 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// Tube/Cone Meshing constants for extent calculations
//
// History:
// 13.08.95 P.Kent Created separate file
#ifndef MESHDEFS_HH
#define MESHDEFS_HH
#include "globals.hh"
const G4double kMeshAngleDefault=(M_PI/4); // Angle for mesh `wedges' in rads
// Works best when simple fraction of M_PI/2
const G4int kMinMeshSections=3; // Min wedges+1 to make
const G4int kMaxMeshSections=37; // max wedges+1 to make
// =>10 degrees/wedge for complete tube
#endif
@@ -0,0 +1,39 @@
// This code implementation is the intellectual property of
// the RD44 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: voxeldefs.hh,v 2.0 1998/07/02 16:57:19 gunter Exp $
// GEANT4 tag $Name: geant4-00 $
//
//
// Voxel Optimisation Constants
//
// History:
// 13.08.95 P.Kent Created separate file
#ifndef VOXELDEFS_HH
#define VOXELDEFS_HH
#include "globals.hh"
// Hard limit on no. voxel nodes per given header
const G4int kMaxVoxelNodes=2000;// Geant 3.21 uses 1000
const G4int kMinVoxelVolumesLevel1=2; // Only begin to make voxels if >=
// this no of daughters
const G4int kMinVoxelVolumesLevel2=3; // Only make second level of refinement
// if >= this no of volumes in
// 1st level node
const G4int kMinVoxelVolumesLevel3=4; // Only make third level of refinement
// if >= this no of volumes in
// 2nd level node
#endif