BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
make_idx.cxx
Go to the documentation of this file.
5#include <iostream>
6#include <cstdlib>
7
8using namespace std;
9
10int main(int argc, char* argv[])
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}
std::vector< std::string > VFileNames_t
Definition: RawFileReader.h:14
void write(std::string fname)
void addPos(uint32_t evtId, uint32_t pos)
const uint32_t * nextEvent()
uint32_t tellg()
std::string currentFile()
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)
int main()
Definition: test_IFile.cxx:11