43#define G4MT_fsmanager ((subInstanceManager.offset[instanceID]).fFastSimulationManager)
44#define G4MT_rsaction ((subInstanceManager.offset[instanceID]).fRegionalSteppingAction)
57 return subInstanceManager;
74 if (rStore->
GetRegion(pName,
false) !=
nullptr)
76 std::ostringstream message;
77 message <<
"The region has NOT been registered !" <<
G4endl
78 <<
" Region " << pName <<
" already existing in store !"
180 if((volMat ==
nullptr) && fInMassGeometry)
182 std::ostringstream message;
183 message <<
"Logical volume <" << lv->
GetName() <<
">" <<
G4endl
184 <<
"does not have a valid material pointer." <<
G4endl
185 <<
"A logical volume belonging to the (tracking) world volume "
186 <<
"must have a valid material.";
187 G4Exception(
"G4Region::ScanVolumeTree()",
"GeomMgt0002",
192 currentRegion =
this;
193 if (volMat !=
nullptr)
197 if (baseMat !=
nullptr) { AddMaterial(baseMat); }
208 if(noDaughters==0)
return;
221 for (std::size_t mat=0; mat<matNo; ++mat)
224 if((volMat ==
nullptr) && fInMassGeometry)
226 std::ostringstream message;
227 message <<
"The parameterisation for the physical volume <"
229 <<
"does not return a valid material pointer." <<
G4endl
230 <<
"A volume belonging to the (tracking) world volume must "
231 <<
"have a valid material.";
232 G4Exception(
"G4Region::ScanVolumeTree()",
"GeomMgt0002",
235 if (volMat !=
nullptr)
239 if (baseMat !=
nullptr) { AddMaterial(baseMat); }
246 for (std::size_t rep=0; rep<repNo; ++rep)
249 if((volMat ==
nullptr) && fInMassGeometry)
251 std::ostringstream message;
252 message <<
"The parameterisation for the physical volume <"
254 <<
"does not return a valid material pointer." <<
G4endl
255 <<
"A volume belonging to the (tracking) world volume must "
256 <<
"have a valid material.";
257 G4Exception(
"G4Region::ScanVolumeTree()",
"GeomMgt0002",
260 if(volMat !=
nullptr)
264 if (baseMat !=
nullptr) { AddMaterial(baseMat); }
273 for (std::size_t i=0; i<noDaughters; ++i)
299 std::ostringstream message;
300 message <<
"Logical volume <" << lv->
GetName() <<
"> is already set as" <<
G4endl
302 <<
"It cannot be root logical volume for another region <" <<
GetName()
305 message,
"A logical volume cannot belong to more than one region!");
313 auto pos = std::find(fRootVolumes.cbegin(),fRootVolumes.cend(),lv);
314 if (pos == fRootVolumes.cend())
318 fRootVolumes.push_back(lv);
324 fRootVolumes.push_back(lv);
346 auto pos = std::find(fRootVolumes.cbegin(),fRootVolumes.cend(),lv);
347 if (pos != fRootVolumes.cend())
349 if (fRootVolumes.size() != 1)
353 fRootVolumes.erase(pos);
400 for (
auto pLV=fRootVolumes.cbegin(); pLV!=fRootVolumes.cend(); ++pLV)
415 { fWorldPhys =
nullptr; }
431 if (currLog->
GetRegion()==
this) {
return true;}
434 while ((nDaughters--) != 0)
452 if(parent !=
nullptr)
460 std::ostringstream message;
461 message <<
"Region <" << fName <<
"> belongs to more than"
462 <<
" one parent region !" <<
G4endl
463 <<
"A region cannot belong to more than one direct parent region,"
465 <<
"to have fast-simulation assigned.";
466 G4Exception(
"G4Region::ClearFastSimulationManager()",
485 G4Region* parent =
nullptr; unique =
true;
490 for(
auto lvItr=lvStore->cbegin(); lvItr!=lvStore->cend(); ++lvItr)
492 std::size_t nD = (*lvItr)->GetNoDaughters();
493 G4Region* aR = (*lvItr)->GetRegion();
497 for(std::size_t iD=0; iD<nD; ++iD)
499 if((*lvItr)->GetDaughter(iD)->GetLogicalVolume()->GetRegion()==
this)
501 if(parent !=
nullptr)
503 if(parent!=aR) { unique =
false; }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4int CreateSubInstance()
static G4LogicalVolumeStore * GetInstance()
std::size_t GetNoDaughters() const
void SetRegionRootFlag(G4bool rreg)
void SetRegion(G4Region *reg)
G4bool IsRootRegion() const
G4Region * GetRegion() const
G4Material * GetMaterial() const
G4VPhysicalVolume * GetDaughter(const std::size_t i) const
const G4String & GetName() const
const G4Material * GetBaseMaterial() const
static void DeRegister(G4Region *pRegion)
static void Register(G4Region *pRegion)
static G4RegionStore * GetInstance()
G4Region * GetRegion(const G4String &name, G4bool verbose=true) const
void SetMapValid(G4bool val)
G4bool BelongsTo(G4VPhysicalVolume *thePhys) const
void ScanVolumeTree(G4LogicalVolume *lv, G4bool region)
G4Region * GetParentRegion(G4bool &unique) const
G4FastSimulationManager * GetFastSimulationManager() const
void SetWorld(G4VPhysicalVolume *wp)
void RemoveRootLogicalVolume(G4LogicalVolume *lv, G4bool scan=true)
const G4String & GetName() const
void UpdateMaterialList()
G4Region(const G4String &name)
void SetFastSimulationManager(G4FastSimulationManager *fsm)
void SetRegionalSteppingAction(G4UserSteppingAction *rusa)
void SetName(const G4String &name)
static const G4RegionManager & GetSubInstanceManager()
G4UserSteppingAction * GetRegionalSteppingAction() const
void ClearFastSimulationManager()
void AddRootLogicalVolume(G4LogicalVolume *lv, G4bool search=true)
virtual G4VVolumeMaterialScanner * GetMaterialScanner()
virtual G4Material * ComputeMaterial(const G4int repNo, G4VPhysicalVolume *currentVol, const G4VTouchable *parentTouch=nullptr)
G4LogicalVolume * GetLogicalVolume() const
virtual G4int GetMultiplicity() const
const G4String & GetName() const
virtual G4VPVParameterisation * GetParameterisation() const =0
virtual G4bool IsParameterised() const =0
virtual G4Material * GetMaterial(G4int idx) const =0
virtual G4int GetNumberOfMaterials() const =0