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; }
170 if((volMat ==
nullptr) && fInMassGeometry)
172 std::ostringstream message;
173 message <<
"Logical volume <" << lv->
GetName() <<
">" <<
G4endl
174 <<
"does not have a valid material pointer." <<
G4endl
175 <<
"A logical volume belonging to the (tracking) world volume "
176 <<
"must have a valid material.";
177 G4Exception(
"G4Region::ScanVolumeTree()",
"GeomMgt0002",
182 currentRegion =
this;
183 if (volMat !=
nullptr)
187 if (baseMat !=
nullptr) { AddMaterial(baseMat); }
198 if(noDaughters==0)
return;
211 for (
size_t mat=0; mat<matNo; ++mat)
214 if(!volMat && fInMassGeometry)
216 std::ostringstream message;
217 message <<
"The parameterisation for the physical volume <"
219 <<
"does not return a valid material pointer." <<
G4endl
220 <<
"A volume belonging to the (tracking) world volume must "
221 <<
"have a valid material.";
222 G4Exception(
"G4Region::ScanVolumeTree()",
"GeomMgt0002",
225 if (volMat !=
nullptr)
229 if (baseMat !=
nullptr) { AddMaterial(baseMat); }
236 for (
size_t rep=0; rep<repNo; ++rep)
239 if((volMat ==
nullptr) && fInMassGeometry)
241 std::ostringstream message;
242 message <<
"The parameterisation for the physical volume <"
244 <<
"does not return a valid material pointer." <<
G4endl
245 <<
"A volume belonging to the (tracking) world volume must "
246 <<
"have a valid material.";
247 G4Exception(
"G4Region::ScanVolumeTree()",
"GeomMgt0002",
250 if(volMat !=
nullptr)
254 if (baseMat !=
nullptr) { AddMaterial(baseMat); }
263 for (
size_t i=0; i<noDaughters; ++i)
289 auto pos = std::find(fRootVolumes.cbegin(),fRootVolumes.cend(),lv);
290 if (pos == fRootVolumes.cend())
294 fRootVolumes.push_back(lv);
300 fRootVolumes.push_back(lv);
322 auto pos = std::find(fRootVolumes.cbegin(),fRootVolumes.cend(),lv);
323 if (pos != fRootVolumes.cend())
325 if (fRootVolumes.size() != 1)
329 fRootVolumes.erase(pos);
376 for (
auto pLV=fRootVolumes.cbegin(); pLV!=fRootVolumes.cend(); ++pLV)
407 if (currLog->
GetRegion()==
this) {
return true;}
428 if(parent !=
nullptr)
436 std::ostringstream message;
437 message <<
"Region <" << fName <<
"> belongs to more than"
438 <<
" one parent region !" <<
G4endl
439 <<
"A region cannot belong to more than one direct parent region,"
441 <<
"to have fast-simulation assigned.";
442 G4Exception(
"G4Region::ClearFastSimulationManager()",
461 G4Region* parent =
nullptr; unique =
true;
466 for(
auto lvItr=lvStore->cbegin(); lvItr!=lvStore->cend(); ++lvItr)
468 G4int nD = (*lvItr)->GetNoDaughters();
469 G4Region* aR = (*lvItr)->GetRegion();
473 for(
auto iD=0; iD<nD; ++iD)
475 if((*lvItr)->GetDaughter(iD)->GetLogicalVolume()->GetRegion()==
this)
479 if(parent!=aR) { unique =
false; }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4int CreateSubInstance()
static G4LogicalVolumeStore * GetInstance()
void SetRegionRootFlag(G4bool rreg)
void SetRegion(G4Region *reg)
size_t GetNoDaughters() const
G4bool IsRootRegion() const
G4Region * GetRegion() const
G4Material * GetMaterial() const
G4VPhysicalVolume * GetDaughter(const G4int 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
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)
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