#include "lcio.h"
#include "IO/LCWriter.h"
#include "IO/LCReader.h"
#include "IO/LCEventListener.h"
#include "IO/LCRunListener.h"
#include "EVENT/LCIO.h"
#include <cstdlib>
#include <iostream>
Include dependency graph for copyfix.cc:
Go to the source code of this file.
Classes | |
class | RunEventProcessor |
Functions | |
int | main (int argc, char **argv) |
int main | ( | int | argc, | |
char ** | argv | |||
) |
Definition at line 78 of file copyfix.cc.
00078 { 00079 00080 char* inFileName ; 00081 char* outFileName ; 00082 00083 try{ // a large try block for debugging .... 00084 00085 // create reader and writer for input and output streams 00086 LCReader* lcReader = LCFactory::getInstance()->createLCReader() ; 00087 00088 if( argc < 3 ){ 00089 cout << "usage: copyfix infilename outfilename " << endl ; 00090 exit(1) ; 00091 } 00092 // read file names from command line 00093 inFileName = argv[1] ; 00094 outFileName = argv[2] ; 00095 00096 00097 try{ lcReader->open( inFileName ) ; } 00098 00099 catch( IOException& e){ 00100 cout << "Can't open file : " << e.what() << endl ; 00101 exit(1) ; 00102 } 00103 00104 // create a new RunEventProcessor, register it with the reader 00105 // and read and proccess the whole stream 00106 { 00107 RunEventProcessor evtProc( outFileName) ; 00108 00109 lcReader->registerLCRunListener( &evtProc ) ; 00110 lcReader->registerLCEventListener( &evtProc ) ; 00111 00112 lcReader->readStream() ; 00113 } 00114 00115 lcReader->close() ; 00116 00117 } 00118 00119 catch(exception& ex){ 00120 cout << "something went wrong: " << ex.what() << endl ; 00121 } 00122 00123 return 0 ; 00124 00125 }