File indexing completed on 2026-09-15 08:29:44
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 #include "G02DetectorMessenger.hh"
0034
0035 #include "G02DetectorConstruction.hh"
0036
0037 #include "G4UIcmdWithAString.hh"
0038 #include "G4UIcmdWithAnInteger.hh"
0039 #include "G4UIdirectory.hh"
0040 #include "globals.hh"
0041
0042
0043
0044 G02DetectorMessenger::G02DetectorMessenger(G02DetectorConstruction* myDet)
0045 : G4UImessenger(),
0046 fTheDetector(myDet),
0047 fTheDetectorDir(0),
0048 fTheReadCommand(0),
0049 fTheWriteCommand(0),
0050 fTheStepCommand(0)
0051 {
0052 fTheDetectorDir = new G4UIdirectory("/mydet/");
0053 fTheDetectorDir->SetGuidance("Detector control.");
0054
0055 fTheReadCommand = new G4UIcmdWithAString("/mydet/readFile", this);
0056 fTheReadCommand->SetGuidance("READ GDML file with given name");
0057 fTheReadCommand->SetParameterName("FileRead", false);
0058 fTheReadCommand->SetDefaultValue("test.gdml");
0059 fTheReadCommand->AvailableForStates(G4State_PreInit);
0060
0061 fTheWriteCommand = new G4UIcmdWithAString("/mydet/writeFile", this);
0062 fTheWriteCommand->SetGuidance("WRITE geometry to GDML file with given name");
0063 fTheWriteCommand->SetParameterName("FileWrite", false);
0064 fTheWriteCommand->SetDefaultValue("wtest.gdml");
0065 fTheWriteCommand->AvailableForStates(G4State_PreInit);
0066
0067 fTheStepCommand = new G4UIcmdWithAString("/mydet/StepFile", this);
0068 fTheStepCommand->SetGuidance("Read STEP Tools files (name without extension)");
0069 fTheStepCommand->SetParameterName("STEPFile", false);
0070 fTheStepCommand->SetDefaultValue("mbb");
0071 fTheStepCommand->AvailableForStates(G4State_PreInit);
0072 }
0073
0074
0075
0076 G02DetectorMessenger::~G02DetectorMessenger()
0077 {
0078 delete fTheReadCommand;
0079 delete fTheWriteCommand;
0080 delete fTheStepCommand;
0081 delete fTheDetectorDir;
0082 }
0083
0084
0085
0086 void G02DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0087 {
0088 if (command == fTheReadCommand) {
0089 fTheDetector->SetReadFile(newValue);
0090 }
0091 if (command == fTheWriteCommand) {
0092 fTheDetector->SetWriteFile(newValue);
0093 }
0094 if (command == fTheStepCommand) {
0095 fTheDetector->SetStepFile(newValue);
0096 }
0097 }