00001 #include "RawFile/RawFileReader.h" 00002 #include "RawFile/EvtIdxHandler.h" 00003 #include "RawFile/RawFileTools.h" 00004 #include "IRawFile/RawFileExceptions.h" 00005 #include <iostream> 00006 #include <cstdlib> 00007 00008 using namespace std; 00009 00010 int main(int argc, char* argv[]) 00011 { 00012 if ( argc != 2 ) { 00013 cout << "Usage: " << argv[0] << " datafile" << endl; 00014 cout << "***********************************" << endl 00015 << "** NEW: wildcard is supported **" << endl 00016 << "***********************************" << endl; 00017 exit(1); 00018 } 00019 00020 const uint32_t* data; 00021 EvtIdxHandler idxhandler; 00022 00023 VFileNames_t fnames; 00024 fnames.push_back(argv[1]); 00025 fnames = RawFileTools::wildcard_correct(fnames); 00026 00027 for ( uint32_t i = 0; i < fnames.size(); ++i ) { 00028 VFileNames_t fname; 00029 fname.push_back(fnames[i]); 00030 RawFileReader freader(fname); 00031 uint32_t thePos = freader.tellg(); 00032 00033 while ( true ) { 00034 try { 00035 data = freader.nextEvent(); 00036 } 00037 catch ( ReachEndOfFileList& e ) { 00038 break; 00039 } 00040 catch ( RawFileException& e ) { 00041 e.print(); 00042 exit(1); 00043 } 00044 00045 idxhandler.addPos( data[8+data[5]], thePos ); 00046 thePos = freader.tellg(); 00047 } 00048 00049 idxhandler.write( RawFileTools::fname2idxname(freader.currentFile()) ); 00050 } 00051 00052 return 0; 00053 }