Import Geant4 8.0.0 source tree
This commit is contained in:
@@ -21,8 +21,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4LogicalVolume.cc,v 1.28 2005/05/25 14:57:52 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-07-01 $
|
||||
// $Id: G4LogicalVolume.cc,v 1.30 2005/11/09 14:54:03 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-08-00 $
|
||||
//
|
||||
//
|
||||
// class G4LogicalVolume Implementation
|
||||
@@ -60,8 +60,7 @@ G4LogicalVolume::G4LogicalVolume( G4VSolid* pSolid,
|
||||
G4bool optimise )
|
||||
: fDaughters(0,(G4VPhysicalVolume*)0), fFieldManager(pFieldMgr),
|
||||
fVoxel(0), fOptimise(optimise), fRootRegion(false), fSmartless(2.),
|
||||
fMass(0.), fVisAttributes(0), fFastSimulationManager(0), fRegion(0),
|
||||
fCutsCouple(0), fIsEnvelope(false)
|
||||
fMass(0.), fVisAttributes(0), fRegion(0), fCutsCouple(0)
|
||||
{
|
||||
SetSolid(pSolid);
|
||||
SetMaterial(pMaterial);
|
||||
@@ -69,7 +68,23 @@ G4LogicalVolume::G4LogicalVolume( G4VSolid* pSolid,
|
||||
SetSensitiveDetector(pSDetector);
|
||||
SetUserLimits(pULimits);
|
||||
//
|
||||
// Add to solid Store
|
||||
// Add to store
|
||||
//
|
||||
G4LogicalVolumeStore::Register(this);
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// Fake default constructor - sets only member data and allocates memory
|
||||
// for usage restricted to object persistency.
|
||||
// ********************************************************************
|
||||
//
|
||||
G4LogicalVolume::G4LogicalVolume( __void__& )
|
||||
: fDaughters(0,(G4VPhysicalVolume*)0), fFieldManager(0),
|
||||
fMaterial(0), fName(""), fSensitiveDetector(0), fSolid(0), fUserLimits(0),
|
||||
fVoxel(0), fOptimise(true), fRootRegion(false), fSmartless(2.),
|
||||
fMass(0.), fVisAttributes(0), fRegion(0), fCutsCouple(0), fBiasWeight(0.)
|
||||
{
|
||||
// Add to store
|
||||
//
|
||||
G4LogicalVolumeStore::Register(this);
|
||||
}
|
||||
@@ -85,74 +100,6 @@ G4LogicalVolume::~G4LogicalVolume()
|
||||
G4LogicalVolumeStore::DeRegister(this);
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// SetFastSimulationManager
|
||||
//
|
||||
// NOTE: recursive method, not inlined.
|
||||
// ********************************************************************
|
||||
//
|
||||
void
|
||||
G4LogicalVolume::
|
||||
SetFastSimulationManager( G4FastSimulationManager* pNewFastSimul,
|
||||
G4bool IsEnvelope )
|
||||
{
|
||||
if( !fIsEnvelope || IsEnvelope )
|
||||
{
|
||||
fIsEnvelope = IsEnvelope;
|
||||
fFastSimulationManager = pNewFastSimul;
|
||||
|
||||
G4int NoDaughters = GetNoDaughters();
|
||||
while ( (NoDaughters--)>0 )
|
||||
{
|
||||
G4LogicalVolume* DaughterLogVol;
|
||||
DaughterLogVol = GetDaughter(NoDaughters)->GetLogicalVolume();
|
||||
if( DaughterLogVol->GetFastSimulationManager() != pNewFastSimul )
|
||||
{
|
||||
DaughterLogVol->SetFastSimulationManager(pNewFastSimul,false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// ClearEnvelopeForFastSimulation
|
||||
// ********************************************************************
|
||||
//
|
||||
void
|
||||
G4LogicalVolume::ClearEnvelopeForFastSimulation( G4LogicalVolume* motherLogVol )
|
||||
{
|
||||
if( fIsEnvelope )
|
||||
{
|
||||
G4FastSimulationManager* NewFastSimulationVal = 0;
|
||||
|
||||
// This is no longer an envelope !
|
||||
//
|
||||
fIsEnvelope = false;
|
||||
|
||||
if( motherLogVol == 0 )
|
||||
{
|
||||
motherLogVol = this->FindMotherLogicalVolumeForEnvelope();
|
||||
}
|
||||
|
||||
// Reset its ParameterisedSimulation values and those of all daughters
|
||||
// (after ensuring the mother was given correctly or was found)
|
||||
//
|
||||
if( motherLogVol != 0 )
|
||||
{
|
||||
NewFastSimulationVal = motherLogVol->GetFastSimulationManager();
|
||||
SetFastSimulationManager(NewFastSimulationVal, false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
G4cerr << "ERROR - Called ClearEnvelope() for non-envelope logical volume!"
|
||||
<< G4endl;
|
||||
G4Exception("G4LogicalVolume::ClearEnvelopeForFastSimulation()",
|
||||
"NotApplicable", FatalException,
|
||||
"Cannot be called for non-envelope logical volumes.");
|
||||
}
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// SetFieldManager
|
||||
// ********************************************************************
|
||||
@@ -199,42 +146,6 @@ G4LogicalVolume::IsAncestor(const G4VPhysicalVolume* aVolume) const
|
||||
return isDaughter;
|
||||
}
|
||||
|
||||
|
||||
// ********************************************************************
|
||||
// FindMotherLogicalVolumeForEnvelope
|
||||
//
|
||||
// Returns a meaningful result IF and only IF the current logical
|
||||
// volume has exactly one physical volume that uses it.
|
||||
// ********************************************************************
|
||||
//
|
||||
G4LogicalVolume*
|
||||
G4LogicalVolume::FindMotherLogicalVolumeForEnvelope()
|
||||
{
|
||||
G4LogicalVolume* motherLogVol = 0;
|
||||
G4LogicalVolumeStore* Store = G4LogicalVolumeStore::GetInstance();
|
||||
|
||||
// Look for the current volume's mother volume.
|
||||
//
|
||||
for ( size_t LV=0; LV < Store->size(); LV++ )
|
||||
{
|
||||
G4LogicalVolume* aLogVol = (*Store)[LV]; // Don't look for it inside itself!
|
||||
if( (aLogVol!=this) && (aLogVol->GetFastSimulationManager()!=0) )
|
||||
{
|
||||
for ( G4int daughter=0; daughter<aLogVol->GetNoDaughters(); daughter++ )
|
||||
{
|
||||
if( aLogVol->GetDaughter(daughter)->GetLogicalVolume()==this )
|
||||
{
|
||||
// aLogVol is the mother !!!
|
||||
//
|
||||
motherLogVol = aLogVol;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return motherLogVol;
|
||||
}
|
||||
|
||||
// ********************************************************************
|
||||
// TotalVolumeEntities
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user