File indexing completed on 2026-09-20 08:29:34
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 #include "RMC01DetectorMessenger.hh"
0040
0041 #include "RMC01DetectorConstruction.hh"
0042
0043 #include "G4UIcmdWith3VectorAndUnit.hh"
0044 #include "G4UIcmdWithADoubleAndUnit.hh"
0045 #include "G4UIdirectory.hh"
0046
0047
0048
0049 RMC01DetectorMessenger::RMC01DetectorMessenger(RMC01DetectorConstruction* GeneralDet)
0050 : G4UImessenger(),
0051 fTheDetector(GeneralDet),
0052 fGeneralDir(0),
0053 fDetDir(0),
0054 fSetSensitiveVolumeHeightCmd(0),
0055 fSetSensitiveVolumeRadiusCmd(0),
0056 fSetShieldingThicknessCmd(0)
0057 {
0058 fGeneralDir = new G4UIdirectory("/RMC01/");
0059 fGeneralDir->SetGuidance("Control of the Geant4 Reverse Monte Carlo example1");
0060
0061 fDetDir = new G4UIdirectory("/RMC01/geometry/");
0062 fDetDir->SetGuidance("Geometry control");
0063
0064 fSetSensitiveVolumeHeightCmd =
0065 new G4UIcmdWithADoubleAndUnit("/RMC01/geometry/SetSensitiveVolumeHeight", this);
0066 fSetSensitiveVolumeHeightCmd->SetGuidance("Set the height of the sensitive cylinder");
0067 fSetSensitiveVolumeHeightCmd->AvailableForStates(G4State_PreInit);
0068
0069 fSetSensitiveVolumeRadiusCmd =
0070 new G4UIcmdWithADoubleAndUnit("/RMC01/geometry/SetSensitiveVolumeRadius", this);
0071 fSetSensitiveVolumeRadiusCmd->SetGuidance("Set the radius of the sensitive cylinder");
0072 fSetSensitiveVolumeRadiusCmd->AvailableForStates(G4State_PreInit);
0073
0074 fSetShieldingThicknessCmd =
0075 new G4UIcmdWithADoubleAndUnit("/RMC01/geometry/SetShieldingThickness", this);
0076 fSetShieldingThicknessCmd->SetGuidance("Set the thickness of the Aluminum Shielding sphere");
0077 fSetShieldingThicknessCmd->AvailableForStates(G4State_PreInit);
0078 }
0079
0080
0081
0082 RMC01DetectorMessenger::~RMC01DetectorMessenger()
0083 {
0084 if (fGeneralDir) delete fGeneralDir;
0085 if (fDetDir) delete fDetDir;
0086 if (fSetSensitiveVolumeHeightCmd) delete fSetSensitiveVolumeHeightCmd;
0087 if (fSetSensitiveVolumeRadiusCmd) delete fSetSensitiveVolumeRadiusCmd;
0088 if (fSetShieldingThicknessCmd) delete fSetShieldingThicknessCmd;
0089 }
0090
0091
0092
0093 void RMC01DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0094 {
0095 if (command == fSetSensitiveVolumeHeightCmd) {
0096 fTheDetector->SetSensitiveVolumeHeight(
0097 fSetSensitiveVolumeHeightCmd->GetNewDoubleValue(newValue));
0098 }
0099
0100 else if (command == fSetSensitiveVolumeRadiusCmd) {
0101 fTheDetector->SetSensitiveVolumeRadius(
0102 fSetSensitiveVolumeRadiusCmd->GetNewDoubleValue(newValue));
0103 }
0104
0105 else if (command == fSetShieldingThicknessCmd) {
0106 fTheDetector->SetShieldingThickness(fSetShieldingThicknessCmd->GetNewDoubleValue(newValue));
0107 }
0108 }
0109
0110