File indexing completed on 2025-01-31 09:22:20
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 #include "PassiveProtonBeamLineMessenger.hh"
0030 #include "PassiveProtonBeamLine.hh"
0031 #include "G4UIdirectory.hh"
0032 #include "G4UIcmdWithADoubleAndUnit.hh"
0033 #include "G4UIcmdWithAString.hh"
0034 #include "G4SystemOfUnits.hh"
0035
0036 PassiveProtonBeamLineMessenger::PassiveProtonBeamLineMessenger(PassiveProtonBeamLine* beamLine)
0037 :passiveProton(beamLine)
0038
0039 {
0040 changeTheBeamLineDir = new G4UIdirectory("/ChangeBeamLine/");
0041 changeTheBeamLineDir -> SetGuidance("Command to change the transport beam line");
0042
0043 changeTheBeamLineNameCmd = new G4UIcmdWithAString("/ChangeBeamLine/beamLineName",this);
0044 changeTheBeamLineNameCmd -> SetGuidance("Insert the name of the beam line you want simulate");
0045 changeTheBeamLineNameCmd -> SetParameterName("List",false);
0046 changeTheBeamLineNameCmd -> AvailableForStates(G4State_PreInit);
0047
0048 modulatorDir = new G4UIdirectory("/modulator/");
0049 modulatorDir -> SetGuidance("Command to rotate the modulator wheel");
0050
0051 beamLineDir = new G4UIdirectory("/beamLine/");
0052 beamLineDir -> SetGuidance("set specification of range shifter");
0053
0054 rangeShifterDir = new G4UIdirectory("/beamLine/RangeShifter/");
0055 rangeShifterDir -> SetGuidance("set specification of range shifter");
0056
0057 firstScatteringFoilDir = new G4UIdirectory("/beamLine/ScatteringFoil1/");
0058 firstScatteringFoilDir -> SetGuidance("set specification of first scattering foil");
0059
0060 secondScatteringFoilDir = new G4UIdirectory("/beamLine/ScatteringFoil2/");
0061 secondScatteringFoilDir -> SetGuidance("set specification of second scattering foil");
0062
0063 rangeStopperDir = new G4UIdirectory("/beamLine/Stopper/");
0064 rangeStopperDir -> SetGuidance("set specification of stopper");
0065
0066 finalCollimatorDir = new G4UIdirectory("/beamLine/FinalCollimator/");
0067 finalCollimatorDir -> SetGuidance("set specification of final collimator");
0068
0069 modulatorAngleCmd = new G4UIcmdWithADoubleAndUnit("/modulator/angle",this);
0070 modulatorAngleCmd -> SetGuidance("Set Modulator Angle");
0071 modulatorAngleCmd -> SetParameterName("Size",false);
0072 modulatorAngleCmd -> SetRange("Size>=0.");
0073 modulatorAngleCmd -> SetUnitCategory("Angle");
0074 modulatorAngleCmd -> AvailableForStates(G4State_Idle);
0075
0076 rangeShifterMatCmd = new G4UIcmdWithAString("/beamLine/RangeShifter/RSMat",this);
0077 rangeShifterMatCmd -> SetGuidance("Set material of range shifter");
0078 rangeShifterMatCmd -> SetParameterName("choice",false);
0079 rangeShifterMatCmd -> AvailableForStates(G4State_Idle);
0080
0081 rangeShifterXSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/RangeShifter/thickness",this);
0082 rangeShifterXSizeCmd -> SetGuidance("Set half of the thickness of range shifter along X axis");
0083 rangeShifterXSizeCmd -> SetParameterName("Size",false);
0084 rangeShifterXSizeCmd -> SetDefaultUnit("mm");
0085 rangeShifterXSizeCmd -> SetUnitCandidates("mm cm m");
0086 rangeShifterXSizeCmd -> AvailableForStates(G4State_Idle);
0087
0088 rangeShifterXPositionCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/RangeShifter/position",this);
0089 rangeShifterXPositionCmd -> SetGuidance("Set position of range shifter");
0090 rangeShifterXPositionCmd -> SetParameterName("Size",false);
0091 rangeShifterXPositionCmd -> SetDefaultUnit("mm");
0092 rangeShifterXPositionCmd -> SetUnitCandidates("mm cm m");
0093 rangeShifterXPositionCmd -> AvailableForStates(G4State_Idle);
0094
0095 firstScatteringFoilXSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/ScatteringFoil1/thickness",this);
0096 firstScatteringFoilXSizeCmd -> SetGuidance("Set half thickness of first scattering foil");
0097 firstScatteringFoilXSizeCmd -> SetParameterName("Size",false);
0098 firstScatteringFoilXSizeCmd -> SetDefaultUnit("mm");
0099 firstScatteringFoilXSizeCmd -> SetUnitCandidates("mm cm m");
0100 firstScatteringFoilXSizeCmd -> AvailableForStates(G4State_Idle);
0101
0102 secondScatteringFoilXSizeCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/ScatteringFoil2/thickness",this);
0103 secondScatteringFoilXSizeCmd -> SetGuidance("Set half thickness of second scattering foil");
0104 secondScatteringFoilXSizeCmd -> SetParameterName("Size",false);
0105 secondScatteringFoilXSizeCmd -> SetDefaultUnit("mm");
0106 secondScatteringFoilXSizeCmd -> SetUnitCandidates("mm cm m");
0107 secondScatteringFoilXSizeCmd -> AvailableForStates(G4State_Idle);
0108
0109 outerRadiusStopperCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/Stopper/outRadius",this);
0110 outerRadiusStopperCmd -> SetGuidance("Set size of outer radius");
0111 outerRadiusStopperCmd -> SetParameterName("Size",false);
0112 outerRadiusStopperCmd -> SetDefaultUnit("mm");
0113 outerRadiusStopperCmd -> SetUnitCandidates("mm cm m");
0114 outerRadiusStopperCmd -> AvailableForStates(G4State_Idle);
0115
0116 innerRadiusFinalCollimatorCmd = new G4UIcmdWithADoubleAndUnit("/beamLine/FinalCollimator/halfInnerRad",this);
0117 innerRadiusFinalCollimatorCmd -> SetGuidance("Set size of inner radius ( max 21.5 mm)");
0118 innerRadiusFinalCollimatorCmd -> SetParameterName("Size",false);
0119 innerRadiusFinalCollimatorCmd -> SetDefaultUnit("mm");
0120 innerRadiusFinalCollimatorCmd -> SetUnitCandidates("mm cm m");
0121 innerRadiusFinalCollimatorCmd -> AvailableForStates(G4State_Idle);
0122 }
0123
0124 PassiveProtonBeamLineMessenger::~PassiveProtonBeamLineMessenger()
0125 {
0126 delete innerRadiusFinalCollimatorCmd;
0127 delete outerRadiusStopperCmd;
0128 delete secondScatteringFoilXSizeCmd;
0129 delete firstScatteringFoilXSizeCmd;
0130 delete rangeShifterXPositionCmd;
0131 delete rangeShifterXSizeCmd;
0132 delete rangeShifterMatCmd;
0133 delete modulatorAngleCmd;
0134 delete finalCollimatorDir;
0135 delete rangeStopperDir;
0136 delete secondScatteringFoilDir;
0137 delete firstScatteringFoilDir;
0138 delete rangeShifterDir;
0139 delete beamLineDir;
0140 delete modulatorDir;
0141 }
0142
0143
0144
0145
0146 void PassiveProtonBeamLineMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
0147 {
0148 if( command == modulatorAngleCmd )
0149 { passiveProton -> SetModulatorAngle
0150 (modulatorAngleCmd -> GetNewDoubleValue(newValue));}
0151
0152 else if( command == rangeShifterMatCmd )
0153 { passiveProton -> SetRSMaterial(newValue);}
0154
0155 else if( command == rangeShifterXSizeCmd )
0156 { passiveProton -> SetRangeShifterXSize
0157 (rangeShifterXSizeCmd -> GetNewDoubleValue(newValue));}
0158
0159 else if( command == rangeShifterXPositionCmd )
0160 { passiveProton -> SetRangeShifterXPosition
0161 (rangeShifterXPositionCmd -> GetNewDoubleValue(newValue));}
0162
0163 else if( command == firstScatteringFoilXSizeCmd )
0164 { passiveProton -> SetFirstScatteringFoilXSize
0165 (firstScatteringFoilXSizeCmd -> GetNewDoubleValue(newValue));}
0166
0167 else if( command == secondScatteringFoilXSizeCmd )
0168 { passiveProton -> SetSecondScatteringFoilXSize
0169 (secondScatteringFoilXSizeCmd -> GetNewDoubleValue(newValue));}
0170
0171 else if( command == outerRadiusStopperCmd )
0172 { passiveProton -> SetOuterRadiusStopper(
0173 outerRadiusStopperCmd -> GetNewDoubleValue(newValue));}
0174
0175 else if( command == innerRadiusFinalCollimatorCmd )
0176 { passiveProton -> SetInnerRadiusFinalCollimator
0177 (innerRadiusFinalCollimatorCmd -> GetNewDoubleValue(newValue));}
0178 }
0179