BOSS 7.0.1
BESIII Offline Software System
Loading...
Searching...
No Matches
test_find.cxx
Go to the documentation of this file.
1#include "RawFile/RawFileReader.h"
2#include "IRawFile/RawFileExceptions.h"
3#include <iostream>
4#include <fstream>
5
6using namespace std;
7
8int main(int argc, char* argv[])
9{
10 if (argc != 3) {
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 if ( confstr == "datafiles" ) {
26 fconf >> confstr;
27 fnames.push_back(confstr);
28 }
29 else if ( confstr == "idxfiles" ) {
30 fconf >> confstr;
31 idxfnames.push_back(confstr);
32 }
33 else {
34 fconf >> confstr;
35 }
36 }
37
38 RawFileReader *freader;
39 if ( idxfnames.empty() ) {
40 freader = new RawFileReader(fnames);
41 }
42 else {
43 freader = new RawFileReader(fnames, idxfnames);
44 }
45
46 uint32_t evtId = atoi( argv[2] );
47
48 try {
49 const uint32_t* data = freader->findEventById(evtId);
50 cout << "Size : " << data[1] << " RID: " << data[9+data[5]] << " GID: " << data[8+data[5]] << endl;
51 }
52 catch ( RawFileException& e ) {
53 e.print();
54 }
55
56 delete freader;
57
58 return 0;
59}
TTree * data
std::vector< std::string > VFileNames_t
virtual void print() const
const uint32_t * findEventById(uint32_t evtId)
int main()
Definition: test_IFile.cxx:11