| 1 | #ifndef MARS_MCalibrationChargeCalc
|
|---|
| 2 | #define MARS_MCalibrationChargeCalc
|
|---|
| 3 |
|
|---|
| 4 | #ifndef MARS_MTask
|
|---|
| 5 | #include "MTask.h"
|
|---|
| 6 | #endif
|
|---|
| 7 |
|
|---|
| 8 | #ifndef ROOT_TArrayC
|
|---|
| 9 | #include <TArrayC.h>
|
|---|
| 10 | #endif
|
|---|
| 11 |
|
|---|
| 12 | #ifndef MARS_MBadPixelsPix
|
|---|
| 13 | #include "MBadPixelsPix.h"
|
|---|
| 14 | #endif
|
|---|
| 15 |
|
|---|
| 16 | #ifndef MARS_MCalibrationCam
|
|---|
| 17 | #include "MCalibrationCam.h"
|
|---|
| 18 | #endif
|
|---|
| 19 |
|
|---|
| 20 | class MCalibrationPattern;
|
|---|
| 21 | class MPedestalCam;
|
|---|
| 22 | class MPedestalPix;
|
|---|
| 23 | class MCalibrationChargePINDiode;
|
|---|
| 24 | class MHCalibrationChargeBlindCam;
|
|---|
| 25 | class MCalibrationIntensityBlindCam;
|
|---|
| 26 | class MCalibrationBlindCam;
|
|---|
| 27 | class MCalibrationChargePix;
|
|---|
| 28 | class MCalibrationIntensityChargeCam;
|
|---|
| 29 | class MCalibrationChargeCam;
|
|---|
| 30 | class MHCalibrationChargeCam;
|
|---|
| 31 | class MCalibrationIntensityQECam;
|
|---|
| 32 | class MCalibrationQECam;
|
|---|
| 33 | class MGeomCam;
|
|---|
| 34 | class MExtractedSignalCam;
|
|---|
| 35 | class MBadPixelsIntensityCam;
|
|---|
| 36 | class MBadPixelsCam;
|
|---|
| 37 | class MExtractor;
|
|---|
| 38 |
|
|---|
| 39 | class MCalibrationChargeCalc : public MTask
|
|---|
| 40 | {
|
|---|
| 41 | private:
|
|---|
| 42 |
|
|---|
| 43 | static const Float_t fgChargeLimit; //! Default for fChargeLimit (now set to: 2.5)
|
|---|
| 44 | static const Float_t fgChargeErrLimit; //! Default for fChargeErrLimit (now set to: 0.)
|
|---|
| 45 | static const Float_t fgChargeRelErrLimit; //! Default for fChargeRelErrLimit (now set to: 1.)
|
|---|
| 46 | static const Float_t fgLambdaCheckLimit; //! Default for fLambdaCheckLimit (now set to: 0.2)
|
|---|
| 47 | static const Float_t fgLambdaErrLimit; //! Default for fLabmdaErrLimit (now set to: 0.5)
|
|---|
| 48 | static const Float_t fgPheErrLowerLimit; //! Default for fPheErrLowerLimit (now set to: 9.0)
|
|---|
| 49 | static const Float_t fgPheErrUpperLimit; //! Default for fPheErrUpperLimit (now set to: 4.5)
|
|---|
| 50 | static const Float_t fgFFactorErrLimit; //! Default for fFFactorErrLimit (now set to: 4.5)
|
|---|
| 51 | static const Float_t fgArrTimeRmsLimit; //! Default for fArrTimeRmsLimit (now set to: 3.5)
|
|---|
| 52 |
|
|---|
| 53 | static const TString fgNamePedestalCam; //! "MPedestalCam"
|
|---|
| 54 |
|
|---|
| 55 | // Variables
|
|---|
| 56 | Float_t fChargeLimit; // Limit acceptance mean charge (in units of PedRMS)
|
|---|
| 57 | Float_t fChargeErrLimit; // Limit acceptance charge error (in abs. numbers)
|
|---|
| 58 | Float_t fChargeRelErrLimit; // Limit acceptance rel. error mean (in abs. numbers)
|
|---|
| 59 | Float_t fLambdaCheckLimit; // Limit rel. diff. lambda and lambdacheck in Blind Pixel
|
|---|
| 60 | Float_t fLambdaErrLimit; // Limit acceptance lambda error in Blind Pixel
|
|---|
| 61 | Float_t fNumHiGainSamples; // Number High-Gain FADC slices used by extractor
|
|---|
| 62 | Float_t fNumLoGainSamples; // Number Low -Gain FADC slices used by extractor
|
|---|
| 63 | Float_t fPheErrLowerLimit; // Lower limit acceptance nr. phe's w.r.t. area idx mean (in sigmas)
|
|---|
| 64 | Float_t fPheErrUpperLimit; // Upper 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 fArrTimeRmsLimit; // Limit acceptance RMS of absolute arrival times
|
|---|
| 67 | Float_t fSqrtHiGainSamples; // Square root nr. High-Gain FADC slices used by extractor
|
|---|
| 68 | Float_t fSqrtLoGainSamples; // Square root nr. Low -Gain FADC slices used by extractor
|
|---|
| 69 |
|
|---|
| 70 | MCalibrationCam::PulserColor_t fPulserColor; // Calibration LEDs colour
|
|---|
| 71 | Float_t fStrength; // Calibration LEDs strength
|
|---|
| 72 |
|
|---|
| 73 | Int_t fNumInnerFFactorMethodUsed; // Number of inner pixels used for F-Factor Method calibration
|
|---|
| 74 |
|
|---|
| 75 | Byte_t fFlags; // Bit-field for the general flags
|
|---|
| 76 | TArrayC fResultFlags; // Bit-fields for the fitting results (one field per area index)
|
|---|
| 77 | TArrayC fBlindPixelFlags; // Bit-fields for the blind pixel flags (one field per blind pixel)
|
|---|
| 78 | TArrayC fPINDiodeFlags; // Bit-fields for the PIN Diode flags (one field per PIN Diode )
|
|---|
| 79 |
|
|---|
| 80 | TString fOutputPath; // Path to the output file
|
|---|
| 81 | TString fOutputFile; // Name of the output file
|
|---|
| 82 | TString fNamePedestalCam; // Name of the 'MPedestalCam' container
|
|---|
| 83 |
|
|---|
| 84 | Int_t fNumProcessed; // Number of processed events (for Intensity calibration)
|
|---|
| 85 | Bool_t fUseExtractorRes; // Include extractor resolution in F-Factor method
|
|---|
| 86 |
|
|---|
| 87 | // Pointers
|
|---|
| 88 | MBadPixelsIntensityCam *fIntensBad; //! Bad Pixels
|
|---|
| 89 | MBadPixelsCam *fBadPixels; //! Bad Pixels
|
|---|
| 90 | MCalibrationIntensityChargeCam *fIntensCam; //! Intensity Calibration results of all pixels
|
|---|
| 91 | MCalibrationChargeCam *fCam; //! Calibrated Charges results of all pixels
|
|---|
| 92 | MHCalibrationChargeCam *fHCam; //! Charges histograms of all pixels
|
|---|
| 93 | MCalibrationIntensityBlindCam *fIntensBlind; //! Intensity Calibration results of the Blind Pixels
|
|---|
| 94 | MCalibrationBlindCam *fBlindCam; //! Calibrated Charges of the Blind Pixels
|
|---|
| 95 | MHCalibrationChargeBlindCam *fHBlindCam; //! Charges histograms of the Blind Pixels
|
|---|
| 96 | MCalibrationChargePINDiode *fPINDiode; //! Calibrated Charges of the PIN Diode
|
|---|
| 97 | MCalibrationIntensityQECam *fIntensQE; //! Intensity Calibration Quantum Efficiencies of all pixels
|
|---|
| 98 | MCalibrationQECam *fQECam; //! Calibrated Quantum Efficiencies of all pixels
|
|---|
| 99 | MGeomCam *fGeom; //! Camera geometry
|
|---|
| 100 | MExtractedSignalCam *fSignal; //! Extracted Signal
|
|---|
| 101 | MCalibrationPattern *fCalibPattern; //! Calibration DM pattern
|
|---|
| 102 | MPedestalCam *fPedestals; //! Pedestals all pixels (calculated previously from ped.file)
|
|---|
| 103 | MExtractor *fExtractor; //! Signal Extractor
|
|---|
| 104 |
|
|---|
| 105 | // enums
|
|---|
| 106 | enum Check_t
|
|---|
| 107 | {
|
|---|
| 108 | kCheckDeadPixels,
|
|---|
| 109 | kCheckExtractionWindow,
|
|---|
| 110 | kCheckHistOverflow,
|
|---|
| 111 | kCheckDeviatingBehavior,
|
|---|
| 112 | kCheckOscillations,
|
|---|
| 113 | kCheckArrivalTimes
|
|---|
| 114 | }; // Possible Checks
|
|---|
| 115 |
|
|---|
| 116 | Byte_t fCheckFlags; // Bit-field to hold the possible check flags
|
|---|
| 117 |
|
|---|
| 118 | enum { kDebug,
|
|---|
| 119 | kPheFitOK, kFFactorFitOK, kBlindPixelFitOK, kBlindPixelPedFitOK, kPINDiodeFitOK };
|
|---|
| 120 |
|
|---|
| 121 | // functions
|
|---|
| 122 | void FinalizePedestals ( const MPedestalPix &ped, MCalibrationChargePix &cal, const Int_t aidx );
|
|---|
| 123 | void FinalizeArrivalTimes ( MCalibrationChargePix &cal, MBadPixelsPix &bad, const char* what);
|
|---|
| 124 | Bool_t FinalizeCharges ( MCalibrationChargePix &cal, MBadPixelsPix &bad, const char* what);
|
|---|
| 125 | Bool_t FinalizePINDiode ();
|
|---|
| 126 | Bool_t FinalizeBlindCam ();
|
|---|
| 127 | Bool_t FinalizeFFactorMethod ();
|
|---|
| 128 | void FinalizeBadPixels ();
|
|---|
| 129 | void FinalizeFFactorQECam ();
|
|---|
| 130 | void FinalizeBlindPixelQECam ();
|
|---|
| 131 | void FinalizePINDiodeQECam ();
|
|---|
| 132 | void FinalizeCombinedQECam ();
|
|---|
| 133 | void FinalizeUnsuitablePixels();
|
|---|
| 134 |
|
|---|
| 135 | const char* GetOutputFile();
|
|---|
| 136 |
|
|---|
| 137 | // Query checks
|
|---|
| 138 | Bool_t IsCheckDeadPixels () const { return TESTBIT(fCheckFlags,kCheckDeadPixels); }
|
|---|
| 139 | Bool_t IsCheckDeviatingBehavior() const { return TESTBIT(fCheckFlags,kCheckDeviatingBehavior); }
|
|---|
| 140 | Bool_t IsCheckExtractionWindow () const { return TESTBIT(fCheckFlags,kCheckExtractionWindow); }
|
|---|
| 141 | Bool_t IsCheckHistOverflow () const { return TESTBIT(fCheckFlags,kCheckHistOverflow); }
|
|---|
| 142 | Bool_t IsCheckOscillations () const { return TESTBIT(fCheckFlags,kCheckOscillations); }
|
|---|
| 143 | Bool_t IsCheckArrivalTimes () const { return TESTBIT(fCheckFlags,kCheckArrivalTimes); }
|
|---|
| 144 |
|
|---|
| 145 | void PrintUncalibrated( MBadPixelsPix::UncalibratedType_t typ, const char *text) const;
|
|---|
| 146 |
|
|---|
| 147 | // Global fit results
|
|---|
| 148 | void SetPheFitOK ( const Int_t aidx, const Bool_t b=kTRUE ) {
|
|---|
| 149 | b ? SETBIT(fResultFlags[aidx], kPheFitOK)
|
|---|
| 150 | : CLRBIT(fResultFlags[aidx], kPheFitOK); }
|
|---|
| 151 | void SetFFactorFitOK ( const Int_t aidx, const Bool_t b=kTRUE ) {
|
|---|
| 152 | b ? SETBIT(fResultFlags[aidx], kFFactorFitOK)
|
|---|
| 153 | : CLRBIT(fResultFlags[aidx], kFFactorFitOK); }
|
|---|
| 154 | void SetBlindPixelFitOK ( const Int_t idx, const Bool_t b=kTRUE ) {
|
|---|
| 155 | b ? SETBIT(fBlindPixelFlags[idx], kBlindPixelFitOK)
|
|---|
| 156 | : CLRBIT(fBlindPixelFlags[idx], kBlindPixelFitOK); }
|
|---|
| 157 | void SetBlindPixelPedFitOK( const Int_t idx, const Bool_t b=kTRUE ) {
|
|---|
| 158 | b ? SETBIT(fBlindPixelFlags[idx], kBlindPixelPedFitOK)
|
|---|
| 159 | : CLRBIT(fBlindPixelFlags[idx], kBlindPixelPedFitOK); }
|
|---|
| 160 | void SetPINDiodeFitOK ( const Int_t idx, const Bool_t b=kTRUE ) {
|
|---|
| 161 | b ? SETBIT(fPINDiodeFlags[idx], kPINDiodeFitOK)
|
|---|
| 162 | : CLRBIT(fPINDiodeFlags[idx], kPINDiodeFitOK); }
|
|---|
| 163 |
|
|---|
| 164 | Int_t PreProcess (MParList *pList);
|
|---|
| 165 | Bool_t ReInit (MParList *pList);
|
|---|
| 166 | Int_t Process ();
|
|---|
| 167 | Int_t PostProcess();
|
|---|
| 168 | Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
|
|---|
| 169 |
|
|---|
| 170 | public:
|
|---|
| 171 |
|
|---|
| 172 | MCalibrationChargeCalc(const char *name=NULL, const char *title=NULL);
|
|---|
| 173 |
|
|---|
| 174 | void Clear(const Option_t *o="");
|
|---|
| 175 |
|
|---|
| 176 | Int_t Finalize();
|
|---|
| 177 |
|
|---|
| 178 | Bool_t IsDebug() const { return TESTBIT(fFlags,kDebug); }
|
|---|
| 179 |
|
|---|
| 180 | void SetChargeLimit ( const Float_t f=fgChargeLimit ) { fChargeLimit = f; }
|
|---|
| 181 | void SetChargeErrLimit ( const Float_t f=fgChargeErrLimit ) { fChargeErrLimit = f; }
|
|---|
| 182 | void SetChargeRelErrLimit ( const Float_t f=fgChargeRelErrLimit ) { fChargeRelErrLimit = f; }
|
|---|
| 183 |
|
|---|
| 184 | // Checks
|
|---|
| 185 | void SetCheckArrivalTimes( const Bool_t b=kTRUE ) {
|
|---|
| 186 | b ? SETBIT(fCheckFlags,kCheckArrivalTimes)
|
|---|
| 187 | : CLRBIT(fCheckFlags,kCheckArrivalTimes); }
|
|---|
| 188 | void SetCheckDeadPixels( const Bool_t b=kTRUE ) {
|
|---|
| 189 | b ? SETBIT(fCheckFlags,kCheckDeadPixels)
|
|---|
| 190 | : CLRBIT(fCheckFlags,kCheckDeadPixels); }
|
|---|
| 191 | void SetCheckDeviatingBehavior( const Bool_t b=kTRUE ) {
|
|---|
| 192 | b ? SETBIT(fCheckFlags,kCheckDeviatingBehavior)
|
|---|
| 193 | : CLRBIT(fCheckFlags,kCheckDeviatingBehavior); }
|
|---|
| 194 | void SetCheckExtractionWindow( const Bool_t b=kTRUE ) {
|
|---|
| 195 | b ? SETBIT(fCheckFlags,kCheckExtractionWindow)
|
|---|
| 196 | : CLRBIT(fCheckFlags,kCheckExtractionWindow); }
|
|---|
| 197 | void SetCheckHistOverflow( const Bool_t b=kTRUE ) {
|
|---|
| 198 | b ? SETBIT(fCheckFlags,kCheckHistOverflow)
|
|---|
| 199 | : CLRBIT(fCheckFlags,kCheckHistOverflow); }
|
|---|
| 200 | void SetCheckOscillations( const Bool_t b=kTRUE ) {
|
|---|
| 201 | b ? SETBIT(fCheckFlags,kCheckOscillations)
|
|---|
| 202 | : CLRBIT(fCheckFlags,kCheckOscillations); }
|
|---|
| 203 | void SetDebug ( const Bool_t b=kTRUE ) {
|
|---|
| 204 | b ? SETBIT(fFlags, kDebug)
|
|---|
| 205 | : CLRBIT(fFlags, kDebug); }
|
|---|
| 206 |
|
|---|
| 207 | void SetExtractor(MExtractor *ext) { fExtractor=ext; }
|
|---|
| 208 | void SetPedestals(MPedestalCam *cam) { fPedestals=cam; }
|
|---|
| 209 |
|
|---|
| 210 | void SetArrTimeRmsLimit ( const Float_t f=fgArrTimeRmsLimit ) { fArrTimeRmsLimit = f; }
|
|---|
| 211 | void SetFFactorErrLimit ( const Float_t f=fgFFactorErrLimit ) { fFFactorErrLimit = f; }
|
|---|
| 212 | void SetLambdaErrLimit ( const Float_t f=fgLambdaErrLimit ) { fLambdaErrLimit = f; }
|
|---|
| 213 | void SetLambdaCheckLimit ( const Float_t f=fgLambdaCheckLimit ) { fLambdaCheckLimit = f; }
|
|---|
| 214 | void SetNamePedestalCam ( const char *name=fgNamePedestalCam.Data()) { fNamePedestalCam = name; }
|
|---|
| 215 | void SetOutputPath ( TString path="." );
|
|---|
| 216 | void SetOutputFile ( TString file="ChargeCalibStat.txt" );
|
|---|
| 217 | void SetPheErrLowerLimit ( const Float_t f=fgPheErrLowerLimit ) { fPheErrLowerLimit = f; }
|
|---|
| 218 | void SetPheErrUpperLimit ( const Float_t f=fgPheErrUpperLimit ) { fPheErrUpperLimit = f; }
|
|---|
| 219 | void SetPulserColor ( const MCalibrationCam::PulserColor_t col ) { fPulserColor = col; }
|
|---|
| 220 | void SetUseExtractorRes(Bool_t b=kTRUE) { fUseExtractorRes = b; }
|
|---|
| 221 |
|
|---|
| 222 | ClassDef(MCalibrationChargeCalc, 3) // Task calculating Calibration Containers and Quantum Efficiencies
|
|---|
| 223 | };
|
|---|
| 224 |
|
|---|
| 225 | #endif
|
|---|