Import Geant4 3.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:03:00 +02:00
parent cfcb558cfe
commit 137e303ecc
2843 changed files with 37082 additions and 38426 deletions
+18 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.15 2000/11/20 17:31:33 gcosmo Exp $
$Id: History,v 1.19 2001/03/08 13:21:11 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,23 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
March 07, 2001 G. Cosmo geommng-V03-00-01
- G4PVPlacement.hh: corrected comments to constructor with G4RotationMatrix*
as argument, to correspond to specifications in the User's Manual.
- G4AssemblyVolume.cc: corrected comments about unique PV identifiers
(by R.Chytracek).
February 07, 2001 G. Cosmo geommng-V03-00-00
- Introduced first implementation of G4AssemblyVolume, a helper class to
combine several volumes together in an arbitrary way in the 3D space.
Added files: G4AssemblyVolume[.hh.icc.cc], G4AssemblyTriplet[.hh.icc]
(by R.Chytracek).
- Added unit test suite for G4AssemblyVolume class: TestAssemblyVolume
(by R.Chytracek).
December 04, 2000 G. Cosmo
- Minor fix to private assignment operator.
November 20, 2000 G. Cosmo geommng-V02-00-04
- Fixes to remove warnings from "-Wall -ansi -pedantic" g++ compiler options:
o commented out variables declared and not used.
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4AffineTransform.hh,v 1.3 2000/04/20 16:49:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// class G4AffineTransform
@@ -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-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// G4AffineTransformation Inline implementation
@@ -0,0 +1,90 @@
// 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: G4AssemblyTriplet.hh,v 1.4 2001/02/07 17:30:57 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Class G4AssemblyTriplet
//
// Class description:
//
// A class to help place logical volumes inside a generic containers (like
// STL vector ) together with information about its rotation and placement.
// How to interpret the rotation and translation depends on the class which
// uses a container of these triplets. The first class using G4AssemblyTriplet
// is G4AssemblyVolume class.
// The pointer to the logical volume is copied so this class does not take
// its ownership and does not delete the object behind.
// Author: Radovan Chytracek
// Version: 1.0
// Date: November 2000
// ----------------------------------------------------------------------
#ifndef G4_ASSEMBLYTRIPLET_H
#define G4_ASSEMBLYTRIPLET_H
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4RotationMatrix.hh"
class G4AssemblyTriplet
{
public: // with description
G4AssemblyTriplet();
// Default constructor
G4AssemblyTriplet( G4LogicalVolume* pVolume,
G4ThreeVector& translation,
G4RotationMatrix* pRotation);
// An explicit constructor
G4AssemblyTriplet( const G4AssemblyTriplet& second );
// Copy constructor
~G4AssemblyTriplet();
// Destructor
G4AssemblyTriplet& operator=( const G4AssemblyTriplet& second );
// Assignment operator
G4LogicalVolume* GetVolume() const;
// Retrieve the logical volume reference
void SetVolume( G4LogicalVolume* pVolume );
// Update the logical volume reference
G4ThreeVector GetTranslation() const;
// Retrieve the logical volume translation
void SetTranslation( G4ThreeVector& pVolume );
// Update the logical volume translation
G4RotationMatrix* GetRotation() const;
// Retrieve the logical volume rotation
void SetRotation( G4RotationMatrix* pVolume );
// Update the logical volume rotation
private:
G4LogicalVolume* fVolume;
// A logical volume
G4ThreeVector fTranslation;
// A logical volume translation
G4RotationMatrix* fRotation;
// A logical volume rotation
};
#include "G4AssemblyTriplet.icc"
#endif // G4_ASSEMBLYTRIPLET_H
@@ -0,0 +1,93 @@
// 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: G4AssemblyTriplet.icc,v 1.4 2001/02/07 17:30:57 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Class G4AssemblyTriplet - inline implementation
//
// ----------------------------------------------------------------------
inline
G4AssemblyTriplet::G4AssemblyTriplet()
: fVolume( 0 ), fRotation( 0 )
{
G4ThreeVector v(0.,0.,0.);
fTranslation = v;
}
inline
G4AssemblyTriplet::G4AssemblyTriplet( G4LogicalVolume* pVolume,
G4ThreeVector& translation,
G4RotationMatrix* pRotation )
: fVolume( pVolume ), fTranslation( translation ), fRotation( pRotation )
{
}
inline
G4AssemblyTriplet::G4AssemblyTriplet( const G4AssemblyTriplet& second )
{
fVolume = second.GetVolume();
fRotation = second.GetRotation();
fTranslation = second.GetTranslation();
}
inline
G4AssemblyTriplet::~G4AssemblyTriplet()
{
}
inline
G4LogicalVolume* G4AssemblyTriplet::GetVolume() const
{
return fVolume;
}
inline
void G4AssemblyTriplet::SetVolume( G4LogicalVolume* pVolume )
{
fVolume = pVolume;
}
inline
G4ThreeVector G4AssemblyTriplet::GetTranslation() const
{
return fTranslation;
}
inline
void G4AssemblyTriplet::SetTranslation( G4ThreeVector& translation )
{
fTranslation = translation;
}
inline
G4RotationMatrix* G4AssemblyTriplet::GetRotation() const
{
return fRotation;
}
inline
void G4AssemblyTriplet::SetRotation( G4RotationMatrix* pRotation )
{
fRotation = pRotation;
}
inline
G4AssemblyTriplet&
G4AssemblyTriplet::operator=( const G4AssemblyTriplet& second )
{
if( this != &second )
{
fVolume = second.GetVolume();
fRotation = second.GetRotation();
fTranslation = second.GetTranslation();
}
return *this;
}
@@ -0,0 +1,148 @@
// 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: G4AssemblyVolume.hh,v 1.4 2001/02/07 17:30:57 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Class G4AssemblyVolume
//
// Class description:
//
// G4AssemblyVolume is a helper class to make the build process of geometry
// easier. It allows to combine several volumes together in an arbitrary way
// in 3D space and then work with the result as with a single logical volume
// for placement.
// The resulting objects are independent copies of each of the assembled
// logical volumes. The placements are not, however, bound one to each other
// when placement is done. They are seen as independent physical volumes in
// space. This is the main difference when compared to the boolean solids or
// parametrised physical volumes.
// Author: Radovan Chytracek, John Apostolakis, Gabriele Cosmo
// Version: 1.0
// Date: November 2000
// ----------------------------------------------------------------------
#ifndef G4_ASSEMBLYVOLUME_H
#define G4_ASSEMBLYVOLUME_H
#include "g4std/vector"
#include "G4Transform3D.hh"
#include "G4AssemblyTriplet.hh"
class G4VPhysicalVolume;
class G4AssemblyVolume
{
public: // with description
G4AssemblyVolume();
G4AssemblyVolume( G4LogicalVolume* volume,
G4ThreeVector& translation,
G4RotationMatrix* rotation);
~G4AssemblyVolume();
//
// Constructors & destructor.
// At destruction all the generated physical volumes and associated
// rotation matrices of the imprints will be destroyed.
void AddPlacedVolume( G4LogicalVolume* pPlacedVolume,
G4ThreeVector& translation,
G4RotationMatrix* rotation);
//
// Place the given volume 'pPlacedVolume' inside the assembly.
//
// The taken approach:
//
// - Place it w.r.t. the assembly coordinate system.
// This step is applied to each of the participating volumes.
//
// The other possible approaches:
//
// - Place w.r.t. the firstly added volume.
// When placed the first, the virtual coordinate system becomes
// the coordinate system of the first one.
// Every next volume being added into the assembly will be placed
// w.r.t to the first one.
//
// - Place w.r.t the last placed volume.
// When placed the first, the virtual coordinate system becomes
// the coordinate system of the first one.
// Every next volume being added into the assembly will be placed
// w.r.t to the previous one.
void AddPlacedVolume( G4LogicalVolume* pPlacedVolume,
G4Transform3D& transformation);
//
// The same as previous but takes complete 3D transformation in space
// as its argument.
void MakeImprint( G4LogicalVolume* pMotherLV,
G4ThreeVector& translationInMother,
G4RotationMatrix* pRotationInMother);
//
// Creates instance of an assembly volume inside the given mother volume.
void MakeImprint( G4LogicalVolume* pMotherLV,
G4Transform3D& transformation);
//
// The same as previous but takes complete 3D transformation in space
// as its argument.
private:
G4std::vector<G4AssemblyTriplet> fTriplets;
//
// Participating volumes represented as a vector of
// <logical volume, translation, rotation>.
G4std::vector<G4VPhysicalVolume*> fPVStore;
//
// We need to keep list of physical volumes created by MakeImprint() method
// in order to be able to cleanup the objects when not needed anymore.
// This requires the user to keep assembly objects in memory during the
// whole job or during the life-time of G4Navigator, log. vol store
// and phys. vol. store may keep pointers to physical volumes generated by
// the assembly volume.
// When an assembly object is about to die it will destroy all its
// generated physical volumes and rotation matrices as well !
// This may affect validity of detector contruction !
protected:
unsigned int GetImprintsCount() const;
void SetImprintsCount( unsigned int value );
void ImprintsCountPlus();
void ImprintsCountMinus();
//
// Internal counting mechanism, used to compute unique the names of
// phys. volumes created by MakeImprint(...) method(s).
private:
unsigned int fImprintsCounter;
//
// Number of imprints of the given assembly volume.
protected:
unsigned int GetInstanceCount() const;
void SetInstanceCount( unsigned int value );
void InstanceCountPlus();
void InstanceCountMinus();
private:
static unsigned int fsInstanceCounter;
};
#include "G4AssemblyVolume.icc"
#endif // G4_ASSEMBLYVOLUME_H
@@ -0,0 +1,39 @@
// 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: G4AssemblyVolume.icc,v 1.2 2001/02/07 17:30:57 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Class G4AssemblyVolume - inline implementation
//
// ----------------------------------------------------------------------
inline
unsigned int G4AssemblyVolume::GetImprintsCount() const
{
return fImprintsCounter;
}
inline
void G4AssemblyVolume::SetImprintsCount( unsigned int value )
{
fImprintsCounter = value;
}
inline
void G4AssemblyVolume::ImprintsCountPlus()
{
fImprintsCounter++;
}
inline
void G4AssemblyVolume::ImprintsCountMinus()
{
fImprintsCounter--;
}
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4DrawVoxels.hh,v 1.9 2000/06/06 13:18:55 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// class G4DrawVoxels
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4GeometryManager.hh,v 1.3 2000/04/20 16:49:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// class G4GeometryManager
//
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LogicalSurface.hh,v 1.4 2000/11/01 15:39:32 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4LogicalSurface.hh,v 1.5 2000/12/04 09:36:31 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
////////////////////////////////////////////////////////////////////////
// Class G4LogicalSurface
@@ -92,17 +92,13 @@ class G4LogicalSurface
public:
virtual ~G4LogicalSurface();
private:
G4LogicalSurface(const G4LogicalSurface &right); // Copying restricted
//////////////
// Operators
//////////////
public:
G4int operator==(const G4LogicalSurface &right) const;
G4int operator!=(const G4LogicalSurface &right) const;
private:
G4LogicalSurface(const G4LogicalSurface &right); // Copying restricted
const G4LogicalSurface& operator=(const G4LogicalSurface& right);
// ------------------
@@ -110,6 +106,7 @@ class G4LogicalSurface
// ------------------
private:
G4String theName; // Surface name
G4OpticalSurface* theOpticalSurface;
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4LogicalSurface.icc,v 1.3 2000/04/20 16:49:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4LogicalSurface.icc,v 1.4 2000/12/04 09:36:31 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
////////////////////////////////////////////////////////////////////////
// Surface Class Inline Methods
@@ -69,7 +69,12 @@ G4LogicalSurface::SetTransitionRadiationSurface(G4TransitionRadiationSurface*
inline const G4LogicalSurface &
G4LogicalSurface::operator=(const G4LogicalSurface &right)
{
return right;
if (&right == this) return *this;
theName = right.theName;
theOpticalSurface = right.theOpticalSurface;
theTransRadSurface = right.theTransRadSurface;
return *this;
}
inline G4int
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4LogicalVolume.hh,v 1.6 2000/11/01 15:39:32 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// class G4LogicalVolume
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4LogicalVolume.icc,v 1.4 2000/11/01 15:39:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// class G4LogicalVolume Inline Implementation file
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4LogicalVolumeStore.hh,v 1.4 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// class G4LogicalVolumeStore
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4PVParameterised.hh,v 1.4 2000/11/01 15:39:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// class G4PVParameterised
@@ -5,8 +5,8 @@
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: G4PVPlacement.hh,v 1.4 2000/11/01 15:39:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// $Id: G4PVPlacement.hh,v 1.5 2001/03/07 17:34:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// class G4PVPlacement
@@ -42,9 +42,8 @@ class G4PVPlacement : public G4VPhysicalVolume
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.
// *pRot and traslated by tlate, relative to the coordinate system of the
// mother volume pMother.
// 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)
@@ -63,12 +62,12 @@ class G4PVPlacement : public G4VPhysicalVolume
// 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
// 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.
// 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. ]
// of moving objects in a given reference frame. ]
// All other arguments are the same as for the previous constructor.
G4PVPlacement(G4RotationMatrix *pRot,
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4PVReplica.hh,v 1.4 2000/11/01 15:39:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// class G4PVReplica
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4PhysicalVolumeStore.hh,v 1.5 2000/11/01 15:39:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// class G4PhysicalVolume
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4SmartVoxelHeader.hh,v 1.4 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// class G4SmartVoxelHeader
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4SmartVoxelHeader.icc,v 1.1 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// G4SmartVoxelHeader Inline implementation
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4SmartVoxelNode.hh,v 1.4 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// class G4SmartVoxelNode
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4SmartVoxelNode.icc,v 1.1 2000/04/20 16:49:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// G4SmartVoxelNode Inline implementation
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4SmartVoxelProxy.hh,v 1.4 2000/11/20 17:31:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// class G4SmartVoxelProxy
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4SmartVoxelProxy.icc,v 1.1 2000/04/20 16:49:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// G4SmartVoxelProxy Inline implementation
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4SolidStore.hh,v 1.4 2000/04/20 16:49:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// class G4SolidStore
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4VPVParameterisation.hh,v 1.3 2000/04/20 16:49:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// class G4VPVParamterisation
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4VPhysicalVolume.hh,v 1.5 2000/11/01 15:39:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// class G4VPhysicalVolume
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4VPhysicalVolume.icc,v 1.4 2000/11/01 15:39:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// class G4VPhysicalVolume Inline Implementation
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4VSolid.hh,v 1.7 2000/11/01 15:39:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// class G4VSolid
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4VSolid.icc,v 1.4 2000/11/01 15:39:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// G4VSolid Inline implementation
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4VTouchable.hh,v 1.4 2000/11/01 15:39:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// class G4VTouchable
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4VTouchable.icc,v 1.4 2000/11/01 15:39:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// class G4VTouchable Inline implementation
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4VoxelLimits.hh,v 1.4 2000/04/20 16:49:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// class G4VoxelLimits
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4VoxelLimits.icc,v 1.1 2000/04/20 16:49:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// G4VoxelLimits Inline implementation
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: meshdefs.hh,v 1.3 2000/04/20 16:49:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Tube/Cone Meshing constants for extent calculations
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: voxeldefs.hh,v 1.4 2000/04/20 16:49:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
//
@@ -0,0 +1,239 @@
// 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: G4AssemblyVolume.cc,v 1.5 2001/02/08 12:33:56 radoone Exp $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// Class G4AssemblyVolume - implementation
//
// ----------------------------------------------------------------------
#include "G4PVPlacement.hh"
#include "G4RotationMatrix.hh"
#include "G4Transform3D.hh"
#include "G4AffineTransform.hh"
#include "G4AssemblyVolume.hh"
#include "g4std/strstream"
unsigned int G4AssemblyVolume::fsInstanceCounter = 0;
// Default constructor
//
G4AssemblyVolume::G4AssemblyVolume()
{
InstanceCountPlus();
SetImprintsCount( 0 );
}
// Destructor
//
G4AssemblyVolume::~G4AssemblyVolume()
{
fTriplets.clear();
unsigned int howmany = fPVStore.size();
if( howmany != 0 )
{
for( unsigned int i = 0; i < howmany; i++ )
{
G4RotationMatrix* pRotToClean = fPVStore[i]->GetRotation();
if( pRotToClean != 0 ) delete pRotToClean;
delete fPVStore[i];
}
}
fPVStore.clear();
InstanceCountMinus();
}
// Add and place the given volume according to the specified
// translation and rotation.
//
void G4AssemblyVolume::AddPlacedVolume( G4LogicalVolume* pVolume,
G4ThreeVector& translation,
G4RotationMatrix* pRotation )
{
G4AssemblyTriplet toAdd( pVolume, translation, pRotation );
fTriplets.push_back( toAdd );
}
// Add and place the given volume according to the specified transformation
//
void G4AssemblyVolume::AddPlacedVolume( G4LogicalVolume* pVolume,
G4Transform3D& transformation )
{
G4ThreeVector v = transformation.getTranslation();
G4RotationMatrix r = transformation.getRotation();
G4AssemblyTriplet toAdd( pVolume, v, &r );
fTriplets.push_back( toAdd );
}
/**
* Create an instance of an assembly volume inside of the specified
* mother volume. This works analogically to making stamp imprints.
* This method makes use of the Geant4 affine transformation class.
* The algorithm is defined as follows:
*
* Having rotation matrix Rm and translation vector Tm to be applied
* inside the mother and rotation matrix Ra and translation vector Ta
* to be applied inside the assembly itself for each of the participating
* volumes the resulting transformation is
*
* Tfinal = Ta * Tm
*
* where Ta and Tm are constructed as
*
* -1 -1
* Ta = Ra * Ta and Tm = Rm * Tm
*
* which in words means that we create first the affine transformations
* by inverse rotation matrices and translations for mother and assembly.
* The resulting final transformation to be applied to each of the
* participating volumes is their product.
* IMPORTANT NOTE!
* The order of multiplication is reversed when comparing to CLHEP 3D
* transformation matrix(G4Transform3D class).
*/
void G4AssemblyVolume::MakeImprint( G4LogicalVolume* pMotherLV,
G4ThreeVector& translationInMother,
G4RotationMatrix* pRotationInMother )
{
unsigned int numberOfDaughters = pMotherLV->GetNoDaughters();
// We start from the first available index
numberOfDaughters++;
ImprintsCountPlus();
for( unsigned int i = 0; i < fTriplets.size(); i++ )
{
// Generate the unique name for the next PV instance
// The name has format:
//
// av_WWW_impr_XXX_YYY_ZZZ
// where the fields mean:
// WWW - assembly volume instance number
// XXX - assembly volume imprint number
// YYY - the name of a log. volume we want to make a placement of
// ZZZ - the log. volume index inside the assembly volume
G4std::strstream pvName;
pvName << "av_"
<< GetInstanceCount()
<< "_impr_"
<< GetImprintsCount()
<< "_"
<< fTriplets[i].GetVolume()->GetName().c_str()
<< "_pv_"
<< i
<< G4std::ends;
// Create the transformation in this assembly volume
G4AffineTransform Ta( fTriplets[i].GetRotation()->inverse(),
fTriplets[i].GetTranslation() );
// Create the transformation in a mother volume
G4AffineTransform Tm( pRotationInMother->inverse(),
translationInMother );
// Combine them together
G4AffineTransform Tfinal = Ta * Tm;
// Extract the final absolute transformation inside a mother
G4RotationMatrix* pFinalRotation = new G4RotationMatrix(
Tfinal.NetRotation()
);
G4ThreeVector finalTranslation = Tfinal.NetTranslation();
// Generate a new physical volume instance inside a mother
G4VPhysicalVolume* pPlaced = new G4PVPlacement(
pFinalRotation
,finalTranslation
,fTriplets[i].GetVolume()
,pvName.str()
,pMotherLV
,false
,numberOfDaughters + i
);
// Register the physical volume created by us so we can delete it later
fPVStore.push_back( pPlaced );
}
}
void G4AssemblyVolume::MakeImprint( G4LogicalVolume* pMotherLV,
G4Transform3D& transformation )
{
unsigned int numberOfDaughters = pMotherLV->GetNoDaughters();
// We start from the first available index
numberOfDaughters++;
for( unsigned int i = 0; i < fTriplets.size(); i++ )
{
// Generate the unique name for the next PV instance
// The name has format:
//
// av_WWW_impr_XXX_YYY_ZZZ
// where the fields mean:
// WWW - assembly volume instance number
// XXX - assembly volume imprint number
// YYY - the name of a log. volume we want to make a placement of
// ZZZ - the log. volume index inside the assembly volume
G4std::strstream pvName;
pvName << "av_"
<< GetInstanceCount()
<< "_impr_"
<< GetImprintsCount()
<< "_"
<< fTriplets[i].GetVolume()->GetName().c_str()
<< "_pv_"
<< i
<< G4std::ends;
G4Transform3D Ta( *(fTriplets[i].GetRotation()),
fTriplets[i].GetTranslation()
);
G4Transform3D Tfinal = transformation * Ta;
// G4RotationMatrix* pFinalRotation =
// new G4RotationMatrix( Tfinal.getRotation().inverse() );
// G4ThreeVector finalTranslation = Tfinal.getTranslation();
// Generate a new physical volume instance inside a mother
G4VPhysicalVolume* pPlaced = new G4PVPlacement( Tfinal,
fTriplets[i].GetVolume(),
pvName.str(),
pMotherLV,
false,
numberOfDaughters + i );
// Register the physical volume created by us so we can delete it later
fPVStore.push_back( pPlaced );
}
}
unsigned int G4AssemblyVolume::GetInstanceCount() const
{
return G4AssemblyVolume::fsInstanceCounter;
}
void G4AssemblyVolume::SetInstanceCount( unsigned int value )
{
G4AssemblyVolume::fsInstanceCounter = value;
}
void G4AssemblyVolume::InstanceCountPlus()
{
G4AssemblyVolume::fsInstanceCounter++;
}
void G4AssemblyVolume::InstanceCountMinus()
{
G4AssemblyVolume::fsInstanceCounter--;
}
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4DrawVoxels.cc,v 1.12 2000/11/20 17:31:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// class G4DrawVoxels
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4GeometryManager.cc,v 1.2 1999/12/15 14:49:52 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// class G4GeometryManager
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4LogicalVolume.cc,v 1.5 2000/11/20 17:31:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// class G4LogicalVolume Implementation
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4LogicalVolumeStore.cc,v 1.4 1999/12/15 14:49:52 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// G4LogicalVolumeStore
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4PVParameterised.cc,v 1.3 2000/11/01 15:39:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// class G4PVParameterised
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4PVPlacement.cc,v 1.3 2000/11/20 17:31:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// class G4PVPlacement Implementation
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4PVReplica.cc,v 1.2 1999/12/15 14:49:53 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// class G4PVReplica Implementation
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4PhysicalVolumeStore.cc,v 1.5 2000/11/01 15:39:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// G4PhysicalVolumeStore
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4SmartVoxelHeader.cc,v 1.7 2000/11/20 17:31:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// class G4SmartVoxelHeader
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4SmartVoxelNode.cc,v 1.2 1999/12/15 14:49:53 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// Class G4SmartVoxelNode
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4SolidStore.cc,v 1.5 2000/09/11 11:09:57 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// G4SolidStore
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4VPVParameterisation.cc,v 1.2 1999/12/15 14:49:54 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// Default implementations for Parameterisations that do not
// parameterise solid and/or material
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4VPhysicalVolume.cc,v 1.3 1999/12/15 14:49:54 gunter Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
//
// class G4VPhysicalVolume Implementation
+1 -1
View File
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4VSolid.cc,v 1.6 2000/11/16 14:29:23 grichine Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// class G4VSolid
//
@@ -6,7 +6,7 @@
// and all its terms.
//
// $Id: G4VoxelLimits.cc,v 1.3 2000/11/01 15:39:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// GEANT4 tag $Name: geant4-03-01 $
//
// class G4VoxelLimits
//