| 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 | DimService *FeedbackState;
|
|---|
| 36 |
|
|---|
| 37 | struct {
|
|---|
| 38 | int State;
|
|---|
| 39 | char Text[BUF_LENGTH];
|
|---|
| 40 | } State;
|
|---|
| 41 |
|
|---|
| 42 | int NumAverages; // Events to take before feedback acts
|
|---|
| 43 | int Count; // Number of currently integrated events
|
|---|
| 44 | int LastServiceUpdate;
|
|---|
| 45 |
|
|---|
| 46 | float Gain; // Feedback gain
|
|---|
| 47 | float DiffVoltage; // for response measurement
|
|---|
| 48 | char TextBuf[BUF_LENGTH];
|
|---|
| 49 |
|
|---|
| 50 | int fLedTrigBoard;
|
|---|
| 51 | int fLedTrigChip;
|
|---|
| 52 | int fLedTrigChannel;
|
|---|
| 53 | int fLedTrigSample;
|
|---|
| 54 | float fLedTrigThreshold;
|
|---|
| 55 | int fLedSignalSample;
|
|---|
| 56 | int fLedBaselineSample;
|
|---|
| 57 | unsigned int fIntHalfWidth;
|
|---|
| 58 | int fDefaultNumAverage;
|
|---|
| 59 |
|
|---|
| 60 | int fNumberOfChannels;
|
|---|
| 61 | int fNumberOfChips;
|
|---|
| 62 |
|
|---|
| 63 | public:
|
|---|
| 64 | HVFeedback(class DAQReadout*);
|
|---|
| 65 | ~HVFeedback();
|
|---|
| 66 |
|
|---|
| 67 | bool ProcessEvent();
|
|---|
| 68 | void SetTarget(int, int, int, float);
|
|---|
| 69 | void GetTargets();
|
|---|
| 70 | void SetGain(float);
|
|---|
| 71 | float GetGain();
|
|---|
| 72 | void SetNumAverages(unsigned int);
|
|---|
| 73 | unsigned int GetNumAverages();
|
|---|
| 74 | void SetFBMode(FBState, bool=false);
|
|---|
| 75 | FBState GetFBMode();
|
|---|
| 76 | unsigned int GetCurrentCount();
|
|---|
| 77 | void MeasureResponse(float);
|
|---|
| 78 | void GetResponse();
|
|---|
| 79 | void ClearAverages();
|
|---|
| 80 | void PrintConfig();
|
|---|
| 81 | };
|
|---|
| 82 |
|
|---|
| 83 | #endif
|
|---|