Geant4  10.02.p01
RunActionMessenger.cc
Go to the documentation of this file.
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 //
28 //
29 // $Id: RunActionMessenger.cc 67268 2013-02-13 11:38:40Z ihrivnac $
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 
34 #include "RunActionMessenger.hh"
35 
36 #include "RunAction.hh"
37 #include "G4UIdirectory.hh"
38 #include "G4UIcommand.hh"
39 #include "G4UIparameter.hh"
40 #include "G4UIcmdWithABool.hh"
41 
42 #include <sstream>
43 
44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
45 
47 :G4UImessenger(),fRunAction(run),
48  fRunDir(0),
49  fAccCmd(0),
50  fLimCmd(0)
51 {
52  fRunDir = new G4UIdirectory("/testem/run/");
53  fRunDir->SetGuidance("run commands");
54 
55  fAccCmd = new G4UIcommand("/testem/run/acceptance",this);
56  fAccCmd->SetGuidance("Check Edep and RMS of energy deposition for given absorber");
57  //
58  G4UIparameter* AbsNbPrm = new G4UIparameter("AbsorNb",'i',false);
59  AbsNbPrm->SetGuidance("absorber number : from 1 to NbOfAbsor");
60  AbsNbPrm->SetParameterRange("AbsorNb>0");
61  fAccCmd->SetParameter(AbsNbPrm);
62  //
63  G4UIparameter* edep = new G4UIparameter("Edep",'d',false);
64  edep->SetGuidance("mean energy deposition (MeV)");
65  edep->SetParameterRange("Edep>=0.");
66  fAccCmd->SetParameter(edep);
67  //
68  G4UIparameter* rms = new G4UIparameter("RMS",'d',false);
69  rms->SetGuidance("RMS of energy deposition (MeV)");
70  rms->SetParameterRange("RMS>=0.");
71  fAccCmd->SetParameter(rms);
72  //
73  G4UIparameter* lim = new G4UIparameter("nRMS",'d',false);
74  lim->SetGuidance("Limit in number of RMS of energy deposition");
75  lim->SetParameterRange("Limit>=0.");
76  fAccCmd->SetParameter(lim);
77  //
78  fLimCmd = new G4UIcmdWithABool("/testem/run/limitEdep",this);
79  fLimCmd->SetGuidance("remove energy outside acceptance limit");
81 }
82 
83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
84 
86 {
87  delete fAccCmd;
88  delete fRunDir;
89  delete fLimCmd;
90 }
91 
92 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
93 
95 {
96  if( command == fAccCmd )
97  {
98  G4int num;
99  G4double edep, rms, lim;
100  std::istringstream is(newValue);
101  is >> num >> edep >> rms >> lim;
102  fRunAction->SetEdepAndRMS(num,edep,rms,lim);
103  }
104 
105  if( command == fLimCmd )
107 }
108 
109 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:152
void SetParameterRange(const char *theRange)
RunActionMessenger(RunAction *)
int G4int
Definition: G4Types.hh:78
static G4bool GetNewBoolValue(const char *paramString)
void SetApplyLimit(G4bool val)
Definition: RunAction.cc:132
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void SetEdepAndRMS(G4ThreeVector)
Definition: RunAction.cc:185
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:239
G4UIcmdWith3Vector * fAccCmd
virtual void SetNewValue(G4UIcommand *, G4String)
G4UIcmdWithABool * fLimCmd
double G4double
Definition: G4Types.hh:76
Run action class.
Definition: RunAction.hh:45
void SetGuidance(const char *theGuidance)
G4UIdirectory * fRunDir