Let’s say I have a simple geometry with three nested volumes world / Volume1 / Volume2
. That is, Volume1
is a daughter of world
and Volume2
is a daughter of Volume1
. Now I want to assign a different region to Volume1
so I can change the production cuts in that region. BUT I want Volume2
to stay in the default world region (because e.g. I have G4UserLimits
attached to that region.
As I understand, if I attach a new region to Volume1
, Volume2
will inherit it. So I thought the following would do what I wanted:
G4Region* region1= G4RegionStore::GetInstance()->FindOrCreateRegion("region1");
l_volume1->SetRegion(region1);
region1->AddRootLogicalVolume(l_region1);
//set cuts, etc for region1
G4Region* defaultRegion = G4RegionStore::GetInstance()->GetRegion("DefaultRegionForTheWorld");
l_volume2->SetRegion(defaultRegion);
defaultRegion->AddRootLogicalVolume(l_volume2);
But that segfaults during the run (happens to be in G4UrbanMscModel::ComputeTruePathLengthLimit
). I guess this is because the world region is special somehow?
Is this is a weird bug, or am I misunderstanding how regions are supposed to be applied? Is there a a a way to accomplish this, or achieve similar results?