#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); AngularCmd = new G4UIcmdWithAString("/Gene/PrimaryGA/SetAngular", this); AngularCmd->SetGuidance("Set type of angular distribution."); AngularCmd->SetParameterName("Angular", false); AngularCmd->AvailableForStates(G4State_PreInit); ReactionCmd = new G4UIcmdWithAString("/Gene/PrimaryGA/SetReaction", this); ReactionCmd->SetGuidance("Set type of reaction."); ReactionCmd->SetParameterName("Reaction", false); ReactionCmd->AvailableForStates(G4State_PreInit); } GenePrimaryGeneratorActionMessenger::~GenePrimaryGeneratorActionMessenger() { delete BeamEnergyCmd; delete PrimaryDir; delete AngularCmd; delete ReactionCmd; } void GenePrimaryGeneratorActionMessenger::SetNewValue(G4UIcommand* command, G4String newValue) { if (command == BeamEnergyCmd) { pPrimaryGeneratorAction->SetBeamEnergy(BeamEnergyCmd->GetNewDoubleValue(newValue)); } if (command == AngularCmd) { pPrimaryGeneratorAction->SetAngType(newValue); } if (command == ReactionCmd) { pPrimaryGeneratorAction->SetReaction(newValue); } }