| 1 | #ifndef FACT_DataCalib
|
|---|
| 2 | #define FACT_DataCalib
|
|---|
| 3 |
|
|---|
| 4 | #include "DataWriteFits2.h"
|
|---|
| 5 | #include "externals/DrsCalib.h"
|
|---|
| 6 |
|
|---|
| 7 | class DimDescribedService;
|
|---|
| 8 |
|
|---|
| 9 | using namespace std;
|
|---|
| 10 |
|
|---|
| 11 | class DataCalib : public DataWriteFits2, 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 | DimDescribedService &fDimRuns; // DimService through which statistics updates are transmitted
|
|---|
| 23 |
|
|---|
| 24 | // uint16_t fDAC[8];
|
|---|
| 25 |
|
|---|
| 26 | void WriteFitsImp(const std::string &filename, const std::vector<float> &vec) const;
|
|---|
| 27 |
|
|---|
| 28 | int GetDrsStep() const { return fData.fStep; }
|
|---|
| 29 |
|
|---|
| 30 | public:
|
|---|
| 31 | DataCalib(const std::string &path, uint32_t id, DimDescribedService &dim, DimDescribedService &runs, MessageImp &imp) : DataWriteFits2(path, id, imp), fDim(dim), fDimRuns(runs)
|
|---|
| 32 | {
|
|---|
| 33 | }
|
|---|
| 34 |
|
|---|
| 35 | static void Restart();
|
|---|
| 36 | static bool ResetTrgOff(DimDescribedService &dim, DimDescribedService &runs);
|
|---|
| 37 | static void Update(DimDescribedService &dim, DimDescribedService &runs);
|
|---|
| 38 |
|
|---|
| 39 | bool Open(const RUN_HEAD* h, const FAD::RunDescription &d);
|
|---|
| 40 | bool WriteEvt(EVENT *e);
|
|---|
| 41 | bool Close(RUN_TAIL * = 0);
|
|---|
| 42 |
|
|---|
| 43 | //static void Apply(int16_t *val, const int16_t *start, uint32_t roi);
|
|---|
| 44 | static void Apply(float *vec, int16_t *val, const int16_t *start, uint32_t roi)
|
|---|
| 45 | {
|
|---|
| 46 | fData.Apply(vec, val, start, roi);
|
|---|
| 47 | }
|
|---|
| 48 |
|
|---|
| 49 | static bool ReadFits(const string &fname, MessageImp &msg);
|
|---|
| 50 |
|
|---|
| 51 | static bool IsValid() { return fData.IsValid(); }
|
|---|
| 52 | static int GetStep() { return fData.fStep; }
|
|---|
| 53 | };
|
|---|
| 54 |
|
|---|
| 55 | #endif
|
|---|