#include <fstream>
#include <iostream>
#include <vector>
#include <cstdio>
Go to the source code of this file.
|
int | main (int argc, char **argv) |
|
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 6 of file read_packed.cxx.
9 std::cerr <<
"Usage: read_packed filename" <<
std::endl;
12 std::ifstream fin(
argv[1], std::ios::in | std::ios::binary);
13 std::vector<std::vector<unsigned short>> samples(128);
20 fin.read((
char*)&word,
sizeof(uint32_t));
24 fin.read((
char*)&word,
sizeof(uint32_t));
25 std::cout <<
"Got new frame with TDC " << word <<
std::endl;
27 std::cout <<
"Error: index at new frame is " << index <<
", not 0" <<
std::endl;
35 unsigned short thisSample[8];
36 thisSample[0]=words[0] & 0xfff;
37 thisSample[1]=(words[0] >> 12) & 0xfff;
38 thisSample[2]=((words[0] >> 24) & 0xff) | ((words[1] << 8) & 0xf00);
39 thisSample[3]=(words[1] >> 4) & 0xfff;
40 thisSample[4]=(words[1] >> 16) & 0xfff;
41 thisSample[5]=((words[1] >> 28) & 0xf) | ((words[2] << 4) & 0xff0);
42 thisSample[6]=(words[2] >> 8) & 0xfff;
43 thisSample[7]=(words[2] >> 20) & 0xfff;
45 printf(
"% 6d % 6d % 6d % 6d % 6d % 6d % 6d % 6d\n",
46 thisSample[0], thisSample[1],
47 thisSample[2], thisSample[3],
48 thisSample[4], thisSample[5],
49 thisSample[6], thisSample[7]);
58 while(word!=0xffffffff && nwords<1000);
59 std::cout <<
"Exiting after reading " << nwords <<
" words" <<
std::endl;
union ptb::content::word::word word
QTextStream & endl(QTextStream &s)