Commit in lcio on rio_v00-00
rootio/ToDo.txt+21-31.1.2.2 -> 1.1.2.3
      /readevent.C+13-131.1.2.2 -> 1.1.2.3
src/cpp/CMakeLists.txt+4-21.22.2.6 -> 1.22.2.7
src/cpp/include/IOIMPL/LCEventIOImpl.h+71.3 -> 1.3.20.1
src/cpp/include/RIO/RIO.h+1-11.1.2.1 -> 1.1.2.2
                   /RIOLCCollectionHandler.h+35-191.1.2.2 -> 1.1.2.3
                   /RIOReader.h+3-31.1.2.4 -> 1.1.2.5
                   /RIOWriter.h+4-31.1.2.2 -> 1.1.2.3
                   /rootio_templates.h+281.1.2.3 -> 1.1.2.4
src/cpp/src/EXAMPLE/rootio.cc+35-351.1.2.3 -> 1.1.2.4
src/cpp/src/IMPL/LCCollectionVec.cc+231.12 -> 1.12.20.1
                /LCEventImpl.cc+72-341.24.8.1 -> 1.24.8.2
                /LCIO.cc+641.22 -> 1.22.12.1
                /LCParametersImpl.cc+131.6 -> 1.6.20.1
                /MCParticleImpl.cc+6-31.29.6.1 -> 1.29.6.2
                /ReconstructedParticleImpl.cc+2-11.11 -> 1.11.6.1
src/cpp/src/RIO/RIOReader.cc+207-1871.1.2.5 -> 1.1.2.6
               /RIOWriter.cc+54-181.1.2.3 -> 1.1.2.4
src/cpp/src/SIO/SIOParticleHandler.cc+41.22 -> 1.22.20.1
+596-322
19 modified files
added Ref and RefVec (pointers across branches) for splitting an event into one branch per collection 

lcio/rootio
ToDo.txt 1.1.2.2 -> 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- ToDo.txt	18 Sep 2009 09:33:39 -0000	1.1.2.2
+++ ToDo.txt	20 Nov 2009 15:28:50 -0000	1.1.2.3
@@ -11,11 +11,29 @@
 
 
  - LCFactory needs to have mechanism to choose either SIO or RIO 
-
    -> try to resolve based on filename extension (slcio/rlcio)
-
    -> implement 'generic decorator' that resolves type at open() ...
+ DONE: added LCReader/WriterDecorator.cc
+    
  
-
  - RIOWriter:   write Runheader
 
+
+ - develop  pointer mechanism that is based in collection indices and store these
+    in order to split the event into branches (SIO blocks)
+    -> define templated class RefVec<T> w/ conversion to vector<ptr>
+   
+
+  - order collections in the event wrt. order of addCollection() calls
+     ( use _colNames vector )
+     DONE:     
+
+
+  - handle collections that are not in the first event 
+      (branches need to be declared before first write)
+
+ 
+
+  - make LCCollection branches subbranches of LCEvent 
+
+

lcio/rootio
readevent.C 1.1.2.2 -> 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- readevent.C	18 Sep 2009 09:33:39 -0000	1.1.2.2
+++ readevent.C	20 Nov 2009 15:28:50 -0000	1.1.2.3
@@ -75,18 +75,18 @@
   bevt->SetAddress( &evt ) ;
   branches.push_back( bevt ) ;
 
-//   IMPL::LCCollectionVec* col = new IMPL::LCCollectionVec ;
-//   branches.push_back( t->GetBranch("MCParticlesSkimmed") ) ;  
-//   branches.back()->SetAddress( &col ) ;
-  
-//   IMPL::LCCollectionVec* cpfo = new IMPL::LCCollectionVec ;
-//   branches.push_back( t->GetBranch("PandoraPFOs") ) ;  
-//   branches.back()->SetAddress( &cpfo ) ;
+   IMPL::LCCollectionVec* col = new IMPL::LCCollectionVec ;
+//    branches.push_back( t->GetBranch("MCParticlesSkimmed") ) ;  
+//    branches.back()->SetAddress( &col ) ;
+  
+   IMPL::LCCollectionVec* cpfo = new IMPL::LCCollectionVec ;
+//    branches.push_back( t->GetBranch("PandoraPFOs") ) ;  
+//    branches.back()->SetAddress( &cpfo ) ;
 
 
-//   IMPL::LCCollectionVec* crml = new IMPL::LCCollectionVec ;
-//   branches.push_back( t->GetBranch("RecoMCTruthLink") ) ;  
-//   branches.back()->SetAddress( &crml ) ;
+   IMPL::LCCollectionVec* crml = new IMPL::LCCollectionVec ;
+   branches.push_back( t->GetBranch("RecoMCTruthLink") ) ;  
+   branches.back()->SetAddress( &crml ) ;
 
   
   int nBranches = branches.size() ;
@@ -108,9 +108,9 @@
       // 	   << std::endl ;
     }
 
-    EVENT::LCCollection* col  = evt->getCollection("MCParticlesSkimmed") ;
-    EVENT::LCCollection* cpfo = evt->getCollection("PandoraPFOs") ;
-    EVENT::LCCollection* crml = evt->getCollection("RecoMCTruthLink") ;
+//     EVENT::LCCollection* col  = evt->getCollection("MCParticlesSkimmed") ;
+//     EVENT::LCCollection* cpfo = evt->getCollection("PandoraPFOs") ;
+//     EVENT::LCCollection* crml = evt->getCollection("RecoMCTruthLink") ;
 
 
    

lcio/src/cpp
CMakeLists.txt 1.22.2.6 -> 1.22.2.7
diff -u -r1.22.2.6 -r1.22.2.7
--- CMakeLists.txt	18 Sep 2009 09:33:39 -0000	1.22.2.6
+++ CMakeLists.txt	20 Nov 2009 15:28:50 -0000	1.22.2.7
@@ -176,11 +176,13 @@
     OUTPUT_NAME lcio
 )
 
-# - needed for apple ??? ---  TARGET_LINK_LIBRARIES( lib_LCIO ${ROOT_LIBRARIES} )
+# - needed for apple ??? ---  
+IF( APPLE )
+TARGET_LINK_LIBRARIES( lib_LCIO ${ROOT_LIBRARIES} )
+ENDIF( APPLE )
 TARGET_LINK_LIBRARIES( lib_LCIO lib_SIO )
 TARGET_LINK_LIBRARIES( lib_LCIOF77 lib_LCIO )
 
-
 # create symbolic target for calling targets bin_XXX
 ADD_CUSTOM_TARGET( bin )
 

lcio/src/cpp/include/IOIMPL
LCEventIOImpl.h 1.3 -> 1.3.20.1
diff -u -r1.3 -r1.3.20.1
--- LCEventIOImpl.h	15 Apr 2005 08:37:40 -0000	1.3
+++ LCEventIOImpl.h	20 Nov 2009 15:28:50 -0000	1.3.20.1
@@ -11,6 +11,10 @@
   class SIOReader ;
 }
 
+namespace RIO{
+  class RIOWriter;
+  class RIOReader;
+}
 
 namespace IOIMPL {
   
@@ -26,6 +30,9 @@
     friend class SIO::SIOEventHeaderHandler ;
     friend class SIO::SIOEventHandler ;
   
+    friend class RIO::RIOReader ;
+    friend class RIO::RIOWriter ;
+
   }; // class
 
 } // namespace

lcio/src/cpp/include/RIO
RIO.h 1.1.2.1 -> 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- RIO.h	18 Sep 2009 09:37:11 -0000	1.1.2.1
+++ RIO.h	20 Nov 2009 15:28:50 -0000	1.1.2.2
@@ -16,7 +16,7 @@
 
 #define RIO_RECORD_SIZE    16000
 
-#define RIO_SPLIT_LEVEL        1
+#define RIO_SPLIT_LEVEL        2
 
 #define RIO_DEFAULT_COMPRESS   4  // what is a reasonable default ?
 

lcio/src/cpp/include/RIO
RIOLCCollectionHandler.h 1.1.2.2 -> 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- RIOLCCollectionHandler.h	15 Sep 2009 15:45:00 -0000	1.1.2.2
+++ RIOLCCollectionHandler.h	20 Nov 2009 15:28:50 -0000	1.1.2.3
@@ -10,7 +10,7 @@
 
 #include "TTree.h"
 #include <vector>
-
+#include "RIO.h"
 
 namespace RIO{
   /* Abstract interface for handling collections of different types.
@@ -19,7 +19,8 @@
   class RIOBranchHandler{
     
   public: 
-    
+    virtual ~RIOBranchHandler() {} ;
+
     virtual void toBranch( const EVENT::LCEvent* evt )=0 ;
     
     virtual void fromBranch( EVENT::LCEvent* evt , int entryID )=0 ;
@@ -31,7 +32,7 @@
   /** Branch handler class for (typed) LCCollections.
    */
   
-  //  template <typename T>
+  //template <typename T>
   class RIOLCCollectionHandler : public RIOBranchHandler{
     
   protected:
@@ -44,7 +45,7 @@
     
     TBranch* _br ;
     IMPL::LCCollectionVec* _tv ;
-    
+    IMPL::LCCollectionVec* _emptyCol ;
     
   public: 
     
@@ -54,10 +55,16 @@
       _name(name),
       _type(type) {
       
+      _emptyCol =  new IMPL::LCCollectionVec( type  )  ;
+
       std::cout << "  RIOLCCollectionHandler( " << name << ", " << tree << ")" << std::endl ;
       
-      //      _tv = 0 ; //IMPL::LCCollectionVec ; // new std::vector<T*> ;      
-      _tv = new IMPL::LCCollectionVec( type  )  ;
+      //_tv = 0 ; //IMPL::LCCollectionVec ; // new std::vector<T*> ;      
+      _tv =  _emptyCol ; // new IMPL::LCCollectionVec( type  )  ;
+//       TClass* cl = TClass::GetClass(TString::Format("vector<EVENT::%s>", type.c_str()));
+//       if (!cl) printf("bad\n");
+//       else {
+      //	_tv = new std::vector<T*> ;      
       
       _br = (TBranch*) tree->GetBranch( _name.c_str() ) ;
       
@@ -65,10 +72,14 @@
 	
 	_br->SetAddress( &_tv ) ;
 	
-      } else {
+	std::cout << " set branch address   " << _br->GetName() << " to " << &_tv << std::endl ;
+     
+ } else {
 	
 	//FIXME: make split level and 'record size' parameters ....
-	tree->Branch( _name.c_str()  , &_tv, 16000, 2 );
+	_br = tree->Branch( _name.c_str()  , &_tv, 16000, RIO_SPLIT_LEVEL );
+
+	//((TBranch*)_br->GetListOfBranches()->FindObject("vector<EVENT::LCObject*>"))->SetName("LCObjVec")  ;
       }
       
       
@@ -113,32 +124,36 @@
 // 	}
 	
 
-// 	IMPL::LCParametersImpl* lcp =  dynamic_cast<IMPL::LCParametersImpl*> ( & col->parameters() ) ; 
-// 	_params = lcp ;
+// // 	IMPL::LCParametersImpl* lcp =  dynamic_cast<IMPL::LCParametersImpl*> ( & col->parameters() ) ; 
+// // 	_params = lcp ;
 
 
-// 	//FIXME: we also need to add the collection flags to the meta data branch ...
+// // 	//FIXME: we also need to add the collection flags to the meta data branch ...
 
 
-//       } catch(const lcio::DataNotAvailableException& e){
+//        } catch(const lcio::DataNotAvailableException& e){
 
-// 	_tv->resize( 0 ) ;
+//  	_tv->resize( 0 ) ;
 	
-// 	std::cout << "  collection not found : " << _name << std::endl ;
-//       }    
+//  	std::cout << "  collection not found : " << _name << std::endl ;
+//        }    
 
+      _tv = _emptyCol ;
+      
       try{
 	
 	EVENT::LCCollection* col =  evt->getCollection( _name ) ;
 	
-	_tv = dynamic_cast<IMPL::LCCollectionVec*> ( col ) ;
+	if( ! col->isTransient() ) 
+	  
+	  _tv = dynamic_cast<IMPL::LCCollectionVec*> ( col ) ;
 	
       } catch(const lcio::DataNotAvailableException& e){
-
-	_tv = new IMPL::LCCollectionVec( _type ) ;
 	
+	//_tv = _emptyCol ; //new IMPL::LCCollectionVec( _type ) ;
+	  
 	std::cout << "  collection not found : " << _name << std::endl ;
-      }    
+      }
       
       
     }
@@ -167,6 +182,7 @@
 
 // 	evt->addCollection( col ,  _name ) ;
 
+      std::cout << " reading from branch  " << _br->GetName() << " entry " << entryID << std::endl ;
 
       int nbyte = _br->GetEntry( entryID );
      

lcio/src/cpp/include/RIO
RIOReader.h 1.1.2.4 -> 1.1.2.5
diff -u -r1.1.2.4 -r1.1.2.5
--- RIOReader.h	18 Sep 2009 09:33:39 -0000	1.1.2.4
+++ RIOReader.h	20 Nov 2009 15:28:50 -0000	1.1.2.5
@@ -23,13 +23,13 @@
 
   class RIOBranchHandler ;
 
-  typedef std::vector< RIOBranchHandler * > BranchVector ;
+  typedef std::map< std::string, RIOBranchHandler*> BranchHandlerMap ;
 
 
   /** Concrete implementation of LCWriter using ROOT I/O.
    * 
    * @author gaede
-   * @version $Id: RIOReader.h,v 1.1.2.4 2009/09/18 09:33:39 gaede Exp $
+   * @version $Id: RIOReader.h,v 1.1.2.5 2009/11/20 15:28:50 gaede Exp $
    */
   class RIOReader : public IO::LCReader {
     
@@ -166,7 +166,7 @@
     TFile* _file ;
     TTree* _tree ;
 
-    BranchVector _branches ;
+    BranchHandlerMap _branches ;
     bool _haveBranches ; 
  
     IMPL::LCEventImpl *_evtImpl ;

lcio/src/cpp/include/RIO
RIOWriter.h 1.1.2.2 -> 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- RIOWriter.h	18 Sep 2009 09:33:39 -0000	1.1.2.2
+++ RIOWriter.h	20 Nov 2009 15:28:50 -0000	1.1.2.3
@@ -17,7 +17,8 @@
   
   class RIOBranchHandler ;
 
-  typedef std::vector< RIOBranchHandler * > BranchVector ;
+  //  typedef std::vector< RIOBranchHandler * > BranchVector ;
+  typedef std::map< std::string, RIOBranchHandler*> BranchHandlerMap ;
 
 
   //  class RIOReader ;
@@ -119,10 +120,10 @@
     TFile* _file ; 
     TTree* _tree ;
     
-    const IMPL::LCEventImpl* _evtImpl ;
+    IMPL::LCEventImpl* _evtImpl ;
     const IMPL::LCRunHeaderImpl* _runImpl ;
     
-    BranchVector _branches ;
+    BranchHandlerMap _branches ;
     bool _haveBranches ; 
     
 

lcio/src/cpp/include/RIO
rootio_templates.h 1.1.2.3 -> 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- rootio_templates.h	15 Sep 2009 08:06:22 -0000	1.1.2.3
+++ rootio_templates.h	20 Nov 2009 15:28:50 -0000	1.1.2.4
@@ -41,6 +41,34 @@
 #pragma link C++ class std::vector<EVENT::Cluster*>+;
 #pragma link C++ class std::vector<EVENT::LCRelation*>+;
 #pragma link C++ class std::vector<EVENT::Vertex*>+;
+
+#pragma link C++ class IMPL::LCRefVec<EVENT::LCObject*>+;
+#pragma link C++ class IMPL::LCRefVec<EVENT::ReconstructedParticle*>+;
+#pragma link C++ class IMPL::LCRefVec<EVENT::MCParticle*>+;
+#pragma link C++ class IMPL::LCRefVec<EVENT::SimTrackerHit*>+;
+#pragma link C++ class IMPL::LCRefVec<EVENT::CalorimeterHit*>+;
+#pragma link C++ class IMPL::LCRefVec<EVENT::TrackerHit*>+;
+#pragma link C++ class IMPL::LCRefVec<EVENT::SimCalorimeterHit*>+;
+#pragma link C++ class IMPL::LCRefVec<EVENT::Track*>+;
+#pragma link C++ class IMPL::LCRefVec<EVENT::Cluster*>+;
+#pragma link C++ class IMPL::LCRefVec<EVENT::LCRelation*>+;
+#pragma link C++ class IMPL::LCRefVec<EVENT::Vertex*>+;
+
+
+#pragma link C++ class IMPL::LCRef<EVENT::LCObject*>+;
+#pragma link C++ class IMPL::LCRef<EVENT::ReconstructedParticle*>+;
+#pragma link C++ class IMPL::LCRef<EVENT::MCParticle*>+;
+#pragma link C++ class IMPL::LCRef<EVENT::SimTrackerHit*>+;
+#pragma link C++ class IMPL::LCRef<EVENT::SimCalorimeterHit*>+;
+#pragma link C++ class IMPL::LCRef<EVENT::TrackerHit*>+;
+#pragma link C++ class IMPL::LCRef<EVENT::CalorimeterHit*>+;
+#pragma link C++ class IMPL::LCRef<EVENT::Track*>+;
+#pragma link C++ class IMPL::LCRef<EVENT::Cluster*>+;
+#pragma link C++ class IMPL::LCRef<EVENT::LCRelation*>+;
+#pragma link C++ class IMPL::LCRef<EVENT::Vertex*>+;
+
+
+
 #endif
 
 #endif

lcio/src/cpp/src/EXAMPLE
rootio.cc 1.1.2.3 -> 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- rootio.cc	14 Sep 2009 13:50:48 -0000	1.1.2.3
+++ rootio.cc	20 Nov 2009 15:28:50 -0000	1.1.2.4
@@ -79,41 +79,41 @@
 
   //_branches.push_back( new LCCol2Branch<ReconstructedParticleROOT>( "PandoraPFOs" , _tree ) )  ;
 
-  _branches.push_back( new LCCol2Branch<EVENT::ReconstructedParticle>( "PandoraPFOs" , _tree ) )  ;
-  _branches.push_back( new LCCol2Branch<EVENT::ReconstructedParticle>( "Durham_2Jets" , _tree ) )  ;
-  _branches.push_back( new LCCol2Branch<EVENT::ReconstructedParticle>( "Durham_3Jets" , _tree ) )  ;
-  _branches.push_back( new LCCol2Branch<EVENT::ReconstructedParticle>( "Durham_4Jets" , _tree ) )  ;
-  _branches.push_back( new LCCol2Branch<EVENT::ReconstructedParticle>( "Durham_5Jets" , _tree ) )  ;
-  _branches.push_back( new LCCol2Branch<EVENT::ReconstructedParticle>( "Durham_6Jets" , _tree ) )  ;
-  _branches.push_back( new LCCol2Branch<EVENT::Vertex>( "IPVertex" , _tree ) )  ;
-  _branches.push_back( new LCCol2Branch<EVENT::Track>( "LDCTracks" , _tree ) )  ;
-  _branches.push_back( new LCCol2Branch<EVENT::MCParticle>( "MCParticlesSkimmed" , _tree ) )  ;
-  _branches.push_back( new LCCol2Branch<EVENT::Cluster>( "PandoraClusters" , _tree ) )  ;
-  _branches.push_back( new LCCol2Branch<EVENT::LCRelation>( "RecoMCTruthLink" , _tree ) )  ;
-  _branches.push_back( new LCCol2Branch<EVENT::Vertex>( "V0Vertices" , _tree ) )  ;
-  _branches.push_back( new LCCol2Branch<EVENT::Vertex>( "ZVRESVertices_2Jets" , _tree ) )  ;
-  _branches.push_back( new LCCol2Branch<EVENT::Vertex>( "ZVRESVertices_3Jets" , _tree ) )  ;
-  _branches.push_back( new LCCol2Branch<EVENT::Vertex>( "ZVRESVertices_4Jets" , _tree ) )  ;
-  _branches.push_back( new LCCol2Branch<EVENT::Vertex>( "ZVRESVertices_5Jets" , _tree ) )  ;
-  _branches.push_back( new LCCol2Branch<EVENT::Vertex>( "ZVRESVertices_6Jets" , _tree ) )  ;
-
-//   _branches.push_back( new LCCol2Branch<IMPL::ReconstructedParticleImpl>( "PandoraPFOs" , _tree ) )  ;
-//   _branches.push_back( new LCCol2Branch<IMPL::ReconstructedParticleImpl>( "Durham_2Jets" , _tree ) )  ;
-//   _branches.push_back( new LCCol2Branch<IMPL::ReconstructedParticleImpl>( "Durham_3Jets" , _tree ) )  ;
-//   _branches.push_back( new LCCol2Branch<IMPL::ReconstructedParticleImpl>( "Durham_4Jets" , _tree ) )  ;
-//   _branches.push_back( new LCCol2Branch<IMPL::ReconstructedParticleImpl>( "Durham_5Jets" , _tree ) )  ;
-//   _branches.push_back( new LCCol2Branch<IMPL::ReconstructedParticleImpl>( "Durham_6Jets" , _tree ) )  ;
-//   _branches.push_back( new LCCol2Branch<IMPL::VertexImpl>( "IPVertex" , _tree ) )  ;
-//   _branches.push_back( new LCCol2Branch<IMPL::TrackImpl>( "LDCTracks" , _tree ) )  ;
-//   _branches.push_back( new LCCol2Branch<IMPL::MCParticleImpl>( "MCParticlesSkimmed" , _tree ) )  ;
-//   _branches.push_back( new LCCol2Branch<IMPL::ClusterImpl>( "PandoraClusters" , _tree ) )  ;
-//   _branches.push_back( new LCCol2Branch<IMPL::LCRelationImpl>( "RecoMCTruthLink" , _tree ) )  ;
-//   _branches.push_back( new LCCol2Branch<IMPL::VertexImpl>( "V0Vertices" , _tree ) )  ;
-//   _branches.push_back( new LCCol2Branch<IMPL::VertexImpl>( "ZVRESVertices_2Jets" , _tree ) )  ;
-//   _branches.push_back( new LCCol2Branch<IMPL::VertexImpl>( "ZVRESVertices_3Jets" , _tree ) )  ;
-//   _branches.push_back( new LCCol2Branch<IMPL::VertexImpl>( "ZVRESVertices_4Jets" , _tree ) )  ;
-//   _branches.push_back( new LCCol2Branch<IMPL::VertexImpl>( "ZVRESVertices_5Jets" , _tree ) )  ;
-//   _branches.push_back( new LCCol2Branch<IMPL::VertexImpl>( "ZVRESVertices_6Jets" , _tree ) )  ;
+//   _branches.push_back( new LCCol2Branch<EVENT::ReconstructedParticle>( "PandoraPFOs" , _tree ) )  ;
+//   _branches.push_back( new LCCol2Branch<EVENT::ReconstructedParticle>( "Durham_2Jets" , _tree ) )  ;
+//   _branches.push_back( new LCCol2Branch<EVENT::ReconstructedParticle>( "Durham_3Jets" , _tree ) )  ;
+//   _branches.push_back( new LCCol2Branch<EVENT::ReconstructedParticle>( "Durham_4Jets" , _tree ) )  ;
+//   _branches.push_back( new LCCol2Branch<EVENT::ReconstructedParticle>( "Durham_5Jets" , _tree ) )  ;
+//   _branches.push_back( new LCCol2Branch<EVENT::ReconstructedParticle>( "Durham_6Jets" , _tree ) )  ;
+//   _branches.push_back( new LCCol2Branch<EVENT::Vertex>( "IPVertex" , _tree ) )  ;
+//   _branches.push_back( new LCCol2Branch<EVENT::Track>( "LDCTracks" , _tree ) )  ;
+//   _branches.push_back( new LCCol2Branch<EVENT::MCParticle>( "MCParticlesSkimmed" , _tree ) )  ;
+//   _branches.push_back( new LCCol2Branch<EVENT::Cluster>( "PandoraClusters" , _tree ) )  ;
+//   _branches.push_back( new LCCol2Branch<EVENT::LCRelation>( "RecoMCTruthLink" , _tree ) )  ;
+//   _branches.push_back( new LCCol2Branch<EVENT::Vertex>( "V0Vertices" , _tree ) )  ;
+//   _branches.push_back( new LCCol2Branch<EVENT::Vertex>( "ZVRESVertices_2Jets" , _tree ) )  ;
+//   _branches.push_back( new LCCol2Branch<EVENT::Vertex>( "ZVRESVertices_3Jets" , _tree ) )  ;
+//   _branches.push_back( new LCCol2Branch<EVENT::Vertex>( "ZVRESVertices_4Jets" , _tree ) )  ;
+//   _branches.push_back( new LCCol2Branch<EVENT::Vertex>( "ZVRESVertices_5Jets" , _tree ) )  ;
+//   _branches.push_back( new LCCol2Branch<EVENT::Vertex>( "ZVRESVertices_6Jets" , _tree ) )  ;
+
+  _branches.push_back( new LCCol2Branch<IMPL::ReconstructedParticleImpl>( "PandoraPFOs" , _tree ) )  ;
+  _branches.push_back( new LCCol2Branch<IMPL::ReconstructedParticleImpl>( "Durham_2Jets" , _tree ) )  ;
+  _branches.push_back( new LCCol2Branch<IMPL::ReconstructedParticleImpl>( "Durham_3Jets" , _tree ) )  ;
+  _branches.push_back( new LCCol2Branch<IMPL::ReconstructedParticleImpl>( "Durham_4Jets" , _tree ) )  ;
+  _branches.push_back( new LCCol2Branch<IMPL::ReconstructedParticleImpl>( "Durham_5Jets" , _tree ) )  ;
+  _branches.push_back( new LCCol2Branch<IMPL::ReconstructedParticleImpl>( "Durham_6Jets" , _tree ) )  ;
+  _branches.push_back( new LCCol2Branch<IMPL::VertexImpl>( "IPVertex" , _tree ) )  ;
+  _branches.push_back( new LCCol2Branch<IMPL::TrackImpl>( "LDCTracks" , _tree ) )  ;
+  _branches.push_back( new LCCol2Branch<IMPL::MCParticleImpl>( "MCParticlesSkimmed" , _tree ) )  ;
+  _branches.push_back( new LCCol2Branch<IMPL::ClusterImpl>( "PandoraClusters" , _tree ) )  ;
+  _branches.push_back( new LCCol2Branch<IMPL::LCRelationImpl>( "RecoMCTruthLink" , _tree ) )  ;
+  _branches.push_back( new LCCol2Branch<IMPL::VertexImpl>( "V0Vertices" , _tree ) )  ;
+  _branches.push_back( new LCCol2Branch<IMPL::VertexImpl>( "ZVRESVertices_2Jets" , _tree ) )  ;
+  _branches.push_back( new LCCol2Branch<IMPL::VertexImpl>( "ZVRESVertices_3Jets" , _tree ) )  ;
+  _branches.push_back( new LCCol2Branch<IMPL::VertexImpl>( "ZVRESVertices_4Jets" , _tree ) )  ;
+  _branches.push_back( new LCCol2Branch<IMPL::VertexImpl>( "ZVRESVertices_5Jets" , _tree ) )  ;
+  _branches.push_back( new LCCol2Branch<IMPL::VertexImpl>( "ZVRESVertices_6Jets" , _tree ) )  ;
   
 
   //---------------------------------------------------------------------------------------------

lcio/src/cpp/src/IMPL
LCCollectionVec.cc 1.12 -> 1.12.20.1
diff -u -r1.12 -r1.12.20.1
--- LCCollectionVec.cc	15 Apr 2005 08:37:46 -0000	1.12
+++ LCCollectionVec.cc	20 Nov 2009 15:28:51 -0000	1.12.20.1
@@ -1,6 +1,8 @@
 
 #include "IMPL/LCCollectionVec.h"
 #include "EVENT/LCIO.h"
+#include "LCIOTypes.h"
+
 #include <iostream>
 
 // #include "UTIL/LCTOOLS.h"
@@ -51,6 +53,27 @@
     }
   }
 
+  void LCCollectionVec::setIndices( unsigned hash ) {
+
+    for( unsigned i=0 ; i< this->size() ; ++i ){
+
+      EVENT::long64 idx(i) ;
+      EVENT::long64 hashL( hash ) ;
+
+//       EVENT::long64 index(  idx | hashL<<32 ) ;
+//       std::cout << "   LcCol setIndices : " << idx << " , " << hashL << ", " <<  index  << std::endl ;
+      this->operator[](i)->setIndex(  idx | hashL<<32 ) ;
+    }
+  }
+ 
+ void LCCollectionVec::ptrToIndex() {
+
+    for( unsigned i=0 ; i< this->size() ; ++i ){
+
+      this->operator[](i)->ptrToIndex() ;
+    }
+  }
+
 LCCollectionVec::~LCCollectionVec() {
 
   if( ! isSubset() ){

lcio/src/cpp/src/IMPL
LCEventImpl.cc 1.24.8.1 -> 1.24.8.2
diff -u -r1.24.8.1 -r1.24.8.2
--- LCEventImpl.cc	15 Sep 2009 15:45:00 -0000	1.24.8.1
+++ LCEventImpl.cc	20 Nov 2009 15:28:51 -0000	1.24.8.2
@@ -14,31 +14,25 @@
 
 namespace IMPL {
   
+LCEventImpl* LCEventImpl::_current = 0 ;
+
 LCEventImpl::LCEventImpl() :
   _runNumber(0),
   _eventNumber(0),
   _timeStamp(0),
   _detectorName("unknown") {
 }
+
+LCEventImpl::LCEventImpl(const LCEventImpl& evt) :
+  _runNumber( evt._runNumber ),
+  _eventNumber( evt._eventNumber ),
+  _timeStamp( evt._timeStamp ),
+  _detectorName(evt._detectorName),
+  _params( evt._params ) {
   
-// LCEventImpl::LCEventImpl(const LCEvent& evt) : 
-//   _runNumber( evt.getRunNumber() ),
-//   _eventNumber( evt.getEventNumber() ),
-//   _timeStamp( evt.getTimeStamp() ),
-//   _detectorName( evt.getDetectorName().c_str() ),
-  
-//   std::vector<std::string>* strVec = evt.getCollectionNames() ;
-//   int nCol = strVec->size() ;
+  //  mutable LCCollectionSet _notOwned ;   // what should we do here ??
   
-//   for( std::vector<std::string>::iterator name = strVec->begin() ; name != strVec->end() ; name++){
-    
-//     const LCCollection* col = evt.getCollection( *name ) ;
-//     col->getTypeName() ;
-    
-//     // to be done - need to create new LCCollectionVec and add to the event ...
-//   }
-
-// }
+}
 
 LCEventImpl::~LCEventImpl() {
   //  std::cout << " ~LCEventImpl() : " << this << std::endl ;
@@ -54,7 +48,50 @@
   }
 
 }
+
+  void LCEventImpl::ptrToIndex() {
     
+    std::vector< LCCollectionVec* > _cols ;
+    _cols.reserve( _colMap.size() ) ;
+
+    typedef LCCollectionMap::const_iterator LCI ;
+
+    for ( LCI i=_colMap.begin() ; i != _colMap.end() ; i++ ){
+
+      LCCollectionVec* col = dynamic_cast<LCCollectionVec*> ( i->second ) ;
+      
+      if( col ) { 
+
+	col->setIndices(  i->first   )  ;
+	_cols.push_back( col ) ;
+      } 
+    }
+    unsigned nCol = _cols.size() ;
+
+    for (unsigned i=0; i<nCol ; i++ ){
+      
+      _cols[i]->ptrToIndex()  ;
+    }
+
+  }
+ 
+  EVENT::LCObject*  LCEventImpl::getObjectForIndex(EVENT::long64 index) {
+
+    // TO DO: cash last collection and hash in order to safe map lookups !!
+    // TO DO: read collection on demand from LCReader ....
+    unsigned hash = ( index >> 32 &  0xffffffff ) ;
+    unsigned i = index & 0xffffffff ;
+
+    LCCollectionMap::iterator it = _colMap.find( hash  )  ;
+
+    if( it != _colMap.end() ) {
+      
+      return it->second->getElementAt( i ) ;
+    }
+    return 0 ;
+  }
+
+
 int LCEventImpl::getRunNumber() const {
   return _runNumber ;
 }
@@ -88,17 +125,14 @@
 }
 const std::vector<std::string>* LCEventImpl::getCollectionNames(bool refresh) const {
 
-  if( refresh ) {
-
-    // return pointer to updated vector _colNames 
-    typedef LCCollectionMap::const_iterator LCI ;
-    
-    _colNames.clear() ;
-    
-    for ( LCI i=_colMap.begin() ; i != _colMap.end() ; i++ ){
-      _colNames.push_back( i->first  ) ; 
-    }
-  }
+//   if( refresh ) {
+//     // return pointer to updated vector _colNames 
+//     typedef LCCollectionMap::const_iterator LCI ;
+//     _colNames.clear() ;
+//     for ( LCI i=_colMap.begin() ; i != _colMap.end() ; i++ ){
+//       _colNames.push_back( i->first  ) ; 
+//     }
+//   }
 
   return &_colNames ;
 }
@@ -108,7 +142,7 @@
 LCCollection * LCEventImpl::getCollection(const std::string & name) const 
   throw (DataNotAvailableException, std::exception) {
 
-  LCCollectionMap::iterator it = _colMap.find( name )  ;
+  LCCollectionMap::iterator it = _colMap.find( Hash( name )  )  ;
 
   if( it == _colMap.end() ) {
     
@@ -152,10 +186,11 @@
   }
       
   // check if name exists
-  if( _colMap.find( name ) != _colMap.end() ) {
+  EVENT::long64 nameH = Hash( name ) ;
+  if( _colMap.find( nameH ) != _colMap.end() ) {
     
     
-    LCCollection* old =  _colMap.find( name )->second ;
+    LCCollection* old =  _colMap.find( nameH )->second ;
     
     std::string type = old->getTypeName()  ;
     throw EventException( std::string("LCEventImpl::addCollection() name already exists: "
@@ -167,8 +202,9 @@
     throw EventException( std::string("LCEventImpl::addCollection()  cannot add NULL collection for : "
 				      +name) ) ; 
 
-  _colMap[ name ]  = col ;
- 
+  _colMap[ Hash( name  ) ]  = col ;
+  
+  _colNames.push_back( name ) ;
 }
 
     
@@ -177,8 +213,10 @@
 
   // remove collection only, if access mode == update
   checkAccess("LCEventImpl::removeCollection") ;
-  _colMap.erase( name ) ;  
+  _colMap.erase( Hash( name )  ) ;  
 
+  std::vector<std::string>::iterator it = std::find( _colNames.begin() , _colNames.end() , name ) ;
+  _colNames.erase( it) ;
 }
 
     

lcio/src/cpp/src/IMPL
LCIO.cc 1.22 -> 1.22.12.1
diff -u -r1.22 -r1.22.12.1
--- LCIO.cc	21 Sep 2006 06:10:42 -0000	1.22
+++ LCIO.cc	20 Nov 2009 15:28:51 -0000	1.22.12.1
@@ -29,4 +29,68 @@
 const char* LCIO::VERTEX = "Vertex" ; 
 
 const char* LCIO::CellIDEncoding = "CellIDEncoding" ; 
+
+  // Hash function for faster lookup in string maps.
+  //  Code copied from ROOT TMath::Hash (http://root.cern.ch).
+  unsigned Hash(const void *txt, int ntxt) {
+    // Calculates hash index from any char string.
+    // Based on precalculated table of 256 specially selected random numbers.
+    //
+    //   For string:  i = TMath::Hash(string,nstring);
+    //   For int:     i = TMath::Hash(&intword,sizeof(int));
+    //   For pointer: i = TMath::Hash(&pointer,sizeof(void*));
+    //
+    //   Limitation: for ntxt>256 calculates hash only from first 256 bytes
+    //
+    //              V.Perev
+    
+    
+    const char *uc = (const char*) txt;
+    unsigned  u = 0, uu = 0;
+    
+    static unsigned utab[256] =
+      {0xb93f6fc0,0x553dfc51,0xb22c1e8c,0x638462c0,0x13e81418,0x2836e171,0x7c4abb90,0xda1a4f39
+       ,0x38f211d1,0x8c804829,0x95a6602d,0x4c590993,0x1810580a,0x721057d4,0x0f587215,0x9f49ce2a
+       ,0xcd5ab255,0xab923a99,0x80890f39,0xbcfa2290,0x16587b52,0x6b6d3f0d,0xea8ff307,0x51542d5c
+       ,0x189bf223,0x39643037,0x0e4a326a,0x214eca01,0x47645a9b,0x0f364260,0x8e9b2da4,0x5563ebd9
+       ,0x57a31c1c,0xab365854,0xdd63ab1f,0x0b89acbd,0x23d57d33,0x1800a0fd,0x225ac60a,0xd0e51943
+       ,0x6c65f669,0xcb966ea0,0xcbafda95,0x2e5c0c5f,0x2988e87e,0xc781cbab,0x3add3dc7,0x693a2c30
+       ,0x42d6c23c,0xebf85f26,0x2544987e,0x2e315e3f,0xac88b5b5,0x7ebd2bbb,0xda07c87b,0x20d460f1
+       ,0xc61c3f40,0x182046e7,0x3b6c3b66,0x2fc10d4a,0x0780dfbb,0xc437280c,0x0988dd07,0xe1498606
+       ,0x8e61d728,0x4f1f3909,0x040a9682,0x49411b29,0x391b0e1c,0xd7905241,0xdd77d95b,0x88426c13
+       ,0x33033e58,0xe158e30e,0x7e342647,0x1e09544b,0x4637353d,0x18ea0924,0x39212b08,0x12580ae8
+       ,0x269a6f06,0x3e10b73b,0x123db33b,0x085412da,0x3bb5f464,0xd9b2d442,0x103d26bb,0xd0038bab
+       ,0x45b6177f,0xfb48f1fe,0x99074c55,0xb545e82e,0x5f79fd0d,0x570f3ae4,0x57e43255,0x037a12ae
+       ,0x4357bdb2,0x337c2c4d,0x2982499d,0x2ab72793,0x3900e7d1,0x57a6bb81,0x7503609b,0x3f39c0d0
+       ,0x717b389d,0x5748034f,0x4698162b,0x5801b97c,0x1dfd5d7e,0xc1386d1c,0xa387a72a,0x084547e4
+       ,0x2e54d8e9,0x2e2f384c,0xe09ccc20,0x8904b71e,0x3e24edc5,0x06a22e16,0x8a2be1df,0x9e5058b2
+       ,0xe01a2f16,0x03325eed,0x587ecfe6,0x584d9cd3,0x32926930,0xe943d68c,0xa9442da8,0xf9650560
+       ,0xf003871e,0x1109c663,0x7a2f2f89,0x1c2210bb,0x37335787,0xb92b382f,0xea605cb5,0x336bbe38
+       ,0x08126bd3,0x1f8c2bd6,0xba6c46f2,0x1a4d1b83,0xc988180d,0xe2582505,0xa8a1b375,0x59a08c49
+       ,0x3db54b48,0x44400f35,0x272d4e7f,0x5579f733,0x98eb590e,0x8ee09813,0x12cc9301,0xc85c402d
+       ,0x135c1039,0x22318128,0x4063c705,0x87a8a3fa,0xfc14431f,0x6e27bf47,0x2d080a19,0x01dba174
+       ,0xe343530b,0xaa1bfced,0x283bb2c8,0x5df250c8,0x4ff9140b,0x045039c1,0xa377780d,0x750f2661
+       ,0x2b108918,0x0b152120,0x3cbc251f,0x5e87b350,0x060625bb,0xe068ba3b,0xdb73ebd7,0x66014ff3
+       ,0xdb003000,0x161a3a0b,0xdc24e142,0x97ea5575,0x635a3cab,0xa719100a,0x256084db,0xc1f4a1e7
+       ,0xe13388f2,0xb8199fc9,0x50c70dc9,0x08154211,0xd60e5220,0xe52c6592,0x584c5fe1,0xfe5e0875
+       ,0x21072b30,0x3370d773,0x92608fe2,0x2d013d93,0x53414b3c,0x2c066142,0x64676644,0x0420887c
+       ,0x35c01187,0x6822119b,0xf9bfe6df,0x273f4ee4,0x87973149,0x7b41282d,0x635d0d1f,0x5f7ecc1e
+       ,0x14c3608a,0x462dfdab,0xc33d8808,0x1dcd995e,0x0fcb11ba,0x11755914,0x5a62044b,0x37f76755
+       ,0x345bd058,0x8831c2b5,0x204a8468,0x3b0b1cd2,0x444e56f4,0x97a93e2c,0xd5f15067,0x266a95fa
+       ,0xff4f8036,0x6160060d,0x930c472f,0xed922184,0x37120251,0xc0add74f,0x1c0bc89d,0x018d47f2
+       ,0xff59ef66,0xd1901a17,0x91f6701b,0x0960082f,0x86f6a8f3,0x1154fecd,0x9867d1de,0x0945482f
+       ,0x790ffcac,0xe5610011,0x4765637e,0xa745dbff,0x841fdcb3,0x4f7372a0,0x3c05013d,0xf1ac4ab7
+       ,0x3bc5b5cc,0x49a73349,0x356a7f67,0x1174f031,0x11d32634,0x4413d301,0x1dd285c4,0x3fae4800
+      };
+    
+    if (ntxt > 255) ntxt = 255;
+    
+    for ( ; ntxt--; uc++) {
+      uu = uu<<1 ^ utab[(*uc) ^ ntxt];
+      u ^= uu;
+    }
+    return u;
+  }
+  
+  
 }

lcio/src/cpp/src/IMPL
LCParametersImpl.cc 1.6 -> 1.6.20.1
diff -u -r1.6 -r1.6.20.1
--- LCParametersImpl.cc	15 Apr 2005 08:37:46 -0000	1.6
+++ LCParametersImpl.cc	20 Nov 2009 15:28:51 -0000	1.6.20.1
@@ -10,6 +10,19 @@
   LCParametersImpl::LCParametersImpl(){
     
   }
+   
+  LCParametersImpl::LCParametersImpl(const LCParametersImpl& other) :
+    _intMap( other._intMap ),
+    _floatMap( other._floatMap ) ,
+    _stringMap( other._stringMap ) {
+  }
+  
+  LCParametersImpl& LCParametersImpl::operator=(const LCParametersImpl& other){
+    _intMap    = other._intMap ;
+    _floatMap  = other._floatMap ;
+    _stringMap = other._stringMap ;
+    return *this ;
+  }
 
   int LCParametersImpl::getIntVal(const std::string & key) const {
     

lcio/src/cpp/src/IMPL
MCParticleImpl.cc 1.29.6.1 -> 1.29.6.2
diff -u -r1.29.6.1 -r1.29.6.2
--- MCParticleImpl.cc	15 Sep 2009 15:45:00 -0000	1.29.6.1
+++ MCParticleImpl.cc	20 Nov 2009 15:28:51 -0000	1.29.6.2
@@ -18,9 +18,10 @@
     _simstatus(0),
     _mass(0),
     _charge(0),
-    _time(0),
-    _parents(0),
-    _daughters(0)
+    _time(0)
+// ,
+//     _parents(0),
+//     _daughters(0)
   {
     _vertex[0] = 0.0 ;
     _vertex[1] = 0.0 ;
@@ -76,6 +77,8 @@
 
 
   const MCParticleVec & MCParticleImpl::getParents() const {
+    //    std::cout << "  --- MCParticleImpl::getParents() : size " << _parents.size() << std::endl ;
+
     return _parents ;
   }
   

lcio/src/cpp/src/IMPL
ReconstructedParticleImpl.cc 1.11 -> 1.11.6.1
diff -u -r1.11 -r1.11.6.1
--- ReconstructedParticleImpl.cc	30 May 2008 14:04:51 -0000	1.11
+++ ReconstructedParticleImpl.cc	20 Nov 2009 15:28:51 -0000	1.11.6.1
@@ -53,7 +53,8 @@
   }
   const EVENT::ParticleIDVec & ReconstructedParticleImpl::getParticleIDs() const { return  _pid ; }
 
-  const EVENT::ReconstructedParticleVec& ReconstructedParticleImpl::getParticles() const { return _particles ; } 
+  const std::vector<EVENT::ReconstructedParticle*>& ReconstructedParticleImpl::getParticles() const { return _particles ; } 
+  //  const EVENT::ReconstructedParticleVec& ReconstructedParticleImpl::getParticles() const { return _particles ; } 
 //   const EVENT::FloatVec & ReconstructedParticleImpl::getParticleWeights() const { return  _particleWeights ; }
 
   const EVENT::ClusterVec& ReconstructedParticleImpl::getClusters() const { return _clusters  ; } 

lcio/src/cpp/src/RIO
RIOReader.cc 1.1.2.5 -> 1.1.2.6
diff -u -r1.1.2.5 -r1.1.2.6
--- RIOReader.cc	18 Sep 2009 09:33:40 -0000	1.1.2.5
+++ RIOReader.cc	20 Nov 2009 15:28:51 -0000	1.1.2.6
@@ -60,8 +60,8 @@
   RIOReader::~RIOReader(){
     
 
-//     delete _evtP ;
-//     delete _runP ;    
+    //     delete _evtP ;
+    //     delete _runP ;    
   }
 
 
@@ -75,15 +75,15 @@
     // JE: first we check if all files exist
     for(i=0; i < filenames.size(); i++){
         
-        if ( stat( filenames[i].c_str(), &fileinfo ) != 0 ){
-            missing_files += filenames[i] ;
-            missing_files += "  " ;
-        }
+      if ( stat( filenames[i].c_str(), &fileinfo ) != 0 ){
+	missing_files += filenames[i] ;
+	missing_files += "  " ;
+      }
     }
 
     // JE: if not raise IOException
     if( missing_files.size() != 0 ){
-        throw IOException( std::string( "[RIOReader::open()] File(s) not found:  " + missing_files )) ;
+      throw IOException( std::string( "[RIOReader::open()] File(s) not found:  " + missing_files )) ;
     }
     
     _myFilenames = &filenames ;
@@ -134,60 +134,60 @@
   void RIOReader::getEventMap() {
 
 
-// //     int status = _stream->seek(0) ; // go to start - FIXME - should we store the current position ?
+    // //     int status = _stream->seek(0) ; // go to start - FIXME - should we store the current position ?
 
-// //     if( status != RIO_STREAM_SUCCESS ) 
-// //       throw IOException( std::string( "[RIOReader::getEventMap()] Can't seek stream to 0" ) ) ;
+    // //     if( status != RIO_STREAM_SUCCESS ) 
+    // //       throw IOException( std::string( "[RIOReader::getEventMap()] Can't seek stream to 0" ) ) ;
     
-// // //    std::cout << " RIOReader::getEventMap() recreating event map for direct access ..." 
-// // //	      << std::endl ;
+    // // //    std::cout << " RIOReader::getEventMap() recreating event map for direct access ..." 
+    // // //	      << std::endl ;
     
-// //     { // -- scope for unpacking evt header --------
-// //       RIOUnpack hdrUnp( RIOUnpack::EVENTHDR ) ;
+    // //     { // -- scope for unpacking evt header --------
+    // //       RIOUnpack hdrUnp( RIOUnpack::EVENTHDR ) ;
       
-// //       while( true ){
+    // //       while( true ){
 	
-// // 	RIO_blockManager::remove(  LCRIO::HEADERBLOCKNAME ) ;
-// // 	RIO_blockManager::add( _evtHandler ) ;
+    // // 	RIO_blockManager::remove(  LCRIO::HEADERBLOCKNAME ) ;
+    // // 	RIO_blockManager::add( _evtHandler ) ;
 
-// // 	//----	  readRecord() ;
-// // 	// read the next record from the stream
-// // 	if( _stream->getState()== RIO_STATE_OPEN ){
+    // // 	//----	  readRecord() ;
+    // // 	// read the next record from the stream
+    // // 	if( _stream->getState()== RIO_STATE_OPEN ){
       
-// // 	  unsigned int status =  _stream->read( &_dummyRecord ) ;
+    // // 	  unsigned int status =  _stream->read( &_dummyRecord ) ;
 	  
-// // 	  if( ! (status & 1)  ){
+    // // 	  if( ! (status & 1)  ){
 
-// // 	    if( status & RIO_STREAM_EOF ){
-// // 	      break ;
-// // 	    }
+    // // 	    if( status & RIO_STREAM_EOF ){
+    // // 	      break ;
+    // // 	    }
 	    
-// // 	    throw IOException( std::string(" io error on stream: ") + *_stream->getName() ) ;
-// // 	  }
-// // 	} else {
-// // 	  throw IOException( std::string(" stream not open: ")+ *_stream->getName() ) ;
-// // 	}
+    // // 	    throw IOException( std::string(" io error on stream: ") + *_stream->getName() ) ;
+    // // 	  }
+    // // 	} else {
+    // // 	  throw IOException( std::string(" stream not open: ")+ *_stream->getName() ) ;
+    // // 	}
 	
-// // 	//--
-// // 	int runNum = (*_evtP)->getRunNumber() ;
-// // 	int evtNum = (*_evtP)->getEventNumber() ;
+    // // 	//--
+    // // 	int runNum = (*_evtP)->getRunNumber() ;
+    // // 	int evtNum = (*_evtP)->getEventNumber() ;
 	
-// //         _evtMap[  EVENTKEY( runNum , evtNum ) ] = _stream->lastRecordStart() ;
+    // //         _evtMap[  EVENTKEY( runNum , evtNum ) ] = _stream->lastRecordStart() ;
 	
-// // // 	EVENT::long64 key  = (EVENT::long64( runNum ) << 32 ) | evtNum ;
-// // // 	std::cout << "  " <<  key << " - " << _stream->lastRecordStart()  
-// // // 		  << " evt: " << evtNum << std::endl ;
+    // // // 	EVENT::long64 key  = (EVENT::long64( runNum ) << 32 ) | evtNum ;
+    // // // 	std::cout << "  " <<  key << " - " << _stream->lastRecordStart()  
+    // // // 		  << " evt: " << evtNum << std::endl ;
 	
-// //       } // while
+    // //       } // while
 
-// //       _stream->seek(0) ; // go to start - FIXME - should we store the current 
+    // //       _stream->seek(0) ; // go to start - FIXME - should we store the current 
 
-// //       if( status != RIO_STREAM_SUCCESS ) 
-// // 	throw IOException( std::string( "[RIOReader::getEventMap()] Can't seek stream to 0" ) ) ;
+    // //       if( status != RIO_STREAM_SUCCESS ) 
+    // // 	throw IOException( std::string( "[RIOReader::getEventMap()] Can't seek stream to 0" ) ) ;
 
-// //     }// -- end of scope for unpacking evt header --
+    // //     }// -- end of scope for unpacking evt header --
 
-// // //    std::cout << " RIOReader::getEventMap() : done " << std::endl ;
+    // // //    std::cout << " RIOReader::getEventMap() : done " << std::endl ;
 
   }
   
@@ -201,21 +201,21 @@
 
     // ToDo ...
 
-// //   // set the _runRecord to unpack for this scope
-// //     //    RIORecordUnpack runUnp( RIOWriter::_runRecord ) ;
-// //     RIOUnpack runUnp( RIOUnpack::RUN ) ;
+    // //   // set the _runRecord to unpack for this scope
+    // //     //    RIORecordUnpack runUnp( RIOWriter::_runRecord ) ;
+    // //     RIOUnpack runUnp( RIOUnpack::RUN ) ;
 
 
-// //     // this might throw the exceptions
-// //     try{ 
-// //       readRecord() ;
-// //     }
-// //     catch(EndOfDataException){
-// //       return 0 ;
-// //     }
+    // //     // this might throw the exceptions
+    // //     try{ 
+    // //       readRecord() ;
+    // //     }
+    // //     catch(EndOfDataException){
+    // //       return 0 ;
+    // //     }
     
-// //     // set the proper acces mode before returning the event
-// //     (*_runP)->setReadOnly(  accessMode == LCIO::READ_ONLY   ) ;
+    // //     // set the proper acces mode before returning the event
+    // //     (*_runP)->setReadOnly(  accessMode == LCIO::READ_ONLY   ) ;
 
     return _runImpl ;
   }
@@ -233,30 +233,31 @@
 
       for(  StrVec::const_iterator name = strVec->begin() ; name != strVec->end() ; name++){
 	
-// 	LCCollection* col = evt->getCollection( *name ) ;
-// 	const LCParameters&  params =  col->getParameters()  ;
-// 	std::string typeName = col->getTypeName() ;
+	// 	LCCollection* col = evt->getCollection( *name ) ;
+	// 	const LCParameters&  params =  col->getParameters()  ;
+	// 	std::string typeName = col->getTypeName() ;
 
 	std::string typeName("YetUnknown") ;
 
 	std::cout << " registering collection " << *name << " of " <<  typeName <<  std::endl ;
 
-// 	//FIXME: these should be held by  a singleton handler manager (registry) 
-// 	if( typeName == LCIO::MCPARTICLE ){
-// 	  _branches.push_back(  new RIO::RIOLCCollectionHandler<EVENT::MCParticle>(name->c_str() ,_tree) ) ;	  
-// 	}      
-// 	if( typeName == LCIO::SIMCALORIMETERHIT ){
-// 	  _branches.push_back(  new RIO::RIOLCCollectionHandler<EVENT::SimCalorimeterHit>(name->c_str() ,_tree) ) ;
-// 	}      
-// 	if( typeName == LCIO::SIMTRACKERHIT ){
-// 	  _branches.push_back(  new RIO::RIOLCCollectionHandler<EVENT::SimTrackerHit>(name->c_str() ,_tree) ) ;	  
-// 	}      
-// 	// ToDo:  add all other LCIO types ....
+	// 	//FIXME: these should be held by  a singleton handler manager (registry) 
+	// 	if( typeName == LCIO::MCPARTICLE ){
+	// 	  _branches.push_back(  new RIO::RIOLCCollectionHandler<EVENT::MCParticle>(name->c_str() ,_tree) ) ;	  
+	// 	}      
+	// 	if( typeName == LCIO::SIMCALORIMETERHIT ){
+	// 	  _branches.push_back(  new RIO::RIOLCCollectionHandler<EVENT::SimCalorimeterHit>(name->c_str() ,_tree) ) ;
+	// 	}      
+	// 	if( typeName == LCIO::SIMTRACKERHIT ){
+	// 	  _branches.push_back(  new RIO::RIOLCCollectionHandler<EVENT::SimTrackerHit>(name->c_str() ,_tree) ) ;	  
+	// 	}      
+	// 	// ToDo:  add all other LCIO types ....
 
 	
-// 	if( *name == "MCParticlesSkimmed" )
+	// 	if( *name == "MCParticlesSkimmed" )
+	//	if( *name == "PandoraPFOs" )
 
-	  _branches.push_back(  new RIO::RIOLCCollectionHandler( *name, typeName   , _tree) ) ;	
+	_branches[ *name ] =  new RIO::RIOLCCollectionHandler( *name, typeName   , _tree)  ;	
 
       }
 
@@ -272,64 +273,83 @@
 
   LCEvent* RIOReader::readNextEvent(int accessMode) throw (IOException, std::exception ) {
 
-//     if( _evtImpl != 0 )   // memory handling in ROOT I/O ? 
-//       delete _evtImpl ;
-    
-
+    //     if( _evtImpl != 0 )   // memory handling in ROOT I/O ? 
+    //       delete _evtImpl ;
     //------------------------------------------------------  
     
       
-      _entry ++ ;
+    _entry ++ ;
 
-      // read event header first
+    // read event header first
       
-      TBranch* br = (TBranch*) _tree->GetBranch( "LCEvent" ) ;
+    TBranch* br = (TBranch*) _tree->GetBranch( "LCEvent" ) ;
       
-      if( br == 0 ){        
+    if( br == 0 ){        
 	
-	throw IOException( std::string( "[RIOReader::readNextEvent()] cant open branch \"LCEvent\" " ) ) ;
-      } 
+      throw IOException( std::string( "[RIOReader::readNextEvent()] cant open branch \"LCEvent\" " ) ) ;
+    } 
       
-      br->SetAddress( &_evtImpl ) ;
+    br->SetAddress( &_evtImpl ) ;
 
-      Long64_t tentry =  _tree->LoadTree( _entry );
+    Long64_t tentry =  _tree->LoadTree( _entry );
 
-      int nbyte = br->GetEntry(tentry);
+    int nbyte = br->GetEntry(tentry);
 
-      if( tentry < 0 ){
+    if( tentry < 0 ){
 
-	return 0 ; // EOF ?
-      }
+      return 0 ; // EOF ?
+    }
 
-#ifdef DEBUG
-      typedef std::vector< std::string > StrVec ; 
+    if( !_haveBranches ) {
+      setUpHandlers( _evtImpl ) ;
+    }    
 
-      const StrVec& strVec = *( _evtImpl->getCollectionNames(false) ) ;
+       
+    _evtImpl->setCurrentEvent( _evtImpl ) ;
 
-      std::cout << " tentry : " << tentry 
-		<< " _entry " << _entry  
-		<< "  eventnum " << _evtImpl->getEventNumber()  
-		<< " ncols: " << strVec.size() 
-		<< " nbyte: " << nbyte
-		<< " _evtImpl " << _evtImpl  
-		<< std::endl ;
+    for( BranchHandlerMap::iterator it=_branches.begin() ; it!=_branches.end() ; ++it){
+      (it->second)->fromBranch( _evtImpl , tentry ) ;
+    }
+       
+       
 
-      for(  StrVec::const_iterator name = strVec.begin() ; name != strVec.end() ; name++){
-	std::cout << " collection: " << *name << std::endl ;
-      }
-#endif      
+    typedef std::vector< std::string > StrVec ; 
+
+    const StrVec& strVec = *( _evtImpl->getCollectionNames() ) ; 
+    //       for(  StrVec::const_iterator name = strVec.begin() ; name != strVec.end() ; name++){
+
+    // 	RIOBranchHandler* bHan = _branches[ *name ] ;
+	
+    // 	if( bHan ) {
+	  
+    // 	  //_evtImpl->removeCollection( *name ) ;
+
+    // 	  bHan->fromBranch( _evtImpl, tentry ) ;
 
-      if( !_haveBranches ) {
+    // 	} else {
+	
+    // 	  std::cout << "WARNING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl 
+    // 		    << "      no handler for collection " <<  *name << " found - collection is not read   !!!  " << std::endl 
+    // 		    << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl ;
 
-	setUpHandlers( _evtImpl ) ;
-      }    
 
-      for( BranchVector::iterator it=_branches.begin() ; it!=_branches.end() ; ++it){
+    // 	}
 	
-	(*it)->fromBranch( _evtImpl , tentry ) ;
-      }
-      
-    
+
+    // 	std::cout << " collection: " << *name << std::endl ;
+    //       }
+
+
+#ifdef DEBUG
+    std::cout << " >>>>>>>>> tentry : " << tentry 
+	      << " _entry " << _entry  
+	      << "  eventnum " << _evtImpl->getEventNumber()  
+	      << " ncols: " << strVec.size() 
+	      << " nbyte: " << nbyte
+	      << " _evtImpl " << _evtImpl  
+	      << std::endl ;
+#endif      
+
     //------------------------------------------------------
 
     return _evtImpl ;      
@@ -339,33 +359,33 @@
     
     _entry += n ;
 
-//     int eventsSkipped = 0 ;
+    //     int eventsSkipped = 0 ;
     
-//     RIOUnpack hdrUnp( RIOUnpack::EVENTHDR ) ;
+    //     RIOUnpack hdrUnp( RIOUnpack::EVENTHDR ) ;
     
-//     while( eventsSkipped++ < n ){
+    //     while( eventsSkipped++ < n ){
       
-//       try { 
+    //       try { 
 	
-// 	readRecord() ;
+    // 	readRecord() ;
 
-//       }
-//       catch(EndOfDataException){
+    //       }
+    //       catch(EndOfDataException){
 
-// 	return ;
-//       }
-//     }
-
-//     // now we need to also read the next  record which suposedly is an event record
-//     // in order to prevent readStream from reading this event (the last to be skipped)
-//     RIOUnpack evtUnp( RIOUnpack::EVENT ) ;
-    
-//     try{ 
-//       readRecord() ;
-//     }
-//     catch(EndOfDataException){
-//       return ;
-//     }
+    // 	return ;
+    //       }
+    //     }
+
+    //     // now we need to also read the next  record which suposedly is an event record
+    //     // in order to prevent readStream from reading this event (the last to be skipped)
+    //     RIOUnpack evtUnp( RIOUnpack::EVENT ) ;
+    
+    //     try{ 
+    //       readRecord() ;
+    //     }
+    //     catch(EndOfDataException){
+    //       return ;
+    //     }
     
   }
 
@@ -418,7 +438,7 @@
 
   void RIOReader::removeLCRunListener(LCRunListener * ls){
     _runListeners.erase( _runListeners.find( ls ) );
- }
+  }
 
   void RIOReader::readStream() throw ( IO::IOException, std::exception ){
 
@@ -430,76 +450,76 @@
   void RIOReader::readStream(int maxRecord) throw (IOException, std::exception ){
     
 
-//     bool readUntilEOF = false ;
-//     if( maxRecord == INT_MAX ) 
-//       readUntilEOF = true ;
-    
-//     // here we need to read all the records on the stream
-//     // and then notify the listeners depending on the type ....
-    
-//     int recordsRead = 0 ;
-//     while( recordsRead < maxRecord ){ 
-	
-//       try{ 
-// 	readRecord() ;
-//       }
-//       catch(EndOfDataException){
-	
-// 	// only throw exception if a 'finite' number of records was 
-// 	// specified that couldn't be read from the file
-// 	if( readUntilEOF ){  
-// 	  return ;
-// 	}else{
-// 	  std::stringstream message ;
-// 	  message << "RIOReader::readStream(int maxRecord) : EOF before " 
-// 		  << maxRecord << " records read from file" << std::ends ;
-// 	  throw EndOfDataException( message.str())  ;
-// 	}
-//       }
+    //     bool readUntilEOF = false ;
+    //     if( maxRecord == INT_MAX ) 
+    //       readUntilEOF = true ;
+    
+    //     // here we need to read all the records on the stream
+    //     // and then notify the listeners depending on the type ....
+    
+    //     int recordsRead = 0 ;
+    //     while( recordsRead < maxRecord ){ 
+	
+    //       try{ 
+    // 	readRecord() ;
+    //       }
+    //       catch(EndOfDataException){
+	
+    // 	// only throw exception if a 'finite' number of records was 
+    // 	// specified that couldn't be read from the file
+    // 	if( readUntilEOF ){  
+    // 	  return ;
+    // 	}else{
+    // 	  std::stringstream message ;
+    // 	  message << "RIOReader::readStream(int maxRecord) : EOF before " 
+    // 		  << maxRecord << " records read from file" << std::ends ;
+    // 	  throw EndOfDataException( message.str())  ;
+    // 	}
+    //       }
       
-//       // notify LCRunListeners 
-//       if( ! strcmp( _dummyRecord->getName()->c_str() , LCRIO::RUNRECORDNAME )){
+    //       // notify LCRunListeners 
+    //       if( ! strcmp( _dummyRecord->getName()->c_str() , LCRIO::RUNRECORDNAME )){
 	
-// 	recordsRead++ ;
+    // 	recordsRead++ ;
 
-// 	std::set<IO::LCRunListener*>::iterator iter = _runListeners.begin() ;
-// 	while( iter != _runListeners.end() ){
+    // 	std::set<IO::LCRunListener*>::iterator iter = _runListeners.begin() ;
+    // 	while( iter != _runListeners.end() ){
 
-// 	  _runImpl->setReadOnly( false ) ;
-// 	  (*iter)->modifyRunHeader( *_runP ) ;
+    // 	  _runImpl->setReadOnly( false ) ;
+    // 	  (*iter)->modifyRunHeader( *_runP ) ;
 
-// 	  _runImpl->setReadOnly( true ) ;
-// 	  (*iter)->processRunHeader( *_runP ) ;
+    // 	  _runImpl->setReadOnly( true ) ;
+    // 	  (*iter)->processRunHeader( *_runP ) ;
 	  
-// 	  iter++ ;
-// 	}
-//       }
-//       // notify LCEventListeners 
-//       if( ! strcmp( _dummyRecord->getName()->c_str() , LCRIO::EVENTRECORDNAME )){
+    // 	  iter++ ;
+    // 	}
+    //       }
+    //       // notify LCEventListeners 
+    //       if( ! strcmp( _dummyRecord->getName()->c_str() , LCRIO::EVENTRECORDNAME )){
 	
-// 	recordsRead++ ;
+    // 	recordsRead++ ;
 
-// 	std::set<IO::LCEventListener*>::iterator iter = _evtListeners.begin() ;
-// 	while( iter != _evtListeners.end() ){
+    // 	std::set<IO::LCEventListener*>::iterator iter = _evtListeners.begin() ;
+    // 	while( iter != _evtListeners.end() ){
 
-// // 	  // restore the daughter relations from the parent relations
-// // 	  RIOParticleHandler::restoreParentDaughterRelations( *_evtP ) ;
-// 	  postProcessEvent() ;
+    // // 	  // restore the daughter relations from the parent relations
+    // // 	  RIOParticleHandler::restoreParentDaughterRelations( *_evtP ) ;
+    // 	  postProcessEvent() ;
 
-// 	  // fg20070813 changed order of update and process (needed for 
-// 	  // Marlin modifying processors )
-// 	  (*_evtP)->setAccessMode( LCIO::UPDATE ) ;
-// 	  (*iter)->modifyEvent( *_evtP ) ;
+    // 	  // fg20070813 changed order of update and process (needed for 
+    // 	  // Marlin modifying processors )
+    // 	  (*_evtP)->setAccessMode( LCIO::UPDATE ) ;
+    // 	  (*iter)->modifyEvent( *_evtP ) ;
 
-// 	  (*_evtP)->setAccessMode( LCIO::READ_ONLY ) ; // set the proper acces mode
-// 	  (*iter)->processEvent( *_evtP ) ;
+    // 	  (*_evtP)->setAccessMode( LCIO::READ_ONLY ) ; // set the proper acces mode
+    // 	  (*iter)->processEvent( *_evtP ) ;
 
 
-// 	  iter++ ;
+    // 	  iter++ ;
 	  
-// 	}
-//       }
-//     }
+    // 	}
+    //       }
+    //     }
   }
   
   void  RIOReader::postProcessEvent() {

lcio/src/cpp/src/RIO
RIOWriter.cc 1.1.2.3 -> 1.1.2.4
diff -u -r1.1.2.3 -r1.1.2.4
--- RIOWriter.cc	18 Sep 2009 09:33:40 -0000	1.1.2.3
+++ RIOWriter.cc	20 Nov 2009 15:28:51 -0000	1.1.2.4
@@ -12,10 +12,12 @@
 #include "EVENT/SimTrackerHit.h"
 
 #include "IMPL/LCIOExceptionHandler.h"
-
+#include "UTIL/LCTOOLS.h"
 
 //#define DEBUG 1
+#ifdef DEBUG
 #include "IMPL/LCTOOLS.h"
+#endif
 
 #include "IMPL/LCRelationImpl.h" 
 
@@ -209,15 +211,18 @@
       }
 
       // if we want to have one branch per collection (when pointer isssue is resolved)
-//       //---- loop over all collections in first event ...
-//       typedef std::vector< std::string > StrVec ; 
-//       const StrVec* strVec = evt->getCollectionNames() ;
-//       for(  StrVec::const_iterator name = strVec->begin() ; name != strVec->end() ; name++){
-// 	LCCollection* col = evt->getCollection( *name ) ;
-// 	std::string typeName = col->getTypeName() ;
-// 	std::cout << " registering collection " << *name << " of " <<  typeName <<  std::endl ;
-// 	_branches.push_back(  new RIO::RIOLCCollectionHandler( *name, typeName, _tree) ) ;	 
-//       }
+      //---- loop over all collections in first event ...
+      typedef std::vector< std::string > StrVec ; 
+      const StrVec* strVec = evt->getCollectionNames() ;
+      for(  StrVec::const_iterator name = strVec->begin() ; name != strVec->end() ; name++){
+	LCCollection* col = evt->getCollection( *name ) ;
+	std::string typeName = col->getTypeName() ;
+	std::cout << " registering collection " << *name << " of " <<  typeName <<  std::endl ;
+
+	if( *name == "RecoMCTruthLink" ) 
+	//if( *name == "PandoraPFOs" ) 
+	  _branches[ *name ] =  new RIO::RIOLCCollectionHandler( *name, typeName, _tree) ;	 
+      }
 
       _haveBranches = true ;
     }
@@ -235,22 +240,53 @@
       setUpHandlers( evt ) ;
     }    
     
-    _evtImpl = dynamic_cast<const IMPL::LCEventImpl*> ( evt ) ;
-
+    const LCEventImpl* evtImpl = dynamic_cast<const IMPL::LCEventImpl*> ( evt )   ;
+    if( ! evtImpl ){
+      throw IO::IOException(" evt is not  IMPL::LCEventImpl !?" ) ;
+    }
+    
+    // create a proxy event - copy of the event w/o collections 
+    // then add to the proxy only those collections that are to be written to the ROOT file
+    LCEventImpl proxyEvt( *evtImpl ) ;
+    
+    typedef std::vector< std::string > StrVec ; 
+    const StrVec* strVec = evt->getCollectionNames() ;
+    for(  StrVec::const_iterator name = strVec->begin() ; name != strVec->end() ; name++){
+      
+      LCCollection* col = evt->getCollection( *name ) ;
 
-    if( !_evtImpl ){
+      if( ! col->isTransient() ){
+	
+	if(_branches.find( *name) != _branches.end() ){
 
-      throw IO::IOException(" evt is not  IMPL::LCEventImpl !???" ) ;
+	  proxyEvt.addCollection( col , *name ) ;
+	}
+	else{
+	  std::cout << "WARNING [RIOWriter]: no handler for collection " <<  *name << " found - collection is not stored !!!" << std::endl ;
+	}
+      }
     }
+    
+    proxyEvt.ptrToIndex();
 
-    // ---- only if we can split the event into one branch per collection (pointers between branches) :
-    //     for( BranchVector::iterator it=_branches.begin() ; it!=_branches.end() ; ++it){
-    //       (*it)->toBranch( evt ) ;
-    //     }
+    // --- let the handlers write their collections
+    for( BranchHandlerMap::iterator it=_branches.begin() ; it!=_branches.end() ; ++it){
+      it->second->toBranch( evt ) ;
+    }
     
+    _evtImpl = &proxyEvt ; 
     _tree->Fill() ;
     _file->Flush() ;
 
+    // now we need to take the ownership for the  collections away from proxy Event
+    strVec = proxyEvt.getCollectionNames() ;
+    for(  StrVec::const_iterator name = strVec->begin() ; name != strVec->end() ; name++){
+	_evtImpl->takeCollection( *name ) ;
+    }    
+
+#ifdef DEBUG
+    UTIL::LCTOOLS::dumpEvent( evt ) ;
+#endif
   }
   
   

lcio/src/cpp/src/SIO
SIOParticleHandler.cc 1.22 -> 1.22.20.1
diff -u -r1.22 -r1.22.20.1
--- SIOParticleHandler.cc	1 Jun 2005 15:10:01 -0000	1.22
+++ SIOParticleHandler.cc	20 Nov 2009 15:28:51 -0000	1.22.20.1
@@ -51,6 +51,7 @@
     for(int i=0;i<numberOfParents;i++){
       SIO_PNTR( stream , &(particle->_parents[i] ) ) ;
     }
+    //    std::cout << " SIOParticleHandler :  read " << particle->_parents.size() << "parents to MCParticle ...." << std::endl ;
 //     for(int i=0;i<numberOfParents;i++){
       
 //       // create a pointer to a pointer to a MCParticle 
@@ -224,8 +225,11 @@
 	  MCParticleIOImpl* mcp = dynamic_cast<MCParticleIOImpl*>( col->getElementAt(i) ) ;
 	  nDaughtersTotal += mcp->getDaughters().size()  ;
 	  nParentsTotal += mcp->getParents().size() ;
+	  //	  std::cout << " SIOParticleHandler::restoreParentDaughterRelations : mcp->getParents().size()" << mcp->getParents().size()  << std::endl ;
 	}
 
+	//	std::cout << " SIOParticleHandler::restoreParentDaughterRelations :  nParentsTotal" << nParentsTotal  << std::endl ;
+
 	for(int i=0; i < col->getNumberOfElements() ; i++){
 	  
 	  MCParticleIOImpl* mcp = dynamic_cast<MCParticleIOImpl*>( col->getElementAt(i) ) ;
CVSspam 0.2.8