File indexing completed on 2025-01-31 09:22:31
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
0037
0038
0039
0040
0041 #include "IORTPrimaryGeneratorMessenger.hh"
0042 #include "IORTPrimaryGeneratorAction.hh"
0043 #include "G4UIdirectory.hh"
0044 #include "G4UIcmdWithADoubleAndUnit.hh"
0045 #include "G4UIcmdWithADouble.hh"
0046
0047 IORTPrimaryGeneratorMessenger::IORTPrimaryGeneratorMessenger(
0048 IORTPrimaryGeneratorAction* IORTGun)
0049 :IORTAction(IORTGun)
0050 {
0051
0052
0053
0054
0055 beamParametersDir = new G4UIdirectory("/beam/");
0056 beamParametersDir -> SetGuidance("set parameters of beam");
0057
0058 EnergyDir = new G4UIdirectory("/beam/energy/");
0059 EnergyDir -> SetGuidance ("set energy of beam");
0060
0061 particlePositionDir = new G4UIdirectory("/beam/position/");
0062 particlePositionDir -> SetGuidance ("set position of particle");
0063
0064
0065
0066
0067 MomentumDir = new G4UIdirectory("/beam/momentum/");
0068 MomentumDir -> SetGuidance ("set momentum of particle ");
0069
0070
0071 ThetaCmd = new G4UIcmdWithADoubleAndUnit("/beam/momentum/Theta",this);
0072 ThetaCmd -> SetGuidance("set Theta");
0073 ThetaCmd -> SetParameterName("Theta",false);
0074 ThetaCmd -> SetDefaultUnit("deg");
0075 ThetaCmd -> SetUnitCandidates("deg rad");
0076 ThetaCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090 meanKineticEnergyCmd = new G4UIcmdWithADoubleAndUnit("/beam/energy/meanEnergy",this);
0091 meanKineticEnergyCmd -> SetGuidance("set mean Kinetic energy");
0092 meanKineticEnergyCmd -> SetParameterName("Energy",false);
0093 meanKineticEnergyCmd -> SetDefaultUnit("MeV");
0094 meanKineticEnergyCmd -> SetUnitCandidates("eV keV MeV GeV TeV");
0095 meanKineticEnergyCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
0096
0097 sigmaEnergyCmd = new G4UIcmdWithADoubleAndUnit("/beam/energy/sigmaEnergy",this);
0098 sigmaEnergyCmd -> SetGuidance("set sigma energy");
0099 sigmaEnergyCmd -> SetParameterName("Energy",false);
0100 sigmaEnergyCmd -> SetDefaultUnit("keV");
0101 sigmaEnergyCmd -> SetUnitCandidates("eV keV MeV GeV TeV");
0102 sigmaEnergyCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
0103
0104 XpositionCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Xposition",this);
0105 XpositionCmd -> SetGuidance("set x coordinate of particle");
0106 XpositionCmd -> SetParameterName("position",false);
0107 XpositionCmd -> SetDefaultUnit("mm");
0108 XpositionCmd -> SetUnitCandidates("mm cm m");
0109 XpositionCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
0110
0111 YpositionCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Yposition",this);
0112 YpositionCmd -> SetGuidance("set y coordinate of particle");
0113 YpositionCmd -> SetParameterName("position",false);
0114 YpositionCmd -> SetDefaultUnit("mm");
0115 YpositionCmd -> SetUnitCandidates("mm cm m");
0116 YpositionCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
0117
0118 sigmaYCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Yposition/sigmaY",this);
0119 sigmaYCmd -> SetGuidance("set sigma y");
0120 sigmaYCmd -> SetParameterName("position",false);
0121 sigmaYCmd -> SetDefaultUnit("mm");
0122 sigmaYCmd -> SetUnitCandidates("mm cm m");
0123 sigmaYCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
0124
0125 ZpositionCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Zposition",this);
0126 ZpositionCmd -> SetGuidance("set z coordinate of particle");
0127 ZpositionCmd -> SetParameterName("position",false);
0128 ZpositionCmd -> SetDefaultUnit("mm");
0129 ZpositionCmd -> SetUnitCandidates("mm cm m");
0130 ZpositionCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
0131
0132 sigmaZCmd = new G4UIcmdWithADoubleAndUnit("/beam/position/Zposition/sigmaZ",this);
0133 sigmaZCmd -> SetGuidance("set sigma z");
0134 sigmaZCmd -> SetParameterName("position",false);
0135 sigmaZCmd -> SetDefaultUnit("mm");
0136 sigmaZCmd -> SetUnitCandidates("mm cm m");
0137 sigmaZCmd -> AvailableForStates(G4State_PreInit,G4State_Idle);
0138 }
0139
0140 IORTPrimaryGeneratorMessenger::~IORTPrimaryGeneratorMessenger()
0141 {
0142 delete beamParametersDir;
0143 delete EnergyDir;
0144 delete meanKineticEnergyCmd;
0145 delete sigmaEnergyCmd;
0146 delete particlePositionDir;
0147 delete MomentumDir;
0148 delete XpositionCmd;
0149 delete YpositionCmd;
0150 delete ZpositionCmd;
0151 delete sigmaYCmd;
0152 delete sigmaZCmd;
0153 delete ThetaCmd;
0154
0155
0156 }
0157
0158 void IORTPrimaryGeneratorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
0159 {
0160 if ( command == meanKineticEnergyCmd )
0161 { IORTAction -> SetmeanKineticEnergy(meanKineticEnergyCmd
0162 -> GetNewDoubleValue(newValue));}
0163 if ( command == sigmaEnergyCmd )
0164 { IORTAction -> SetsigmaEnergy(sigmaEnergyCmd
0165 -> GetNewDoubleValue(newValue));}
0166 if ( command == XpositionCmd )
0167 { IORTAction -> SetXposition(XpositionCmd
0168 -> GetNewDoubleValue(newValue));}
0169
0170 if ( command == YpositionCmd )
0171 { IORTAction -> SetYposition(YpositionCmd
0172 -> GetNewDoubleValue(newValue));}
0173
0174 if ( command == ZpositionCmd )
0175 { IORTAction -> SetZposition(ZpositionCmd
0176 -> GetNewDoubleValue(newValue));}
0177
0178 if ( command == sigmaYCmd )
0179 { IORTAction -> SetsigmaY(sigmaYCmd
0180 -> GetNewDoubleValue(newValue));}
0181
0182 if ( command == sigmaZCmd )
0183 { IORTAction -> SetsigmaZ(sigmaZCmd
0184 -> GetNewDoubleValue(newValue));}
0185
0186 if ( command == ThetaCmd )
0187 { IORTAction -> SetTheta(ThetaCmd
0188 -> GetNewDoubleValue(newValue));}
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200 }