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