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