Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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$
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 :fRunAction(run)
48 {
49  fRunDir = new G4UIdirectory("/testem/run/");
50  fRunDir->SetGuidance("run commands");
51 
52  fAccCmd = new G4UIcommand("/testem/run/acceptance",this);
53  fAccCmd->SetGuidance("Check Edep and RMS of energy deposition for given absorber");
54  //
55  G4UIparameter* AbsNbPrm = new G4UIparameter("AbsorNb",'i',false);
56  AbsNbPrm->SetGuidance("absorber number : from 1 to NbOfAbsor");
57  AbsNbPrm->SetParameterRange("AbsorNb>0");
58  fAccCmd->SetParameter(AbsNbPrm);
59  //
60  G4UIparameter* edep = new G4UIparameter("Edep",'d',false);
61  edep->SetGuidance("mean energy deposition (MeV)");
62  edep->SetParameterRange("Edep>=0.");
63  fAccCmd->SetParameter(edep);
64  //
65  G4UIparameter* rms = new G4UIparameter("RMS",'d',false);
66  rms->SetGuidance("RMS of energy deposition (MeV)");
67  rms->SetParameterRange("RMS>=0.");
68  fAccCmd->SetParameter(rms);
69  //
70  G4UIparameter* lim = new G4UIparameter("nRMS",'d',false);
71  lim->SetGuidance("Limit in number of RMS of energy deposition");
72  lim->SetParameterRange("Limit>=0.");
73  fAccCmd->SetParameter(lim);
74  //
75  fLimCmd = new G4UIcmdWithABool("/testem/run/limitEdep",this);
76  fLimCmd->SetGuidance("remove energy outside acceptance limit");
78 }
79 
80 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
81 
83 {
84  delete fAccCmd;
85  delete fRunDir;
86  delete fLimCmd;
87 }
88 
89 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
90 
92 {
93  if( command == fAccCmd )
94  {
95  G4int num;
96  G4double edep, rms, lim;
97  std::istringstream is(newValue);
98  is >> num >> edep >> rms >> lim;
99  fRunAction->SetEdepAndRMS(num,edep,rms,lim);
100  }
101 
102  if( command == fLimCmd )
103  { fRunAction->SetApplyLimit(fLimCmd->GetNewBoolValue(newValue));}
104 }
105 
106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......