Commit in lcio/src/cpp on MAIN
CMakeLists.txt+11.39 -> 1.40
src/EXAMPLE/lcio_event_counter.cc+51added 1.1
+52
1 added + 1 modified, total 2 files
added event_counter tool

lcio/src/cpp
CMakeLists.txt 1.39 -> 1.40
diff -u -r1.39 -r1.40
--- CMakeLists.txt	13 Mar 2011 12:42:19 -0000	1.39
+++ CMakeLists.txt	16 Mar 2011 10:39:12 -0000	1.40
@@ -270,6 +270,7 @@
 ADD_LCIO_BIN( copyfix ) 
 ADD_LCIO_BIN( stdhepjob ) 
 ADD_LCIO_BIN( addRandomAccess )
+ADD_LCIO_BIN( lcio_event_counter ) 
 
 
 

lcio/src/cpp/src/EXAMPLE
lcio_event_counter.cc added at 1.1
diff -N lcio_event_counter.cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ lcio_event_counter.cc	16 Mar 2011 10:39:12 -0000	1.1
@@ -0,0 +1,51 @@
+#include "lcio.h"
+
+#include "IO/LCReader.h"
+//#include "IMPL/LCTOOLS.h"
+//#include "EVENT/LCRunHeader.h" 
+
+#include <cstdlib>
+
+static std::vector<std::string> FILEN ; 
+
+using namespace std ;
+using namespace lcio ;
+
+/** Small utility to count the number of events in lcio files
+ */
+
+int main(int argc, char** argv ){
+
+  // read file names from command line (only argument) 
+  if( argc < 2) {
+    cout << " count the number of events in the given input files" << endl << endl;
+    cout << " usage:  lcio_event_counter <input-file1> [[input-file2],...]" << endl ;
+    exit(1) ;
+  }
+
+  for(int i=1 ; i < argc ; i++){
+      FILEN.push_back( argv[i] )  ;
+  }
+
+  int nFiles = argc-1 ;
+  
+  int total_events = 0 ;
+
+  LCReader* lcReader = LCFactory::getInstance()->createLCReader() ;
+  
+   for(int i=0 ; i < nFiles ; i++){
+
+    lcReader->open( FILEN[i] ) ;
+
+    total_events += lcReader->getNumberOfEvents() ;
+
+    lcReader->close() ;
+  }  
+
+  cout <<  total_events << endl ;
+
+  delete lcReader ;
+  return 0 ;
+}
+
+  
CVSspam 0.2.8