File indexing completed on 2026-04-17 07:51:37
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 "G4IAEAphspReaderMessenger.hh"
0042 #include "G4IAEAphspReader.hh"
0043
0044 #include "G4UIcmdWith3Vector.hh"
0045 #include "G4UIcmdWith3VectorAndUnit.hh"
0046 #include "G4UIcmdWithABool.hh"
0047 #include "G4UIcmdWithADoubleAndUnit.hh"
0048 #include "G4UIcmdWithAnInteger.hh"
0049 #include "G4UIdirectory.hh"
0050
0051
0052 G4IAEAphspReaderMessenger::G4IAEAphspReaderMessenger(G4IAEAphspReader* reader)
0053 :fIAEAphspReader(reader)
0054 {
0055 fPhaseSpaceDir = new G4UIdirectory("/IAEAphspReader/");
0056 fPhaseSpaceDir
0057 ->SetGuidance("Commands for the IAEA phase-space file management.");
0058
0059
0060 fVerboseCmd = new G4UIcmdWithAnInteger("/IAEAphspReader/verbose", this);
0061 fVerboseCmd->SetGuidance("Set verbose level of G4IAEAphspReader class");
0062 fVerboseCmd->SetParameterName("value", false);
0063 fVerboseCmd->SetRange("value >= 0");
0064 fVerboseCmd->AvailableForStates(G4State_Idle);
0065
0066 fNofParallelRunsCmd =
0067 new G4UIcmdWithAnInteger("/IAEAphspReader/numberOfParallelRuns", this);
0068 fNofParallelRunsCmd
0069 ->SetGuidance("Select the number of fragments N in which the phase-space");
0070 fNofParallelRunsCmd
0071 ->SetGuidance(" file is divided into.");
0072 fNofParallelRunsCmd->SetParameterName("N", false);
0073 fNofParallelRunsCmd->SetRange("N > 0");
0074 fNofParallelRunsCmd->AvailableForStates(G4State_Idle);
0075
0076 fParallelRunCmd =
0077 new G4UIcmdWithAnInteger("/IAEAphspReader/parallelRun", this);
0078 fParallelRunCmd->
0079 SetGuidance("Use the fragment F (of a total of N) from which particles");
0080 fParallelRunCmd->SetGuidance(" are extracted. (1 <= F <= N).");
0081 fParallelRunCmd->SetParameterName("frag", false);
0082 fParallelRunCmd->SetRange("frag > 0");
0083 fParallelRunCmd->AvailableForStates(G4State_Idle);
0084
0085 fTimesRecycledCmd =
0086 new G4UIcmdWithAnInteger("/IAEAphspReader/recycling", this);
0087 fTimesRecycledCmd
0088 ->SetGuidance("Select the number of times that each particle is reused.");
0089 fTimesRecycledCmd
0090 ->SetGuidance("(Caution: 1 means that each particle is used twice.)");
0091 fTimesRecycledCmd->SetParameterName("choice", false);
0092 fTimesRecycledCmd->SetRange("choice >= 0");
0093 fTimesRecycledCmd->AvailableForStates(G4State_Idle);
0094
0095 fPhspGlobalTranslationCmd =
0096 new G4UIcmdWith3VectorAndUnit("/IAEAphspReader/translate", this);
0097 fPhspGlobalTranslationCmd->SetGuidance("Set the translation components.");
0098 fPhspGlobalTranslationCmd->SetParameterName("x0", "y0", "z0", false);
0099 fPhspGlobalTranslationCmd->SetDefaultUnit("cm");
0100 fPhspGlobalTranslationCmd->SetUnitCandidates("mm cm m");
0101 fPhspGlobalTranslationCmd->AvailableForStates(G4State_Idle);
0102
0103 fPhspRotationOrderCmd =
0104 new G4UIcmdWithAnInteger("/IAEAphspReader/rotationOrder", this);
0105 fPhspRotationOrderCmd
0106 ->SetGuidance("Select the order in which the rotations are performed.");
0107 fPhspRotationOrderCmd
0108 ->SetGuidance("1 means X axis, 2 means Y axis and 3 means Z axis.");
0109 fPhspRotationOrderCmd
0110 ->SetGuidance("The argument must be a 3-digit integer without repetition.");
0111 fPhspRotationOrderCmd->SetParameterName("choice", false);
0112 fPhspRotationOrderCmd->AvailableForStates(G4State_Idle);
0113
0114 fRotXCmd = new G4UIcmdWithADoubleAndUnit("/IAEAphspReader/rotateX", this);
0115 fRotXCmd->SetGuidance("Set the rotation angle around the global X axis.");
0116 fRotXCmd->SetParameterName("angle", false);
0117 fRotXCmd->SetDefaultUnit("deg");
0118 fRotXCmd->SetUnitCandidates("deg rad");
0119 fRotXCmd->AvailableForStates(G4State_Idle);
0120
0121 fRotYCmd = new G4UIcmdWithADoubleAndUnit("/IAEAphspReader/rotateY", this);
0122 fRotYCmd->SetGuidance("Set the rotation angle around the global Y axis.");
0123 fRotYCmd->SetParameterName("angle", false);
0124 fRotYCmd->SetDefaultUnit("deg");
0125 fRotYCmd->SetUnitCandidates("deg rad");
0126 fRotYCmd->AvailableForStates(G4State_Idle);
0127
0128 fRotZCmd = new G4UIcmdWithADoubleAndUnit("/IAEAphspReader/rotateZ", this);
0129 fRotZCmd->SetGuidance("Set the rotation angle around the global Z axis.");
0130 fRotZCmd->SetParameterName("angle", false);
0131 fRotZCmd->SetDefaultUnit("deg");
0132 fRotZCmd->SetUnitCandidates("deg rad");
0133 fRotZCmd->AvailableForStates(G4State_Idle);
0134
0135 fIsocenterPosCmd =
0136 new G4UIcmdWith3VectorAndUnit("/IAEAphspReader/isocenterPosition", this);
0137 fIsocenterPosCmd->SetGuidance("Set the isocenter position.");
0138 fIsocenterPosCmd->SetParameterName("Xic", "Yic", "Zic", false);
0139 fIsocenterPosCmd->SetDefaultUnit("cm");
0140 fIsocenterPosCmd->SetUnitCandidates("mm cm m");
0141 fIsocenterPosCmd->AvailableForStates(G4State_Idle);
0142
0143 fCollimatorRotAxisCmd =
0144 new G4UIcmdWith3Vector("/IAEAphspReader/collimatorRotationAxis", this);
0145 fCollimatorRotAxisCmd
0146 ->SetGuidance("Set the rotation axis of the collimator.");
0147 fCollimatorRotAxisCmd->SetGuidance("It has to be a unit vector.");
0148 fCollimatorRotAxisCmd->SetParameterName("Ucol", "Vcol", "Wcol", false);
0149 fCollimatorRotAxisCmd->SetRange("Ucol != 0 || Vcol != 0 || Wcol != 0");
0150 fCollimatorRotAxisCmd->AvailableForStates(G4State_Idle);
0151
0152 fCollimatorAngleCmd =
0153 new G4UIcmdWithADoubleAndUnit("/IAEAphspReader/collimatorAngle", this);
0154 fCollimatorAngleCmd
0155 ->SetGuidance("Set the rotation angle of the phase space plane around ");
0156 fCollimatorAngleCmd
0157 ->SetGuidance("the rotation axis of the collimator.");
0158 fCollimatorAngleCmd->SetParameterName("angle", false);
0159 fCollimatorAngleCmd->SetDefaultUnit("deg");
0160 fCollimatorAngleCmd->SetUnitCandidates("deg rad");
0161 fCollimatorAngleCmd->AvailableForStates(G4State_Idle);
0162
0163 fGantryRotAxisCmd =
0164 new G4UIcmdWith3Vector("/IAEAphspReader/gantryRotationAxis", this);
0165 fGantryRotAxisCmd->SetGuidance("Set the rotation axis of the gantry.");
0166 fGantryRotAxisCmd->SetGuidance("It has to be a unit vector.");
0167 fGantryRotAxisCmd->SetParameterName("Ugan", "Vgan", "Wgan", false);
0168 fGantryRotAxisCmd->SetRange("Ugan != 0 || Vgan != 0 || Wgan != 0");
0169 fGantryRotAxisCmd->AvailableForStates(G4State_Idle);
0170
0171 fGantryAngleCmd =
0172 new G4UIcmdWithADoubleAndUnit("/IAEAphspReader/gantryAngle", this);
0173 fGantryAngleCmd
0174 ->SetGuidance("Set the rotation angle of the phase space plane around ");
0175 fGantryAngleCmd
0176 ->SetGuidance("the gantry rotation axis.");
0177 fGantryAngleCmd->SetParameterName("angle", false);
0178 fGantryAngleCmd->SetDefaultUnit("deg");
0179 fGantryAngleCmd->SetUnitCandidates("deg rad");
0180 fGantryAngleCmd->AvailableForStates(G4State_Idle);
0181
0182 fAxialSymmetryXCmd =
0183 new G4UIcmdWithABool("/IAEAphspReader/axialSymmetryX", this);
0184 fAxialSymmetryXCmd
0185 ->SetGuidance("Command to take into account rotational symmetry around X");
0186 fAxialSymmetryXCmd->SetParameterName("choice", true);
0187 fAxialSymmetryXCmd->SetDefaultValue(true);
0188 fAxialSymmetryXCmd->AvailableForStates(G4State_Idle);
0189
0190 fAxialSymmetryYCmd =
0191 new G4UIcmdWithABool("/IAEAphspReader/axialSymmetryY", this);
0192 fAxialSymmetryYCmd
0193 ->SetGuidance("Command to take into account rotational symmetry around Y");
0194 fAxialSymmetryYCmd->SetParameterName("choice", true);
0195 fAxialSymmetryYCmd->SetDefaultValue(true);
0196 fAxialSymmetryYCmd->AvailableForStates(G4State_Idle);
0197
0198 fAxialSymmetryZCmd =
0199 new G4UIcmdWithABool("/IAEAphspReader/axialSymmetryZ", this);
0200 fAxialSymmetryZCmd
0201 ->SetGuidance("Command to take into account rotational symmetry around Z");
0202 fAxialSymmetryZCmd->SetParameterName("choice", true);
0203 fAxialSymmetryZCmd->SetDefaultValue(true);
0204 fAxialSymmetryZCmd->AvailableForStates(G4State_Idle);
0205 }
0206
0207
0208 G4IAEAphspReaderMessenger::~G4IAEAphspReaderMessenger()
0209 {
0210 delete fPhaseSpaceDir;
0211 delete fVerboseCmd;
0212 delete fNofParallelRunsCmd;
0213 delete fParallelRunCmd;
0214 delete fTimesRecycledCmd;
0215 delete fPhspGlobalTranslationCmd;
0216 delete fPhspRotationOrderCmd;
0217 delete fRotXCmd;
0218 delete fRotYCmd;
0219 delete fRotZCmd;
0220 delete fIsocenterPosCmd;
0221 delete fCollimatorRotAxisCmd;
0222 delete fCollimatorAngleCmd;
0223 delete fGantryRotAxisCmd;
0224 delete fGantryAngleCmd;
0225 delete fAxialSymmetryXCmd;
0226 delete fAxialSymmetryYCmd;
0227 delete fAxialSymmetryZCmd;
0228 }
0229
0230
0231 void G4IAEAphspReaderMessenger::SetNewValue(G4UIcommand* command,
0232 G4String newValue)
0233 {
0234 if( command == fVerboseCmd )
0235 fIAEAphspReader->SetVerbose(fVerboseCmd->GetNewIntValue(newValue));
0236
0237 else if( command == fNofParallelRunsCmd )
0238 fIAEAphspReader
0239 ->SetTotalParallelRuns(fNofParallelRunsCmd->GetNewIntValue(newValue));
0240
0241 else if( command == fParallelRunCmd )
0242 fIAEAphspReader->SetParallelRun(fParallelRunCmd->GetNewIntValue(newValue));
0243
0244 else if( command == fTimesRecycledCmd )
0245 fIAEAphspReader
0246 ->SetTimesRecycled(fTimesRecycledCmd->GetNewIntValue(newValue) );
0247
0248 else if( command == fPhspGlobalTranslationCmd )
0249 fIAEAphspReader
0250 ->SetGlobalPhspTranslation(fPhspGlobalTranslationCmd
0251 ->GetNew3VectorValue(newValue) );
0252
0253 else if( command == fPhspRotationOrderCmd )
0254 fIAEAphspReader
0255 ->SetTimesRecycled(fPhspRotationOrderCmd->GetNewIntValue(newValue) );
0256
0257 else if( command == fRotXCmd )
0258 fIAEAphspReader->SetRotationX( fRotXCmd->GetNewDoubleValue(newValue) );
0259
0260 else if( command == fRotYCmd )
0261 fIAEAphspReader->SetRotationY( fRotYCmd->GetNewDoubleValue(newValue) );
0262
0263 else if( command == fRotZCmd )
0264 fIAEAphspReader->SetRotationZ( fRotZCmd->GetNewDoubleValue(newValue) );
0265
0266 else if( command == fIsocenterPosCmd )
0267 fIAEAphspReader
0268 ->SetIsocenterPosition(fIsocenterPosCmd->GetNew3VectorValue(newValue));
0269
0270 else if( command == fCollimatorRotAxisCmd )
0271 fIAEAphspReader
0272 ->SetCollimatorRotationAxis(fCollimatorRotAxisCmd
0273 ->GetNew3VectorValue(newValue) );
0274
0275 else if( command == fCollimatorAngleCmd )
0276 fIAEAphspReader
0277 ->SetCollimatorAngle(fCollimatorAngleCmd->GetNewDoubleValue(newValue));
0278
0279 else if( command == fGantryRotAxisCmd )
0280 fIAEAphspReader
0281 ->SetGantryRotationAxis(fGantryRotAxisCmd->GetNew3VectorValue(newValue));
0282
0283 else if( command == fGantryAngleCmd )
0284 fIAEAphspReader
0285 ->SetGantryAngle( fGantryAngleCmd->GetNewDoubleValue(newValue) );
0286
0287 else if( command == fAxialSymmetryXCmd )
0288 fIAEAphspReader
0289 ->SetAxialSymmetryX( fAxialSymmetryXCmd->GetNewBoolValue(newValue));
0290
0291 else if( command == fAxialSymmetryYCmd )
0292 fIAEAphspReader
0293 ->SetAxialSymmetryY( fAxialSymmetryYCmd->GetNewBoolValue(newValue) );
0294
0295 else if( command == fAxialSymmetryZCmd )
0296 fIAEAphspReader
0297 ->SetAxialSymmetryZ( fAxialSymmetryZCmd->GetNewBoolValue(newValue) );
0298
0299 }