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)
177#ifdef CLONE_FIELD_MGR
224 return subInstanceManager;
266 while ( (NoDaughters--)>0 )
270 if ( forceAllDaughters || (DaughterLogVol->
GetFieldManager() ==
nullptr) )
287 if( fDaughters.empty() )
289 fDaughtersVolumeType = daughterType;
297 if( fDaughters[0]->IsReplicated() )
299 std::ostringstream message;
300 message <<
"ERROR - Attempt to place a volume in a mother volume"
302 <<
" already containing a replicated volume." <<
G4endl
303 <<
" A volume can either contain several placements" <<
G4endl
304 <<
" or a unique replica or parameterised volume !" <<
G4endl
306 <<
" Placing volume: " << pNewDaughter->
GetName()
308 G4Exception(
"G4LogicalVolume::AddDaughter()",
"GeomMgt0002",
310 "Replica or parameterised volume must be the only daughter!");
316 if( daughterType != fDaughtersVolumeType )
318 std::ostringstream message;
319 message <<
"ERROR - Attempt to place a volume in a mother volume"
321 <<
" already containing a different type of volume." <<
G4endl
322 <<
" A volume can either contain" <<
G4endl
323 <<
" - one or more placements, OR" <<
G4endl
324 <<
" - one or more 'external' type physical volumes." <<
G4endl
326 <<
" Volume being placed: " << pNewDaughter->
GetName()
328 G4Exception(
"G4LogicalVolume::AddDaughter()",
"GeomMgt0002",
330 "Cannot mix placements and external physical volumes !");
338 fDaughters.push_back(pNewDaughter);
349 if( (
G4MT_fmanager !=
nullptr ) && (pDaughterFieldManager ==
nullptr) )
353 if (fRegion !=
nullptr)
366 for (
auto i=fDaughters.cbegin(); i!=fDaughters.cend(); ++i )
374 if (fRegion !=
nullptr)
387 fDaughters.erase(fDaughters.cbegin(), fDaughters.cend());
388 if (fRegion !=
nullptr)
431 instLVdata.
fSolid = pSolid;
432 instLVdata.
fMass = 0.0;
515 for (
auto itDau = fDaughters.cbegin(); itDau != fDaughters.cend(); ++itDau)
517 isDaughter = (*itDau)->GetLogicalVolume()->IsAncestor(aVolume);
518 if (isDaughter)
break;
534 for (
auto itDau = fDaughters.cbegin(); itDau != fDaughters.cend(); ++itDau)
574 if (logMaterial ==
nullptr)
576 std::ostringstream message;
577 message <<
"No material associated to the logical volume: "
578 << fName <<
" !" <<
G4endl
579 <<
"Sorry, cannot compute the mass ...";
580 G4Exception(
"G4LogicalVolume::GetMass()",
"GeomMgt0002",
586 std::ostringstream message;
587 message <<
"No solid is associated to the logical volume: "
588 << fName <<
" !" <<
G4endl
589 <<
"Sorry, cannot compute the mass ...";
590 G4Exception(
"G4LogicalVolume::GetMass()",
"GeomMgt0002",
602 for (
auto itDau = fDaughters.cbegin(); itDau != fDaughters.cend(); ++itDau)
617 if (physParam !=
nullptr)
619 daughterSolid = physParam->
ComputeSolid(i, physDaughter);
625 daughterSolid = logDaughter->
GetSolid();
636 massSum += logDaughter->
GetMass(
true,
true, daughterMaterial);
661 fDaughtersVolumeType = aType;
667 works = (expectedVType == aType);
670 fDaughtersVolumeType = aType;
683 fVisAttributes = std::make_shared<const G4VisAttributes>(VA);
693 fVisAttributes = std::shared_ptr<const G4VisAttributes>(pVA,[](
const G4VisAttributes*){});
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)
void SetMapValid(G4bool val)
static void Register(G4LogicalVolume *pVolume)
static G4LogicalVolumeStore * GetInstance()
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)
std::size_t GetNoDaughters() const
virtual ~G4LogicalVolume()
void RemoveDaughter(const G4VPhysicalVolume *p)
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 std::size_t 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()