BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
make_idx.cxx File Reference
#include "IRawFile/RawFileExceptions.h"
#include "RawFile/EvtIdxHandler.h"
#include "RawFile/RawFileReader.h"
#include "RawFile/RawFileTools.h"
#include <cstdlib>
#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 10 of file make_idx.cxx.

10 {
11 if ( argc != 2 )
12 {
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 {
29 VFileNames_t fname;
30 fname.push_back( fnames[i] );
31 RawFileReader freader( fname );
32 uint32_t thePos = freader.tellg();
33
34 while ( true )
35 {
36 try
37 { data = freader.nextEvent(); } catch ( ReachEndOfFileList& e )
38 { break; } catch ( RawFileException& e )
39 {
40 e.print();
41 exit( 1 );
42 }
43
44 idxhandler.addPos( data[8 + data[5]], thePos );
45 thePos = freader.tellg();
46 }
47
48 idxhandler.write( RawFileTools::fname2idxname( freader.currentFile() ) );
49 }
50
51 return 0;
52}
TTree * data
std::vector< std::string > VFileNames_t
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)
std::string fname2idxname(const std::string &fname)