CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
Event/RawFile/RawFile-00-00-10/test/test_read.cxx File Reference
#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[])
 

Function Documentation

◆ main()

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

Definition at line 8 of file Event/RawFile/RawFile-00-00-10/test/test_read.cxx.

9{
10 if (argc != 3) {
11 cout << "Usage: " << argv[0] << " file.conf nevts" << 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 const uint32_t* data;
47
48 int nevts = atoi( argv[2] );
49 for ( int i = 0; i < nevts; ++i ) {
50 try {
51 data = freader->nextEvent();
52 //data = freader->nextEvent(1000);
53 //data = freader->roughlyNextEvent(1000);
54 }
55 catch ( RawFileException& e ) {
56 e.print();
57 break;
58 }
59 cout << "Size : " << data[1] << " RID: " << data[9+data[5]] << " GID: " << data[8+data[5]] << endl;
60 }
61
62 delete freader;
63
64 return 0;
65}
TTree * data
std::vector< std::string > VFileNames_t
virtual void print() const
const uint32_t * nextEvent()