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 >> 28 // >> 29 // $Id: DetectorMessenger.cc 78723 2014-01-20 10:32:17Z gcosmo $ >> 30 // >> 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... >> 32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 38 33 39 #include "DetectorMessenger.hh" 34 #include "DetectorMessenger.hh" 40 35 41 #include "DetectorConstruction.hh" 36 #include "DetectorConstruction.hh" 42 << 37 #include "G4UIdirectory.hh" 43 #include "G4UIcmdWithADoubleAndUnit.hh" << 44 #include "G4UIcmdWithAString.hh" 38 #include "G4UIcmdWithAString.hh" >> 39 #include "G4UIcmdWithAnInteger.hh" >> 40 #include "G4UIcmdWithADoubleAndUnit.hh" 45 41 46 //....oooOO0OOooo........oooOO0OOooo........oo 42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 47 43 48 DetectorMessenger::DetectorMessenger(DetectorC << 44 DetectorMessenger::DetectorMessenger(DetectorConstruction * Det) 49 : G4UImessenger(), << 45 :G4UImessenger(),fDetector(Det), 50 fDetector(Det), << 46 fTestemDir(0), 51 fTestemDir(0), << 47 fDetDir(0), 52 fDetDir(0), << 48 fMaterCmd(0), 53 fMaterCmd(0), << 49 fRadiusCmd(0), 54 fRadiusCmd(0), << 50 fTrackingCutCmd(0) 55 fTrackingCutCmd(0) << 51 { 56 { << 57 fTestemDir = new G4UIdirectory("/w/"); 52 fTestemDir = new G4UIdirectory("/w/"); 58 fTestemDir->SetGuidance("Detector control"); << 53 fTestemDir->SetGuidance(" detector control."); 59 << 54 60 fDetDir = new G4UIdirectory("/w/det/"); 55 fDetDir = new G4UIdirectory("/w/det/"); 61 fDetDir->SetGuidance("Detector construction << 56 fDetDir->SetGuidance("detector construction commands"); 62 << 57 63 fMaterCmd = new G4UIcmdWithAString("/w/det/s << 58 fMaterCmd = new G4UIcmdWithAString("/w/det/setMat",this); 64 fMaterCmd->SetGuidance("Select material of t << 59 fMaterCmd->SetGuidance("Select material of the sphere."); 65 fMaterCmd->SetParameterName("Choice", false) << 60 fMaterCmd->SetParameterName("choice",false); 66 fMaterCmd->AvailableForStates(G4State_PreIni << 61 fMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 67 fMaterCmd->SetToBeBroadcasted(false); << 62 fMaterCmd->SetToBeBroadcasted(false); 68 << 63 69 fRadiusCmd = new G4UIcmdWithADoubleAndUnit(" << 64 fRadiusCmd = new G4UIcmdWithADoubleAndUnit("/w/det/setRadius",this); 70 fRadiusCmd->SetGuidance("Set radius of the a 65 fRadiusCmd->SetGuidance("Set radius of the absorber"); 71 fRadiusCmd->SetParameterName("Radius", false << 66 fRadiusCmd->SetParameterName("Radius",false); 72 fRadiusCmd->SetRange("Radius>0."); 67 fRadiusCmd->SetRange("Radius>0."); 73 fRadiusCmd->SetUnitCategory("Length"); 68 fRadiusCmd->SetUnitCategory("Length"); 74 fRadiusCmd->AvailableForStates(G4State_PreIn << 69 fRadiusCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 75 fRadiusCmd->SetToBeBroadcasted(false); 70 fRadiusCmd->SetToBeBroadcasted(false); 76 << 71 77 fTrackingCutCmd = new G4UIcmdWithADoubleAndU << 72 fTrackingCutCmd = >> 73 new G4UIcmdWithADoubleAndUnit("/w/det/setTrackingCut",this); 78 fTrackingCutCmd->SetGuidance("Set tracking c 74 fTrackingCutCmd->SetGuidance("Set tracking cut in the absorber"); 79 fTrackingCutCmd->SetParameterName("Cut", fal << 75 fTrackingCutCmd->SetParameterName("Cut",false); 80 fTrackingCutCmd->SetRange("Cut>0."); 76 fTrackingCutCmd->SetRange("Cut>0."); 81 fTrackingCutCmd->SetUnitCategory("Energy"); 77 fTrackingCutCmd->SetUnitCategory("Energy"); 82 fTrackingCutCmd->AvailableForStates(G4State_ << 78 fTrackingCutCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 83 fTrackingCutCmd->SetToBeBroadcasted(false); 79 fTrackingCutCmd->SetToBeBroadcasted(false); 84 } 80 } 85 81 86 //....oooOO0OOooo........oooOO0OOooo........oo 82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 87 83 88 DetectorMessenger::~DetectorMessenger() 84 DetectorMessenger::~DetectorMessenger() 89 { 85 { 90 delete fMaterCmd; 86 delete fMaterCmd; 91 delete fRadiusCmd; 87 delete fRadiusCmd; 92 delete fTrackingCutCmd; 88 delete fTrackingCutCmd; 93 delete fDetDir; << 89 delete fDetDir; 94 delete fTestemDir; 90 delete fTestemDir; 95 } 91 } 96 92 97 //....oooOO0OOooo........oooOO0OOooo........oo 93 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 98 94 99 void DetectorMessenger::SetNewValue(G4UIcomman << 95 void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue) 100 { << 96 { 101 if (command == fMaterCmd) { << 97 if( command == fMaterCmd ) 102 fDetector->SetMaterial(newValue); << 98 { fDetector->SetMaterial(newValue);} 103 } << 99 104 << 100 if( command == fRadiusCmd ) 105 if (command == fRadiusCmd) { << 101 { fDetector->SetRadius(fRadiusCmd->GetNewDoubleValue(newValue));} 106 fDetector->SetRadius(fRadiusCmd->GetNewDou << 102 107 } << 103 if( command == fTrackingCutCmd ) 108 << 104 { fDetector->SetTrackingCut(fTrackingCutCmd->GetNewDoubleValue(newValue));} 109 if (command == fTrackingCutCmd) { << 110 fDetector->SetTrackingCut(fTrackingCutCmd- << 111 } << 112 } 105 } >> 106 >> 107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 113 108