#include "Chamber20nepMessenger.hh" #include "Chamber20nep.hh" #include "G4UIdirectory.hh" #include "G4UIcommand.hh" #include "G4UIparameter.hh" #include "G4UIcmdWithAString.hh" #include "G4UIcmdWithAnInteger.hh" #include "G4UIcmdWithADoubleAndUnit.hh" #include "G4UIcmdWithADouble.hh" #include "globals.hh" Chamber20nepMessenger::Chamber20nepMessenger(Chamber20nep* CH):chamber20Nep(CH) { CHDir = new G4UIdirectory("/Chamber20nep/"); CHDir->SetGuidance("Chamber20nep control."); DummyPosCmd = new G4UIcommand("/Chamber20nep/DummySurfacePos",this); DummyPosCmd->SetGuidance("Set position of Dummy Surface"); DummyPosCmd->SetGuidance("format: x y z unit"); G4UIparameter* DummyPosX = new G4UIparameter("DummyPosX",'d',false); DummyPosX->SetGuidance("DummyPosX"); DummyPosCmd->SetParameter(DummyPosX); G4UIparameter* DummyPosY = new G4UIparameter("DummyPosY",'d',false); DummyPosY->SetGuidance("DummyPosY"); DummyPosCmd->SetParameter(DummyPosY); G4UIparameter* DummyPosZ = new G4UIparameter("DummyPosZ",'d',false); DummyPosZ->SetGuidance("DummyPosZ"); DummyPosCmd->SetParameter(DummyPosZ); G4UIparameter* DummyPosUnit = new G4UIparameter("DummyPosUnit",'s',false); DummyPosUnit->SetGuidance("Dummy Pos Unit"); DummyPosCmd->SetParameter(DummyPosUnit); } Chamber20nepMessenger::~Chamber20nepMessenger() { delete DummyPosCmd; } void Chamber20nepMessenger::SetNewValue(G4UIcommand * command,G4String newValue) { if (command == DummyPosCmd) { G4double v1,v2,v3; G4String unt; std::istringstream is(newValue); is >> v1 >> v2 >> v3 >> unt; G4ThreeVector vec(v1,v2,v3); vec *= G4UIcommand::ValueOf(unt); chamber20Nep->SetDummyPos(vec); } }