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

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