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

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