GRUTinizer
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JanusDataFormat.h
Go to the documentation of this file.
1 #ifndef _TJANUSDATAFORMAT_H_
2 #define _TJANUSDATAFORMAT_H_
3 
4 struct VMUSB_Header {
5  uint16_t data;
6 
7  // Size in 16-bit words, not self-inclusive.
8  int size() const { return (data & 0x0fff)>>0; }
9  int stack() const { return (data & 0xf000)>>12; }
10 } __attribute__((packed));
11 
12 struct CAEN_ADC{
13  uint16_t tail, head;
14 
15  enum EntryType{ Begin=0x2, Event=0x0, End=0x4, Invalid=0x6 };
16 
17  int card_num() const { return (head & 0xf800)>>11; }
18  EntryType entry_type() const { return EntryType((head & 0x0700)>>8); }
19  int crate_num() const { return (head & 0x00ff)>>0; }
20  int header_zeros() const { return (tail & 0xc000)>>13; }
21  int num_entries() const { return (tail & 0x3f00)>>8; }
22  int trailing_stuff() const { return (tail & 0x00ff)>>0; }
23  int channel_num() const { return (head & 0x003f)>>0; }
24  int adcvalue() const { return (tail & 0x0fff)>>0; }
25  bool overflow() const { return tail & (1<<12); }
26  bool underflow() const { return tail & (1<<13); }
27 
28  bool IsValid() const { return entry_type() == Event; }
29 } __attribute__((packed));
30 
32  uint16_t buffer[6];
33 
34  long ts1() const { return buffer[0] + (long(buffer[1])<<16) + (long(buffer[4])<<32); }
35  long ts2() const { return buffer[2] + (long(buffer[3])<<16) + (long(buffer[5])<<32); }
36 } __attribute__((packed));
37 
38 #endif /* _TJANUSDATAFORMAT_H_ */