File indexing completed on 2025-01-31 09:22:18
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 #include "HadrontherapyModulatorMessenger.hh"
0037 #include "HadrontherapyModulator.hh"
0038 #include "G4UIdirectory.hh"
0039 #include "G4UIcmdWithADoubleAndUnit.hh"
0040 #include "G4UIcmdWithAString.hh"
0041 #include "G4UIcmdWith3VectorAndUnit.hh"
0042
0043
0044 HadrontherapyModulatorMessenger::HadrontherapyModulatorMessenger(HadrontherapyModulator* Mod)
0045 :Modulator(Mod)
0046
0047 {
0048 modulatorDir = new G4UIdirectory("/modulator/");
0049 modulatorDir -> SetGuidance("Command to change the modulator wheel proprties");
0050
0051 modulatorMatCmd = new G4UIcmdWithAString("/modulator/RMWMat",this);
0052 modulatorMatCmd -> SetGuidance("Set material of modulatorWheel");
0053 modulatorMatCmd -> SetParameterName("Material",false);
0054 modulatorMatCmd -> AvailableForStates(G4State_Idle);
0055
0056 modulatorExternalFile=new G4UIcmdWithAString("/modulator/ReadData",this);
0057 modulatorExternalFile -> SetGuidance("set properties of modulator steps via a external file");
0058 modulatorExternalFile -> SetParameterName("FileName",true,false);
0059 modulatorExternalFile -> SetDefaultValue ("default");
0060 modulatorExternalFile -> AvailableForStates(G4State_Idle);
0061
0062 modulatorPositionCmd = new G4UIcmdWith3VectorAndUnit("/modulator/position",this);
0063 modulatorPositionCmd -> SetGuidance("Set position of modulato");
0064 modulatorPositionCmd -> SetParameterName("PositionAlongX",
0065 "PositionAlongY",
0066 "PositionAlongZ",false);
0067 modulatorPositionCmd -> SetDefaultUnit("mm");
0068 modulatorPositionCmd -> SetUnitCandidates("mm cm m");
0069 modulatorPositionCmd -> AvailableForStates(G4State_Idle);
0070
0071
0072 modulatorOuterRadiusCmd = new G4UIcmdWithADoubleAndUnit("/modulator/outRadius",this);
0073 modulatorOuterRadiusCmd -> SetGuidance("Set size of outer radius");
0074 modulatorOuterRadiusCmd-> SetParameterName("Size",false);
0075 modulatorOuterRadiusCmd -> SetDefaultUnit("mm");
0076 modulatorOuterRadiusCmd-> SetUnitCandidates("mm cm m");
0077 modulatorOuterRadiusCmd-> AvailableForStates(G4State_Idle);
0078
0079 modulatorInnerRadiusCmd = new G4UIcmdWithADoubleAndUnit("/modulator/innerRadius",this);
0080 modulatorInnerRadiusCmd -> SetGuidance("Set size of inner radius");
0081 modulatorInnerRadiusCmd-> SetParameterName("Size",false);
0082 modulatorInnerRadiusCmd -> SetDefaultUnit("mm");
0083 modulatorInnerRadiusCmd-> SetUnitCandidates("mm cm m");
0084 modulatorInnerRadiusCmd-> AvailableForStates(G4State_Idle);
0085
0086 modulatorAngleCmd = new G4UIcmdWithADoubleAndUnit("/modulator/angle",this);
0087 modulatorAngleCmd -> SetGuidance("Set Modulator Angle");
0088 modulatorAngleCmd -> SetParameterName("Size",false);
0089 modulatorAngleCmd -> SetRange("Size>=0.");
0090 modulatorAngleCmd -> SetUnitCategory("Angle");
0091 modulatorAngleCmd -> AvailableForStates(G4State_Idle);
0092 }
0093
0094 HadrontherapyModulatorMessenger::~ HadrontherapyModulatorMessenger()
0095 {
0096 delete modulatorAngleCmd;
0097 delete modulatorMatCmd;
0098 delete modulatorPositionCmd;
0099 delete modulatorInnerRadiusCmd;
0100 delete modulatorOuterRadiusCmd;
0101 delete modulatorDir;
0102 }
0103
0104
0105
0106
0107 void HadrontherapyModulatorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
0108 {
0109 if( command == modulatorAngleCmd )
0110 {Modulator -> SetModulatorAngle
0111 (modulatorAngleCmd -> GetNewDoubleValue(newValue));}
0112
0113 else if( command == modulatorMatCmd )
0114 {Modulator -> SetModulatorMaterial(newValue);}
0115
0116 else if (command== modulatorExternalFile)
0117 {Modulator->GetDataFromFile(newValue);}
0118
0119 else if( command == modulatorPositionCmd )
0120 { G4ThreeVector size = modulatorPositionCmd-> GetNew3VectorValue(newValue);
0121 Modulator -> SetModulatorPosition(size);}
0122
0123 else if( command == modulatorOuterRadiusCmd )
0124 { Modulator -> SetModulatorOuterRadius(
0125 modulatorOuterRadiusCmd -> GetNewDoubleValue(newValue));}
0126
0127 else if( command == modulatorInnerRadiusCmd )
0128 { Modulator -> SetModulatorInnerRadius(
0129 modulatorInnerRadiusCmd -> GetNewDoubleValue(newValue));}
0130 }
0131