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