14 std::ifstream in(filename, std::ifstream::in | std::ifstream::binary);
16 printf(
"unable to open file %s\n", filename);
19 in.seekg(0, std::ifstream::end);
20 int64_t filesize = in.tellg();
24 std::shared_ptr<TMidasEvent> mevent = std::make_shared<TMidasEvent>();
25 std::map<int, int> type_counter;
29 int64_t starttime = 0;
31 int currenteventnumber = 0;
32 int64_t bytesread = 0;
44 printf(
"Failed to find any midas event!\n");
48 bytesread += mfile.
Read(mevent);
49 switch(mevent->GetEventId()) {
55 stoptime = mevent->GetTimeStamp();
59 type_counter[mevent->GetEventId()]++;
62 if((++currenteventnumber % 15000) == 0) {
63 std::streamsize precision = std::cout.precision();
64 std::cout.precision(2);
65 std::cout <<
" Looping over event " << currenteventnumber <<
" have looped " <<
static_cast<double>(bytesread) / 1000000. <<
"MB/" <<
static_cast<double>(filesize) / 1000000. <<
" MB => " << std::setprecision(1) <<
static_cast<double>(bytesread) / 1000000 / sw.RealTime() <<
" MB/s \r";
66 std::cout.precision(precision);
70 std::streamsize precision = std::cout.precision();
71 std::cout.precision(2);
72 std::cout <<
" Looping over event " << currenteventnumber <<
" have looped " <<
static_cast<double>(bytesread) / 1000000. <<
"MB/" <<
static_cast<double>(filesize) / 1000000. <<
" MB => " << std::setprecision(1) <<
static_cast<double>(bytesread) / 1000000 / sw.RealTime() <<
" MB/s \r";
73 std::cout.precision(precision);
75 printf(
"EventTypes Seen: \n");
76 for(
auto& it : type_counter) {
77 printf(
"\tEventId[0x%x] = %i\n", it.first, it.second);
80 printf(
"Run length = %lli seconds\n",
static_cast<long long int>(stoptime - starttime));