Geant4_10
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 
32 #include "ExG4EventAction01.hh"
33 
34 #include "G4UIdirectory.hh"
35 #include "G4UIcmdWithAnInteger.hh"
36 #include "G4UIcmdWithABool.hh"
37 #include "globals.hh"
38 
39 //_____________________________________________________________________________
41  : G4UImessenger(),
42  fEventAction(eventAction),
43  fTopDirectory(0),
44  fDirectory(0),
45  fSetVerboseLevelCmd(0),
46  fSetPrintModuloCmd(0),
47  fSetSaveRndmCmd(0)
48 {
49  fTopDirectory = new G4UIdirectory("/ExG4/");
50  fTopDirectory->SetGuidance("UI commands of common example classes");
51 
52  fDirectory = new G4UIdirectory("/ExG4/event/");
53  fDirectory->SetGuidance("Event control");
54 
55  fSetVerboseLevelCmd = new G4UIcmdWithAnInteger("/ExG4/event/verboseLevel",this);
56  fSetVerboseLevelCmd->SetGuidance("Set event verbose level ." );
57  fSetVerboseLevelCmd->SetParameterName("VerboseLevel",false);
58  fSetVerboseLevelCmd->AvailableForStates(G4State_PreInit, G4State_Init);
59 
60  fSetPrintModuloCmd = new G4UIcmdWithAnInteger("/ExG4/event/printModulo",this);
61  fSetPrintModuloCmd->SetGuidance("Print events modulo n");
62  fSetPrintModuloCmd->SetParameterName("PrintModulo",false);
63  fSetPrintModuloCmd->SetRange("PrintModulo>0");
64  fSetPrintModuloCmd->AvailableForStates(G4State_Idle, G4State_Init);
65 
66  fSetSaveRndmCmd = new G4UIcmdWithABool("/ExG4/event/saveRndm",this);
67  fSetSaveRndmCmd->SetGuidance("Activate saving random number at endOfEvent.");
68  fSetSaveRndmCmd->SetParameterName("SaveRndm",false);
69  fSetSaveRndmCmd->AvailableForStates(G4State_Idle, G4State_Init);
70 }
71 
72 //_____________________________________________________________________________
74 {
75  delete fTopDirectory;
76  delete fDirectory;
77  delete fSetVerboseLevelCmd;
78  delete fSetPrintModuloCmd;
79  delete fSetSaveRndmCmd;
80 }
81 
82 //_____________________________________________________________________________
84 {
85  if(command == fSetVerboseLevelCmd) {
86  fEventAction->SetVerboseLevel(fSetVerboseLevelCmd->GetNewIntValue(newValue));
87  }
88  else if ( command == fSetPrintModuloCmd ) {
89  fEventAction->SetPrintModulo(fSetPrintModuloCmd->GetNewIntValue(newValue));
90  }
91  else if ( command == fSetSaveRndmCmd ) {
92  fEventAction->SetSaveRndm(fSetSaveRndmCmd->GetNewBoolValue(newValue));
93  }
94 }
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 SetPrintModulo(G4int value)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
Definition of the ExG4EventAction01 class.
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void SetSaveRndm(G4bool value)
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
void SetVerboseLevel(G4int level)
Definition of the ExG4EventAction01Messenger class.