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

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