1 | #ifndef FACT_DataCalib
|
---|
2 | #define FACT_DataCalib
|
---|
3 |
|
---|
4 | #include "DataWriteFits.h"
|
---|
5 | #include "externals/DrsCalib.h"
|
---|
6 |
|
---|
7 | class DimDescribedService;
|
---|
8 |
|
---|
9 | using namespace std;
|
---|
10 |
|
---|
11 | class DataCalib : public DataWriteFits, public DrsCalibrate
|
---|
12 | {
|
---|
13 | static DrsCalibration fData;
|
---|
14 |
|
---|
15 | static std::vector<float> fStats; /// Storage for mean and rms values
|
---|
16 |
|
---|
17 | /// State of the DRS calibration: Positiove numbers mean that
|
---|
18 | /// we are in a run, negative mean that it is closed
|
---|
19 | static bool fProcessing;
|
---|
20 |
|
---|
21 | DimDescribedService &fDim; // DimService through which statistics updates are transmitted
|
---|
22 |
|
---|
23 | // uint16_t fDAC[8];
|
---|
24 |
|
---|
25 | void WriteFits();
|
---|
26 |
|
---|
27 | int GetDrsStep() const { return fData.fStep; }
|
---|
28 |
|
---|
29 | public:
|
---|
30 | DataCalib(const std::string &path, uint32_t id, DimDescribedService &dim, MessageImp &imp) : DataWriteFits(path, id, imp), fDim(dim)
|
---|
31 | {
|
---|
32 | }
|
---|
33 |
|
---|
34 | static void Restart();
|
---|
35 | static bool ResetTrgOff(DimDescribedService &dim);
|
---|
36 | static void Update(DimDescribedService &dim);
|
---|
37 |
|
---|
38 | bool Open(const RUN_HEAD* h, const FAD::RunDescription &d);
|
---|
39 | bool WriteEvt(EVENT *e);
|
---|
40 | bool Close(RUN_TAIL * = 0);
|
---|
41 |
|
---|
42 | //static void Apply(int16_t *val, const int16_t *start, uint32_t roi);
|
---|
43 | static void Apply(float *vec, int16_t *val, const int16_t *start, uint32_t roi)
|
---|
44 | {
|
---|
45 | fData.Apply(vec, val, start, roi);
|
---|
46 | }
|
---|
47 |
|
---|
48 | static bool ReadFits(const string &fname, MessageImp &msg);
|
---|
49 |
|
---|
50 | static bool IsValid() { return fData.IsValid(); }
|
---|
51 | };
|
---|
52 |
|
---|
53 | #endif
|
---|