Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // G4PersistencyCenter implementation 26 // G4PersistencyCenter implementation 27 // 27 // 28 // Author: Youhei Morita, 10.08.2001 28 // Author: Youhei Morita, 10.08.2001 29 // ------------------------------------------- 29 // -------------------------------------------------------------------- 30 30 31 #include "G4PersistencyCenter.hh" 31 #include "G4PersistencyCenter.hh" 32 #include "G4PersistencyCenterMessenger.hh" 32 #include "G4PersistencyCenterMessenger.hh" 33 33 34 #include "G4UImanager.hh" 34 #include "G4UImanager.hh" 35 #include "G4PersistencyManager.hh" 35 #include "G4PersistencyManager.hh" 36 #include "G4VHCIOentry.hh" 36 #include "G4VHCIOentry.hh" 37 #include "G4VDCIOentry.hh" 37 #include "G4VDCIOentry.hh" 38 38 39 G4ThreadLocal G4PersistencyCenter* G4Persisten 39 G4ThreadLocal G4PersistencyCenter* G4PersistencyCenter::f_thePointer = nullptr; 40 40 41 // ------------------------------------------- 41 // -------------------------------------------------------------------- 42 G4PersistencyCenter::G4PersistencyCenter() 42 G4PersistencyCenter::G4PersistencyCenter() 43 { 43 { 44 f_wrObj[0] = "HepMC"; 44 f_wrObj[0] = "HepMC"; 45 f_wrObj[1] = "MCTruth"; 45 f_wrObj[1] = "MCTruth"; 46 f_wrObj[2] = "Hits"; 46 f_wrObj[2] = "Hits"; 47 f_wrObj[3] = "Digits"; 47 f_wrObj[3] = "Digits"; 48 48 49 f_rdObj[0] = "Hits"; 49 f_rdObj[0] = "Hits"; 50 f_rdObj[1] = "HitsBG"; 50 f_rdObj[1] = "HitsBG"; 51 51 52 for(auto itr = f_wrObj.cbegin(); itr != f_wr 52 for(auto itr = f_wrObj.cbegin(); itr != f_wrObj.cend(); ++itr) 53 { 53 { 54 f_writeFileName[(*itr).second] = "G4defaul 54 f_writeFileName[(*itr).second] = "G4defaultOutput"; 55 } 55 } 56 56 57 for(auto itr = f_rdObj.cbegin(); itr != f_rd 57 for(auto itr = f_rdObj.cbegin(); itr != f_rdObj.cend(); ++itr) 58 { 58 { 59 f_readFileName[(*itr).second] = "G4default 59 f_readFileName[(*itr).second] = "G4defaultInput"; 60 } 60 } 61 61 62 f_writeFileMode["HepMC"] = kRecycle; 62 f_writeFileMode["HepMC"] = kRecycle; 63 f_writeFileMode["MCTruth"] = kOn; 63 f_writeFileMode["MCTruth"] = kOn; 64 f_writeFileMode["Hits"] = kOn; 64 f_writeFileMode["Hits"] = kOn; 65 f_writeFileMode["Digits"] = kOff; 65 f_writeFileMode["Digits"] = kOff; 66 66 67 f_readFileMode["Hits"] = false; 67 f_readFileMode["Hits"] = false; 68 f_readFileMode["HitsBG"] = false; 68 f_readFileMode["HitsBG"] = false; 69 69 70 f_theMessenger = new G4PersistencyCenterMe 70 f_theMessenger = new G4PersistencyCenterMessenger(this); 71 f_currentManager = new G4PersistencyManager( 71 f_currentManager = new G4PersistencyManager(this, "Default"); 72 } 72 } 73 73 74 // ------------------------------------------- 74 // -------------------------------------------------------------------- 75 G4PersistencyCenter::~G4PersistencyCenter() 75 G4PersistencyCenter::~G4PersistencyCenter() 76 { 76 { 77 delete f_theMessenger; 77 delete f_theMessenger; 78 delete f_currentManager; 78 delete f_currentManager; 79 } 79 } 80 80 81 // ------------------------------------------- 81 // -------------------------------------------------------------------- 82 G4PersistencyCenter* G4PersistencyCenter::GetP 82 G4PersistencyCenter* G4PersistencyCenter::GetPersistencyCenter() 83 { 83 { 84 if(f_thePointer == nullptr) 84 if(f_thePointer == nullptr) 85 f_thePointer = new G4PersistencyCenter; 85 f_thePointer = new G4PersistencyCenter; 86 return f_thePointer; 86 return f_thePointer; 87 } 87 } 88 88 89 // ------------------------------------------- 89 // -------------------------------------------------------------------- 90 void G4PersistencyCenter::SelectSystem(const G 90 void G4PersistencyCenter::SelectSystem(const G4String& systemName) 91 { 91 { 92 G4int st = 0; 92 G4int st = 0; 93 93 94 if(f_currentManager != nullptr) 94 if(f_currentManager != nullptr) 95 delete f_currentManager; 95 delete f_currentManager; 96 96 97 G4PersistencyManager* pm = nullptr; 97 G4PersistencyManager* pm = nullptr; 98 98 99 if(systemName == "ROOT") 99 if(systemName == "ROOT") 100 { 100 { 101 G4cout << " G4PersistencyCenter: \"ROOT\" 101 G4cout << " G4PersistencyCenter: \"ROOT\" Persistency Package is selected." 102 << G4endl; 102 << G4endl; 103 // G4UImanager *man=G4UImanager::GetUIpoin 103 // G4UImanager *man=G4UImanager::GetUIpointer(); 104 // std::string libs="Cint:Core:Tree:Rint:M 104 // std::string libs="Cint:Core:Tree:Rint:Matrix:Physics:fadsROOT"; 105 // st = man->ApplyCommand("/load "+libs); 105 // st = man->ApplyCommand("/load "+libs); 106 if(st == 0) 106 if(st == 0) 107 { 107 { 108 pm = GetPersistencyManager("ROOT"); 108 pm = GetPersistencyManager("ROOT"); 109 } 109 } 110 } 110 } 111 else if(systemName == "ODBMS") 111 else if(systemName == "ODBMS") 112 { 112 { 113 G4cout << " G4PersistencyCenter: \"ODBMS\" 113 G4cout << " G4PersistencyCenter: \"ODBMS\" package is selected." << G4endl; 114 // G4UImanager *man=G4UImanager::GetUIpoin 114 // G4UImanager *man=G4UImanager::GetUIpointer(); 115 // std::string libs="fadsODBMS"; 115 // std::string libs="fadsODBMS"; 116 // st = man->ApplyCommand("/load "+libs); 116 // st = man->ApplyCommand("/load "+libs); 117 if(st == 0) 117 if(st == 0) 118 { 118 { 119 pm = GetPersistencyManager("ODBMS"); 119 pm = GetPersistencyManager("ODBMS"); 120 } 120 } 121 } 121 } 122 else 122 else 123 { 123 { 124 G4cout << " G4PersistencyCenter: Default i 124 G4cout << " G4PersistencyCenter: Default is selected." << G4endl; 125 pm = new G4PersistencyManager(this, "Defau 125 pm = new G4PersistencyManager(this, "Default"); 126 } 126 } 127 127 128 if(st == 0) 128 if(st == 0) 129 { 129 { 130 f_currentManager = pm->Create(); 130 f_currentManager = pm->Create(); 131 if(f_currentManager != nullptr) 131 if(f_currentManager != nullptr) 132 f_currentManager->SetVerboseLevel(m_verb 132 f_currentManager->SetVerboseLevel(m_verbose); 133 f_currentSystemName = systemName; 133 f_currentSystemName = systemName; 134 } 134 } 135 } 135 } 136 136 137 // ------------------------------------------- 137 // -------------------------------------------------------------------- 138 void G4PersistencyCenter::SetHepMCObjyReaderFi 138 void G4PersistencyCenter::SetHepMCObjyReaderFile(const G4String& file) 139 { 139 { 140 if(SetReadFile("HepMC", file)) 140 if(SetReadFile("HepMC", file)) 141 { 141 { 142 SetRetrieveMode("HepMC", true); 142 SetRetrieveMode("HepMC", true); 143 } 143 } 144 } 144 } 145 145 146 // ------------------------------------------- 146 // -------------------------------------------------------------------- 147 G4String G4PersistencyCenter::CurrentHepMCObjy 147 G4String G4PersistencyCenter::CurrentHepMCObjyReaderFile() 148 { 148 { 149 if(CurrentRetrieveMode("HepMC")) 149 if(CurrentRetrieveMode("HepMC")) 150 { 150 { 151 return CurrentReadFile("HepMC"); 151 return CurrentReadFile("HepMC"); 152 } 152 } 153 else 153 else 154 { 154 { 155 return ""; 155 return ""; 156 } 156 } 157 } 157 } 158 158 159 // ------------------------------------------- 159 // -------------------------------------------------------------------- 160 void G4PersistencyCenter::SetStoreMode(const G 160 void G4PersistencyCenter::SetStoreMode(const G4String& objName, StoreMode mode) 161 { 161 { 162 if((*(f_writeFileName.find(objName))).second 162 if((*(f_writeFileName.find(objName))).second != "") 163 { 163 { 164 f_writeFileMode[objName] = mode; 164 f_writeFileMode[objName] = mode; 165 } 165 } 166 else 166 else 167 { 167 { 168 G4cerr << "!! unknown object type " << obj 168 G4cerr << "!! unknown object type " << objName << " for output." << G4endl; 169 } 169 } 170 } 170 } 171 171 172 // ------------------------------------------- 172 // -------------------------------------------------------------------- 173 void G4PersistencyCenter::SetRetrieveMode(cons 173 void G4PersistencyCenter::SetRetrieveMode(const G4String& objName, G4bool mode) 174 { 174 { 175 if((*(f_readFileName.find(objName))).second 175 if((*(f_readFileName.find(objName))).second != "") 176 { 176 { 177 f_readFileMode[objName] = mode; 177 f_readFileMode[objName] = mode; 178 } 178 } 179 else 179 else 180 { 180 { 181 G4cerr << "!! unknown object type " << obj 181 G4cerr << "!! unknown object type " << objName << " for input." << G4endl; 182 } 182 } 183 } 183 } 184 184 185 // ------------------------------------------- 185 // -------------------------------------------------------------------- 186 StoreMode G4PersistencyCenter::CurrentStoreMod 186 StoreMode G4PersistencyCenter::CurrentStoreMode(const G4String& objName) 187 { 187 { 188 if((*(f_writeFileName.find(objName))).second 188 if((*(f_writeFileName.find(objName))).second != "") 189 { 189 { 190 return f_writeFileMode[objName]; 190 return f_writeFileMode[objName]; 191 } 191 } 192 else 192 else 193 { 193 { 194 return kOff; 194 return kOff; 195 } 195 } 196 } 196 } 197 197 198 // ------------------------------------------- 198 // -------------------------------------------------------------------- 199 G4bool G4PersistencyCenter::CurrentRetrieveMod 199 G4bool G4PersistencyCenter::CurrentRetrieveMode(const G4String& objName) 200 { 200 { 201 if((*(f_readFileName.find(objName))).second 201 if((*(f_readFileName.find(objName))).second != "") 202 { 202 { 203 return f_readFileMode[objName]; 203 return f_readFileMode[objName]; 204 } 204 } 205 else 205 else 206 { 206 { 207 return false; 207 return false; 208 } 208 } 209 } 209 } 210 210 211 // ------------------------------------------- 211 // -------------------------------------------------------------------- 212 G4bool G4PersistencyCenter::SetWriteFile(const 212 G4bool G4PersistencyCenter::SetWriteFile(const G4String& objName, 213 const 213 const G4String& writeFileName) 214 { 214 { 215 if((*(f_writeFileName.find(objName))).second 215 if((*(f_writeFileName.find(objName))).second != "") 216 { 216 { 217 f_writeFileName[objName] = writeFileName; 217 f_writeFileName[objName] = writeFileName; 218 } 218 } 219 else 219 else 220 { 220 { 221 G4cerr << "!! unknown object type " << obj 221 G4cerr << "!! unknown object type " << objName << " for output." << G4endl; 222 return false; 222 return false; 223 } 223 } 224 return true; 224 return true; 225 } 225 } 226 226 227 // ------------------------------------------- 227 // -------------------------------------------------------------------- 228 G4bool G4PersistencyCenter::SetReadFile(const 228 G4bool G4PersistencyCenter::SetReadFile(const G4String& objName, 229 const 229 const G4String& readFileName) 230 { 230 { 231 #ifndef WIN32 231 #ifndef WIN32 232 if(f_ut.FileExists(readFileName)) 232 if(f_ut.FileExists(readFileName)) 233 { 233 { 234 f_readFileName[objName] = readFileName; 234 f_readFileName[objName] = readFileName; 235 } 235 } 236 else 236 else 237 { 237 { 238 G4cerr << "!! File \"" << objName << "\" d 238 G4cerr << "!! File \"" << objName << "\" does not exist." << G4endl; 239 return false; 239 return false; 240 } 240 } 241 #endif 241 #endif 242 return true; 242 return true; 243 } 243 } 244 244 245 // ------------------------------------------- 245 // -------------------------------------------------------------------- 246 G4String G4PersistencyCenter::CurrentWriteFile 246 G4String G4PersistencyCenter::CurrentWriteFile(const G4String& objName) 247 { 247 { 248 if((*(f_writeFileName.find(objName))).second 248 if((*(f_writeFileName.find(objName))).second != "") 249 { 249 { 250 return f_writeFileName[objName]; 250 return f_writeFileName[objName]; 251 } 251 } 252 else 252 else 253 { 253 { 254 return "?????"; 254 return "?????"; 255 } 255 } 256 } 256 } 257 257 258 // ------------------------------------------- 258 // -------------------------------------------------------------------- 259 G4String G4PersistencyCenter::CurrentReadFile( 259 G4String G4PersistencyCenter::CurrentReadFile(const G4String& objName) 260 { 260 { 261 if((*(f_readFileName.find(objName))).second 261 if((*(f_readFileName.find(objName))).second != "") 262 { 262 { 263 return f_readFileName[objName]; 263 return f_readFileName[objName]; 264 } 264 } 265 else 265 else 266 { 266 { 267 return "?????"; 267 return "?????"; 268 } 268 } 269 } 269 } 270 270 271 // ------------------------------------------- 271 // -------------------------------------------------------------------- 272 G4String G4PersistencyCenter::CurrentObject(co 272 G4String G4PersistencyCenter::CurrentObject(const G4String& file) 273 { 273 { 274 for(auto itr = f_readFileName.cbegin(); itr 274 for(auto itr = f_readFileName.cbegin(); itr != f_readFileName.cend(); ++itr) 275 { 275 { 276 if(file == (*itr).second) 276 if(file == (*itr).second) 277 return (*itr).first; 277 return (*itr).first; 278 } 278 } 279 for(auto itr = f_writeFileName.cbegin(); itr 279 for(auto itr = f_writeFileName.cbegin(); itr != f_writeFileName.cend(); ++itr) 280 { 280 { 281 if(file == (*itr).second) 281 if(file == (*itr).second) 282 return (*itr).first; 282 return (*itr).first; 283 } 283 } 284 return "?????"; 284 return "?????"; 285 } 285 } 286 286 287 // ------------------------------------------- 287 // -------------------------------------------------------------------- 288 void G4PersistencyCenter::AddHCIOmanager(const 288 void G4PersistencyCenter::AddHCIOmanager(const G4String& detName, 289 const 289 const G4String& colName) 290 { 290 { 291 G4HCIOcatalog* ioc = G4HCIOcatalog::GetHCIOc 291 G4HCIOcatalog* ioc = G4HCIOcatalog::GetHCIOcatalog(); 292 292 293 G4VHCIOentry* ioe = ioc->GetEntry(detName); 293 G4VHCIOentry* ioe = ioc->GetEntry(detName); 294 if(ioe != nullptr) 294 if(ioe != nullptr) 295 { 295 { 296 ioe->CreateHCIOmanager(detName, colName); 296 ioe->CreateHCIOmanager(detName, colName); 297 } 297 } 298 else 298 else 299 { 299 { 300 G4cerr << "Error! -- HCIO assignment faile 300 G4cerr << "Error! -- HCIO assignment failed for detector " << detName 301 << ", collection " << colName << G4 301 << ", collection " << colName << G4endl; 302 } 302 } 303 } 303 } 304 304 305 // ------------------------------------------- 305 // -------------------------------------------------------------------- 306 G4String G4PersistencyCenter::CurrentHCIOmanag 306 G4String G4PersistencyCenter::CurrentHCIOmanager() 307 { 307 { 308 G4HCIOcatalog* ioc = G4HCIOcatalog::GetHCIOc 308 G4HCIOcatalog* ioc = G4HCIOcatalog::GetHCIOcatalog(); 309 return ioc->CurrentHCIOmanager(); 309 return ioc->CurrentHCIOmanager(); 310 } 310 } 311 311 312 // ------------------------------------------- 312 // -------------------------------------------------------------------- 313 void G4PersistencyCenter::AddDCIOmanager(const 313 void G4PersistencyCenter::AddDCIOmanager(const G4String& detName) 314 { 314 { 315 G4DCIOcatalog* ioc = G4DCIOcatalog::GetDCIOc 315 G4DCIOcatalog* ioc = G4DCIOcatalog::GetDCIOcatalog(); 316 316 317 G4String colName = ""; 317 G4String colName = ""; 318 G4VDCIOentry* ioe = ioc->GetEntry(detName); 318 G4VDCIOentry* ioe = ioc->GetEntry(detName); 319 if(ioe != nullptr) 319 if(ioe != nullptr) 320 { 320 { 321 ioe->CreateDCIOmanager(detName, colName); 321 ioe->CreateDCIOmanager(detName, colName); 322 } 322 } 323 else 323 else 324 { 324 { 325 G4cerr << "Error! -- DCIO assignment faile 325 G4cerr << "Error! -- DCIO assignment failed for detector " << detName 326 << ", collection " << colName << G4 326 << ", collection " << colName << G4endl; 327 } 327 } 328 } 328 } 329 329 330 // ------------------------------------------- 330 // -------------------------------------------------------------------- 331 G4String G4PersistencyCenter::CurrentDCIOmanag 331 G4String G4PersistencyCenter::CurrentDCIOmanager() 332 { 332 { 333 G4DCIOcatalog* ioc = G4DCIOcatalog::GetDCIOc 333 G4DCIOcatalog* ioc = G4DCIOcatalog::GetDCIOcatalog(); 334 return ioc->CurrentDCIOmanager(); 334 return ioc->CurrentDCIOmanager(); 335 } 335 } 336 336 337 // ------------------------------------------- 337 // -------------------------------------------------------------------- 338 void G4PersistencyCenter::PrintAll() 338 void G4PersistencyCenter::PrintAll() 339 { 339 { 340 G4cout << "Persistency Package: " << Current 340 G4cout << "Persistency Package: " << CurrentSystem() << G4endl; 341 G4cout << G4endl; 341 G4cout << G4endl; 342 342 343 G4String name, file; 343 G4String name, file; 344 StoreMode mode; 344 StoreMode mode; 345 345 346 G4cout << "Output object types and file name 346 G4cout << "Output object types and file names:" << G4endl; 347 for(auto itr = f_wrObj.cbegin(); itr != f_wr 347 for(auto itr = f_wrObj.cbegin(); itr != f_wrObj.cend(); ++itr) 348 { 348 { 349 name = (*itr).second; 349 name = (*itr).second; 350 // disabled HepMC and MCTruth for now 350 // disabled HepMC and MCTruth for now 351 if(name != "HepMC" && name != "MCTruth") 351 if(name != "HepMC" && name != "MCTruth") 352 { 352 { 353 G4cout << " Object: " << PadString(name 353 G4cout << " Object: " << PadString(name, 9); 354 mode = CurrentStoreMode(name); 354 mode = CurrentStoreMode(name); 355 if(mode == kOn) 355 if(mode == kOn) 356 { 356 { 357 G4cout << " <on> "; 357 G4cout << " <on> "; 358 } 358 } 359 else if(mode == kOff) 359 else if(mode == kOff) 360 { 360 { 361 G4cout << " <off> "; 361 G4cout << " <off> "; 362 } 362 } 363 else if(mode == kRecycle) 363 else if(mode == kRecycle) 364 { 364 { 365 G4cout << "<recycle>"; 365 G4cout << "<recycle>"; 366 } 366 } 367 file = CurrentWriteFile(name); 367 file = CurrentWriteFile(name); 368 if(file == "") 368 if(file == "") 369 file = " <N/A>"; 369 file = " <N/A>"; 370 G4cout << " File: " << file << G4endl; 370 G4cout << " File: " << file << G4endl; 371 } 371 } 372 } 372 } 373 G4cout << G4endl; 373 G4cout << G4endl; 374 374 375 G4cout << "Input object types and file names 375 G4cout << "Input object types and file names:" << G4endl; 376 for(auto itr = f_rdObj.cbegin(); itr != f_rd 376 for(auto itr = f_rdObj.cbegin(); itr != f_rdObj.cend(); ++itr) 377 { 377 { 378 name = (*itr).second; 378 name = (*itr).second; 379 // disabled HepMC and MCTruth for now 379 // disabled HepMC and MCTruth for now 380 if(name != "HepMC" && name != "MCTruth") 380 if(name != "HepMC" && name != "MCTruth") 381 { 381 { 382 G4cout << " Object: " << PadString(name 382 G4cout << " Object: " << PadString(name, 9); 383 if(CurrentRetrieveMode(name)) 383 if(CurrentRetrieveMode(name)) 384 { 384 { 385 G4cout << " <on> "; 385 G4cout << " <on> "; 386 } 386 } 387 else 387 else 388 { 388 { 389 G4cout << " <off> "; 389 G4cout << " <off> "; 390 } 390 } 391 file = CurrentReadFile(name); 391 file = CurrentReadFile(name); 392 if(file == "") 392 if(file == "") 393 file = " <N/A>"; 393 file = " <N/A>"; 394 G4cout << " File: " << CurrentReadFile(n 394 G4cout << " File: " << CurrentReadFile(name) << G4endl; 395 } 395 } 396 } 396 } 397 G4cout << G4endl; 397 G4cout << G4endl; 398 398 399 G4HCIOcatalog* hioc = G4HCIOcatalog::GetHCIO 399 G4HCIOcatalog* hioc = G4HCIOcatalog::GetHCIOcatalog(); 400 if(hioc != nullptr) 400 if(hioc != nullptr) 401 { 401 { 402 G4cout << "Hit IO Managers:" << G4endl; 402 G4cout << "Hit IO Managers:" << G4endl; 403 hioc->PrintEntries(); 403 hioc->PrintEntries(); 404 hioc->PrintHCIOmanager(); 404 hioc->PrintHCIOmanager(); 405 G4cout << G4endl; 405 G4cout << G4endl; 406 } 406 } 407 else 407 else 408 { 408 { 409 G4cout << "Hit IO Manager catalog is not r 409 G4cout << "Hit IO Manager catalog is not registered." << G4endl; 410 } 410 } 411 411 412 G4DCIOcatalog* dioc = G4DCIOcatalog::GetDCIO 412 G4DCIOcatalog* dioc = G4DCIOcatalog::GetDCIOcatalog(); 413 if(dioc != nullptr) 413 if(dioc != nullptr) 414 { 414 { 415 G4cout << "Digit IO Managers:" << G4endl; 415 G4cout << "Digit IO Managers:" << G4endl; 416 dioc->PrintEntries(); 416 dioc->PrintEntries(); 417 dioc->PrintDCIOmanager(); 417 dioc->PrintDCIOmanager(); 418 G4cout << G4endl; 418 G4cout << G4endl; 419 } 419 } 420 else 420 else 421 { 421 { 422 G4cout << "Digit IO Manager catalog is not 422 G4cout << "Digit IO Manager catalog is not registered." << G4endl; 423 } 423 } 424 } 424 } 425 425 426 // ------------------------------------------- 426 // -------------------------------------------------------------------- 427 void G4PersistencyCenter::SetPersistencyManage 427 void G4PersistencyCenter::SetPersistencyManager(G4PersistencyManager* pm, 428 428 const G4String& name) 429 { 429 { 430 f_currentManager = pm; 430 f_currentManager = pm; 431 f_currentSystemName = name; 431 f_currentSystemName = name; 432 } 432 } 433 433 434 // ------------------------------------------- 434 // -------------------------------------------------------------------- 435 G4PersistencyManager* 435 G4PersistencyManager* 436 G4PersistencyCenter::GetPersistencyManager(con 436 G4PersistencyCenter::GetPersistencyManager(const G4String& nam) 437 { 437 { 438 if(f_theCatalog.find(nam) != f_theCatalog.ce 438 if(f_theCatalog.find(nam) != f_theCatalog.cend()) 439 return f_theCatalog[nam]; 439 return f_theCatalog[nam]; 440 return nullptr; 440 return nullptr; 441 } 441 } 442 442 443 // ------------------------------------------- 443 // -------------------------------------------------------------------- 444 void G4PersistencyCenter::RegisterPersistencyM 444 void G4PersistencyCenter::RegisterPersistencyManager(G4PersistencyManager* pm) 445 { 445 { 446 f_theCatalog[pm->GetName()] = pm; 446 f_theCatalog[pm->GetName()] = pm; 447 } 447 } 448 448 449 // ------------------------------------------- 449 // -------------------------------------------------------------------- 450 void G4PersistencyCenter::DeletePersistencyMan 450 void G4PersistencyCenter::DeletePersistencyManager() 451 { 451 { 452 if(f_currentManager != nullptr) 452 if(f_currentManager != nullptr) 453 delete f_currentManager; 453 delete f_currentManager; 454 f_currentManager = nullptr; 454 f_currentManager = nullptr; 455 } 455 } 456 456 457 // ------------------------------------------- 457 // -------------------------------------------------------------------- 458 void G4PersistencyCenter::SetVerboseLevel(G4in 458 void G4PersistencyCenter::SetVerboseLevel(G4int v) 459 { 459 { 460 m_verbose = v; 460 m_verbose = v; 461 if(f_currentManager != nullptr) 461 if(f_currentManager != nullptr) 462 f_currentManager->SetVerboseLevel(m_verbos 462 f_currentManager->SetVerboseLevel(m_verbose); 463 } 463 } 464 464 465 // ------------------------------------------- 465 // -------------------------------------------------------------------- 466 G4String G4PersistencyCenter::PadString(const 466 G4String G4PersistencyCenter::PadString(const G4String& name, 467 unsign 467 unsigned int width) 468 { 468 { 469 if(name.length() > width) 469 if(name.length() > width) 470 { 470 { 471 return name.substr(0, width - 1) + "#"; 471 return name.substr(0, width - 1) + "#"; 472 } 472 } 473 else 473 else 474 { 474 { 475 G4String wname = name; 475 G4String wname = name; 476 for(unsigned int i = 0; i < width - name.l 476 for(unsigned int i = 0; i < width - name.length(); ++i) 477 wname = wname + " "; 477 wname = wname + " "; 478 return wname; 478 return wname; 479 } 479 } 480 } 480 } 481 481