| 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 |
|
|---|
| 21 | const unsigned int READ_BUFFER_SIZE = 1000000;
|
|---|
| 22 |
|
|---|
| 23 | class FADBoard {
|
|---|
| 24 |
|
|---|
| 25 | class FAD *m;
|
|---|
| 26 | int Socket;
|
|---|
| 27 | char *Name;
|
|---|
| 28 | pthread_t Thread;
|
|---|
| 29 | pthread_mutex_t Mutex;
|
|---|
| 30 | DimService *NameService;
|
|---|
| 31 | DimService *IDService;
|
|---|
| 32 | DimService *TempService;
|
|---|
| 33 | DimService *ROIService;
|
|---|
| 34 | DimService *DACService;
|
|---|
| 35 |
|
|---|
| 36 | void ReadLoop();
|
|---|
| 37 | static void LaunchThread(class FADBoard *);
|
|---|
| 38 |
|
|---|
| 39 | public:
|
|---|
| 40 | FADBoard(std::string, unsigned short, class FAD *, unsigned int);
|
|---|
| 41 | ~FADBoard();
|
|---|
| 42 |
|
|---|
| 43 | struct BoardStatus {
|
|---|
| 44 | unsigned short BoardID;
|
|---|
| 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 | unsigned short Data[NChips][NChannels][NBins];
|
|---|
| 55 | double Baseline[NChips][NChannels][NBins];
|
|---|
| 56 | double Gain[NChips][NChannels][NBins];
|
|---|
| 57 | float ACalibTemp;
|
|---|
| 58 | time_t ACalibTime;
|
|---|
| 59 |
|
|---|
| 60 | double Sum[NChips][NChannels][NBins];
|
|---|
| 61 | unsigned int NumForSum;
|
|---|
| 62 | bool DoSum;
|
|---|
| 63 |
|
|---|
| 64 | void Send(const void *, size_t);
|
|---|
| 65 | void Send(unsigned short);
|
|---|
| 66 | struct BoardStatus GetStatus();
|
|---|
| 67 | void AccumulateSum(unsigned int);
|
|---|
| 68 | void Lock();
|
|---|
| 69 | void Unlock();
|
|---|
| 70 |
|
|---|
| 71 | bool InitOK;
|
|---|
| 72 | bool CommError;
|
|---|
| 73 | bool Active;
|
|---|
| 74 | };
|
|---|
| 75 |
|
|---|
| 76 | #endif
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.