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

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