Import Geant4 7.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 12:11:21 +02:00
parent 516dbf1a58
commit d93e1e39a9
5384 changed files with 125662 additions and 82444 deletions
@@ -22,7 +22,7 @@
//
//
// $Id: G4BlockingList.cc,v 1.2 2003/11/02 14:01:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-01 $
//
//
// class G4BlockingList Implementation
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4GeometryManager.cc,v 1.15 2003/11/02 14:01:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: G4GeometryManager.cc,v 1.17 2005/04/14 11:00:56 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
// class G4GeometryManager
//
@@ -43,7 +43,7 @@
// Needed for building optimisations
//
#include "G4LogicalVolumeStore.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include "G4SmartVoxelHeader.hh"
#include "voxeldefs.hh"
@@ -66,28 +66,46 @@ G4GeometryManager::G4GeometryManager()
// Closes geometry - performs sanity checks and optionally builds optimisation
// for placed volumes (always built for replicas & parameterised).
// NOTE: Currently no sanity checks are performed.
// Applies to just a specific subtree if a physical volume is specified.
// ***************************************************************************
//
G4bool G4GeometryManager::CloseGeometry(G4bool pOptimise, G4bool verbose)
G4bool G4GeometryManager::CloseGeometry(G4bool pOptimise, G4bool verbose,
G4VPhysicalVolume* pVolume)
{
if (!fIsClosed)
if (!fIsClosed)
{
BuildOptimisations(pOptimise, verbose);
if (pVolume)
{
BuildOptimisations(pOptimise, pVolume);
}
else
{
BuildOptimisations(pOptimise, verbose);
}
fIsClosed=true;
}
return true;
}
// ***************************************************************************
// Opens the geometry and removes all optimisations.
// Opens the geometry and removes optimisations (optionally, related to just
// the specified logical-volume).
// Applies to just a specific subtree if a physical volume is specified.
// ***************************************************************************
//
void G4GeometryManager::OpenGeometry()
void G4GeometryManager::OpenGeometry(G4VPhysicalVolume* pVolume)
{
if (fIsClosed)
{
DeleteOptimisations();
fIsClosed=false;
if (pVolume)
{
DeleteOptimisations(pVolume);
}
else
{
DeleteOptimisations();
}
fIsClosed=false;
}
}
@@ -125,16 +143,13 @@ void G4GeometryManager::BuildOptimisations(G4bool allOpts, G4bool verbose)
G4Timer timer;
G4Timer allTimer;
std::vector<G4SmartVoxelStat> stats;
if (verbose) allTimer.Start();
if (verbose) { allTimer.Start(); }
G4LogicalVolumeStore *Store;
G4LogicalVolume *volume;
G4SmartVoxelHeader *head;
G4int nVolumes, n;
Store=G4LogicalVolumeStore::GetInstance();
nVolumes=Store->size();
G4LogicalVolumeStore* Store = G4LogicalVolumeStore::GetInstance();
G4LogicalVolume* volume;
G4SmartVoxelHeader* head;
for (n=0; n<nVolumes; n++)
for (size_t n=0; n<Store->size(); n++)
{
if (verbose) timer.Start();
volume=(*Store)[n];
@@ -142,11 +157,8 @@ void G4GeometryManager::BuildOptimisations(G4bool allOpts, G4bool verbose)
// delete before replacement
//
head = volume->GetVoxelHeader();
if (head)
{
delete head;
volume->SetVoxelHeader(0);
}
delete head;
volume->SetVoxelHeader(0);
if ( (volume->IsToOptimise())
&& (volume->GetNoDaughters()>=kMinVoxelVolumesLevel1&&allOpts)
|| ( (volume->GetNoDaughters()==1)
@@ -164,9 +176,11 @@ void G4GeometryManager::BuildOptimisations(G4bool allOpts, G4bool verbose)
}
else
{
G4cerr << "ERROR - Allocation of new VoxelHeader failed." << G4endl;
G4cerr << "ERROR - Allocation of new VoxelHeader" << G4endl
<< " for volume " << volume->GetName() << " failed."
<< G4endl;
G4Exception("G4GeometryManager::BuildOptimisations()", "FatalError",
FatalException, "VoxelHeader allocation error.");
FatalException, "VoxelHeader allocation error.");
}
if (verbose)
{
@@ -194,31 +208,99 @@ void G4GeometryManager::BuildOptimisations(G4bool allOpts, G4bool verbose)
}
}
// ***************************************************************************
// Creates optimisation info for the specified volumes subtree.
// ***************************************************************************
//
void G4GeometryManager::BuildOptimisations(G4bool allOpts,
G4VPhysicalVolume* pVolume)
{
if (!pVolume) { return; }
// Retrieve the mother logical volume, if not NULL,
// otherwise apply global optimisation for the world volume
//
G4LogicalVolume* tVolume = pVolume->GetMotherLogical();
if (!tVolume) { return BuildOptimisations(allOpts, false); }
G4SmartVoxelHeader* head = tVolume->GetVoxelHeader();
delete head;
tVolume->SetVoxelHeader(0);
if ( (tVolume->IsToOptimise())
&& (tVolume->GetNoDaughters()>=kMinVoxelVolumesLevel1&&allOpts)
|| ( (tVolume->GetNoDaughters()==1)
&& (tVolume->GetDaughter(0)->IsReplicated()==true) ) )
{
head = new G4SmartVoxelHeader(tVolume);
if (head)
{
tVolume->SetVoxelHeader(head);
}
else
{
G4cerr << "ERROR - Allocation of new VoxelHeader" << G4endl
<< " for volume " << tVolume->GetName() << " failed."
<< G4endl;
G4Exception("G4GeometryManager::BuildOptimisations()", "FatalError",
FatalException, "VoxelHeader allocation error.");
}
}
else
{
// Don't create voxels for this node
#ifdef G4GEOMETRY_VOXELDEBUG
G4cout << "**** G4GeometryManager::BuildOptimisations" << G4endl
<< " Skipping logical volume name = " << volume->GetName()
<< G4endl;
#endif
}
// Scan recursively the associated logical volume tree
//
tVolume = pVolume->GetLogicalVolume();
if (tVolume->GetNoDaughters()) { BuildOptimisations(allOpts, tVolume->GetDaughter(0)); }
}
// ***************************************************************************
// Removes all optimisation info.
// Loops over all logical volumes, deleting non-null voxels pointers.
// Loops over all logical volumes, deleting non-null voxels pointers,
// ***************************************************************************
//
void G4GeometryManager::DeleteOptimisations()
{
G4LogicalVolumeStore* Store=G4LogicalVolumeStore::GetInstance();
G4LogicalVolume* volume;
G4SmartVoxelHeader* head;
G4int nVolumes, n;
nVolumes = Store->size();
for (n=0; n<nVolumes; n++)
G4LogicalVolume* tVolume = 0;
G4LogicalVolumeStore* Store = G4LogicalVolumeStore::GetInstance();
for (size_t n=0; n<Store->size(); n++)
{
volume=(*Store)[n];
head=volume->GetVoxelHeader();
if (head)
{
delete head;
volume->SetVoxelHeader(0);
}
tVolume=(*Store)[n];
delete tVolume->GetVoxelHeader();
tVolume->SetVoxelHeader(0);
}
}
// ***************************************************************************
// Removes optimisation info for the specified subtree.
// Scans recursively all daughter volumes, deleting non-null voxels pointers.
// ***************************************************************************
//
void G4GeometryManager::DeleteOptimisations(G4VPhysicalVolume* pVolume)
{
if (!pVolume) { return; }
// Retrieve the mother logical volume, if not NULL,
// otherwise global deletion to world volume.
//
G4LogicalVolume* tVolume = pVolume->GetMotherLogical();
if (!tVolume) { return DeleteOptimisations(); }
delete tVolume->GetVoxelHeader();
tVolume->SetVoxelHeader(0);
// Scan recursively the associated logical volume tree
//
tVolume = pVolume->GetLogicalVolume();
if (tVolume->GetNoDaughters()) { DeleteOptimisations(tVolume->GetDaughter(0)); }
}
// ***************************************************************************
// Reports statistics on voxel optimisation when closing geometry.
// ***************************************************************************
@@ -236,7 +318,7 @@ G4GeometryManager::ReportVoxelStats( std::vector<G4SmartVoxelStat> & stats,
G4int i, nStat = stats.size();
G4long totalMemory = 0;
for( i=0;i<nStat;++i ) totalMemory += stats[i].GetMemoryUse();
for( i=0;i<nStat;++i ) { totalMemory += stats[i].GetMemoryUse(); }
G4cout << " Total memory consumed for geometry optimisation: "
<< totalMemory/1024 << " kByte" << G4endl;
@@ -265,11 +347,11 @@ G4GeometryManager::ReportVoxelStats( std::vector<G4SmartVoxelStat> & stats,
G4double system = stats[i].GetSysTime();
G4double perc = 0.0;
if (system < 0) system = 0.0;
if (system < 0) { system = 0.0; }
if ((total < 0) || (totalCpuTime < perMillion))
total = 0;
{ total = 0; }
else
perc = total*100/totalCpuTime;
{ perc = total*100/totalCpuTime; }
G4cout << std::setprecision(2)
<< std::setiosflags(std::ios::fixed|std::ios::right)
@@ -302,7 +384,7 @@ G4GeometryManager::ReportVoxelStats( std::vector<G4SmartVoxelStat> & stats,
{
G4long memory = stats[i].GetMemoryUse();
G4double totTime = stats[i].GetTotalTime();
if (totTime < 0) totTime = 0.0;
if (totTime < 0) { totTime = 0.0; }
G4cout << std::setprecision(2)
<< std::setiosflags(std::ios::fixed|std::ios::right)
@@ -22,7 +22,7 @@
//
//
// $Id: G4IdentityTrajectoryFilter.cc,v 1.2 2003/11/02 14:01:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-01 $
//
// ------------------------------------------------------------------------
@@ -21,13 +21,14 @@
// ********************************************************************
//
//
// $Id: G4LogicalVolume.cc,v 1.22 2004/11/15 14:15:21 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: G4LogicalVolume.cc,v 1.28 2005/05/25 14:57:52 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
//
// class G4LogicalVolume Implementation
//
// History:
// 01.03.05 G.Santin: Added flag for optional propagation of GetMass()
// 17.05.02 G.Cosmo: Added flag for optional optimisation
// 12.02.99 S.Giani: Default initialization of voxelization quality
// 04.08.97 P.M.DeFreitas: Added methods for parameterised simulation
@@ -40,6 +41,7 @@
#include "G4VSolid.hh"
#include "G4Material.hh"
#include "G4VPVParameterisation.hh"
#include "G4VisAttributes.hh"
#include "G4UnitsTable.hh"
@@ -269,11 +271,16 @@ G4int G4LogicalVolume::TotalVolumeEntities() const
// 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
// call. By setting the 'propagate' boolean flag to 'false' the
// method returns the mass of the present logical volume only
// (subtracted for the volume occupied by the daughter volumes).
// The extra argument 'parMaterial' is internally used to
// consider cases of geometrical parameterisations by material.
// ********************************************************************
//
G4double G4LogicalVolume::GetMass(G4bool forced, G4Material* parMaterial)
G4double G4LogicalVolume::GetMass(G4bool forced,
G4bool propagate,
G4Material* parMaterial)
{
// Return the cached non-zero value, if not forced
//
@@ -303,7 +310,8 @@ G4double G4LogicalVolume::GetMass(G4bool forced, G4Material* parMaterial)
fMass = fSolid->GetCubicVolume() * globalDensity;
// For each daughter in the tree, subtract the mass occupied
// and add the real daughter's one computed recursively
// and if required by the propagate flag, add the real daughter's
// one computed recursively
for (G4PhysicalVolumeList::const_iterator itDau = fDaughters.begin();
itDau != fDaughters.end(); itDau++)
@@ -335,12 +343,21 @@ G4double G4LogicalVolume::GetMass(G4bool forced, G4Material* parMaterial)
}
subMass = daughterSolid->GetCubicVolume() * globalDensity;
// Subtract the daughter's portion for the mass and add the real
// daughter's mass computed recursively
// Subtract the daughter's portion for the mass and, if required,
// add the real daughter's mass computed recursively
//
fMass = fMass - subMass + logDaughter->GetMass(true, daughterMaterial);
fMass -= subMass;
if (propagate)
{
fMass += logDaughter->GetMass(true, true, daughterMaterial);
}
}
}
return fMass;
}
void G4LogicalVolume::SetVisAttributes (const G4VisAttributes& VA)
{
fVisAttributes = new G4VisAttributes(VA);
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4LogicalVolumeStore.cc,v 1.14 2004/09/03 08:17:57 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-01 $
//
// G4LogicalVolumeStore
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4PhysicalVolumeStore.cc,v 1.15 2004/09/03 08:17:57 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-01 $
//
// G4PhysicalVolumeStore
//
@@ -21,9 +21,9 @@
// ********************************************************************
//
//
// $Id: G4ReflectedSolid.cc,v 1.3 2004/10/13 13:06:51 gcosmo Exp $
// $Id: G4ReflectedSolid.cc,v 1.5 2005/03/23 17:16:31 allison Exp $
//
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-01 $
//
// Implementation for G4ReflectedSolid class for boolean
// operations between other solids
@@ -83,6 +83,7 @@ G4ReflectedSolid::~G4ReflectedSolid()
delete fPtrTransform3D; fPtrTransform3D=0;
delete fDirectTransform3D; fDirectTransform3D=0;
}
delete fpPolyhedron;
}
G4GeometryType G4ReflectedSolid::GetEntityType() const
@@ -524,7 +525,7 @@ std::ostream& G4ReflectedSolid::StreamInfo(std::ostream& os) const
void
G4ReflectedSolid::DescribeYourselfTo ( G4VGraphicsScene& scene ) const
{
scene.AddThis (*this);
scene.AddSolid (*this);
}
////////////////////////////////////////////////////
@@ -559,9 +560,12 @@ G4ReflectedSolid::CreateNURBS () const
G4Polyhedron*
G4ReflectedSolid::GetPolyhedron () const
{
if (!fpPolyhedron)
{
fpPolyhedron = CreatePolyhedron ();
}
if (!fpPolyhedron ||
fpPolyhedron->GetNumberOfRotationStepsAtTimeOfCreation() !=
fpPolyhedron->GetNumberOfRotationSteps())
{
delete fpPolyhedron;
fpPolyhedron = CreatePolyhedron ();
}
return fpPolyhedron;
}
+23 -3
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Region.cc,v 1.11 2003/11/02 14:01:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// $Id: G4Region.cc,v 1.14 2005/04/04 09:28:45 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
//
// class G4Region Implementation
@@ -42,7 +42,7 @@
// *******************************************************************
//
G4Region::G4Region(const G4String& pName)
: fName(pName), fRegionMod(true), fCut(0), fUserInfo(0)
: fName(pName), fRegionMod(true), fCut(0), fUserInfo(0), fUserLimits(0)
{
G4RegionStore* rStore = G4RegionStore::GetInstance();
if (rStore->GetRegion(pName,false))
@@ -87,6 +87,16 @@ void G4Region::ScanVolumeTree(G4LogicalVolume* lv, G4bool region)
G4Region* currentRegion = 0;
size_t noDaughters = lv->GetNoDaughters();
G4Material* volMat = lv->GetMaterial();
if(!volMat)
{
G4String errmsg = "Logical volume <";
errmsg += lv->GetName();
errmsg += "> does not have a valid material pointer.\n";
errmsg += "A logical volume belonging to the (tracking) world volume ";
errmsg += "must have a valid material.\nCheck your geometry construction.";
G4Exception("G4Region::ScanVolumeTree()", "SetupError",
FatalException, errmsg);
}
G4MaterialList::iterator pos;
if (region)
{
@@ -119,6 +129,16 @@ void G4Region::ScanVolumeTree(G4LogicalVolume* lv, G4bool region)
for (register size_t rep=0; rep<repNo; rep++)
{
volMat = pParam->ComputeMaterial(rep, daughterPVol);
if(!volMat)
{
G4String errmsg = "The parameterisation for the physical volume <";
errmsg += daughterPVol->GetName();
errmsg += ">\n does not return a valid material pointer.\n";
errmsg += "A volume belonging to the (tracking) world volume must have ";
errmsg += "a valid material.\nCheck your parameterisation.";
G4Exception("G4Region::ScanVolumeTree()",
"SetupError", FatalException, errmsg);
}
pos = std::find(fMaterials.begin(),fMaterials.end(),volMat);
if (pos == fMaterials.end())
{
@@ -22,7 +22,7 @@
//
//
// $Id: G4RegionStore.cc,v 1.8 2004/09/03 08:17:58 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-01 $
//
// G4RegionStore
//
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4SmartVoxelHeader.cc,v 1.25 2004/12/02 09:31:22 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
// $Id: G4SmartVoxelHeader.cc,v 1.26 2005/04/13 15:53:09 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-01 $
//
//
// class G4SmartVoxelHeader
@@ -868,8 +868,8 @@ G4ProxyVector* G4SmartVoxelHeader::BuildNodes(G4LogicalVolume* pVolume,
G4cerr << "PANIC! - G4SmartVoxelHeader::BuildNodes()" << G4endl
<< " Daughter physical volume "
<< pDaughter->GetName() << G4endl
<< " is entirely outside mother logical volume "
<< pVolume->GetName() << " !!" << G4endl;
<< " is entirely outside mother logical volume "
<< pVolume->GetName() << " !!" << G4endl;
G4Exception("G4SmartVoxelHeader::BuildNodes()", "InvalidSetup",
FatalException, "Overlapping daughter with mother volume.");
}
@@ -1307,7 +1307,7 @@ std::ostream& operator << (std::ostream& s, const G4SmartVoxelHeader& h)
for (G4int j=0; j<h.fslices[i]->GetNode()->GetNoContained(); j++)
{
s << " " << h.fslices[i]->GetNode()->GetVolume(j);
}
}
s << " }" << G4endl;
collectNode = h.fslices[i];
collectNodeNo = i;
@@ -22,7 +22,7 @@
//
//
// $Id: G4SmartVoxelNode.cc,v 1.5 2003/11/02 14:01:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-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-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-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-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-01 $
//
// --------------------------------------------------------------------
// GEANT 4 class source file
@@ -22,7 +22,7 @@
//
//
// $Id: G4SolidStore.cc,v 1.13 2004/09/03 08:17:58 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-01 $
//
// G4SolidStore
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4VCurvedTrajectoryFilter.cc,v 1.2 2003/11/02 14:01:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-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-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-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-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-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-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-01 $
//
//
// class G4VPhysicalVolume Implementation
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4VSolid.cc,v 1.25 2004/10/10 10:15:27 johna Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-01 $
//
// class G4VSolid
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4VStoreNotifier.cc,v 1.1 2004/09/02 07:48:57 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
// GEANT4 tag $Name: geant4-07-01 $
//
// G4VStoreNotifier
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4VoxelLimits.cc,v 1.10 2004/12/02 09:31:22 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
// GEANT4 tag $Name: geant4-07-01 $
//
// class G4VoxelLimits
//