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.9 2006/06/29 16:53:14 gunter Exp $ 27 /// \brief Implementation of the RunActionMess << 27 // GEANT4 tag $Name: geant4-08-01-patch-01 $ 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" 40 #include "G4UIparameter.hh" << 36 #include "G4UIcmdWith3Vector.hh" 41 << 42 #include <sstream> << 43 37 44 //....oooOO0OOooo........oooOO0OOooo........oo 38 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 45 39 46 RunActionMessenger::RunActionMessenger(RunActi << 40 RunActionMessenger::RunActionMessenger(RunAction* run) >> 41 :Run(run) 47 { 42 { 48 fRunDir = new G4UIdirectory("/testem/run/"); << 43 runDir = new G4UIdirectory("/testem/run/"); 49 fRunDir->SetGuidance("run commands"); << 44 runDir->SetGuidance("run control"); 50 << 45 51 fAccCmd = new G4UIcommand("/testem/run/accep << 46 accCmd1 = new G4UIcmdWith3Vector("/testem/run/acceptanceL1",this); 52 fAccCmd->SetGuidance("Check Edep and RMS of << 47 accCmd1->SetGuidance("set Edep and RMS"); 53 // << 48 accCmd1->SetGuidance("acceptance values for first layer"); 54 G4UIparameter* AbsNbPrm = new G4UIparameter( << 49 accCmd1->SetParameterName("edep","rms","limit",true); 55 AbsNbPrm->SetGuidance("absorber number : fro << 50 accCmd1->SetRange("edep>0 && edep<1 && rms>0"); 56 AbsNbPrm->SetParameterRange("AbsorNb>0"); << 51 accCmd1->AvailableForStates(G4State_PreInit,G4State_Idle); 57 fAccCmd->SetParameter(AbsNbPrm); << 52 58 // << 53 accCmd2 = new G4UIcmdWith3Vector("/testem/run/acceptanceL2",this); 59 G4UIparameter* edep = new G4UIparameter("Ede << 54 accCmd2->SetGuidance("set Edep and RMS"); 60 edep->SetGuidance("mean energy deposition (M << 55 accCmd2->SetGuidance("acceptance values for 2nd layer"); 61 edep->SetParameterRange("Edep>=0."); << 56 accCmd2->SetParameterName("edep","rms","limit",true); 62 fAccCmd->SetParameter(edep); << 57 accCmd2->SetRange("edep>0 && edep<1 && rms>0"); 63 // << 58 accCmd2->AvailableForStates(G4State_PreInit,G4State_Idle); 64 G4UIparameter* rms = new G4UIparameter("RMS" << 65 rms->SetGuidance("RMS of energy deposition ( << 66 rms->SetParameterRange("RMS>=0."); << 67 fAccCmd->SetParameter(rms); << 68 // << 69 G4UIparameter* lim = new G4UIparameter("nRMS << 70 lim->SetGuidance("Limit in number of RMS of << 71 lim->SetParameterRange("Limit>=0."); << 72 fAccCmd->SetParameter(lim); << 73 // << 74 fLimCmd = new G4UIcmdWithABool("/testem/run/ << 75 fLimCmd->SetGuidance("remove energy outside << 76 fLimCmd->AvailableForStates(G4State_PreInit, << 77 } 59 } 78 60 79 //....oooOO0OOooo........oooOO0OOooo........oo 61 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 80 62 81 RunActionMessenger::~RunActionMessenger() 63 RunActionMessenger::~RunActionMessenger() 82 { 64 { 83 delete fAccCmd; << 65 delete accCmd1; 84 delete fRunDir; << 66 delete accCmd2; 85 delete fLimCmd; << 67 delete runDir; 86 } 68 } 87 69 88 //....oooOO0OOooo........oooOO0OOooo........oo 70 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 89 71 90 void RunActionMessenger::SetNewValue(G4UIcomma << 72 void RunActionMessenger::SetNewValue(G4UIcommand* command,G4String newValue) 91 { << 73 { 92 if (command == fAccCmd) { << 74 if( command == accCmd1 ) 93 G4int num; << 75 { Run->SetEdepAndRMS(1,accCmd1->GetNew3VectorValue(newValue));} 94 G4double edep, rms, lim; << 76 95 std::istringstream is(newValue); << 77 if( command == accCmd2 ) 96 is >> num >> edep >> rms >> lim; << 78 { Run->SetEdepAndRMS(2,accCmd2->GetNew3VectorValue(newValue));} 97 fRunAction->SetEdepAndRMS(num, edep, rms, << 98 } << 99 << 100 if (command == fLimCmd) { << 101 fRunAction->SetApplyLimit(fLimCmd->GetNewB << 102 } << 103 } 79 } 104 80 105 //....oooOO0OOooo........oooOO0OOooo........oo 81 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 106 82