source: drsdaq/HVFeedback.h@ 179

Last change on this file since 179 was 175, checked in by ogrimm, 15 years ago
Feedback now using DIM for communication with bias server.
File size: 2.2 KB
Line 
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#define kNumberOfChipsMax 2
16#define kNumberOfChannelsMax 10
17
18enum FBState {FB_Off, FB_Active, FB_Targets, FB_ResponseFirst, FB_ResponseSecond};
19
20class HVFeedback: public EvidenceServer {
21
22 class DAQReadout *m;
23 class PixelMap *PixMap;
24 FBState FBMode;
25
26 float (*Average)[kNumberOfChipsMax][kNumberOfChannelsMax];
27 float (*Sigma)[kNumberOfChipsMax][kNumberOfChannelsMax];
28 float (*Response)[kNumberOfChipsMax][kNumberOfChannelsMax];
29 float (*Target)[kNumberOfChipsMax][kNumberOfChannelsMax];
30 float (*Buffer)[kNumberOfChipsMax][kNumberOfChannelsMax];
31 float (*DIMAverage)[kNumberOfChipsMax][kNumberOfChannelsMax];
32 float (*DIMSigma)[kNumberOfChipsMax][kNumberOfChannelsMax];
33
34 DimService *FeedbackAverage;
35 DimService *FeedbackSigma;
36 DimService *FeedbackResponse;
37 DimService *FeedbackTarget;
38 DimService *CountService;
39
40 int NumAverages; // Events to take before feedback acts
41 int Count; // Number of currently integrated events
42 int LastServiceUpdate;
43
44 float Gain; // Feedback gain
45 float DiffVoltage; // for response measurement
46 char TextBuf[BUF_LENGTH];
47
48 int fLedTrigBoard;
49 int fLedTrigChip;
50 int fLedTrigChannel;
51 int fLedTrigSample;
52 float fLedTrigThreshold;
53 int fLedSignalSample;
54 int fLedBaselineSample;
55 unsigned int fIntHalfWidth;
56 int fDefaultNumAverage;
57
58 int fNumberOfChannels;
59 int fNumberOfChips;
60
61 public:
62 HVFeedback(class DAQReadout*, char*);
63 ~HVFeedback();
64
65 bool ProcessEvent();
66 void SetTarget(int, int, int, float);
67 void GetTargets();
68 void SetGain(float);
69 float GetGain();
70 void SetNumAverages(unsigned int);
71 unsigned int GetNumAverages();
72 void SetFBMode(FBState, bool=false);
73 FBState GetFBMode();
74 unsigned int GetCurrentCount();
75 void MeasureResponse(float);
76 void GetResponse();
77 void ClearAverages();
78 bool WriteHVCommand(const char *, ...);
79 void PrintConfig(int);
80};
81
82#endif
Note: See TracBrowser for help on using the repository browser.