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