Print

Print


Commit in lcio/src/cpp on MAIN
include/UTIL/LCTypedVector.h+2-21.2 -> 1.3
src/EXAMPLE/simjob.cc+7-11.53 -> 1.54
+9-3
2 modified files
fixed potential problem with resize for gcc4.x (+testcode in simjob)

lcio/src/cpp/include/UTIL
LCTypedVector.h 1.2 -> 1.3
diff -u -r1.2 -r1.3
--- LCTypedVector.h	28 Mar 2006 17:18:49 -0000	1.2
+++ LCTypedVector.h	19 Feb 2007 17:38:46 -0000	1.3
@@ -23,7 +23,7 @@
    *  <p>Note that instantiating an LCTypedVector involves copying and casting of the pointers in 
    *  the collection. In a future release of LCIO this might not be neccessary any more.
    *  @author gaede
-   *  @version $Id: LCTypedVector.h,v 1.2 2006/03/28 17:18:49 gaede Exp $
+   *  @version $Id: LCTypedVector.h,v 1.3 2007/02/19 17:38:46 gaede Exp $
    */
   template <class T> 
   class LCTypedVector : public  std::vector<T*> {
@@ -32,7 +32,7 @@
     
     LCTypedVector( EVENT::LCCollection* col ) : _col( col) {
       
-      resize( _col->getNumberOfElements() ) ;
+      this->resize( _col->getNumberOfElements() ) ;
       
       for(int i=0;i<_col->getNumberOfElements();i++ ) {
 	

lcio/src/cpp/src/EXAMPLE
simjob.cc 1.53 -> 1.54
diff -u -r1.53 -r1.54
--- simjob.cc	3 Aug 2006 16:53:36 -0000	1.53
+++ simjob.cc	19 Feb 2007 17:38:47 -0000	1.54
@@ -22,6 +22,8 @@
 #include "UTIL/LCTime.h"
 //#include "UTIL/BitField64.h"
 #include "UTIL/CellIDEncoder.h"
+#include "UTIL/LCTypedVector.h"
+
 
 // #include "UTIL/LCIOTypeInfo.h"
 
@@ -294,6 +296,8 @@
 	trkVec->setFlag( thFlag.getFlag()  ) ;
 	
 
+	LCTypedVector<MCParticle> mcpTV( mcVec ) ;
+
 	CellIDEncoder<SimTrackerHitImpl> cd( "i:8,j:8,k:8" ,trkVec )  ;
 	
 	for(int j=0;j<NHITS;j++){
@@ -319,7 +323,9 @@
 	  float rn =  .99999*rand()/RAND_MAX ;
 	  int mcIndx = static_cast<int>( NMCPART * rn ) ;
 	  
-	  hit->setMCParticle( dynamic_cast<MCParticle*>(mcVec->getElementAt( mcIndx ) ) ) ;
+
+// 	  hit->setMCParticle( dynamic_cast<MCParticle*>(mcVec->getElementAt( mcIndx ) ) ) ;
+	  hit->setMCParticle( mcpTV[ mcIndx ]  ) ;
 	  
 	  hit->setMomentum( 1. , 2. , 3. ) ; 
 	  hit->setPathLength( .042 ) ;
CVSspam 0.2.8