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