source: trunk/MagicSoft/Mars/mhcalib/MHCalibrationCam.h@ 7180

Last change on this file since 7180 was 7095, checked in by tbretz, 19 years ago
*** empty log message ***
File size: 11.5 KB
Line 
1#ifndef MARS_MHCalibrationCam
2#define MARS_MHCalibrationCam
3
4#ifndef MARS_MArrayI
5#include "MArrayI.h"
6#endif
7#ifndef MARS_MArrayF
8#include "MArrayF.h"
9#endif
10#ifndef MARS_MH
11#include "MH.h"
12#endif
13#ifndef MARS_MCamEvent
14#include "MCamEvent.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
25class TText;
26class TOrdCollection;
27
28class MHCalibrationPix;
29class MGeomCam;
30class MRawRunHeader;
31class MCalibrationIntensityCam;
32class MCalibrationCam;
33class MCalibrationPix;
34class MBadPixelsIntensityCam;
35class MBadPixelsCam;
36class MBadPixelsPix;
37
38class MHCalibrationCam : public MH, public MCamEvent
39{
40
41private:
42 static const Double_t fgLowerFitLimitHiGain; //! The default for fLowerFitLimitHiGain (now at: 0)
43 static const Double_t fgUpperFitLimitHiGain; //! The default for fUpperFitLimitHiGain (now at: 0)
44 static const Double_t fgLowerFitLimitLoGain; //! The default for fLowerFitLimitLoGain (now at: 0)
45 static const Double_t fgUpperFitLimitLoGain; //! The default for fUpperFitLimitLoGain (now at: 0)
46
47 static const Int_t fgPulserFrequency; //! The default for fPulserFrequency (now set to: 500)
48 static const Float_t fgProbLimit; //! The default for fProbLimit (now set to: 0.0001)
49 static const Float_t fgOverflowLimit; //! The default for fOverflowLimit (now at: 0.005)
50
51 static const TString gsHistName; //! Default Histogram names
52 static const TString gsHistTitle; //! Default Histogram titles
53 static const TString gsHistXTitle; //! Default Histogram x-axis titles
54 static const TString gsHistYTitle; //! Default Histogram y-axis titles
55
56protected:
57
58 Int_t fNbins; // Number of bins
59 Axis_t fFirst; // Lower histogram limit
60 Axis_t fLast; // Upper histogram limit
61
62 Float_t fProbLimit; // Limit for acceptance of probability of Gauss-Fit
63 Float_t fOverflowLimit; // Part of maximum allowed overflow events
64
65 Double_t fLowerFitLimitHiGain; // Lower limit for the fit range for the hi-gain hist
66 Double_t fUpperFitLimitHiGain; // Upper limit for the fit range for the hi-gain hist
67 Double_t fLowerFitLimitLoGain; // Lower limit for the fit range for the lo-gain hist
68 Double_t fUpperFitLimitLoGain; // Upper limit for the fit range for the lo-gain hist
69
70 Bool_t fIsHiGainFitRanges; // Are high-gain fit ranges defined?
71 Bool_t fIsLoGainFitRanges; // Are low-gain fit ranges defined?
72
73 TString fHistName; //! Histogram names
74 TString fHistTitle; //! Histogram titles
75 TString fHistXTitle; //! Histogram x-axis titles
76 TString fHistYTitle; //! Histogram y-axis titles
77
78 Float_t fNumHiGainSaturationLimit; // Rel. amount sat. higain FADC slices until pixel is called saturated
79 Float_t fNumLoGainSaturationLimit; // Rel. amount sat. logain FADC slices until pixel is called saturated
80
81 MArrayI fRunNumbers; // Numbers of runs used
82
83 MArrayF fAverageAreaRelSigma; // Re-normalized relative sigmas in average pixels per area
84 MArrayF fAverageAreaRelSigmaVar; // Variance Re-normalized relative sigmas in average pixels per area
85 MArrayI fAverageAreaSat; // Number of saturated slices in average pixels per area
86 MArrayF fAverageAreaSigma; // Re-normalized sigmas in average pixels per area
87 MArrayF fAverageAreaSigmaVar; // Variance Re-normalized sigmas in average pixels per area
88 MArrayI fAverageAreaNum; // Number of pixels in average pixels per area
89 MArrayI fAverageSectorNum; // Number of pixels in average pixels per sector
90
91 TOrdCollection *fAverageHiGainAreas; // Array of calibration pixels, one per pixel area
92 TOrdCollection *fAverageHiGainSectors; // Array of calibration pixels, one per camera sector
93 TOrdCollection *fAverageLoGainAreas; // Array of calibration pixels, one per pixel area
94 TOrdCollection *fAverageLoGainSectors; // Array of calibration pixels, one per camera sector
95
96 MCalibrationCam::PulserColor_t fColor; // Colour of the pulsed LEDs
97
98 MBadPixelsIntensityCam *fIntensBad; //! Bad Pixels intensity calibration storage container
99 MBadPixelsCam *fBadPixels; //! Bad Pixels storage container
100 MCalibrationIntensityCam *fIntensCam; //! Intensity Calibration Cam with the results
101 MCalibrationCam *fCam; //! Calibration Cam with the results
102 MGeomCam *fGeom; //! Camera geometry
103 MRawRunHeader *fRunHeader; //! Run Header
104
105 TOrdCollection *fHiGainArray; // Array of calibration pixels, one per pixel
106 TOrdCollection *fLoGainArray; // Array of calibration pixels, one per pixel
107
108 Int_t fPulserFrequency; // Light pulser frequency
109
110 enum {
111 kDebug,
112 kLoGain,
113 kAverageing,
114 kOscillations,
115 kSizeCheck,
116 kIsReset
117 }; // Possible global flags
118
119 Byte_t fFlags; // Bit-field to hold the global flags
120
121 virtual Bool_t SetupHists ( const MParList *pList ) { return kTRUE; }
122 virtual Bool_t ReInitHists( MParList *pList ) { return kTRUE; }
123 virtual Bool_t FillHists ( const MParContainer *par, const Stat_t w=1) { return kTRUE; }
124 virtual Bool_t FinalizeHists() { return kTRUE; }
125
126 virtual void FinalizeBadPixels() { }
127
128 virtual void CalcAverageSigma();
129
130 virtual void InitHiGainArrays( const Int_t npix, const Int_t nareas, const Int_t nsectors );
131 virtual void InitLoGainArrays( const Int_t npix, const Int_t nareas, const Int_t nsectors );
132
133 virtual void ResetHistTitles();
134
135 void DrawAverageSigma( Bool_t sat, Bool_t inner,
136 Float_t sigma, Float_t sigmaerr,
137 Float_t relsigma, Float_t relsigmaerr) const;
138
139 void FitHiGainArrays ( MCalibrationCam &calcam, MBadPixelsCam &badcam,
140 MBadPixelsPix::UncalibratedType_t fittyp,
141 MBadPixelsPix::UncalibratedType_t osctyp);
142
143 void FitHiGainHists ( MHCalibrationPix &hist,
144 MCalibrationPix &pix,
145 MBadPixelsPix &bad,
146 MBadPixelsPix::UncalibratedType_t fittyp,
147 MBadPixelsPix::UncalibratedType_t osctyp);
148
149 void FitLoGainArrays ( MCalibrationCam &calcam, MBadPixelsCam &badcam,
150 MBadPixelsPix::UncalibratedType_t fittyp,
151 MBadPixelsPix::UncalibratedType_t osctyp);
152
153 void FitLoGainHists ( MHCalibrationPix &hist,
154 MCalibrationPix &pix,
155 MBadPixelsPix &bad,
156 MBadPixelsPix::UncalibratedType_t fittyp,
157 MBadPixelsPix::UncalibratedType_t osctyp);
158
159 void InitHists ( MHCalibrationPix &hist, MBadPixelsPix &bad, const Int_t i);
160 Bool_t InitCams ( MParList *plist, const TString name );
161
162 Bool_t IsAverageing () const { return TESTBIT(fFlags,kAverageing); }
163 Bool_t IsDebug () const { return TESTBIT(fFlags,kDebug); }
164 Bool_t IsLoGain () const { return TESTBIT(fFlags,kLoGain); }
165 Bool_t IsOscillations() const { return TESTBIT(fFlags,kOscillations); }
166 Bool_t IsSizeCheck () const { return TESTBIT(fFlags,kSizeCheck); }
167 Bool_t IsReset () const { return TESTBIT(fFlags,kIsReset); }
168
169 void ToggleFlag(Bool_t b, Byte_t flag) { b ? SETBIT(fFlags, flag) : CLRBIT(fFlags,flag); }
170
171 void Remove ( TOrdCollection *col );
172
173 Int_t ReadEnv ( const TEnv &env, TString prefix, Bool_t print );
174
175public:
176
177 MHCalibrationCam(const char *name=NULL, const char *title=NULL);
178 virtual ~MHCalibrationCam();
179
180 Bool_t SetupFill(const MParList *pList);
181 Bool_t ReInit ( MParList *pList);
182 Bool_t Fill (const MParContainer *par, const Stat_t w=1);
183 Bool_t Finalize ( );
184
185 virtual void ResetHists();
186
187 // Draw
188 void Draw(const Option_t *opt); // *MENU*
189
190 Bool_t GetPixelContent ( Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const { return kTRUE; }
191 void DrawPixelContent( Int_t num ) const {}
192
193 const Int_t GetAverageAreas () const;
194 MHCalibrationPix &GetAverageHiGainArea (UInt_t i);
195 const MHCalibrationPix &GetAverageHiGainArea (UInt_t i) const;
196 MHCalibrationPix &GetAverageLoGainArea (UInt_t i);
197 const MHCalibrationPix &GetAverageLoGainArea (UInt_t i) const;
198 MHCalibrationPix &GetAverageHiGainSector(UInt_t i);
199 const MHCalibrationPix &GetAverageHiGainSector(UInt_t i) const;
200 MHCalibrationPix &GetAverageLoGainSector(UInt_t i);
201 const MHCalibrationPix &GetAverageLoGainSector(UInt_t i) const;
202 const Int_t GetAverageSectors () const;
203 const MCalibrationCam::PulserColor_t GetColor () const { return fColor; }
204 const Float_t GetNumHiGainSaturationLimit() const { return fNumHiGainSaturationLimit; }
205 const Float_t GetNumLoGainSaturationLimit() const { return fNumLoGainSaturationLimit; }
206 const MArrayI &GetRunNumbers () const { return fRunNumbers; }
207 const Int_t GetSize () const;
208
209 MHCalibrationPix &operator[] (UInt_t i);
210 const MHCalibrationPix &operator[] (UInt_t i) const;
211 MHCalibrationPix &operator() (UInt_t i);
212 const MHCalibrationPix &operator() (UInt_t i) const;
213
214 void SetColor(const MCalibrationCam::PulserColor_t color) { fColor = color; }
215
216 void SetAverageing(const Bool_t b=kTRUE) { ToggleFlag(b,kAverageing); }
217 void SetDebug(const Bool_t b=kTRUE) { ToggleFlag(b,kDebug); }
218 void SetLoGain(const Bool_t b=kTRUE) { ToggleFlag(b,kLoGain); }
219 void SetOscillations(const Bool_t b=kTRUE) { ToggleFlag(b,kOscillations); }
220 void SetSizeCheck(const Bool_t b=kTRUE) { ToggleFlag(b,kSizeCheck); }
221 void SetIsReset(const Bool_t b=kTRUE) { ToggleFlag(b,kIsReset); }
222
223 void SetHistName ( const char *name ) { fHistName = name; }
224 void SetHistTitle ( const char *name ) { fHistTitle = name; }
225 void SetHistXTitle( const char *name ) { fHistXTitle = name; }
226 void SetHistYTitle( const char *name ) { fHistYTitle = name; }
227
228 void SetLowerFitLimitHiGain( const Double_t d=fgLowerFitLimitHiGain) { fLowerFitLimitHiGain = d; }
229 void SetUpperFitLimitHiGain( const Double_t d=fgUpperFitLimitHiGain) { fUpperFitLimitHiGain = d; }
230 void SetLowerFitLimitLoGain( const Double_t d=fgLowerFitLimitLoGain) { fLowerFitLimitLoGain = d; }
231 void SetUpperFitLimitLoGain( const Double_t d=fgUpperFitLimitLoGain) { fUpperFitLimitLoGain = d; }
232
233 void SetNbins ( const Int_t i ) { fNbins = i; }
234 void SetFirst ( const Axis_t f ) { fFirst = f; }
235 void SetLast ( const Axis_t f ) { fLast = f; }
236
237 void SetProbLimit ( const Float_t f=fgProbLimit) { fProbLimit = f; }
238
239 void SetNumLoGainSaturationLimit( const Float_t lim ) { fNumLoGainSaturationLimit = lim; }
240 void SetNumHiGainSaturationLimit( const Float_t lim ) { fNumHiGainSaturationLimit = lim; }
241 void SetOverflowLimit ( const Float_t f=fgOverflowLimit ) { fOverflowLimit = f; }
242 void SetPulserFrequency ( const Int_t i=fgPulserFrequency ) { fPulserFrequency = i; }
243
244 ClassDef(MHCalibrationCam, 5) // Base Histogram class for Calibration Camera
245};
246
247#endif
Note: See TracBrowser for help on using the repository browser.