#include "DoubleDynamiteMessenger.hh" #include "DoubleDynamite.hh" DoubleDynamiteMessenger::DoubleDynamiteMessenger(DoubleDynamite* d) :dd(d) { ddDir = new G4UIdirectory("/DoubleDynamite/"); ddDir->SetGuidance("Commands to modify the DoubleDynamite system"); ddPositionCmd = new G4UIcmdWith3VectorAndUnit("/DoubleDynamite/SetFrontFacePosition", this); ddPositionCmd->SetGuidance("Set the position of the DoubleDynamite front face"); ddPositionCmd->SetParameterName("PosX", "PosY", "PosZ", false); ddPositionCmd->SetUnitCategory("Length"); ddPositionCmd->AvailableForStates(G4State_PreInit,G4State_Idle); ddSeparationCmd = new G4UIcmdWithADoubleAndUnit("/DoubleDynamite/SensorSeparation", this); ddSeparationCmd->SetGuidance("Set the separation of the DoubleDynamite sensors (epi to epi)"); ddSeparationCmd->SetParameterName("SepZ", false); ddSeparationCmd->SetUnitCategory("Length"); ddSeparationCmd->AvailableForStates(G4State_PreInit,G4State_Idle); ddConstructCmd = new G4UIcmdWithABool("/DoubleDynamite/Construct", this); ddConstructCmd->SetGuidance("Set to true of false to signify whether to build the DoubleDynamite or not"); ddConstructCmd->SetParameterName("Construct", false); ddConstructCmd->AvailableForStates(G4State_PreInit,G4State_Idle); } DoubleDynamiteMessenger::~DoubleDynamiteMessenger() { delete ddDir; delete ddPositionCmd; delete ddSeparationCmd; delete ddConstructCmd; } void DoubleDynamiteMessenger::SetNewValue(G4UIcommand* command, G4String newValue) { if(command == ddPositionCmd) dd->SetFrontFacePosition(ddPositionCmd->GetNew3VectorValue(newValue)); if(command == ddSeparationCmd) dd->SetSensorSeparation(ddSeparationCmd->GetNewDoubleValue(newValue)); if(command == ddConstructCmd) dd->SetConstructDoubleDynamite(ddConstructCmd->GetNewBoolValue(newValue)); }