I am trying to define commands via the GenericMessenger clas and the commands are successfully being generated. But when I call the commands they do not update the geometry.
_Geant4 Version:_11.2.2
_Operating System:Ubuntu 24.04
_Compiler/Version:gcc 12.4
_CMake Version:3.28.3
Below are my setter functions to update the absorber thickness and material from example B4d
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void DetectorConstruction::SetMaterial(G4String matName)
{
auto nistManager = G4NistManager::Instance();
absoMaterial = matName;
G4cout << absoMaterial << G4endl;
nistManager->FindOrBuildMaterial(absoMaterial);
DefineMaterials();
DefineVolumes();
G4RunManager::GetRunManager()->GeometryHasBeenModified();
G4UImanager* UImanager = G4UImanager::GetUIpointer();
if(UImanager->GetUIpointer()) {
UImanager->ApplyCommand("/vis/viewer/rebuild");
}
}
void DetectorConstruction::SetThickness(G4double abs_t)
{
G4GeometryManager::GetInstance() -> OpenGeometry();
//* example
absoThickness = abs_t;
G4cout << absoThickness << G4endl;
DefineVolumes();
G4RunManager::GetRunManager()->GeometryHasBeenModified();
G4UImanager* UImanager = G4UImanager::GetUIpointer();
if(UImanager->GetUIpointer()) {
UImanager->ApplyCommand("/vis/viewer/rebuild");
}
}
I am using the command
auto detConstruction = new B4d::DetectorConstruction();
runManager->SetUserInitialization(detConstruction);
in my main file to call the detector construction.
It may also be worth noting that I am printing out the values of the thickness and material in the definevolumes method and they are being realized by this class correctly based on the g4cout statement.
Any thoughts here?