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/TestEm3/src/RunActio << 26 // $Id: RunActionMessenger.cc,v 1.13 2007/04/25 10:07:27 vnivanch Exp $ 27 /// \brief Implementation of the RunActionMess << 27 // GEANT4 tag $Name: geant4-09-02 $ 28 // << 29 // 28 // 30 //....oooOO0OOooo........oooOO0OOooo........oo 29 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oo 30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 31 33 #include "RunActionMessenger.hh" 32 #include "RunActionMessenger.hh" 34 33 35 #include "RunAction.hh" 34 #include "RunAction.hh" 36 << 37 #include "G4UIcmdWithABool.hh" << 38 #include "G4UIcommand.hh" << 39 #include "G4UIdirectory.hh" 35 #include "G4UIdirectory.hh" >> 36 #include "G4UIcommand.hh" 40 #include "G4UIparameter.hh" 37 #include "G4UIparameter.hh" >> 38 #include "G4UIcmdWithABool.hh" 41 39 42 #include <sstream> 40 #include <sstream> 43 41 44 //....oooOO0OOooo........oooOO0OOooo........oo 42 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 45 43 46 RunActionMessenger::RunActionMessenger(RunActi << 44 RunActionMessenger::RunActionMessenger(RunAction* run) >> 45 :Run(run) 47 { 46 { 48 fRunDir = new G4UIdirectory("/testem/run/"); << 47 runDir = new G4UIdirectory("/testem/run/"); 49 fRunDir->SetGuidance("run commands"); << 48 runDir->SetGuidance("run commands"); 50 << 49 51 fAccCmd = new G4UIcommand("/testem/run/accep << 50 accCmd = new G4UIcommand("/testem/run/acceptance",this); 52 fAccCmd->SetGuidance("Check Edep and RMS of << 51 accCmd->SetGuidance("Check Edep and RMS of energy deposition for given absorber"); 53 // 52 // 54 G4UIparameter* AbsNbPrm = new G4UIparameter( << 53 G4UIparameter* AbsNbPrm = new G4UIparameter("AbsorNb",'i',false); 55 AbsNbPrm->SetGuidance("absorber number : fro 54 AbsNbPrm->SetGuidance("absorber number : from 1 to NbOfAbsor"); 56 AbsNbPrm->SetParameterRange("AbsorNb>0"); 55 AbsNbPrm->SetParameterRange("AbsorNb>0"); 57 fAccCmd->SetParameter(AbsNbPrm); << 56 accCmd->SetParameter(AbsNbPrm); 58 // << 57 // 59 G4UIparameter* edep = new G4UIparameter("Ede << 58 G4UIparameter* edep = new G4UIparameter("Edep",'d',false); 60 edep->SetGuidance("mean energy deposition (M 59 edep->SetGuidance("mean energy deposition (MeV)"); 61 edep->SetParameterRange("Edep>=0."); 60 edep->SetParameterRange("Edep>=0."); 62 fAccCmd->SetParameter(edep); << 61 accCmd->SetParameter(edep); 63 // << 62 // 64 G4UIparameter* rms = new G4UIparameter("RMS" << 63 G4UIparameter* rms = new G4UIparameter("RMS",'d',false); 65 rms->SetGuidance("RMS of energy deposition ( 64 rms->SetGuidance("RMS of energy deposition (MeV)"); 66 rms->SetParameterRange("RMS>=0."); 65 rms->SetParameterRange("RMS>=0."); 67 fAccCmd->SetParameter(rms); << 66 accCmd->SetParameter(rms); 68 // << 67 // 69 G4UIparameter* lim = new G4UIparameter("nRMS << 68 G4UIparameter* lim = new G4UIparameter("nRMS",'d',false); 70 lim->SetGuidance("Limit in number of RMS of 69 lim->SetGuidance("Limit in number of RMS of energy deposition"); 71 lim->SetParameterRange("Limit>=0."); 70 lim->SetParameterRange("Limit>=0."); 72 fAccCmd->SetParameter(lim); << 71 accCmd->SetParameter(lim); 73 // 72 // 74 fLimCmd = new G4UIcmdWithABool("/testem/run/ << 73 limCmd = new G4UIcmdWithABool("/testem/run/limitEdep",this); 75 fLimCmd->SetGuidance("remove energy outside << 74 limCmd->SetGuidance("remove energy outside acceptance limit"); 76 fLimCmd->AvailableForStates(G4State_PreInit, << 75 limCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 77 } 76 } 78 77 79 //....oooOO0OOooo........oooOO0OOooo........oo 78 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 80 79 81 RunActionMessenger::~RunActionMessenger() 80 RunActionMessenger::~RunActionMessenger() 82 { 81 { 83 delete fAccCmd; << 82 delete accCmd; 84 delete fRunDir; << 83 delete runDir; 85 delete fLimCmd; << 84 delete limCmd; 86 } 85 } 87 86 88 //....oooOO0OOooo........oooOO0OOooo........oo 87 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 89 88 90 void RunActionMessenger::SetNewValue(G4UIcomma << 89 void RunActionMessenger::SetNewValue(G4UIcommand* command,G4String newValue) 91 { << 90 { 92 if (command == fAccCmd) { << 91 if( command == accCmd ) 93 G4int num; << 92 { 94 G4double edep, rms, lim; << 93 G4int num; 95 std::istringstream is(newValue); << 94 G4double edep, rms, lim; 96 is >> num >> edep >> rms >> lim; << 95 std::istringstream is(newValue); 97 fRunAction->SetEdepAndRMS(num, edep, rms, << 96 is >> num >> edep >> rms >> lim; 98 } << 97 Run->SetEdepAndRMS(num,edep,rms,lim); 99 << 98 } 100 if (command == fLimCmd) { << 99 101 fRunAction->SetApplyLimit(fLimCmd->GetNewB << 100 if( command == limCmd ) 102 } << 101 { Run->SetApplyLimit(limCmd->GetNewBoolValue(newValue));} 103 } 102 } 104 103 105 //....oooOO0OOooo........oooOO0OOooo........oo 104 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 106 105