source: fact/FADctrl/FADBoard.h@ 10117

Last change on this file since 10117 was 10117, checked in by ogrimm, 12 years ago
Amplitude calibration integrated into event loop
File size: 1.5 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 <sys/socket.h>
16#include <netdb.h>
17
18#include "FAD.h"
19#include "FADFormat.h"
20
21const unsigned int READ_BUFFER_SIZE = 1000000;
22
23class FADBoard {
24
25 class FAD *m;
26 int Socket;
27 pthread_t Thread;
28 pthread_mutex_t Mutex;
29 DimService *DIM_Name;
30 DimService *DIM_ID;
31 DimService *DIM_Temp;
32 DimService *DIM_ROI;
33 DimService *DIM_DAC;
34
35 void ReadLoop();
36 static void LaunchThread(class FADBoard *);
37
38 public:
39 FADBoard(std::string, unsigned short, class FAD *, unsigned int);
40 ~FADBoard();
41
42 struct BoardStatus {
43 unsigned short BoardID;
44 unsigned short FirmwareRevision;
45 unsigned long TriggerID;
46 unsigned char TriggerType;
47 unsigned short TriggerCell[NChips];
48 unsigned short ROI[NChips][NChannels];
49 unsigned short DAC[NDAC];
50 float Temp[NTemp];
51 struct timeval Update;
52 } Status;
53
54 short Data[NChips][NChannels][NBins];
55 long int Sum[NChips][NChannels][NBins];
56 short Baseline[NChips][NChannels][NBins];
57 double Gain[NChips][NChannels][NBins];
58 double SecondaryBaseline[NChips][NChannels][NBins];
59 float ACalibTemp;
60 time_t ACalibTime;
61
62
63 void Send(const void *, size_t);
64 void Send(unsigned short);
65 struct BoardStatus GetStatus();
66 void AmplitudeCalibration();
67 void Lock();
68 void Unlock();
69
70 char *Name;
71 bool InitOK;
72 bool CommError;
73 bool Active;
74 bool Continue;
75 pthread_cond_t CondVar;
76};
77
78#endif
Note: See TracBrowser for help on using the repository browser.