00001 #include "lcio/AddDifSynchro.hh"
00002 #include "lcio/Count.hh"
00003
00004
00005 #include "Log.hh"
00006
00007 #include <iostream>
00008 #include <string>
00009
00010 using namespace std;
00011
00012 int main(int argc, char**argv){
00013
00014 if ( argc != 4 ) {
00015 cout << endl <<"usage:addDifSynchro difSynchro_file slab_file output_file " << endl;
00016 exit(1);
00017 }
00018
00019 string difSynchroName;
00020 difSynchroName.assign(argv[1]);
00021
00022 string slabFileName;
00023 slabFileName.assign(argv[2]);
00024
00025 unsigned int synchroNumber = Count(difSynchroName).getNumberOfEvent();
00026 unsigned int slabNumber = Count(slabFileName).getNumberOfEvent();
00027
00028 if ( synchroNumber != slabNumber )
00029 {
00030 cout << endl << " !!! ERROR !!! " << endl << endl ;
00031 cout << "Number of event differ in both file" << endl ;
00032 cout << difSynchroName << " " << synchroNumber << " number of events." << endl;
00033 cout << slabFileName << " " << slabNumber << " number of events." << endl;
00034 exit ( -1 ) ;
00035 }
00036 cout << "--- " << synchroNumber << " event to merge ---" <<endl;
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 AddDifSynchro *evtProc = new AddDifSynchro(difSynchroName,argv[3]) ;
00054
00055
00056 LCReader* lcReader = LCFactory::getInstance()->createLCReader() ;
00057 lcReader->open(slabFileName);
00058
00059 lcReader->registerLCEventListener( evtProc ) ;
00060
00061
00062 lcReader->readStream() ;
00063
00064 lcReader->close() ;
00065 delete lcReader ;
00066 delete evtProc;
00067 return 0 ;
00068 }