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 Check_t
|
---|
97 | {
|
---|
98 | kCheckDeadPixels,
|
---|
99 | kCheckExtractionWindow,
|
---|
100 | kCheckHistOverflow,
|
---|
101 | kCheckDeviatingBehavior,
|
---|
102 | kCheckOscillations
|
---|
103 | }; // Possible Checks
|
---|
104 |
|
---|
105 | Byte_t fCheckFlags; // Bit-field to hold the possible check flags
|
---|
106 |
|
---|
107 | enum { kDebug, kPheFitOK, kFFactorFitOK, kBlindPixelFitOK, kBlindPixelPedFitOK, kPINDiodeFitOK };
|
---|
108 |
|
---|
109 | // functions
|
---|
110 | const char* GetOutputFile();
|
---|
111 | void FinalizePedestals ( const MPedestalPix &ped, MCalibrationChargePix &cal, const Int_t aidx );
|
---|
112 | Bool_t FinalizeCharges ( MCalibrationChargePix &cal, MBadPixelsPix &bad, const char* what);
|
---|
113 | Bool_t FinalizePINDiode ();
|
---|
114 | Bool_t FinalizeBlindPixel ();
|
---|
115 | Bool_t FinalizeBlindCam ();
|
---|
116 | Bool_t FinalizeFFactorMethod ();
|
---|
117 | void FinalizeBadPixels ();
|
---|
118 | void FinalizeFFactorQECam ();
|
---|
119 | void FinalizeBlindPixelQECam ();
|
---|
120 | void FinalizePINDiodeQECam ();
|
---|
121 | void FinalizeCombinedQECam ();
|
---|
122 | void FinalizeUnsuitablePixels();
|
---|
123 |
|
---|
124 | void PrintUncalibrated( MBadPixelsPix::UncalibratedType_t typ, const char *text) const;
|
---|
125 |
|
---|
126 | // Query checks
|
---|
127 | Bool_t IsCheckDeadPixels () const { return TESTBIT(fCheckFlags,kCheckDeadPixels); }
|
---|
128 | Bool_t IsCheckDeviatingBehavior() const { return TESTBIT(fCheckFlags,kCheckDeviatingBehavior); }
|
---|
129 | Bool_t IsCheckExtractionWindow () const { return TESTBIT(fCheckFlags,kCheckExtractionWindow); }
|
---|
130 | Bool_t IsCheckHistOverflow () const { return TESTBIT(fCheckFlags,kCheckHistOverflow); }
|
---|
131 | Bool_t IsCheckOscillations () const { return TESTBIT(fCheckFlags,kCheckOscillations); }
|
---|
132 |
|
---|
133 | // Global fit results
|
---|
134 | void SetPheFitOK ( const Int_t aidx, const Bool_t b=kTRUE ) {
|
---|
135 | b ? SETBIT(fResultFlags[aidx], kPheFitOK)
|
---|
136 | : CLRBIT(fResultFlags[aidx], kPheFitOK); }
|
---|
137 | void SetFFactorFitOK ( const Int_t aidx, const Bool_t b=kTRUE ) {
|
---|
138 | b ? SETBIT(fResultFlags[aidx], kFFactorFitOK)
|
---|
139 | : CLRBIT(fResultFlags[aidx], kFFactorFitOK); }
|
---|
140 | void SetBlindPixelFitOK ( const Int_t idx, const Bool_t b=kTRUE ) {
|
---|
141 | b ? SETBIT(fBlindPixelFlags[idx], kBlindPixelFitOK)
|
---|
142 | : CLRBIT(fBlindPixelFlags[idx], kBlindPixelFitOK); }
|
---|
143 | void SetBlindPixelPedFitOK( const Int_t idx, const Bool_t b=kTRUE ) {
|
---|
144 | b ? SETBIT(fBlindPixelFlags[idx], kBlindPixelPedFitOK)
|
---|
145 | : CLRBIT(fBlindPixelFlags[idx], kBlindPixelPedFitOK); }
|
---|
146 | void SetPINDiodeFitOK ( const Int_t idx, const Bool_t b=kTRUE ) {
|
---|
147 | b ? SETBIT(fPINDiodeFlags[idx], kPINDiodeFitOK)
|
---|
148 | : CLRBIT(fPINDiodeFlags[idx], kPINDiodeFitOK); }
|
---|
149 |
|
---|
150 | Int_t PreProcess (MParList *pList);
|
---|
151 | Bool_t ReInit (MParList *pList);
|
---|
152 | Int_t Process ();
|
---|
153 | Int_t PostProcess();
|
---|
154 | Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
|
---|
155 |
|
---|
156 | public:
|
---|
157 |
|
---|
158 | MCalibrationChargeCalc(const char *name=NULL, const char *title=NULL);
|
---|
159 |
|
---|
160 | void Clear(const Option_t *o="");
|
---|
161 |
|
---|
162 | Bool_t IsDebug() const { return TESTBIT(fFlags,kDebug); }
|
---|
163 |
|
---|
164 | void SetChargeLimit ( const Float_t f=fgChargeLimit ) { fChargeLimit = f; }
|
---|
165 | void SetChargeErrLimit ( const Float_t f=fgChargeErrLimit ) { fChargeErrLimit = f; }
|
---|
166 | void SetChargeRelErrLimit ( const Float_t f=fgChargeRelErrLimit ) { fChargeRelErrLimit = f; }
|
---|
167 |
|
---|
168 | // Checks
|
---|
169 | void SetCheckDeadPixels( const Bool_t b=kTRUE ) {
|
---|
170 | b ? SETBIT(fCheckFlags,kCheckDeadPixels)
|
---|
171 | : CLRBIT(fCheckFlags,kCheckDeadPixels); }
|
---|
172 | void SetCheckDeviatingBehavior( const Bool_t b=kTRUE ) {
|
---|
173 | b ? SETBIT(fCheckFlags,kCheckDeviatingBehavior)
|
---|
174 | : CLRBIT(fCheckFlags,kCheckDeviatingBehavior); }
|
---|
175 | void SetCheckExtractionWindow( const Bool_t b=kTRUE ) {
|
---|
176 | b ? SETBIT(fCheckFlags,kCheckExtractionWindow)
|
---|
177 | : CLRBIT(fCheckFlags,kCheckExtractionWindow); }
|
---|
178 | void SetCheckHistOverflow( const Bool_t b=kTRUE ) {
|
---|
179 | b ? SETBIT(fCheckFlags,kCheckHistOverflow)
|
---|
180 | : CLRBIT(fCheckFlags,kCheckHistOverflow); }
|
---|
181 | void SetCheckOscillations( const Bool_t b=kTRUE ) {
|
---|
182 | b ? SETBIT(fCheckFlags,kCheckOscillations)
|
---|
183 | : CLRBIT(fCheckFlags,kCheckOscillations); }
|
---|
184 |
|
---|
185 | void SetDebug ( const Bool_t b=kTRUE ) { b ? SETBIT(fFlags, kDebug)
|
---|
186 | : CLRBIT(fFlags, kDebug); }
|
---|
187 | void SetFFactorErrLimit ( const Float_t f=fgFFactorErrLimit ) { fFFactorErrLimit = f; }
|
---|
188 | void SetLambdaErrLimit ( const Float_t f=fgLambdaErrLimit ) { fLambdaErrLimit = f; }
|
---|
189 | void SetLambdaCheckLimit ( const Float_t f=fgLambdaCheckLimit ) { fLambdaCheckLimit = f; }
|
---|
190 | void SetOutputPath ( TString path="." );
|
---|
191 | void SetOutputFile ( TString file="ChargeCalibStat.txt" );
|
---|
192 | void SetPheErrLimit ( const Float_t f=fgPheErrLimit ) { fPheErrLimit = f; }
|
---|
193 | void SetPulserColor ( const MCalibrationCam::PulserColor_t col ) { fPulserColor = col; }
|
---|
194 |
|
---|
195 | ClassDef(MCalibrationChargeCalc, 1) // Task calculating Calibration Containers and Quantum Efficiencies
|
---|
196 | };
|
---|
197 |
|
---|
198 | #endif
|
---|