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

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