Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4PersistencyCenterMessenger Class Reference

#include <G4PersistencyCenterMessenger.hh>

+ Inheritance diagram for G4PersistencyCenterMessenger:

Public Member Functions

 G4PersistencyCenterMessenger (G4PersistencyCenter *p)
 
 ~G4PersistencyCenterMessenger ()
 
void SetNewValue (G4UIcommand *command, G4String newValues)
 
G4String GetCurrentValue (G4UIcommand *command)
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()=default
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool operator!= (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Additional Inherited Members

- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (const G4String &s)
 
G4long StoL (const G4String &s)
 
G4double StoD (const G4String &s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 

Detailed Description

Definition at line 45 of file G4PersistencyCenterMessenger.hh.

Constructor & Destructor Documentation

◆ G4PersistencyCenterMessenger()

G4PersistencyCenterMessenger::G4PersistencyCenterMessenger ( G4PersistencyCenter p)

Definition at line 34 of file G4PersistencyCenterMessenger.cc.

36 : pc(p)
37{
38 G4String name = "/persistency/";
39 directory = new G4UIdirectory(name.c_str());
40 directory->SetGuidance("Control commands for Persistency package");
41
42 G4String cmd = name + "verbose";
43
44 verboseCmd = new G4UIcmdWithAnInteger(cmd.c_str(), this);
45 verboseCmd->SetGuidance("Set the verbose level of G4PersistencyManager.");
46 verboseCmd->SetGuidance(" 0 : Silent (default)");
47 verboseCmd->SetGuidance(" 1 : Display main topics");
48 verboseCmd->SetGuidance(" 2 : Display event-level topics");
49 verboseCmd->SetGuidance(" 3 : Display debug information");
50 verboseCmd->SetParameterName("level", true);
51 verboseCmd->SetDefaultValue(0);
52 verboseCmd->SetRange("level >=0 && level <=3");
53
54 G4String vname = name + "select";
55
56 cmd = vname;
57 select = new G4UIcmdWithAString(cmd.c_str(), this);
58 select->SetGuidance("Selection of a persistency package");
59 select->SetParameterName("Persistency package name", true, true);
60 select->SetCandidates("ODBMS ROOT None");
61
62 vname = name + "store/";
63
64 subdir1 = new G4UIdirectory(vname.c_str());
65 subdir1->SetGuidance("Specifiy object types for store");
66
67 wrObj.push_back("HepMC");
68 wrObj.push_back("MCTruth");
69 wrObj.push_back("Hits");
70
71 G4String guidance;
72 G4int i;
73
74 for(i = 0; i < 3; ++i)
75 {
76 cmd = vname + wrObj[i];
77 guidance = "Store " + wrObj[i] + " objects for output";
78 storeObj.push_back(new G4UIcmdWithAString(cmd.c_str(), this));
79 storeObj[i]->SetGuidance(guidance.c_str());
80 if(wrObj[i] == "HepMC")
81 {
82 storeObj[i]->SetCandidates("on off recycle");
83 }
84 else
85 {
86 storeObj[i]->SetCandidates("on off");
87 }
88 }
89
90 vname += "using/";
91 subdir2 = new G4UIdirectory(vname.c_str());
92 subdir2->SetGuidance("Select I/O manager for store");
93
94 cmd = vname + "hitIO";
95 regHitIO = new G4UIcmdWithAString(cmd.c_str(), this);
96 regHitIO->SetGuidance("Resiter Hits I/O Manager");
97 regHitIO->SetParameterName("Name of Hits I/O Manager", true, true);
98
99 vname = name + "set/";
100 subdir3 = new G4UIdirectory(vname.c_str());
101 subdir3->SetGuidance("Set various parameters");
102
103 vname += "writeFile/";
104 subdir4 = new G4UIdirectory(vname.c_str());
105 subdir4->SetGuidance("Set output file names for object types");
106
107 for(i = 0; i < 3; ++i)
108 {
109 cmd = vname + wrObj[i];
110 guidance = "Set an output file name for " + wrObj[i] + ".";
111 setWrFile.push_back(new G4UIcmdWithAString(cmd.c_str(), this));
112 setWrFile[i]->SetGuidance(guidance.c_str());
113 setWrFile[i]->SetParameterName("file name", true, true);
114 }
115
116 vname = name + "set/ReadFile/";
117 subdir5 = new G4UIdirectory(vname.c_str());
118 subdir5->SetGuidance("Set input file names for object types");
119
120 rdObj.push_back("Hits");
121
122 cmd = vname + rdObj[0];
123 guidance = "Set an input file name for " + rdObj[0] + ".";
124 setRdFile.push_back(new G4UIcmdWithAString(cmd.c_str(), this));
125 setRdFile[0]->SetGuidance(guidance.c_str());
126 setRdFile[0]->SetParameterName("file name", true, true);
127
128 cmd = name + "printall";
129 printAll = new G4UIcmdWithoutParameter(cmd.c_str(), this);
130 printAll->SetGuidance("Print all parameters.");
131}
int G4int
Definition: G4Types.hh:85
void SetCandidates(const char *candidateList)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4int defVal)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:157
void SetRange(const char *rs)
Definition: G4UIcommand.hh:121
const char * name(G4int ptype)

◆ ~G4PersistencyCenterMessenger()

G4PersistencyCenterMessenger::~G4PersistencyCenterMessenger ( )

Definition at line 134 of file G4PersistencyCenterMessenger.cc.

135{
136 delete directory;
137 delete subdir1;
138 delete subdir2;
139 delete subdir3;
140 delete subdir4;
141 delete subdir5;
142 delete verboseCmd;
143 delete select;
144 delete regHitIO;
145 for(G4int i = 0; i < 3; ++i)
146 {
147 delete storeObj[i];
148 delete setWrFile[i];
149 }
150 delete setRdFile[0];
151 delete printAll;
152}

Member Function Documentation

◆ GetCurrentValue()

G4String G4PersistencyCenterMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 214 of file G4PersistencyCenterMessenger.cc.

215{
216 G4String ustr = "Undefined";
217
218 if(command == verboseCmd)
219 {
221 }
222 else if(command == select)
223 {
224 return pc->CurrentSystem();
225 }
226 else if(command == regHitIO)
227 {
228 return pc->CurrentHCIOmanager();
229 }
230 else if(command == setRdFile[0])
231 {
232 return pc->CurrentReadFile(rdObj[0]);
233 }
234 else
235 {
236 for(G4int i = 0; i < 3; ++i)
237 {
238 if(command == storeObj[i])
239 {
240 switch(pc->CurrentStoreMode(wrObj[i]))
241 {
242 case kOn:
243 return "on";
244 break;
245 case kOff:
246 return "off";
247 break;
248 case kRecycle:
249 return "recycle";
250 break;
251 default:
252 return "?????";
253 break;
254 };
255 }
256 else if(command == setWrFile[i])
257 {
258 return pc->CurrentWriteFile(wrObj[i]);
259 }
260 }
261 }
262
263 return ustr;
264}
@ kRecycle
G4String CurrentReadFile(const G4String &objName)
StoreMode CurrentStoreMode(const G4String &objName)
const G4String & CurrentSystem()
G4String CurrentWriteFile(const G4String &objName)
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:446

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 155 of file G4PersistencyCenterMessenger.cc.

157{
158 if(command == verboseCmd)
159 {
160 pc->SetVerboseLevel(verboseCmd->GetNewIntValue(newValues));
161 }
162 else if(command == select)
163 {
164 pc->SelectSystem(newValues);
165 }
166 else if(command == regHitIO)
167 {
168 pc->AddHCIOmanager(PopWord(newValues, 1, " "), PopWord(newValues, 2, " "));
169 }
170 else if(command == setRdFile[0])
171 {
172 pc->SetReadFile(rdObj[0], newValues);
173 }
174 else if(command == printAll)
175 {
176 pc->PrintAll();
177 }
178 else
179 {
180 for(G4int i = 0; i < 3; ++i)
181 {
182 if(command == storeObj[i])
183 {
184 StoreMode mode = kOff;
185 if(newValues == "on")
186 {
187 mode = kOn;
188 }
189 else if(newValues == "off")
190 {
191 mode = kOff;
192 }
193 else if(newValues == "recycle")
194 {
195 mode = kRecycle;
196 }
197 else
198 {
199 G4cerr << "Unrecognized keyword - \"" << newValues << "\"." << G4endl;
200 }
201 pc->SetStoreMode(wrObj[i], mode);
202 break;
203 }
204 else if(command == setWrFile[i])
205 {
206 pc->SetWriteFile(wrObj[i], newValues);
207 break;
208 }
209 }
210 }
211}
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
G4bool SetWriteFile(const G4String &objName, const G4String &writeFileName)
G4bool SetReadFile(const G4String &objName, const G4String &readFileName)
void SetStoreMode(const G4String &objName, StoreMode mode)
void AddHCIOmanager(const G4String &detName, const G4String &colName)
void SelectSystem(const G4String &systemName)
static G4int GetNewIntValue(const char *paramString)

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