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