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

Last change on this file since 5489 was 5137, 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 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
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 TOrdCollection *fAverageHiGainAreas; // Array of calibration pixels, one per pixel area
75 TOrdCollection *fAverageHiGainSectors; // Array of calibration pixels, one per camera sector
76 TOrdCollection *fAverageLoGainAreas; // Array of calibration pixels, one per pixel area
77 TOrdCollection *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 TOrdCollection *fHiGainArray; // Array of calibration pixels, one per pixel
89 TOrdCollection *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 virtual void ResetHistTitles();
111
112 void DrawAverageSigma( Bool_t sat, Bool_t inner,
113 Float_t sigma, Float_t sigmaerr,
114 Float_t relsigma, Float_t relsigmaerr) const;
115
116 void FitHiGainArrays ( MCalibrationCam &calcam, MBadPixelsCam &badcam,
117 MBadPixelsPix::UncalibratedType_t fittyp,
118 MBadPixelsPix::UncalibratedType_t osctyp);
119
120 void FitHiGainHists ( MHCalibrationPix &hist,
121 MCalibrationPix &pix,
122 MBadPixelsPix &bad,
123 MBadPixelsPix::UncalibratedType_t fittyp,
124 MBadPixelsPix::UncalibratedType_t osctyp);
125
126 void FitLoGainArrays ( MCalibrationCam &calcam, MBadPixelsCam &badcam,
127 MBadPixelsPix::UncalibratedType_t fittyp,
128 MBadPixelsPix::UncalibratedType_t osctyp);
129
130 void FitLoGainHists ( MHCalibrationPix &hist,
131 MCalibrationPix &pix,
132 MBadPixelsPix &bad,
133 MBadPixelsPix::UncalibratedType_t fittyp,
134 MBadPixelsPix::UncalibratedType_t osctyp);
135
136 void InitHists ( MHCalibrationPix &hist, MBadPixelsPix &bad, const Int_t i);
137
138 Bool_t IsAverageing () const { return TESTBIT(fFlags,kAverageing); }
139 Bool_t IsDebug () const { return TESTBIT(fFlags,kDebug); }
140 Bool_t IsLoGain () const { return TESTBIT(fFlags,kLoGain); }
141 Bool_t IsOscillations() const { return TESTBIT(fFlags,kOscillations); }
142 Bool_t IsSizeCheck () const { return TESTBIT(fFlags,kSizeCheck); }
143
144 void Remove(TOrdCollection *col);
145
146 Int_t ReadEnv ( const TEnv &env, TString prefix, Bool_t print);
147
148public:
149
150 MHCalibrationCam(const char *name=NULL, const char *title=NULL);
151 virtual ~MHCalibrationCam();
152
153 Bool_t SetupFill(const MParList *pList);
154 Bool_t ReInit ( MParList *pList);
155 Bool_t Fill (const MParContainer *par, const Stat_t w=1);
156 Bool_t Finalize ( );
157
158 virtual void ResetHists();
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 MArrayI &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
Note: See TracBrowser for help on using the repository browser.