source: fact/FADctrl/FADBoard.h@ 10113

Last change on this file since 10113 was 10113, checked in by ogrimm, 14 years ago
Event thread informed through pipe of new incoming data
File size: 1.6 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 short Baseline[NChips][NChannels][NBins];
56 double Gain[NChips][NChannels][NBins];
57 double SecondaryBaseline[NChips][NChannels][NBins];
58 float ACalibTemp;
59 time_t ACalibTime;
60
61 long int Sum[NChips][NChannels][NBins];
62 unsigned int NumForSum;
63 bool DoSum;
64 bool SumPhysPipeline;
65
66 void Send(const void *, size_t);
67 void Send(unsigned short);
68 struct BoardStatus GetStatus();
69 void AccumulateSum(unsigned int, bool);
70 void Lock();
71 void Unlock();
72
73 char *Name;
74 bool InitOK;
75 bool CommError;
76 bool Active;
77};
78
79#endif
Note: See TracBrowser for help on using the repository browser.