Import Geant4 10.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-12-09 12:35:28 +01:00
parent 4ec577e5c4
commit a3452e42ac
3514 changed files with 210500 additions and 89628 deletions
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4AffineTransform.hh 96126 2016-03-16 21:16:54Z gcosmo $
// $Id: G4AffineTransform.hh 98309 2016-07-06 10:30:15Z gcosmo $
//
//
// class G4AffineTransform
@@ -65,6 +65,7 @@
#include "G4Types.hh"
#include "G4ThreeVector.hh"
#include "G4RotationMatrix.hh"
#include "G4Transform3D.hh"
class G4AffineTransform
{
@@ -152,6 +153,9 @@ public: // with description
inline void SetNetTranslation(const G4ThreeVector& tlate);
inline operator G4Transform3D () const;
// Conversion operator (cast) to G4Transform3D
private:
inline G4AffineTransform(
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4AffineTransform.icc 93152 2015-10-08 11:53:57Z gcosmo $
// $Id: G4AffineTransform.icc 98309 2016-07-06 10:30:15Z gcosmo $
//
//
// G4AffineTransformation Inline implementation
@@ -363,10 +363,9 @@ G4bool G4AffineTransform::IsTranslated() const
inline G4RotationMatrix G4AffineTransform::NetRotation() const
{
G4RotationMatrix mat;
return mat.rotateAxes(G4ThreeVector(rxx,ryx,rzx),
G4ThreeVector(rxy,ryy,rzy),
G4ThreeVector(rxz,ryz,rzz));
return G4Rep3x3(rxx,rxy,rxz,
ryx,ryy,ryz,
rzx,rzy,rzz);
}
inline
@@ -397,6 +396,12 @@ void G4AffineTransform::SetNetTranslation(const G4ThreeVector& tlate)
tz=tlate.z();
}
inline
G4AffineTransform::operator G4Transform3D () const
{
return G4Transform3D(NetRotation().inverse(),NetTranslation());
}
inline
std::ostream& operator << (std::ostream& os, const G4AffineTransform& transf)
{
@@ -32,32 +32,14 @@
// Class description:
//
// Helper class to facilitate calculation of the extent of a solid
// within the limits defined by the G4VoxelLimits object.
// within the limits defined by a G4VoxelLimits object.
//
// The function CalculateExtent() of a particular solid can create
// a G4BoundingEnvelope object that bounds the solid and then call
// CalculateExtent() of the G4BoundingEnvelope object.
//
// Calculation of the extent by G4BoundingEnvelope takes into account
// special parameter "delta" - width of an imagery layer that envelops
// the object. This value, multiplied by max scale factor, is added
// to the voxel limits during calculation of the extent.
//
// Example of use.
// In case of G4Box, max possible distance of a point to the border
// of the box, where the point is still considered as belonging to
// the surface of the box, is sqrt(0.5)*kCarTolerance (see corner).
// So, it will be safe to set the extension = kCarTolerance.
//
// Alternative solution can be to define G4BoundingEnvelope wide
// enough to include the surface of the solid and set delta = 0.
//
// The class supports the following bouding envelopes:
// - axis aligned bounding box (AABB);
// - bounding prism given by two convex polygonal bases;
// - bounding pyramid given by apex and convex polygonal base;
// - set of bounding prisms, given by a sequence of convex
// polygonal bases;
// Calculation of extent uses G4Transform3D, thus takes into account
// scaling and reflection, if any.
// History:
//
@@ -84,98 +66,88 @@ class G4BoundingEnvelope
{
public:
G4BoundingEnvelope(const G4ThreeVector& pMin,
const G4ThreeVector& pMax, G4double delta);
G4BoundingEnvelope(const G4ThreeVector& pMin,
const G4ThreeVector& pMax);
// Constructor from an axis aligned bounding box (AABB)
G4BoundingEnvelope(const G4ThreeVectorList& baseA,
const G4ThreeVectorList& baseB, G4double delta);
// Constructor from a prism given by two bases, the bases
// should have equal number of vertices
G4BoundingEnvelope(const G4ThreeVector& apex,
const G4ThreeVectorList& base, G4double delta);
// Constructor from a pyramid given by apex and base
G4BoundingEnvelope(const std::vector<G4ThreeVectorList*>& polygons,
G4double delta);
G4BoundingEnvelope(const std::vector<const G4ThreeVectorList*>& polygons);
// Constructor from a sequence of convex polygons, the polygons
// should have equal numbers of vertices except first and last
// polygons which may consist of a single vertex
G4BoundingEnvelope(const G4BoundingEnvelope& rhs);
// Copy constructor
G4BoundingEnvelope& operator=(const G4BoundingEnvelope& rhs);
// Assignment operator
G4BoundingEnvelope(const G4ThreeVector& pMin,
const G4ThreeVector& pMax,
const std::vector<const G4ThreeVectorList*>& polygons);
// Constructor from AABB and a sequence of polygons
~G4BoundingEnvelope();
// Destructor
G4bool BoundingBoxVsVoxelLimits(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimits,
const G4Transform3D& pTransform3D,
G4double& pMin, G4double& pMax) const;
// Analyse the position of the bounding box relative to the voxel.
// It returns "true" in the case where the value of the extent can be
// figured out directly from the dimensions of the bounding box, or
// it is clear that the bounding box and the voxel do not intersect.
// The reply "false" means that further calculations are needed.
G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimits,
const G4Transform3D& pTransform3D,
G4double& pMin, G4double& pMax) const;
// Calculate extent of the envelope
// Calculate extent of the bounding envelope
private:
void SetDelta(G4double delta);
// Set the extension
void CheckBoundingBox();
// Check correctness of the AABB (axis aligned bounding box)
void SetBoundingBox(const G4ThreeVector& pMin,
const G4ThreeVector& pMax);
// Set AABB (axis aligned bounding box)
void CheckBoundingPolygons();
// Check correctness of the sequence of convex polygonal bases
void SetBoundingPrism(const G4ThreeVectorList& baseA,
const G4ThreeVectorList& baseB);
// Set bounding prism
void SetBoundingPyramid(const G4ThreeVector& apex,
const G4ThreeVectorList& base);
// Set bounding pyramid
void SetBoundingPolygons(const std::vector<G4ThreeVectorList*>& polygons);
// Set bounding sequence of convex polygons
void CleanPolygons();
// Free allocated memory
G4VoxelLimits GetAdjustedVoxelLimits(const G4VoxelLimits& pVoxelLimits,
G4double pDelta) const;
// Extend voxel limits by scaled surface tolerance
G4double FindScaleFactor(const G4Transform3D& pTransform3D) const;
// Find max scale factor of the transformation
void TransformVertices(const G4Transform3D& pTransform3D,
const G4Polygon3D& polyA,
G4Polygon3D& polyB,
G4Segment3D& pAABB) const;
// Transform vertices of a polygon and update AABB (bounding box)
std::vector<G4Polygon3D*>& pBases) const;
// Create list of transformed polygons
void GetPrismAABB(const G4Polygon3D& pBaseA,
const G4Polygon3D& pBaseB,
G4Segment3D& pAABB) const;
// Find bounding box of a prism
void CreateListOfEdges(const G4Polygon3D& baseA,
const G4Polygon3D& baseB,
std::vector<G4Segment3D>& pEdges) const;
std::vector<G4Segment3D>& pEdges) const;
// Create list of edges of a prism
void CreateListOfPlanes(const G4Polygon3D& baseA,
const G4Polygon3D& baseB,
std::vector<G4Plane3D>& pPlanes) const;
std::vector<G4Plane3D>& pPlanes) const;
// Create list of planes bounding a prism
G4bool ClipEdgesByVoxelLimits(const std::vector<G4Segment3D>& pEdges,
const G4VoxelLimits& pLimits,
G4Segment3D& pExtent) const;
G4bool ClipEdgesByVoxel(const std::vector<G4Segment3D>& pEdges,
const G4VoxelLimits& pLimits,
G4Segment3D& pExtent) const;
// Clip set of edges by G4VoxelLimits
void ClipVoxelLimitsByPlanes(const G4VoxelLimits& pLimits,
const std::vector<G4Plane3D>& pPlanes,
const G4Segment3D& pAABB,
G4Segment3D& pExtent) const;
// Clip G4VoxelLimits by set of planes bounding a convex prism
void ClipVoxelByPlanes(G4int pBits,
const G4VoxelLimits& pLimits,
const std::vector<G4Plane3D>& pPlanes,
const G4Segment3D& pAABB,
G4Segment3D& pExtent) const;
// Clip G4VoxelLimits by set of planes bounding a prism
private:
G4double fDelta; // extention
std::vector<G4Polygon3D*> fBases; // sequence of polygonal bases
G4ThreeVector fMin, fMax;
// original bounding box
const std::vector<const G4ThreeVectorList*>* fPolygons;
// ref to original sequence of polygonal bases
};
#endif // G4BOUNDINGENVELOPE_HH
@@ -52,8 +52,10 @@ class G4GeomSplitter
{
public:
G4GeomSplitter() : totalobj(0), totalspace(0), sharedOffset(0) {
G4MUTEXINIT(mutex);
G4GeomSplitter()
: totalobj(0), totalspace(0), sharedOffset(0)
{
G4MUTEXINIT(mutex);
}
G4int CreateSubInstance()
@@ -125,7 +127,8 @@ class G4GeomSplitter
// To cope with user's changes in Geometry - e.g. change of material in a volume
{
G4AutoLock l(&mutex);
if (!offset) {
if (!offset)
{
SlaveInitializeSubInstance();
G4Exception("G4GeomSPlitter::SlaveReCopySubInstance()",
"MissingInitialisation", JustWarning,
@@ -153,18 +156,9 @@ class G4GeomSplitter
// Use recycled work area - which was created previously
if( offset && offset!=newOffset )
{
if( newOffset != offset )
{
G4Exception("G4GeomSplitter::UseWorkspace()",
"TwoWorkspaces", FatalException,
"Thread already has workspace - cannot use another.");
}
else
{
G4Exception("G4GeomSplitter::UseWorkspace()",
"TwoWorkspaces", JustWarning,
"Thread already has a workspace - trying to set the same again.");
}
G4Exception("G4GeomSplitter::UseWorkspace()",
"TwoWorkspaces", FatalException,
"Thread already has workspace - cannot use another.");
}
offset= newOffset;
// totalobj= numObjects;
@@ -200,4 +194,6 @@ class G4GeomSplitter
G4Mutex mutex;
};
template <typename T> G4ThreadLocal T* G4GeomSplitter<T>::offset = 0;
#endif
@@ -0,0 +1,196 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: $
//
//
// --------------------------------------------------------------------
// class G4GeomTools
//
// Class description:
//
// A collection of utilities which can be helpfull for a wide range
// of geometry-related tasks
// History:
//
// 10.10.2016 E.Tcherniaev: Initial version.
// --------------------------------------------------------------------
#ifndef G4GEOMTOOLS_HH
#define G4GEOMTOOLS_HH
#include <vector>
#include "G4TwoVector.hh"
#include "G4ThreeVector.hh"
typedef std::vector<G4TwoVector> G4TwoVectorList;
typedef std::vector<G4ThreeVector> G4ThreeVectorList;
class G4GeomTools
{
public:
// ==================================================================
// 2D Utilities
// ------------------------------------------------------------------
static G4double TriangleArea(G4double Ax, G4double Ay,
G4double Bx, G4double By,
G4double Cx, G4double Cy);
static G4double TriangleArea(const G4TwoVector& A,
const G4TwoVector& B,
const G4TwoVector& C);
// Calcuate area of 2D triangle, return value is positive if
// vertices of the triangle are given in anticlockwise order,
// otherwise it is negative
static G4double QuadArea(const G4TwoVector& A,
const G4TwoVector& B,
const G4TwoVector& C,
const G4TwoVector& D);
// Calcuate area of 2D quadrilateral, return value is positive if
// vertices of the quadrilateral are given in anticlockwise order,
// otherwise it is negative
static G4double PolygonArea(const G4TwoVectorList& polygon);
// Calcuate area of 2D polygon, return value is positive if
// vertices of the polygon are defined in anticlockwise order,
// otherwise it is negative
static G4bool PointInTriangle(G4double Px, G4double Py,
G4double Ax, G4double Ay,
G4double Bx, G4double By,
G4double Cx, G4double Cy);
// Decide if point (Px,Py) is inside triangle (Ax,Ay)(Bx,By)(Cx,Cy)
static G4bool PointInTriangle(const G4TwoVector& P,
const G4TwoVector& A,
const G4TwoVector& B,
const G4TwoVector& C);
// Decide if point P is inside triangle ABC
/*
static G4bool PointInPolygon(const G4TwoVector& P
const G4TwoVectorList& Polygon);
// Decide if point P is inside Polygon
*/
static G4bool IsConvex(const G4TwoVectorList& polygon);
// Decide if 2D polygon is convex, i.e. all internal angles are
// less than pi
static G4bool TriangulatePolygon(const G4TwoVectorList& polygon,
G4TwoVectorList& result);
static G4bool TriangulatePolygon(const G4TwoVectorList& polygon,
std::vector<G4int>& result);
// Simple implementation of "ear clipping" algorithm for
// triangulation of a simple contour/polygon, it places results
// in a std::vector as triplets of vertices. If triangulation
// is sucsessfull then the function returns true, otherwise false
static void RemoveRedundantVertices(G4TwoVectorList& polygon,
std::vector<G4int>& iout,
G4double tolerance = 0);
// Remove collinear and coincident points from 2D polygon.
// Indices of removed points are available in iout.
static G4bool DiskExtent(G4double rmin, G4double rmax,
G4double startPhi, G4double delPhi,
G4TwoVector& pmin, G4TwoVector& pmax);
// Calculate bounding square of a disk sector,
// it returns false if input parameters do not meet the following:
// rmin >= 0
// rmax > rmin + kCarTolerance
// delPhi > 0 + kCarTolerance
static void DiskExtent(G4double rmin, G4double rmax,
G4double sinPhiStart, G4double cosPhiStart,
G4double sinPhiEnd, G4double cosPhiEnd,
G4TwoVector& pmin, G4TwoVector& pmax);
// Calculate bounding square of a disk sector,
// faster version without check of parameters
// ==================================================================
// 3D Utilities
// ------------------------------------------------------------------
/*
static G4ThreeVector TriangleAreaNormal(const G4ThreeVector& A,
const G4ThreeVector& B,
const G4ThreeVector& C);
// Calcuate normal to the plane of of 3D triangle ABC with
// length equal to its area
static G4ThreeVector QuadAreaNormal(const G4ThreeVector& A,
const G4ThreeVector& B,
const G4ThreeVector& C,
const G4ThreeVector& D);
// Calcuate normal to the plane of 3D quadrilateral ABCD with
// length equal to its area
static G4ThreeVector PolygonAreaNormal(const G4ThreeVectorList& polygon);
// Calcuate normal to the plane of 3D polygon with
// length equal to its area
static G4bool IsPlanar(const G4ThreeVector& A,
const G4ThreeVector& B,
const G4ThreeVector& C,
const G4ThreeVector& D);
// Decide if 3D quadrilateral ABCD is planar
static G4bool IsPlanar(const G4ThreeVectorList& polygon);
// Decide if 3D polygon is planar
*/
static G4double DistancePointSegment(G4ThreeVector P,
G4ThreeVector A,
G4ThreeVector B);
// Calculate distance between point P and line segment AB in 3D
static G4bool SphereExtent(G4double rmin, G4double rmax,
G4double startTheta, G4double delTheta,
G4double startPhi, G4double delPhi,
G4ThreeVector& pmin, G4ThreeVector& pmax);
// Calculate bounding box of a spherical sector,
// it returns false if input parameters do not meet the following:
// rmin >= 0
// rmax > rmin + kCarTolerance
// startTheta >= 0 && <= pi;
// delTheta > 0 + kCarTolerance
// delPhi > 0 + kCarTolerance
private:
static G4bool CheckSnip(const G4TwoVectorList& contour,
G4int a, G4int b, G4int c,
G4int n, const G4int* V);
// Helper function for TriangulatePolygon()
};
#endif // G4GEOMTOOLS_HH
@@ -0,0 +1,106 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id:$
//
// ---------------------------------------------------------------------------
//
// class G4LogicalCrystalVolume
//
// Class description:
//
// Specialised logical volume for the description of crystals.
// The object can be created only with an extended material
// with a crystal extension. The class handles the orientation
// of the crystal axes wrt the solid to which the crystal is attached.
//
// History:
//
// 21-04-16, created by E.Bagli
//
// ---------------------------------------------------------------------------
#ifndef G4LOGICALCRYSTALVOLUME_HH
#define G4LOGICALCRYSTALVOLUME_HH 1
#include <vector>
#include "G4LogicalVolume.hh"
class G4CrystalExtension;
class G4ExtendedMaterial;
class G4LogicalCrystalVolume : public G4LogicalVolume
{
public:
G4LogicalCrystalVolume(G4VSolid* pSolid,
G4ExtendedMaterial* pMaterial,
const G4String& name,
G4FieldManager* pFieldMgr=0,
G4VSensitiveDetector* pSDetector=0,
G4UserLimits* pULimits=0,
G4bool optimise=true,
G4int h=0,
G4int k=0,
G4int l=0,
G4double rot=0.);
~G4LogicalCrystalVolume();
G4bool IsExtended() const { return true; }
// Return true if it is not a base-class object.
void SetMillerOrientation(G4int h, G4int k, G4int l, G4double rot=0.);
// Set physical lattice orientation, relative to G4VSolid coordinates
// Miller orientation aligns lattice normal (hkl) with geometry +Z
const G4ThreeVector& RotateToLattice(G4ThreeVector& dir) const;
const G4ThreeVector& RotateToSolid(G4ThreeVector& dir) const;
// Rotate input vector between lattice and solid orientations
// Returns new vector value for convenience
const G4CrystalExtension* GetCrystal() const;
const G4ThreeVector& GetBasis(G4int i) const;
// Call through to get crystal basis vectors
void SetVerbose(G4int aInt) { verboseLevel = aInt; }
static G4bool IsLattice(G4LogicalVolume* aLV);
private:
G4RotationMatrix fOrient; // Rotate geometry into lattice frame
G4RotationMatrix fInverse;
G4int hMiller, kMiller, lMiller; // Save Miller indices for dumps
G4double fRot;
G4int verboseLevel;
static std::vector<G4LogicalVolume*> fLCVvec;
};
#endif
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4LogicalVolume.hh 93287 2015-10-15 09:50:22Z gcosmo $
// $Id: G4LogicalVolume.hh 100397 2016-10-20 07:34:38Z gcosmo $
//
//
// class G4LogicalVolume
@@ -96,6 +96,7 @@
// - Flags if the Logical Volume is an envelope for a FastSimulationManager.
// History:
// 19.10.16 M.Asai: Added virtual keyword to the destructor
// 15.01.13 G.Cosmo, A.Dotti: Modified for thread-safety for MT
// 12.11.04 G.Cosmo: Added GetMass() method for computing mass of the tree
// 24.09.02 G.Cosmo: Added flags and accessors for region cuts handling
@@ -119,6 +120,7 @@
#include "G4Region.hh" // Required by inline methods
#include "G4VPhysicalVolume.hh" // Need operator == for vector fdaughters
#include "G4GeomSplitter.hh" // Needed for MT RW data splitting
#include "G4Threading.hh"
// Forward declarations
//
@@ -139,13 +141,14 @@ class G4LVData
public:
G4LVData();
void initialize() {
fSolid = 0;
fSensitiveDetector = 0;
fFieldManager = 0;
fMaterial = 0;
fMass = 0.0;
fCutsCouple = 0;
void initialize()
{
fSolid = 0;
fSensitiveDetector = 0;
fFieldManager = 0;
fMaterial = 0;
fMass = 0.0;
fCutsCouple = 0;
}
public:
@@ -204,9 +207,10 @@ class G4LogicalVolume
// hierarchy is applied by default. For parameterised volumes in
// the hierarchy, optimisation is -always- applied.
~G4LogicalVolume();
virtual ~G4LogicalVolume();
// Destructor. Removes the logical volume from the logical volume Store.
// NOT virtual, since not meant to act as base class.
// This class is NOT meant to act as base class, except for exceptional
// circumstances of extended types used in the kernel.
inline const G4String& GetName() const;
inline void SetName(const G4String& pName);
@@ -217,7 +221,7 @@ class G4LogicalVolume
inline G4VPhysicalVolume* GetDaughter(const G4int i) const;
// Returns the ith daughter. Note numbering starts from 0,
// and no bounds checking is performed.
inline void AddDaughter(G4VPhysicalVolume* p);
void AddDaughter(G4VPhysicalVolume* p);
// Adds the volume p as a daughter of the current logical volume.
inline G4bool IsDaughter(const G4VPhysicalVolume* p) const;
// Returns true if the volume p is a daughter of the current
@@ -226,10 +230,10 @@ class G4LogicalVolume
// Returns true if the volume p is part of the hierarchy of
// volumes established by the current logical volume. Scans
// recursively the volume tree.
inline void RemoveDaughter(const G4VPhysicalVolume* p);
void RemoveDaughter(const G4VPhysicalVolume* p);
// Removes the volume p from the List of daughter of the current
// logical volume.
inline void ClearDaughters();
void ClearDaughters();
// Clears the list of daughters. Used by the phys-volume store when
// the geometry tree is cleared, since modified at run-time.
G4int TotalVolumeEntities() const;
@@ -238,14 +242,14 @@ class G4LogicalVolume
inline EVolume CharacteriseDaughters() const;
// Characterise the daughters of this logical volume.
inline G4VSolid* GetSolid() const;
inline void SetSolid(G4VSolid *pSolid);
G4VSolid* GetSolid() const;
void SetSolid(G4VSolid *pSolid);
// Gets and sets the current solid.
inline G4Material* GetMaterial() const;
inline void SetMaterial(G4Material *pMaterial);
G4Material* GetMaterial() const;
void SetMaterial(G4Material *pMaterial);
// Gets and sets the current material.
inline void UpdateMaterial(G4Material *pMaterial);
void UpdateMaterial(G4Material *pMaterial);
// Sets material and corresponding MaterialCutsCouple.
// This method is invoked by G4Navigator while it is navigating through
// material parameterization.
@@ -264,12 +268,12 @@ class G4LogicalVolume
// method returns the mass of the present logical volume only
// (subtracted for the volume occupied by the daughter volumes).
// An optional argument to specify a material is also provided.
void ResetMass();
void ResetMass();
// Ensure that cached value of Mass is invalidated - due to change in
// state, e.g. change of size of Solid, change of type of solid,
// or the addition/deletion of a daughter volume.
inline G4FieldManager* GetFieldManager() const;
G4FieldManager* GetFieldManager() const;
// Gets current FieldManager.
void SetFieldManager(G4FieldManager *pFieldMgr, G4bool forceToAllDaughters);
// Sets FieldManager and propagates it:
@@ -278,9 +282,9 @@ class G4LogicalVolume
// ii) to all daughters
// if forceToAllDaughters=true
inline G4VSensitiveDetector* GetSensitiveDetector() const;
G4VSensitiveDetector* GetSensitiveDetector() const;
// Gets current SensitiveDetector.
inline void SetSensitiveDetector(G4VSensitiveDetector *pSDetector);
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector);
// Sets SensitiveDetector (can be 0).
inline G4UserLimits* GetUserLimits() const;
@@ -316,8 +320,8 @@ class G4LogicalVolume
inline void PropagateRegion();
// Propagates region pointer to daughters.
inline const G4MaterialCutsCouple* GetMaterialCutsCouple() const;
inline void SetMaterialCutsCouple(G4MaterialCutsCouple* cuts);
const G4MaterialCutsCouple* GetMaterialCutsCouple() const;
void SetMaterialCutsCouple(G4MaterialCutsCouple* cuts);
// Accessors for production cuts.
G4bool operator == (const G4LogicalVolume& lv) const;
@@ -344,6 +348,9 @@ class G4LogicalVolume
// persistency for clients requiring preallocation of memory for
// persistifiable objects.
virtual G4bool IsExtended() const;
// Return true if it is not a base-class object.
inline G4FieldManager* GetMasterFieldManager() const;
// Gets current FieldManager for the master thread.
inline G4VSensitiveDetector* GetMasterSensitiveDetector() const;
@@ -374,12 +381,12 @@ class G4LogicalVolume
// This method is similar to the destructor. It is used by each worker
// thread to achieve the partial effect as that of the master thread.
inline void AssignFieldManager( G4FieldManager *fldMgr);
void AssignFieldManager( G4FieldManager *fldMgr);
// Set the FieldManager - only at this level (do not push down hierarchy)
// Optimised Methods - passing thread instance of worker data
inline static G4VSolid* GetSolid(G4LVData &instLVdata) ; // const;
inline static void SetSolid(G4LVData &instLVdata, G4VSolid *pSolid);
static G4VSolid* GetSolid(G4LVData &instLVdata) ; // const;
static void SetSolid(G4LVData &instLVdata, G4VSolid *pSolid);
// Optimised Methods - passing thread instance of worker data
private:
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4LogicalVolume.icc 91010 2015-06-15 09:55:26Z gcosmo $
// $Id: G4LogicalVolume.icc 99379 2016-09-20 09:45:19Z gcosmo $
//
//
// class G4LogicalVolume Inline Implementation file
@@ -38,19 +38,6 @@
// 17.05.02 - G.Cosmo: Added IsToOptimise() method
// --------------------------------------------------------------------
// These macros change the references to fields that are now encapsulated
// in the class G4LVData.
//
#define G4MT_solid ((subInstanceManager.offset[instanceID]).fSolid)
#define G4MT_sdetector ((subInstanceManager.offset[instanceID]).fSensitiveDetector)
#define G4MT_fmanager ((subInstanceManager.offset[instanceID]).fFieldManager)
#define G4MT_material ((subInstanceManager.offset[instanceID]).fMaterial)
#define G4MT_mass ((subInstanceManager.offset[instanceID]).fMass)
#define G4MT_ccouple ((subInstanceManager.offset[instanceID]).fCutsCouple)
#define G4MT_instance (subInstanceManager.offset[instanceID])
#include "G4Threading.hh"
// ********************************************************************
// GetName
// ********************************************************************
@@ -81,23 +68,6 @@ G4int G4LogicalVolume::GetInstanceID() const
return instanceID;
}
// ********************************************************************
// GetFieldManager
// ********************************************************************
//
inline
G4FieldManager* G4LogicalVolume::GetFieldManager() const
{
return G4MT_fmanager;
}
inline void G4LogicalVolume::AssignFieldManager( G4FieldManager *fldMgr)
{
G4MT_fmanager= fldMgr;
if(G4Threading::IsMasterThread()) fFieldManager = fldMgr;
}
// ********************************************************************
// GetMasterFieldManager
// ********************************************************************
@@ -140,49 +110,6 @@ G4FastSimulationManager* G4LogicalVolume::GetFastSimulationManager () const
return fFSM;
}
// ********************************************************************
// AddDaughter
// ********************************************************************
//
inline
void G4LogicalVolume::AddDaughter(G4VPhysicalVolume* pNewDaughter)
{
if( !fDaughters.empty() && fDaughters[0]->IsReplicated() )
{
std::ostringstream message;
message << "ERROR - Attempt to place a volume in a mother volume" << G4endl
<< " already containing a replicated volume." << G4endl
<< " A volume can either contain several placements" << G4endl
<< " or a unique replica or parameterised volume !" << G4endl
<< " Mother logical volume: " << GetName() << G4endl
<< " Placing volume: " << pNewDaughter->GetName() << G4endl;
G4Exception("G4LogicalVolume::AddDaughter()", "GeomMgt0002",
FatalException, message,
"Replica or parameterised volume must be the only daughter !");
}
// Invalidate previous calculation of mass - if any - for all threads
G4MT_mass = 0.;
// SignalVolumeChange(); // fVolumeChanged= true;
fDaughters.push_back(pNewDaughter);
G4LogicalVolume* pDaughterLogical = pNewDaughter->GetLogicalVolume();
// Propagate the Field Manager, if the daughter has no field Manager.
//
G4FieldManager* pDaughterFieldManager = pDaughterLogical->GetFieldManager();
if( pDaughterFieldManager == 0 )
{
pDaughterLogical->SetFieldManager(G4MT_fmanager, false);
}
if (fRegion)
{
PropagateRegion();
fRegion->RegionModified(true);
}
}
// ********************************************************************
// IsDaughter
// ********************************************************************
@@ -198,48 +125,6 @@ G4bool G4LogicalVolume::IsDaughter(const G4VPhysicalVolume* p) const
return false;
}
// ********************************************************************
// RemoveDaughter
// ********************************************************************
//
inline
void G4LogicalVolume::RemoveDaughter(const G4VPhysicalVolume* p)
{
G4PhysicalVolumeList::iterator i;
for ( i=fDaughters.begin(); i!=fDaughters.end(); ++i )
{
if (**i==*p)
{
fDaughters.erase(i);
break;
}
}
if (fRegion)
{
fRegion->RegionModified(true);
}
G4MT_mass = 0.;
}
// ********************************************************************
// ClearDaughters
// ********************************************************************
//
inline
void G4LogicalVolume::ClearDaughters()
{
G4PhysicalVolumeList::iterator i;
for ( i=fDaughters.begin(); i!=fDaughters.end(); ++i )
{
fDaughters.erase(i);
}
if (fRegion)
{
fRegion->RegionModified(true);
}
G4MT_mass = 0.;
}
// ********************************************************************
// CharacteriseDaughters
// ********************************************************************
@@ -262,30 +147,6 @@ EVolume G4LogicalVolume::CharacteriseDaughters() const
return type;
}
inline
void G4LogicalVolume::ResetMass()
{
G4MT_mass= 0.0;
}
// ********************************************************************
// GetSolid
// ********************************************************************
//
inline
G4VSolid* G4LogicalVolume::GetSolid(G4LVData &instLVdata) // const
{
return instLVdata.fSolid;
}
inline
G4VSolid* G4LogicalVolume::GetSolid() const
{
// return G4MT_solid;
// return ((subInstanceManager.offset[instanceID]).fSolid);
return this->GetSolid( subInstanceManager.offset[instanceID] );
}
// ********************************************************************
// GetMasterSolid
// ********************************************************************
@@ -296,72 +157,6 @@ G4VSolid* G4LogicalVolume::GetMasterSolid() const
return fSolid;
}
// ********************************************************************
// SetSolid
// ********************************************************************
//
inline
void G4LogicalVolume::SetSolid(G4VSolid *pSolid)
{
// ((subInstanceManager.offset[instanceID]).fSolid) = pSolid;
G4MT_solid=pSolid;
// G4MT_mass = 0.;
this->ResetMass();
}
inline
void G4LogicalVolume::SetSolid(G4LVData &instLVdata, G4VSolid *pSolid)
{
instLVdata.fSolid = pSolid;
// G4MT_solid=pSolid;
instLVdata.fMass= 0;
// A fast way to reset the mass ... ie G4MT_mass = 0.;
}
// ********************************************************************
// GetMaterial
// ********************************************************************
//
inline
G4Material* G4LogicalVolume::GetMaterial() const
{
return G4MT_material;
}
// ********************************************************************
// SetMaterial
// ********************************************************************
//
inline
void G4LogicalVolume::SetMaterial(G4Material *pMaterial)
{
G4MT_material=pMaterial;
G4MT_mass = 0.;
}
// ********************************************************************
// UpdateMaterial
// ********************************************************************
//
inline
void G4LogicalVolume::UpdateMaterial(G4Material *pMaterial)
{
G4MT_material=pMaterial;
if(fRegion) { G4MT_ccouple = fRegion->FindCouple(pMaterial); }
G4MT_mass = 0.;
}
// ********************************************************************
// GetSensitiveDetector
// ********************************************************************
//
inline
G4VSensitiveDetector* G4LogicalVolume::GetSensitiveDetector() const
{
return G4MT_sdetector;
}
// ********************************************************************
// GetMasterSensitiveDetector
// ********************************************************************
@@ -372,17 +167,6 @@ G4VSensitiveDetector* G4LogicalVolume::GetMasterSensitiveDetector() const
return fSensitiveDetector;
}
// ********************************************************************
// SetSensitiveDetector
// ********************************************************************
//
inline
void G4LogicalVolume::SetSensitiveDetector(G4VSensitiveDetector* pSDetector)
{
G4MT_sdetector = pSDetector;
if(G4Threading::IsMasterThread()) fSensitiveDetector = pSDetector;
}
// ********************************************************************
// GetUserLimits
// ********************************************************************
@@ -527,26 +311,6 @@ void G4LogicalVolume::PropagateRegion()
fRegion->ScanVolumeTree(this, true);
}
// ********************************************************************
// GetMaterialCutsCouple
// ********************************************************************
//
inline
const G4MaterialCutsCouple* G4LogicalVolume::GetMaterialCutsCouple() const
{
return G4MT_ccouple;
}
// ********************************************************************
// SetMaterialCutsCouple
// ********************************************************************
//
inline
void G4LogicalVolume::SetMaterialCutsCouple(G4MaterialCutsCouple* cuts)
{
G4MT_ccouple = cuts;
}
// ********************************************************************
// Lock
// ********************************************************************
@@ -606,10 +370,3 @@ G4double G4LogicalVolume::GetBiasWeight() const
{
return fBiasWeight;
}
#undef G4MT_solid
#undef G4MT_sdetector
#undef G4MT_fmanager
#undef G4MT_material
// #undef G4MT_mass
// #undef G4MT_ccouple
#undef G4MT_instance
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ReflectedSolid.hh 96930 2016-05-18 08:56:58Z gcosmo $
// $Id: G4ReflectedSolid.hh 100906 2016-11-03 09:59:32Z gcosmo $
//
//
// class G4ReflectedSolid
@@ -63,6 +63,8 @@ class G4ReflectedSolid : public G4VSolid
EInside Inside( const G4ThreeVector& p ) const;
void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
G4bool CalculateExtent( const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,
+5 -11
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4Region.hh 67975 2013-03-13 10:19:44Z gcosmo $
// $Id: G4Region.hh 99379 2016-09-20 09:45:19Z gcosmo $
//
// class G4Region
//
@@ -96,12 +96,6 @@ class G4RegionData
//
typedef G4GeomSplitter<G4RegionData> G4RegionManager;
// These macros changes the references to fields that are now encapsulated
// in the class G4RegionData.
//
#define G4MT_fsmanager ((subInstanceManager.offset[instanceID]).fFastSimulationManager)
#define G4MT_rsaction ((subInstanceManager.offset[instanceID]).fRegionalSteppingAction)
class G4Region
{
typedef std::vector<G4LogicalVolume*> G4RootLVList;
@@ -177,8 +171,8 @@ class G4Region
// Find a G4MaterialCutsCouple which corresponds to the material
// in this region.
inline void SetFastSimulationManager(G4FastSimulationManager* fsm);
inline G4FastSimulationManager* GetFastSimulationManager() const;
void SetFastSimulationManager(G4FastSimulationManager* fsm);
G4FastSimulationManager* GetFastSimulationManager() const;
// Set and Get methods for G4FastSimulationManager.
// The root logical volume that has the region with G4FastSimulationManager
// becomes an envelope of fast simulation.
@@ -215,8 +209,8 @@ class G4Region
// Flag 'unique' is true if there is only one parent region containing
// the current region.
inline void SetRegionalSteppingAction(G4UserSteppingAction* rusa);
inline G4UserSteppingAction* GetRegionalSteppingAction() const;
void SetRegionalSteppingAction(G4UserSteppingAction* rusa);
G4UserSteppingAction* GetRegionalSteppingAction() const;
// Set/Get method of the regional user stepping action
public: // without description
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4Region.icc 67975 2013-03-13 10:19:44Z gcosmo $
// $Id: G4Region.icc 99379 2016-09-20 09:45:19Z gcosmo $
//
//
// class G4Region Inline Implementation file
@@ -237,26 +237,6 @@ G4MaterialCutsCouple* G4Region::FindCouple(G4Material* mat)
return couple;
}
// ********************************************************************
// SetFastSimulationManager
// ********************************************************************
//
inline
void G4Region::SetFastSimulationManager(G4FastSimulationManager* fsm)
{
G4MT_fsmanager = fsm;
}
// ********************************************************************
// GetFastSimulationManager
// ********************************************************************
//
inline
G4FastSimulationManager* G4Region::GetFastSimulationManager() const
{
return G4MT_fsmanager;
}
// ********************************************************************
// GetFieldManager
// ********************************************************************
@@ -303,26 +283,6 @@ void G4Region::AddMaterial(G4Material* aMaterial)
}
}
// ********************************************************************
// SetRegionalSteppingAction
// ********************************************************************
//
inline
void G4Region::SetRegionalSteppingAction(G4UserSteppingAction* rusa)
{
G4MT_rsaction = rusa;
}
// ********************************************************************
// GetRegionalSteppingAction
// ********************************************************************
//
inline
G4UserSteppingAction* G4Region::GetRegionalSteppingAction() const
{
return G4MT_rsaction;
}
// ********************************************************************
// UsedInMassGeometry
// ********************************************************************
@@ -176,10 +176,6 @@ class G4USolid : public G4VSolid
return fShape;
}
protected:
G4ThreeVectorList* CreateRotatedVertices(const G4AffineTransform& pT) const;
protected: // data
VUSolid* fShape;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VPhysicalVolume.hh 93287 2015-10-15 09:50:22Z gcosmo $
// $Id: G4VPhysicalVolume.hh 99379 2016-09-20 09:45:19Z gcosmo $
//
//
// class G4VPhysicalVolume
@@ -115,26 +115,26 @@ class G4VPhysicalVolume
// (They are the inverse of each other).
G4RotationMatrix* GetObjectRotation() const; // Obsolete
inline G4RotationMatrix GetObjectRotationValue() const; // Replacement
inline G4ThreeVector GetObjectTranslation() const;
G4RotationMatrix GetObjectRotationValue() const; // Replacement
G4ThreeVector GetObjectTranslation() const;
// Return the rotation/translation of the Object relative to the mother.
inline const G4RotationMatrix* GetFrameRotation() const;
inline G4ThreeVector GetFrameTranslation() const;
const G4RotationMatrix* GetFrameRotation() const;
G4ThreeVector GetFrameTranslation() const;
// Return the rotation/translation of the Frame used to position
// this volume in its mother volume (opposite of object rot/trans).
// Older access functions, that do not distinguish between frame/object!
inline const G4ThreeVector& GetTranslation() const;
inline const G4RotationMatrix* GetRotation() const;
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
inline void SetTranslation(const G4ThreeVector &v);
inline G4RotationMatrix* GetRotation();
inline void SetRotation(G4RotationMatrix*);
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.
@@ -24,21 +24,13 @@
// ********************************************************************
//
//
// $Id: G4VPhysicalVolume.icc 74466 2013-10-07 15:36:32Z gcosmo $
// $Id: G4VPhysicalVolume.icc 99379 2016-09-20 09:45:19Z gcosmo $
//
//
// class G4VPhysicalVolume Inline Implementation
//
// --------------------------------------------------------------------
// These macros change the references to fields that are now encapsulated
// in the class G4PVData.
//
#define G4MT_rot ((subInstanceManager.offset[instanceID]).frot)
#define G4MT_trans ((subInstanceManager.offset[instanceID]).ftrans)
#define G4MT_pvdata (subInstanceManager.offset[instanceID])
inline
G4bool G4VPhysicalVolume::operator == (const G4VPhysicalVolume& right) const
{
@@ -51,37 +43,6 @@ G4int G4VPhysicalVolume::GetInstanceID() const
return instanceID;
}
inline
const G4ThreeVector& G4VPhysicalVolume::GetTranslation() const
{
return G4MT_trans;
}
inline
void G4VPhysicalVolume::SetTranslation(const G4ThreeVector &vec)
{
G4MT_trans=vec;
}
inline
const G4RotationMatrix* G4VPhysicalVolume::GetRotation() const
{
return G4MT_rot;
}
inline
G4RotationMatrix* G4VPhysicalVolume::GetRotation()
{
return G4MT_rot;
}
inline
void G4VPhysicalVolume::SetRotation(G4RotationMatrix *pRot)
{
G4MT_rot=pRot;
}
inline
G4LogicalVolume* G4VPhysicalVolume::GetLogicalVolume() const
{
@@ -137,37 +98,3 @@ EVolume G4VPhysicalVolume::VolumeType() const
}
return type;
}
inline
G4RotationMatrix G4VPhysicalVolume::GetObjectRotationValue() const
{
G4RotationMatrix aRotM; // Initialised to identity
// Insure against G4MT_rot being a null pointer
if(G4MT_rot)
{
aRotM= G4MT_rot->inverse();
}
return aRotM;
}
inline
G4ThreeVector G4VPhysicalVolume::GetObjectTranslation() const
{
return G4MT_trans;
}
inline
const G4RotationMatrix* G4VPhysicalVolume::GetFrameRotation() const
{
return G4MT_rot;
}
inline
G4ThreeVector G4VPhysicalVolume::GetFrameTranslation() const
{
return -G4MT_trans;
}
#undef G4MT_rot
#undef G4MT_trans
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VSolid.hh 92695 2015-09-14 08:49:44Z gcosmo $
// $Id: G4VSolid.hh 100906 2016-11-03 09:59:32Z gcosmo $
//
//
// class G4VSolid
@@ -108,6 +108,9 @@ class G4VSolid
inline G4double GetTolerance() const;
// Returns the cached geometrical tolerance.
virtual void Extent(G4ThreeVector& pMin, G4ThreeVector& pMax) const;
// Returns the bounding box of the solid.
virtual G4bool CalculateExtent(const EAxis pAxis,
const G4VoxelLimits& pVoxelLimit,
const G4AffineTransform& pTransform,