54#define G4MT_solid ((subInstanceManager.offset[instanceID]).fSolid)
55#define G4MT_sdetector ((subInstanceManager.offset[instanceID]).fSensitiveDetector)
56#define G4MT_fmanager ((subInstanceManager.offset[instanceID]).fFieldManager)
57#define G4MT_material ((subInstanceManager.offset[instanceID]).fMaterial)
58#define G4MT_mass ((subInstanceManager.offset[instanceID]).fMass)
59#define G4MT_ccouple ((subInstanceManager.offset[instanceID]).fCutsCouple)
60#define G4MT_instance (subInstanceManager.offset[instanceID])
81 fSensitiveDetector = pSDetector;
82 fFieldManager = pFieldMgr;
136 if (!fLock && fRootRegion)
167#ifdef CLONE_FIELD_MGR
214 return subInstanceManager;
256 while ( (NoDaughters--)>0 )
260 if ( forceAllDaughters || (DaughterLogVol->
GetFieldManager() ==
nullptr) )
277 if( fDaughters.empty() )
279 fDaughtersVolumeType = daughterType;
287 if( fDaughters[0]->IsReplicated() )
289 std::ostringstream message;
290 message <<
"ERROR - Attempt to place a volume in a mother volume"
292 <<
" already containing a replicated volume." <<
G4endl
293 <<
" A volume can either contain several placements" <<
G4endl
294 <<
" or a unique replica or parameterised volume !" <<
G4endl
296 <<
" Placing volume: " << pNewDaughter->
GetName()
298 G4Exception(
"G4LogicalVolume::AddDaughter()",
"GeomMgt0002",
300 "Replica or parameterised volume must be the only daughter!");
306 if( daughterType != fDaughtersVolumeType )
308 std::ostringstream message;
309 message <<
"ERROR - Attempt to place a volume in a mother volume"
311 <<
" already containing a different type of volume." <<
G4endl
312 <<
" A volume can either contain" <<
G4endl
313 <<
" - one or more placements, OR" <<
G4endl
314 <<
" - one or more 'external' type physical volumes." <<
G4endl
316 <<
" Volume being placed: " << pNewDaughter->
GetName()
318 G4Exception(
"G4LogicalVolume::AddDaughter()",
"GeomMgt0002",
320 "Cannot mix placements and external physical volumes !");
328 fDaughters.push_back(pNewDaughter);
339 if( (
G4MT_fmanager !=
nullptr ) && (pDaughterFieldManager ==
nullptr) )
356 for (
auto i=fDaughters.cbegin(); i!=fDaughters.cend(); ++i )
377 fDaughters.erase(fDaughters.cbegin(), fDaughters.cend());
378 if (fRegion !=
nullptr)
421 instLVdata.
fSolid = pSolid;
422 instLVdata.
fMass = 0.0;
505 for (
auto itDau = fDaughters.cbegin(); itDau != fDaughters.cend(); ++itDau)
507 isDaughter = (*itDau)->GetLogicalVolume()->IsAncestor(aVolume);
508 if (isDaughter)
break;
524 for (
auto itDau = fDaughters.cbegin(); itDau != fDaughters.cend(); ++itDau)
564 if (logMaterial ==
nullptr)
566 std::ostringstream message;
567 message <<
"No material associated to the logical volume: "
568 << fName <<
" !" <<
G4endl
569 <<
"Sorry, cannot compute the mass ...";
570 G4Exception(
"G4LogicalVolume::GetMass()",
"GeomMgt0002",
576 std::ostringstream message;
577 message <<
"No solid is associated to the logical volume: "
578 << fName <<
" !" <<
G4endl
579 <<
"Sorry, cannot compute the mass ...";
580 G4Exception(
"G4LogicalVolume::GetMass()",
"GeomMgt0002",
592 for (
auto itDau = fDaughters.cbegin(); itDau != fDaughters.cend(); ++itDau)
609 daughterSolid = physParam->
ComputeSolid(i, physDaughter);
615 daughterSolid = logDaughter->
GetSolid();
626 massSum += logDaughter->
GetMass(
true,
true, daughterMaterial);
656 fDaughtersVolumeType = aType;
662 works = (expectedVType == aType);
665 fDaughtersVolumeType = aType;
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
static G4GEOM_DLL G4ThreadLocal T * offset
G4int CreateSubInstance()
void SlaveCopySubInstanceArray()
static void DeRegister(G4LogicalVolume *pVolume)
static void Register(G4LogicalVolume *pVolume)
G4VSolid * GetSolid() const
G4double GetMass(G4bool forced=false, G4bool propagate=true, G4Material *parMaterial=nullptr)
void SetName(const G4String &pName)
G4bool IsAncestor(const G4VPhysicalVolume *p) const
void SetFieldManager(G4FieldManager *pFieldMgr, G4bool forceToAllDaughters)
void AddDaughter(G4VPhysicalVolume *p)
void SetUserLimits(G4UserLimits *pULimits)
G4VSensitiveDetector * GetSensitiveDetector() const
void TerminateWorker(G4LogicalVolume *ptrMasterObject)
virtual ~G4LogicalVolume()
void RemoveDaughter(const G4VPhysicalVolume *p)
size_t GetNoDaughters() const
EVolume DeduceDaughtersType() const
virtual G4bool IsExtended() const
G4bool ChangeDaughtersType(EVolume atype)
static const G4LVManager & GetSubInstanceManager()
G4LogicalVolume(G4VSolid *pSolid, G4Material *pMaterial, const G4String &name, G4FieldManager *pFieldMgr=nullptr, G4VSensitiveDetector *pSDetector=nullptr, G4UserLimits *pULimits=nullptr, G4bool optimise=true)
G4bool IsDaughter(const G4VPhysicalVolume *p) const
G4Material * GetMaterial() const
G4VPhysicalVolume * GetDaughter(const G4int i) const
void InitialiseWorker(G4LogicalVolume *ptrMasterObject, G4VSolid *pSolid, G4VSensitiveDetector *pSDetector)
G4FieldManager * GetFieldManager() const
void SetVisAttributes(const G4VisAttributes *pVA)
G4int TotalVolumeEntities() const
const G4String & GetName() const
const G4MaterialCutsCouple * GetMaterialCutsCouple() const
void AssignFieldManager(G4FieldManager *fldMgr)
void SetMaterial(G4Material *pMaterial)
void SetSolid(G4VSolid *pSolid)
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)
void SetMaterialCutsCouple(G4MaterialCutsCouple *cuts)
void UpdateMaterial(G4Material *pMaterial)
G4double GetDensity() const
void RemoveRootLogicalVolume(G4LogicalVolume *lv, G4bool scan=true)
G4MaterialCutsCouple * FindCouple(G4Material *mat)
void RegionModified(G4bool flag)
virtual G4VSolid * ComputeSolid(const G4int, G4VPhysicalVolume *)
virtual G4Material * ComputeMaterial(const G4int repNo, G4VPhysicalVolume *currentVol, const G4VTouchable *parentTouch=nullptr)
virtual EVolume VolumeType() const =0
G4LogicalVolume * GetLogicalVolume() const
virtual G4int GetMultiplicity() const
const G4String & GetName() const
virtual G4VPVParameterisation * GetParameterisation() const =0
virtual void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
virtual G4double GetCubicVolume()