Print

Print


Commit in lcio/src/cpp on rio_v00-00
include/IMPL/ReconstructedParticleImpl.h+1-11.12.12.1 -> 1.12.12.2
include/IOIMPL/ReconstructedParticleIOImpl.h+4-21.2 -> 1.2.20.1
              /rootio_templates.h+141.1.2.2 -> 1.1.2.3
src/EXAMPLE/LCCol2Branch.h+45-61.1.2.1 -> 1.1.2.2
           /rootio.cc+25-1311.1.2.1 -> 1.1.2.2
+89-140
5 modified files
cleaned up code from older experiments...

lcio/src/cpp/include/IMPL
ReconstructedParticleImpl.h 1.12.12.1 -> 1.12.12.2
diff -u -r1.12.12.1 -r1.12.12.2
--- ReconstructedParticleImpl.h	7 Jul 2009 12:52:09 -0000	1.12.12.1
+++ ReconstructedParticleImpl.h	13 Jul 2009 08:30:46 -0000	1.12.12.2
@@ -141,7 +141,7 @@
     EVENT::ParticleIDVec _pid ;
     EVENT::ReconstructedParticleVec _particles ;
     EVENT::ClusterVec _clusters ;
-    EVENT::TrackVec _tracks ; //! tell ROOT to not stream this ...
+    EVENT::TrackVec _tracks ; //#### ! tell ROOT to not stream this ...
 
     EVENT::Vertex* _sv ;
     

lcio/src/cpp/include/IOIMPL
ReconstructedParticleIOImpl.h 1.2 -> 1.2.20.1
diff -u -r1.2 -r1.2.20.1
--- ReconstructedParticleIOImpl.h	15 Apr 2005 08:37:40 -0000	1.2
+++ ReconstructedParticleIOImpl.h	13 Jul 2009 08:30:47 -0000	1.2.20.1
@@ -1,12 +1,14 @@
-#ifndef SIO_RECONSTRUCTEDPARTICLEIOIMPL_H
-#define SIO_RECONSTRUCTEDPARTICLEIOIMPL_H 1
+#ifndef IMPL_ReconstructedParticleIOImpl_H
+#define IMPL_ReconstructedParticleIOImpl_H 1
 
 #include "IMPL/ReconstructedParticleImpl.h"
 
+
 // forward declaration
 namespace SIO{ 
   class SIOReconstructedParticleHandler ;
 }
+ 
 
 namespace IOIMPL {
 

lcio/src/cpp/include/IOIMPL
rootio_templates.h 1.1.2.2 -> 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- rootio_templates.h	8 Jul 2009 15:09:02 -0000	1.1.2.2
+++ rootio_templates.h	13 Jul 2009 08:30:47 -0000	1.1.2.3
@@ -11,6 +11,8 @@
 #include "IMPL/ClusterImpl.h"
 #include "IMPL/LCRelationImpl.h"
 
+#include "TRefArray.h"
+
 // ---- tell ROOT about the templates instantiations that we are going to use ...
 
 #ifdef __MAKECINT__
@@ -31,4 +33,16 @@
 
 
 
+
+
+
+// seperate data members and pointer members in ROOT
+struct ReconstructedParticleROOT{
+  EVENT::ReconstructedParticle* Particle ;
+  TRefArray  Tracks ;
+} ;
+
+
+
+
 #endif

lcio/src/cpp/src/EXAMPLE
LCCol2Branch.h 1.1.2.1 -> 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- LCCol2Branch.h	7 Jul 2009 12:57:53 -0000	1.1.2.1
+++ LCCol2Branch.h	13 Jul 2009 08:30:47 -0000	1.1.2.2
@@ -4,15 +4,12 @@
 #include "lcio.h"
 #include "EVENT/LCEvent.h"
 #include "IMPL/LCCollectionVec.h"
-#include "IMPL/ReconstructedParticleImpl.h"
+//#include "IMPL/ReconstructedParticleImpl.h"
 #include "UTIL/LCTypedVector.h"
 
-//#include "TSystem.h"
-//#include "TFile.h"
 #include "TTree.h"
-//#include "TClassTable.h"
+//#include "TRefArray.h"
 
-//typedef IMPL::ReconstructedParticleImpl T ;
 
 
 class LCBranch{
@@ -39,7 +36,8 @@
     tree->Branch( name  , &_tv, 16000, 2 );
 
   }
-  
+
+ 
   
   
   
@@ -88,5 +86,46 @@
 }; // class
 
 
+
+
+// template<>
+// void LCCol2Branch<ReconstructedParticleROOT>::fill( EVENT::LCEvent* evt ){
+  
+//   _tv->clear() ;
+//   _tv->resize( 0 ) ;
+  
+  
+//   try{
+    
+//     EVENT::LCCollection* col =  evt->getCollection( _name ) ;
+    
+//     int n = col->getNumberOfElements() ;
+    
+//     _tv->resize( n ) ;
+    
+//     for( int i=0; i<n ; ++i){
+      
+//       EVENT::ReconstructedParticle* p = dynamic_cast<EVENT::ReconstructedParticle*>( col->getElementAt(i) )  ;
+
+//       (*_tv)[i]->Particle = p ;
+
+//       unsigned ntrk = p->getTracks().size() ;
+
+//       for( unsigned j=0;j<ntrk;j++){
+
+// ---- TRefs work only for TObjects !!
+// 	(*_tv)[i]->Tracks.Add(  p->getTracks()[j] ) ; 
+
+//       }
+//     }
+    
+//   } catch(const lcio::DataNotAvailableException& e){
+    
+//     std::cout << "  collection not found : " << _name << std::endl ;
+//   }    
+// }
+
+
+
 #endif 
 //=============================================================================

lcio/src/cpp/src/EXAMPLE
rootio.cc 1.1.2.1 -> 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- rootio.cc	7 Jul 2009 12:57:53 -0000	1.1.2.1
+++ rootio.cc	13 Jul 2009 08:30:47 -0000	1.1.2.2
@@ -13,13 +13,14 @@
 #include "IMPL/LCEventImpl.h"
 // #include "EVENT/LCRunHeader.h" 
 
-#include "lcio_templates.h"
+#include "IOIMPL/rootio_templates.h"
 
 #include "LCCol2Branch.h"
 
 #include "TSystem.h"
 #include "TFile.h"
 #include "TTree.h"
+#include "TRefArray.h"
 #include "TClassTable.h"
 
 
@@ -28,16 +29,19 @@
 static const char* FILEN = "simjob.slcio" ; // default file name 
 static  char*  RFILEN = "simjob.root" ; // default file name 
 
-//static  char* PFOCOL="ReconstructedParticle" ;
-static  char* PFOCOL="PandoraPFOs" ;
 
 
-//#define RECOTREE 
-//#define EVENTTREE
-
 using namespace std ;
 using namespace lcio ;
 
+
+struct RecoWrapper{
+  EVENT::ReconstructedParticle* RecPart ;
+  TRefArray  Tracks ;
+} ;
+
+
+
 /** example and test code for writing a root file ...
  */
 
@@ -57,34 +61,6 @@
 
 
   //---------------------------------------------------------------------------------------------
-  //  load the LCIO ROOT dictionary
-  // 
-  //   if (!TClassTable::GetDict("IMPL::ReconstructedParticleImpl")) {
-  //     unsigned res ;
-  
-  //     // fg: don't need to load lcio again !? 
-  //     //     res = gSystem->Load("./liblcio.so"); 
-  //     //     if (res != 0 ) {
-  //     //       std::cout << " can't load ./liblcio.so  !  err = "  << res << std::endl ;
-  //     //       exit(1) ;
-  //     //     } 
-  //     //     std::cout << " successfully loaded LCIO library " << std::endl ;
-  
-  //     res = gSystem->Load("./liblcioDict.so"); 
-  
-  //     if (res != 0 ) {
-  //       std::cout << " can't load ./liblcioDict.so  !  err = "  << res << std::endl ;
-  //       exit(1) ;
-  //     } 
-  //     std::cout << " successfully loaded LCIO dictionary " << std::endl ;
-  //   }
-  
-  //   if (!TClassTable::GetDict("IMPL::ReconstructedParticleImpl")) {
-  //     std::cout  << " unknown dictionary for ReconstructedParticleImpl" << std::endl ;
-  //     exit(1) ;
-  //   } 
-  
-  //---------------------------------------------------------------------------------------------
   //   create a ROOT tree with ReconstructedParticles ...
   //
 
@@ -96,6 +72,13 @@
   BV _branches ;
   _branches.reserve(50) ;
   
+
+  // ---  create branches for lcio collections --------
+  //      -> how should we do this in general ? - read the first n events ? ....
+  //
+
+  //_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 ) )  ;
@@ -113,6 +96,7 @@
   _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 ) )  ;
@@ -132,54 +116,6 @@
 //   _branches.push_back( new LCCol2Branch<IMPL::VertexImpl>( "ZVRESVertices_6Jets" , _tree ) )  ;
   
 
-// #ifdef RECOTREE //=======================================================================================
-//     IMPL::ReconstructedParticleImpl* _p = new IMPL::ReconstructedParticleImpl() ; 
-//     //    _ep = new IMPL::LCEventImpl() ;
-    
-//     //LCCollectionVec dummy(LCIO::RECONSTRUCTEDPARTICLE) ;
-    
-//     // UTIL::LCTypedVector<IMPL::ReconstructedParticleImpl>* _pv = new UTIL::LCTypedVector<IMPL::ReconstructedParticleImpl> ;
-//     std::vector<IMPL::ReconstructedParticleImpl*>* _pv = new std::vector<IMPL::ReconstructedParticleImpl*> ;
-    
-//     //LCTypedVectorReconstructedParticleImpl* _pv = new LCTypedVectorReconstructedParticleImpl ;
-    
-//     //PFOVec* _pv = new PFOVec ;
-    
-//     //IMPL::LCCollectionVec* _pv = new IMPL::LCCollectionVec(LCIO::RECONSTRUCTEDPARTICLE) ;
-//     //  _pv = new PFOVec ;
-//     //  _np = 0 ;
-    
-    
-//     //  _tree->Branch("recopart", &_p);
-//     _tree->Branch("recovec", &_pv, 16000, 2 );
-//     //  _tree->Branch("recovecn", &_np);
-    
-//     //_tree->Branch("event",&_ep); 
-    
-//     delete _p ;
-//     //  delete _pv ;
-//     //  delete _ep ;
-    
-// #endif //#ifdef RECOTREE //=======================================================================================
-  
-
-//     //---------------------------------------------------------------------------------------------
-//     //   create a ROOT tree with complete LCEvent ...
-//     //
-// #ifdef EVENTTREE //=======================================================================================
-    
-
-//     IMPL::LCEventImpl* _evt  = new IMPL::LCEventImpl ;
-    
-    
-//     _tree->Branch("lcevent", &_evt, 16000, 2 );
-    
-//     delete _evt ;
-
-// #endif //#ifdef EVENTTREE //=======================================================================================
-
-
-
   //---------------------------------------------------------------------------------------------
   //  open the lcio file
   // 
@@ -189,8 +125,7 @@
   int nEvents = 0 ;
   
 
-
-
+  
   //---------------------------------------------------------------------------------------------
   //   the event loop 
   while( (evt = lcReader->readNextEvent()) != 0 ) {
@@ -203,66 +138,25 @@
 
     _tree->Fill() ;
     
-
-
-
-//     //    LCTOOLS::dumpEvent( evt ) ;
-
-// #ifdef RECOTREE //=======================================================================================
-//     try{
-      
-//       //      LCCollectionVec* col = dynamic_cast<LCCollectionVec*>( evt->getCollection( PFOCOL ) );
-//       //      _pv = col ;
-      
-//       LCCollection* col =  evt->getCollection( PFOCOL ) ;
-
-//       UTIL::LCTypedVector<IMPL::ReconstructedParticleImpl> tv(col) ;
-
-//       //      _pv->assign( tv.begin() , tv.end() ) ;
-      
-//       _pv =  &tv ;
-
-//       //_pv->v =  tv ;
-//       _tree->Fill() ;
-      
-//     }catch(const DataNotAvailableException& e){
-//       std::cout << "  collection not found : " << PFOCOL << std::endl ;
-//     }
-
-// #endif //#ifdef RECOTREE //=======================================================================================
-
-
-// #ifdef EVENTTREE //=======================================================================================
-
-//     _evt = dynamic_cast< IMPL::LCEventImpl* >( evt )  ;
-
-//     _tree->Fill() ;
-
-// #endif //#ifdef EVENTTREE //=======================================================================================
-
-
     nEvents ++ ;
   } 
   // -------- end of event loop -----------
   
   cout << endl <<  "  " <<  nEvents << " events copied from file: " << FILEN 
        << " to " <<  RFILEN  << std::endl  ;
-  
-  lcReader->close() ;
-  delete lcReader ;
 
 
   _file->Write() ;
   delete _file ;
-  //  delete _tree ;
-
+  
+  lcReader->close() ;
+  delete lcReader ;
+  
   for( BV::const_iterator it = _branches.begin() ; it != _branches.end()  ; ++it) {
-    
     delete (*it) ;
   }
-
-
+  
   return 0 ;
 }
 
-  
+
CVSspam 0.2.8