Geant4-11
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
G4EvManMessenger Class Reference

#include <G4EvManMessenger.hh>

Inheritance diagram for G4EvManMessenger:
G4UImessenger

Public Member Functions

G4bool CommandsShouldBeInMaster () const
 
 G4EvManMessenger (G4EventManager *fEvMan)
 
G4String GetCurrentValue (G4UIcommand *command)
 
G4bool operator!= (const G4UImessenger &messenger) const
 
G4bool operator== (const G4UImessenger &messenger) const
 
void SetNewValue (G4UIcommand *command, G4String newValues)
 
 ~G4EvManMessenger ()
 

Protected Member Functions

void AddUIcommand (G4UIcommand *newCommand)
 
G4String BtoS (G4bool b)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
G4String DtoS (G4double a)
 
G4String ItoS (G4int i)
 
G4bool StoB (G4String s)
 
G4double StoD (G4String s)
 
G4int StoI (G4String s)
 
G4long StoL (G4String s)
 

Protected Attributes

G4UIdirectorybaseDir = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 

Private Attributes

G4UIcmdWithoutParameterabortCmd = nullptr
 
G4UIdirectoryeventDirectory = nullptr
 
G4EventManagerfEvManager = nullptr
 
G4UIcmdWithoutParameterstoreEvtCmd = nullptr
 
G4UIcmdWithAnIntegerverboseCmd = nullptr
 

Detailed Description

Definition at line 48 of file G4EvManMessenger.hh.

Constructor & Destructor Documentation

◆ G4EvManMessenger()

G4EvManMessenger::G4EvManMessenger ( G4EventManager fEvMan)

Definition at line 37 of file G4EvManMessenger.cc.

38 : fEvManager(fEvMan)
39{
40 eventDirectory = new G4UIdirectory("/event/");
41 eventDirectory->SetGuidance("EventManager control commands.");
42
43 abortCmd = new G4UIcmdWithoutParameter("/event/abort",this);
44 abortCmd->SetGuidance("Abort current event.");
46
47 verboseCmd = new G4UIcmdWithAnInteger("/event/verbose",this);
48 verboseCmd->SetGuidance("Set Verbose level of event management category.");
49 verboseCmd->SetGuidance(" 0 : Silent");
50 verboseCmd->SetGuidance(" 1 : Stacking information");
51 verboseCmd->SetGuidance(" 2 : More...");
52 verboseCmd->SetParameterName("level",false);
53 verboseCmd->SetRange("level>=0");
54
55 storeEvtCmd = new G4UIcmdWithoutParameter("/event/keepCurrentEvent",this);
56 storeEvtCmd->SetGuidance("Store the current event to G4Run object instead of deleting it at the end of event.");
57 storeEvtCmd->SetGuidance("Stored event is available through G4Run until the beginning of next run.");
58 storeEvtCmd->SetGuidance("Given the potential large memory size of G4Event and its data-member objects stored in G4Event,");
59 storeEvtCmd->SetGuidance("the user must be careful and responsible for not to store too many G4Event objects.");
61}
@ G4State_EventProc
G4EventManager * fEvManager
G4UIcmdWithAnInteger * verboseCmd
G4UIcmdWithoutParameter * abortCmd
G4UIcmdWithoutParameter * storeEvtCmd
G4UIdirectory * eventDirectory
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:156
void SetRange(const char *rs)
Definition: G4UIcommand.hh:120
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:288

References abortCmd, G4UIcommand::AvailableForStates(), eventDirectory, G4State_EventProc, G4UIcommand::SetGuidance(), G4UIcmdWithAnInteger::SetParameterName(), G4UIcommand::SetRange(), storeEvtCmd, and verboseCmd.

◆ ~G4EvManMessenger()

G4EvManMessenger::~G4EvManMessenger ( )

Definition at line 63 of file G4EvManMessenger.cc.

64{
65 delete abortCmd;
66 delete verboseCmd;
67 delete storeEvtCmd;
68 delete eventDirectory;
69}

References abortCmd, eventDirectory, storeEvtCmd, and verboseCmd.

Member Function Documentation

◆ AddUIcommand()

void G4UImessenger::AddUIcommand ( G4UIcommand newCommand)
protectedinherited

Definition at line 149 of file G4UImessenger.cc.

150{
151 G4cerr << "Warning : Old style definition of G4UIcommand <"
152 << newCommand->GetCommandPath() << ">." << G4endl;
153}
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
const G4String & GetCommandPath() const
Definition: G4UIcommand.hh:136

References G4cerr, G4endl, and G4UIcommand::GetCommandPath().

◆ BtoS()

G4String G4UImessenger::BtoS ( G4bool  b)
protectedinherited

Definition at line 98 of file G4UImessenger.cc.

99{
100 G4String vl = "0";
101 if(b)
102 vl = "true";
103 return vl;
104}

◆ CommandsShouldBeInMaster()

G4bool G4UImessenger::CommandsShouldBeInMaster ( ) const
inlineinherited

Definition at line 77 of file G4UImessenger.hh.

78 {
80 }
G4bool commandsShouldBeInMaster

References G4UImessenger::commandsShouldBeInMaster.

Referenced by G4UIcommand::G4UIcommandCommonConstructorCode().

◆ CreateCommand()

template<typename T >
T * G4UImessenger::CreateCommand ( const G4String cname,
const G4String dsc 
)
protectedinherited

Definition at line 110 of file G4UImessenger.hh.

111{
112 G4String path;
113 if(cname[0] != '/')
114 {
115 path = baseDirName + cname;
116 if(path[0] != '/')
117 path = "/" + path;
118 }
119
120 T* command = new T(path.c_str(), this);
121 command->SetGuidance(dsc.c_str());
122
123 return command;
124}
G4String baseDirName

References G4UImessenger::baseDirName.

◆ CreateDirectory()

void G4UImessenger::CreateDirectory ( const G4String path,
const G4String dsc,
G4bool  commandsToBeBroadcasted = true 
)
protectedinherited

Definition at line 156 of file G4UImessenger.cc.

158{
160
161 G4String fullpath = path;
162 if(fullpath.back() != '/')
163 fullpath.append("/");
164
165 G4UIcommandTree* tree = ui->GetTree()->FindCommandTree(fullpath.c_str());
166 if(tree != nullptr)
167 {
168 baseDirName = tree->GetPathName();
169 }
170 else
171 {
172 baseDir = new G4UIdirectory(fullpath.c_str(), commandsToBeBroadcasted);
173 baseDirName = fullpath;
174 baseDir->SetGuidance(dsc.c_str());
175 }
176}
const G4String & GetPathName() const
G4UIcommandTree * FindCommandTree(const char *commandPath)
G4UIcommandTree * GetTree() const
Definition: G4UImanager.hh:186
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77
G4UIdirectory * baseDir

References G4UImessenger::baseDir, G4UImessenger::baseDirName, G4UIcommandTree::FindCommandTree(), G4UIcommandTree::GetPathName(), G4UImanager::GetTree(), G4UImanager::GetUIpointer(), and G4UIcommand::SetGuidance().

Referenced by G4MoleculeShootMessenger::G4MoleculeShootMessenger(), and G4UImessenger::G4UImessenger().

◆ DtoS()

G4String G4UImessenger::DtoS ( G4double  a)
protectedinherited

Definition at line 90 of file G4UImessenger.cc.

91{
92 std::ostringstream os;
93 os << a;
94 return G4String(os.str());
95}

Referenced by G4ScoreQuantityMessenger::FilterCommands(), and G4UIcontrolMessenger::SetNewValue().

◆ GetCurrentValue()

G4String G4EvManMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 81 of file G4EvManMessenger.cc.

82{
83 G4String cv;
84 if( command == verboseCmd )
86 return cv;
87}
G4int GetVerboseLevel()
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:445

References G4UIcommand::ConvertToString(), fEvManager, G4EventManager::GetVerboseLevel(), and verboseCmd.

◆ ItoS()

G4String G4UImessenger::ItoS ( G4int  i)
protectedinherited

Definition at line 82 of file G4UImessenger.cc.

83{
84 std::ostringstream os;
85 os << i;
86 return G4String(os.str());
87}

Referenced by G4GenericMessenger::DeclareMethod(), and G4ParticleGunMessenger::GetCurrentValue().

◆ operator!=()

G4bool G4UImessenger::operator!= ( const G4UImessenger messenger) const
inherited

Definition at line 76 of file G4UImessenger.cc.

77{
78 return this != &messenger;
79}

◆ operator==()

G4bool G4UImessenger::operator== ( const G4UImessenger messenger) const
inherited

Definition at line 70 of file G4UImessenger.cc.

71{
72 return this == &messenger;
73}

◆ SetNewValue()

void G4EvManMessenger::SetNewValue ( G4UIcommand command,
G4String  newValues 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 71 of file G4EvManMessenger.cc.

72{
73 if( command == verboseCmd )
75 if( command == abortCmd )
77 if( command == storeEvtCmd )
79}
void KeepTheCurrentEvent()
void SetVerboseLevel(G4int value)
void AbortCurrentEvent()
static G4int GetNewIntValue(const char *paramString)

References abortCmd, G4EventManager::AbortCurrentEvent(), fEvManager, G4UIcmdWithAnInteger::GetNewIntValue(), G4EventManager::KeepTheCurrentEvent(), G4EventManager::SetVerboseLevel(), storeEvtCmd, and verboseCmd.

◆ StoB()

G4bool G4UImessenger::StoB ( G4String  s)
protectedinherited

Definition at line 137 of file G4UImessenger.cc.

138{
140 G4bool vl = false;
141 if(v == "Y" || v == "YES" || v == "1" || v == "T" || v == "TRUE")
142 {
143 vl = true;
144 }
145 return vl;
146}
bool G4bool
Definition: G4Types.hh:86
G4String to_upper_copy(G4String str)
Return uppercase copy of string.

References G4StrUtil::to_upper_copy().

Referenced by G4LocalThreadCoutMessenger::SetNewValue(), G4CascadeParamMessenger::SetNewValue(), G4ScoreQuantityMessenger::SetNewValue(), and G4ScoringMessenger::SetNewValue().

◆ StoD()

G4double G4UImessenger::StoD ( G4String  s)
protectedinherited

◆ StoI()

G4int G4UImessenger::StoI ( G4String  s)
protectedinherited

◆ StoL()

G4long G4UImessenger::StoL ( G4String  s)
protectedinherited

Definition at line 117 of file G4UImessenger.cc.

118{
119 G4long vl;
120 const char* t = str;
121 std::istringstream is(t);
122 is >> vl;
123 return vl;
124}
long G4long
Definition: G4Types.hh:87

Referenced by G4RunMessenger::SetNewValue().

Field Documentation

◆ abortCmd

G4UIcmdWithoutParameter* G4EvManMessenger::abortCmd = nullptr
private

Definition at line 61 of file G4EvManMessenger.hh.

Referenced by G4EvManMessenger(), SetNewValue(), and ~G4EvManMessenger().

◆ baseDir

G4UIdirectory* G4UImessenger::baseDir = nullptr
protectedinherited

◆ baseDirName

G4String G4UImessenger::baseDirName = ""
protectedinherited

◆ commandsShouldBeInMaster

G4bool G4UImessenger::commandsShouldBeInMaster = false
protectedinherited

◆ eventDirectory

G4UIdirectory* G4EvManMessenger::eventDirectory = nullptr
private

Definition at line 60 of file G4EvManMessenger.hh.

Referenced by G4EvManMessenger(), and ~G4EvManMessenger().

◆ fEvManager

G4EventManager* G4EvManMessenger::fEvManager = nullptr
private

Definition at line 59 of file G4EvManMessenger.hh.

Referenced by GetCurrentValue(), and SetNewValue().

◆ storeEvtCmd

G4UIcmdWithoutParameter* G4EvManMessenger::storeEvtCmd = nullptr
private

Definition at line 63 of file G4EvManMessenger.hh.

Referenced by G4EvManMessenger(), SetNewValue(), and ~G4EvManMessenger().

◆ verboseCmd

G4UIcmdWithAnInteger* G4EvManMessenger::verboseCmd = nullptr
private

The documentation for this class was generated from the following files: