#include <DataFormats/daq_common_header.hh>
#include <DataFormats/infoword.hh>
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <cstring>
#include <sys/ioctl.h>
#include <signal.h>
#include <unistd.h>
#include <vector>
#include <cassert>
 
Go to the source code of this file.
 | 
| const static unsigned int  | ttdc = 1414808643 | 
|   | 
| const static unsigned int  | taes = 1413563731 | 
|   | 
| static int  | terminal_width | 
|   | 
◆ sig_term_change()
      
        
          | void sig_term_change  | 
          ( | 
          int  | 
           | ) | 
           | 
        
      
 
Definition at line 23 of file daq_parser.cpp.
   25   static bool const is_a_tty = isatty(1);
 
   32     ioctl(1, TIOCGWINSZ, &sz);
 
 
 
 
◆ __attribute__()
      
        
          | struct __attribute__  | 
          ( | 
          (packed)  | 
           | ) | 
           | 
        
      
 
 
◆ operator<<()
  
  
      
        
          | std::ostream& operator<<  | 
          ( | 
          std::ostream &  | 
          stream,  | 
         
        
           | 
           | 
          const hit_t &  | 
          hit  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inline   | 
  
 
Definition at line 44 of file daq_parser.cpp.
   46   return stream << 
"C: " 
   47                 << std::setfill(
' ') << std::setw(2)
 
   48                 << (
unsigned int) hit.channel
 
   51                 << std::setfill(
' ') << std::setw(6)
 
   52                 << ntohl(hit.timestamp)
 
   55                 << std::setfill(
' ') << std::setw(6)
 
   56                 << (
unsigned int) hit.ToT;
 
 
 
 
◆ print_acoustic_data()
      
        
          | void print_acoustic_data  | 
          ( | 
          const char *const  | 
          buffer,  | 
        
        
           | 
           | 
          ssize_t  | 
          buffer_size  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Definition at line 59 of file daq_parser.cpp.
   63     std::cout << 
"InfoWord: yes\n" 
   64               << *static_cast<const InfoWord* const>(static_cast<const void* const>(
 
   70     std::cout << 
"InfoWord: no\n";
 
 
 
 
◆ print_summary()
      
        
          | void print_summary  | 
          ( | 
          hit_t const *const  | 
          hits,  | 
        
        
           | 
           | 
          std::size_t  | 
          nhits  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Definition at line 74 of file daq_parser.cpp.
   78   for (
unsigned i = 0; i < nhits; ++i) {
 
   79     if (hits[i].channel < 0 || hits[i].channel > 30) {
 
   82       ++summary[hits[i].channel];
 
   88   for (
unsigned i = 0; i < summary.size(); ++i) {
 
   89     std::cout << 
"CH" << std::setfill(
'0') << std::setw(2) << i
 
   90               << 
": " << std::setfill(
' ') << std::setw(4) << summary[i] << 
' ';
 
   92     if ((i + 1) % 
n == 0) {
 
  100     std::cout << 
"wrong channels: " << wrong << 
'\n';
 
 
 
 
◆ print_optical_data()
      
        
          | void print_optical_data  | 
          ( | 
          const char *const  | 
          buffer,  | 
        
        
           | 
           | 
          ssize_t  | 
          buffer_size  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Definition at line 104 of file daq_parser.cpp.
  106   const unsigned int nhits = 
buffer_size / 
sizeof(hit_t);
 
  108   std::cout << 
"Number of hits: " << nhits << 
'\n';
 
  110   const hit_t* 
const hits = static_cast<const hit_t* const>(
 
  111       static_cast<const void* const>(buffer)
 
  115     const int printing = 20 > nhits ? nhits : 20;
 
  118     for (
int i = 0; i < printing; ++i)
 
  121                 << std::setfill(
'0') << std::setw(2)
 
  126       if ((i + 1) % 
n == 0)
 
 
 
 
◆ parseData()
      
        
          | void parseData  | 
          ( | 
          std::istream &  | 
          stream | ) | 
           | 
        
      
 
Definition at line 141 of file daq_parser.cpp.
  149     stream.read((
char*) &header, 
sizeof(header));
 
  151     if (stream.gcount() != 
sizeof(header))
 
  156     std::cout << 
"Counter: " << ++count << 
'\n';
 
  159     assert(header.FrameLength - 
sizeof(header) >= 0 && 
"Wrong frame length.");
 
  161     std::size_t 
const payload_size = header.FrameLength - 
sizeof(header);
 
  163     if (payload.capacity() < payload_size)
 
  165       payload.resize(payload_size);
 
  168     stream.read((
char*) payload.data(), payload_size);
 
  170     if (static_cast<std::size_t>(stream.gcount()) != payload_size)
 
  175     if (header.DataType == 
ttdc) {
 
  177     } 
else if (header.DataType == 
taes) {
 
  180       std::cout << 
"Unknown data type\n";
 
 
 
 
◆ main()
      
        
          | int main  | 
          ( | 
          int  | 
          argc,  | 
        
        
           | 
           | 
          char *  | 
          argv[]  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Definition at line 187 of file daq_parser.cpp.
  191     if (strcmp(argv[1], 
"-h") == 0)
 
  193       std::cout << 
"Usage: " << argv[0] << 
" [-h] [filename]\n" 
  195                 << 
"-h shows this help\n" 
  196                 << 
"filename: if specified reads from file, otherwise stdin is used\n";
 
  213     std::ifstream input_file(argv[1], std::ios::binary);
 
 
 
 
◆ ttdc
  
  
      
        
          | const static unsigned int ttdc = 1414808643 | 
         
       
   | 
  
static   | 
  
 
 
◆ taes
  
  
      
        
          | const static unsigned int taes = 1413563731 | 
         
       
   | 
  
static   | 
  
 
 
◆ terminal_width