stream  0.10.0
stream analysis framework
AdcMessage.h
1 #ifndef HADAQ_ADCMESSAGE_H
2 #define HADAQ_ADCMESSAGE_H
3 
4 #include <cstdint>
5 #include <cstdio>
6 #include <limits>
7 
8 namespace hadaq {
9 
13  struct AdcMessage {
14  protected:
15  uint32_t fData;
16 
17  public:
18  double fFineTiming;
19  double fIntegral;
20 
22  AdcMessage() : fData(0),
23  fFineTiming(std::numeric_limits<double>::quiet_NaN()),
24  fIntegral(std::numeric_limits<double>::quiet_NaN())
25  {}
26 
28  AdcMessage(uint32_t d) : fData(d) {}
29 
30  //void assign(uint32_t d) { fData=d; }
31 
33  uint32_t getKind() const { return fData >> 28; }
34 
36  bool operator<(const AdcMessage &rhs) const
37  { return (fData < rhs.fData); }
38 
40  uint32_t getAdcId() const { return (fData >> 20) & 0xf; }
42  uint32_t getAdcCh() const { return (fData >> 16) & 0xf; }
44  uint32_t getCh() const { return 4*getAdcId()+getAdcCh(); }
45 
49  short int getValue() const { return fData & 0xffff; }
50  };
51 
52 }
53 
54 #endif
AdcMessage is wrapper for data, produced by FPGA struct is used to avoid any potential overhead.
Definition: AdcMessage.h:13
double fIntegral
integral
Definition: AdcMessage.h:19
uint32_t fData
data
Definition: AdcMessage.h:15
bool operator<(const AdcMessage &rhs) const
dummy compare to keep sorting in subevent
Definition: AdcMessage.h:36
uint32_t getKind() const
Returns kind of the message.
Definition: AdcMessage.h:33
uint32_t getCh() const
logical ADC channel, 0..47
Definition: AdcMessage.h:44
uint32_t getAdcId() const
ADC index, 0..11.
Definition: AdcMessage.h:40
AdcMessage()
constructor
Definition: AdcMessage.h:22
uint32_t getAdcCh() const
ADC channel, 0..3.
Definition: AdcMessage.h:42
double fFineTiming
fine timing
Definition: AdcMessage.h:18
short int getValue() const
the value of the ADC channel handle the sign bit correctly for debug signals from CFD firmware 10bit ...
Definition: AdcMessage.h:49
AdcMessage(uint32_t d)
constructor
Definition: AdcMessage.h:28