Import Geant4 2.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:42:07 +02:00
parent 103bda00c8
commit e7d7193284
3106 changed files with 171117 additions and 90550 deletions
@@ -5,11 +5,13 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4AffineTransform.hh,v 1.2 1999/12/15 14:49:50 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4AffineTransform.hh,v 1.3 2000/04/20 16:49:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// class G4AffineTransform Header File
// class G4AffineTransform
//
// Class description:
//
// A class for geometric affine transformations [see, eg. Foley & Van Dam]
// Supports efficient arbitrary rotation & transformation of vectors and the
@@ -17,20 +19,19 @@
// maintained internally for greater computational efficiency for transforms
// that do not involve rotation.
//
// Interfaces to the GEANT4 modified CLHEP classes G4ThreeVector &
// G4RotationMatrix
// Interfaces to the 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:
// 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
//
@@ -49,126 +50,103 @@
class G4AffineTransform
{
public:
G4AffineTransform();
// Translation only: Under t'form translate point at origin by tlate
G4AffineTransform();
G4AffineTransform(const G4ThreeVector &tlate);
// Rotation only: Under t'form rotate by rot
public: // with description
G4AffineTransform(const G4RotationMatrix &rot);
// Under t'form: Rotate by rot then translate by tlate
G4AffineTransform(const G4ThreeVector &tlate);
// Translation only: under t'form translate point at origin by tlate
G4AffineTransform(const G4RotationMatrix &rot,
const G4ThreeVector &tlate);
G4AffineTransform(const G4RotationMatrix &rot);
// Rotation only: under t'form rotate by rot
G4AffineTransform(const G4RotationMatrix &rot,
const G4ThreeVector &tlate);
// 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
// Optionally rotate by *rot then translate by tlate - rot may be null
G4AffineTransform operator * (const G4AffineTransform &tf) const;
// Compound Transforms:
// tf2=tf2*tf1 equivalent to tf2*=tf1
// Returns compound transformation of self*tf
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);
// (Modifying) Multiplies self by tf; Returns self reference
// ie. A=AB for a*=b
G4AffineTransform operator * (const G4AffineTransform &tf) const;
G4AffineTransform& Product(const G4AffineTransform &tf1,
const G4AffineTransform &tf2);
// '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& InverseProduct(const G4AffineTransform &tf1,
const G4AffineTransform &tf2);
// (Modifying) Sets self=tf1*(tf2^-1); Returns self reference
G4ThreeVector TransformPoint(const G4ThreeVector &vec) const;
// Transform the specified point: returns vec*rot+tlate
G4ThreeVector TransformAxis(const G4ThreeVector &axis) const;
// Transform the specified axis: returns
// (Modifying) Multiplies self by tf; Returns self reference
// ie. A=AB for a*=b
G4AffineTransform& operator *= (const G4AffineTransform &tf);
void ApplyPointTransform(G4ThreeVector &vec) const;
// Transform the specified point (in place): sets vec=vec*rot+tlate
void ApplyAxisTransform(G4ThreeVector &axis) const;
// Transform the specified axis (in place): sets axis=axis*rot;
// '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 Inverse() const;
// Return inverse of current transform
G4AffineTransform& Product(const G4AffineTransform &tf1,
const G4AffineTransform &tf2);
// (Modifying) Sets self=tf1*(tf2^-1); Returns self reference
G4AffineTransform& Invert();
// (Modifying) Sets self=inverse of self; Returns self reference
G4AffineTransform& InverseProduct(const G4AffineTransform &tf1,
const G4AffineTransform &tf2);
// Transform the specified point: returns vec*rot+tlate
G4AffineTransform& operator +=(const G4ThreeVector &tlate);
G4AffineTransform& operator -=(const G4ThreeVector &tlate);
// (Modifying) Adjust net translation by given vector;
// Returns self reference
G4ThreeVector TransformPoint(const G4ThreeVector &vec) const;
// Transform the specified axis: returns
G4bool operator == (const G4AffineTransform &tf) const;
G4bool operator != (const G4AffineTransform &tf) const;
G4ThreeVector TransformAxis(const G4ThreeVector &axis) const;
// Transform the specified point (in place): sets vec=vec*rot+tlate
G4double operator [] (const G4int n) const;
void ApplyPointTransform(G4ThreeVector &vec) const;
// Transform the specified axis (in place): sets axis=axis*rot;
G4bool IsRotated() const;
// True if transform includes rotation
void ApplyAxisTransform(G4ThreeVector &axis) const;
G4bool IsTranslated() const;
// True if transform includes translation
// Return inverse of current transform
G4RotationMatrix NetRotation() const;
G4AffineTransform Inverse() const;
G4ThreeVector NetTranslation() const;
// (Modifying) Sets self=inverse of self; Returns self reference
void SetNetRotation(const G4RotationMatrix &rot);
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);
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;
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
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4AffineTransform.icc,v 1.3 1999/12/15 14:49:50 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// G4AffineTransformation Inline implementation
@@ -5,32 +5,33 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4DrawVoxels.hh,v 1.7 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4DrawVoxels.hh,v 1.9 2000/06/06 13:18:55 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// class G4DrawVoxels
//
// Implementation
// Class description:
//
// Define G4DrawVoxelsDebug for debugging information on G4cout
//
// History:
// 03/08/1999 The G4VisAttributes have been made member data for lifetime reasons / visualisation L.G (see John Allison for further explanation)
// 29.07.99 first comitted version L.G.
// Utility class for the visualization of voxels in the detector geometry.
// Define G4DrawVoxelsDebug in the environment at compilation for debugging
// information printed to G4cout.
// History:
// 03/08/1999 The G4VisAttributes have been made member data for lifetime
// reasons / visualisation - L.G (ask John Allison for further
// explanation).
// 29/07/1999 First comitted version - L.G.
#ifndef G4DrawVoxels_HH
#define G4DrawVoxels_HH
//***********what I need to use (include and forward declarations) FOR DRAWING VOXELS****************
// *********** what I need to use (include and forward declarations)
// FOR DRAWING VOXELS ****************
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
#include "G4PlacedPolyhedron.hh" //#include "G4Polyhedron.hh" included
//#include <rw/tpordvec.h>
//#include <rw/tvordvec.h>
#include "G4SmartVoxelHeader.hh"
#include "G4VoxelLimits.hh"
#include "G4AffineTransform.hh"
@@ -38,17 +39,21 @@
#include "G4LogicalVolume.hh"
#include "G4VSolid.hh"
#define voxel_width 0;
#define voxel_width 0
#define G4DrawVoxelsDebug
// ***********************************************************************
class G4DrawVoxels
{
public: // with description
//***************************************************************************************************
class G4DrawVoxels{
public:
//constructor. It initialises the members data to default colors
G4DrawVoxels();
// Constructor. It initialises the members data to default colors
// Copy constructor and assignment operator not supported (array
// fvoxelcolours ...).
~G4DrawVoxels(){};
//Copy constructor Assignment operator not supported (array fvoxelcolours ...)
// Destructor NOT virtual. Not a base class.
void DrawVoxels(const G4LogicalVolume* lv) const;
G4PlacedPolyhedronList* CreatePlacedPolyhedra(const G4LogicalVolume*) const;
@@ -57,7 +62,8 @@ class G4DrawVoxels{
void SetBoundingBoxVisAttributes(G4VisAttributes&);
private:
//Member data
// Member data
G4VisAttributes fVoxelsVisAttributes[3];
G4VisAttributes fBoundingBoxVisAttributes;
@@ -65,7 +71,8 @@ class G4DrawVoxels{
G4AffineTransform GetAbsoluteTransformation(const G4VPhysicalVolume*) const;
//Copy constructor Assignment operator not supported (array fvoxelcolours ...)
// Copy constructor Assignment operator not supported (array
// fvoxelcolours ...)
G4DrawVoxels(const G4DrawVoxels&);
G4DrawVoxels operator=(const G4DrawVoxels&);
};
@@ -5,33 +5,23 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4GeometryManager.hh,v 1.2 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4GeometryManager.hh,v 1.3 2000/04/20 16:49:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// class G4GeometryManager
//
// A class resposible for high level geometrical functions, and for
// Class description:
//
// A class responsible 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.
// The class is a `singleton', with access via the static method
// G4GeometryManager::GetInstance().
//
// Member data:
//
// static G4GeometryManager* fgInstance
// Ptr to the unique instance of class
//
// static G4GeometryManager* fgInstance
// - Ptr to the unique instance of class
// History:
// 26.07.95 P.Kent Initial version, incuding optimisation Build
@@ -51,14 +41,25 @@
class G4GeometryManager
{
public:
public: // with description
G4bool CloseGeometry(G4bool pOptimise=true);
// Close (`lock') the geometry: perform sanity and `completion' checks
// and optionally [default=yes] build optimisation information.
void OpenGeometry();
static G4GeometryManager* GetInstance();
// Open (`unlock') the geometry and remove optimisation information if
// present.
static G4GeometryManager* GetInstance();
// Return ptr to singleton instance of the class.
protected:
protected:
G4GeometryManager();
private:
private:
void BuildOptimisations(const G4bool allOpt);
void DeleteOptimisations();
@@ -67,5 +68,3 @@ private:
};
#endif
@@ -5,22 +5,37 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LogicalSurface.hh,v 1.2 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4LogicalSurface.hh,v 1.3 2000/04/20 16:49:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
////////////////////////////////////////////////////////////////////////
// G4LogicalSurface Definition
// Class G4LogicalSurface
////////////////////////////////////////////////////////////////////////
//
// 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.
// Class 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.
//
// Methods:
// G4OpticalSurface* GetOpticalSurface() const
// void SetOpticalSurface(G4OpticalSurface*)
//
// G4String GetName() const
// void SetName(const G4String&)
//
// G4TransitionRadiationSurface* GetTransitionRadiationSurface() const
// void SetTransitionRadiationSurface(G4TransitionRadiationSurface*)
//
// Data members:
// G4String theName
// G4OpticalSurface* theOpticalSurface
// G4TransitionRadiationSurface* theTransRadSurface
// Version: 1.0
// Created: 1997, June, 4th to 17th
// Author: John Apostolakis, (with help of Peter Gumplinger)
@@ -38,7 +53,6 @@
/////////////
#include "globals.hh"
#include "templates.hh"
class G4OpticalSurface;
class G4TransitionRadiationSurface;
@@ -52,59 +66,54 @@ class G4LogicalSurface
////////////
// Methods
////////////
public:
G4OpticalSurface* GetOpticalSurface() const
{ return theOpticalSurface; }
public:
G4OpticalSurface* GetOpticalSurface() const;
void SetOpticalSurface(G4OpticalSurface* ptrOpticalSurface);
void SetOpticalSurface(G4OpticalSurface* ptrOpticalSurface)
{ theOpticalSurface= ptrOpticalSurface; }
G4String GetName() const;
void SetName(const G4String& name);
G4String GetName() const { return theName; }
void SetName(const G4String& name){theName = name;}
G4TransitionRadiationSurface* GetTransitionRadiationSurface() const
{ return theTransRadSurface; }
void SetTransitionRadiationSurface( G4TransitionRadiationSurface* transRadSurf )
{ theTransRadSurface= transRadSurf; }
G4TransitionRadiationSurface* GetTransitionRadiationSurface() const;
void SetTransitionRadiationSurface(G4TransitionRadiationSurface* transRadSurf);
////////////////////////////////
// Constructors and Destructor
////////////////////////////////
protected:
protected:
// There should be no instances of this class
G4LogicalSurface(const G4String& name,
G4OpticalSurface* opticalSurface);
G4LogicalSurface(const G4String& name,
G4OpticalSurface* opticalSurface);
// Is the name more meaningful for the properties or the logical
// surface ?
// surface ?
public:
virtual ~G4LogicalSurface();
public:
virtual ~G4LogicalSurface();
private:
G4LogicalSurface(const G4LogicalSurface &right); // Copying restricted
private:
G4LogicalSurface(const G4LogicalSurface &right); // Copying restricted
//////////////
// Operators
//////////////
public:
G4int operator==(const G4LogicalSurface &right) const;
G4int operator!=(const G4LogicalSurface &right) const;
public:
G4int operator==(const G4LogicalSurface &right) const;
G4int operator!=(const G4LogicalSurface &right) const;
private:
const G4LogicalSurface& operator=(const G4LogicalSurface& right);
private:
const G4LogicalSurface& operator=(const G4LogicalSurface& right);
// ------------------
// Basic data members ( To define a 'logical' surface)
// ------------------
private:
G4String theName; // Surface name
private:
G4String theName; // Surface name
G4OpticalSurface* theOpticalSurface;
G4TransitionRadiationSurface* theTransRadSurface;
G4OpticalSurface* theOpticalSurface;
G4TransitionRadiationSurface* theTransRadSurface;
};
////////////////////
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LogicalSurface.icc,v 1.2 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4LogicalSurface.icc,v 1.3 2000/04/20 16:49:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
////////////////////////////////////////////////////////////////////////
// Surface Class Inline Methods
@@ -20,31 +20,70 @@
//
////////////////////////////////////////////////////////////////////////
// #include "G4ios.hh"
/////////////////////////
// Class Inline Methods
/////////////////////////
inline G4OpticalSurface*
G4LogicalSurface::GetOpticalSurface() const
{
return theOpticalSurface;
}
inline void
G4LogicalSurface::SetOpticalSurface(G4OpticalSurface* ptrOpticalSurface)
{
theOpticalSurface = ptrOpticalSurface;
}
inline G4String
G4LogicalSurface::GetName() const
{
return theName;
}
inline void
G4LogicalSurface::SetName(const G4String& name)
{
theName = name;
}
inline G4TransitionRadiationSurface*
G4LogicalSurface::GetTransitionRadiationSurface() const
{
return theTransRadSurface;
}
inline void
G4LogicalSurface::SetTransitionRadiationSurface(G4TransitionRadiationSurface*
transRadSurf )
{
theTransRadSurface= transRadSurf;
}
//////////////
// Operators
//////////////
inline const G4LogicalSurface & G4LogicalSurface::operator=(const G4LogicalSurface &right)
inline const G4LogicalSurface &
G4LogicalSurface::operator=(const G4LogicalSurface &right)
{
return right;
}
inline G4int G4LogicalSurface::operator==(const G4LogicalSurface &right) const
inline G4int
G4LogicalSurface::operator==(const G4LogicalSurface &right) const
{
return (this == (G4LogicalSurface *) &right);
}
inline G4int G4LogicalSurface::operator!=(const G4LogicalSurface &right) const
inline G4int
G4LogicalSurface::operator!=(const G4LogicalSurface &right) const
{
return (this != (G4LogicalSurface *) &right);
}
/////////////////
// Constructors
/////////////////
@@ -5,166 +5,68 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LogicalVolume.hh,v 1.4 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4LogicalVolume.hh,v 1.5 2000/04/20 16:49:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// class G4LogicalVolume
//
// Class description:
//
// 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.
// 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
// Get and Set functionality is provided for all attributes, 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
//
// 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
// 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.
// NOTE: This class is currently *NOT* subclassed, since not meant to
// act as a base class. Therefore, the destructor is NOT 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.
//
// G4double GetSmartless()
// Gets user defined optimisation quality
// void SetSmartless(G4double)
// Sets user defined optimisation quality
//
// 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:
//
// G4RWTPtrOrderedVector<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
// G4double smartless
// Quality for optimisation, average number of voxels to be spent per content
// 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
// Data members:
//
// G4RWTPtrOrderedVector<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.
// G4VSensitiveDetector *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.
// G4SmartVoxelHeader *fVoxel
// - Pointer (possibly NULL) to optimisation info objects.
// G4double fSmartless
// - Quality for optimisation, average number of voxels to be spent
// per content.
// const G4VisAttributes* fVisAttributes
// - Pointer (possibly NULL) to visualization attributes.
// 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:
// 12.02.99 S.Giani: Added user defined optimisation quality
// 09.11.98 J. Apostolakis: Changed G4MagneticField to G4FieldManager
@@ -195,79 +97,139 @@ class G4FastSimulationManager;
class G4LogicalVolume
{
public:
public: // with description
G4LogicalVolume(G4VSolid *pSolid, G4Material *pMaterial,
const G4String& name,
G4FieldManager *pFieldMgr=0,
G4VSensitiveDetector *pSDetector=0,
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.
// NOT virtual, since not meant to act as base class.
G4String GetName() const;
void SetName(const G4String& pName);
// Returns and sets the name of the 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 checking is performed.
void AddDaughter(G4VPhysicalVolume* p);
// Add the volume p as a daughter of the current logical volume.
G4bool IsDaughter(const G4VPhysicalVolume* 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;
void SetSolid(G4VSolid *pSolid);
// Gets and sets the current solid.
G4Material* GetMaterial() const;
void SetMaterial(G4Material *pMaterial);
// Gets and sets the current material.
G4FieldManager* GetFieldManager() const;
// Gets current FieldManager.
void SetFieldManager(G4FieldManager *pFieldMgr, 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;
void SetUserLimits(G4UserLimits *pULimits);
// Gets and sets current UserLimits.
G4SmartVoxelHeader* GetVoxelHeader() const;
void SetVoxelHeader(G4SmartVoxelHeader *pVoxel);
// Gets and sets current VoxelHeader.
G4double GetSmartless();
void SetSmartless(G4double s);
// Gets and sets user defined optimisation quality.
G4bool operator == ( const G4LogicalVolume& lv) const;
// Equality defined by address only- return true if objects are at
// same address, else false.
const G4VisAttributes* GetVisAttributes () const;
void SetVisAttributes (const G4VisAttributes* pVA);
void SetVisAttributes (const G4VisAttributes& VA);
// Gets and sets visualization attributes.
void BecomeEnvelopeForFastSimulation(G4FastSimulationManager* );
// Makes this an Envelope for given FastSimulationManager.
// Ensures that all its daughter volumes get it too - unless they
// have one already.
void ClearEnvelopeForFastSimulation(G4LogicalVolume* motherLV= 0);
// Erase volume's Envelope status and propagate the FastSimulationManager
// of its mother volume to itself and its daughters.
G4FastSimulationManager* GetFastSimulationManager () const;
// Gets current FastSimulationManager pointer.
void SetBiasWeight (G4double w);
G4double GetBiasWeight() const;
// Sets and gets bias weight.
private:
private:
void SetFastSimulationManager (G4FastSimulationManager* pPA,
G4bool IsEnvelope);
G4LogicalVolume* FindMotherLogicalVolumeForEnvelope();
//
// Data members:
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.
G4LogicalVolume* FindMotherLogicalVolumeForEnvelope();
private:
// Data members:
private:
G4RWTPtrOrderedVector<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.
G4VSensitiveDetector *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.
G4SmartVoxelHeader *fVoxel;
// Pointer (possibly NULL) to optimisation info objects.
G4double fSmartless;
// Quality for optimisation, average number of voxels to be spent
// per content.
const G4VisAttributes* fVisAttributes;
// Pointer (possibly NULL) to visualization attributes.
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.
};
#include "G4LogicalVolume.icc"
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4LogicalVolume.icc,v 1.3 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// class G4LogicalVolume Inline Implementation file
@@ -5,43 +5,30 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LogicalVolumeStore.hh,v 1.3 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4LogicalVolumeStore.hh,v 1.4 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// class G4LogicalVolumeStore
//
// Container for all LogicalVolumes, with functionality derived from
// G4RWTPtrOrderedVector<T>. The class is `singleton', in that only
// one can exist, and access is facillitated via G4LogicalVolumeStore::GetInstance()
// Class description:
//
// 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.
// Container for all LogicalVolumes, with functionality derived from
// G4RWTPtrOrderedVector<T>. The class is a `singleton', in that only
// one can exist, and access is provided via the static function
// 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 G4RWTPtrOrderedVector<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
// instead of inheritance for G4RWTPtrOrderedVector<T>.
//
// Member data:
//
// static G4LogicalVolumeStore* fgInstance
// Ptr to the single G4LogicalVolumeStore
//
// - Ptr to the single G4LogicalVolumeStore.
// History:
// 10.07.95 P.Kent Initial version
@@ -54,14 +41,25 @@
class G4LogicalVolumeStore : public G4RWTPtrOrderedVector<G4LogicalVolume>
{
public:
public: // with description
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,
// creating it if necessary.
virtual ~G4LogicalVolumeStore();
// Destructor.
protected:
G4LogicalVolumeStore();
private:
static G4LogicalVolumeStore* fgInstance;
};
@@ -5,38 +5,19 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PVParameterised.hh,v 1.2 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4PVParameterised.hh,v 1.3 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// class G4PVParameterised
//
// Class description:
//
// 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
@@ -47,13 +28,17 @@
class G4PVParameterised : public G4PVReplica
{
public:
public: // with description
G4PVParameterised(const G4String& pName,
G4LogicalVolume* pLogical,
G4VPhysicalVolume* pMother,
const EAxis pAxis,
const G4int nReplicas,
G4VPVParameterisation *pParam);
// Replicate the volume nReplicas Times using the paramaterisation pParam,
// within the mother volume pMother. The positioning of the replicas is
// dominant along the specified axis.
G4PVParameterised(const G4String& pName,
G4LogicalVolume* pLogical,
@@ -61,19 +46,22 @@ public:
const EAxis pAxis,
const G4int nReplicas,
G4VPVParameterisation *pParam);
// Almost exactly similar to first constructor, changing only mother
// pointer's type to LogicalVolume.
virtual G4VPVParameterisation* GetParameterisation() const;
// Returns the current pointer to the parameterisation.
virtual void GetReplicationData(EAxis& axis,
G4int& nReplicas,
G4double& width,
G4double& offset,
G4bool& consuming) const;
private:
G4int& nReplicas,
G4double& width,
G4double& offset,
G4bool& consuming) const;
// Fills arguments with the attributes from the base replica.
private:
G4VPVParameterisation *fparam;
};
#endif
@@ -5,80 +5,17 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PVPlacement.hh,v 1.2 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4PVPlacement.hh,v 1.3 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// class G4PVPlacement
//
// Class description:
//
// 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
@@ -91,12 +28,12 @@
#define G4PVPLACEMENT_HH
#include "G4VPhysicalVolume.hh"
// class G4Transform3D;
#include "G4Transform3D.hh"
class G4PVPlacement : public G4VPhysicalVolume
{
public:
public: // with description
G4PVPlacement(G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
const G4String &pName,
@@ -104,6 +41,17 @@ public:
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 Currently NOT used. For future use to identify if the volume
// is MANY in the GEANT 3 sense, or not.
// pCopyNo should be set to 0 for the first volume of a given type.
G4PVPlacement(const G4Transform3D &Transform3D,
const G4String &pName,
@@ -111,6 +59,17 @@ public:
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).
// 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(G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
@@ -119,6 +78,12 @@ public:
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,
G4LogicalVolume *pCurrentLogical,
@@ -126,12 +91,22 @@ public:
G4LogicalVolume *pMotherLogical,
G4bool pMany,
G4int pCopyNo);
// Utilises both variations above (from 2nd and 3rd constructor).
~G4PVPlacement();
// Default destructor.
virtual G4bool IsMany() const;
virtual G4int GetCopyNo() const;
virtual void SetCopyNo(G4int CopyNo);
// Gets and sets the copy number of the volume.
virtual void Setup(G4VPhysicalVolume *pMother);
// Sets the pointer to the mother volume.
// Must not be called when geometry closed.
public: // without description
virtual G4bool IsMany() const;
virtual G4bool IsReplicated() const;
virtual G4VPVParameterisation* GetParameterisation() const;
virtual void GetReplicationData(EAxis& axis,
@@ -139,16 +114,17 @@ public:
G4double& width,
G4double& offset,
G4bool& consuming) const;
virtual void Setup(G4VPhysicalVolume *pMother);
private:
G4bool fmany; // flag for booleans
private:
G4bool fmany; // flag for booleans/MANY - not used
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);
// Auxiliary function for 2nd constructor (one with G4Transform3D).
// Creates a new RotMatrix on the heap (using "new") and copies
// its argument into it.
};
#endif
@@ -5,12 +5,14 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PVReplica.hh,v 1.2 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4PVReplica.hh,v 1.3 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// class G4PVReplica
//
// Class description:
//
// 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
@@ -51,7 +53,7 @@
// 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
@@ -65,7 +67,8 @@
class G4PVReplica : public G4VPhysicalVolume
{
public:
public:
G4PVReplica(const G4String& pName,
G4LogicalVolume* pLogical,
G4VPhysicalVolume* pMother,
@@ -95,13 +98,16 @@ public:
G4double& offset,
G4bool& consuming) const;
virtual void Setup(G4VPhysicalVolume *pMother);
private:
private:
void CheckAndSetParameters(
const EAxis pAxis,
const G4int nReplicas,
const G4double width,
const G4double offset);
protected:
protected:
EAxis faxis;
G4int fnReplicas;
G4double fwidth,foffset;
@@ -5,14 +5,16 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PhysicalVolumeStore.hh,v 1.3 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4PhysicalVolumeStore.hh,v 1.4 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// class G4PhysicalVolume
//
// Class description:
//
// Container for all solids, with functionality derived from
// G4RWTPtrOrderedVector<T>. The class is `singleton', in that only
// one can exist, and access is facillitated via
// G4RWTPtrOrderedVector<T>. The class is a `singleton', in that only
// one can exist, and access is provided via the static method
// G4PhysicalVolumeStore::GetInstance()
//
// All solids should be registered with G4PhysicalVolumeStore, and removed on
@@ -22,27 +24,11 @@
// If much additional functionality is added, should consider containment
// instead of inheritance for G4RWTPtrOrderedVector<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
//
// - Ptr to the single G4PhysicalVolumeStore.
// History:
// 25.07.95 P.Kent Initial version
@@ -55,14 +41,25 @@
class G4PhysicalVolumeStore : public G4RWTPtrOrderedVector<G4VPhysicalVolume>
{
public:
public: // with description
static void Register(G4VPhysicalVolume* pSolid);
// Add the volume to the collection.
static void DeRegister(G4VPhysicalVolume* pSolid);
// Remove the volume from the collection.
static G4PhysicalVolumeStore* GetInstance();
// Get a ptr to the unique G4PhysicalVolumeStore,
// creating it if necessary.
virtual ~G4PhysicalVolumeStore();
// Default destructor.
protected:
G4PhysicalVolumeStore();
private:
static G4PhysicalVolumeStore* fgInstance;
};
@@ -5,68 +5,32 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4SmartVoxelHeader.hh,v 1.3 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4SmartVoxelHeader.hh,v 1.4 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// class G4SmartVoxelHeader
//
// Represents set of voxels, created by a single axis of virtual division.
// Class description:
//
// Represents a set of voxels, created by a single axis of virtual division.
// Contains the individual voxels, which are potentially further divided
// along different axes
// 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,
// G4RWTValOrderedVector<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
// - The (cartesian) slicing/division axis
// G4double fmaxExtent
// G4double fminExtent
// Minimum and maximum coordiantes along the axis
// - Minimum and maximum coordiantes along the axis
// G4RWTPtrOrderedVector<G4SmartVoxelProxy> fslices
// The slices along the axis
// - 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]
//
// - Minimum and maximum equivalent slice nos.
// [Applies to the level of the header, not its nodes]
// History:
// 13.07.95 P.Kent Initial version
@@ -85,12 +49,13 @@
#include "g4rw/tvvector.h"
#include "g4rw/tpordvec.h"
#include "g4rw/tvordvec.h"
// Forward declarations
class G4LogicalVolume;
class G4VoxelLimits;
class G4VPhysicalVolume;
// Typedefs
typedef G4RWTPtrOrderedVector<G4SmartVoxelProxy> G4ProxyVector;
typedef G4RWTPtrOrderedVector<G4SmartVoxelNode> G4NodeVector;
typedef G4RWTValOrderedVector<G4int> G4VolumeNosVector;
@@ -98,142 +63,126 @@ typedef G4RWTValVector<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;
}
public: // with description
// Axis enquiry
EAxis GetAxis() const
{
return faxis;
}
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].
// Extent enquiry functions
G4double GetMaxExtent() const
{
return fmaxExtent;
}
G4int GetMaxEquivalentSliceNo() const;
void SetMaxEquivalentSliceNo(const G4int pMax);
G4int GetMinEquivalentSliceNo() const;
void SetMinEquivalentSliceNo(const G4int pMin);
// Access functions for min/max equivalent slices (nodes & headers).
EAxis GetAxis() const;
// Return the current division axis.
G4double GetMinExtent() const
{
return fminExtent;
}
G4double GetMaxExtent() const;
// Return the maximum coordinate limit along the current axis.
G4double GetMinExtent() const;
// Return the minimum coordinate limit along the current axis.
// Slice enquiry functions
G4int GetNoSlices() const
{
return fslices.entries();
}
G4int GetNoSlices() const;
// Return the no of slices along the current axis.
// Slice access
G4SmartVoxelProxy* GetSlice(const G4int n) const
{
return fslices(n);
}
// True if all slices equal (after collection)
G4SmartVoxelProxy* GetSlice(const G4int n) const;
// Return ptr to the proxy for the nth slice (numbering from 0,
// no bounds checking performed).
G4bool AllSlicesEqual() const;
// True if all slices equal (after collection).
public: // without description
G4bool operator == (const G4SmartVoxelHeader& pHead) const;
friend G4std::ostream& operator << (G4std::ostream&s, const G4SmartVoxelHeader& h);
friend G4std::ostream&
operator << (G4std::ostream&s, const G4SmartVoxelHeader& h);
protected:
protected:
G4SmartVoxelHeader(G4LogicalVolume* pVolume,
const G4VoxelLimits& pLimits,
const G4VolumeNosVector* 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.
// `Worker' / operation functions:
// `Worker' / operation functions:
// Build and refine voxels for daughters of specified volume which
// DOES NOT contain a REPLICATED daughter
void BuildVoxels(G4LogicalVolume* pVolume);
// Build and refine voxels for daughters of specified volume which
// DOES NOT contain a REPLICATED daughter.
// Build voxels for specified volume containing a single
// replicated volume
void BuildReplicaVoxels(G4LogicalVolume* pVolume);
// Build voxels for specified volume containing a single
// replicated volume.
// Construct nodes in simple consuming case
void BuildConsumedNodes(const G4int nReplicas);
// Construct nodes in simple consuming case.
// 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);
// 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.
// 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.
// Calculate and Store the minimum and maximum equivalent neighbour
// values for all slices.
void CollectEquivalentNodes();
// Collect common nodes, deleting all but one to save memory,
// and adjusting stored slice ptrs appropriately.
// Collect common headers, deleting all but one to save memory, and adjusting
// stored slice ptrs appropriately.
void CollectEquivalentHeaders();
// Collect common headers, deleting all but one to save memory,
// and adjusting stored slice ptrs appropriately.
// 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);
G4ProxyVector* BuildNodes(G4LogicalVolume* pVolume,
G4VoxelLimits pLimits,
const G4VolumeNosVector* pCandidates,
EAxis pAxis);
// Build the nodes corresponding to the specified axis, within
// the specified limits, considering the daughters numbered pCandidates
// of the logical volume.
// 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);
// 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.
// 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);
// Examined each contained node, refine (create a replacement additional
// dimension of voxels) when there is more than one voxel in the slice.
// Min and max equivalent slice nos for previous level
G4int fminEquivalent;
G4int fmaxEquivalent;
// Min and max equivalent slice nos for previous level.
// Axis for slices
EAxis faxis;
// Max and min coordinate along faxis
// Axis for slices.
G4double fmaxExtent;
G4double fminExtent;
// Slices along axis
// Max and min coordinate along faxis.
G4ProxyVector fslices;
// Slices along axis.
};
#include "G4SmartVoxelHeader.icc"
#endif
@@ -0,0 +1,67 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4SmartVoxelHeader.icc,v 1.1 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// G4SmartVoxelHeader Inline implementation
//
inline
G4int G4SmartVoxelHeader::GetMaxEquivalentSliceNo() const
{
return fmaxEquivalent;
}
inline
void G4SmartVoxelHeader::SetMaxEquivalentSliceNo(const G4int pMax)
{
fmaxEquivalent=pMax;
}
inline
G4int G4SmartVoxelHeader::GetMinEquivalentSliceNo() const
{
return fminEquivalent;
}
inline
void G4SmartVoxelHeader::SetMinEquivalentSliceNo(const G4int pMin)
{
fminEquivalent=pMin;
}
inline
EAxis G4SmartVoxelHeader::GetAxis() const
{
return faxis;
}
inline
G4double G4SmartVoxelHeader::GetMaxExtent() const
{
return fmaxExtent;
}
inline
G4double G4SmartVoxelHeader::GetMinExtent() const
{
return fminExtent;
}
inline
G4int G4SmartVoxelHeader::GetNoSlices() const
{
return fslices.entries();
}
inline
G4SmartVoxelProxy* G4SmartVoxelHeader::GetSlice(const G4int n) const
{
return fslices(n);
}
@@ -5,60 +5,27 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4SmartVoxelNode.hh,v 1.3 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4SmartVoxelNode.hh,v 1.4 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// class G4SmartVoxelNode
//
// Class description:
//
// 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.
//
// G4RWTValOrderedVector<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.
// - Min and maximum nodes with same contents. Set by constructor
// and set methods.
// G4RWTValOrderedVector<G4int>(1) fcontents
// Vector of no.s of volumes inside the node
//
// - Vector of no.s of volumes inside the node.
// History:
// 12.07.95 P.Kent Initial version
@@ -76,66 +43,48 @@ typedef G4RWTValOrderedVector<G4int> G4SliceVector;
class G4SmartVoxelNode
{
public:
public: // with description
// Constructor. Set min and max equivalent nodes to default.
G4SmartVoxelNode(const G4int pSlice=0) : fminEquivalent(pSlice),
fmaxEquivalent(pSlice)
{
}
fmaxEquivalent(pSlice) {}
// 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.
// Destructor. No actions necessary
~G4SmartVoxelNode()
{
}
~G4SmartVoxelNode() {}
// Destructor. No actions.
// Access functions for contents
G4int GetVolume(const G4int pVolumeNo) const;
// Return contained volume number pVolumeNo.
// Note: starts from 0 and no bounds checking performed.
// Return contained volume no pVolumeNo.
// No bounds checking
void Insert(G4int pVolumeNo);
// Add the specified volume number to the contents.
G4int GetVolume(const G4int pVolumeNo) const
{
return fcontents(pVolumeNo);
}
G4int GetNoContained() const;
// Return the number of volumes inside the node.
// 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;
}
G4int GetMaxEquivalentSliceNo() const;
// Return the maximum slice (node/header) number with the same contents,
// and with all intermediate slice also having the same contents.
void SetMaxEquivalentSliceNo(const G4int pMax);
// Set the maximum slice number (as above).
G4int GetMinEquivalentSliceNo() const;
// Return the minimum slice (node/header) number with the same contents,
// and with all intermediate nodes also having the same contents.
void SetMinEquivalentSliceNo(const G4int pMin);
// Set the minimum slice number (as above).
G4bool operator == (const G4SmartVoxelNode& v) const;
private:
// Equality operator.
private:
G4int fminEquivalent;
G4int fmaxEquivalent;
G4SliceVector fcontents;
};
#include "G4SmartVoxelNode.icc"
#endif
@@ -0,0 +1,55 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4SmartVoxelNode.icc,v 1.1 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// G4SmartVoxelNode Inline implementation
//
inline
G4int G4SmartVoxelNode::GetVolume(const G4int pVolumeNo) const
{
return fcontents(pVolumeNo);
}
inline
void G4SmartVoxelNode::Insert(G4int pVolumeNo)
{
fcontents.insert(pVolumeNo);
}
inline
G4int G4SmartVoxelNode::GetNoContained() const
{
return fcontents.entries();
}
inline
G4int G4SmartVoxelNode::GetMaxEquivalentSliceNo() const
{
return fmaxEquivalent;
}
inline
void G4SmartVoxelNode::SetMaxEquivalentSliceNo(const G4int pMax)
{
fmaxEquivalent=pMax;
}
inline
G4int G4SmartVoxelNode::GetMinEquivalentSliceNo() const
{
return fminEquivalent;
}
inline
void G4SmartVoxelNode::SetMinEquivalentSliceNo(const G4int pMin)
{
fminEquivalent=pMin;
}
@@ -5,39 +5,20 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4SmartVoxelProxy.hh,v 1.2 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4SmartVoxelProxy.hh,v 1.3 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-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.
// Class description:
//
// 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
@@ -55,55 +36,41 @@ class G4SmartVoxelHeader;
class G4SmartVoxelProxy
{
public:
public: // with description
G4SmartVoxelProxy(G4SmartVoxelHeader *pHeader)
{
fHeader=pHeader;
fNode=0;
}
: fHeader(pHeader), fNode(0) {}
// Proxy for the specified header.
G4SmartVoxelProxy(G4SmartVoxelNode *pNode)
{
fHeader=0;
fNode=pNode;
}
: fHeader(0), fNode(pNode) {}
// Proxy for the specified node.
// Destructor - do nothing. Not responsible for proxied objects
~G4SmartVoxelProxy() {;}
~G4SmartVoxelProxy() {}
// Destructor - do nothing. Not responsible for proxied objects.
G4bool IsHeader() const
{
return (fHeader) ? true:false;
}
G4bool IsHeader() const;
// Return true if proxying for a header, else false.
G4bool IsNode() const
{
return (fNode) ? true:false;
}
G4SmartVoxelNode* GetNode() const
{
assert(fNode != 0);
return fNode;
}
G4bool IsNode() const;
// Return true if proxying for a node, else false.
G4SmartVoxelHeader* GetHeader() const
{
assert(fHeader != 0);
return fHeader;
}
G4SmartVoxelNode* GetNode() const;
// Return ptr to proxied node, else call G4Exception.
G4bool operator == (const G4SmartVoxelProxy& v) const
{
return (this==&v) ? true : false;
}
G4SmartVoxelHeader* GetHeader() const;
// Return ptr to proxied header, else call G4Exception
G4bool operator == (const G4SmartVoxelProxy& v) const;
// Equality operator.
// True when objects share same address.
private:
private:
G4SmartVoxelNode* fNode;
G4SmartVoxelHeader* fHeader;
};
#include "G4SmartVoxelProxy.icc"
#endif
@@ -0,0 +1,45 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4SmartVoxelProxy.icc,v 1.1 2000/04/20 16:49:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// G4SmartVoxelProxy Inline implementation
//
inline
G4bool G4SmartVoxelProxy::IsHeader() const
{
return (fHeader) ? true:false;
}
inline
G4bool G4SmartVoxelProxy::IsNode() const
{
return (fNode) ? true:false;
}
inline
G4SmartVoxelNode* G4SmartVoxelProxy::GetNode() const
{
assert(fNode != 0);
return fNode;
}
inline
G4SmartVoxelHeader* G4SmartVoxelProxy::GetHeader() const
{
assert(fHeader != 0);
return fHeader;
}
inline
G4bool G4SmartVoxelProxy::operator == (const G4SmartVoxelProxy& v) const
{
return (this==&v) ? true : false;
}
@@ -5,14 +5,17 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4SolidStore.hh,v 1.3 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4SolidStore.hh,v 1.4 2000/04/20 16:49:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// class G4SolidStore
//
// Class description:
//
// Container for all solids, with functionality derived from
// G4RWTPtrOrderedVector<T>. The class is `singleton', in that only
// one can exist, and access is facillitated via G4SolidStore::GetInstance()
// G4RWTPtrOrderedVector<T>. The class is a `singleton', in that only
// one can exist, and access is provided via the static method
// G4SolidStore::GetInstance().
//
// All solids should be registered with G4SolidStore, and removed on their
// destruction. Intended principally for UI browser. The underlying
@@ -21,27 +24,11 @@
// If much additional functionality is added, should consider containment
// instead of inheritance for G4RWTPtrOrderedVector<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
//
// - Ptr to the single G4SolidStore
// History:
// 10.07.95 P.Kent Initial version
@@ -54,14 +41,24 @@
class G4SolidStore : public G4RWTPtrOrderedVector<G4VSolid>
{
public:
public: // with description
static void Register(G4VSolid* pSolid);
// Add the solid to the collection.
static void DeRegister(G4VSolid* pSolid);
// Remove the solid from the collection.
static G4SolidStore* GetInstance();
// Get a ptr to the unique G4SolidStore, creating it if necessary.
virtual ~G4SolidStore();
// Default destructor.
protected:
G4SolidStore();
private:
static G4SolidStore* fgInstance;
};
@@ -5,15 +5,17 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VPVParameterisation.hh,v 1.2 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4VPVParameterisation.hh,v 1.3 2000/04/20 16:49:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// class G4VPVParamterisation
//
// Class description:
//
// 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
@@ -43,67 +45,50 @@ class G4Material;
class G4VPVParameterisation
{
public:
public:
virtual void ComputeTransformation(const G4int,
G4VPhysicalVolume *) const = 0;
virtual G4VSolid* ComputeSolid(const G4int,
G4VPhysicalVolume *);
virtual G4VSolid* ComputeSolid(const G4int, G4VPhysicalVolume *);
virtual G4Material* ComputeMaterial(const G4int,
G4VPhysicalVolume *);
virtual G4Material* ComputeMaterial(const G4int, G4VPhysicalVolume *);
virtual void ComputeDimensions(G4Box &,
const G4int,
const G4VPhysicalVolume *) const
{
}
const G4VPhysicalVolume *) const {}
virtual void ComputeDimensions(G4Tubs &,
const G4int,
const G4VPhysicalVolume *) const
{
}
const G4VPhysicalVolume *) const {}
virtual void ComputeDimensions(G4Trd &,
const G4int,
const G4VPhysicalVolume *) const
{
}
const G4VPhysicalVolume *) const {}
virtual void ComputeDimensions(G4Trap &,
const G4int,
const G4VPhysicalVolume *) const
{
}
const G4VPhysicalVolume *) const {}
virtual void ComputeDimensions(G4Cons &,
const G4int,
const G4VPhysicalVolume *) const
{
}
const G4VPhysicalVolume *) const {}
virtual void ComputeDimensions(G4Sphere &,
const G4int,
const G4VPhysicalVolume *) const
{
}
const G4VPhysicalVolume *) const {}
virtual void ComputeDimensions(G4Torus &,
const G4int,
const G4VPhysicalVolume *) const
{
}
const G4VPhysicalVolume *) const {}
virtual void ComputeDimensions(G4Para &,
const G4int,
const G4VPhysicalVolume *) const
{
}
const G4VPhysicalVolume *) const {}
virtual void ComputeDimensions(G4Hype &,
const G4int,
const G4VPhysicalVolume *) const
{
}
const G4VPhysicalVolume *) const {}
};
#endif
@@ -5,114 +5,19 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VPhysicalVolume.hh,v 1.3 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4VPhysicalVolume.hh,v 1.4 2000/04/20 16:49:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// class description:
//
// class G4VPhysicalVolume
//
// This is an Abstract Base class for representation of positioned volume.
// class G4VPhysicalVolume
//
// Class description:
//
// This is an Abstract Base class for the representation of positioned volume.
// The volume is placed within a mother volume, relative to its coordinate
// system. Either a single positioned volume or many positioned volume can
// be represented by a particular G4VPhysicalVolume.
//
// 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 // Obsolete
// inline G4RotationMatrix GetObjectRotationValue() const; // Replacement
// 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).
//
//
// 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]
// be represented by a particular G4VPhysicalVolume.
// Older access methods:
//
// 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/parameterisation mechanism.
//
// History:
// 09.11.99 J.Apostolakis Added GetObjectRotationValue() method & redid comments.
// 28.08.96 P.Kent Replaced transform by rotmat + vector
@@ -133,59 +38,110 @@ class G4VPVParameterisation;
class G4VPhysicalVolume
{
public: // with description
public: // with description
G4VPhysicalVolume(G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
const G4String &pName,
G4LogicalVolume *pLogical,
G4VPhysicalVolume *pMother);
// Initialise volume, positioned in a frame which is rotated by *pRot,
// relative to the coordinate system of the mother volume pMother.
// The center of the object is then placed at tlate 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.
//
// The constructor also registers volume with physical volume Store.
// Note that the Store may be removed or dynamically built in future
// because of memory constraints.
// Destructor - will be subclassed
virtual ~G4VPhysicalVolume();
// Destructor, will be subclassed. Removes volume from volume Store.
// Define equality by equal addresses only.
G4bool operator == (const G4VPhysicalVolume& p) const;
// Define equality by equal addresses only.
// Access functions
G4RotationMatrix* GetObjectRotation() const; // Obsolete
inline G4RotationMatrix GetObjectRotationValue() const; // Replacement
G4ThreeVector GetObjectTranslation() const;
// Access functions
// The following are 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; // Obsolete
G4RotationMatrix GetObjectRotationValue() const; // Replacement
G4ThreeVector GetObjectTranslation() const;
// Return the rotation/translation of the Object relative to the mother.
const G4RotationMatrix* GetFrameRotation() const;
G4ThreeVector GetFrameTranslation() const;
// Older access functions, that do not distinguish between frame/object!
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 access functions, that do not distinguish between frame/object!
const G4ThreeVector& GetTranslation() const;
const G4RotationMatrix* GetRotation() const;
// Old access functions, that do not distinguish between frame/object!
// They return the translation/rotation of the volume.
// Set functions
// Set functions
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/parameterisation mechanism.
G4LogicalVolume* GetLogicalVolume() const;
// Return the associated logical volume.
void SetLogicalVolume(G4LogicalVolume *pLogical);
// Set the logical volume. Must not be called when geometry closed.
G4VPhysicalVolume* GetMother() const;
// Return the current mother pointer.
void SetMother(G4VPhysicalVolume *pMother);
// Set the mother volume. Must not be called when geometry closed.
G4String GetName() const;
// Return the volume's name.
void SetName(const G4String& pName);
// Set the volume's name.
// Functions required of subclasses
// Functions required of subclasses
virtual G4bool IsMany() const = 0;
// Return true if the volume is MANY (not implemented yet).
virtual G4int GetCopyNo() const = 0;
// Return the volumes copy number.
virtual void SetCopyNo(G4int CopyNo) = 0;
// Set the volumes copy number.
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 GetReplicationData(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;
protected:
// Perform any initialisation/setup necessary for the given volume.
// [Set the current mother pointer to refer to the specified mother,
// by calling SetMother]
protected:
G4RotationMatrix *frot;
G4ThreeVector ftrans;
private:
private:
G4LogicalVolume *flogical; // The logical volume representing the
// physical and tracking attributes of
// the volume
@@ -196,6 +152,3 @@ private:
#include "G4VPhysicalVolume.icc"
#endif
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4VPhysicalVolume.icc,v 1.3 1999/12/15 14:49:51 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// class G4VPhysicalVolume Inline Implementation
+112 -231
View File
@@ -5,16 +5,15 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VSolid.hh,v 1.4 1999/12/15 14:49:52 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4VSolid.hh,v 1.6 2000/04/20 16:49:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// Class Description
//
// class G4VSolid
//
// Abstract base class solids, physical shapes that can be tracked through.
// Class description:
//
// Abstract base class for 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.
@@ -31,182 +30,15 @@
//
// 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".
//
// Class Description - end:
// -----------------------------------------------------------------------------
// 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.
//
// - Name for this solid.
// History:
// 12.04.00 J.Allison Implemented GetExtent() in terms of CalculateExtent()
// 17.06.98 J.Apostolakis Added pure virtual function GetEntityType()
// 26.07.96 P.Kent Added ComputeDimensions for replication mechanism.
// 26.07.96 P.Kent Added ComputeDimensions for replication mechanism
// 27.03.96 J.Allison Methods for visualisation
// 30.06.95 P.Kent Initial version, no scoping or visualisation functions
@@ -230,129 +62,178 @@ class G4DisplacedSolid;
#include "G4ThreeVector.hh"
#include "g4rw/tvordvec.h"
typedef G4RWTValOrderedVector<G4ThreeVector> G4ThreeVectorList;
typedef G4String G4GeometryType;
class G4VSolid {
public: // With description
G4VSolid(const G4String& name);
virtual ~G4VSolid();
class G4VSolid
{
public: // with description
G4bool operator==( const G4VSolid& s) const
{
return (this==&s) ? true : false;
}
G4VSolid(const G4String& name);
// Creates a new shape, with the supplied name. No provision is made
// for sharing a common name amongst multiple classes.
virtual ~G4VSolid();
// Default destructor.
G4bool operator==( const G4VSolid& s) const;
// Return true only if addresses are the same.
G4String GetName() const;
// Returns the current shape's name.
void SetName(const G4String& name);
// Sets the current shape's name.
virtual G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
G4double& pMin, G4double& pMax) const = 0;
// Calculate the minimum and maximum extent of the solid, when under the
// specified transform, and within the specified limits. If the solid
// is not intersected by the region, return false, else return true.
virtual EInside Inside(const G4ThreeVector& p) const = 0;
// 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.
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector& p) const = 0;
// Returns the outwards pointing unit normal of the shape for the
// surface closest to the point at offset p.
virtual G4double DistanceToIn(const G4ThreeVector& p,
const G4ThreeVector& v) const = 0;
const G4ThreeVector& v) const = 0;
// Return the distance along the normalised vector v to the shape,
// from the point at offset p. If there is no intersection, return
// kInfinity. The first intersection resulting from `leaving' a
// surface/volume is discarded. Hence, it is tolerant of points on
// the surface of the shape.
virtual G4double DistanceToIn(const G4ThreeVector& p) const = 0;
// Calculate the distance to the nearest surface of a shape from an
// outside point. The distance can be an underestimate.
virtual G4double DistanceToOut(const G4ThreeVector& p,
const G4ThreeVector& v,
const G4bool calcNorm=false,
G4bool *validNorm=0,
G4ThreeVector *n=0) const = 0;
// Return the 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 set to false if the solid does not lie entirely behind
// or on the exiting surface
// If calcNorm==false:
// validNorm and n are unused.
//
// Must be called as solid.DistanceToOut(p,v) or by specifying all
// the parameters.
virtual G4double DistanceToOut(const G4ThreeVector& p) const = 0;
// Calculate the distance to the nearest surface of a shape from an
// inside point. The distance can be an underestimate.
virtual void ComputeDimensions(G4VPVParameterisation* p,
const G4int n,
const G4VPhysicalVolume* pRep);
// Throw exception if ComputeDimensions called frrom an illegal
// derived class.
virtual G4GeometryType GetEntityType() const = 0;
// Provide identification of the class of an object.
// (required for persistency and STEP interface)
// Visualization functions
virtual void DescribeYourselfTo (G4VGraphicsScene& scene) const = 0;
virtual G4VisExtent GetExtent () const = 0;
// A "double dispatch" function which identifies the solid
// to the graphics scene.
virtual G4VisExtent GetExtent () const;
// Provide extent (bounding box) as possible hint to the graphics view.
virtual G4Polyhedron* CreatePolyhedron () const;
virtual G4NURBS* CreateNURBS () const;
// Create a G4Polyhedron/G4NURBS/... (It is the caller's responsibility
// to delete it). A null pointer means "not created".
// If Solid is made up from a Boolean operation of two solids,
// return the "no" solid.
// If the solid is not a "Boolean", return 0
virtual const G4VSolid* GetConstituentSolid(G4int no) const;
virtual G4VSolid* GetConstituentSolid(G4int no);
// If the solid is made up from a Boolean operation of two solids,
// return the "no" solid. If the solid is not a "Boolean", return 0.
// If the Solid is a "G4DisplacedSolid", return a self pointer
// else return 0
virtual const G4DisplacedSolid* GetDisplacedSolidPtr() const;
virtual G4DisplacedSolid* GetDisplacedSolidPtr();
// If the solid is a "G4DisplacedSolid", return a self pointer
// else return 0.
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
protected: // with description
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
// 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 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
// 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;
// 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.
// 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 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:
// 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;
// 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.
G4String fshapeName; // Name
};
@@ -5,15 +5,27 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VSolid.icc,v 1.2 1999/12/15 14:49:52 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4VSolid.icc,v 1.3 2000/04/20 16:49:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// G4VSolid Inline implementation
//
inline G4Polyhedron* G4VSolid::CreatePolyhedron () const {
inline
G4bool G4VSolid::operator==( const G4VSolid& s) const
{
return (this==&s) ? true : false;
}
inline
G4Polyhedron* G4VSolid::CreatePolyhedron () const
{
return 0;
}
inline G4NURBS* G4VSolid::CreateNURBS () const {
inline
G4NURBS* G4VSolid::CreateNURBS () const
{
return 0;
}
@@ -5,35 +5,31 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VTouchable.hh,v 1.2 1999/12/15 14:49:52 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4VTouchable.hh,v 1.3 2000/04/20 16:49:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// class G4VTouchable Paul Kent August 1996
// class G4VTouchable
//
// 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
// Class description:
//
// Base class for `touchable' objects capable of maintaining an
// association between parts of the geometrical hierarchy (volumes
// &/or solids) and their resultant transformation
// &/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
// -----------
// A touchable is a geometrical volume (solid) which has a unique
// placement in a detector description. It is 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.
// 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
// volume's transformation.
//
// 2) GetSolid that gives the solid of this touchable.
//
@@ -43,38 +39,44 @@
//
// Several capabilities are available from touchables with physical volumes:
//
// 3) GetVolume gives the physical volume
// 3) GetVolume gives the physical volume.
//
// 4) GetReplicaNumber gives the replica number of the physical volume,
// if it is replicated.
// if it is replicated.
//
// Touchables that Store volume hierarchy (history) have the whole stack of
// 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.
// 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.
// The top of the history tree is, by convention, the world volume.
//
// 5) GetHistoryDepth gives the depth of the history tree
// 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.
// 6) GetReplicaNumber, GetVolume, GetTranslation and GetRotation each
// can 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 <--------
// 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.
// NOTE: this method MODIFIES the touchable.
//
// An update method, with different arguments is available, so
// that the information in a touchable can be updated:
// 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.
// 8) UpdateYourself takes a physical volume pointer and can additionally
// take a NavigationHistory.
// History:
// Created: Paul Kent, August 1996
//
// Modified: John Apostolakis, July 1997: new methods to Retrieve replica
// and history information
// (intention is to hide NavigHistory)
#ifndef G4VTOUCHABLE_HH
#define G4VTOUCHABLE_HH
@@ -90,28 +92,37 @@ class G4NavigationHistory;
class G4VTouchable
{
public:
public: // with description
G4VTouchable();
virtual ~G4VTouchable();
// Constructor and destructor.
virtual const G4ThreeVector& GetTranslation(G4int depth=0) const = 0;
virtual const G4RotationMatrix* GetRotation(G4int depth=0) const = 0;
virtual const G4RotationMatrix* GetRotation(G4int depth=0) const = 0;
// Accessors for translation and rotation.
virtual G4VPhysicalVolume* GetVolume(G4int depth=0) const;
virtual G4VSolid* GetSolid(G4int depth=0) const;
// Accessors for physical volumes and solid.
// Methods for touchables with history
virtual G4int GetReplicaNumber(G4int depth=0) const;
virtual G4int GetHistoryDepth() const;
virtual G4int MoveUpHistory( G4int num_levels = 1 );
virtual G4int GetHistoryDepth() const;
virtual G4int MoveUpHistory(G4int num_levels=1);
// Methods for touchables with history.
virtual void UpdateYourself(G4VPhysicalVolume* pPhysVol,
const G4NavigationHistory* history=NULL);
// Update method.
public: // without description
// 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;
// Should this method be deprecated ? It is used in G4Navigator!
};
#include "G4VTouchable.icc"
#endif
@@ -5,57 +5,67 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VTouchable.icc,v 1.2 1999/12/15 14:49:52 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4VTouchable.icc,v 1.3 2000/04/20 16:49:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// class G4VTouchable Inline implementation
//
inline G4VTouchable::G4VTouchable()
inline
G4VTouchable::G4VTouchable()
{
}
inline G4VTouchable::~G4VTouchable()
inline
G4VTouchable::~G4VTouchable()
{
}
inline G4VPhysicalVolume* G4VTouchable::GetVolume(G4int) const
inline
G4VPhysicalVolume* G4VTouchable::GetVolume(G4int) const
{
G4Exception("G4VTouchable::GetVolume(G4int depth) undefined");
return NULL;
}
inline G4VSolid* G4VTouchable::GetSolid(G4int) const
inline
G4VSolid* G4VTouchable::GetSolid(G4int) const
{
G4Exception("G4VTouchable::GetSolid(G4int depth) undefined");
return NULL;
}
inline G4int G4VTouchable::GetReplicaNumber(G4int) const
inline
G4int G4VTouchable::GetReplicaNumber(G4int) const
{
G4Exception("G4VTouchable::GetReplicaNumber(G4int depth) undefined");
return 0;
}
inline G4int G4VTouchable::MoveUpHistory( G4int )
inline
G4int G4VTouchable::MoveUpHistory( G4int )
{
G4Exception("G4VTouchable::MoveUpHistory(G4int) undefined ");
return 0; // for this touchable subclass
}
inline void G4VTouchable::UpdateYourself( G4VPhysicalVolume* ,
const G4NavigationHistory* )
inline
void G4VTouchable::UpdateYourself(G4VPhysicalVolume*,
const G4NavigationHistory* )
{
G4Exception("G4VTouchable::UpdateYourself( G4VPhysicalVolume*, const G4NavigationHistory* ) undefined ");
}
inline G4int G4VTouchable::GetHistoryDepth() const
inline
G4int G4VTouchable::GetHistoryDepth() const
{
G4Exception("G4VTouchable::GetHistoryDepth() undefined ");
return 0;
}
inline const G4NavigationHistory* G4VTouchable::GetHistory() const
inline
const G4NavigationHistory* G4VTouchable::GetHistory() const
{
G4Exception("G4VTouchable::GetHistory() undefined");
return NULL;
@@ -67,8 +77,3 @@ inline void G4VTouchable::ResetLevel()
G4Exception("G4VTouchable::ResetLevel() undefined");
}
#endif
@@ -5,91 +5,29 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VoxelLimits.hh,v 1.3 1999/12/15 16:40:07 gcosmo Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: G4VoxelLimits.hh,v 1.4 2000/04/20 16:49:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
// class G4VoxelLimits
//
// Represents limitation/restrictions of space , where restrictions
// Class description:
//
// 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
// - The min and max values along each axis. +-kInfinity if not restricted.
//
//
// operators:
//
// G4std::ostream& operator << (G4std::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
//
// Beware no break statements after returns in switch(pAxis)s.
// History:
// 13.07.95 P.Kent Initial version.
@@ -106,146 +44,82 @@
class G4VoxelLimits
{
public:
// Constructor - initialise to be unlimited
public: // with description
G4VoxelLimits() : fxAxisMin(-kInfinity),fxAxisMax(kInfinity),
fyAxisMin(-kInfinity),fyAxisMax(kInfinity),
fzAxisMin(-kInfinity),fzAxisMax(kInfinity)
{;}
fzAxisMin(-kInfinity),fzAxisMax(kInfinity) {;}
// Constructor - initialise to be unlimited. Volume unrestricted.
// G4VoxelLimits(const G4VoxelLimits& v);
// Destructor
~G4VoxelLimits() {;}
// Destructor. No actions.
// Further restict limits
void AddLimit(const EAxis pAxis, const G4double pMin,const G4double pMax);
// Restrict the volume to between specified min and max along the
// given axis. Cartesian axes only, pMin<=pMax.
// Return appropriate max limit
G4double GetMaxXExtent() const
{
return fxAxisMax;
}
G4double GetMaxYExtent() const
{
return fyAxisMax;
}
G4double GetMaxZExtent() const
{
return fzAxisMax;
}
G4double GetMaxXExtent() const;
// Return maximum x extent.
G4double GetMaxYExtent() const;
// Return maximum y extent.
G4double GetMaxZExtent() const;
// Return maximum z extent.
// Return appropriate min limit
G4double GetMinXExtent() const
{
return fxAxisMin;
}
G4double GetMinYExtent() const
{
return fyAxisMin;
}
G4double GetMinZExtent() const
{
return fzAxisMin;
}
G4double GetMinXExtent() const;
// Return minimum x extent.
G4double GetMinYExtent() const;
// Return minimum y extent.
G4double GetMinZExtent() const;
// Return minimum z extent.
// 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();
}
}
G4double GetMaxExtent(const EAxis pAxis) const;
// Return maximum extent of volume along specified axis.
G4double GetMinExtent(const EAxis pAxis) const;
// Return minimum extent of volume along specified axis.
//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();
}
}
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.
// 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 IsLimited() const;
// Return true if limited along any axis
G4bool IsLimited(const EAxis pAxis) const;
// Return true if the specified axis is restricted/limited.
G4bool ClipToLimits(G4ThreeVector& pStart,G4ThreeVector& pEnd) const;
// 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.
// 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;
}
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 the 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()
private:
private:
G4double fxAxisMin,fxAxisMax;
G4double fyAxisMin,fyAxisMax;
G4double fzAxisMin,fzAxisMax;
};
#include "G4VoxelLimits.icc"
G4std::ostream& operator << (G4std::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.
#endif
@@ -0,0 +1,138 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4VoxelLimits.icc,v 1.1 2000/04/20 16:49:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// G4VoxelLimits Inline implementation
//
inline
G4double G4VoxelLimits::GetMaxXExtent() const
{
return fxAxisMax;
}
inline
G4double G4VoxelLimits::GetMaxYExtent() const
{
return fyAxisMax;
}
inline
G4double G4VoxelLimits::GetMaxZExtent() const
{
return fzAxisMax;
}
inline
G4double G4VoxelLimits::GetMinXExtent() const
{
return fxAxisMin;
}
inline
G4double G4VoxelLimits::GetMinYExtent() const
{
return fyAxisMin;
}
inline
G4double G4VoxelLimits::GetMinZExtent() const
{
return fzAxisMin;
}
inline
G4double G4VoxelLimits::GetMaxExtent(const EAxis pAxis) const
{
if (pAxis==kXAxis)
{
return GetMaxXExtent();
}
else if (pAxis==kYAxis)
{
return GetMaxYExtent();
}
else
{
assert(pAxis==kZAxis);
return GetMaxZExtent();
}
}
inline
G4double G4VoxelLimits::GetMinExtent(const EAxis pAxis) const
{
if (pAxis==kXAxis)
{
return GetMinXExtent();
}
else if (pAxis==kYAxis)
{
return GetMinYExtent();
}
else
{
assert(pAxis==kZAxis);
return GetMinZExtent();
}
}
inline
G4bool G4VoxelLimits::IsXLimited() const
{
return (fxAxisMin==-kInfinity&&fxAxisMax==kInfinity) ? false : true;
}
inline
G4bool G4VoxelLimits::IsYLimited() const
{
return (fyAxisMin==-kInfinity&&fyAxisMax==kInfinity) ? false : true;
}
inline
G4bool G4VoxelLimits::IsZLimited() const
{
return (fzAxisMin==-kInfinity&&fzAxisMax==kInfinity) ? false : true;
}
inline
G4bool G4VoxelLimits::IsLimited() const
{
return (IsXLimited()||IsYLimited()||IsZLimited());
}
inline
G4bool G4VoxelLimits::IsLimited(const EAxis pAxis) const
{
if (pAxis==kXAxis)
{
return IsXLimited();
}
else if (pAxis==kYAxis)
{
return IsYLimited();
}
else
{
assert(pAxis==kZAxis);
return IsZLimited();
}
}
inline
G4bool G4VoxelLimits::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;
}
@@ -5,12 +5,12 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: meshdefs.hh,v 1.2 1999/12/15 14:49:52 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: meshdefs.hh,v 1.3 2000/04/20 16:49:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
// Tube/Cone Meshing constants for extent calculations
//
// History:
// 13.08.95 P.Kent Created separate file
@@ -27,8 +27,3 @@ const G4int kMaxMeshSections=37; // max wedges+1 to make
// =>10 degrees/wedge for complete tube
#endif
@@ -5,13 +5,13 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: voxeldefs.hh,v 1.3 1999/12/15 14:49:52 gunter Exp $
// GEANT4 tag $Name: geant4-01-01 $
// $Id: voxeldefs.hh,v 1.4 2000/04/20 16:49:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-02-00 $
//
//
//
// Voxel Optimisation Constants
//
// History:
// 12.02.99 S.Giani made numerical values consistent with Geant3.21
// 13.08.95 P.Kent Created separate file
@@ -33,8 +33,3 @@ const G4int kMinVoxelVolumesLevel3=4; // Only make third level of refinement
// if >= this no of volumes in
// 2nd level node
#endif