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

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