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