1 | #ifndef HVFEEDBACK_H_SEEN
|
---|
2 | #define HVFEEDBACK_H_SEEN
|
---|
3 |
|
---|
4 | #define BUF_LENGTH 1000
|
---|
5 |
|
---|
6 | #include <stdlib.h>
|
---|
7 |
|
---|
8 | #include "RawDataCTX.h"
|
---|
9 | #include "DAQReadout.h"
|
---|
10 | #include "SlowData.h"
|
---|
11 |
|
---|
12 | enum FBState {FB_Off, FB_Active, FB_Targets, FB_ResponseFirst, FB_ResponseSecond};
|
---|
13 |
|
---|
14 | class HVFeedback {
|
---|
15 |
|
---|
16 | class DAQReadout *m;
|
---|
17 | class PixelMap *PixMap;
|
---|
18 | class SlowData *SlowDataClass;
|
---|
19 | FBState FBMode;
|
---|
20 |
|
---|
21 | float (*Average)[kNumberOfChips][kNumberOfChannels];
|
---|
22 | float (*Sigma)[kNumberOfChips][kNumberOfChannels];
|
---|
23 | float (*Response)[kNumberOfChips][kNumberOfChannels];
|
---|
24 | float (*Target)[kNumberOfChips][kNumberOfChannels];
|
---|
25 | float (*Buffer)[kNumberOfChips][kNumberOfChannels];
|
---|
26 |
|
---|
27 | unsigned int NumAverages; // Events to take before feedback acts
|
---|
28 | unsigned int Count; // Number of currently integrated events
|
---|
29 |
|
---|
30 | float Gain; // Feedback gain
|
---|
31 | float DiffVoltage; // for response measurement
|
---|
32 | int SocketDescriptor;
|
---|
33 | char TextBuf[BUF_LENGTH];
|
---|
34 |
|
---|
35 | int fLedTrigBoard;
|
---|
36 | int fLedTrigChip;
|
---|
37 | int fLedTrigChannel;
|
---|
38 | int fLedTrigSample;
|
---|
39 | float fLedTrigThreshold;
|
---|
40 | int fLedSignalSample;
|
---|
41 | int fLedBaselineSample;
|
---|
42 | unsigned int fIntHalfWidth;
|
---|
43 | int fDefaultNumAverage;
|
---|
44 | char fHVControlServer[BUF_LENGTH];
|
---|
45 | int fHVControlPort;
|
---|
46 | int fMaxCmdAckDelay;
|
---|
47 |
|
---|
48 | public:
|
---|
49 | HVFeedback(class DAQReadout*, char*);
|
---|
50 | ~HVFeedback();
|
---|
51 |
|
---|
52 | bool ProcessEvent();
|
---|
53 | void SetTarget(int, int, int, float);
|
---|
54 | void GetTargets();
|
---|
55 | void SetGain(float);
|
---|
56 | float GetGain();
|
---|
57 | void SetNumAverages(unsigned int);
|
---|
58 | unsigned int GetNumAverages();
|
---|
59 | void SetFBMode(FBState);
|
---|
60 | FBState GetFBMode();
|
---|
61 | unsigned int GetCurrentCount();
|
---|
62 | void MeasureResponse(float);
|
---|
63 | void GetResponse();
|
---|
64 | void ClearAverages();
|
---|
65 | bool WriteHVCommand(const char *, ...);
|
---|
66 | void PrintConfig();
|
---|
67 | };
|
---|
68 |
|
---|
69 | #endif
|
---|