1 | #ifndef MARS_MCalibrateData
|
---|
2 | #define MARS_MCalibrateData
|
---|
3 |
|
---|
4 | #ifndef MARS_MTask
|
---|
5 | #include "MTask.h"
|
---|
6 | #endif
|
---|
7 |
|
---|
8 | #ifndef MARS_MArrayF
|
---|
9 | #include "MArrayF.h"
|
---|
10 | #endif
|
---|
11 |
|
---|
12 | class MGeomCam;
|
---|
13 | class MBadPixelsCam;
|
---|
14 | class MPedestalCam;
|
---|
15 | class MPedPhotCam;
|
---|
16 | class MSignalCam;
|
---|
17 | class MCalibConstCam;
|
---|
18 | class MExtractedSignalCam;
|
---|
19 |
|
---|
20 | class MCalibrationChargeCam;
|
---|
21 | class MCalibrationQECam;
|
---|
22 |
|
---|
23 | class MCalibrateData : public MTask
|
---|
24 | {
|
---|
25 | public:
|
---|
26 | #pragma GCC diagnostic push
|
---|
27 | #pragma GCC diagnostic ignored "-Wshadow"
|
---|
28 | enum CalibrationMode_t
|
---|
29 | {
|
---|
30 | kSkip = 0,
|
---|
31 | kNone = 1,
|
---|
32 | kFlatCharge = 2,
|
---|
33 | kBlindPixel = 3,
|
---|
34 | kFfactor = 4,
|
---|
35 | kPinDiode = 5,
|
---|
36 | kCombined = 6,
|
---|
37 | kDummy = 7
|
---|
38 | };
|
---|
39 | #pragma GCC diagnostic pop
|
---|
40 |
|
---|
41 | enum PedestalType_t
|
---|
42 | {
|
---|
43 | kNo = BIT(0),
|
---|
44 | kRun = BIT(1),
|
---|
45 | kEvent = BIT(2)
|
---|
46 | };
|
---|
47 |
|
---|
48 | enum SignalType_t
|
---|
49 | {
|
---|
50 | kPhe,
|
---|
51 | kPhot
|
---|
52 | };
|
---|
53 |
|
---|
54 | static const CalibrationMode_t gkDefault;
|
---|
55 |
|
---|
56 | private:
|
---|
57 | static const Float_t gkCalibConvMinLimit; //! Minimum limit for conv. factor
|
---|
58 | static const Float_t gkCalibConvMaxLimit; //! Maximum limit for conv. factor
|
---|
59 |
|
---|
60 | Float_t fCalibConvMinLimit; // Minimum limit for conv. factor
|
---|
61 | Float_t fCalibConvMaxLimit; // Maximum limit for conv. factor
|
---|
62 |
|
---|
63 | MGeomCam *fGeomCam; //! Camera geometry container
|
---|
64 | MBadPixelsCam *fBadPixels; //! Bad Pixels information
|
---|
65 | MCalibrationChargeCam *fCalibrations; //! Calibration constants
|
---|
66 | MCalibrationQECam *fQEs; //! Quantum efficiencies
|
---|
67 | MExtractedSignalCam *fSignals; //! Integrated charge in FADCs counts
|
---|
68 | MSignalCam *fCerPhotEvt; //! Cerenkov Photon Event used for calculation
|
---|
69 | MCalibConstCam *fCalibConstCam; //! Temporary calib consts storage
|
---|
70 |
|
---|
71 | CalibrationMode_t fCalibrationMode; // Flag defining the calibration mode (CalibrationMode_t)
|
---|
72 | Byte_t fPedestalFlag; // Flags defining to calibrate the pedestal each event or each run
|
---|
73 | Byte_t fSignalType; // Flag defining the signal type (kphot or kphe)
|
---|
74 |
|
---|
75 | Float_t fRenormFactor; // Possible renormalization factor for signals (-> phes)
|
---|
76 | Float_t fScaleFactor; // Possible scale factor for signals
|
---|
77 |
|
---|
78 | TString fFileNameScale; // File name for list of scale factors
|
---|
79 |
|
---|
80 | TList fNamesPedestal; // Names of input and output pedestal conatainer
|
---|
81 | TList fPedestalCams; //! List of pointers to input MPedestalCam
|
---|
82 | TList fPedPhotCams; //! List of pointers to corresponding output MPedPhotCam
|
---|
83 |
|
---|
84 | MArrayF fCalibConsts; //! Array of calibration constants for each pixel, calculated only once!
|
---|
85 | MArrayF fCalibFFactors; //! Array of calibration F-Factors for each pixel, calculated only once!
|
---|
86 | MArrayF fHiLoConv; //! Array of calibration constants for each pixel, calculated only once!
|
---|
87 | MArrayF fHiLoConvErr; //! Array of calibration F-Factors for each pixel, calculated only once!
|
---|
88 |
|
---|
89 | Int_t Calibrate(Bool_t data, Bool_t pedestal) const;
|
---|
90 |
|
---|
91 | Int_t PreProcess(MParList *pList);
|
---|
92 | Bool_t ReInit(MParList *pList);
|
---|
93 | Int_t Process();
|
---|
94 | Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
|
---|
95 | void StreamPrimitive(std::ostream &out) const;
|
---|
96 |
|
---|
97 | public:
|
---|
98 | MCalibrateData(CalibrationMode_t calmode=gkDefault,
|
---|
99 | const char *name=NULL, const char *title=NULL);
|
---|
100 |
|
---|
101 | void AddPedestal(const char *name="Cam");
|
---|
102 | void AddPedestal(const char *pedestal, const char *pedphot);
|
---|
103 |
|
---|
104 | void EnablePedestalType(PedestalType_t i) { fPedestalFlag |= i; }
|
---|
105 |
|
---|
106 | //Int_t GetSize() const { return fCalibConsts.GetSize(); }
|
---|
107 |
|
---|
108 | void Print(Option_t *o="") const;
|
---|
109 |
|
---|
110 | void SetPedestalFlag(PedestalType_t i=kRun) { fPedestalFlag = i; }
|
---|
111 | Bool_t TestPedestalFlag(PedestalType_t i) const { return fPedestalFlag&i ? kTRUE : kFALSE; }
|
---|
112 |
|
---|
113 | void SetCalibrationMode ( CalibrationMode_t calmode=gkDefault) { fCalibrationMode=calmode; }
|
---|
114 | void SetSignalType ( SignalType_t sigtype=kPhe ) { fSignalType =sigtype; }
|
---|
115 |
|
---|
116 | void SetCalibConvMinLimit( const Float_t f=gkCalibConvMinLimit ) { fCalibConvMinLimit = f; }
|
---|
117 | void SetCalibConvMaxLimit( const Float_t f=gkCalibConvMaxLimit ) { fCalibConvMaxLimit = f; }
|
---|
118 |
|
---|
119 | void SetScaleFactor(const Float_t f=1) { fScaleFactor=f; }
|
---|
120 |
|
---|
121 | Bool_t UpdateConversionFactors( const MCalibrationChargeCam *updatecam=NULL);
|
---|
122 |
|
---|
123 | ClassDef(MCalibrateData, 1) // Task to calibrate FADC counts into photons or photo-electrons
|
---|
124 | };
|
---|
125 |
|
---|
126 | #endif /* MCalibrateData */
|
---|