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

Last change on this file since 5037 was 5037, checked in by gaug, 20 years ago
*** empty log message ***
File size: 9.6 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 // Clone
157 TObject *Clone(const char *name="") const;
158
159 // Draw
160 void Draw(const Option_t *opt);
161
162 Bool_t GetPixelContent ( Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const { return kTRUE; }
163 void DrawPixelContent( Int_t num ) const {}
164
165 const Int_t GetAverageAreas () const;
166 MHCalibrationPix &GetAverageHiGainArea (UInt_t i);
167 const MHCalibrationPix &GetAverageHiGainArea (UInt_t i) const;
168 MHCalibrationPix &GetAverageLoGainArea (UInt_t i);
169 const MHCalibrationPix &GetAverageLoGainArea (UInt_t i) const;
170 MHCalibrationPix &GetAverageHiGainSector(UInt_t i);
171 const MHCalibrationPix &GetAverageHiGainSector(UInt_t i) const;
172 MHCalibrationPix &GetAverageLoGainSector(UInt_t i);
173 const MHCalibrationPix &GetAverageLoGainSector(UInt_t i) const;
174 const Int_t GetAverageSectors () const;
175 const MCalibrationCam::PulserColor_t GetColor () const { return fColor; }
176 const Float_t GetNumHiGainSaturationLimit() const { return fNumHiGainSaturationLimit; }
177 const Float_t GetNumLoGainSaturationLimit() const { return fNumLoGainSaturationLimit; }
178 const MArrayI &GetRunNumbers () const { return fRunNumbers; }
179 const Int_t GetSize () const;
180
181 MHCalibrationPix &operator[] (UInt_t i);
182 const MHCalibrationPix &operator[] (UInt_t i) const;
183 MHCalibrationPix &operator() (UInt_t i);
184 const MHCalibrationPix &operator() (UInt_t i) const;
185
186 void SetColor ( const MCalibrationCam::PulserColor_t color) { fColor = color; }
187 void SetAverageing ( const Bool_t b=kTRUE ) { b
188 ? SETBIT(fFlags,kAverageing)
189 : CLRBIT(fFlags,kAverageing); }
190 void SetDebug ( const Bool_t b=kTRUE ) { b
191 ? SETBIT(fFlags,kDebug)
192 : CLRBIT(fFlags,kDebug); }
193 void SetLoGain ( const Bool_t b=kTRUE ) { b
194 ? SETBIT(fFlags,kLoGain)
195 : CLRBIT(fFlags,kLoGain); }
196 void SetOscillations ( const Bool_t b=kTRUE ) { b
197 ? SETBIT(fFlags,kOscillations)
198 : CLRBIT(fFlags,kOscillations); }
199 void SetSizeCheck ( const Bool_t b=kTRUE ) { b
200 ? SETBIT(fFlags,kSizeCheck)
201 : CLRBIT(fFlags,kSizeCheck); }
202 void SetHistName ( const char *name ) { fHistName = name; }
203 void SetHistTitle ( const char *name ) { fHistTitle = name; }
204 void SetHistXTitle( const char *name ) { fHistXTitle = name; }
205 void SetHistYTitle( const char *name ) { fHistYTitle = name; }
206
207 void SetNbins ( const Int_t i ) { fNbins = i; }
208 void SetFirst ( const Axis_t f ) { fFirst = f; }
209 void SetLast ( const Axis_t f ) { fLast = f; }
210
211 void SetNumLoGainSaturationLimit( const Float_t lim ) { fNumLoGainSaturationLimit = lim; }
212 void SetNumHiGainSaturationLimit( const Float_t lim ) { fNumHiGainSaturationLimit = lim; }
213 void SetPulserFrequency ( const Int_t f=fgPulserFrequency) { fPulserFrequency = f; }
214
215 ClassDef(MHCalibrationCam, 1) // Base Histogram class for Calibration Camera
216};
217
218#endif
219
220
221
222
223
224
225
226
227
Note: See TracBrowser for help on using the repository browser.