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 /// \file electromagnetic/microelectronics1/sr 26 /// \file electromagnetic/microelectronics1/src/DetectorMessenger.cc 27 /// \brief Implementation of the DetectorMesse 27 /// \brief Implementation of the DetectorMessenger class 28 // 28 // 29 // 29 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 32 33 #include "DetectorMessenger.hh" 33 #include "DetectorMessenger.hh" 34 34 35 #include "DetectorConstruction.hh" 35 #include "DetectorConstruction.hh" 36 #include "G4UIdirectory.hh" 36 #include "G4UIdirectory.hh" 37 #include "G4UIcmdWithAString.hh" 37 #include "G4UIcmdWithAString.hh" 38 #include "G4UIcmdWithADoubleAndUnit.hh" 38 #include "G4UIcmdWithADoubleAndUnit.hh" 39 #include "G4UIcmdWithoutParameter.hh" 39 #include "G4UIcmdWithoutParameter.hh" 40 40 41 //....oooOO0OOooo........oooOO0OOooo........oo 41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 42 42 43 DetectorMessenger::DetectorMessenger(DetectorC 43 DetectorMessenger::DetectorMessenger(DetectorConstruction * Det) 44 :G4UImessenger(),fDetector(Det), 44 :G4UImessenger(),fDetector(Det), 45 fmicroelectronicsDir(0), 45 fmicroelectronicsDir(0), 46 fDetDir(0), 46 fDetDir(0), 47 fMaterCmd(0), 47 fMaterCmd(0), 48 fSizeCmd(0) 48 fSizeCmd(0) 49 { 49 { 50 50 51 fmicroelectronicsDir = new G4UIdirectory("/m 51 fmicroelectronicsDir = new G4UIdirectory("/microelectronics/"); 52 fmicroelectronicsDir->SetGuidance("commands 52 fmicroelectronicsDir->SetGuidance("commands specific to this example"); 53 53 54 fDetDir = new G4UIdirectory("/microelectroni 54 fDetDir = new G4UIdirectory("/microelectronics/det/"); 55 fDetDir->SetGuidance("detector construction 55 fDetDir->SetGuidance("detector construction commands"); 56 56 57 fMaterCmd = new G4UIcmdWithAString("/microel 57 fMaterCmd = new G4UIcmdWithAString("/microelectronics/det/setMat",this); 58 fMaterCmd->SetGuidance("Select material of t 58 fMaterCmd->SetGuidance("Select material of the box."); 59 fMaterCmd->SetParameterName("choice",false); 59 fMaterCmd->SetParameterName("choice",false); 60 fMaterCmd->AvailableForStates(G4State_PreIni 60 fMaterCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 61 fMaterCmd->SetToBeBroadcasted(false); 61 fMaterCmd->SetToBeBroadcasted(false); 62 62 63 fSizeCmd = new G4UIcmdWithADoubleAndUnit("/m 63 fSizeCmd = new G4UIcmdWithADoubleAndUnit("/microelectronics/det/setSize",this); 64 fSizeCmd->SetGuidance("Set size of the box") 64 fSizeCmd->SetGuidance("Set size of the box"); 65 fSizeCmd->SetParameterName("Size",false); 65 fSizeCmd->SetParameterName("Size",false); 66 fSizeCmd->SetRange("Size>0."); 66 fSizeCmd->SetRange("Size>0."); 67 fSizeCmd->SetUnitCategory("Length"); 67 fSizeCmd->SetUnitCategory("Length"); 68 fSizeCmd->AvailableForStates(G4State_PreInit 68 fSizeCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 69 fSizeCmd->SetToBeBroadcasted(false); 69 fSizeCmd->SetToBeBroadcasted(false); 70 } 70 } 71 71 72 //....oooOO0OOooo........oooOO0OOooo........oo 72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 73 73 74 DetectorMessenger::~DetectorMessenger() 74 DetectorMessenger::~DetectorMessenger() 75 { 75 { 76 delete fMaterCmd; 76 delete fMaterCmd; 77 delete fSizeCmd; 77 delete fSizeCmd; 78 delete fDetDir; 78 delete fDetDir; 79 delete fmicroelectronicsDir; 79 delete fmicroelectronicsDir; 80 } 80 } 81 81 82 //....oooOO0OOooo........oooOO0OOooo........oo 82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 83 83 84 void DetectorMessenger::SetNewValue(G4UIcomman 84 void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue) 85 { 85 { 86 if( command == fMaterCmd ) 86 if( command == fMaterCmd ) 87 { fDetector->SetMaterial(newValue);} 87 { fDetector->SetMaterial(newValue);} 88 88 89 if( command == fSizeCmd ) 89 if( command == fSizeCmd ) 90 { fDetector->SetSize(fSizeCmd->GetNewDouble 90 { fDetector->SetSize(fSizeCmd->GetNewDoubleValue(newValue));} 91 91 92 } 92 } 93 93 94 //....oooOO0OOooo........oooOO0OOooo........oo 94 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 95 95