/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/lcio/src/cpp/src/EXAMPLE/addRandomAccess.cc

Go to the documentation of this file.
00001 #include "lcio.h"
00002 
00003 #include "IO/LCWriter.h"
00004 //#include "EVENT/LCIO.h"
00005 
00006 #include <iostream>
00007 #include <sstream>
00008 #include <stdio.h>
00009 #include <stdlib.h>
00010 
00011 using namespace lcio ;
00012 
00013 static std::vector<std::string> FILEN ; 
00014 
00015 
00016 /** Simple program that opens existing LCIO files and appends the records needed for direct access - if they don't exist.
00017  */
00018 
00019 int main(int argc, char** argv ){
00020   
00021     
00022     // create sio writer
00023     LCWriter* lcWrt = LCFactory::getInstance()->createLCWriter()  ;
00024 
00025     // read file names from command line (only argument) 
00026     if( argc < 2) {
00027       std::cout << " usage:  addRandomAccess <input-file1> [[input-file2],...]" << std::endl ;
00028       exit(1) ;
00029     }
00030     for(int i=1 ; i < argc ; i++){
00031       FILEN.push_back( argv[i] )  ;
00032     }
00033 
00034     int nFiles = argc-1 ;
00035 
00036     for( int i=0 ; i <nFiles ; ++i ) {
00037 
00038       try{
00039       
00040         lcWrt->open( FILEN[i] , LCIO::WRITE_APPEND )  ;
00041 
00042         lcWrt->close() ;
00043 
00044       }catch(IOException& e){
00045 
00046         std::cout << " io error in file  " << FILEN[i] << " : " << e.what() << std::endl ;
00047       }
00048     }
00049 
00050     return 0 ;
00051 }
00052 

Generated on Mon Jan 7 13:15:21 2013 for MicromegasFramework by  doxygen 1.4.7