I write a DetectorMessenger.cc,which can change the thickness of ZnS in .mac as
void DetectorMessenger::SetNewValue(G4UIcommand *command, G4String val) {
if (command == fSetThicknessCmd)
{
fdet->SetThickness(fSetThicknessCmd->GetNewDoubleValue(val));
}
}
In DetectorConstruction,function SetThickness is
void DetectorConstruction::SetThickness(G4double val)
{
if (val<=0){fThickness=50*um;}
else{fThickness = val ;}
G4RunManager::GetRunManager()->GeometryHasBeenModified();
}
fThickness is
G4Box* solid_ZnS =new G4Box("ZnS", 0.5*env_sizeXY,0.5*env_sizeXY,fThickness/2);
Is that setting right?
Can this change the thickness of the material in loop?