source: fact/FADctrl/FADBoard.h@ 10107

Last change on this file since 10107 was 10101, checked in by ogrimm, 14 years ago
Amplitude calibration information stored in file
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 long TriggerID;
45 unsigned char TriggerType;
46 unsigned short TriggerCell[NChips];
47 unsigned short ROI[NChips][NChannels];
48 unsigned short DAC[NDAC];
49 float Temp[NTemp];
50 struct timeval Update;
51 } Status;
52
53 short Data[NChips][NChannels][NBins];
54 short Baseline[NChips][NChannels][NBins];
55 double Gain[NChips][NChannels][NBins];
56 float ACalibTemp;
57 time_t ACalibTime;
58
59 long int Sum[NChips][NChannels][NBins];
60 unsigned int NumForSum;
61 bool DoSum;
62
63 void Send(const void *, size_t);
64 void Send(unsigned short);
65 struct BoardStatus GetStatus();
66 void AccumulateSum(unsigned int);
67 void Lock();
68 void Unlock();
69
70 char *Name;
71 bool InitOK;
72 bool CommError;
73 bool Active;
74};
75
76#endif
Note: See TracBrowser for help on using the repository browser.