Message: Reloading Geometry with Region Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Reloading Geometry with Region 

Forum: Geometry
Date: Jan 16, 23:46
From: Adrien MATTA <Adrien MATTA>

Hello everyone,

I am developing a geant4 based application (https://github.com/adrien-matta/nptool). I have implemented a mechanism in which the user can reload the geometry between two runs, and it worked well until I started using G4Region (not sure if this is linked, but the region are associated to G4FastSimulationModel).

I have a Clear Geometry Method that Open the geometry and Clean the various Store:

void DetectorConstruction::ClearGeometry(){
 G4GeometryManager::GetInstance()->OpenGeometry(); 
 G4PhysicalVolumeStore::GetInstance()->Clean(); 
 G4LogicalVolumeStore::GetInstance()->Clean();
 G4SolidStore::GetInstance()->Clean(); 
}

and a RedefineGeometry Method doing:

void DetectorConstruction::RedefineGeometry(std::string file){ 
 ClearGeometry();
 G4RunManager::GetRunManager()->DefineWorldVolume(Construct(file));
 G4RunManager::GetRunManager()->GeometryHasBeenModified();   
 G4RunManager::GetRunManager()->PhysicsHasBeenModified() ; 
 G4RunManager::GetRunManager()->Initialize();  
}

The Construct method is reading an ASCII file describing the setup and instantiating a new world volume and putting all the detector/target inside.

This methods worked flawlessly until I introduce a G4Region associated with the Target in which I call a G4FastSimulationModel to simulate a two-body reaction.

Now I can reload the geometry and see it in my GUI, but if try to simulate an event I got a G4 Exception telling me: "Default world region should have a unique logical volume".

I tried several things, like calling G4RegionStore::GetInstance()->Clean() in the clear geometry method, but that did not change much. I also tried to get the DefaultRegionForTheWorld and remove it root logical volume, but the exception keep showing up.

I guess there is a simple but critical step I am missing to properly remove the previous world volume associated with the default world region. Any help would be welcome.

Cheers, Adrien.

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 More: Re: Reloading Geometry with Region   (Gabriele Cosmo - Jan 18, 01:21)
(_ Idea: Re: Reloading Geometry with Region   (Adrien MATTA - Feb 01, 08:27)
 Add Message Add Message
to: "Reloading Geometry with Region"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]