BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
test_find.cxx File Reference
#include "IRawFile/RawFileExceptions.h"
#include "RawFile/RawFileReader.h"
#include <fstream>
#include <iostream>

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Function Documentation

◆ main()

int main ( int argc,
char * argv[] )

Definition at line 8 of file test_find.cxx.

8 {
9 if ( argc != 3 )
10 {
11 cout << "Usage: " << argv[0] << " file.conf EvtId" << endl;
12 cout << "***********************************" << endl
13 << "** NEW: wildcard is supported **" << endl
14 << "***********************************" << endl;
15 exit( 1 );
16 }
17
18 VFileNames_t fnames;
19 VFileNames_t idxfnames;
20
21 string confstr;
22 ifstream fconf( argv[1] );
23
24 while ( !( fconf >> confstr ).eof() )
25 {
26 if ( confstr == "datafiles" )
27 {
28 fconf >> confstr;
29 fnames.push_back( confstr );
30 }
31 else if ( confstr == "idxfiles" )
32 {
33 fconf >> confstr;
34 idxfnames.push_back( confstr );
35 }
36 else { fconf >> confstr; }
37 }
38
39 RawFileReader* freader;
40 if ( idxfnames.empty() ) { freader = new RawFileReader( fnames ); }
41 else { freader = new RawFileReader( fnames, idxfnames ); }
42
43 uint32_t evtId = atoi( argv[2] );
44
45 try
46 {
47 const uint32_t* data = freader->findEventById( evtId );
48 cout << "Size : " << data[1] << " RID: " << data[9 + data[5]]
49 << " GID: " << data[8 + data[5]] << endl;
50 } catch ( RawFileException& e )
51 { e.print(); }
52
53 delete freader;
54
55 return 0;
56}
TTree * data
std::vector< std::string > VFileNames_t
virtual void print() const
const uint32_t * findEventById(uint32_t evtId)