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

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