File indexing completed on 2025-01-31 09:22:13
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 #include "GammaRayTelDetectorConstruction.hh"
0038 #include "GammaRayTelDetectorMessenger.hh"
0039
0040 #include "G4UIcmdWithADoubleAndUnit.hh"
0041 #include "G4UIcmdWithAnInteger.hh"
0042 #include "G4UIcmdWithAString.hh"
0043 #include "G4UIcmdWithoutParameter.hh"
0044 #include "G4UIdirectory.hh"
0045
0046
0047
0048 GammaRayTelDetectorMessenger::GammaRayTelDetectorMessenger(GammaRayTelDetectorConstruction *GammaRayTelDet) : detector(GammaRayTelDet) {
0049 directory = new G4UIdirectory("/payload/");
0050 directory->SetGuidance("GammaRayTel payload control.");
0051
0052
0053
0054 converterMaterialCmd = new G4UIcmdWithAString("/payload/setConvMat", this);
0055 converterMaterialCmd->SetGuidance("Select the material of the converter.");
0056 converterMaterialCmd->SetParameterName("choice", false);
0057 converterMaterialCmd->AvailableForStates(G4State_Idle);
0058
0059
0060
0061 converterThicknessCmd = new G4UIcmdWithADoubleAndUnit("/payload/setConvThick", this);
0062 converterThicknessCmd->SetGuidance("Set the thickness of the converter.");
0063 converterThicknessCmd->SetParameterName("Size", false);
0064 converterThicknessCmd->SetRange("Size>=0.");
0065 converterThicknessCmd->SetUnitCategory("Length");
0066 converterThicknessCmd->AvailableForStates(G4State_Idle);
0067
0068
0069
0070 siliconThicknessCmd = new G4UIcmdWithADoubleAndUnit("/payload/setSiThick", this);
0071 siliconThicknessCmd->SetGuidance("Set the thickness of the silicon.");
0072 siliconThicknessCmd->SetParameterName("Size", false);
0073 siliconThicknessCmd->SetRange("Size>=0.");
0074 siliconThicknessCmd->SetUnitCategory("Length");
0075 siliconThicknessCmd->AvailableForStates(G4State_Idle);
0076
0077
0078
0079 siliconPitchCmd = new G4UIcmdWithADoubleAndUnit("/payload/setSiPitch", this);
0080 siliconPitchCmd->SetGuidance("Set the pitch of silicon strips.");
0081 siliconPitchCmd->SetParameterName("Size", false);
0082 siliconPitchCmd->SetRange("Size>=0.");
0083 siliconPitchCmd->SetUnitCategory("Length");
0084 siliconPitchCmd->AvailableForStates(G4State_Idle);
0085
0086
0087
0088 siliconTileXYCmd = new G4UIcmdWithADoubleAndUnit("/payload/setSiTileXY", this);
0089 siliconTileXYCmd->SetGuidance("Set XY dimensions of a silicon tile.");
0090 siliconTileXYCmd->SetParameterName("Size", false);
0091 siliconTileXYCmd->SetRange("Size>=0.");
0092 siliconTileXYCmd->SetUnitCategory("Length");
0093 siliconTileXYCmd->AvailableForStates(G4State_Idle);
0094
0095
0096
0097 numberOfSiTilesCmd = new G4UIcmdWithAnInteger("/payload/setNbOfSiTiles", this);
0098 numberOfSiTilesCmd->SetGuidance("Set the number of silicon tiles.");
0099 numberOfSiTilesCmd->SetParameterName("NbSiTiles", false);
0100 numberOfSiTilesCmd->SetRange("NbSiTiles>0 && NbSiTiles<100");
0101 numberOfSiTilesCmd->AvailableForStates(G4State_Idle);
0102
0103
0104
0105 numberOfTKRLayersCmd = new G4UIcmdWithAnInteger("/payload/setNbOfTKRLayers", this);
0106 numberOfTKRLayersCmd->SetGuidance("Set the number of TKR layers.");
0107 numberOfTKRLayersCmd->SetParameterName("NbTKRLayers", false);
0108 numberOfTKRLayersCmd->SetRange("NbTKRLayers>0 && NbTKRLayers<30");
0109 numberOfTKRLayersCmd->AvailableForStates(G4State_Idle);
0110
0111
0112
0113 layerDistanceCmd = new G4UIcmdWithADoubleAndUnit("/payload/setLayerDistance", this);
0114 layerDistanceCmd->SetGuidance("Set the distance between two layers.");
0115 layerDistanceCmd->SetParameterName("Size", false);
0116 layerDistanceCmd->SetRange("Size>=0.");
0117 layerDistanceCmd->SetUnitCategory("Length");
0118 layerDistanceCmd->AvailableForStates(G4State_Idle);
0119
0120
0121
0122 viewsDistanceCmd = new G4UIcmdWithADoubleAndUnit("/payload/setViewsDistance", this);
0123 viewsDistanceCmd->SetGuidance("Set the distance between X and Y views.");
0124 viewsDistanceCmd->SetParameterName("Size", false);
0125 viewsDistanceCmd->SetRange("Size>=0.");
0126 viewsDistanceCmd->SetUnitCategory("Length");
0127 viewsDistanceCmd->AvailableForStates(G4State_Idle);
0128
0129
0130
0131 calThicknessCmd = new G4UIcmdWithADoubleAndUnit("/payload/setCALThick", this);
0132 calThicknessCmd->SetGuidance("Set the thickness of CAL detectors.");
0133 calThicknessCmd->SetParameterName("Size", false);
0134 calThicknessCmd->SetRange("Size>=0.");
0135 calThicknessCmd->SetUnitCategory("Length");
0136 calThicknessCmd->AvailableForStates(G4State_Idle);
0137
0138
0139
0140 numberOfCALBarsCmd = new G4UIcmdWithAnInteger("/payload/setNbOfCALBars", this);
0141 numberOfCALBarsCmd->SetGuidance("Set the number of CsI bars.");
0142 numberOfCALBarsCmd->SetParameterName("NbSiTiles", false);
0143 numberOfCALBarsCmd->SetRange("NbSiTiles>0 && NbSiTiles<100");
0144 numberOfCALBarsCmd->AvailableForStates(G4State_Idle);
0145
0146
0147
0148 numberOfCALLayersCmd = new G4UIcmdWithAnInteger("/payload/setNbOfCALLayers", this);
0149 numberOfCALLayersCmd->SetGuidance("Set the number of CAL layers.");
0150 numberOfCALLayersCmd->SetParameterName("NbCALLayers", false);
0151 numberOfCALLayersCmd->SetRange("NbCALLayers>0 && NbCALLayers<16");
0152 numberOfCALLayersCmd->AvailableForStates(G4State_Idle);
0153
0154
0155
0156 acdThicknessCmd = new G4UIcmdWithADoubleAndUnit("/payload/setACDThick", this);
0157 acdThicknessCmd->SetGuidance("Set the thickness of ACD detectors");
0158 acdThicknessCmd->SetParameterName("Size", false);
0159 acdThicknessCmd->SetRange("Size>=0.");
0160 acdThicknessCmd->SetUnitCategory("Length");
0161 acdThicknessCmd->AvailableForStates(G4State_Idle);
0162
0163
0164
0165 updateCmd = new G4UIcmdWithoutParameter("/payload/update", this);
0166 updateCmd->SetGuidance("Update the geometry of the payload.");
0167 updateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
0168 updateCmd->SetGuidance("if you changed geometrical value(s).");
0169 updateCmd->AvailableForStates(G4State_Idle);
0170
0171
0172
0173 magneticFieldCmd = new G4UIcmdWithADoubleAndUnit("/payload/setField", this);
0174 magneticFieldCmd->SetGuidance("Define the magnetic field.");
0175 magneticFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
0176 magneticFieldCmd->SetParameterName("Bz", false);
0177 magneticFieldCmd->SetUnitCategory("Magnetic flux density");
0178 magneticFieldCmd->AvailableForStates(G4State_Idle);
0179 }
0180
0181
0182
0183 GammaRayTelDetectorMessenger::~GammaRayTelDetectorMessenger() {
0184 delete converterMaterialCmd;
0185 delete converterThicknessCmd;
0186 delete numberOfSiTilesCmd;
0187 delete numberOfTKRLayersCmd;
0188 delete siliconTileXYCmd;
0189 delete siliconPitchCmd;
0190 delete siliconThicknessCmd;
0191 delete layerDistanceCmd;
0192 delete viewsDistanceCmd;
0193 delete acdThicknessCmd;
0194 delete numberOfCALLayersCmd;
0195 delete numberOfCALBarsCmd;
0196 delete calThicknessCmd;
0197 delete updateCmd;
0198 delete magneticFieldCmd;
0199 delete directory;
0200 }
0201
0202
0203
0204 void GammaRayTelDetectorMessenger::SetNewValue(G4UIcommand *command, G4String newValue) {
0205
0206
0207 if (command == converterMaterialCmd) {
0208 detector->SetConverterMaterial(newValue);
0209 } else if (command == converterThicknessCmd) {
0210 detector->SetConverterThickness(converterThicknessCmd->GetNewDoubleValue(newValue));
0211 } else
0212
0213
0214
0215 if (command == siliconTileXYCmd) {
0216 detector->SetTKRTileSizeXY(siliconTileXYCmd->GetNewDoubleValue(newValue));
0217 } else if (command == siliconPitchCmd) {
0218 detector->SetTKRSiliconPitch(siliconPitchCmd->GetNewDoubleValue(newValue));
0219 } else if (command == siliconThicknessCmd) {
0220 detector->SetTKRSiliconThickness(siliconThicknessCmd->GetNewDoubleValue(newValue));
0221 } else if (command == numberOfSiTilesCmd) {
0222 detector->SetNbOfTKRTiles(numberOfSiTilesCmd->GetNewIntValue(newValue));
0223 } else if (command == numberOfTKRLayersCmd) {
0224 detector->SetNbOfTKRLayers(numberOfTKRLayersCmd->GetNewIntValue(newValue));
0225 } else if (command == layerDistanceCmd) {
0226 detector->SetTKRLayerDistance(layerDistanceCmd->GetNewDoubleValue(newValue));
0227 } else if (command == viewsDistanceCmd) {
0228 detector->SetTKRViewsDistance(viewsDistanceCmd->GetNewDoubleValue(newValue));
0229 } else
0230
0231
0232
0233 if (command == numberOfCALLayersCmd) {
0234 detector->SetNbOfCALLayers(numberOfCALLayersCmd->GetNewIntValue(newValue));
0235 } else if (command == numberOfCALBarsCmd) {
0236 detector->SetNbOfCALBars(numberOfCALBarsCmd->GetNewIntValue(newValue));
0237 } else if (command == calThicknessCmd) {
0238 detector->SetCALBarThickness(calThicknessCmd->GetNewDoubleValue(newValue));
0239 } else
0240
0241
0242
0243 if (command == acdThicknessCmd) {
0244 detector->SetACDThickness(acdThicknessCmd->GetNewDoubleValue(newValue));
0245 } else if (command == updateCmd) {
0246 detector->UpdateGeometry();
0247 } else if (command == magneticFieldCmd) {
0248 detector->SetMagField(magneticFieldCmd->GetNewDoubleValue(newValue));
0249 }
0250 }