00001 #include "RawFile/RawFileReader.h"
00002 #include "IRawFile/RawFileExceptions.h"
00003 #include <iostream>
00004 #include <fstream>
00005
00006 using namespace std;
00007
00008 int main(int argc, char* argv[])
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
00053
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 }