G4-DESCSS/src/G4HumanPhantomMessenger.cpp

51 lines
1.8 KiB
C++

#include "DetectorConstruction.h"
#include "G4HumanPhantomMessenger.h"
#include "G4RunManager.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIdirectory.hh"
#include "globals.hh"
G4HumanPhantomMessenger::G4HumanPhantomMessenger(DetectorConstruction* myUsrPhtm) : myUserPhantom(myUsrPhtm) {
phantomDir = new G4UIdirectory("/phantom/");
phantomDir->SetGuidance("Set Your Phantom.");
modelCmd = new G4UIcmdWithAString("/phantom/setPhantomModel", this);
modelCmd->SetGuidance("Set sex of Phantom: MIRD, MIRDHead.");
modelCmd->SetParameterName("phantomModel", true);
modelCmd->SetDefaultValue("MIRD");
modelCmd->SetCandidates("MIRD MIRDHead");
modelCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
sexCmd = new G4UIcmdWithAString("/phantom/setPhantomSex", this);
sexCmd->SetGuidance("Set sex of Phantom: Male or Female.");
sexCmd->SetParameterName("phantomSex", true);
sexCmd->SetDefaultValue("Female");
sexCmd->SetCandidates("Male Female");
sexCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
endCmd = new G4UIcmdWithoutParameter("/phantom/buildNewPhantom", this);
endCmd->SetGuidance("Build your Phantom.");
endCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
}
G4HumanPhantomMessenger::~G4HumanPhantomMessenger() {
delete modelCmd;
delete sexCmd;
delete endCmd;
delete phantomDir;
}
void G4HumanPhantomMessenger::SetNewValue(G4UIcommand* command, G4String newValue) {
if (command == modelCmd) {
myUserPhantom->SetPhantomModel(newValue);
}
if (command == sexCmd) {
myUserPhantom->SetPhantomSex(newValue);
}
if (command == endCmd) {
G4cout << " ****************>>>> NEW PHANTOM CONSTRUCTION <<<<***************** " << G4endl;
}
}