#include "RawFile/RawFileReader.h"
#include "RawFile/EvtIdxHandler.h"
#include "RawFile/RawFileTools.h"
#include "IRawFile/RawFileExceptions.h"
#include <iostream>
#include <cstdlib>
Go to the source code of this file.
Functions | |
int | main (int argc, char *argv[]) |
int main | ( | int | argc, | |
char * | argv[] | |||
) |
Definition at line 10 of file make_idx.cxx.
References EvtIdxHandler::addPos(), RawFileReader::currentFile(), fname, RawFileTools::fname2idxname(), genRecEmupikp::i, RawFileReader::nextEvent(), RawFileException::print(), RawFileReader::tellg(), RawFileTools::wildcard_correct(), and EvtIdxHandler::write().
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 }