Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/persistency/mctruth/src/G4PersistencyCenter.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /persistency/mctruth/src/G4PersistencyCenter.cc (Version 11.3.0) and /persistency/mctruth/src/G4PersistencyCenter.cc (Version 10.0.p2)


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