Import Geant4 7.0.0 source tree
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4BlockingList.cc,v 1.2 2003/11/02 14:01:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// class G4BlockingList Implementation
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4GeometryManager.cc,v 1.15 2003/11/02 14:01:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
// class G4GeometryManager
|
||||
//
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4IdentityTrajectoryFilter.cc,v 1.2 2003/11/02 14:01:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4LogicalVolume.cc,v 1.18 2003/11/02 14:01:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4LogicalVolume.cc,v 1.22 2004/11/15 14:15:21 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// class G4LogicalVolume Implementation
|
||||
@@ -37,6 +37,11 @@
|
||||
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4VPVParameterisation.hh"
|
||||
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
// ********************************************************************
|
||||
// Constructor - sets member data and adds to logical Store,
|
||||
@@ -53,7 +58,7 @@ G4LogicalVolume::G4LogicalVolume( G4VSolid* pSolid,
|
||||
G4bool optimise )
|
||||
: fDaughters(0,(G4VPhysicalVolume*)0), fFieldManager(pFieldMgr),
|
||||
fVoxel(0), fOptimise(optimise), fRootRegion(false), fSmartless(2.),
|
||||
fVisAttributes(0), fFastSimulationManager(0), fRegion(0),
|
||||
fMass(0.), fVisAttributes(0), fFastSimulationManager(0), fRegion(0),
|
||||
fCutsCouple(0), fIsEnvelope(false)
|
||||
{
|
||||
SetSolid(pSolid);
|
||||
@@ -227,3 +232,115 @@ G4LogicalVolume::FindMotherLogicalVolumeForEnvelope()
|
||||
}
|
||||
return motherLogVol;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// TotalVolumeEntities
|
||||
//
|
||||
// Returns the total number of physical volumes (replicated or placed)
|
||||
// in the tree represented by the current logical volume.
|
||||
// ********************************************************************
|
||||
//
|
||||
G4int G4LogicalVolume::TotalVolumeEntities() const
|
||||
{
|
||||
static G4int vols = 0;
|
||||
|
||||
vols++;
|
||||
for (G4PhysicalVolumeList::const_iterator itDau = fDaughters.begin();
|
||||
itDau != fDaughters.end(); itDau++)
|
||||
{
|
||||
G4VPhysicalVolume* physDaughter = (*itDau);
|
||||
for (G4int i=0; i<physDaughter->GetMultiplicity(); i++)
|
||||
{
|
||||
physDaughter->GetLogicalVolume()->TotalVolumeEntities();
|
||||
}
|
||||
}
|
||||
return vols;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// GetMass
|
||||
//
|
||||
// Returns the mass of the logical volume tree computed from the
|
||||
// estimated geometrical volume of each solid and material associated
|
||||
// to the logical volume and its daughters.
|
||||
// NOTE: the computation may require considerable amount of time,
|
||||
// depending from the complexity of the geometry tree.
|
||||
// The returned value is cached and can be used for successive
|
||||
// calls (default), unless recomputation is forced by providing
|
||||
// 'true' for the boolean argument in input. Computation should
|
||||
// be forced if the geometry setup has changed after the previous
|
||||
// call. The extra argument 'parMaterial' is internally used to
|
||||
// consider cases of geometrical parameterisations by material.
|
||||
// ********************************************************************
|
||||
//
|
||||
G4double G4LogicalVolume::GetMass(G4bool forced, G4Material* parMaterial)
|
||||
{
|
||||
// Return the cached non-zero value, if not forced
|
||||
//
|
||||
if ( (fMass) && (!forced) ) return fMass;
|
||||
|
||||
// Global density and computed mass associated to the logical
|
||||
// volume without considering its daughters
|
||||
//
|
||||
G4Material* logMaterial = parMaterial ? parMaterial : fMaterial;
|
||||
if (!logMaterial)
|
||||
{
|
||||
G4cerr << "ERROR - G4LogicalVolume::GetMass()" << G4endl
|
||||
<< " No material is associated to the logical volume: "
|
||||
<< fName << " ! Sorry, cannot compute the mass ..." << G4endl;
|
||||
G4Exception("G4LogicalVolume::GetMass()", "InvalidSetup", FatalException,
|
||||
"No material associated to the logical volume !");
|
||||
}
|
||||
if (!fSolid)
|
||||
{
|
||||
G4cerr << "ERROR - G4LogicalVolume::GetMass()" << G4endl
|
||||
<< " No solid is associated to the logical volume: "
|
||||
<< fName << " ! Sorry, cannot compute the mass ..." << G4endl;
|
||||
G4Exception("G4LogicalVolume::GetMass()", "InvalidSetup", FatalException,
|
||||
"No solid associated to the logical volume !");
|
||||
}
|
||||
G4double globalDensity = logMaterial->GetDensity();
|
||||
fMass = fSolid->GetCubicVolume() * globalDensity;
|
||||
|
||||
// For each daughter in the tree, subtract the mass occupied
|
||||
// and add the real daughter's one computed recursively
|
||||
|
||||
for (G4PhysicalVolumeList::const_iterator itDau = fDaughters.begin();
|
||||
itDau != fDaughters.end(); itDau++)
|
||||
{
|
||||
G4VPhysicalVolume* physDaughter = (*itDau);
|
||||
G4LogicalVolume* logDaughter = physDaughter->GetLogicalVolume();
|
||||
G4double subMass=0.;
|
||||
G4VSolid* daughterSolid = 0;
|
||||
G4Material* daughterMaterial = 0;
|
||||
|
||||
// Compute the mass to subtract and to add for each daughter
|
||||
// considering its multiplicity (i.e. replicated or not) and
|
||||
// eventually its parameterisation (by solid and/or by material)
|
||||
//
|
||||
for (G4int i=0; i<physDaughter->GetMultiplicity(); i++)
|
||||
{
|
||||
G4VPVParameterisation*
|
||||
physParam = physDaughter->GetParameterisation();
|
||||
if (physParam)
|
||||
{
|
||||
daughterSolid = physParam->ComputeSolid(i, physDaughter);
|
||||
daughterSolid->ComputeDimensions(physParam, i, physDaughter);
|
||||
daughterMaterial = physParam->ComputeMaterial(i, physDaughter);
|
||||
}
|
||||
else
|
||||
{
|
||||
daughterSolid = logDaughter->GetSolid();
|
||||
daughterMaterial = logDaughter->GetMaterial();
|
||||
}
|
||||
subMass = daughterSolid->GetCubicVolume() * globalDensity;
|
||||
|
||||
// Subtract the daughter's portion for the mass and add the real
|
||||
// daughter's mass computed recursively
|
||||
//
|
||||
fMass = fMass - subMass + logDaughter->GetMass(true, daughterMaterial);
|
||||
}
|
||||
}
|
||||
|
||||
return fMass;
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4LogicalVolumeStore.cc,v 1.12 2003/11/02 14:01:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4LogicalVolumeStore.cc,v 1.14 2004/09/03 08:17:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
// G4LogicalVolumeStore
|
||||
//
|
||||
@@ -35,12 +35,14 @@
|
||||
#include "G4Types.hh"
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
#include "G4GeometryManager.hh"
|
||||
#include "G4VStoreNotifier.hh"
|
||||
|
||||
// ***************************************************************************
|
||||
// Static class variables
|
||||
// ***************************************************************************
|
||||
//
|
||||
G4LogicalVolumeStore* G4LogicalVolumeStore::fgInstance = 0;
|
||||
G4VStoreNotifier* G4LogicalVolumeStore::fgNotifier = 0;
|
||||
G4bool G4LogicalVolumeStore::locked = false;
|
||||
|
||||
// ***************************************************************************
|
||||
@@ -93,6 +95,7 @@ void G4LogicalVolumeStore::Clean()
|
||||
|
||||
for(pos=store->begin(); pos!=store->end(); pos++)
|
||||
{
|
||||
if (fgNotifier) fgNotifier->NotifyDeRegistration();
|
||||
if (*pos) delete *pos; i++;
|
||||
}
|
||||
|
||||
@@ -107,6 +110,16 @@ void G4LogicalVolumeStore::Clean()
|
||||
store->clear();
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Associate user notifier to the store
|
||||
// ***************************************************************************
|
||||
//
|
||||
void G4LogicalVolumeStore::SetNotifier(G4VStoreNotifier* pNotifier)
|
||||
{
|
||||
GetInstance();
|
||||
fgNotifier = pNotifier;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Add volume to container
|
||||
// ***************************************************************************
|
||||
@@ -114,6 +127,7 @@ void G4LogicalVolumeStore::Clean()
|
||||
void G4LogicalVolumeStore::Register(G4LogicalVolume* pVolume)
|
||||
{
|
||||
GetInstance()->push_back(pVolume);
|
||||
if (fgNotifier) fgNotifier->NotifyRegistration();
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
@@ -124,6 +138,7 @@ void G4LogicalVolumeStore::DeRegister(G4LogicalVolume* pVolume)
|
||||
{
|
||||
if (!locked) // Do not de-register if locked !
|
||||
{
|
||||
if (fgNotifier) fgNotifier->NotifyDeRegistration();
|
||||
for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
|
||||
{
|
||||
if (**i==*pVolume)
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4PhysicalVolumeStore.cc,v 1.13 2003/11/02 14:01:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4PhysicalVolumeStore.cc,v 1.15 2004/09/03 08:17:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
// G4PhysicalVolumeStore
|
||||
//
|
||||
@@ -36,12 +36,14 @@
|
||||
#include "G4PhysicalVolumeStore.hh"
|
||||
#include "G4GeometryManager.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VStoreNotifier.hh"
|
||||
|
||||
// ***************************************************************************
|
||||
// Static class variables
|
||||
// ***************************************************************************
|
||||
//
|
||||
G4PhysicalVolumeStore* G4PhysicalVolumeStore::fgInstance = 0;
|
||||
G4VStoreNotifier* G4PhysicalVolumeStore::fgNotifier = 0;
|
||||
G4bool G4PhysicalVolumeStore::locked = false;
|
||||
|
||||
// ***************************************************************************
|
||||
@@ -103,6 +105,7 @@ void G4PhysicalVolumeStore::Clean(G4bool notifyLV)
|
||||
|
||||
for(pos=store->begin(); pos!=store->end(); pos++)
|
||||
{
|
||||
if (fgNotifier) fgNotifier->NotifyDeRegistration();
|
||||
if (*pos) delete *pos; i++;
|
||||
}
|
||||
|
||||
@@ -117,13 +120,24 @@ void G4PhysicalVolumeStore::Clean(G4bool notifyLV)
|
||||
store->clear();
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Associate user notifier to the store
|
||||
// ***************************************************************************
|
||||
//
|
||||
void G4PhysicalVolumeStore::SetNotifier(G4VStoreNotifier* pNotifier)
|
||||
{
|
||||
GetInstance();
|
||||
fgNotifier = pNotifier;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Add Volume to container
|
||||
// ***************************************************************************
|
||||
//
|
||||
void G4PhysicalVolumeStore::Register(G4VPhysicalVolume* pVolume)
|
||||
{
|
||||
GetInstance()->push_back(pVolume);
|
||||
GetInstance()->push_back(pVolume);
|
||||
if (fgNotifier) fgNotifier->NotifyRegistration();
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
@@ -135,6 +149,7 @@ void G4PhysicalVolumeStore::DeRegister(G4VPhysicalVolume* pVolume)
|
||||
{
|
||||
if (!locked) // Do not de-register if locked !
|
||||
{
|
||||
if (fgNotifier) fgNotifier->NotifyDeRegistration();
|
||||
G4LogicalVolume* motherLogical = pVolume->GetMotherLogical();
|
||||
if (motherLogical) motherLogical->RemoveDaughter(pVolume);
|
||||
for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
|
||||
|
||||
@@ -21,9 +21,9 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ReflectedSolid.cc,v 1.1 2004/05/13 14:49:42 gcosmo Exp $
|
||||
// $Id: G4ReflectedSolid.cc,v 1.3 2004/10/13 13:06:51 gcosmo Exp $
|
||||
//
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
// Implementation for G4ReflectedSolid class for boolean
|
||||
// operations between other solids
|
||||
@@ -53,7 +53,7 @@
|
||||
G4ReflectedSolid::G4ReflectedSolid( const G4String& pName,
|
||||
G4VSolid* pSolid ,
|
||||
const G4Transform3D& transform )
|
||||
: G4VSolid(pName)
|
||||
: G4VSolid(pName), fpPolyhedron(0)
|
||||
{
|
||||
fPtrSolid = pSolid ;
|
||||
G4RotationMatrix rotMatrix ;
|
||||
@@ -116,6 +116,7 @@ G4AffineTransform G4ReflectedSolid::GetTransform() const
|
||||
void G4ReflectedSolid::SetTransform(G4AffineTransform& transform)
|
||||
{
|
||||
fPtrTransform = &transform ;
|
||||
fpPolyhedron = 0;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -129,6 +130,7 @@ G4AffineTransform G4ReflectedSolid::GetDirectTransform() const
|
||||
void G4ReflectedSolid::SetDirectTransform(G4AffineTransform& transform)
|
||||
{
|
||||
fDirectTransform = &transform ;
|
||||
fpPolyhedron = 0;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -142,6 +144,7 @@ G4Transform3D G4ReflectedSolid::GetTransform3D() const
|
||||
void G4ReflectedSolid::SetTransform3D(G4Transform3D& transform)
|
||||
{
|
||||
fPtrTransform3D = &transform ;
|
||||
fpPolyhedron = 0;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@@ -155,6 +158,7 @@ G4Transform3D G4ReflectedSolid::GetDirectTransform3D() const
|
||||
void G4ReflectedSolid::SetDirectTransform3D(G4Transform3D& transform)
|
||||
{
|
||||
fDirectTransform3D = &transform ;
|
||||
fpPolyhedron = 0;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@@ -547,3 +551,17 @@ G4ReflectedSolid::CreateNURBS () const
|
||||
// return fPtrSolid->CreateNURBS() ;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
//
|
||||
//
|
||||
|
||||
G4Polyhedron*
|
||||
G4ReflectedSolid::GetPolyhedron () const
|
||||
{
|
||||
if (!fpPolyhedron)
|
||||
{
|
||||
fpPolyhedron = CreatePolyhedron ();
|
||||
}
|
||||
return fpPolyhedron;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4Region.cc,v 1.11 2003/11/02 14:01:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// class G4Region Implementation
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4RegionStore.cc,v 1.6 2003/11/02 14:01:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4RegionStore.cc,v 1.8 2004/09/03 08:17:58 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
// G4RegionStore
|
||||
//
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "G4Region.hh"
|
||||
#include "G4RegionStore.hh"
|
||||
#include "G4GeometryManager.hh"
|
||||
#include "G4VStoreNotifier.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
|
||||
@@ -43,6 +44,7 @@
|
||||
// ***************************************************************************
|
||||
//
|
||||
G4RegionStore* G4RegionStore::fgInstance = 0;
|
||||
G4VStoreNotifier* G4RegionStore::fgNotifier = 0;
|
||||
G4bool G4RegionStore::locked = false;
|
||||
|
||||
// ***************************************************************************
|
||||
@@ -66,7 +68,7 @@ G4RegionStore::~G4RegionStore()
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Delete all elements from the store
|
||||
// Delete all regions from the store except for the world region
|
||||
// ***************************************************************************
|
||||
//
|
||||
void G4RegionStore::Clean()
|
||||
@@ -90,12 +92,13 @@ void G4RegionStore::Clean()
|
||||
std::vector<G4Region*>::iterator pos;
|
||||
|
||||
#ifdef G4GEOMETRY_VOXELDEBUG
|
||||
G4cout << "Deleting Solids ... ";
|
||||
G4cout << "Deleting Regions ... ";
|
||||
#endif
|
||||
|
||||
for(pos=store->begin(); pos!=store->end(); pos++)
|
||||
for(pos=store->begin()+1; pos!=store->end(); pos++)
|
||||
{
|
||||
if (*pos) delete *pos; i++;
|
||||
if (fgNotifier) fgNotifier->NotifyDeRegistration();
|
||||
if (*pos) delete *pos; i++; // Do NOT delete world region !
|
||||
}
|
||||
|
||||
#ifdef G4GEOMETRY_VOXELDEBUG
|
||||
@@ -110,22 +113,34 @@ void G4RegionStore::Clean()
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Add Solid to container
|
||||
// Associate user notifier to the store
|
||||
// ***************************************************************************
|
||||
//
|
||||
void G4RegionStore::SetNotifier(G4VStoreNotifier* pNotifier)
|
||||
{
|
||||
GetInstance();
|
||||
fgNotifier = pNotifier;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Add Region to container
|
||||
// ***************************************************************************
|
||||
//
|
||||
void G4RegionStore::Register(G4Region* pRegion)
|
||||
{
|
||||
GetInstance()->push_back(pRegion);
|
||||
if (fgNotifier) fgNotifier->NotifyRegistration();
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Remove Solid from container
|
||||
// Remove Region from container
|
||||
// ***************************************************************************
|
||||
//
|
||||
void G4RegionStore::DeRegister(G4Region* pRegion)
|
||||
{
|
||||
if (!locked) // Do not de-register if locked !
|
||||
{
|
||||
if (fgNotifier) fgNotifier->NotifyDeRegistration();
|
||||
for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
|
||||
{
|
||||
if (**i==*pRegion)
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SmartVoxelHeader.cc,v 1.24 2003/11/02 14:01:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4SmartVoxelHeader.cc,v 1.25 2004/12/02 09:31:22 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
//
|
||||
// class G4SmartVoxelHeader
|
||||
@@ -366,8 +366,8 @@ void G4SmartVoxelHeader::BuildReplicaVoxels(G4LogicalVolume* pVolume)
|
||||
G4VoxelLimits limits;
|
||||
G4AffineTransform origin;
|
||||
pVolume->GetSolid()->CalculateExtent(axis, limits, origin, min, max);
|
||||
if ( (fabs((min-fminExtent)/fminExtent) +
|
||||
fabs((max-fmaxExtent)/fmaxExtent)) > 0.05)
|
||||
if ( (std::fabs((min-fminExtent)/fminExtent) +
|
||||
std::fabs((max-fmaxExtent)/fmaxExtent)) > 0.05)
|
||||
{
|
||||
G4cerr << "ERROR - G4SmartVoxelHeader::BuildReplicaVoxels()"
|
||||
<< G4endl
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4SmartVoxelNode.cc,v 1.5 2003/11/02 14:01:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
// Class G4SmartVoxelNode
|
||||
//
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4SmartVoxelProxy.cc,v 1.2 2003/11/02 14:01:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
// Class G4SmartVoxelProxy
|
||||
//
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4SmartVoxelStat.cc,v 1.2 2003/11/02 14:01:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
// GEANT 4 class source file
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SolidStore.cc,v 1.11 2003/11/02 14:01:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4SolidStore.cc,v 1.13 2004/09/03 08:17:58 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
// G4SolidStore
|
||||
//
|
||||
@@ -35,12 +35,14 @@
|
||||
#include "globals.hh"
|
||||
#include "G4SolidStore.hh"
|
||||
#include "G4GeometryManager.hh"
|
||||
#include "G4VStoreNotifier.hh"
|
||||
|
||||
// ***************************************************************************
|
||||
// Static class variables
|
||||
// ***************************************************************************
|
||||
//
|
||||
G4SolidStore* G4SolidStore::fgInstance = 0;
|
||||
G4VStoreNotifier* G4SolidStore::fgNotifier = 0;
|
||||
G4bool G4SolidStore::locked = false;
|
||||
|
||||
// ***************************************************************************
|
||||
@@ -95,6 +97,7 @@ void G4SolidStore::Clean()
|
||||
|
||||
for(pos=store->begin(); pos!=store->end(); pos++)
|
||||
{
|
||||
if (fgNotifier) fgNotifier->NotifyDeRegistration();
|
||||
if (*pos) delete *pos; i++;
|
||||
}
|
||||
|
||||
@@ -109,6 +112,16 @@ void G4SolidStore::Clean()
|
||||
store->clear();
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Associate user notifier to the store
|
||||
// ***************************************************************************
|
||||
//
|
||||
void G4SolidStore::SetNotifier(G4VStoreNotifier* pNotifier)
|
||||
{
|
||||
GetInstance();
|
||||
fgNotifier = pNotifier;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Add Solid to container
|
||||
// ***************************************************************************
|
||||
@@ -116,6 +129,7 @@ void G4SolidStore::Clean()
|
||||
void G4SolidStore::Register(G4VSolid* pSolid)
|
||||
{
|
||||
GetInstance()->push_back(pSolid);
|
||||
if (fgNotifier) fgNotifier->NotifyRegistration();
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
@@ -126,6 +140,7 @@ void G4SolidStore::DeRegister(G4VSolid* pSolid)
|
||||
{
|
||||
if (!locked) // Do not de-register if locked !
|
||||
{
|
||||
if (fgNotifier) fgNotifier->NotifyDeRegistration();
|
||||
for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
|
||||
{
|
||||
if (**i==*pSolid)
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VCurvedTrajectoryFilter.cc,v 1.2 2003/11/02 14:01:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4VCurvedTrajectoryFilter.hh"
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VPVDivisionFactory.cc,v 1.1 2004/05/13 14:53:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-02 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
// class G4VPVDivisionFactory Implementation file
|
||||
//
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VPVParameterisation.cc,v 1.4 2003/11/02 14:01:23 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
// Default implementations for Parameterisations that do not
|
||||
// parameterise solid and/or material.
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//
|
||||
//
|
||||
// $Id: G4VPhysicalVolume.cc,v 1.9 2003/11/02 14:01:24 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
//
|
||||
// class G4VPhysicalVolume Implementation
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VSolid.cc,v 1.20 2003/11/02 14:01:24 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4VSolid.cc,v 1.25 2004/10/10 10:15:27 johna Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
// class G4VSolid
|
||||
//
|
||||
@@ -41,6 +41,8 @@
|
||||
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4SolidStore.hh"
|
||||
#include "globals.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
#include "G4VoxelLimits.hh"
|
||||
#include "G4AffineTransform.hh"
|
||||
@@ -53,7 +55,7 @@
|
||||
// - Add ourselves to solid Store
|
||||
|
||||
G4VSolid::G4VSolid(const G4String& name)
|
||||
: fshapeName(name)
|
||||
: fshapeName(name)
|
||||
{
|
||||
G4SolidStore::GetInstance()->Register(this);
|
||||
}
|
||||
@@ -415,3 +417,69 @@ G4NURBS* G4VSolid::CreateNURBS () const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
G4Polyhedron* G4VSolid::GetPolyhedron () const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Returns an estimation of the solid volume in internal units.
|
||||
// The number of statistics and error accuracy is fixed.
|
||||
// This method may be overloaded by derived classes to compute the
|
||||
// exact geometrical quantity for solids where this is possible.
|
||||
// or anyway to cache the computed value.
|
||||
// This implementation does NOT cache the computed value.
|
||||
|
||||
G4double G4VSolid::GetCubicVolume()
|
||||
{
|
||||
G4int cubVolStatistics = 1000000;
|
||||
G4double cubVolEpsilon = 0.001;
|
||||
return EstimateCubicVolume(cubVolStatistics, cubVolEpsilon);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Calculate cubic volume based on Inside() method.
|
||||
// Accuracy is limited by the second argument or the statistics
|
||||
// expressed by the first argument.
|
||||
// Implementation is courtesy of Vasiliki Despoina Mitsou,
|
||||
// University of Athens.
|
||||
|
||||
G4double G4VSolid::EstimateCubicVolume(G4int nStat, G4double epsilon) const
|
||||
{
|
||||
G4int iInside=0;
|
||||
G4double px,py,pz,minX,maxX,minY,maxY,minZ,maxZ,volume;
|
||||
G4bool yesno;
|
||||
G4ThreeVector p;
|
||||
EInside in;
|
||||
|
||||
// values needed for CalculateExtent signature
|
||||
|
||||
G4VoxelLimits limit; // Unlimited
|
||||
G4AffineTransform origin;
|
||||
|
||||
// min max extents of pSolid along X,Y,Z
|
||||
|
||||
yesno = this->CalculateExtent(kXAxis,limit,origin,minX,maxX);
|
||||
yesno = this->CalculateExtent(kYAxis,limit,origin,minY,maxY);
|
||||
yesno = this->CalculateExtent(kZAxis,limit,origin,minZ,maxZ);
|
||||
|
||||
// limits
|
||||
|
||||
if(nStat < 100) nStat = 100;
|
||||
if(epsilon > 0.01) epsilon = 0.01;
|
||||
|
||||
for(G4int i = 0; i < nStat; i++ )
|
||||
{
|
||||
px = minX+(maxX-minX)*G4UniformRand();
|
||||
py = minY+(maxY-minY)*G4UniformRand();
|
||||
pz = minZ+(maxZ-minZ)*G4UniformRand();
|
||||
p = G4ThreeVector(px,py,pz);
|
||||
in = this->Inside(p);
|
||||
if(in != kOutside) iInside++;
|
||||
}
|
||||
volume = (maxX-minX)*(maxY-minY)*(maxZ-minZ)*iInside/nStat;
|
||||
return volume;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * DISCLAIMER *
|
||||
// * *
|
||||
// * The following disclaimer summarizes all the specific disclaimers *
|
||||
// * of contributors to this software. The specific disclaimers,which *
|
||||
// * govern, are listed with their locations in: *
|
||||
// * http://cern.ch/geant4/license *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. *
|
||||
// * *
|
||||
// * This code implementation is the intellectual property of the *
|
||||
// * GEANT4 collaboration. *
|
||||
// * By copying, distributing or modifying the Program (or any work *
|
||||
// * based on the Program) you indicate your acceptance of this *
|
||||
// * statement, and all its terms. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VStoreNotifier.cc,v 1.1 2004/09/02 07:48:57 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-01 $
|
||||
//
|
||||
// G4VStoreNotifier
|
||||
//
|
||||
// Implementation for the store notifier base class
|
||||
//
|
||||
// Author:
|
||||
// 01.09.04 G.Cosmo Initial version
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4VStoreNotifier.hh"
|
||||
|
||||
// ***************************************************************************
|
||||
// Constructor
|
||||
// ***************************************************************************
|
||||
//
|
||||
G4VStoreNotifier::G4VStoreNotifier()
|
||||
{
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Destructor
|
||||
// ***************************************************************************
|
||||
//
|
||||
G4VStoreNotifier::~G4VStoreNotifier()
|
||||
{
|
||||
}
|
||||
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VoxelLimits.cc,v 1.9 2003/11/02 14:01:24 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-06-00-patch-01 $
|
||||
// $Id: G4VoxelLimits.cc,v 1.10 2004/12/02 09:31:22 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-00-cand-03 $
|
||||
//
|
||||
// class G4VoxelLimits
|
||||
//
|
||||
@@ -136,15 +136,15 @@ G4bool G4VoxelLimits::ClipToLimits( G4ThreeVector& pStart,
|
||||
y2 = pEnd.y() ;
|
||||
z2 = pEnd.z() ;
|
||||
/*
|
||||
if( abs(x1-x2) < kCarTolerance*kCarTolerance)
|
||||
if( std::abs(x1-x2) < kCarTolerance*kCarTolerance)
|
||||
{
|
||||
G4cout<<"x1 = "<<x1<<"\t"<<"x2 = "<<x2<<G4endl;
|
||||
}
|
||||
if( abs(y1-y2) < kCarTolerance*kCarTolerance)
|
||||
if( std::abs(y1-y2) < kCarTolerance*kCarTolerance)
|
||||
{
|
||||
G4cout<<"y1 = "<<y1<<"\t"<<"y2 = "<<y2<<G4endl;
|
||||
}
|
||||
if( abs(z1-z2) < kCarTolerance*kCarTolerance)
|
||||
if( std::abs(z1-z2) < kCarTolerance*kCarTolerance)
|
||||
{
|
||||
G4cout<<"z1 = "<<z1<<"\t"<<"z2 = "<<z2<<G4endl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user