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

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