Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4PersistencyCenterMessenger Class Reference

#include <G4PersistencyCenterMessenger.hh>

Inheritance diagram for G4PersistencyCenterMessenger:
Collaboration 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 ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
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 (G4String s)
 
G4double StoD (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
 
G4String baseDirName
 
G4bool commandsShouldBeInMaster
 

Detailed Description

Definition at line 47 of file G4PersistencyCenterMessenger.hh.

Constructor & Destructor Documentation

G4PersistencyCenterMessenger::G4PersistencyCenterMessenger ( G4PersistencyCenter p)

Definition at line 34 of file G4PersistencyCenterMessenger.cc.

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

Here is the call graph for this function:

G4PersistencyCenterMessenger::~G4PersistencyCenterMessenger ( )

Definition at line 131 of file G4PersistencyCenterMessenger.cc.

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

Member Function Documentation

G4String G4PersistencyCenterMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 203 of file G4PersistencyCenterMessenger.cc.

204 {
205  G4String ustr="Undefined";
206 
207  if (command==verboseCmd)
208  {
209  return pc->VerboseLevel();
210  }
211  else if (command==select)
212  {
213  return pc->CurrentSystem();
214  }
215  else if (command==regHitIO)
216  {
217  return pc->CurrentHCIOmanager();
218  }
219  else if (command==setRdFile[0])
220  {
221  return pc->CurrentReadFile(rdObj[0]);
222  }
223  else
224  {
225  for( int i=0; i<3; i++ ) {
226  if( command==storeObj[i] )
227  {
228  switch (pc->CurrentStoreMode(wrObj[i])) {
229  case kOn:
230  return "on";
231  break;
232  case kOff:
233  return "off";
234  break;
235  case kRecycle:
236  return "recycle";
237  break;
238  default:
239  return "?????";
240  break;
241  };
242  }
243  else if( command==setWrFile[i] )
244  {
245  return pc->CurrentWriteFile(wrObj[i]);
246  }
247  }
248  }
249 
250  return ustr;
251 }
std::string CurrentReadFile(std::string objName)
StoreMode CurrentStoreMode(std::string objName)
std::string CurrentHCIOmanager()
const std::string CurrentSystem()
std::string CurrentWriteFile(std::string objName)

Here is the call graph for this function:

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

Reimplemented from G4UImessenger.

Definition at line 152 of file G4PersistencyCenterMessenger.cc.

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

Here is the call graph for this function:


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