source: trunk/examples/extended/electromagnetic/TestEm3/src/RunActionMessenger.cc @ 1309

Last change on this file since 1309 was 1230, checked in by garnier, 14 years ago

update to geant4.9.3

File size: 4.1 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer                                           *
4// *                                                                  *
5// * The  Geant4 software  is  copyright of the Copyright Holders  of *
6// * the Geant4 Collaboration.  It is provided  under  the terms  and *
7// * conditions of the Geant4 Software License,  included in the file *
8// * LICENSE and available at  http://cern.ch/geant4/license .  These *
9// * include a list of copyright holders.                             *
10// *                                                                  *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work  make  any representation or  warranty, express or implied, *
14// * regarding  this  software system or assume any liability for its *
15// * use.  Please see the license in the file  LICENSE  and URL above *
16// * for the full disclaimer and the limitation of liability.         *
17// *                                                                  *
18// * This  code  implementation is the result of  the  scientific and *
19// * technical work of the GEANT4 collaboration.                      *
20// * By using,  copying,  modifying or  distributing the software (or *
21// * any work based  on the software)  you  agree  to acknowledge its *
22// * use  in  resulting  scientific  publications,  and indicate your *
23// * acceptance of all terms of the Geant4 Software license.          *
24// ********************************************************************
25//
26// $Id: RunActionMessenger.cc,v 1.13 2007/04/25 10:07:27 vnivanch Exp $
27// GEANT4 tag $Name: geant4-09-03-cand-01 $
28//
29//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
30//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
31
32#include "RunActionMessenger.hh"
33
34#include "RunAction.hh"
35#include "G4UIdirectory.hh"
36#include "G4UIcommand.hh"
37#include "G4UIparameter.hh"
38#include "G4UIcmdWithABool.hh"
39
40#include <sstream>
41
42//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
43
44RunActionMessenger::RunActionMessenger(RunAction* run)
45:Run(run)
46{
47  runDir = new G4UIdirectory("/testem/run/");
48  runDir->SetGuidance("run commands");
49   
50  accCmd = new G4UIcommand("/testem/run/acceptance",this);
51  accCmd->SetGuidance("Check Edep and RMS of energy deposition for given absorber");
52  //
53  G4UIparameter* AbsNbPrm = new G4UIparameter("AbsorNb",'i',false);
54  AbsNbPrm->SetGuidance("absorber number : from 1 to NbOfAbsor");
55  AbsNbPrm->SetParameterRange("AbsorNb>0");
56  accCmd->SetParameter(AbsNbPrm);
57  //   
58  G4UIparameter* edep = new G4UIparameter("Edep",'d',false);
59  edep->SetGuidance("mean energy deposition (MeV)");
60  edep->SetParameterRange("Edep>=0.");
61  accCmd->SetParameter(edep);
62  //   
63  G4UIparameter* rms = new G4UIparameter("RMS",'d',false);
64  rms->SetGuidance("RMS of energy deposition (MeV)");
65  rms->SetParameterRange("RMS>=0.");
66  accCmd->SetParameter(rms);
67  //   
68  G4UIparameter* lim = new G4UIparameter("nRMS",'d',false);
69  lim->SetGuidance("Limit in number of RMS of energy deposition");
70  lim->SetParameterRange("Limit>=0.");
71  accCmd->SetParameter(lim);
72  //
73  limCmd = new G4UIcmdWithABool("/testem/run/limitEdep",this);
74  limCmd->SetGuidance("remove energy outside acceptance limit");
75  limCmd->AvailableForStates(G4State_PreInit,G4State_Idle);     
76}
77
78//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
79
80RunActionMessenger::~RunActionMessenger()
81{
82  delete accCmd;
83  delete runDir;   
84  delete limCmd;
85}
86
87//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
88
89void RunActionMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
90{     
91  if( command == accCmd )
92   { 
93     G4int num; 
94     G4double edep, rms, lim;
95     std::istringstream is(newValue);
96     is >> num >> edep >> rms >> lim;
97     Run->SetEdepAndRMS(num,edep,rms,lim);
98   }
99
100  if( command == limCmd )
101   { Run->SetApplyLimit(limCmd->GetNewBoolValue(newValue));}
102}
103
104//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Note: See TracBrowser for help on using the repository browser.