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 // This example is provided by the Geant4-DNA << 27 // Any report or published results obtained us << 28 // shall cite the following Geant4-DNA collabo << 29 // Med. Phys. 45 (2018) e722-e739 << 30 // Phys. Med. 31 (2015) 861-874 << 31 // Med. Phys. 37 (2010) 4692-4708 << 32 // Int. J. Model. Simul. Sci. Comput. 1 (2010) << 33 // << 34 // The Geant4-DNA web site is available at htt << 35 // << 36 /// \file medical/dna/wvalue/src/DetectorMesse 26 /// \file medical/dna/wvalue/src/DetectorMessenger.cc 37 /// \brief Implementation of the DetectorMesse 27 /// \brief Implementation of the DetectorMessenger class 38 28 39 #include "DetectorMessenger.hh" 29 #include "DetectorMessenger.hh" 40 << 41 #include "DetectorConstruction.hh" 30 #include "DetectorConstruction.hh" 42 31 43 #include "G4UIcmdWithADoubleAndUnit.hh" << 32 #include "G4UIdirectory.hh" 44 #include "G4UIcmdWithAString.hh" 33 #include "G4UIcmdWithAString.hh" >> 34 #include "G4UIcmdWithAnInteger.hh" >> 35 #include "G4UIcmdWithADoubleAndUnit.hh" 45 36 46 //....oooOO0OOooo........oooOO0OOooo........oo 37 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 47 38 48 DetectorMessenger::DetectorMessenger(DetectorC << 39 DetectorMessenger::DetectorMessenger(DetectorConstruction * Det) 49 : G4UImessenger(), << 40 :G4UImessenger(),fDetector(Det), 50 fDetector(Det), << 41 fTestemDir(0), 51 fTestemDir(0), << 42 fDetDir(0), 52 fDetDir(0), << 43 fMaterCmd(0), 53 fMaterCmd(0), << 44 fRadiusCmd(0), 54 fRadiusCmd(0), << 45 fTrackingCutCmd(0) 55 fTrackingCutCmd(0) << 46 { 56 { << 57 fTestemDir = new G4UIdirectory("/w/"); 47 fTestemDir = new G4UIdirectory("/w/"); 58 fTestemDir->SetGuidance("Detector control"); << 48 fTestemDir->SetGuidance(" detector control."); 59 << 49 60 fDetDir = new G4UIdirectory("/w/det/"); 50 fDetDir = new G4UIdirectory("/w/det/"); 61 fDetDir->SetGuidance("Detector construction << 51 fDetDir->SetGuidance("detector construction commands"); 62 << 52 63 fMaterCmd = new G4UIcmdWithAString("/w/det/s << 53 fMaterCmd = new G4UIcmdWithAString("/w/det/setMat",this); 64 fMaterCmd->SetGuidance("Select material of t << 54 fMaterCmd->SetGuidance("Select material of the sphere."); 65 fMaterCmd->SetParameterName("Choice", false) << 55 fMaterCmd->SetParameterName("choice",false); 66 fMaterCmd->AvailableForStates(G4State_PreIni << 56 fMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 67 fMaterCmd->SetToBeBroadcasted(false); << 57 fMaterCmd->SetToBeBroadcasted(false); 68 << 58 69 fRadiusCmd = new G4UIcmdWithADoubleAndUnit(" << 59 fRadiusCmd = new G4UIcmdWithADoubleAndUnit("/w/det/setRadius",this); 70 fRadiusCmd->SetGuidance("Set radius of the a 60 fRadiusCmd->SetGuidance("Set radius of the absorber"); 71 fRadiusCmd->SetParameterName("Radius", false << 61 fRadiusCmd->SetParameterName("Radius",false); 72 fRadiusCmd->SetRange("Radius>0."); 62 fRadiusCmd->SetRange("Radius>0."); 73 fRadiusCmd->SetUnitCategory("Length"); 63 fRadiusCmd->SetUnitCategory("Length"); 74 fRadiusCmd->AvailableForStates(G4State_PreIn << 64 fRadiusCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 75 fRadiusCmd->SetToBeBroadcasted(false); 65 fRadiusCmd->SetToBeBroadcasted(false); 76 << 66 77 fTrackingCutCmd = new G4UIcmdWithADoubleAndU << 67 fTrackingCutCmd = >> 68 new G4UIcmdWithADoubleAndUnit("/w/det/setTrackingCut",this); 78 fTrackingCutCmd->SetGuidance("Set tracking c 69 fTrackingCutCmd->SetGuidance("Set tracking cut in the absorber"); 79 fTrackingCutCmd->SetParameterName("Cut", fal << 70 fTrackingCutCmd->SetParameterName("Cut",false); 80 fTrackingCutCmd->SetRange("Cut>0."); 71 fTrackingCutCmd->SetRange("Cut>0."); 81 fTrackingCutCmd->SetUnitCategory("Energy"); 72 fTrackingCutCmd->SetUnitCategory("Energy"); 82 fTrackingCutCmd->AvailableForStates(G4State_ << 73 fTrackingCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 83 fTrackingCutCmd->SetToBeBroadcasted(false); 74 fTrackingCutCmd->SetToBeBroadcasted(false); 84 } 75 } 85 76 86 //....oooOO0OOooo........oooOO0OOooo........oo 77 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 87 78 88 DetectorMessenger::~DetectorMessenger() 79 DetectorMessenger::~DetectorMessenger() 89 { 80 { 90 delete fMaterCmd; 81 delete fMaterCmd; 91 delete fRadiusCmd; 82 delete fRadiusCmd; 92 delete fTrackingCutCmd; 83 delete fTrackingCutCmd; 93 delete fDetDir; << 84 delete fDetDir; 94 delete fTestemDir; 85 delete fTestemDir; 95 } 86 } 96 87 97 //....oooOO0OOooo........oooOO0OOooo........oo 88 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 98 89 99 void DetectorMessenger::SetNewValue(G4UIcomman << 90 void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue) 100 { << 91 { 101 if (command == fMaterCmd) { << 92 if( command == fMaterCmd ) 102 fDetector->SetMaterial(newValue); << 93 { fDetector->SetMaterial(newValue);} 103 } << 94 104 << 95 if( command == fRadiusCmd ) 105 if (command == fRadiusCmd) { << 96 { fDetector->SetRadius(fRadiusCmd->GetNewDoubleValue(newValue));} 106 fDetector->SetRadius(fRadiusCmd->GetNewDou << 97 107 } << 98 if( command == fTrackingCutCmd ) 108 << 99 { fDetector->SetTrackingCut(fTrackingCutCmd->GetNewDoubleValue(newValue));} 109 if (command == fTrackingCutCmd) { << 110 fDetector->SetTrackingCut(fTrackingCutCmd- << 111 } << 112 } 100 } 113 101