43#define G4MT_fsmanager ((subInstanceManager.offset[instanceID]).fFastSimulationManager)
44#define G4MT_rsaction ((subInstanceManager.offset[instanceID]).fRegionalSteppingAction)
57 return subInstanceManager;
76 std::ostringstream message;
77 message <<
"The region has NOT been registered !" <<
G4endl
78 <<
" Region " << pName <<
" already existing in store !"
114 if(fUserInfo !=
nullptr) {
delete fUserInfo; }
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 && 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 auto pos = std::find(fRootVolumes.cbegin(),fRootVolumes.cend(),lv);
300 if (pos == fRootVolumes.cend())
304 fRootVolumes.push_back(lv);
310 fRootVolumes.push_back(lv);
332 auto pos = std::find(fRootVolumes.cbegin(),fRootVolumes.cend(),lv);
333 if (pos != fRootVolumes.cend())
335 if (fRootVolumes.size() != 1)
339 fRootVolumes.erase(pos);
386 for (
auto pLV=fRootVolumes.cbegin(); pLV!=fRootVolumes.cend(); ++pLV)
401 { fWorldPhys =
nullptr; }
417 if (currLog->
GetRegion()==
this) {
return true;}
438 if(parent !=
nullptr)
446 std::ostringstream message;
447 message <<
"Region <" << fName <<
"> belongs to more than"
448 <<
" one parent region !" <<
G4endl
449 <<
"A region cannot belong to more than one direct parent region,"
451 <<
"to have fast-simulation assigned.";
452 G4Exception(
"G4Region::ClearFastSimulationManager()",
471 G4Region* parent =
nullptr; unique =
true;
476 for(
auto lvItr=lvStore->cbegin(); lvItr!=lvStore->cend(); ++lvItr)
478 std::size_t nD = (*lvItr)->GetNoDaughters();
479 G4Region* aR = (*lvItr)->GetRegion();
483 for(std::size_t iD=0; iD<nD; ++iD)
485 if((*lvItr)->GetDaughter(iD)->GetLogicalVolume()->GetRegion()==
this)
489 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)
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