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.1 2007/08/16 10:32:04 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 "G4UIcmdWithADouble.hh" |
---|
37 | #include "G4UIcmdWithAnInteger.hh" |
---|
38 | #include "G4UIcmdWithAString.hh" |
---|
39 | |
---|
40 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
41 | |
---|
42 | RunActionMessenger::RunActionMessenger(RunAction * ra): runaction(ra) |
---|
43 | { |
---|
44 | actDir = new G4UIdirectory("/testex/run/"); |
---|
45 | actDir->SetGuidance("run commands"); |
---|
46 | |
---|
47 | binSizeCmd = new G4UIcmdWithADouble("/testex/run/binSize", this); |
---|
48 | binSizeCmd->SetGuidance("Set bin size."); |
---|
49 | binSizeCmd->SetParameterName("binSize", false); |
---|
50 | binSizeCmd->AvailableForStates(G4State_PreInit, G4State_Idle); |
---|
51 | |
---|
52 | verboseCmd = new G4UIcmdWithAnInteger("/testex/run/verbose", this); |
---|
53 | verboseCmd->SetGuidance("Set verbose level."); |
---|
54 | verboseCmd->SetParameterName("verbose", false); |
---|
55 | verboseCmd->AvailableForStates(G4State_PreInit, G4State_Idle); |
---|
56 | |
---|
57 | histoNameCmd = new G4UIcmdWithAString("/testex/run/HistoName", this); |
---|
58 | histoNameCmd->SetGuidance("Set histo file name."); |
---|
59 | histoNameCmd->SetParameterName("histoName", false); |
---|
60 | histoNameCmd->AvailableForStates(G4State_PreInit, G4State_Idle); |
---|
61 | |
---|
62 | histoTypeCmd = new G4UIcmdWithAString("/testex/run/HistoType", this); |
---|
63 | histoTypeCmd->SetGuidance("Set histo file type."); |
---|
64 | histoTypeCmd->SetParameterName("histoType", false); |
---|
65 | histoTypeCmd->AvailableForStates(G4State_PreInit, G4State_Idle); |
---|
66 | |
---|
67 | } |
---|
68 | |
---|
69 | |
---|
70 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
71 | RunActionMessenger::~RunActionMessenger() |
---|
72 | { |
---|
73 | delete binSizeCmd; |
---|
74 | delete verboseCmd; |
---|
75 | delete histoNameCmd; |
---|
76 | delete histoTypeCmd; |
---|
77 | } |
---|
78 | |
---|
79 | |
---|
80 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|
81 | void RunActionMessenger::SetNewValue(G4UIcommand* command,G4String newValue) |
---|
82 | { |
---|
83 | |
---|
84 | if( command == binSizeCmd ) |
---|
85 | { runaction->SetBinSize(binSizeCmd->GetNewDoubleValue(newValue));} |
---|
86 | |
---|
87 | if( command == verboseCmd ) |
---|
88 | { runaction->SetVerbose(verboseCmd->GetNewIntValue(newValue));} |
---|
89 | |
---|
90 | if( command == histoNameCmd ) |
---|
91 | { runaction->SetHistoName(newValue);} |
---|
92 | |
---|
93 | if( command == histoTypeCmd ) |
---|
94 | { runaction->SetHistoType(newValue);} |
---|
95 | |
---|
96 | } |
---|
97 | |
---|
98 | //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... |
---|