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

#include <G4PersistencyCenter.hh>

Public Member Functions

void SelectSystem (std::string systemName)
 
const std::string CurrentSystem ()
 
void SetHepMCObjyReaderFile (std::string file)
 
std::string CurrentHepMCObjyReaderFile ()
 
void SetStoreMode (std::string objName, StoreMode mode)
 
void SetRetrieveMode (std::string objName, G4bool mode)
 
StoreMode CurrentStoreMode (std::string objName)
 
G4bool CurrentRetrieveMode (std::string objName)
 
G4bool SetWriteFile (std::string objName, std::string writeFileName)
 
G4bool SetReadFile (std::string objName, std::string readFileName)
 
std::string CurrentWriteFile (std::string objName)
 
std::string CurrentReadFile (std::string objName)
 
std::string CurrentObject (std::string file)
 
void AddHCIOmanager (std::string detName, std::string colName)
 
std::string CurrentHCIOmanager ()
 
void AddDCIOmanager (std::string detName)
 
std::string CurrentDCIOmanager ()
 
void PrintAll ()
 
G4PersistencyManagerCurrentPersistencyManager ()
 
void SetPersistencyManager (G4PersistencyManager *pm, std::string name)
 
G4PersistencyManagerGetPersistencyManager (std::string nam)
 
void RegisterPersistencyManager (G4PersistencyManager *pm)
 
void DeletePersistencyManager ()
 
void SetVerboseLevel (int v)
 
int VerboseLevel ()
 

Static Public Member Functions

static G4PersistencyCenterGetPersistencyCenter ()
 

Detailed Description

Definition at line 63 of file G4PersistencyCenter.hh.

Member Function Documentation

void G4PersistencyCenter::AddDCIOmanager ( std::string  detName)

Definition at line 282 of file G4PersistencyCenter.cc.

283 {
285 
286  std::string colName = "";
287  G4VDCIOentry* ioe = ioc->GetEntry(detName);
288  if ( ioe != 0 ) {
289  ioe->CreateDCIOmanager(detName, colName);
290  } else {
291  G4cerr << "Error! -- DCIO assignment failed for detector " << detName
292  << ", collection " << colName << G4endl;
293  }
294 }
virtual void CreateDCIOmanager(std::string, std::string)
Definition: G4VDCIOentry.hh:57
G4VDCIOentry * GetEntry(std::string name)
static G4DCIOcatalog * GetDCIOcatalog()
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

void G4PersistencyCenter::AddHCIOmanager ( std::string  detName,
std::string  colName 
)

Definition at line 261 of file G4PersistencyCenter.cc.

262 {
264 
265  G4VHCIOentry* ioe = ioc->GetEntry(detName);
266  if ( ioe != 0 ) {
267  ioe->CreateHCIOmanager(detName, colName);
268  } else {
269  G4cerr << "Error! -- HCIO assignment failed for detector " << detName
270  << ", collection " << colName << G4endl;
271  }
272 }
G4VHCIOentry * GetEntry(std::string name)
static G4HCIOcatalog * GetHCIOcatalog()
virtual void CreateHCIOmanager(std::string, std::string)
Definition: G4VHCIOentry.hh:57
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

Here is the caller graph for this function:

std::string G4PersistencyCenter::CurrentDCIOmanager ( )

Definition at line 297 of file G4PersistencyCenter.cc.

298 {
300  return ioc->CurrentDCIOmanager();
301 }
static G4DCIOcatalog * GetDCIOcatalog()
std::string CurrentDCIOmanager()

Here is the call graph for this function:

std::string G4PersistencyCenter::CurrentHCIOmanager ( )

Definition at line 275 of file G4PersistencyCenter.cc.

276 {
278  return ioc->CurrentHCIOmanager();
279 }
std::string CurrentHCIOmanager()
static G4HCIOcatalog * GetHCIOcatalog()

Here is the call graph for this function:

Here is the caller graph for this function:

std::string G4PersistencyCenter::CurrentHepMCObjyReaderFile ( )

Definition at line 145 of file G4PersistencyCenter.cc.

146 {
147  if ( CurrentRetrieveMode("HepMC") ) {
148  return CurrentReadFile("HepMC");
149  } else {
150  return "";
151  }
152 }
std::string CurrentReadFile(std::string objName)
G4bool CurrentRetrieveMode(std::string objName)

Here is the call graph for this function:

std::string G4PersistencyCenter::CurrentObject ( std::string  file)

Definition at line 248 of file G4PersistencyCenter.cc.

249 {
250  FileMap::iterator itr;
251  for ( itr = f_readFileName.begin(); itr != f_readFileName.end(); itr++ ) {
252  if ( file == (*itr).second ) return (*itr).first;
253  }
254  for ( itr = f_writeFileName.begin(); itr != f_writeFileName.end(); itr++ ) {
255  if ( file == (*itr).second ) return (*itr).first;
256  }
257  return "?????";
258 }
G4PersistencyManager* G4PersistencyCenter::CurrentPersistencyManager ( )
inline

Definition at line 124 of file G4PersistencyCenter.hh.

124 { return f_currentManager; };

Here is the caller graph for this function:

std::string G4PersistencyCenter::CurrentReadFile ( std::string  objName)

Definition at line 238 of file G4PersistencyCenter.cc.

239 {
240  if ( (*(f_readFileName.find(objName))).second != "" ) {
241  return f_readFileName[objName];
242  } else {
243  return "?????";
244  }
245 }

Here is the caller graph for this function:

G4bool G4PersistencyCenter::CurrentRetrieveMode ( std::string  objName)

Definition at line 187 of file G4PersistencyCenter.cc.

188 {
189  if ( (*(f_readFileName.find(objName))).second != "" ) {
190  return f_readFileMode[objName];
191  } else {
192  return false;
193  }
194 }

Here is the caller graph for this function:

StoreMode G4PersistencyCenter::CurrentStoreMode ( std::string  objName)

Definition at line 177 of file G4PersistencyCenter.cc.

178 {
179  if ( (*(f_writeFileName.find(objName))).second != "" ) {
180  return f_writeFileMode[objName];
181  } else {
182  return kOff;
183  }
184 }

Here is the caller graph for this function:

const std::string G4PersistencyCenter::CurrentSystem ( )
inline

Definition at line 73 of file G4PersistencyCenter.hh.

73 { return f_currentSystemName; };

Here is the caller graph for this function:

std::string G4PersistencyCenter::CurrentWriteFile ( std::string  objName)

Definition at line 228 of file G4PersistencyCenter.cc.

229 {
230  if ( (*(f_writeFileName.find(objName))).second != "" ) {
231  return f_writeFileName[objName];
232  } else {
233  return "?????";
234  }
235 }

Here is the caller graph for this function:

void G4PersistencyCenter::DeletePersistencyManager ( )

Definition at line 397 of file G4PersistencyCenter.cc.

398 {
399  if (f_currentManager!=0) delete f_currentManager;
400  f_currentManager=0;
401 }
G4PersistencyCenter * G4PersistencyCenter::GetPersistencyCenter ( )
static

Definition at line 86 of file G4PersistencyCenter.cc.

87 {
88  if ( f_thePointer == 0 ) f_thePointer = new G4PersistencyCenter;
89  return f_thePointer;
90 }

Here is the caller graph for this function:

G4PersistencyManager * G4PersistencyCenter::GetPersistencyManager ( std::string  nam)

Definition at line 383 of file G4PersistencyCenter.cc.

384 {
385  if (f_theCatalog.find(nam)!=f_theCatalog.end())
386  return f_theCatalog[nam];
387  return 0;
388 }

Here is the caller graph for this function:

void G4PersistencyCenter::PrintAll ( void  )

Definition at line 304 of file G4PersistencyCenter.cc.

305 {
306  G4cout << "Persistency Package: " << CurrentSystem() << G4endl;
307  G4cout << G4endl;
308 
309  ObjMap::iterator itr;
310  std::string name;
311  std::string file;
312  StoreMode mode;
313 
314  G4cout << "Output object types and file names:" << G4endl;
315  for ( itr = f_wrObj.begin(); itr != f_wrObj.end(); itr++ ) {
316  name = (*itr).second;
317  // disabled HepMC and MCTruth for now
318  if ( name != "HepMC" && name != "MCTruth" ) {
319  G4cout << " Object: " << PadString(name, 9);
320  mode = CurrentStoreMode(name);
321  if ( mode == kOn ) {
322  G4cout << " <on> ";
323  } else if ( mode == kOff ) {
324  G4cout << " <off> ";
325  } else if ( mode == kRecycle ) {
326  G4cout << "<recycle>";
327  }
328  file = CurrentWriteFile(name);
329  if ( file == "" ) file = " <N/A>";
330  G4cout << " File: " << file << G4endl;
331  }
332  }
333  G4cout << G4endl;
334 
335  G4cout << "Input object types and file names:" << G4endl;
336  for ( itr = f_rdObj.begin(); itr != f_rdObj.end(); itr++ ) {
337  name = (*itr).second;
338  // disabled HepMC and MCTruth for now
339  if ( name != "HepMC" && name != "MCTruth" ) {
340  G4cout << " Object: " << PadString(name, 9);
341  if ( CurrentRetrieveMode(name) ) {
342  G4cout << " <on> ";
343  } else {
344  G4cout << " <off> ";
345  }
346  file = CurrentReadFile(name);
347  if ( file == "" ) file = " <N/A>";
348  G4cout << " File: " << CurrentReadFile(name) << G4endl;
349  }
350  }
351  G4cout << G4endl;
352 
354  if ( hioc != 0 ) {
355  G4cout << "Hit IO Managers:" << G4endl;
356  hioc->PrintEntries();
357  hioc->PrintHCIOmanager();
358  G4cout << G4endl;
359  } else {
360  G4cout << "Hit IO Manager catalog is not registered." << G4endl;
361  }
362 
364  if ( dioc != 0 ) {
365  G4cout << "Digit IO Managers:" << G4endl;
366  dioc->PrintEntries();
367  dioc->PrintDCIOmanager();
368  G4cout << G4endl;
369  } else {
370  G4cout << "Digit IO Manager catalog is not registered." << G4endl;
371  }
372 }
const XML_Char * name
Definition: expat.h:151
void PrintDCIOmanager()
std::string CurrentReadFile(std::string objName)
static G4HCIOcatalog * GetHCIOcatalog()
StoreMode CurrentStoreMode(std::string objName)
G4GLOB_DLL std::ostream G4cout
void PrintHCIOmanager()
static G4DCIOcatalog * GetDCIOcatalog()
G4bool CurrentRetrieveMode(std::string objName)
const std::string CurrentSystem()
#define G4endl
Definition: G4ios.hh:61
std::string CurrentWriteFile(std::string objName)

Here is the call graph for this function:

Here is the caller graph for this function:

void G4PersistencyCenter::RegisterPersistencyManager ( G4PersistencyManager pm)

Definition at line 391 of file G4PersistencyCenter.cc.

392 {
393  f_theCatalog[pm->GetName()]=pm;
394 }

Here is the call graph for this function:

void G4PersistencyCenter::SelectSystem ( std::string  systemName)

Definition at line 94 of file G4PersistencyCenter.cc.

95 {
96  G4int st = 0;
97 
98  if (f_currentManager!=0) delete f_currentManager;
99 
100  G4PersistencyManager* pm = 0;
101 
102  if (systemName=="ROOT")
103  {
104  G4cout<<" G4PersistencyCenter: \"ROOT\" Persistency Package is selected."
105  <<G4endl;
106  // G4UImanager *man=G4UImanager::GetUIpointer();
107  // std::string libs="Cint:Core:Tree:Rint:Matrix:Physics:fadsROOT";
108  // st = man->ApplyCommand("/load "+libs);
109  if ( st == 0 ) {
110  pm = GetPersistencyManager("ROOT");
111  }
112  }
113  else if (systemName=="ODBMS")
114  {
115  G4cout<<" G4PersistencyCenter: \"ODBMS\" package is selected."<<G4endl;
116  // G4UImanager *man=G4UImanager::GetUIpointer();
117  // std::string libs="fadsODBMS";
118  // st = man->ApplyCommand("/load "+libs);
119  if ( st == 0 ) {
120  pm = GetPersistencyManager("ODBMS");
121  }
122  }
123  else
124  {
125  G4cout<<" G4PersistencyCenter: Default is selected."<< G4endl;
126  pm = new G4PersistencyManager(this, "Default");
127  }
128 
129  if ( st == 0 ) {
130  f_currentManager = pm->Create();
131  if (f_currentManager!=0) f_currentManager->SetVerboseLevel(m_verbose);
132  f_currentSystemName = systemName;
133  }
134 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
virtual G4PersistencyManager * Create()
#define G4endl
Definition: G4ios.hh:61
G4PersistencyManager * GetPersistencyManager(std::string nam)

Here is the call graph for this function:

Here is the caller graph for this function:

void G4PersistencyCenter::SetHepMCObjyReaderFile ( std::string  file)

Definition at line 137 of file G4PersistencyCenter.cc.

138 {
139  if ( SetReadFile("HepMC", file) ) {
140  SetRetrieveMode("HepMC", true);
141  }
142 }
void SetRetrieveMode(std::string objName, G4bool mode)
G4bool SetReadFile(std::string objName, std::string readFileName)

Here is the call graph for this function:

void G4PersistencyCenter::SetPersistencyManager ( G4PersistencyManager pm,
std::string  name 
)

Definition at line 375 of file G4PersistencyCenter.cc.

377 {
378  f_currentManager=pm;
379  f_currentSystemName=name;
380 }
const XML_Char * name
Definition: expat.h:151
G4bool G4PersistencyCenter::SetReadFile ( std::string  objName,
std::string  readFileName 
)

Definition at line 210 of file G4PersistencyCenter.cc.

211 {
212 #ifndef WIN32
213  if ( f_ut.FileExists(readFileName) )
214  {
215  f_readFileName[objName] = readFileName;
216  }
217  else
218  {
219  G4cerr << "!! File \"" << objName << "\" does not exist."
220  << G4endl;
221  return false;
222  }
223 #endif
224  return true;
225 }
G4bool FileExists(const std::string file)
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr

Here is the call graph for this function:

Here is the caller graph for this function:

void G4PersistencyCenter::SetRetrieveMode ( std::string  objName,
G4bool  mode 
)

Definition at line 166 of file G4PersistencyCenter.cc.

167 {
168  if ( (*(f_readFileName.find(objName))).second != "" ) {
169  f_readFileMode[objName] = mode;
170  } else {
171  G4cerr << "!! unknown object type " << objName << " for input."
172  << G4endl;
173  }
174 }
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr

Here is the caller graph for this function:

void G4PersistencyCenter::SetStoreMode ( std::string  objName,
StoreMode  mode 
)

Definition at line 155 of file G4PersistencyCenter.cc.

156 {
157  if ( (*(f_writeFileName.find(objName))).second != "" ) {
158  f_writeFileMode[objName] = mode;
159  } else {
160  G4cerr << "!! unknown object type " << objName << " for output."
161  << G4endl;
162  }
163 }
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr

Here is the caller graph for this function:

void G4PersistencyCenter::SetVerboseLevel ( int  v)

Definition at line 404 of file G4PersistencyCenter.cc.

405 {
406  m_verbose = v;
407  if ( f_currentManager != 0 ) f_currentManager->SetVerboseLevel(m_verbose);
408 }
tuple v
Definition: test.py:18

Here is the call graph for this function:

Here is the caller graph for this function:

G4bool G4PersistencyCenter::SetWriteFile ( std::string  objName,
std::string  writeFileName 
)

Definition at line 197 of file G4PersistencyCenter.cc.

198 {
199  if ( (*(f_writeFileName.find(objName))).second != "" ) {
200  f_writeFileName[objName] = writeFileName;
201  } else {
202  G4cerr << "!! unknown object type " << objName << " for output."
203  << G4endl;
204  return false;
205  }
206  return true;
207 }
#define G4endl
Definition: G4ios.hh:61
G4GLOB_DLL std::ostream G4cerr

Here is the caller graph for this function:

int G4PersistencyCenter::VerboseLevel ( )
inline

Definition at line 142 of file G4PersistencyCenter.hh.

142 { return m_verbose; };

Here is the caller graph for this function:


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