Print

Print


Commit in slic on MAIN
include/LcioManager.hh+31.48 -> 1.49
src/LcioManager.cc+15-111.63 -> 1.64
+18-11
2 modified files
bool var added to track whether writer is open or closed

slic/include
LcioManager.hh 1.48 -> 1.49
diff -u -r1.48 -r1.49
--- LcioManager.hh	21 Sep 2005 00:12:48 -0000	1.48
+++ LcioManager.hh	22 Sep 2005 21:38:37 -0000	1.49
@@ -1,3 +1,4 @@
+// $Header: /cvs/lcd/slic/include/LcioManager.hh,v 1.49 2005/09/22 21:38:37 jeremy Exp $
 #ifndef slic_LcioManager_hh
 #define slic_LcioManager_hh 1
 
@@ -227,6 +228,8 @@
     bool m_useAutonaming;
 
     bool m_enableDumpEvent;
+
+    bool m_writerIsOpen;
   };
 };
 

slic/src
LcioManager.cc 1.63 -> 1.64
diff -u -r1.63 -r1.64
--- LcioManager.cc	21 Sep 2005 00:12:48 -0000	1.63
+++ LcioManager.cc	22 Sep 2005 21:38:37 -0000	1.64
@@ -1,7 +1,7 @@
-// $Header: /cvs/lcd/slic/src/LcioManager.cc,v 1.63 2005/09/21 00:12:48 jeremy Exp $
+// $Header: /cvs/lcd/slic/src/LcioManager.cc,v 1.64 2005/09/22 21:38:37 jeremy Exp $
 #include "LcioManager.hh"
 
-// SLIC
+// slic
 #include "FileUtil.hh"
 #include "TimeUtil.hh"
 #include "PackageInfo.hh"
@@ -10,17 +10,15 @@
 #include "LcioFileNamer.hh"
 #include "TrajectoryManager.hh"
 #include "G4Application.hh"
-
-// StdHep
 #include "lStdHep.hh"
 
-// LCDD
+// lcdd
 #include "LCDDProcessor.hh"
 #include "G4CalorimeterHit.hh"
 #include "G4TrackerHit.hh"
 #include "StringUtil.hh"
 
-// LCIO
+// lcio
 #include "EVENT/LCIO.h"
 #include "IOIMPL/LCFactory.h"
 #include "IO/LCWriter.h"
@@ -34,7 +32,7 @@
 #include "G4TrajectoryContainer.hh"
 #include "G4EventManager.hh"
 
-//
+// std
 #include <ctime>
 
 using IMPL::LCRunHeaderImpl;
@@ -59,7 +57,8 @@
       m_fileExistsAction( LcioManager::eFail ),
       m_runNumber(0),
       m_useAutonaming(false),
-      m_enableDumpEvent(false)
+      m_enableDumpEvent(false),
+      m_writerIsOpen(false)
   {
     // messenger
     m_messenger = new LcioMessenger(this);
@@ -147,6 +146,7 @@
     // open the file using the writer with the full path and no extension
     if( m_writer ) {
       m_writer->open( getFullOutputPath(), writeMode );
+      m_writerIsOpen = true;
     }
     else {
       G4Exception("LCWriter is null!");
@@ -192,10 +192,13 @@
   void LcioManager::deleteWriter()
   {
     if ( m_writer != 0 ) {
-      try {
-	m_writer->close();
+      if ( m_writerIsOpen ) {
+	try {
+	  m_writer->close();
+	  m_writerIsOpen = false;
+	}
+	catch (...) {}
       }
-      catch (...) {}
       delete m_writer;
       m_writer = 0;
     }
@@ -237,6 +240,7 @@
 
     // close the writer to flush it (may reopen)
     m_writer->close();
+    m_writerIsOpen = false;
 
     // set append for subsequent writes if interactive mode
     if ( G4Application::instance()->getMode() == G4Application::eInteractive ) {
CVSspam 0.2.8