source: trunk/Mars/mcalib/MCalibrationChargeCalc.h@ 11270

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