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

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