1 | #ifndef MARS_MCalibrateData
|
---|
2 | #define MARS_MCalibrateData
|
---|
3 |
|
---|
4 | /////////////////////////////////////////////////////////////////////////////
|
---|
5 | // //
|
---|
6 | // MCalibrateData //
|
---|
7 | // //
|
---|
8 | // Integrates the desired ADC time slices of one pixel and apply //
|
---|
9 | // calibration constants //
|
---|
10 | // //
|
---|
11 | // Differences between MCalibrateData and MCalibrate : //
|
---|
12 | // in MCalibrateData //
|
---|
13 | // - in ReInit the MPedPhot container is filled using //
|
---|
14 | // - the pedstals/slice from MPedestalCam //
|
---|
15 | // - the number of used FADC slices from MExtractedSignalCam //
|
---|
16 | // - the photon/ADC conversion factor from MCalibrationCam //
|
---|
17 | // //
|
---|
18 | /////////////////////////////////////////////////////////////////////////////
|
---|
19 | #ifndef MARS_MTask
|
---|
20 | #include "MTask.h"
|
---|
21 | #endif
|
---|
22 |
|
---|
23 | #ifndef MARS_MArrayF
|
---|
24 | #include "MArrayF.h"
|
---|
25 | #endif
|
---|
26 |
|
---|
27 | #ifndef MARS_MCamEvent
|
---|
28 | #include "MCamEvent.h"
|
---|
29 | #endif
|
---|
30 |
|
---|
31 | class MGeomCam;
|
---|
32 | class MBadPixelsCam;
|
---|
33 | class MPedestalCam;
|
---|
34 | class MCalibrationChargeCam;
|
---|
35 | class MCalibrationQECam;
|
---|
36 | class MExtractedSignalCam;
|
---|
37 |
|
---|
38 | class MPedPhotCam;
|
---|
39 | class MCerPhotEvt;
|
---|
40 |
|
---|
41 | class MCalibrateData : public MTask, public MCamEvent
|
---|
42 | {
|
---|
43 | private:
|
---|
44 |
|
---|
45 | MGeomCam *fGeomCam; //! Camera geometry container
|
---|
46 | MBadPixelsCam *fBadPixels; //! Bad Pixels information
|
---|
47 | MCalibrationChargeCam *fCalibrations; //! Calibration constants
|
---|
48 | MCalibrationChargeCam *fCalibUpdate; //! Calibration constants update (for interlaced cal events)
|
---|
49 | MCalibrationQECam *fQEs; //! Quantum efficiencies
|
---|
50 | MExtractedSignalCam *fSignals; //! Integrated charge in FADCs counts
|
---|
51 | MCerPhotEvt *fCerPhotEvt; //! Cerenkov Photon Event used for calculation
|
---|
52 |
|
---|
53 | UShort_t fCalibrationMode; // Flag defining the calibration mode (CalibrationMode_t)
|
---|
54 | Byte_t fPedestalFlag; // Flags defining to calibrate the pedestal each event or each run
|
---|
55 | Byte_t fSignalType; // Flag defining the signal type (kphot or kphe)
|
---|
56 |
|
---|
57 | Float_t fRenormFactor; // Possible renormalization factor for signals (-> phes)
|
---|
58 |
|
---|
59 | TList fNamesPedestal; // Names of input and output pedestal conatainer
|
---|
60 | TList fPedestalCams; //! List of pointers to input MPedestalCam
|
---|
61 | TList fPedPhotCams; //! List of pointers to corresponding output MPedPhotCam
|
---|
62 |
|
---|
63 | MArrayF fCalibConsts; //! Array of calibration constants for each pixel, calculated only once!
|
---|
64 | MArrayF fCalibFFactors; //! Array of calibration F-Factors for each pixel, calculated only once!
|
---|
65 | MArrayF fHiLoConv; //! Array of calibration constants for each pixel, calculated only once!
|
---|
66 | MArrayF fHiLoConvErr; //! Array of calibration F-Factors for each pixel, calculated only once!
|
---|
67 |
|
---|
68 | Int_t Calibrate(Bool_t data, Bool_t pedestal) const;
|
---|
69 |
|
---|
70 | Int_t PreProcess(MParList *pList);
|
---|
71 | Bool_t ReInit(MParList *pList);
|
---|
72 | Int_t Process();
|
---|
73 | Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
|
---|
74 | void StreamPrimitive(ofstream &out) const;
|
---|
75 |
|
---|
76 | public:
|
---|
77 |
|
---|
78 | enum CalibrationMode_t
|
---|
79 | {
|
---|
80 | kSkip = 0,
|
---|
81 | kNone = 1,
|
---|
82 | kFlatCharge = 2,
|
---|
83 | kBlindPixel = 3,
|
---|
84 | kFfactor = 4,
|
---|
85 | kPinDiode = 5,
|
---|
86 | kCombined = 6,
|
---|
87 | kDummy = 7
|
---|
88 | };
|
---|
89 |
|
---|
90 | static const CalibrationMode_t kDefault = kFfactor;
|
---|
91 |
|
---|
92 | enum PedestalType_t
|
---|
93 | {
|
---|
94 | kNo = BIT(0),
|
---|
95 | kRun = BIT(1),
|
---|
96 | kEvent = BIT(2)
|
---|
97 | };
|
---|
98 |
|
---|
99 | enum SignalType_t
|
---|
100 | {
|
---|
101 | kPhe,
|
---|
102 | kPhot
|
---|
103 | };
|
---|
104 |
|
---|
105 | MCalibrateData(CalibrationMode_t calmode=kDefault,
|
---|
106 | const char *name=NULL, const char *title=NULL);
|
---|
107 |
|
---|
108 | void AddPedestal(const char *name="Cam");
|
---|
109 | void AddPedestal(const char *pedestal, const char *pedphot);
|
---|
110 |
|
---|
111 | void EnablePedestalType(PedestalType_t i) { fPedestalFlag |= i; }
|
---|
112 |
|
---|
113 | Int_t GetSize() const { return fCalibConsts.GetSize(); }
|
---|
114 |
|
---|
115 | void Print(Option_t *o="") const;
|
---|
116 |
|
---|
117 | void SetPedestalFlag(PedestalType_t i=kRun) { fPedestalFlag = i; }
|
---|
118 | Bool_t TestPedestalFlag(PedestalType_t i) const { return fPedestalFlag&i ? kTRUE : kFALSE; }
|
---|
119 |
|
---|
120 | void SetCalibrationMode ( CalibrationMode_t calmode=kDefault ) { fCalibrationMode=calmode; }
|
---|
121 | void SetSignalType ( SignalType_t sigtype=kPhot ) { fSignalType =sigtype; }
|
---|
122 |
|
---|
123 | void SetCalibUpdate ( MCalibrationChargeCam *cam=NULL ) { fCalibUpdate = cam; }
|
---|
124 |
|
---|
125 | Bool_t UpdateConversionFactors();
|
---|
126 |
|
---|
127 | Bool_t GetPixelContent ( Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0 ) const;
|
---|
128 | void DrawPixelContent( Int_t num) const;
|
---|
129 |
|
---|
130 | ClassDef(MCalibrateData, 1) // Task to calibrate FADC counts into Cherenkov photons
|
---|
131 | };
|
---|
132 |
|
---|
133 | #endif /* MCalibrateData */
|
---|
134 |
|
---|
135 |
|
---|
136 |
|
---|
137 |
|
---|
138 |
|
---|
139 |
|
---|