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

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