Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // 26 // 27 /// \file DetectorMessenger.cc 27 /// \file DetectorMessenger.cc 28 /// \brief Implementation of the DetectorMesse 28 /// \brief Implementation of the DetectorMessenger class 29 29 30 #include "DetectorMessenger.hh" 30 #include "DetectorMessenger.hh" 31 << 32 #include "DetectorConstruction.hh" 31 #include "DetectorConstruction.hh" 33 32 34 #include "G4UIcmdWithAString.hh" << 35 #include "G4UIdirectory.hh" 33 #include "G4UIdirectory.hh" >> 34 #include "G4UIcmdWithAString.hh" 36 35 37 //....oooOO0OOooo........oooOO0OOooo........oo 36 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 38 37 39 DetectorMessenger::DetectorMessenger(DetectorC << 38 DetectorMessenger::DetectorMessenger( 40 : fDetectorConstruction(detectorConstruction << 39 DetectorConstruction* detectorConstruction) 41 { << 40 : G4UImessenger(), >> 41 fDetectorConstruction(detectorConstruction), >> 42 fDirectory(0), >> 43 fSetMethodCmd(0) >> 44 { 42 fDirectory = new G4UIdirectory("/placement/" 45 fDirectory = new G4UIdirectory("/placement/"); 43 fDirectory->SetGuidance("Transform example d 46 fDirectory->SetGuidance("Transform example detector control"); 44 << 47 45 fSetMethodCmd = new G4UIcmdWithAString("/pla << 48 fSetMethodCmd >> 49 = new G4UIcmdWithAString("/placement/setMethod",this); 46 fSetMethodCmd->SetGuidance("Select method fo 50 fSetMethodCmd->SetGuidance("Select method for definition of transformations."); 47 fSetMethodCmd->SetParameterName("Method", fa 51 fSetMethodCmd->SetParameterName("Method", false); 48 fSetMethodCmd->SetCandidates( 52 fSetMethodCmd->SetCandidates( 49 "WithDirectMatrix WithInverseMatrix WithAx 53 "WithDirectMatrix WithInverseMatrix WithAxialRotations WithEulerAngles WithReflections"); 50 fSetMethodCmd->AvailableForStates(G4State_Pr << 51 } 54 } 52 55 53 //....oooOO0OOooo........oooOO0OOooo........oo 56 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 54 57 55 DetectorMessenger::~DetectorMessenger() 58 DetectorMessenger::~DetectorMessenger() 56 { 59 { 57 delete fDirectory; 60 delete fDirectory; 58 delete fSetMethodCmd; 61 delete fSetMethodCmd; 59 } 62 } 60 63 61 //....oooOO0OOooo........oooOO0OOooo........oo 64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 62 65 63 void DetectorMessenger::SetNewValue(G4UIcomman << 66 void DetectorMessenger::SetNewValue(G4UIcommand* command, 64 { << 67 G4String newValue) 65 if (command == fSetMethodCmd) { << 68 { >> 69 if( command == fSetMethodCmd ) { 66 DetectorConstruction::EMethod method; 70 DetectorConstruction::EMethod method; 67 if (newValue == "WithDirectMatrix") << 71 if ( newValue == "WithDirectMatrix" ) 68 method = DetectorConstruction::kWithDire 72 method = DetectorConstruction::kWithDirectMatrix; 69 else if (newValue == "WithInverseMatrix") << 73 else if ( newValue == "WithInverseMatrix" ) 70 method = DetectorConstruction::kWithInve 74 method = DetectorConstruction::kWithInverseMatrix; 71 else if (newValue == "WithAxialRotations") << 75 else if ( newValue == "WithAxialRotations" ) 72 method = DetectorConstruction::kWithAxia 76 method = DetectorConstruction::kWithAxialRotations; 73 else if (newValue == "WithEulerAngles") << 77 else if ( newValue == "WithEulerAngles" ) 74 method = DetectorConstruction::kWithEule 78 method = DetectorConstruction::kWithEulerAngles; 75 else if (newValue == "WithReflections") << 79 else if ( newValue == "WithReflections" ) 76 method = DetectorConstruction::kWithRefl 80 method = DetectorConstruction::kWithReflections; 77 else << 81 else return; 78 return; << 79 fDetectorConstruction->SetMethod(method); 82 fDetectorConstruction->SetMethod(method); 80 } 83 } 81 } 84 } 82 85 83 //....oooOO0OOooo........oooOO0OOooo........oo 86 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 84 87