File indexing completed on 2025-01-31 09:22:03
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 "FlashDetectorMessenger.hh"
0030 #include "FlashDetectorConstruction.hh"
0031 #include "G4UIdirectory.hh"
0032 #include "G4UIcmdWith3VectorAndUnit.hh"
0033 #include "G4UIcmdWithoutParameter.hh"
0034 #include "G4UIcmdWithAString.hh"
0035 #include "G4UIcmdWithADoubleAndUnit.hh"
0036
0037
0038 FlashDetectorMessenger::FlashDetectorMessenger(FlashDetectorConstruction* detector)
0039 :flashDetector(detector)
0040 {
0041
0042 fChangeThePhantomDir = new G4UIdirectory("/fChangePhantom/");
0043 fChangeThePhantomDir -> SetGuidance("Command to fChange the Phantom Size/position");
0044
0045
0046 fChangeThePhantomMaterialCmd = new G4UIcmdWithAString("/changePhantom/material", this);
0047 fChangeThePhantomMaterialCmd -> SetGuidance("fChange the Phantom and the detector material");
0048 fChangeThePhantomMaterialCmd -> SetParameterName("PhantomMaterial", false);
0049 fChangeThePhantomMaterialCmd -> SetDefaultValue("G4_WATER");
0050 fChangeThePhantomMaterialCmd -> AvailableForStates(G4State_Idle);
0051
0052
0053
0054
0055 fChangeTheDetectorDir = new G4UIdirectory("/changeDetector/");
0056 fChangeTheDetectorDir -> SetGuidance("Command to fChange the Detector Size");
0057
0058
0059 fChangeTheDetectorMaterialCmd = new G4UIcmdWithAString("/changeDetector/material", this);
0060 fChangeTheDetectorMaterialCmd -> SetGuidance("fChange the Phantom and the detector material");
0061 fChangeTheDetectorMaterialCmd -> SetParameterName("PhantomMaterial", false);
0062
0063 fChangeTheDetectorMaterialCmd -> AvailableForStates(G4State_Idle);
0064
0065
0066
0067 fUpdateCmd = new G4UIcmdWithoutParameter("/changePhantom/update",this);
0068 fUpdateCmd->SetGuidance("Update Phantom/Detector geometry.");
0069 fUpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
0070 fUpdateCmd->SetGuidance("if you fChanged geometrical value(s).");
0071 fUpdateCmd->AvailableForStates(G4State_Idle);
0072
0073 fUpdateCmd_d = new G4UIcmdWithoutParameter("/changeDetector/update",this);
0074 fUpdateCmd_d->SetGuidance("Update Detector geometry.");
0075 fUpdateCmd_d->SetGuidance("This command MUST be applied before \"beamOn\" ");
0076 fUpdateCmd_d->SetGuidance("if you fChanged geometrical value(s).");
0077 fUpdateCmd_d->AvailableForStates(G4State_Idle);
0078
0079
0080
0081 }
0082
0083
0084 FlashDetectorMessenger::~FlashDetectorMessenger()
0085 {
0086
0087
0088 delete fChangeThePhantomDir;
0089 delete fChangeTheDetectorDir;
0090
0091 delete fChangeThePhantomMaterialCmd;
0092 delete fChangeTheDetectorMaterialCmd;
0093
0094 }
0095
0096
0097 void FlashDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
0098 {
0099
0100
0101 if (command == fChangeThePhantomMaterialCmd)
0102 {
0103 flashDetector -> SetPhantomMaterial(newValue);
0104 }
0105
0106 else if (command == fChangeTheDetectorMaterialCmd)
0107 {
0108 flashDetector -> SetDetectorMaterial(newValue);
0109 }
0110
0111
0112
0113 }