32 lines
1.2 KiB
C++
32 lines
1.2 KiB
C++
#include "GenePrimaryGeneratorActionMessenger.hh"
|
|
|
|
#include "G4SystemOfUnits.hh"
|
|
#include "G4UIcmdWithADoubleAndUnit.hh"
|
|
#include "G4UIcmdWithAString.hh"
|
|
#include "G4UIdirectory.hh"
|
|
#include "GenePrimaryGeneratorAction.hh"
|
|
|
|
GenePrimaryGeneratorActionMessenger::GenePrimaryGeneratorActionMessenger(GenePrimaryGeneratorAction* pPrimary)
|
|
: pPrimaryGeneratorAction(pPrimary) {
|
|
PrimaryDir = new G4UIdirectory("/Gene/PrimaryGA/");
|
|
PrimaryDir->SetGuidance("Commands to set alpha beam energy");
|
|
|
|
BeamEnergyCmd = new G4UIcmdWithADoubleAndUnit("/Gene/PrimaryGA/SetBeamEnergy", this);
|
|
BeamEnergyCmd->SetGuidance("Set alpha beam energy.");
|
|
BeamEnergyCmd->SetParameterName("BeamEnergy", false);
|
|
BeamEnergyCmd->SetUnitCategory("Energy");
|
|
BeamEnergyCmd->SetRange("BeamEnergy>0.0");
|
|
BeamEnergyCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
|
}
|
|
|
|
GenePrimaryGeneratorActionMessenger::~GenePrimaryGeneratorActionMessenger() {
|
|
delete BeamEnergyCmd;
|
|
delete PrimaryDir;
|
|
}
|
|
|
|
void GenePrimaryGeneratorActionMessenger::SetNewValue(G4UIcommand* command, G4String newValue) {
|
|
if (command == BeamEnergyCmd) {
|
|
pPrimaryGeneratorAction->SetBeamEnergy(BeamEnergyCmd->GetNewDoubleValue(newValue));
|
|
}
|
|
}
|