ROOTANA
Alpha16.h
Go to the documentation of this file.
1 //
2 // ALPHA-g TPC
3 //
4 // GRIF-16/ALPHA-16 ADC functions
5 //
6 // Class definitions
7 //
8 
9 #ifndef ALPHA16H
10 #define ALPHA16H
11 
12 #include <stdint.h>
13 #include <vector>
14 
16 {
21  uint32_t hardwareId;
22  uint32_t buildTimestamp;
23  uint32_t eventTimestamp;
24  uint32_t triggerOffset;
25  int moduleId;
27  int channelId;
28  int nsamples;
29  int checksum;
30  int length;
31  int xcrc16;
32 
33  static int PacketType(const void*ptr, int bklen8);
34  static int PacketVersion(const void*ptr, int bklen8);
35  static uint32_t PacketTimestamp(const void*ptr, int bklen8);
36  static int PacketChannel(const void*ptr, int bklen8);
37 
38  void Unpack(const void* bkptr, int bklen8);
39  void Print() const;
40 };
41 
42 typedef std::vector<int16_t> Alpha16WaveformVector;
43 
45 {
46  public:
47  void Unpack(const void* bkptr, int bklen8);
48 };
49 
50 #define MAX_ALPHA16 32
51 #define NUM_CHAN_ALPHA16 16
52 
54 {
55  int eventNo; // event counter, starting from 1
56  double eventTime; // event time stamp, in ns, time of first event is zero
57  double prevEventTime; // time of previous event, in ns, zero for first event
58 
59  bool udpPresent[MAX_ALPHA16*NUM_CHAN_ALPHA16]; // udp packet received
60  uint32_t udpEventTs[MAX_ALPHA16*NUM_CHAN_ALPHA16]; // timestamp from udp packet
61 
64 
65  int numChan; // count of received channels
66 
67  bool error; // event has an error
68  bool complete; // event is complete
69 
70  Alpha16Event(); // ctor
71  ~Alpha16Event(); // dtor
72 
73  void Reset();
74  void Print() const;
75 };
76 
77 struct Alpha16EVB
78 {
79  int fEventCount; // event counter
80 
82  uint32_t fFirstEventTs[MAX_ALPHA16*NUM_CHAN_ALPHA16]; // udp timestamp of first event
83  //uint32_t fLastEventTs[MAX_ALPHA16*NUM_CHAN_ALPHA16]; // udp timestamp of last seen event
84  uint32_t fLastEventTs;
85 
88 
89  std::vector<int> fConfModMap;
90 
91  Alpha16EVB(); // ctor
92 
93  void Reset();
94  //void Print() const;
95 
96  void Configure(int runno);
97 
99  void AddBank(Alpha16Event* e, int imodule, const void* bkptr, int bklen);
100  void CheckEvent(Alpha16Event* e);
101 
102  //Alpha16Event* FindEvent(int imodule, uint32_t udpTs);
103  //Alpha16Event* GetNextEvent();
104  //static bool Match(const Alpha16Event* e, int imodule, uint32_t udpTs);
105 };
106 
107 #endif
108 
109 /* emacs
110  * Local Variables:
111  * tab-width: 8
112  * c-basic-offset: 3
113  * indent-tabs-mode: nil
114  * End:
115  */
#define MAX_ALPHA16
Definition: Alpha16.h:50
std::vector< int16_t > Alpha16WaveformVector
Definition: Alpha16.h:42
#define NUM_CHAN_ALPHA16
Definition: Alpha16.h:51
void Unpack(const void *bkptr, int bklen8)
Definition: Alpha16.cxx:174
void CheckEvent(Alpha16Event *e)
Definition: Alpha16.cxx:378
Alpha16Event * NewEvent()
Definition: Alpha16.cxx:368
void Reset()
Definition: Alpha16.cxx:220
int fEventCount
Definition: Alpha16.h:79
uint32_t fLastEventTs
Definition: Alpha16.h:84
void Configure(int runno)
Definition: Alpha16.cxx:232
int fConfNumChan
Definition: Alpha16.h:86
uint32_t fFirstEventTs[MAX_ALPHA16 *NUM_CHAN_ALPHA16]
Definition: Alpha16.h:82
bool fHaveEventTs
Definition: Alpha16.h:81
void AddBank(Alpha16Event *e, int imodule, const void *bkptr, int bklen)
Definition: Alpha16.cxx:308
std::vector< int > fConfModMap
Definition: Alpha16.h:89
int fConfNumSamples
Definition: Alpha16.h:87
uint32_t udpEventTs[MAX_ALPHA16 *NUM_CHAN_ALPHA16]
Definition: Alpha16.h:60
int eventNo
Definition: Alpha16.h:55
bool udpPresent[MAX_ALPHA16 *NUM_CHAN_ALPHA16]
Definition: Alpha16.h:59
void Reset()
Definition: Alpha16.cxx:194
Alpha16Packet udpPacket[MAX_ALPHA16 *NUM_CHAN_ALPHA16]
Definition: Alpha16.h:62
int numChan
Definition: Alpha16.h:65
void Print() const
Definition: Alpha16.cxx:210
Alpha16Waveform waveform[MAX_ALPHA16 *NUM_CHAN_ALPHA16]
Definition: Alpha16.h:63
double prevEventTime
Definition: Alpha16.h:57
double eventTime
Definition: Alpha16.h:56
bool complete
Definition: Alpha16.h:68
bool error
Definition: Alpha16.h:67
int channelType
Definition: Alpha16.h:26
int acceptedTrigger
Definition: Alpha16.h:20
int length
Definition: Alpha16.h:30
int nsamples
Definition: Alpha16.h:28
uint32_t triggerOffset
Definition: Alpha16.h:24
static int PacketVersion(const void *ptr, int bklen8)
Definition: Alpha16.cxx:139
int packetVersion
Definition: Alpha16.h:19
uint32_t buildTimestamp
Definition: Alpha16.h:22
static int PacketChannel(const void *ptr, int bklen8)
Definition: Alpha16.cxx:149
int channelId
Definition: Alpha16.h:27
int packetType
Definition: Alpha16.h:18
static uint32_t PacketTimestamp(const void *ptr, int bklen8)
Definition: Alpha16.cxx:144
void Unpack(const void *bkptr, int bklen8)
Definition: Alpha16.cxx:47
int bankLength
Definition: Alpha16.h:17
int xcrc16
Definition: Alpha16.h:31
int moduleId
Definition: Alpha16.h:25
uint32_t eventTimestamp
Definition: Alpha16.h:23
void Print() const
Definition: Alpha16.cxx:157
uint32_t hardwareId
Definition: Alpha16.h:21
static int PacketType(const void *ptr, int bklen8)
Definition: Alpha16.cxx:134
int checksum
Definition: Alpha16.h:29