| 1 | #ifndef MARS_MCalibrationChargeCalc
|
|---|
| 2 | #define MARS_MCalibrationChargeCalc
|
|---|
| 3 |
|
|---|
| 4 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 5 | // //
|
|---|
| 6 | // MCalibrationChargeCalc //
|
|---|
| 7 | // //
|
|---|
| 8 | // Integrates the time slices of the all pixels of a calibration event //
|
|---|
| 9 | // and substract the pedestal value //
|
|---|
| 10 | // //
|
|---|
| 11 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 12 |
|
|---|
| 13 | #ifndef MARS_MTask
|
|---|
| 14 | #include "MTask.h"
|
|---|
| 15 | #endif
|
|---|
| 16 |
|
|---|
| 17 | #ifndef MARS_MBadPixelsPix
|
|---|
| 18 | #include "MBadPixelsPix.h"
|
|---|
| 19 | #endif
|
|---|
| 20 |
|
|---|
| 21 | #ifndef MARS_MCalibrationCam
|
|---|
| 22 | #include "MCalibrationCam.h"
|
|---|
| 23 | #endif
|
|---|
| 24 |
|
|---|
| 25 | #ifndef ROOT_TArrayC
|
|---|
| 26 | #include <TArrayC.h>
|
|---|
| 27 | #endif
|
|---|
| 28 |
|
|---|
| 29 | class MRawEvtHeader;
|
|---|
| 30 | class MPedestalCam;
|
|---|
| 31 | class MPedestalPix;
|
|---|
| 32 | class MCalibrationChargePINDiode;
|
|---|
| 33 | class MCalibrationChargeBlindCam;
|
|---|
| 34 | class MCalibrationChargeBlindPix;
|
|---|
| 35 | class MCalibrationChargePix;
|
|---|
| 36 | class MCalibrationChargeCam;
|
|---|
| 37 | class MCalibrationIntensityChargeCam;
|
|---|
| 38 | class MCalibrationQECam;
|
|---|
| 39 | class MGeomCam;
|
|---|
| 40 | class MExtractedSignalCam;
|
|---|
| 41 | class MBadPixelsCam;
|
|---|
| 42 | class MTime;
|
|---|
| 43 |
|
|---|
| 44 | class MCalibrationChargeCalc : public MTask
|
|---|
| 45 | {
|
|---|
| 46 | private:
|
|---|
| 47 |
|
|---|
| 48 | static const Float_t fgChargeLimit; //! Default for fChargeLimit (now set to: 2.5)
|
|---|
| 49 | static const Float_t fgChargeErrLimit; //! Default for fChargeErrLimit (now set to: 0.)
|
|---|
| 50 | static const Float_t fgChargeRelErrLimit; //! Default for fChargeRelErrLimit (now set to: 1.)
|
|---|
| 51 | static const Float_t fgLambdaCheckLimit; //! Default for fLambdaCheckLimit (now set to: 0.2)
|
|---|
| 52 | static const Float_t fgLambdaErrLimit; //! Default for fLabmdaErrLimit (now set to: 0.5)
|
|---|
| 53 | static const Float_t fgPheErrLimit; //! Default for fPheErrLimit (now set to: 4.5)
|
|---|
| 54 | static const Float_t fgFFactorErrLimit; //! Default for fFFactorErrLimit (now set to: 4.5)
|
|---|
| 55 |
|
|---|
| 56 | // Variables
|
|---|
| 57 | Float_t fChargeLimit; // Limit acceptance mean charge (in units of PedRMS)
|
|---|
| 58 | Float_t fChargeErrLimit; // Limit acceptance charge error (in abs. numbers)
|
|---|
| 59 | Float_t fChargeRelErrLimit; // Limit acceptance rel. error mean (in abs. numbers)
|
|---|
| 60 | Float_t fLambdaCheckLimit; // Limit rel. diff. lambda and lambdacheck in Blind Pixel
|
|---|
| 61 | Float_t fLambdaErrLimit; // Limit acceptance lambda error in Blind Pixel
|
|---|
| 62 | Float_t fNumHiGainSamples; // Number High-Gain FADC slices used by extractor
|
|---|
| 63 | Float_t fNumLoGainSamples; // Number Low -Gain FADC slices used by extractor
|
|---|
| 64 | Float_t fPheErrLimit; // Limit acceptance nr. phe's w.r.t. area idx mean (in sigmas)
|
|---|
| 65 | Float_t fFFactorErrLimit; // Limit acceptance F-Factor w.r.t. area idx mean
|
|---|
| 66 | Float_t fSqrtHiGainSamples; // Square root nr. High-Gain FADC slices used by extractor
|
|---|
| 67 | Float_t fSqrtLoGainSamples; // Square root nr. Low -Gain FADC slices used by extractor
|
|---|
| 68 |
|
|---|
| 69 | MCalibrationCam::PulserColor_t fPulserColor; // Calibration LEDs colour
|
|---|
| 70 | UInt_t fPulserPattern; // Calibration LEDs Pulser Pattern
|
|---|
| 71 |
|
|---|
| 72 | Int_t fNumInnerFFactorMethodUsed; // Number of inner pixels used for F-Factor Method calibration
|
|---|
| 73 |
|
|---|
| 74 | Byte_t fFlags; // Bit-field for the general flags
|
|---|
| 75 | TArrayC fResultFlags; // Bit-fields for the fitting results (one field per area index)
|
|---|
| 76 | TArrayC fBlindPixelFlags; // Bit-fields for the blind pixel flags (one field per blind pixel)
|
|---|
| 77 | TArrayC fPINDiodeFlags; // Bit-fields for the PIN Diode flags (one field per PIN Diode )
|
|---|
| 78 |
|
|---|
| 79 | TString fOutputPath; // Path to the output file
|
|---|
| 80 | TString fOutputFile; // Name of the output file
|
|---|
| 81 |
|
|---|
| 82 | // Pointers
|
|---|
| 83 | MBadPixelsCam *fBadPixels; // Bad Pixels
|
|---|
| 84 | MCalibrationIntensityChargeCam *fIntensCam; // Calibrated Charges of all pixels
|
|---|
| 85 | MCalibrationChargeCam *fCam; // Calibrated Charges of all pixels
|
|---|
| 86 | MCalibrationChargeBlindPix *fBlindPixel; // Calibrated Charges of the Blind Pixel
|
|---|
| 87 | MCalibrationChargeBlindCam *fBlindCam; // Calibrated Charges of the Blind Pixels
|
|---|
| 88 | MCalibrationChargePINDiode *fPINDiode; // Calibrated Charges of the PIN Diode
|
|---|
| 89 | MCalibrationQECam *fQECam; // Calibrated Quantum Efficiencies of all pixels
|
|---|
| 90 | MGeomCam *fGeom; //! Camera geometry
|
|---|
| 91 | MExtractedSignalCam *fSignal; //! Extracted Signal
|
|---|
| 92 | MRawEvtHeader *fHeader; //! Event header
|
|---|
| 93 | MPedestalCam *fPedestals; //! Pedestals all pixels (calculated previously from ped.file)
|
|---|
| 94 |
|
|---|
| 95 | // enums
|
|---|
| 96 | enum { kDebug, kPheFitOK, kFFactorFitOK, kBlindPixelFitOK, kBlindPixelPedFitOK, kPINDiodeFitOK };
|
|---|
| 97 |
|
|---|
| 98 | // functions
|
|---|
| 99 | const char* GetOutputFile();
|
|---|
| 100 | void FinalizePedestals ( const MPedestalPix &ped, MCalibrationChargePix &cal, const Int_t aidx );
|
|---|
| 101 | Bool_t FinalizeCharges ( MCalibrationChargePix &cal, MBadPixelsPix &bad, const char* what);
|
|---|
| 102 | Bool_t FinalizePINDiode ();
|
|---|
| 103 | Bool_t FinalizeBlindPixel ();
|
|---|
| 104 | Bool_t FinalizeBlindCam ();
|
|---|
| 105 | Bool_t FinalizeFFactorMethod ();
|
|---|
| 106 | void FinalizeBadPixels ();
|
|---|
| 107 | void FinalizeFFactorQECam ();
|
|---|
| 108 | void FinalizeBlindPixelQECam ();
|
|---|
| 109 | void FinalizePINDiodeQECam ();
|
|---|
| 110 | void FinalizeCombinedQECam ();
|
|---|
| 111 | void FinalizeUnsuitablePixels();
|
|---|
| 112 |
|
|---|
| 113 | void PrintUncalibrated( MBadPixelsPix::UncalibratedType_t typ, const char *text) const;
|
|---|
| 114 |
|
|---|
| 115 | void SetPheFitOK ( const Int_t aidx, const Bool_t b=kTRUE ) {
|
|---|
| 116 | b ? SETBIT(fResultFlags[aidx], kPheFitOK)
|
|---|
| 117 | : CLRBIT(fResultFlags[aidx], kPheFitOK); }
|
|---|
| 118 | void SetFFactorFitOK ( const Int_t aidx, const Bool_t b=kTRUE ) {
|
|---|
| 119 | b ? SETBIT(fResultFlags[aidx], kFFactorFitOK)
|
|---|
| 120 | : CLRBIT(fResultFlags[aidx], kFFactorFitOK); }
|
|---|
| 121 | void SetBlindPixelFitOK ( const Int_t idx, const Bool_t b=kTRUE ) {
|
|---|
| 122 | b ? SETBIT(fBlindPixelFlags[idx], kBlindPixelFitOK)
|
|---|
| 123 | : CLRBIT(fBlindPixelFlags[idx], kBlindPixelFitOK); }
|
|---|
| 124 | void SetBlindPixelPedFitOK( const Int_t idx, const Bool_t b=kTRUE ) {
|
|---|
| 125 | b ? SETBIT(fBlindPixelFlags[idx], kBlindPixelPedFitOK)
|
|---|
| 126 | : CLRBIT(fBlindPixelFlags[idx], kBlindPixelPedFitOK); }
|
|---|
| 127 | void SetPINDiodeFitOK ( const Int_t idx, const Bool_t b=kTRUE ) {
|
|---|
| 128 | b ? SETBIT(fPINDiodeFlags[idx], kPINDiodeFitOK)
|
|---|
| 129 | : CLRBIT(fPINDiodeFlags[idx], kPINDiodeFitOK); }
|
|---|
| 130 |
|
|---|
| 131 | Int_t PreProcess (MParList *pList);
|
|---|
| 132 | Bool_t ReInit (MParList *pList);
|
|---|
| 133 | Int_t Process ();
|
|---|
| 134 | Int_t PostProcess();
|
|---|
| 135 | Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
|
|---|
| 136 |
|
|---|
| 137 | public:
|
|---|
| 138 |
|
|---|
| 139 | MCalibrationChargeCalc(const char *name=NULL, const char *title=NULL);
|
|---|
| 140 |
|
|---|
| 141 | void Clear(const Option_t *o="");
|
|---|
| 142 |
|
|---|
| 143 | Bool_t IsDebug() const { return TESTBIT(fFlags,kDebug); }
|
|---|
| 144 |
|
|---|
| 145 | void SetChargeLimit ( const Float_t f=fgChargeLimit ) { fChargeLimit = f; }
|
|---|
| 146 | void SetChargeErrLimit ( const Float_t f=fgChargeErrLimit ) { fChargeErrLimit = f; }
|
|---|
| 147 | void SetChargeRelErrLimit ( const Float_t f=fgChargeRelErrLimit ) { fChargeRelErrLimit = f; }
|
|---|
| 148 | void SetDebug ( const Bool_t b=kTRUE ) { b ? SETBIT(fFlags, kDebug)
|
|---|
| 149 | : CLRBIT(fFlags, kDebug); }
|
|---|
| 150 | void SetFFactorErrLimit ( const Float_t f=fgFFactorErrLimit ) { fFFactorErrLimit = f; }
|
|---|
| 151 | void SetLambdaErrLimit ( const Float_t f=fgLambdaErrLimit ) { fLambdaErrLimit = f; }
|
|---|
| 152 | void SetLambdaCheckLimit ( const Float_t f=fgLambdaCheckLimit ) { fLambdaCheckLimit = f; }
|
|---|
| 153 | void SetOutputPath ( TString path="." );
|
|---|
| 154 | void SetOutputFile ( TString file="ChargeCalibStat.txt" );
|
|---|
| 155 | void SetPheErrLimit ( const Float_t f=fgPheErrLimit ) { fPheErrLimit = f; }
|
|---|
| 156 | void SetPulserColor ( const MCalibrationCam::PulserColor_t col ) { fPulserColor = col; }
|
|---|
| 157 |
|
|---|
| 158 |
|
|---|
| 159 | ClassDef(MCalibrationChargeCalc, 1) // Task calculating Calibration Containers and Quantum Efficiencies
|
|---|
| 160 | };
|
|---|
| 161 |
|
|---|
| 162 | #endif
|
|---|