Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ExG4EventAction01Messenger.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 //
26 // $Id$
27 //
30 
31 #include "ExG4EventAction01Messenger.hh"
32 #include "ExG4EventAction01.hh"
33 
34 #include "G4UIdirectory.hh"
35 #include "G4UIcmdWithAnInteger.hh"
36 #include "G4UIcmdWithABool.hh"
37 #include "globals.hh"
38 
39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
40 
42  ExG4EventAction01* eventAction)
43  : G4UImessenger(),
44  fEventAction(eventAction),
45  fTopDirectory(0),
46  fDirectory(0),
47  fSetVerboseLevelCmd(0),
48  fSetSaveRndmCmd(0)
49 {
50  fTopDirectory = new G4UIdirectory("/ExG4/");
51  fTopDirectory->SetGuidance("UI commands of common example classes");
52 
53  fDirectory = new G4UIdirectory("/ExG4/event/");
54  fDirectory->SetGuidance("Event control");
55 
56  fSetVerboseLevelCmd
57  = new G4UIcmdWithAnInteger("/ExG4/event/verboseLevel",this);
58  fSetVerboseLevelCmd->SetGuidance("Set event verbose level ." );
59  fSetVerboseLevelCmd->SetParameterName("VerboseLevel",false);
60  fSetVerboseLevelCmd->AvailableForStates(G4State_PreInit, G4State_Init);
61 
62  fSetSaveRndmCmd = new G4UIcmdWithABool("/ExG4/event/saveRndm",this);
63  fSetSaveRndmCmd
64  ->SetGuidance("Activate saving random number at endOfEvent.");
65  fSetSaveRndmCmd->SetParameterName("SaveRndm",false);
66  fSetSaveRndmCmd->AvailableForStates(G4State_Idle, G4State_Init);
67 }
68 
69 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
70 
72 {
73  delete fTopDirectory;
74  delete fDirectory;
75  delete fSetVerboseLevelCmd;
76  delete fSetSaveRndmCmd;
77 }
78 
79 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
80 
82  G4String newValue)
83 {
84  if(command == fSetVerboseLevelCmd) {
85  fEventAction
86  ->SetVerboseLevel(fSetVerboseLevelCmd->GetNewIntValue(newValue));
87  }
88  else if ( command == fSetSaveRndmCmd ) {
89  fEventAction->SetSaveRndm(fSetSaveRndmCmd->GetNewBoolValue(newValue));
90  }
91 }
92 
93 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4int GetNewIntValue(const char *paramString)
ExG4EventAction01Messenger(ExG4EventAction01 *eventAction)
virtual void SetNewValue(G4UIcommand *command, G4String newValue)
static G4bool GetNewBoolValue(const char *paramString)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void SetSaveRndm(G4bool value)
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:240
void SetVerboseLevel(G4int level)