Warning, file /geant4/examples/extended/geometry/transforms/src/DetectorMessenger.cc was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
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 #include "DetectorMessenger.hh"
0031
0032 #include "DetectorConstruction.hh"
0033
0034 #include "G4UIcmdWithAString.hh"
0035 #include "G4UIdirectory.hh"
0036
0037
0038
0039 DetectorMessenger::DetectorMessenger(DetectorConstruction* detectorConstruction)
0040 : fDetectorConstruction(detectorConstruction)
0041 {
0042 fDirectory = new G4UIdirectory("/placement/");
0043 fDirectory->SetGuidance("Transform example detector control");
0044
0045 fSetMethodCmd = new G4UIcmdWithAString("/placement/setMethod", this);
0046 fSetMethodCmd->SetGuidance("Select method for definition of transformations.");
0047 fSetMethodCmd->SetParameterName("Method", false);
0048 fSetMethodCmd->SetCandidates(
0049 "WithDirectMatrix WithInverseMatrix WithAxialRotations WithEulerAngles WithReflections");
0050 fSetMethodCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
0051 }
0052
0053
0054
0055 DetectorMessenger::~DetectorMessenger()
0056 {
0057 delete fDirectory;
0058 delete fSetMethodCmd;
0059 }
0060
0061
0062
0063 void DetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
0064 {
0065 if (command == fSetMethodCmd) {
0066 DetectorConstruction::EMethod method;
0067 if (newValue == "WithDirectMatrix")
0068 method = DetectorConstruction::kWithDirectMatrix;
0069 else if (newValue == "WithInverseMatrix")
0070 method = DetectorConstruction::kWithInverseMatrix;
0071 else if (newValue == "WithAxialRotations")
0072 method = DetectorConstruction::kWithAxialRotations;
0073 else if (newValue == "WithEulerAngles")
0074 method = DetectorConstruction::kWithEulerAngles;
0075 else if (newValue == "WithReflections")
0076 method = DetectorConstruction::kWithReflections;
0077 else
0078 return;
0079 fDetectorConstruction->SetMethod(method);
0080 }
0081 }
0082
0083