File indexing completed on 2025-01-18 09:17:01
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 "DetectorMessenger.hh"
0030 #include "DetectorConstruction.hh"
0031
0032
0033
0034 DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
0035 :fDetector(Det)
0036 {
0037 fQuadDir = new G4UIdirectory("/quad/");
0038 fQuadDir->SetGuidance("Quadrupole control.");
0039
0040 fModelCmd = new G4UIcmdWithAnInteger("/quad/setModel",this);
0041 fModelCmd->SetGuidance("Select magnetic field model.");
0042 fModelCmd->SetParameterName("model",false);
0043 fModelCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0044
0045 fProfileCmd = new G4UIcmdWithAnInteger("/displayProfile",this);
0046 fProfileCmd->SetGuidance("Display beam profile.");
0047 fProfileCmd->SetParameterName("profile",false);
0048 fProfileCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0049
0050 fGridCmd = new G4UIcmdWithAnInteger("/setGrid",this);
0051 fGridCmd->SetGuidance("Put grid and shadow plane.");
0052 fGridCmd->SetParameterName("grid",false);
0053 fGridCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0054
0055 fCoefCmd = new G4UIcmdWithAnInteger("/setCoef",this);
0056 fCoefCmd->SetGuidance("Calculate aberration coefficients.");
0057 fCoefCmd->SetParameterName("coef",false);
0058 fCoefCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0059
0060 fG1Cmd = new G4UIcmdWithADouble("/quad/setG1",this);
0061 fG1Cmd->SetGuidance("Set G1.");
0062 fG1Cmd->SetParameterName("G1",false);
0063 fG1Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0064
0065 fG2Cmd = new G4UIcmdWithADouble("/quad/setG2",this);
0066 fG2Cmd->SetGuidance("Set G2.");
0067 fG2Cmd->SetParameterName("G2",false);
0068 fG2Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0069
0070 fG3Cmd = new G4UIcmdWithADouble("/quad/setG3",this);
0071 fG3Cmd->SetGuidance("Set G3.");
0072 fG3Cmd->SetParameterName("G3",false);
0073 fG3Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0074
0075 fG4Cmd = new G4UIcmdWithADouble("/quad/setG4",this);
0076 fG4Cmd->SetGuidance("Set G4.");
0077 fG4Cmd->SetParameterName("G4",false);
0078 fG4Cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
0079
0080 }
0081
0082
0083
0084 DetectorMessenger::~DetectorMessenger()
0085 {
0086 delete fG1Cmd;
0087 delete fG2Cmd;
0088 delete fG3Cmd;
0089 delete fG4Cmd;
0090 delete fQuadDir;
0091 delete fModelCmd;
0092 delete fProfileCmd;
0093 delete fGridCmd;
0094 delete fCoefCmd;
0095 }
0096
0097
0098
0099 void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
0100 {
0101 if( command == fModelCmd )
0102 { fDetector->SetModel(fModelCmd->GetNewIntValue(newValue));}
0103
0104 if( command == fProfileCmd )
0105 { fDetector->SetProfile(fProfileCmd->GetNewIntValue(newValue));}
0106
0107 if( command == fGridCmd )
0108 { fDetector->SetGrid(fGridCmd->GetNewIntValue(newValue));}
0109
0110 if( command == fCoefCmd )
0111 { fDetector->SetCoef(fGridCmd->GetNewIntValue(newValue));}
0112
0113 if( command == fG1Cmd )
0114 { fDetector->SetG1(fG1Cmd->GetNewDoubleValue(newValue));}
0115
0116 if( command == fG2Cmd )
0117 { fDetector->SetG2(fG1Cmd->GetNewDoubleValue(newValue));}
0118
0119 if( command == fG3Cmd )
0120 { fDetector->SetG3(fG1Cmd->GetNewDoubleValue(newValue));}
0121
0122 if( command == fG4Cmd )
0123 { fDetector->SetG4(fG1Cmd->GetNewDoubleValue(newValue));}
0124
0125 }