source: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h@ 8339

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