Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/persistency/mctruth/src/G4PersistencyManager.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/G4PersistencyManager.cc (Version 11.3.0) and /persistency/mctruth/src/G4PersistencyManager.cc (Version 11.1.1)


  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 // G4PersistencyManager implementation             26 // G4PersistencyManager implementation
 27 //                                                 27 //
 28 // Author: Youhei Morita, 17.07.2001               28 // Author: Youhei Morita, 17.07.2001
 29 // -------------------------------------------     29 // --------------------------------------------------------------------
 30                                                    30 
 31 #include "G4PersistencyManager.hh"                 31 #include "G4PersistencyManager.hh"
 32                                                    32 
 33 #include <iomanip>                                 33 #include <iomanip>
 34 #include "G4PersistencyCenter.hh"                  34 #include "G4PersistencyCenter.hh"
 35                                                    35 
 36 // -------------------------------------------     36 // --------------------------------------------------------------------
 37 G4PersistencyManager::G4PersistencyManager(G4P     37 G4PersistencyManager::G4PersistencyManager(G4PersistencyCenter* ptc,
 38                                            con     38                                            const G4String& n)
 39   : f_pc(ptc)                                      39   : f_pc(ptc)
 40   , nameMgr(n)                                     40   , nameMgr(n)
 41 {                                                  41 {
 42   m_verbose = f_pc->VerboseLevel();                42   m_verbose = f_pc->VerboseLevel();
 43 }                                                  43 }
 44                                                    44 
 45 // -------------------------------------------     45 // --------------------------------------------------------------------
 46 G4PersistencyManager::~G4PersistencyManager()      46 G4PersistencyManager::~G4PersistencyManager()
 47 {                                                  47 {
 48 }                                                  48 }
 49                                                    49 
 50 // -------------------------------------------     50 // --------------------------------------------------------------------
 51 G4PersistencyManager* G4PersistencyManager::Ge     51 G4PersistencyManager* G4PersistencyManager::GetPersistencyManager()
 52 {                                                  52 {
 53   return G4PersistencyCenter::GetPersistencyCe     53   return G4PersistencyCenter::GetPersistencyCenter()
 54     ->CurrentPersistencyManager();                 54     ->CurrentPersistencyManager();
 55 }                                                  55 }
 56                                                    56 
 57 // -------------------------------------------     57 // --------------------------------------------------------------------
 58 void G4PersistencyManager::SetVerboseLevel(G4i     58 void G4PersistencyManager::SetVerboseLevel(G4int v)
 59 {                                                  59 {
 60   m_verbose = v;                                   60   m_verbose = v;
 61   if(m_verbose > 2)                                61   if(m_verbose > 2)
 62   {                                                62   {
 63     G4cout << "G4PersistencyManager[\"" << nam     63     G4cout << "G4PersistencyManager[\"" << nameMgr << "\"," << this
 64            << "]: verbose level is set to " <<     64            << "]: verbose level is set to " << m_verbose << "." << G4endl;
 65   }                                                65   }
 66   if(EventIO() != nullptr)                         66   if(EventIO() != nullptr)
 67     EventIO()->SetVerboseLevel(m_verbose);         67     EventIO()->SetVerboseLevel(m_verbose);
 68   if(MCTruthIO() != nullptr)                       68   if(MCTruthIO() != nullptr)
 69     MCTruthIO()->SetVerboseLevel(m_verbose);       69     MCTruthIO()->SetVerboseLevel(m_verbose);
 70   if(HitIO() != nullptr)                           70   if(HitIO() != nullptr)
 71     HitIO()->SetVerboseLevel(m_verbose);           71     HitIO()->SetVerboseLevel(m_verbose);
 72   if(DigitIO() != nullptr)                         72   if(DigitIO() != nullptr)
 73     DigitIO()->SetVerboseLevel(m_verbose);         73     DigitIO()->SetVerboseLevel(m_verbose);
 74   if(TransactionManager() != nullptr)              74   if(TransactionManager() != nullptr)
 75     TransactionManager()->SetVerboseLevel(m_ve     75     TransactionManager()->SetVerboseLevel(m_verbose);
 76                                                    76 
 77   G4int i;                                         77   G4int i;
 78                                                    78 
 79   G4HCIOcatalog* hcio = G4HCIOcatalog::GetHCIO     79   G4HCIOcatalog* hcio = G4HCIOcatalog::GetHCIOcatalog();
 80   if(hcio != nullptr)                              80   if(hcio != nullptr)
 81   {                                                81   {
 82     hcio->SetVerboseLevel(m_verbose);              82     hcio->SetVerboseLevel(m_verbose);
 83     for(i = 0; i < (G4int)hcio->NumberOfHCIOma     83     for(i = 0; i < (G4int)hcio->NumberOfHCIOmanager(); ++i)
 84     {                                              84     {
 85       hcio->GetHCIOmanager(i)->SetVerboseLevel     85       hcio->GetHCIOmanager(i)->SetVerboseLevel(m_verbose);
 86     }                                              86     }
 87   }                                                87   }
 88   G4DCIOcatalog* dcio = G4DCIOcatalog::GetDCIO     88   G4DCIOcatalog* dcio = G4DCIOcatalog::GetDCIOcatalog();
 89   if(dcio != nullptr)                              89   if(dcio != nullptr)
 90   {                                                90   {
 91     dcio->SetVerboseLevel(m_verbose);              91     dcio->SetVerboseLevel(m_verbose);
 92     for(i = 0; i < (G4int)dcio->NumberOfDCIOma     92     for(i = 0; i < (G4int)dcio->NumberOfDCIOmanager(); ++i)
 93     {                                              93     {
 94       dcio->GetDCIOmanager(i)->SetVerboseLevel     94       dcio->GetDCIOmanager(i)->SetVerboseLevel(m_verbose);
 95     }                                              95     }
 96   }                                                96   }
 97 }                                                  97 }
 98                                                    98 
 99 // -------------------------------------------     99 // --------------------------------------------------------------------
100 G4bool G4PersistencyManager::Store(const G4Eve    100 G4bool G4PersistencyManager::Store(const G4Event* evt)
101 {                                                 101 {
102   if(m_verbose > 2)                               102   if(m_verbose > 2)
103   {                                               103   {
104     G4cout << "G4PersistencyManager::Store() i    104     G4cout << "G4PersistencyManager::Store() is called for event# "
105            << evt->GetEventID() << "." << G4en    105            << evt->GetEventID() << "." << G4endl;
106   }                                               106   }
107                                                   107 
108   if(TransactionManager() == nullptr)             108   if(TransactionManager() == nullptr)
109     return true;                                  109     return true;
110                                                   110 
111   G4bool is_store = f_pc->CurrentStoreMode("MC    111   G4bool is_store = f_pc->CurrentStoreMode("MCTruth") != kOff ||
112                     f_pc->CurrentStoreMode("Hi    112                     f_pc->CurrentStoreMode("Hits") != kOff ||
113                     f_pc->CurrentStoreMode("Di    113                     f_pc->CurrentStoreMode("Digits") != kOff;
114                                                   114 
115   if(!is_store)                                   115   if(!is_store)
116     return true;                                  116     return true;
117                                                   117 
118   // Call package dependent Initialize()          118   // Call package dependent Initialize()
119   //                                              119   //
120   if(!f_is_initialized)                           120   if(!f_is_initialized)
121   {                                               121   {
122     f_is_initialized = true;                      122     f_is_initialized = true;
123     if(m_verbose > 1)                             123     if(m_verbose > 1)
124     {                                             124     {
125       G4cout << "G4PersistencyManager:: Initia    125       G4cout << "G4PersistencyManager:: Initializing Transaction ... "
126              << G4endl;                           126              << G4endl;
127     }                                             127     }
128     Initialize();                                 128     Initialize();
129   }                                               129   }
130                                                   130 
131   G4bool st1 = true, st2 = true;                  131   G4bool st1 = true, st2 = true;
132                                                   132 
133   // Start event IO transaction                   133   // Start event IO transaction
134   //                                              134   //
135   if(TransactionManager()->StartUpdate())         135   if(TransactionManager()->StartUpdate())
136   {                                               136   {
137     if(m_verbose > 2)                             137     if(m_verbose > 2)
138     {                                             138     {
139       G4cout << "G4PersistencyManager: Update     139       G4cout << "G4PersistencyManager: Update transaction started for event#"
140              << evt->GetEventID() << "." << G4    140              << evt->GetEventID() << "." << G4endl;
141     }                                             141     }
142   }                                               142   }
143   else                                            143   else
144   {                                               144   {
145     G4cerr << "TransactionManager::Store(G4Eve    145     G4cerr << "TransactionManager::Store(G4Event) - StartUpdate() failed."
146            << G4endl;                             146            << G4endl;
147     return false;                                 147     return false;
148   }                                               148   }
149                                                   149 
150   G4String file;                                  150   G4String file;
151   G4String obj;                                   151   G4String obj;
152                                                   152 
153   G4bool stmct = true, st3 = true;                153   G4bool stmct = true, st3 = true;
154                                                   154 
155   // Store MCTruth event                          155   // Store MCTruth event
156   //                                              156   //
157   obj                = "MCTruth";                 157   obj                = "MCTruth";
158   G4MCTEvent* mctevt = nullptr;                   158   G4MCTEvent* mctevt = nullptr;
159   if(f_pc->CurrentStoreMode(obj) == kOn)          159   if(f_pc->CurrentStoreMode(obj) == kOn)
160   {                                               160   {
161     //  Note: This part of code will not be ac    161     //  Note: This part of code will not be activated until a method
162     //  to obtain the current pointer of G4MCT    162     //  to obtain the current pointer of G4MCTEvent* become available.
163                                                   163 
164     // if ( (mctevt = f_MCTman->GetCurrentEven    164     // if ( (mctevt = f_MCTman->GetCurrentEvent()) != 0 ) {
165     if(mctevt != nullptr)                         165     if(mctevt != nullptr)
166     {                                             166     {
167       file = f_pc->CurrentWriteFile(obj);         167       file = f_pc->CurrentWriteFile(obj);
168       if(TransactionManager()->SelectWriteFile    168       if(TransactionManager()->SelectWriteFile(obj, file))
169       {                                           169       {
170         stmct = MCTruthIO()->Store(mctevt);       170         stmct = MCTruthIO()->Store(mctevt);
171         if(stmct && m_verbose > 1)                171         if(stmct && m_verbose > 1)
172         {                                         172         {
173           G4cout << " -- File : " << file << "    173           G4cout << " -- File : " << file << " -- Event# " << evt->GetEventID()
174                  << " -- G4MCTEvent Stored." <    174                  << " -- G4MCTEvent Stored." << G4endl;
175         }                                         175         }
176       }                                           176       }
177       else                                        177       else
178       {                                           178       {
179         stmct = false;                            179         stmct = false;
180       }                                           180       }
181     }  // end of if ( mctevt != nullptr )         181     }  // end of if ( mctevt != nullptr )
182   }                                               182   }
183                                                   183 
184   // Store hits collection                        184   // Store hits collection
185   //                                              185   //
186   obj = "Hits";                                   186   obj = "Hits";
187   if(f_pc->CurrentStoreMode(obj) == kOn)          187   if(f_pc->CurrentStoreMode(obj) == kOn)
188   {                                               188   {
189     if(G4HCofThisEvent* hc = evt->GetHCofThisE    189     if(G4HCofThisEvent* hc = evt->GetHCofThisEvent())
190     {                                             190     {
191       file = f_pc->CurrentWriteFile(obj);         191       file = f_pc->CurrentWriteFile(obj);
192       if(TransactionManager()->SelectWriteFile    192       if(TransactionManager()->SelectWriteFile(obj, file))
193       {                                           193       {
194         st1 = HitIO()->Store(hc);                 194         st1 = HitIO()->Store(hc);
195         if(st1 && m_verbose > 1)                  195         if(st1 && m_verbose > 1)
196         {                                         196         {
197           G4cout << " -- File : " << file << "    197           G4cout << " -- File : " << file << " -- Event# " << evt->GetEventID()
198                  << " -- Hit Collections Store    198                  << " -- Hit Collections Stored." << G4endl;
199         }                                         199         }
200       }                                           200       }
201       else                                        201       else
202       {                                           202       {
203         st1 = false;                              203         st1 = false;
204       }                                           204       }
205     }                                             205     }
206   }                                               206   }
207                                                   207 
208   // Store digits collection                      208   // Store digits collection
209   //                                              209   //
210   obj = "Digits";                                 210   obj = "Digits";
211   if(f_pc->CurrentStoreMode(obj) == kOn)          211   if(f_pc->CurrentStoreMode(obj) == kOn)
212   {                                               212   {
213     if(G4DCofThisEvent* dc = evt->GetDCofThisE    213     if(G4DCofThisEvent* dc = evt->GetDCofThisEvent())
214     {                                             214     {
215       file = f_pc->CurrentWriteFile(obj);         215       file = f_pc->CurrentWriteFile(obj);
216       if(TransactionManager()->SelectWriteFile    216       if(TransactionManager()->SelectWriteFile(obj, file))
217       {                                           217       {
218         st2 = DigitIO()->Store(dc);               218         st2 = DigitIO()->Store(dc);
219         if(st2 && m_verbose > 1)                  219         if(st2 && m_verbose > 1)
220         {                                         220         {
221           G4cout << " -- File : " << file << "    221           G4cout << " -- File : " << file << " -- Event# " << evt->GetEventID()
222                  << " -- Digit Collections Sto    222                  << " -- Digit Collections Stored." << G4endl;
223         }                                         223         }
224       }                                           224       }
225       else                                        225       else
226       {                                           226       {
227         st2 = false;                              227         st2 = false;
228       }                                           228       }
229     }                                             229     }
230   }                                               230   }
231                                                   231 
232   // Store this G4EVENT                           232   // Store this G4EVENT
233   //                                              233   //
234   if(mctevt != 0 || evt != 0)                     234   if(mctevt != 0 || evt != 0)
235   {                                               235   {
236     obj  = "Hits";                                236     obj  = "Hits";
237     file = f_pc->CurrentWriteFile(obj);           237     file = f_pc->CurrentWriteFile(obj);
238     if(TransactionManager()->SelectWriteFile(o    238     if(TransactionManager()->SelectWriteFile(obj, file))
239     {                                             239     {
240       st3 = EventIO()->Store(evt);                240       st3 = EventIO()->Store(evt);
241       if(st3 && m_verbose > 1)                    241       if(st3 && m_verbose > 1)
242       {                                           242       {
243         G4cout << " -- File name: " << f_pc->C    243         G4cout << " -- File name: " << f_pc->CurrentWriteFile("Hits")
244                << " -- Event# " << evt->GetEve    244                << " -- Event# " << evt->GetEventID()
245                << " -- G4Pevent is Stored." <<    245                << " -- G4Pevent is Stored." << G4endl;
246       }                                           246       }
247     }                                             247     }
248     else                                          248     else
249     {                                             249     {
250       st3 = false;                                250       st3 = false;
251     }                                             251     }
252   }                                               252   }
253                                                   253 
254   G4bool st = stmct && st1 && st2 && st3;         254   G4bool st = stmct && st1 && st2 && st3;
255                                                   255 
256   if(st)                                          256   if(st)
257   {                                               257   {
258     TransactionManager()->Commit();               258     TransactionManager()->Commit();
259     if(m_verbose > 0)                             259     if(m_verbose > 0)
260       G4cout << "G4PersistencyManager: event#     260       G4cout << "G4PersistencyManager: event# " << evt->GetEventID()
261              << " is stored." << G4endl;          261              << " is stored." << G4endl;
262   }                                               262   }
263   else                                            263   else
264   {                                               264   {
265     G4cerr << "G4PersistencyManager::Store(G4E    265     G4cerr << "G4PersistencyManager::Store(G4Event) - Transaction aborted."
266            << G4endl;                             266            << G4endl;
267     TransactionManager()->Abort();                267     TransactionManager()->Abort();
268   }                                               268   }
269                                                   269 
270   return st;                                      270   return st;
271 }                                                 271 }
272                                                   272 
273 // -------------------------------------------    273 // --------------------------------------------------------------------
274 G4bool G4PersistencyManager::Retrieve(G4Event*    274 G4bool G4PersistencyManager::Retrieve(G4Event*& evt)
275 {                                                 275 {
276   if(m_verbose > 2)                               276   if(m_verbose > 2)
277   {                                               277   {
278     G4cout << "G4PersistencyManager::Retrieve(    278     G4cout << "G4PersistencyManager::Retrieve(G4Event*&) is called." << G4endl;
279   }                                               279   }
280                                                   280 
281   if(TransactionManager() == nullptr)             281   if(TransactionManager() == nullptr)
282     return true;                                  282     return true;
283                                                   283 
284   if(f_pc->CurrentRetrieveMode("MCTruth") == f    284   if(f_pc->CurrentRetrieveMode("MCTruth") == false &&
285      f_pc->CurrentRetrieveMode("Hits") == fals    285      f_pc->CurrentRetrieveMode("Hits") == false &&
286      f_pc->CurrentRetrieveMode("Digits") == fa    286      f_pc->CurrentRetrieveMode("Digits") == false)
287   {                                               287   {
288     return true;                                  288     return true;
289   }                                               289   }
290                                                   290 
291   // Call package dependent Initialize()          291   // Call package dependent Initialize()
292   //                                              292   //
293   if(!f_is_initialized)                           293   if(!f_is_initialized)
294   {                                               294   {
295     f_is_initialized = true;                      295     f_is_initialized = true;
296     if(m_verbose > 1)                             296     if(m_verbose > 1)
297     {                                             297     {
298       G4cout << "G4PersistencyManager:: Initia    298       G4cout << "G4PersistencyManager:: Initializing Transaction ... "
299              << G4endl;                           299              << G4endl;
300     }                                             300     }
301     Initialize();                                 301     Initialize();
302   }                                               302   }
303                                                   303 
304   // Start event IO transaction                   304   // Start event IO transaction
305   //                                              305   //
306   if(TransactionManager()->StartRead())           306   if(TransactionManager()->StartRead())
307   {                                               307   {
308     if(m_verbose > 2)                             308     if(m_verbose > 2)
309     {                                             309     {
310       G4cout << "G4PersistencyManager: Read tr    310       G4cout << "G4PersistencyManager: Read transaction started." << G4endl;
311     }                                             311     }
312   }                                               312   }
313   else                                            313   else
314   {                                               314   {
315     G4cerr << "TransactionManager::Retrieve(G4    315     G4cerr << "TransactionManager::Retrieve(G4Event) - StartRead() failed."
316            << G4endl;                             316            << G4endl;
317     return false;                                 317     return false;
318   }                                               318   }
319                                                   319 
320   G4bool st = false;                              320   G4bool st = false;
321   G4String file;                                  321   G4String file;
322                                                   322 
323   // Retrieve a G4EVENT                           323   // Retrieve a G4EVENT
324   //                                              324   //
325   G4String obj = "Hits";                          325   G4String obj = "Hits";
326   if(f_pc->CurrentRetrieveMode(obj) == true)      326   if(f_pc->CurrentRetrieveMode(obj) == true)
327   {                                               327   {
328     file = f_pc->CurrentReadFile(obj);            328     file = f_pc->CurrentReadFile(obj);
329     if(TransactionManager()->SelectReadFile(ob    329     if(TransactionManager()->SelectReadFile(obj, file))
330     {                                             330     {
331       st = EventIO()->Retrieve(evt);              331       st = EventIO()->Retrieve(evt);
332       if(st && m_verbose > 1)                     332       if(st && m_verbose > 1)
333       {                                           333       {
334         G4cout << " -- File : " << file << " -    334         G4cout << " -- File : " << file << " -- Event# " << evt->GetEventID()
335                << " -- G4Event is Retrieved."     335                << " -- G4Event is Retrieved." << G4endl;
336       }                                           336       }
337     }                                             337     }
338     else                                          338     else
339     {                                             339     {
340       st = false;                                 340       st = false;
341     }                                             341     }
342   }                                               342   }
343                                                   343 
344   if(st)                                          344   if(st)
345   {                                               345   {
346     TransactionManager()->Commit();               346     TransactionManager()->Commit();
347   }                                               347   }
348   else                                            348   else
349   {                                               349   {
350     G4cerr << "G4PersistencyManager::Retrieve(    350     G4cerr << "G4PersistencyManager::Retrieve() - Transaction aborted."
351            << G4endl;                             351            << G4endl;
352     TransactionManager()->Abort();                352     TransactionManager()->Abort();
353   }                                               353   }
354                                                   354 
355   return st;                                      355   return st;
356 }                                                 356 }
357                                                   357