source: fact/FADctrl/FADBoard.h@ 10212

Last change on this file since 10212 was 10212, checked in by ogrimm, 14 years ago
Implemented new FAD data format
File size: 1.7 KB
Line 
1#ifndef FADBoard_H_SEEN
2#define FADBoard_H_SEEN
3
4#include <ctype.h>
5#include <time.h>
6#include <math.h>
7#include <errno.h>
8#include <unistd.h>
9#include <dirent.h>
10#include <sys/time.h>
11
12#include <stdlib.h>
13#include <string.h>
14#include <iostream>
15#include <algorithm>
16#include <sys/socket.h>
17#include <netdb.h>
18
19#include "FAD.h"
20#include "FADFormat.h"
21
22const unsigned int READ_BUFFER_SIZE = 1000000;
23
24class FADBoard: public DimThread {
25
26 class FAD *m;
27 int Socket;
28 pthread_mutex_t Mutex;
29 DimService *DIM_Name, *DIM_ID, *DIM_Temp, *DIM_ROI, *DIM_DAC;
30
31 void ReadLoop();
32 static void LaunchThread(class FADBoard *);
33 void threadHandler();
34
35 public:
36 FADBoard(std::string, unsigned short, class FAD *, unsigned int);
37 ~FADBoard();
38
39 struct BoardStatus {
40 uint16_t BoardID;
41 uint64_t DNA;
42 uint16_t FirmwareRevision;
43 uint32_t BoardTime;
44 uint32_t EventCounter;
45 uint32_t TriggerID;
46 uint16_t TriggerType;
47 uint16_t TriggerCRC;
48 uint16_t TriggerCell[NChips];
49 float Frequency;
50 bool Lock[NChips];
51 uint16_t PhaseShift;
52 uint16_t ROI[NChips][NChannels];
53 uint16_t DAC[NDAC];
54 float Temp[NTemp];
55 struct timeval Update;
56 } Status;
57
58 short Data[NChips][NChannels][NBins];
59 long int Sum[NChips][NChannels][NBins];
60
61 struct CalibData {
62 uint64_t DNA;
63 short Baseline[NChips][NChannels][NBins];
64 double Gain[NChips][NChannels][NBins];
65 double Secondary[NChips][NChannels][NBins];
66 float Temp;
67 float Frequency;
68 time_t Time;
69 } ACalib;
70
71 void Send(const void *, size_t);
72 void Send(unsigned short);
73 struct BoardStatus GetStatus();
74 void AmplitudeCalibration();
75 void Lock();
76 void Unlock();
77
78 unsigned short Port;
79 char *Name;
80 bool CommOK;
81 bool Active;
82 bool Continue;
83 pthread_t Thread;
84 pthread_cond_t CondVar;
85};
86
87#endif
Note: See TracBrowser for help on using the repository browser.