43#define G4MT_fsmanager ((subInstanceManager.offset[instanceID]).fFastSimulationManager)
44#define G4MT_rsaction ((subInstanceManager.offset[instanceID]).fRegionalSteppingAction)
57 return subInstanceManager;
68 instanceID = subInstanceManager.CreateSubInstance();
73 if (rStore->
GetRegion(pName,
false) !=
nullptr)
75 std::ostringstream message;
76 message <<
"The region has NOT been registered !" <<
G4endl
77 <<
" Region " << pName <<
" already existing in store !"
96 instanceID = subInstanceManager.CreateSubInstance();
179 if((volMat ==
nullptr) && fInMassGeometry)
181 std::ostringstream message;
182 message <<
"Logical volume <" << lv->
GetName() <<
">" <<
G4endl
183 <<
"does not have a valid material pointer." <<
G4endl
184 <<
"A logical volume belonging to the (tracking) world volume "
185 <<
"must have a valid material.";
186 G4Exception(
"G4Region::ScanVolumeTree()",
"GeomMgt0002",
191 currentRegion =
this;
192 if (volMat !=
nullptr)
196 if (baseMat !=
nullptr) { AddMaterial(baseMat); }
207 if(noDaughters==0) {
return; }
220 for (std::size_t mat=0; mat<matNo; ++mat)
223 if((volMat ==
nullptr) && fInMassGeometry)
225 std::ostringstream message;
226 message <<
"The parameterisation for the physical volume <"
228 <<
"does not return a valid material pointer." <<
G4endl
229 <<
"A volume belonging to the (tracking) world volume must "
230 <<
"have a valid material.";
231 G4Exception(
"G4Region::ScanVolumeTree()",
"GeomMgt0002",
234 if (volMat !=
nullptr)
238 if (baseMat !=
nullptr) { AddMaterial(baseMat); }
245 for (std::size_t rep=0; rep<repNo; ++rep)
248 if((volMat ==
nullptr) && fInMassGeometry)
250 std::ostringstream message;
251 message <<
"The parameterisation for the physical volume <"
253 <<
"does not return a valid material pointer." <<
G4endl
254 <<
"A volume belonging to the (tracking) world volume must "
255 <<
"have a valid material.";
256 G4Exception(
"G4Region::ScanVolumeTree()",
"GeomMgt0002",
259 if(volMat !=
nullptr)
263 if (baseMat !=
nullptr) { AddMaterial(baseMat); }
272 for (std::size_t i=0; i<noDaughters; ++i)
298 std::ostringstream message;
299 message <<
"Logical volume <" << lv->
GetName() <<
"> is already set as" <<
G4endl
301 <<
"It cannot be root logical volume for another region <" <<
GetName()
304 message,
"A logical volume cannot belong to more than one region!");
312 auto pos = std::find(fRootVolumes.cbegin(),fRootVolumes.cend(),lv);
313 if (pos == fRootVolumes.cend())
317 fRootVolumes.push_back(lv);
323 fRootVolumes.push_back(lv);
345 auto pos = std::find(fRootVolumes.cbegin(),fRootVolumes.cend(),lv);
346 if (pos != fRootVolumes.cend())
348 if (fRootVolumes.size() != 1)
352 fRootVolumes.erase(pos);
371 subInstanceManager.FreeSlave();
399 for (
const auto & rootVolume : fRootVolumes)
415 fWorldPhys =
nullptr;
434 if (currLog->
GetRegion()==
this) {
return true;}
437 while ((nDaughters--) != 0)
455 if(parent !=
nullptr)
463 std::ostringstream message;
464 message <<
"Region <" << fName <<
"> belongs to more than"
465 <<
" one parent region !" <<
G4endl
466 <<
"A region cannot belong to more than one direct parent region,"
468 <<
"to have fast-simulation assigned.";
469 G4Exception(
"G4Region::ClearFastSimulationManager()",
493 for(
const auto & lvol : *lvStore)
495 std::size_t nD = lvol->GetNoDaughters();
500 for(std::size_t iD=0; iD<nD; ++iD)
502 if(lvol->GetDaughter(iD)->GetLogicalVolume()->GetRegion()==
this)
504 if(parent !=
nullptr)
506 if(parent!=aR) {
unique =
false; }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4GeomSplitter< G4RegionData > G4RegionManager
G4LogicalVolumeStore is a singleton class, acting as container for all logical volumes,...
static G4LogicalVolumeStore * GetInstance()
G4LogicalVolume represents a leaf node or unpositioned subtree in the geometry hierarchy....
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
G4RegionStore is a singleton class, acting as container for all geometrical regions,...
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)
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
G4bool BelongsTo(G4VPhysicalVolume *pv) 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)
G4VPVParameterisation ia an abstract base class for Parameterisation, able to compute the transformat...
virtual G4VVolumeMaterialScanner * GetMaterialScanner()
virtual G4Material * ComputeMaterial(const G4int repNo, G4VPhysicalVolume *currentVol, const G4VTouchable *parentTouch=nullptr)
G4VPhysicalVolume is an abstract base class for the representation of a positioned volume....
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
PUGI__FN I unique(I begin, I end)