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