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