49 f_wrObj[1] =
"MCTruth";
51 f_wrObj[3] =
"Digits";
54 f_rdObj[1] =
"HitsBG";
58 for ( itr = f_wrObj.begin(); itr != f_wrObj.end(); itr++ ) {
59 f_writeFileName[(*itr).second] =
"G4defaultOutput";
62 for ( itr = f_rdObj.begin(); itr != f_rdObj.end(); itr++ ) {
63 f_readFileName[(*itr).second] =
"G4defaultInput";
67 f_writeFileMode[
"MCTruth"] =
kOn;
68 f_writeFileMode[
"Hits"] =
kOn;
69 f_writeFileMode[
"Digits"] =
kOff;
71 f_readFileMode[
"Hits"] =
false;
72 f_readFileMode[
"HitsBG"] =
false;
81 delete f_theMessenger;
82 delete f_currentManager;
98 if (f_currentManager!=0)
delete f_currentManager;
102 if (systemName==
"ROOT")
104 G4cout<<
" G4PersistencyCenter: \"ROOT\" Persistency Package is selected."
113 else if (systemName==
"ODBMS")
115 G4cout<<
" G4PersistencyCenter: \"ODBMS\" package is selected."<<
G4endl;
125 G4cout<<
" G4PersistencyCenter: Default is selected."<<
G4endl;
130 f_currentManager = pm->
Create();
132 f_currentSystemName = systemName;
157 if ( (*(f_writeFileName.find(objName))).second !=
"" ) {
158 f_writeFileMode[objName] = mode;
160 G4cerr <<
"!! unknown object type " << objName <<
" for output."
168 if ( (*(f_readFileName.find(objName))).second !=
"" ) {
169 f_readFileMode[objName] = mode;
171 G4cerr <<
"!! unknown object type " << objName <<
" for input."
181 if ( (*(f_writeFileName.find(objName))).second !=
"" ) {
182 return f_writeFileMode[objName];
191 if ( (*(f_readFileName.find(objName))).second !=
"" ) {
192 return f_readFileMode[objName];
201 if ( (*(f_writeFileName.find(objName))).second !=
"" ) {
202 f_writeFileName[objName] = writeFileName;
204 G4cerr <<
"!! unknown object type " << objName <<
" for output."
217 f_readFileName[objName] = readFileName;
221 G4cerr <<
"!! File \"" << objName <<
"\" does not exist."
232 if ( (*(f_writeFileName.find(objName))).second !=
"" ) {
233 return f_writeFileName[objName];
242 if ( (*(f_readFileName.find(objName))).second !=
"" ) {
243 return f_readFileName[objName];
252 FileMap::iterator itr;
253 for ( itr = f_readFileName.begin(); itr != f_readFileName.end(); itr++ ) {
254 if ( file == (*itr).second )
return (*itr).first;
256 for ( itr = f_writeFileName.begin(); itr != f_writeFileName.end(); itr++ ) {
257 if ( file == (*itr).second )
return (*itr).first;
271 G4cerr <<
"Error! -- HCIO assignment failed for detector " << detName
272 <<
", collection " << colName <<
G4endl;
288 std::string colName =
"";
293 G4cerr <<
"Error! -- DCIO assignment failed for detector " << detName
294 <<
", collection " << colName <<
G4endl;
311 ObjMap::iterator itr;
316 G4cout <<
"Output object types and file names:" <<
G4endl;
317 for ( itr = f_wrObj.begin(); itr != f_wrObj.end(); itr++ ) {
318 name = (*itr).second;
320 if ( name !=
"HepMC" && name !=
"MCTruth" ) {
321 G4cout <<
" Object: " << PadString(name, 9);
325 }
else if ( mode ==
kOff ) {
331 if ( file ==
"" ) file =
" <N/A>";
337 G4cout <<
"Input object types and file names:" <<
G4endl;
338 for ( itr = f_rdObj.begin(); itr != f_rdObj.end(); itr++ ) {
339 name = (*itr).second;
341 if ( name !=
"HepMC" && name !=
"MCTruth" ) {
342 G4cout <<
" Object: " << PadString(name, 9);
349 if ( file ==
"" ) file =
" <N/A>";
362 G4cout <<
"Hit IO Manager catalog is not registered." <<
G4endl;
372 G4cout <<
"Digit IO Manager catalog is not registered." <<
G4endl;
381 f_currentSystemName=name;
387 if (f_theCatalog.find(nam)!=f_theCatalog.end())
388 return f_theCatalog[nam];
395 f_theCatalog[pm->
GetName()]=pm;
401 if (f_currentManager!=0)
delete f_currentManager;
409 if ( f_currentManager != 0 ) f_currentManager->
SetVerboseLevel(m_verbose);
413std::string G4PersistencyCenter::PadString(std::string name,
unsigned int width)
415 if ( name.length() > width ) {
416 return name.substr(0,width-1) +
"#";
418 std::string wname = name;
419 for (
unsigned int i=0; i < width-name.length(); i++) wname = wname +
" ";
G4DLLIMPORT std::ostream G4cerr
G4DLLIMPORT std::ostream G4cout
G4VDCIOentry * GetEntry(std::string name)
std::string CurrentDCIOmanager()
static G4DCIOcatalog * GetDCIOcatalog()
G4bool FileExists(const std::string file)
G4VHCIOentry * GetEntry(std::string name)
std::string CurrentHCIOmanager()
static G4HCIOcatalog * GetHCIOcatalog()
void DeletePersistencyManager()
std::string CurrentHepMCObjyReaderFile()
void SelectSystem(std::string systemName)
void SetPersistencyManager(G4PersistencyManager *pm, std::string name)
static G4PersistencyCenter * GetPersistencyCenter()
const std::string CurrentSystem()
G4bool SetReadFile(std::string objName, std::string readFileName)
void AddDCIOmanager(std::string detName)
std::string CurrentHCIOmanager()
void SetRetrieveMode(std::string objName, G4bool mode)
std::string CurrentDCIOmanager()
std::string CurrentWriteFile(std::string objName)
void RegisterPersistencyManager(G4PersistencyManager *pm)
void SetVerboseLevel(int v)
StoreMode CurrentStoreMode(std::string objName)
void SetStoreMode(std::string objName, StoreMode mode)
void SetHepMCObjyReaderFile(std::string file)
G4bool CurrentRetrieveMode(std::string objName)
void AddHCIOmanager(std::string detName, std::string colName)
G4PersistencyManager * GetPersistencyManager(std::string nam)
G4bool SetWriteFile(std::string objName, std::string writeFileName)
std::string CurrentReadFile(std::string objName)
std::string CurrentObject(std::string file)
void SetVerboseLevel(int v)
virtual G4PersistencyManager * Create()
virtual void CreateDCIOmanager(std::string, std::string)
virtual void CreateHCIOmanager(std::string, std::string)