Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4LogicalVolume Class Reference

G4LogicalVolume represents a leaf node or unpositioned subtree in the geometry hierarchy. Logical volumes are named, and may have daughters ascribed to them. They are responsible for retrieval of the physical and tracking attributes of the physical volume that it represents: solid, material, magnetic field, and optionally, user limits, sensitive detectors, regions, biasing weights. More...

#include <G4LogicalVolume.hh>

Inheritance diagram for G4LogicalVolume:

Public Member Functions

 G4LogicalVolume (G4VSolid *pSolid, G4Material *pMaterial, const G4String &name, G4FieldManager *pFieldMgr=nullptr, G4VSensitiveDetector *pSDetector=nullptr, G4UserLimits *pULimits=nullptr, G4bool optimise=true)
virtual ~G4LogicalVolume ()
 G4LogicalVolume (const G4LogicalVolume &)=delete
G4LogicalVolumeoperator= (const G4LogicalVolume &)=delete
const G4StringGetName () const
void SetName (const G4String &pName)
std::size_t GetNoDaughters () const
G4VPhysicalVolumeGetDaughter (const std::size_t i) const
void AddDaughter (G4VPhysicalVolume *p)
G4bool IsDaughter (const G4VPhysicalVolume *p) const
G4bool IsAncestor (const G4VPhysicalVolume *p) const
void RemoveDaughter (const G4VPhysicalVolume *p)
void ClearDaughters ()
G4int TotalVolumeEntities () const
EVolume CharacteriseDaughters () const
EVolume DeduceDaughtersType () const
G4VSolidGetSolid () const
void SetSolid (G4VSolid *pSolid)
G4MaterialGetMaterial () const
void SetMaterial (G4Material *pMaterial)
void UpdateMaterial (G4Material *pMaterial)
G4double GetMass (G4bool forced=false, G4bool propagate=true, G4Material *parMaterial=nullptr)
void ResetMass ()
G4FieldManagerGetFieldManager () const
void SetFieldManager (G4FieldManager *pFieldMgr, G4bool forceToAllDaughters)
G4VSensitiveDetectorGetSensitiveDetector () const
void SetSensitiveDetector (G4VSensitiveDetector *pSDetector)
G4UserLimitsGetUserLimits () const
void SetUserLimits (G4UserLimits *pULimits)
G4SmartVoxelHeaderGetVoxelHeader () const
void SetVoxelHeader (G4SmartVoxelHeader *pVoxel)
G4double GetSmartless () const
void SetSmartless (G4double s)
G4bool IsToOptimise () const
void SetOptimisation (G4bool optim)
G4bool IsRootRegion () const
void SetRegionRootFlag (G4bool rreg)
G4bool IsRegion () const
void SetRegion (G4Region *reg)
G4RegionGetRegion () const
void PropagateRegion ()
const G4MaterialCutsCoupleGetMaterialCutsCouple () const
void SetMaterialCutsCouple (G4MaterialCutsCouple *cuts)
G4bool operator== (const G4LogicalVolume &lv) const
const G4VisAttributesGetVisAttributes () const
void SetVisAttributes (const G4VisAttributes *pVA)
void SetVisAttributes (const G4VisAttributes &VA)
G4FastSimulationManagerGetFastSimulationManager () const
void SetBiasWeight (G4double w)
G4double GetBiasWeight () const
virtual G4bool IsExtended () const
G4FieldManagerGetMasterFieldManager () const
G4VSensitiveDetectorGetMasterSensitiveDetector () const
G4VSolidGetMasterSolid () const
G4int GetInstanceID () const
void Lock ()
void InitialiseWorker (G4LogicalVolume *ptrMasterObject, G4VSolid *pSolid, G4VSensitiveDetector *pSDetector)
void TerminateWorker (G4LogicalVolume *ptrMasterObject)
void AssignFieldManager (G4FieldManager *fldMgr)
G4bool ChangeDaughtersType (EVolume atype)
 G4LogicalVolume (__void__ &)

Static Public Member Functions

static const G4LVManagerGetSubInstanceManager ()
static void Clean ()
static G4VSolidGetSolid (G4LVData &instLVdata)
static void SetSolid (G4LVData &instLVdata, G4VSolid *pSolid)

Detailed Description

G4LogicalVolume represents a leaf node or unpositioned subtree in the geometry hierarchy. Logical volumes are named, and may have daughters ascribed to them. They are responsible for retrieval of the physical and tracking attributes of the physical volume that it represents: solid, material, magnetic field, and optionally, user limits, sensitive detectors, regions, biasing weights.

Definition at line 170 of file G4LogicalVolume.hh.

Constructor & Destructor Documentation

◆ G4LogicalVolume() [1/3]

G4LogicalVolume::G4LogicalVolume ( G4VSolid * pSolid,
G4Material * pMaterial,
const G4String & name,
G4FieldManager * pFieldMgr = nullptr,
G4VSensitiveDetector * pSDetector = nullptr,
G4UserLimits * pULimits = nullptr,
G4bool optimise = true )

Constructor for G4LogicalVolume. The solid and material pointer must be non null. The parameters for field, detector and user limits are optional. The volume also enters itself into the logical volume Store. Optimisation of the geometry (voxelisation) for the volume hierarchy is applied by default. For parameterised volumes in the hierarchy, optimisation is -always- applied.

Parameters
[in]pSolidPointer to the associated solid primitive.
[in]pMaterialPointer to the associated material.
[in]nameThe volume name.
[in]pFieldMgrPointer to optional magnetic field manager.
[in]pSDetectorPointer to optional associated sensitive detector.
[in]pULimitsPointer to optional user limits.
[in]optimiseFlag to enable/disable optimisation structure.

Definition at line 72 of file G4LogicalVolume.cc.

79 : fDaughters(0,(G4VPhysicalVolume*)nullptr), fDaughtersVolumeType(kNormal),
80 fOptimise(optimise)
81{
82 // Initialize 'Shadow'/master pointers - for use in copying to workers
83 //
84 fSolid = pSolid;
85 fSensitiveDetector = pSDetector;
86 fFieldManager = pFieldMgr;
87
88 instanceID = subInstanceManager.CreateSubInstance();
89 AssignFieldManager(pFieldMgr);
90
91 G4MT_mass = 0.;
92 G4MT_ccouple = nullptr;
93
94 SetSolid(pSolid);
95 SetMaterial(pMaterial);
96 SetName(name);
97 SetSensitiveDetector(pSDetector);
98 SetUserLimits(pULimits);
99
100 // Initialize 'Shadow' data structure - for use by object persistency
101 //
102 lvdata = new G4LVData();
103 lvdata->fSolid = pSolid;
104 lvdata->fMaterial = pMaterial;
105
106 //
107 // Add to store
108 //
110}
#define G4MT_mass
#define G4MT_ccouple
static void Register(G4LogicalVolume *pVolume)
void SetName(const G4String &pName)
void SetUserLimits(G4UserLimits *pULimits)
void AssignFieldManager(G4FieldManager *fldMgr)
void SetMaterial(G4Material *pMaterial)
void SetSolid(G4VSolid *pSolid)
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)
@ kNormal
Definition geomdefs.hh:84

Referenced by AddDaughter(), G4LogicalCrystalVolume::G4LogicalCrystalVolume(), G4LogicalVolume(), GetMass(), InitialiseWorker(), G4LogicalCrystalVolume::IsLattice(), Lock(), operator=(), operator==(), SetFieldManager(), and TerminateWorker().

◆ ~G4LogicalVolume()

G4LogicalVolume::~G4LogicalVolume ( )
virtual

Destructor. Removes the logical volume from the logical volume Store. This class is NOT meant to act as base class, except for exceptional circumstances of extended types used in the kernel.

Definition at line 138 of file G4LogicalVolume.cc.

139{
140 if (!fLock && fRootRegion) // De-register root region first if not locked
141 { // and flagged as root logical-volume
142 fRegion->RemoveRootLogicalVolume(this, true);
143 }
144 delete lvdata;
146}
static void DeRegister(G4LogicalVolume *pVolume)

◆ G4LogicalVolume() [2/3]

G4LogicalVolume::G4LogicalVolume ( const G4LogicalVolume & )
delete

Copy-constructor and assignment operator not allowed.

◆ G4LogicalVolume() [3/3]

G4LogicalVolume::G4LogicalVolume ( __void__ & )

Fake default constructor for usage restricted to direct object persistency for clients requiring preallocation of memory for persistifiable objects.

Definition at line 117 of file G4LogicalVolume.cc.

118 : fDaughters(0,(G4VPhysicalVolume*)nullptr), fName("")
119{
120 instanceID = subInstanceManager.CreateSubInstance();
121
122 SetSensitiveDetector(nullptr); // G4MT_sdetector = nullptr;
123 SetFieldManager(nullptr, false); // G4MT_fmanager = nullptr;
124
125 G4MT_mass = 0.;
126 G4MT_ccouple = nullptr;
127
128 // Add to store
129 //
131}
void SetFieldManager(G4FieldManager *pFieldMgr, G4bool forceToAllDaughters)

Member Function Documentation

◆ AddDaughter()

void G4LogicalVolume::AddDaughter ( G4VPhysicalVolume * p)

Adds the volume 'p' as a daughter of the current logical volume.

Definition at line 285 of file G4LogicalVolume.cc.

286{
287 EVolume daughterType = pNewDaughter->VolumeType();
288
289 // The type of the navigation needed is determined by the first daughter
290 //
291 if( fDaughters.empty() )
292 {
293 fDaughtersVolumeType = daughterType;
294 }
295 else
296 {
297 // Check consistency of detector description
298
299 // 1. A replica or parameterised volume can have only one daughter
300 //
301 if( fDaughters[0]->IsReplicated() )
302 {
303 std::ostringstream message;
304 message << "ERROR - Attempt to place a volume in a mother volume"
305 << G4endl
306 << " already containing a replicated volume." << G4endl
307 << " A volume can either contain several placements" << G4endl
308 << " or a unique replica or parameterised volume !" << G4endl
309 << " Mother logical volume: " << GetName() << G4endl
310 << " Placing volume: " << pNewDaughter->GetName()
311 << G4endl;
312 G4Exception("G4LogicalVolume::AddDaughter()", "GeomMgt0002",
313 FatalException, message,
314 "Replica or parameterised volume must be the only daughter!");
315 }
316 else
317 {
318 // 2. Ensure that Placement and External physical volumes do not mix
319 //
320 if( daughterType != fDaughtersVolumeType )
321 {
322 std::ostringstream message;
323 message << "ERROR - Attempt to place a volume in a mother volume"
324 << G4endl
325 << " already containing a different type of volume." << G4endl
326 << " A volume can either contain" << G4endl
327 << " - one or more placements, OR" << G4endl
328 << " - one or more 'external' type physical volumes." << G4endl
329 << " Mother logical volume: " << GetName() << G4endl
330 << " Volume being placed: " << pNewDaughter->GetName()
331 << G4endl;
332 G4Exception("G4LogicalVolume::AddDaughter()", "GeomMgt0002",
333 FatalException, message,
334 "Cannot mix placements and external physical volumes !");
335 }
336 }
337 }
338
339 // Invalidate previous calculation of mass - if any - for all threads
340 //
341 G4MT_mass = 0.;
342 fDaughters.push_back(pNewDaughter);
343
344 G4LogicalVolume* pDaughterLogical = pNewDaughter->GetLogicalVolume();
345
346 // Propagate the Field Manager, if the daughter has no field Manager
347 //
348 G4FieldManager* pDaughterFieldManager = pDaughterLogical->GetFieldManager();
349
350 // Avoid propagating the fieldManager pointer if null
351 // and daughter's one is null as well...
352 //
353 if( (G4MT_fmanager != nullptr ) && (pDaughterFieldManager == nullptr) )
354 {
355 pDaughterLogical->SetFieldManager(G4MT_fmanager, false);
356 }
357 if (fRegion != nullptr)
358 {
360 fRegion->RegionModified(true);
361 }
362}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
#define G4MT_fmanager
G4bool IsReplicated() const override
#define G4endl
Definition G4ios.hh:67
G4LogicalVolume(G4VSolid *pSolid, G4Material *pMaterial, const G4String &name, G4FieldManager *pFieldMgr=nullptr, G4VSensitiveDetector *pSDetector=nullptr, G4UserLimits *pULimits=nullptr, G4bool optimise=true)
void PropagateRegion()
G4FieldManager * GetFieldManager() const
const G4String & GetName() const
EVolume
Definition geomdefs.hh:83

Referenced by G4PVDivision(), G4PVDivision(), G4PVDivision(), G4PVDivision(), G4PVParameterised::G4PVParameterised(), G4PVParameterised::G4PVParameterised(), G4PVPlacement::G4PVPlacement(), G4PVPlacement::G4PVPlacement(), G4PVPlacement::G4PVPlacement(), G4PVPlacement::G4PVPlacement(), G4PVReplica(), and G4VExternalPhysicalVolume::G4VExternalPhysicalVolume().

◆ AssignFieldManager()

void G4LogicalVolume::AssignFieldManager ( G4FieldManager * fldMgr)

Sets the Field Manager only at this level (does not push down hierarchy)

Definition at line 244 of file G4LogicalVolume.cc.

245{
246 G4MT_fmanager= fldMgr;
247 if(G4Threading::IsMasterThread()) { fFieldManager = fldMgr; }
248}
G4bool IsMasterThread()

Referenced by G4LogicalVolume(), InitialiseWorker(), and SetFieldManager().

◆ ChangeDaughtersType()

G4bool G4LogicalVolume::ChangeDaughtersType ( EVolume atype)

Changes the type of the daughters volume to be of type 'atype'. Meant for the user adopting an external navigator for the contents of a volume.

Returns
Success (true) or failure (false).

Definition at line 656 of file G4LogicalVolume.cc.

657{
658 G4bool works = false;
659 if( aType == kExternal )
660 {
661 // It is the responsibility of External Navigator to handle types selected
662 //
663 fDaughtersVolumeType = aType;
664 works = true;
665 }
666 else
667 {
668 EVolume expectedVType = DeduceDaughtersType();
669 works = (expectedVType == aType);
670 if ( works )
671 {
672 fDaughtersVolumeType = aType;
673 }
674 }
675 return works;
676}
bool G4bool
Definition G4Types.hh:86
EVolume DeduceDaughtersType() const
@ kExternal
Definition geomdefs.hh:87

◆ CharacteriseDaughters()

EVolume G4LogicalVolume::CharacteriseDaughters ( ) const
inline

Characterises the daughters of this logical volume.

Referenced by G4ITNavigator2::RecheckDistanceToCurrentBoundary().

◆ Clean()

void G4LogicalVolume::Clean ( )
static

Clears memory allocated by sub-instance manager.

Definition at line 202 of file G4LogicalVolume.cc.

203{
204 subInstanceManager.FreeSlave();
205}

Referenced by G4LogicalVolumeStore::~G4LogicalVolumeStore().

◆ ClearDaughters()

void G4LogicalVolume::ClearDaughters ( )

Clears the list of daughters. Used by the physical volume store when the geometry tree is cleared, since modified at run-time.

Definition at line 389 of file G4LogicalVolume.cc.

390{
391 fDaughters.erase(fDaughters.cbegin(), fDaughters.cend());
392 if (fRegion != nullptr)
393 {
394 fRegion->RegionModified(true);
395 }
396 G4MT_mass = 0.;
397}

◆ DeduceDaughtersType()

EVolume G4LogicalVolume::DeduceDaughtersType ( ) const
inline

Utility method used by CharacteriseDaughters().

Referenced by ChangeDaughtersType().

◆ GetBiasWeight()

G4double G4LogicalVolume::GetBiasWeight ( ) const
inline

◆ GetDaughter()

◆ GetFastSimulationManager()

G4FastSimulationManager * G4LogicalVolume::GetFastSimulationManager ( ) const
inline

◆ GetFieldManager()

G4FieldManager * G4LogicalVolume::GetFieldManager ( ) const

Gets current Field Manager pointer.

Definition at line 235 of file G4LogicalVolume.cc.

236{
237 return G4MT_fmanager;
238}

Referenced by AddDaughter(), G4VFieldModel::DescribeYourselfTo(), G4PropagatorInField::FindAndSetFieldManager(), InitialiseWorker(), and SetFieldManager().

◆ GetInstanceID()

◆ GetMass()

G4double G4LogicalVolume::GetMass ( G4bool forced = false,
G4bool propagate = true,
G4Material * parMaterial = nullptr )

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 (by default) to its daughters.

Note
The computation may require a 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. 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). An optional argument to specify a material is also provided.
Parameters
[in]forcedFlag to force recomputation or use cached value.
[in]propagateFlag to limit or not computation to daughters.
[in]parMaterialOptional pointer to a custom material, usually used in parameterisations.

Definition at line 565 of file G4LogicalVolume.cc.

568{
569 // Return the cached non-zero value, if not forced
570 //
571 if ( ((G4MT_mass) != 0.0) && (!forced) ) { return G4MT_mass; }
572
573 // Global density and computed mass associated to the logical
574 // volume without considering its daughters
575 //
576 G4Material* logMaterial = parMaterial != nullptr ? parMaterial : GetMaterial();
577 if (logMaterial == nullptr)
578 {
579 std::ostringstream message;
580 message << "No material associated to the logical volume: "
581 << fName << " !" << G4endl
582 << "Sorry, cannot compute the mass ...";
583 G4Exception("G4LogicalVolume::GetMass()", "GeomMgt0002",
584 FatalException, message);
585 return 0.0;
586 }
587 if ( GetSolid() == nullptr )
588 {
589 std::ostringstream message;
590 message << "No solid is associated to the logical volume: "
591 << fName << " !" << G4endl
592 << "Sorry, cannot compute the mass ...";
593 G4Exception("G4LogicalVolume::GetMass()", "GeomMgt0002",
594 FatalException, message);
595 return 0.0;
596 }
597 G4double globalDensity = logMaterial->GetDensity();
598 G4double motherMass = GetSolid()->GetCubicVolume() * globalDensity;
599 G4double massSum = motherMass;
600
601 // For each daughter in the tree, subtract the mass occupied
602 // and if required by the propagate flag, add the real daughter's
603 // one computed recursively
604
605 for (const auto & physDaughter : fDaughters)
606 {
607 G4LogicalVolume* logDaughter = physDaughter->GetLogicalVolume();
608 G4double subMass = 0.0;
609 G4VSolid* daughterSolid = nullptr;
610 G4Material* daughterMaterial = nullptr;
611
612 // Compute the mass to subtract and to add for each daughter
613 // considering its multiplicity (i.e. replicated or not) and
614 // eventually its parameterisation (by solid and/or by material)
615 //
616 for (auto i=0; i<physDaughter->GetMultiplicity(); ++i)
617 {
618 G4VPVParameterisation* physParam = physDaughter->GetParameterisation();
619 if (physParam != nullptr)
620 {
621 daughterSolid = physParam->ComputeSolid(i, physDaughter);
622 daughterSolid->ComputeDimensions(physParam, i, physDaughter);
623 daughterMaterial = physParam->ComputeMaterial(i, physDaughter);
624 }
625 else
626 {
627 daughterSolid = logDaughter->GetSolid();
628 daughterMaterial = logDaughter->GetMaterial();
629 }
630 subMass = daughterSolid->GetCubicVolume() * globalDensity;
631
632 // Subtract the daughter's portion for the mass and, if required,
633 // add the real daughter's mass computed recursively
634 //
635 massSum -= subMass;
636 if (propagate)
637 {
638 massSum += logDaughter->GetMass(true, true, daughterMaterial);
639 }
640 }
641 }
642 G4MT_mass = massSum;
643 return massSum;
644}
double G4double
Definition G4Types.hh:83
G4VSolid * GetSolid() const
G4double GetMass(G4bool forced=false, G4bool propagate=true, G4Material *parMaterial=nullptr)
G4Material * GetMaterial() const
G4double GetDensity() const
virtual G4Material * ComputeMaterial(const G4int repNo, G4VPhysicalVolume *currentVol, const G4VTouchable *parentTouch=nullptr)
virtual G4VSolid * ComputeSolid(const G4int no, G4VPhysicalVolume *pv)
virtual void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
Definition G4VSolid.cc:136
virtual G4double GetCubicVolume()
Definition G4VSolid.cc:214

Referenced by GetMass(), and G4ASCIITreeSceneHandler::RequestPrimitives().

◆ GetMasterFieldManager()

G4FieldManager * G4LogicalVolume::GetMasterFieldManager ( ) const
inline

Returns current Field Manager for the master thread.

◆ GetMasterSensitiveDetector()

G4VSensitiveDetector * G4LogicalVolume::GetMasterSensitiveDetector ( ) const
inline

Returns current Sensitive Detector for the master thread.

Referenced by G4GDMLWriteStructure::ExportSD().

◆ GetMasterSolid()

G4VSolid * G4LogicalVolume::GetMasterSolid ( ) const
inline

Returns current Solid for the master thread.

Referenced by G4GeometryWorkspace::InitialisePhysicalVolumes().

◆ GetMaterial()

◆ GetMaterialCutsCouple()

const G4MaterialCutsCouple * G4LogicalVolume::GetMaterialCutsCouple ( ) const

◆ GetName()

const G4String & G4LogicalVolume::GetName ( ) const
inline

Returns and sets the name of the logical volume.

Referenced by G4AdjointCrossSurfChecker::AddanExtSurfaceOfAvolume(), AddDaughter(), G4OpenInventorSceneHandler::AddPrimitive(), G4Region::AddRootLogicalVolume(), G4VtkSceneHandler::AddSolid(), G4VBiasingOperator::AttachTo(), G4PVParameterised::CheckOverlaps(), G4PVPlacement::CheckOverlaps(), checkVol(), G4tgbVolume::ConstructG4LogVol(), G4tgbVolume::ConstructG4PhysVol(), G4tgbVolume::ConstructG4Volumes(), G3Division::CreatePVReplica(), G4AdjointCrossSurfChecker::CrossingAnInterfaceBetweenTwoVolumes(), G4RadioactiveDecay::DecayIt(), G4VRadioactiveDecay::DecayIt(), G4RunManagerKernel::DefineWorldVolume(), G4LogicalVolumeStore::DeRegister(), G4ReflectionFactory::Divide(), G4ReflectionFactory::Divide(), G4ReflectionFactory::Divide(), G4GDMLReadStructure::DivisionvolRead(), G4TrajectoryDrawByOriginVolume::Draw(), G4tgbVolumeMgr::DumpG4LogVolLeaf(), G4LogicalSkinSurface::DumpInfo(), G4tgbGeometryDumper::DumpLogVol(), G4tgbGeometryDumper::DumpPhysVol(), G4tgbGeometryDumper::DumpPVPlacement(), G4TrajectoryOriginVolumeFilter::Evaluate(), G4BuildGeom(), G4PVReplica(), G4GDMLRead::GeneratePhysvolName(), G4ITNavigator1::GetLocalExitNormal(), G4ITNavigator2::GetLocalExitNormal(), G4Navigator::GetLocalExitNormal(), G4XrayReflection::GetMeanFreePath(), G4tgbVolumeMgr::GetTopLogVol(), G4tgbVolumeMgr::GetTopPhysVol(), G4GDMLReadStructure::GetWorldVolume(), G4AdjointCrossSurfChecker::GoingInOrOutOfaVolumeByExtSurface(), G4GDMLWriteParamvol::ParamvolAlgorithmWrite(), G4GDMLReadParamvol::ParamvolRead(), G4GDMLWriteParamvol::ParamvolWrite(), G4GDMLReadStructure::PhysvolRead(), G4GDMLWriteStructure::PhysvolWrite(), G4ReflectionFactory::Place(), G4LogicalVolumeStore::Register(), G4tgbVolumeMgr::RegisterMe(), G4RunManager::ReOptimize(), G4GDMLReadStructure::ReplicaRead(), G4ReflectionFactory::Replicate(), G4GDMLWriteStructure::ReplicavolWrite(), G4VoxelisationHelper::ReportVoxelInfo(), G4ASCIITreeSceneHandler::RequestPrimitives(), G4VoxelSafety::SafetyForVoxelHeader(), G4PolarizedAnnihilationModel::SampleSecondaries(), G4PolarizedComptonModel::SampleSecondaries(), G4Region::ScanVolumeTree(), G4VRadioactiveDecay::SelectAllVolumes(), G4VChannelingFastSimCrystalData::SetBendingAngle(), G4VChannelingFastSimCrystalData::SetCrystallineUndulatorParameters(), G4VChannelingFastSimCrystalData::SetCUParameters(), G4FieldBuilder::SetLocalField(), G4VVisCommandGeometrySet::SetLVVisAtts(), G4VChannelingFastSimCrystalData::SetMiscutAngle(), G4VisCommandGeometryRestore::SetNewValue(), G4VUserDetectorConstruction::SetSensitiveDetector(), G4GDMLWriteSetup::SetupWrite(), G4PolarizationManager::SetVolumePolarization(), G4GDMLWriteStructure::SkinSurfaceCache(), G4GDMLRead::StripNames(), G4GDMLWriteStructure::TraverseVolumeTree(), and G4VoxelisationHelper::UndertakeOptimisation().

◆ GetNoDaughters()

◆ GetRegion()

◆ GetSensitiveDetector()

G4VSensitiveDetector * G4LogicalVolume::GetSensitiveDetector ( ) const

◆ GetSmartless()

G4double G4LogicalVolume::GetSmartless ( ) const
inline

Gets and sets the user defined optimisation quality associated to the volume.

◆ GetSolid() [1/2]

G4VSolid * G4LogicalVolume::GetSolid ( ) const

Gets and sets the current solid.

Definition at line 417 of file G4LogicalVolume.cc.

418{
419 return this->GetSolid( subInstanceManager.offset[instanceID] );
420}

Referenced by G4AdjointCrossSurfChecker::AddanExtSurfaceOfAvolume(), G4PseudoScene::AddCompound(), G4VSceneHandler::AddCompound(), G4GMocrenFileSceneHandler::AddPrimitive(), G4GMocrenFileSceneHandler::AddSolid(), G4ReplicaNavigation::BackLocate(), G4PhantomParameterisation::BuildContainerSolid(), G4PVParameterised::CheckOverlaps(), G4PVPlacement::CheckOverlaps(), G4GeometryWorkspace::CloneReplicaSolid(), G4NormalNavigation::ComputeSafety(), G4ParameterisedNavigation::ComputeSafety(), G4ReplicaNavigation::ComputeSafety(), G4VoxelNavigation::ComputeSafety(), G4VoxelSafety::ComputeSafety(), G4PhantomParameterisation::ComputeSolid(), G4VNestedParameterisation::ComputeSolid(), G4VPVParameterisation::ComputeSolid(), G4ITNavigator1::ComputeStep(), G4ITNavigator2::ComputeStep(), G4Navigator::ComputeStep(), G4NormalNavigation::ComputeStep(), G4ParameterisedNavigation::ComputeStep(), G4ReplicaNavigation::ComputeStep(), G4VoxelNavigation::ComputeStep(), G4RegularNavigation::ComputeStepSkippingEqualMaterials(), G4tgbVolume::ConstructG4PhysVol(), G4TheRayTracer::CreateBitMap(), G3Division::CreatePVReplica(), G4LogicalVolumeModel::DescribeYourselfTo(), G4VFieldModel::DescribeYourselfTo(), G4ChannelingFastSimModel::DoIt(), G4VisManager::Draw(), G4tgbGeometryDumper::DumpLogVol(), G4Navigator::GetGlobalExitNormal(), G4ITNavigator1::GetLocalExitNormal(), G4ITNavigator2::GetLocalExitNormal(), G4Navigator::GetLocalExitNormal(), GetMass(), G4ITTransportationManager::GetParallelWorld(), G4TransportationManager::GetParallelWorld(), GetSolid(), G4BOptnForceCommonTruncatedExp::Initialize(), G4ChannelingFastSimModel::ModelTrigger(), G4GDMLWriteParamvol::ParametersWrite(), G4ElNeutrinoNucleusProcess::PostStepDoIt(), G4MuNeutrinoNucleusProcess::PostStepDoIt(), G4NeutrinoElectronProcess::PostStepDoIt(), G4TauNeutrinoNucleusProcess::PostStepDoIt(), G4NavigationLogger::PreComputeStepLog(), G4PSFlatSurfaceCurrent::ProcessHits(), G4PSFlatSurfaceFlux::ProcessHits(), G4PSSphereSurfaceFlux::ProcessHits(), G4PSVolumeFlux::ProcessHits(), G4ITNavigator2::RecheckDistanceToCurrentBoundary(), G4NavigationLogger::ReportOutsideMother(), G4NavigationLogger::ReportVolumeAndIntersection(), G4VoxelSafety::SafetyForVoxelHeader(), G4VoxelSafety::SafetyForVoxelNode(), G4VChannelingFastSimCrystalData::SetBendingAngle(), G4VisCommandsTouchable::SetNewValue(), G4GeomTestVolume::TestOverlapInTree(), and G4GDMLWriteStructure::TraverseVolumeTree().

◆ GetSolid() [2/2]

G4VSolid * G4LogicalVolume::GetSolid ( G4LVData & instLVdata)
static

Optimised methods, passing thread instance of worker data.

Definition at line 412 of file G4LogicalVolume.cc.

413{
414 return instLVdata.fSolid;
415}
G4VSolid * fSolid

◆ GetSubInstanceManager()

const G4LVManager & G4LogicalVolume::GetSubInstanceManager ( )
static

Returns the private data instance manager.

Definition at line 226 of file G4LogicalVolume.cc.

227{
228 return subInstanceManager;
229}

Referenced by G4GeometryWorkspace::G4GeometryWorkspace().

◆ GetUserLimits()

◆ GetVisAttributes()

const G4VisAttributes * G4LogicalVolume::GetVisAttributes ( ) const

◆ GetVoxelHeader()

◆ InitialiseWorker()

void G4LogicalVolume::InitialiseWorker ( G4LogicalVolume * ptrMasterObject,
G4VSolid * pSolid,
G4VSensitiveDetector * pSDetector )

This method is similar to the constructor. It is used by each worker thread to achieve the partial effect as that of the master thread.

Definition at line 168 of file G4LogicalVolume.cc.

172{
173 subInstanceManager.SlaveCopySubInstanceArray();
174
175 SetSolid(pSolid);
176 SetSensitiveDetector(pSDetector); // How this object is available now ?
177 AssignFieldManager(fFieldManager);
178 // Should be set - but a per-thread copy is not available yet
179 // Must not call SetFieldManager(), which propagates FieldMgr
180
181#ifdef CLONE_FIELD_MGR
182 // Create a field FieldManager by cloning
183 //
184 G4FieldManager workerFldMgr = fFieldManager->GetWorkerClone(G4bool* created);
185 if( created || (GetFieldManager() != workerFldMgr) )
186 {
187 SetFieldManager(fFieldManager, false); // which propagates FieldMgr
188 }
189 else
190 {
191 // Field manager existed and is equal to current one
192 //
193 AssignFieldManager(workerFldMgr);
194 }
195#endif
196}

Referenced by G4GeometryWorkspace::CloneReplicaSolid(), and G4GeometryWorkspace::InitialisePhysicalVolumes().

◆ IsAncestor()

G4bool G4LogicalVolume::IsAncestor ( const G4VPhysicalVolume * p) const

Returns true if the volume 'p' is part of the hierarchy of volumes established by the current logical volume. Scans recursively the volume tree.

Definition at line 514 of file G4LogicalVolume.cc.

515{
516 G4bool isDaughter = IsDaughter(aVolume);
517 if (!isDaughter)
518 {
519 for (const auto & daughter : fDaughters)
520 {
521 isDaughter = daughter->GetLogicalVolume()->IsAncestor(aVolume);
522 if (isDaughter) { break; }
523 }
524 }
525 return isDaughter;
526}
G4bool IsDaughter(const G4VPhysicalVolume *p) const

◆ IsDaughter()

G4bool G4LogicalVolume::IsDaughter ( const G4VPhysicalVolume * p) const
inline

Returns true if the volume 'p' is a daughter of the current logical volume.

Referenced by IsAncestor().

◆ IsExtended()

G4bool G4LogicalVolume::IsExtended ( ) const
virtual

Returns true if it is not a base-class object.

Reimplemented in G4LogicalCrystalVolume.

Definition at line 254 of file G4LogicalVolume.cc.

255{
256 return false;
257}

◆ IsRegion()

G4bool G4LogicalVolume::IsRegion ( ) const
inline

Replies if the logical volume is part of a cuts region or not.

◆ IsRootRegion()

G4bool G4LogicalVolume::IsRootRegion ( ) const
inline

Replies if the logical volume represents a root region or not.

Referenced by G4Region::AddRootLogicalVolume(), and G4Region::ScanVolumeTree().

◆ IsToOptimise()

G4bool G4LogicalVolume::IsToOptimise ( ) const
inline

Replies if the geometry optimisation (voxelisation) is to be applied for this volume hierarchy.

◆ Lock()

void G4LogicalVolume::Lock ( )
inline

Sets lock identifier for final deletion of entity.

◆ operator=()

G4LogicalVolume & G4LogicalVolume::operator= ( const G4LogicalVolume & )
delete

◆ operator==()

G4bool G4LogicalVolume::operator== ( const G4LogicalVolume & lv) const

Equality defined by address only. Returns true if objects are at same address, else false.

◆ PropagateRegion()

void G4LogicalVolume::PropagateRegion ( )
inline

Propagates region pointer to daughters.

Referenced by AddDaughter().

◆ RemoveDaughter()

void G4LogicalVolume::RemoveDaughter ( const G4VPhysicalVolume * p)

Removes the volume 'p' from the list of daughters of the current logical volume.

Definition at line 368 of file G4LogicalVolume.cc.

369{
370 for (auto i=fDaughters.cbegin(); i!=fDaughters.cend(); ++i )
371 {
372 if (**i==*p)
373 {
374 fDaughters.erase(i);
375 break;
376 }
377 }
378 if (fRegion != nullptr)
379 {
380 fRegion->RegionModified(true);
381 }
382 G4MT_mass = 0.;
383}

Referenced by G4PhysicalVolumeStore::DeRegister().

◆ ResetMass()

void G4LogicalVolume::ResetMass ( )

Resets the cached value of mass. Ensures that cached value of mass is invalidated due to change in state, e.g. change of the size of the solid, change of the type of solid, or the addition/deletion of a daughter volume.

Definition at line 403 of file G4LogicalVolume.cc.

404{
405 G4MT_mass= 0.0;
406}

Referenced by SetSolid().

◆ SetBiasWeight()

void G4LogicalVolume::SetBiasWeight ( G4double w)
inline

Sets and gets the bias weight.

◆ SetFieldManager()

void G4LogicalVolume::SetFieldManager ( G4FieldManager * pFieldMgr,
G4bool forceToAllDaughters )

Sets the Field Manager and propagates it.

Parameters
[in]pFieldMgrPointer to the field manager.
[in]forceToAllDaughtersFlag to force propagation to all daughters (true), or only to daughters having null pointer to the field manager (false).

Definition at line 264 of file G4LogicalVolume.cc.

266{
267 AssignFieldManager(pNewFieldMgr);
268
269 auto NoDaughters = GetNoDaughters();
270 while ( (NoDaughters--)>0 )
271 {
272 G4LogicalVolume* DaughterLogVol;
273 DaughterLogVol = GetDaughter(NoDaughters)->GetLogicalVolume();
274 if ( forceAllDaughters || (DaughterLogVol->GetFieldManager() == nullptr) )
275 {
276 DaughterLogVol->SetFieldManager(pNewFieldMgr, forceAllDaughters);
277 }
278 }
279}
std::size_t GetNoDaughters() const
G4VPhysicalVolume * GetDaughter(const std::size_t i) const
G4LogicalVolume * GetLogicalVolume() const

Referenced by AddDaughter(), G4LogicalVolume(), InitialiseWorker(), SetFieldManager(), and G4WorkerThread::UpdateGeometryAndPhysicsVectorFromMaster().

◆ SetMaterial()

void G4LogicalVolume::SetMaterial ( G4Material * pMaterial)

Definition at line 452 of file G4LogicalVolume.cc.

453{
454 G4MT_material = pMaterial;
455 G4MT_mass = 0.0;
456}

Referenced by G4LogicalVolume(), and G4ScoreSplittingProcess::PostStepDoIt().

◆ SetMaterialCutsCouple()

void G4LogicalVolume::SetMaterialCutsCouple ( G4MaterialCutsCouple * cuts)

Definition at line 501 of file G4LogicalVolume.cc.

502{
503 G4MT_ccouple = cuts;
504}

◆ SetName()

void G4LogicalVolume::SetName ( const G4String & pName)

Definition at line 152 of file G4LogicalVolume.cc.

153{
154 fName = pName;
156}
static G4LogicalVolumeStore * GetInstance()

Referenced by G4LogicalVolume(), and G4GDMLRead::StripNames().

◆ SetOptimisation()

void G4LogicalVolume::SetOptimisation ( G4bool optim)
inline

Specifies if to apply or not geometry optimisation to the volume hierarchy. For parameterised volumes in the hierarchy, optimisation is always applied.

◆ SetRegion()

void G4LogicalVolume::SetRegion ( G4Region * reg)
inline

◆ SetRegionRootFlag()

void G4LogicalVolume::SetRegionRootFlag ( G4bool rreg)
inline

Sets/unsets the volume as a root region for cuts.

Referenced by G4Region::AddRootLogicalVolume(), and G4Region::RemoveRootLogicalVolume().

◆ SetSensitiveDetector()

void G4LogicalVolume::SetSensitiveDetector ( G4VSensitiveDetector * pSDetector)

◆ SetSmartless()

void G4LogicalVolume::SetSmartless ( G4double s)
inline

◆ SetSolid() [1/2]

void G4LogicalVolume::SetSolid ( G4LVData & instLVdata,
G4VSolid * pSolid )
static

Definition at line 433 of file G4LogicalVolume.cc.

434{
435 instLVdata.fSolid = pSolid;
436 instLVdata.fMass = 0.0;
437}
G4double fMass

◆ SetSolid() [2/2]

◆ SetUserLimits()

void G4LogicalVolume::SetUserLimits ( G4UserLimits * pULimits)
inline

Referenced by G4LogicalVolume().

◆ SetVisAttributes() [1/2]

void G4LogicalVolume::SetVisAttributes ( const G4VisAttributes & VA)

Definition at line 682 of file G4LogicalVolume.cc.

683{
684 if (G4Threading::IsWorkerThread()) { return; }
685 fVisAttributes = std::make_shared<const G4VisAttributes>(VA);
686}
G4bool IsWorkerThread()

◆ SetVisAttributes() [2/2]

void G4LogicalVolume::SetVisAttributes ( const G4VisAttributes * pVA)

Definition at line 692 of file G4LogicalVolume.cc.

693{
694 if (G4Threading::IsWorkerThread()) { return; }
695 fVisAttributes = std::shared_ptr<const G4VisAttributes>(pVA,[](const G4VisAttributes*){});
696}

Referenced by G4tgbVolume::ConstructG4LogVol(), G4BuildGeom(), G4GDMLReadStructure::GetWorldVolume(), G4VVisCommandGeometrySet::SetLVVisAtts(), G4VisCommandGeometryRestore::SetNewValue(), G4ScoringBox::SetupGeometry(), and G4ScoringCylinder::SetupGeometry().

◆ SetVoxelHeader()

void G4LogicalVolume::SetVoxelHeader ( G4SmartVoxelHeader * pVoxel)
inline

◆ TerminateWorker()

void G4LogicalVolume::TerminateWorker ( G4LogicalVolume * ptrMasterObject)

This method is similar to the destructor. It is used by each worker thread to achieve the partial effect as that of the master thread.

Definition at line 215 of file G4LogicalVolume.cc.

217{
218}

Referenced by G4GeometryWorkspace::DestroyWorkspace().

◆ TotalVolumeEntities()

G4int G4LogicalVolume::TotalVolumeEntities ( ) const

Returns the total number of physical volumes (replicated or placed) in the tree represented by the current logical volume.

Definition at line 535 of file G4LogicalVolume.cc.

536{
537 G4int vols = 1;
538 for (auto physDaughter : fDaughters)
539 {
540 vols += physDaughter->GetMultiplicity()
541 *physDaughter->GetLogicalVolume()->TotalVolumeEntities();
542 }
543 return vols;
544}
int G4int
Definition G4Types.hh:85

◆ UpdateMaterial()

void G4LogicalVolume::UpdateMaterial ( G4Material * pMaterial)

Sets the material and corresponding Material-Cuts-Couple. This method is invoked by G4Navigator while it is navigating through material parameterisation.

Definition at line 462 of file G4LogicalVolume.cc.

463{
464 G4MT_material=pMaterial;
465 if (fRegion != nullptr) { G4MT_ccouple = fRegion->FindCouple(pMaterial); }
466 G4MT_mass = 0.0;
467}

Referenced by G4ParameterisedNavigation::LevelLocate(), G4RegularNavigation::LevelLocate(), G4ITNavigator1::LocateGlobalPointAndSetup(), G4ITNavigator2::LocateGlobalPointAndSetup(), G4Navigator::LocateGlobalPointAndSetup(), G4ITNavigator1::SetupHierarchy(), G4ITNavigator2::SetupHierarchy(), and G4Navigator::SetupHierarchy().


The documentation for this class was generated from the following files: