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

Last change on this file since 7599 was 7288, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 13.2 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 fOutputPath; // Path to the output file
83 TString fOutputFile; // Name of the output file
84 TString fNamePedestalCam; // Name of the 'MPedestalCam' container
85
86 Int_t fNumProcessed; // Number of processed events (for Intensity calibration)
87
88 // Pointers
89 MBadPixelsIntensityCam *fIntensBad; //! Bad Pixels
90 MBadPixelsCam *fBadPixels; //! Bad Pixels
91 MCalibrationIntensityChargeCam *fIntensCam; //! Intensity Calibration results of all pixels
92 MCalibrationChargeCam *fCam; //! Calibrated Charges results of all pixels
93 MHCalibrationChargeCam *fHCam; //! Charges histograms of all pixels
94 MCalibrationIntensityBlindCam *fIntensBlind; //! Intensity Calibration results of the Blind Pixels
95 MCalibrationBlindCam *fBlindCam; //! Calibrated Charges of the Blind Pixels
96 MHCalibrationChargeBlindCam *fHBlindCam; //! Charges histograms of the Blind Pixels
97 MCalibrationChargePINDiode *fPINDiode; //! Calibrated Charges of the PIN Diode
98 MCalibrationIntensityQECam *fIntensQE; //! Intensity Calibration Quantum Efficiencies of all pixels
99 MCalibrationQECam *fQECam; //! Calibrated Quantum Efficiencies of all pixels
100 MGeomCam *fGeom; //! Camera geometry
101 MExtractedSignalCam *fSignal; //! Extracted Signal
102 MCalibrationPattern *fCalibPattern; //! Calibration DM pattern
103 MPedestalCam *fPedestals; //! Pedestals all pixels (calculated previously from ped.file)
104 MExtractor *fExtractor; //! Signal Extractor
105
106 // enums
107 enum Check_t
108 {
109 kCheckDeadPixels,
110 kCheckExtractionWindow,
111 kCheckHistOverflow,
112 kCheckDeviatingBehavior,
113 kCheckOscillations,
114 kCheckArrivalTimes
115 }; // Possible Checks
116
117 Byte_t fCheckFlags; // Bit-field to hold the possible check flags
118
119 enum FitResult_t { kPheFitOK,
120 kFFactorFitOK,
121 kBlindPixelFitOK,
122 kBlindPixelPedFitOK,
123 kPINDiodeFitOK }; // Possible Fit Result flags
124
125 TArrayC fResultFlags; // Bit-fields for the fitting results (one field per area index)
126 TArrayC fBlindPixelFlags; // Bit-fields for the blind pixel flags (one field per blind pixel)
127 TArrayC fPINDiodeFlags; // Bit-fields for the PIN Diode flags (one field per PIN Diode )
128
129 enum { kDebug,
130 kUseExtractorRes,
131 kUseUnreliables,
132 kUseExternalNumPhes }; // Possible general flags
133
134 Byte_t fFlags; // Bit-field to hold the general flags
135
136 // functions
137 void FinalizeArrivalTimes ( MCalibrationChargePix &cal, MBadPixelsPix &bad, const char* what);
138 void FinalizeBadPixels ();
139 Bool_t FinalizeBlindCam ();
140 void FinalizeBlindPixelQECam ();
141 Bool_t FinalizeCharges ( MCalibrationChargePix &cal, MBadPixelsPix &bad, const char* what);
142 void FinalizeCombinedQECam ();
143 void FinalizeFFactorQECam ();
144 Bool_t FinalizeFFactorMethod ();
145 void FinalizePedestals ( const MPedestalPix &ped, MCalibrationChargePix &cal, const Int_t aidx );
146 Bool_t FinalizePINDiode ();
147 void FinalizePINDiodeQECam ();
148 Bool_t FinalizeUnsuitablePixels();
149
150 const char* GetOutputFile();
151
152 // Query checks
153 Bool_t IsCheckDeadPixels () const { return TESTBIT(fCheckFlags,kCheckDeadPixels); }
154 Bool_t IsCheckDeviatingBehavior() const { return TESTBIT(fCheckFlags,kCheckDeviatingBehavior); }
155 Bool_t IsCheckExtractionWindow () const { return TESTBIT(fCheckFlags,kCheckExtractionWindow); }
156 Bool_t IsCheckHistOverflow () const { return TESTBIT(fCheckFlags,kCheckHistOverflow); }
157 Bool_t IsCheckOscillations () const { return TESTBIT(fCheckFlags,kCheckOscillations); }
158 Bool_t IsCheckArrivalTimes () const { return TESTBIT(fCheckFlags,kCheckArrivalTimes); }
159
160 Bool_t IsDebug () const { return TESTBIT(fFlags,kDebug); }
161 Bool_t IsUseExtractorRes () const { return TESTBIT(fFlags,kUseExtractorRes); }
162 Bool_t IsUseUnreliables () const { return TESTBIT(fFlags,kUseUnreliables); }
163 Bool_t IsUseExternalNumPhes () const { return TESTBIT(fFlags,kUseExternalNumPhes); }
164
165 void PrintUncalibrated( MBadPixelsPix::UncalibratedType_t typ, const char *text) const;
166
167 // Global fit results
168 void SetPheFitOK (const Int_t aidx, const Bool_t b=kTRUE) { b ? SETBIT(fResultFlags[aidx], kPheFitOK) : CLRBIT(fResultFlags[aidx], kPheFitOK); }
169 void SetFFactorFitOK (const Int_t aidx, const Bool_t b=kTRUE) { b ? SETBIT(fResultFlags[aidx], kFFactorFitOK) : CLRBIT(fResultFlags[aidx], kFFactorFitOK); }
170 void SetBlindPixelFitOK (const Int_t idx, const Bool_t b=kTRUE) { b ? SETBIT(fBlindPixelFlags[idx], kBlindPixelFitOK) : CLRBIT(fBlindPixelFlags[idx], kBlindPixelFitOK); }
171 void SetBlindPixelPedFitOK(const Int_t idx, const Bool_t b=kTRUE) { b ? SETBIT(fBlindPixelFlags[idx], kBlindPixelPedFitOK): CLRBIT(fBlindPixelFlags[idx], kBlindPixelPedFitOK); }
172 void SetPINDiodeFitOK (const Int_t idx, const Bool_t b=kTRUE) { b ? SETBIT(fPINDiodeFlags[idx], kPINDiodeFitOK): CLRBIT(fPINDiodeFlags[idx], kPINDiodeFitOK); }
173
174 Int_t PreProcess (MParList *pList);
175 Bool_t ReInit (MParList *pList);
176 Int_t Process ();
177 Int_t PostProcess();
178 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
179
180public:
181 MCalibrationChargeCalc(const char *name=NULL, const char *title=NULL);
182
183 void Clear(const Option_t *o="");
184
185 void ResetNumProcessed() { fNumProcessed=0; }
186
187 Int_t Finalize();
188
189 void SetChargeLimit (const Float_t f=fgChargeLimit ) { fChargeLimit = f; }
190 void SetChargeErrLimit (const Float_t f=fgChargeErrLimit ) { fChargeErrLimit = f; }
191 void SetChargeRelErrLimit(const Float_t f=fgChargeRelErrLimit) { fChargeRelErrLimit = f; }
192
193 // Checks
194 void SetCheckArrivalTimes(const Bool_t b=kTRUE) { b ? SETBIT(fCheckFlags,kCheckArrivalTimes) : CLRBIT(fCheckFlags,kCheckArrivalTimes); }
195 void SetCheckDeadPixels(const Bool_t b=kTRUE) { b ? SETBIT(fCheckFlags,kCheckDeadPixels) : CLRBIT(fCheckFlags,kCheckDeadPixels); }
196 void SetCheckDeviatingBehavior(const Bool_t b=kTRUE) { b ? SETBIT(fCheckFlags,kCheckDeviatingBehavior) : CLRBIT(fCheckFlags,kCheckDeviatingBehavior); }
197 void SetCheckExtractionWindow(const Bool_t b=kTRUE) { b ? SETBIT(fCheckFlags,kCheckExtractionWindow) : CLRBIT(fCheckFlags,kCheckExtractionWindow); }
198 void SetCheckHistOverflow(const Bool_t b=kTRUE) { b ? SETBIT(fCheckFlags,kCheckHistOverflow) : CLRBIT(fCheckFlags,kCheckHistOverflow); }
199 void SetCheckOscillations(const Bool_t b=kTRUE) { b ? SETBIT(fCheckFlags,kCheckOscillations) : CLRBIT(fCheckFlags,kCheckOscillations); }
200 void SetDebug(const Bool_t b=kTRUE) { b ? SETBIT(fFlags, kDebug) : CLRBIT(fFlags, kDebug); }
201 void SetUseExtractorRes(const Bool_t b=kTRUE) { b ? SETBIT(fFlags, kUseExtractorRes) : CLRBIT(fFlags, kUseExtractorRes); }
202 void SetUseUnreliables(const Bool_t b=kTRUE) { b ? SETBIT(fFlags, kUseUnreliables) : CLRBIT(fFlags, kUseUnreliables); }
203 void SetUseExternalNumPhes(const Bool_t b=kTRUE) { b ? SETBIT(fFlags, kUseExternalNumPhes) : CLRBIT(fFlags, kUseExternalNumPhes); }
204
205 // pointers
206 void SetPedestals(MPedestalCam *cam) { fPedestals=cam; }
207 void SetExtractor(MExtractor *ext) { fExtractor=ext; }
208
209 // limits
210 void SetArrTimeRmsLimit (const Float_t f=fgArrTimeRmsLimit ) { fArrTimeRmsLimit = f; }
211 void SetFFactorErrLimit (const Float_t f=fgFFactorErrLimit ) { fFFactorErrLimit = f; }
212 void SetLambdaErrLimit (const Float_t f=fgLambdaErrLimit ) { fLambdaErrLimit = f; }
213 void SetLambdaCheckLimit(const Float_t f=fgLambdaCheckLimit) { fLambdaCheckLimit = f; }
214 void SetUnsuitablesLimit(const Float_t f=fgUnsuitablesLimit) { fUnsuitablesLimit = f; }
215 void SetUnreliablesLimit(const Float_t f=fgUnreliablesLimit) { fUnreliablesLimit = f; }
216
217 // others
218 void SetExternalNumPhes ( const Float_t f=0. ) { fExternalNumPhes = f; }
219 void SetExternalNumPhesRelVar( const Float_t f=0. ) { fExternalNumPhesRelVar = f; }
220 void SetNamePedestalCam ( const char *name=fgNamePedestalCam.Data()) { fNamePedestalCam = name; }
221 void SetOutputPath ( const TString path="." );
222 void SetOutputFile ( const TString file="ChargeCalibStat.txt" );
223 void SetPheErrLowerLimit ( const Float_t f=fgPheErrLowerLimit ) { fPheErrLowerLimit = f; }
224 void SetPheErrUpperLimit ( const Float_t f=fgPheErrUpperLimit ) { fPheErrUpperLimit = f; }
225 void SetPulserColor ( const MCalibrationCam::PulserColor_t col ) { fPulserColor = col; }
226
227 ClassDef(MCalibrationChargeCalc, 4) // Task calculating Calibration Containers and Quantum Efficiencies
228};
229
230#endif
Note: See TracBrowser for help on using the repository browser.