#include "RawFile/RawFileReader.h"
#include "IRawFile/RawFileExceptions.h"
#include <iostream>
#include <fstream>
Go to the source code of this file.
Functions | |
int | main (int argc, char *argv[]) |
int main | ( | int | argc, | |
char * | argv[] | |||
) |
Definition at line 8 of file test_read.cxx.
References genRecEmupikp::i, RawFileReader::nextEvent(), RawFileException::print(), and deljobs::string.
00009 { 00010 if (argc != 3) { 00011 cout << "Usage: " << argv[0] << " file.conf nevts" << endl; 00012 cout << "***********************************" << endl 00013 << "** NEW: wildcard is supported **" << endl 00014 << "***********************************" << endl; 00015 exit(1); 00016 } 00017 00018 VFileNames_t fnames; 00019 VFileNames_t idxfnames; 00020 00021 string confstr; 00022 ifstream fconf(argv[1]); 00023 00024 while ( !(fconf>>confstr).eof() ) { 00025 if ( confstr == "datafiles" ) { 00026 fconf >> confstr; 00027 fnames.push_back(confstr); 00028 } 00029 else if ( confstr == "idxfiles" ) { 00030 fconf >> confstr; 00031 idxfnames.push_back(confstr); 00032 } 00033 else { 00034 fconf >> confstr; 00035 } 00036 } 00037 00038 RawFileReader *freader; 00039 if ( idxfnames.empty() ) { 00040 freader = new RawFileReader(fnames); 00041 } 00042 else { 00043 freader = new RawFileReader(fnames, idxfnames); 00044 } 00045 00046 const uint32_t* data; 00047 00048 int nevts = atoi( argv[2] ); 00049 for ( int i = 0; i < nevts; ++i ) { 00050 try { 00051 data = freader->nextEvent(); 00052 //data = freader->nextEvent(1000); 00053 //data = freader->roughlyNextEvent(1000); 00054 } 00055 catch ( RawFileException& e ) { 00056 e.print(); 00057 break; 00058 } 00059 cout << "Size : " << data[1] << " RID: " << data[9+data[5]] << " GID: " << data[8+data[5]] << endl; 00060 } 00061 00062 delete freader; 00063 00064 return 0; 00065 }