BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
make_idx.cxx File Reference
#include "RawFile/RawFileReader.h"
#include "RawFile/EvtIdxHandler.h"
#include "RawFile/RawFileTools.h"
#include "IRawFile/RawFileExceptions.h"
#include <iostream>
#include <cstdlib>

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 10 of file make_idx.cxx.

11{
12 if ( argc != 2 ) {
13 cout << "Usage: " << argv[0] << " datafile" << endl;
14 cout << "***********************************" << endl
15 << "** NEW: wildcard is supported **" << endl
16 << "***********************************" << endl;
17 exit(1);
18 }
19
20 const uint32_t* data;
21 EvtIdxHandler idxhandler;
22
23 VFileNames_t fnames;
24 fnames.push_back(argv[1]);
25 fnames = RawFileTools::wildcard_correct(fnames);
26
27 for ( uint32_t i = 0; i < fnames.size(); ++i ) {
28 VFileNames_t fname;
29 fname.push_back(fnames[i]);
30 RawFileReader freader(fname);
31 uint32_t thePos = freader.tellg();
32
33 while ( true ) {
34 try {
35 data = freader.nextEvent();
36 }
37 catch ( ReachEndOfFileList& e ) {
38 break;
39 }
40 catch ( RawFileException& e ) {
41 e.print();
42 exit(1);
43 }
44
45 idxhandler.addPos( data[8+data[5]], thePos );
46 thePos = freader.tellg();
47 }
48
49 idxhandler.write( RawFileTools::fname2idxname(freader.currentFile()) );
50 }
51
52 return 0;
53}
TTree * data
std::vector< std::string > VFileNames_t
Definition: RawFileReader.h:14
void write(std::string fname)
void addPos(uint32_t evtId, uint32_t pos)
virtual void print() const
std::vector< std::string > wildcard_correct(const std::string &fname)
Definition: RawFileTools.cxx:6
std::string fname2idxname(const std::string &fname)