Import Geant4 5.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:15:15 +02:00
parent 37fff30d2e
commit fbd4999cf7
4396 changed files with 56662 additions and 52446 deletions
@@ -22,7 +22,7 @@
//
//
// $Id: G4AssemblyVolume.cc,v 1.13 2002/09/10 17:07:15 radoone Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// Class G4AssemblyVolume - implementation
@@ -22,7 +22,7 @@
//
//
// $Id: G4DrawVoxels.cc,v 1.15 2002/04/19 08:20:22 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4DrawVoxels
@@ -22,7 +22,7 @@
//
//
// $Id: G4GeometryManager.cc,v 1.12 2002/11/19 17:15:20 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// class G4GeometryManager
//
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4LogicalVolume.cc,v 1.11 2002/11/08 22:45:25 japost Exp $
// GEANT4 tag $Name: geant4-05-00 $
// $Id: G4LogicalVolume.cc,v 1.15 2003/04/03 10:26:54 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4LogicalVolume Implementation
@@ -52,8 +52,9 @@ G4LogicalVolume::G4LogicalVolume( G4VSolid* pSolid,
G4UserLimits* pULimits,
G4bool optimise )
: fDaughters(0,(G4VPhysicalVolume*)0), fFieldManager(pFieldMgr),
fVoxel(0), fOptimise(optimise), fSmartless(2.), fVisAttributes (0),
fFastSimulationManager (0), fIsEnvelope(false)
fVoxel(0), fOptimise(optimise), fRootRegion(false), fSmartless(2.),
fVisAttributes(0), fFastSimulationManager(0), fRegion(0),
fCutsCouple(0), fIsEnvelope(false)
{
SetSolid(pSolid);
SetMaterial(pMaterial);
@@ -176,6 +177,30 @@ G4LogicalVolume::SetFieldManager(G4FieldManager* pNewFieldMgr,
}
// ********************************************************************
// IsAncestor
//
// Finds out if the current logical volume is an ancestor of a given
// physical volume
// ********************************************************************
//
G4bool
G4LogicalVolume::IsAncestor(const G4VPhysicalVolume* aVolume) const
{
G4bool isDaughter = IsDaughter(aVolume);
if (!isDaughter)
{
for (G4PhysicalVolumeList::const_iterator itDau = fDaughters.begin();
itDau != fDaughters.end(); itDau++)
{
isDaughter = (*itDau)->GetLogicalVolume()->IsAncestor(aVolume);
if (isDaughter) break;
}
}
return isDaughter;
}
// ********************************************************************
// FindMotherLogicalVolumeForEnvelope
//
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4LogicalVolumeStore.cc,v 1.8 2002/04/26 16:24:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// $Id: G4LogicalVolumeStore.cc,v 1.9 2003/01/30 07:57:32 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
// G4LogicalVolumeStore
//
@@ -128,6 +128,8 @@ void G4LogicalVolumeStore::DeRegister(G4LogicalVolume* pVolume)
{
if (**i==*pVolume)
{
if (pVolume->IsRootRegion())
pVolume->GetRegion()->RemoveRootLogicalVolume(pVolume);
GetInstance()->erase(i);
break;
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4PVParameterised.cc,v 1.7 2002/10/23 16:11:11 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4PVParameterised
+66 -73
View File
@@ -21,72 +21,66 @@
// ********************************************************************
//
//
// $Id: G4PVPlacement.cc,v 1.5 2002/10/14 07:42:26 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// $Id: G4PVPlacement.cc,v 1.7 2003/03/31 14:18:51 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4PVPlacement Implementation
#include "G4PVPlacement.hh"
// #include "G4Transform3D.hh"
#include "G4LogicalVolume.hh"
G4PVPlacement::G4PVPlacement(G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
const G4String& pName,
G4LogicalVolume *pLogical,
G4VPhysicalVolume *pMother,
G4bool pMany,
G4int pCopyNo) :
G4VPhysicalVolume(pRot,tlate,pName,pLogical,pMother),
fmany(pMany), fallocatedRotM(false), fcopyNo(pCopyNo)
G4PVPlacement::G4PVPlacement( G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
const G4String& pName,
G4LogicalVolume *pLogical,
G4VPhysicalVolume *pMother,
G4bool pMany,
G4int pCopyNo )
: G4VPhysicalVolume(pRot,tlate,pName,pLogical,pMother),
fmany(pMany), fallocatedRotM(false), fcopyNo(pCopyNo)
{
}
G4PVPlacement::G4PVPlacement(const G4Transform3D &Transform3D,
const G4String& pName,
G4LogicalVolume *pLogical,
G4VPhysicalVolume *pMother,
G4bool pMany,
G4int pCopyNo) :
G4VPhysicalVolume( NewPtrRotMatrix(Transform3D.getRotation().inverse()),
Transform3D.getTranslation(),
pName,pLogical,pMother),
fmany(pMany), fcopyNo(pCopyNo)
G4PVPlacement::G4PVPlacement( const G4Transform3D &Transform3D,
const G4String& pName,
G4LogicalVolume *pLogical,
G4VPhysicalVolume *pMother,
G4bool pMany,
G4int pCopyNo)
: G4VPhysicalVolume(NewPtrRotMatrix(Transform3D.getRotation().inverse()),
Transform3D.getTranslation(),pName,pLogical,pMother),
fmany(pMany), fcopyNo(pCopyNo)
{
fallocatedRotM= (this->GetRotation() != 0);
}
//
// The logical volume of the mother is utilised (not the physical)
// [ The physical volume is needed, known and set only at tracking time. ]
// The logical volume of the mother is utilised (not the physical)
// The physical volume is needed, known and set only at tracking time.
//
G4PVPlacement::G4PVPlacement(G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
G4LogicalVolume *pCurrentLogical,
const G4String& pName,
G4LogicalVolume *pMotherLogical,
G4bool pMany,
G4int pCopyNo) :
G4VPhysicalVolume(pRot,tlate,pName,pCurrentLogical,0),
fmany(pMany), fallocatedRotM(false), fcopyNo(pCopyNo)
G4PVPlacement::G4PVPlacement( G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
G4LogicalVolume *pCurrentLogical,
const G4String& pName,
G4LogicalVolume *pMotherLogical,
G4bool pMany,
G4int pCopyNo)
: G4VPhysicalVolume(pRot,tlate,pName,pCurrentLogical,0),
fmany(pMany), fallocatedRotM(false), fcopyNo(pCopyNo)
{
if (pMotherLogical) pMotherLogical->AddDaughter(this);
}
G4PVPlacement::G4PVPlacement( const G4Transform3D &Transform3D,
G4LogicalVolume *pCurrentLogical,
const G4String& pName,
G4LogicalVolume *pMotherLogical,
G4bool pMany,
G4int pCopyNo):
G4VPhysicalVolume( 0,
Transform3D.getTranslation(),
pName,
pCurrentLogical,
0),
G4LogicalVolume *pCurrentLogical,
const G4String& pName,
G4LogicalVolume *pMotherLogical,
G4bool pMany,
G4int pCopyNo)
: G4VPhysicalVolume(0,Transform3D.getTranslation(),pName,pCurrentLogical,0),
fmany(pMany), fcopyNo(pCopyNo)
{
this->SetRotation( NewPtrRotMatrix(Transform3D.getRotation().inverse()) );
@@ -95,8 +89,6 @@ G4PVPlacement::G4PVPlacement( const G4Transform3D &Transform3D,
if (pMotherLogical) pMotherLogical->AddDaughter(this);
}
G4PVPlacement::~G4PVPlacement()
{
if( fallocatedRotM ){ delete frot; }
@@ -104,68 +96,69 @@ G4PVPlacement::~G4PVPlacement()
G4bool G4PVPlacement::IsMany() const
{
return fmany;
return fmany;
}
G4int G4PVPlacement::GetCopyNo() const
{
return fcopyNo;
return fcopyNo;
}
void G4PVPlacement::SetCopyNo(G4int newCopyNo)
void G4PVPlacement::SetCopyNo(G4int newCopyNo)
{
fcopyNo= newCopyNo;
fcopyNo= newCopyNo;
}
G4bool G4PVPlacement::IsReplicated() const
{
return false;
return false;
}
G4bool G4PVPlacement::IsParameterised() const
{
return false;
return false;
}
G4VPVParameterisation* G4PVPlacement::GetParameterisation() const
{
return 0;
return 0;
}
void G4PVPlacement::GetReplicationData(EAxis& axis,
G4int& nReplicas,
G4double& width,
G4double& offset,
G4bool& consuming) const
void G4PVPlacement::GetReplicationData( EAxis&,
G4int&,
G4double&,
G4double&,
G4bool& ) const
{
// No-operations
// No-operations
}
void G4PVPlacement::Setup(G4VPhysicalVolume *pMother)
{
SetMother(pMother);
SetMother(pMother);
}
//
// Auxiliary function for 2nd & 4th constructors (the ones with G4Transform3D)
// Creates a new RotMatrix on the heap (using "new") and copies
// its argument into it.
// Creates a new RotMatrix on the heap (using "new") and copies
// its argument into it.
//
// No entity is currently responsible to delete this memory.
// This is a memory leak. <-- FIXME
// No entity is currently responsible to delete this memory.
// This is a memory leak. <-- FIXME
//
G4RotationMatrix* G4PVPlacement::NewPtrRotMatrix(const G4RotationMatrix &RotMat)
{
G4RotationMatrix *pRotMatrix;
if ( RotMat.isIdentity() )
pRotMatrix= 0;
else{
pRotMatrix= new G4RotationMatrix(RotMat);
}
// fallocatedRotM= ! (RotMat.isIdentity());
G4RotationMatrix *pRotMatrix;
if ( RotMat.isIdentity() )
{
pRotMatrix= 0;
}
else
{
pRotMatrix= new G4RotationMatrix(RotMat);
}
// fallocatedRotM= ! (RotMat.isIdentity());
return pRotMatrix;
return pRotMatrix;
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4PVReplica.cc,v 1.9 2002/10/23 16:26:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4PVReplica Implementation
@@ -22,7 +22,7 @@
//
//
// $Id: G4PhysicalVolumeStore.cc,v 1.9 2002/04/26 16:24:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// G4PhysicalVolumeStore
//
+233
View File
@@ -0,0 +1,233 @@
//
// ********************************************************************
// * 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: G4Region.cc,v 1.7 2003/03/24 10:17:54 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4Region Implementation
#include "G4RegionStore.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include "G4Region.hh"
#include "G4VPVParameterisation.hh"
// *******************************************************************
// Constructor:
// - Adds self to region Store
// *******************************************************************
//
G4Region::G4Region(const G4String& pName)
: fName(pName), fRegionMod(true), fCut(0)
{
G4RegionStore* rStore = G4RegionStore::GetInstance();
if (rStore->GetRegion(pName,false))
{
G4cerr << "WARNING - G4Region::G4Region()" << G4endl
<< " Region " << pName << " already existing in store !"
<< G4endl
<< " The region has NOT been registered !" << G4endl;
}
else
{
rStore->Register(this);
}
}
// *******************************************************************
// Destructor:
// - Removes self from region Store
// *******************************************************************
//
G4Region::~G4Region()
{
G4RegionStore::GetInstance()->DeRegister(this);
}
// *******************************************************************
// ScanVolumeTree:
// - Scans recursively the 'lv' logical volume tree, retrieves
// and places all materials in the list.
// - The boolean flag 'region' identifies if the volume tree must
// have region reset (false) or if the current region must be
// associated to the logical volume 'lv' and its tree (true).
// *******************************************************************
//
void G4Region::ScanVolumeTree(G4LogicalVolume* lv, G4bool region)
{
// If logical volume is going to become a region, add
// its material to the list if not already present
//
G4Region* currentRegion = 0;
size_t noDaughters = lv->GetNoDaughters();
G4Material* volMat = lv->GetMaterial();
G4MaterialList::iterator pos;
if (region)
{
currentRegion = this;
pos = G4std::find(fMaterials.begin(),fMaterials.end(),volMat);
if (pos == fMaterials.end())
{
fMaterials.push_back(volMat);
fRegionMod = true;
}
}
// Set the LV region to be either the current region or NULL,
// according to the boolean selector
//
lv->SetRegion(currentRegion);
// Stop recursion here if no further daughters are involved
//
if(noDaughters==0) return;
G4VPhysicalVolume* daughterPVol = lv->GetDaughter(0);
if (daughterPVol->IsParameterised())
{
// Adopt special treatment in case of parameterised volumes,
// where parameterisation involves a new material scan
//
G4VPVParameterisation* pParam = daughterPVol->GetParameterisation();
size_t repNo = daughterPVol->GetMultiplicity();
for (register size_t rep=0; rep<repNo; rep++)
{
volMat = pParam->ComputeMaterial(rep, daughterPVol);
pos = G4std::find(fMaterials.begin(),fMaterials.end(),volMat);
if (pos == fMaterials.end())
{
fMaterials.push_back(volMat);
fRegionMod = true;
}
}
G4LogicalVolume* daughterLVol = daughterPVol->GetLogicalVolume();
ScanVolumeTree(daughterLVol, region);
}
else
{
for (register size_t i=0; i<noDaughters; i++)
{
G4LogicalVolume* daughterLVol = lv->GetDaughter(i)->GetLogicalVolume();
if (!daughterLVol->IsRootRegion())
{
// Set daughter's LV to be a region and store materials in
// the materials list, if the LV is not already a root region
//
ScanVolumeTree(daughterLVol, region);
}
}
}
}
// *******************************************************************
// AddRootLogicalVolume:
// - Adds a root logical volume and sets its daughters flags as
// regions. It also recomputes the materials list for the region.
// *******************************************************************
//
void G4Region::AddRootLogicalVolume(G4LogicalVolume* lv)
{
// Check the logical volume is not already in the list
//
G4RootLVList::iterator pos;
pos = G4std::find(fRootVolumes.begin(),fRootVolumes.end(),lv);
if (pos == fRootVolumes.end())
{
// Insert the root volume in the list and set it as root region
//
fRootVolumes.push_back(lv);
lv->SetRegionRootFlag(true);
}
// Scan recursively the tree of daugther volumes and set regions
//
ScanVolumeTree(lv, true);
// Set region as modified
//
fRegionMod = true;
}
// *******************************************************************
// RemoveRootLogicalVolume:
// - Removes a root logical volume and resets its daughters flags as
// regions. It also recomputes the materials list for the region.
// *******************************************************************
//
void G4Region::RemoveRootLogicalVolume(G4LogicalVolume* lv)
{
// Find and remove logical volume from the list
//
G4RootLVList::iterator pos;
pos = G4std::find(fRootVolumes.begin(),fRootVolumes.end(),lv);
if (pos != fRootVolumes.end())
{
fRootVolumes.erase(pos);
lv->SetRegionRootFlag(false);
}
// Scan recursively the tree of daugther volumes and reset regions
//
ScanVolumeTree(lv, false);
// Update the materials list
//
UpdateMaterialList();
// Set region as modified
//
fRegionMod = true;
}
// *******************************************************************
// ClearMaterialList:
// - Clears the material list.
// *******************************************************************
//
void G4Region::ClearMaterialList()
{
fMaterials.clear();
}
// *******************************************************************
// UpdateMaterialList:
// - computes material list looping through
// each root logical volume in the region.
// *******************************************************************
//
void G4Region::UpdateMaterialList()
{
// Reset the materials list
//
ClearMaterialList();
// Loop over the root logical volumes and rebuild the list
// of materials from scratch
//
G4RootLVList::iterator pLV;
for (pLV=fRootVolumes.begin(); pLV!=fRootVolumes.end(); pLV++)
{
ScanVolumeTree(*pLV, true);
}
}
@@ -0,0 +1,225 @@
//
// ********************************************************************
// * 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: G4RegionStore.cc,v 1.4 2003/02/07 11:46:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
// G4RegionStore
//
// Implementation for singleton container
//
// History:
// 18.09.02 G.Cosmo Initial version
// ********************************************************************
#include "G4Region.hh"
#include "G4RegionStore.hh"
#include "G4GeometryManager.hh"
// ***************************************************************************
// Static class variables
// ***************************************************************************
//
G4RegionStore* G4RegionStore::fgInstance = 0;
G4bool G4RegionStore::locked = false;
// ***************************************************************************
// Protected constructor: Construct underlying container with
// initial size of 20 entries
// ***************************************************************************
//
G4RegionStore::G4RegionStore()
: G4std::vector<G4Region*>()
{
reserve(20);
}
// ***************************************************************************
// Destructor
// ***************************************************************************
//
G4RegionStore::~G4RegionStore()
{
Clean();
}
// ***************************************************************************
// Delete all elements from the store
// ***************************************************************************
//
void G4RegionStore::Clean()
{
// Do nothing if geometry is closed
//
if (G4GeometryManager::GetInstance()->IsGeometryClosed())
{
G4cout << "WARNING - Attempt to delete the region store"
<< " while geometry closed !" << G4endl;
return;
}
// Locks store for deletion of regions. De-registration will be
// performed at this stage. G4Regions will not de-register themselves.
//
locked = true;
size_t i=0;
G4RegionStore* store = GetInstance();
G4std::vector<G4Region*>::iterator pos;
#ifdef G4GEOMETRY_VOXELDEBUG
G4cout << "Deleting Solids ... ";
#endif
for(pos=store->begin(); pos!=store->end(); pos++)
{
if (*pos) delete *pos; i++;
}
#ifdef G4GEOMETRY_VOXELDEBUG
if (store->size() < i-1)
{ G4cout << "No regions deleted. Already deleted by user ?" << G4endl; }
else
{ G4cout << i-1 << " regions deleted !" << G4endl; }
#endif
locked = false;
store->clear();
}
// ***************************************************************************
// Add Solid to container
// ***************************************************************************
//
void G4RegionStore::Register(G4Region* pRegion)
{
GetInstance()->push_back(pRegion);
}
// ***************************************************************************
// Remove Solid from container
// ***************************************************************************
//
void G4RegionStore::DeRegister(G4Region* pRegion)
{
if (!locked) // Do not de-register if locked !
{
for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
{
if (**i==*pRegion)
{
GetInstance()->erase(i);
break;
}
}
}
}
// ***************************************************************************
// Return ptr to Store, setting if necessary
// ***************************************************************************
//
G4RegionStore* G4RegionStore::GetInstance()
{
static G4RegionStore worldStore;
if (!fgInstance)
{
fgInstance = &worldStore;
}
return fgInstance;
}
// ***************************************************************************
// Loops through all regions to verify if a region has been modified.
// It returns TRUE if just one region is modified.
// ***************************************************************************
//
G4bool G4RegionStore::IsModified() const
{
for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
{
if ((*i)->IsModified()) return true;
}
return false;
}
// ***************************************************************************
// Loops through all regions to reset flag for modification to FALSE.
// Used by the run manager to notify that the physics table has been updated.
// ***************************************************************************
//
void G4RegionStore::ResetRegionModified()
{
for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
{
(*i)->RegionModified(false);
}
}
// ***************************************************************************
// Forces recomputation of material lists in all regions in the store.
// ***************************************************************************
//
void G4RegionStore::UpdateMaterialList()
{
for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
{
(*i)->UpdateMaterialList();
}
}
// ***************************************************************************
// Returns a region through its name specification.
// ***************************************************************************
//
G4Region* G4RegionStore::GetRegion(const G4String& name, G4bool verbose) const
{
for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
{
if ((*i)->GetName() == name)
return *i;
}
if (verbose)
{
G4cerr << "ERROR - G4RegionStore::GetRegion()" << G4endl
<< " Region " << name << " NOT found in store !" << G4endl;
}
return 0;
}
// ***************************************************************************
// Returns a region through its name specification, if it exists.
// If it does not exist it will allocate a new region with the given
// name, delegating the ownership to the caller client.
// ***************************************************************************
//
G4Region* G4RegionStore::FindOrCreateRegion(const G4String& name)
{
G4Region* target = GetRegion(name,false);
if (!target)
{
target = new G4Region(name);
}
return target;
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4SmartVoxelHeader.cc,v 1.20 2002/05/17 17:59:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4SmartVoxelHeader
@@ -22,7 +22,7 @@
//
//
// $Id: G4SmartVoxelNode.cc,v 1.4 2002/04/19 08:20:22 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// Class G4SmartVoxelNode
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4SmartVoxelProxy.cc,v 1.1 2002/04/19 08:20:22 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// Class G4SmartVoxelProxy
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4SmartVoxelStat.cc,v 1.1 2001/10/22 16:08:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// --------------------------------------------------------------------
// GEANT 4 class source file
@@ -22,7 +22,7 @@
//
//
// $Id: G4SolidStore.cc,v 1.9 2002/04/26 16:24:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// G4SolidStore
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4VPVParameterisation.cc,v 1.3 2001/07/11 09:59:21 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// Default implementations for Parameterisations that do not
// parameterise solid and/or material
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VPhysicalVolume.cc,v 1.5 2002/10/14 07:42:26 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// $Id: G4VPhysicalVolume.cc,v 1.6 2003/03/05 18:06:58 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4VPhysicalVolume Implementation
@@ -36,25 +36,27 @@
#include "G4LogicalVolume.hh"
// Constructor: init parameters and register in Store
G4VPhysicalVolume::G4VPhysicalVolume(G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
const G4String& pName,
G4LogicalVolume* pLogical,
G4VPhysicalVolume* pMother)
//
G4VPhysicalVolume::G4VPhysicalVolume( G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
const G4String& pName,
G4LogicalVolume* pLogical,
G4VPhysicalVolume* pMother)
{
ftrans=tlate;
frot=pRot;
SetName(pName);
SetLogicalVolume(pLogical);
SetMother(pMother);
if (pMother) pMother->GetLogicalVolume()->AddDaughter(this);
G4PhysicalVolumeStore::Register(this);
ftrans=tlate;
frot=pRot;
SetName(pName);
SetLogicalVolume(pLogical);
SetMother(pMother);
if (pMother) pMother->GetLogicalVolume()->AddDaughter(this);
G4PhysicalVolumeStore::Register(this);
}
// Destructor - remove from Store
//
G4VPhysicalVolume::~G4VPhysicalVolume()
{
G4PhysicalVolumeStore::DeRegister(this);
G4PhysicalVolumeStore::DeRegister(this);
}
G4int G4VPhysicalVolume::GetMultiplicity() const
+39 -32
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VSolid.cc,v 1.14 2002/10/28 11:25:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// $Id: G4VSolid.cc,v 1.17 2003/03/31 14:18:51 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
// class G4VSolid
//
@@ -30,15 +30,14 @@
//
// History:
//
// 10.05.02 V.Grichine, bug fixed in ClipPoligon: clip only other axis and limited
// voxels
// 15.04.02 V.Grichine, bug fixed in ClipPoligon: clip only one axis
// 06.12.02 V.Grichine, restored original conditions in ClipPolygon()
// 10.05.02 V.Grichine, ClipPolygon(): clip only other axis and limited voxels
// 15.04.02 V.Grichine, bug fixed in ClipPolygon(): clip only one axis
// 13.03.02 V.Grichine, cosmetics of voxel limit functions
// 15.11.00 D.Williams, V.Grichine change in CalculateClippedPolygonExtent:
// else if(component>pMax) ---> if
// 15.11.00 D.Williams, V.Grichine fix in CalculateClippedPolygonExtent()
// 10.07.95 P.Kent Added == operator, solid Store entry
// 30.06.95 P.Kent
//
// 30.06.95 P.Kent Created.
//
#include "G4VSolid.hh"
#include "G4SolidStore.hh"
@@ -52,6 +51,7 @@
// Constructor
// - Copies name
// - Add ourselves to solid Store
G4VSolid::G4VSolid(const G4String& name)
: fshapeName(name)
{
@@ -62,6 +62,7 @@ G4VSolid::G4VSolid(const G4String& name)
//
// Destructor (virtual)
// - Remove ourselves from solid Store
G4VSolid::~G4VSolid()
{
G4SolidStore::GetInstance()->DeRegister(this);
@@ -70,6 +71,7 @@ G4VSolid::~G4VSolid()
//////////////////////////////////////////////////////////////////////////
//
// Streaming operator dumping solid contents
G4std::ostream& operator<< ( G4std::ostream& os, const G4VSolid& e )
{
return e.StreamInfo(os);
@@ -79,11 +81,15 @@ G4std::ostream& operator<< ( G4std::ostream& os, const G4VSolid& e )
//
// Throw exception if ComputeDimensions called for illegal derived class
void G4VSolid::ComputeDimensions(G4VPVParameterisation* p,
const G4int n,
const G4VPhysicalVolume* pRep)
void G4VSolid::ComputeDimensions(G4VPVParameterisation*,
const G4int,
const G4VPhysicalVolume*)
{
G4Exception("G4VSolid::ComputeDimensions called illegally: not overloaded by derived class");
G4cout << "ERROR - Illegal call to G4VSolid::ComputeDimensions()" << G4endl
<< " Method not overloaded by derived class !" << G4endl;
G4cerr << "ERROR - Illegal call to G4VSolid::ComputeDimensions()" << G4endl
<< " Method not overloaded by derived class !" << G4endl;
G4Exception("G4VSolid::ComputeDimensions() - Illegal call");
}
///////////////////////////////////////////////////////////////////////////
@@ -243,13 +249,13 @@ void G4VSolid::CalculateClippedPolygonExtent(G4ThreeVectorList& pPolygon,
void G4VSolid::ClipPolygon( G4ThreeVectorList& pPolygon,
const G4VoxelLimits& pVoxelLimit,
const EAxis pAxis ) const
const EAxis ) const
{
G4ThreeVectorList outputPolygon;
if ( pVoxelLimit.IsLimited() )
{
if (pVoxelLimit.IsXLimited() && pAxis != kXAxis)
if (pVoxelLimit.IsXLimited() ) // && pAxis != kXAxis)
{
G4VoxelLimits simpleLimit1;
simpleLimit1.AddLimit(kXAxis,pVoxelLimit.GetMinXExtent(),kInfinity);
@@ -268,14 +274,14 @@ void G4VSolid::ClipPolygon( G4ThreeVectorList& pPolygon,
if ( !pPolygon.size() ) return;
else outputPolygon.clear();
}
if ( pVoxelLimit.IsYLimited() && pAxis != kYAxis)
if ( pVoxelLimit.IsYLimited() ) // && pAxis != kYAxis)
{
G4VoxelLimits simpleLimit1;
simpleLimit1.AddLimit(kYAxis,pVoxelLimit.GetMinYExtent(),kInfinity);
ClipPolygonToSimpleLimits(pPolygon,outputPolygon,simpleLimit1);
// Must always clear pPolygon - for clip to simpleLimit2 and in case of
// early exit
// Must always clear pPolygon - for clip to simpleLimit2 and in case of
// early exit
pPolygon.clear();
@@ -288,14 +294,14 @@ void G4VSolid::ClipPolygon( G4ThreeVectorList& pPolygon,
if ( !pPolygon.size() ) return;
else outputPolygon.clear();
}
if ( pVoxelLimit.IsZLimited() && pAxis != kZAxis)
if ( pVoxelLimit.IsZLimited() ) // && pAxis != kZAxis)
{
G4VoxelLimits simpleLimit1;
simpleLimit1.AddLimit(kZAxis,pVoxelLimit.GetMinZExtent(),kInfinity);
ClipPolygonToSimpleLimits(pPolygon,outputPolygon,simpleLimit1);
// Must always clear pPolygon - for clip to simpleLimit2 and in case of
// early exit
// Must always clear pPolygon - for clip to simpleLimit2 and in case of
// early exit
pPolygon.clear();
@@ -305,7 +311,7 @@ void G4VSolid::ClipPolygon( G4ThreeVectorList& pPolygon,
simpleLimit2.AddLimit(kZAxis,-kInfinity,pVoxelLimit.GetMaxZExtent());
ClipPolygonToSimpleLimits(outputPolygon,pPolygon,simpleLimit2);
// Return after final clip - no cleanup
// Return after final clip - no cleanup
}
}
}
@@ -326,7 +332,7 @@ void G4VSolid::ClipPolygonToSimpleLimits( G4ThreeVectorList& pPolygon,
for (i = 0 ; i < noVertices ; i++ )
{
vStart = pPolygon[i];
// G4cout<<"i = "<<i<<G4endl;
// G4cout << "i = " << i << G4endl;
if ( i == noVertices-1 ) vEnd = pPolygon[0];
else vEnd = pPolygon[i+1];
@@ -334,14 +340,15 @@ void G4VSolid::ClipPolygonToSimpleLimits( G4ThreeVectorList& pPolygon,
{
if (pVoxelLimit.Inside(vEnd))
{
// vStart and vEnd inside -> output end point
// vStart and vEnd inside -> output end point
//
outputPolygon.push_back(vEnd);
}
else
{
// vStart inside, vEnd outside -> output crossing point
// G4cout<<"vStart inside, vEnd outside"<<G4endl;
// vStart inside, vEnd outside -> output crossing point
//
// G4cout << "vStart inside, vEnd outside" << G4endl;
pVoxelLimit.ClipToLimits(vStart,vEnd);
outputPolygon.push_back(vEnd);
}
@@ -350,9 +357,9 @@ void G4VSolid::ClipPolygonToSimpleLimits( G4ThreeVectorList& pPolygon,
{
if (pVoxelLimit.Inside(vEnd))
{
// vStart outside, vEnd inside -> output inside section
// G4cout<<"vStart outside, vEnd inside"<<G4endl;
// vStart outside, vEnd inside -> output inside section
//
// G4cout << "vStart outside, vEnd inside" << G4endl;
pVoxelLimit.ClipToLimits(vStart,vEnd);
outputPolygon.push_back(vStart);
outputPolygon.push_back(vEnd);
@@ -366,10 +373,10 @@ void G4VSolid::ClipPolygonToSimpleLimits( G4ThreeVectorList& pPolygon,
}
}
const G4VSolid* G4VSolid::GetConstituentSolid(G4int no) const
const G4VSolid* G4VSolid::GetConstituentSolid(G4int) const
{ return 0; }
G4VSolid* G4VSolid::GetConstituentSolid(G4int no)
G4VSolid* G4VSolid::GetConstituentSolid(G4int)
{ return 0; }
const G4DisplacedSolid* G4VSolid::GetDisplacedSolidPtr() const
@@ -22,7 +22,7 @@
//
//
// $Id: G4VoxelLimits.cc,v 1.7 2002/04/19 08:20:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// class G4VoxelLimits
//