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