source: trunk/FACT++/src/DataCalib.h@ 17316

Last change on this file since 17316 was 17233, checked in by tbretz, 12 years ago
Get the last available drs calibration to initialize the DataWriteFits2 so that it will use this one for compression.
File size: 1.9 KB
Line 
1#ifndef FACT_DataCalib
2#define FACT_DataCalib
3
4#include "DataWriteFits2.h"
5#include "externals/DrsCalib.h"
6
7class DimDescribedService;
8
9using namespace std;
10
11class 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
30public:
31 DataCalib(const std::string &path, uint64_t night, uint32_t id, const DrsCalibration &calib, DimDescribedService &dim, DimDescribedService &runs, MessageImp &imp) : DataWriteFits2(path, night, id, calib, 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(const EVENT &e);
41 bool Close(const 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 static const DrsCalibration &GetCalibration() { return fData; }
55};
56
57#endif
Note: See TracBrowser for help on using the repository browser.