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

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