source: branches/Mars_McMismatchStudy/mhcalib/MHCalibrationCam.h@ 18222

Last change on this file since 18222 was 9153, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 11.5 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 MCalibrationCam;
32class MCalibrationPix;
33class MBadPixelsCam;
34class MBadPixelsPix;
35
36class MHCalibrationCam : public MH, public MCamEvent
37{
38
39private:
40 static const Double_t fgLowerFitLimitHiGain; //! Default for fLowerFitLimitHiGain
41 static const Double_t fgUpperFitLimitHiGain; //! Default for fUpperFitLimitHiGain
42 static const Double_t fgLowerFitLimitLoGain; //! Default for fLowerFitLimitLoGain
43 static const Double_t fgUpperFitLimitLoGain; //! Default for fUpperFitLimitLoGain
44
45 static const Int_t fgPulserFrequency; //! Default for fPulserFrequency
46 static const Float_t fgProbLimit; //! Default for fProbLimit
47 static const Float_t fgOverflowLimit; //! Default for fOverflowLimit
48 static const Int_t fgMaxNumEvts; //! Default for fMaxNumEvts
49
50 static const TString gsHistName; //! Default Histogram names
51 static const TString gsHistTitle; //! Default Histogram titles
52 static const TString gsHistXTitle; //! Default Histogram x-axis titles
53 static const TString gsHistYTitle; //! Default Histogram y-axis titles
54
55protected:
56
57 Int_t fNbins; // Number of bins
58 Axis_t fFirst; // Lower histogram limit
59 Axis_t fLast; // Upper histogram limit
60
61 Float_t fProbLimit; // Limit for acceptance of probability of Gauss-Fit
62 Float_t fOverflowLimit; // Part of maximum allowed overflow events
63
64 Double_t fLowerFitLimitHiGain; // Lower limit for the fit range for the hi-gain hist
65 Double_t fUpperFitLimitHiGain; // Upper limit for the fit range for the hi-gain hist
66 Double_t fLowerFitLimitLoGain; // Lower limit for the fit range for the lo-gain hist
67 Double_t fUpperFitLimitLoGain; // Upper limit for the fit range for the lo-gain hist
68
69 Bool_t fIsHiGainFitRanges; // Are high-gain fit ranges defined?
70 Bool_t fIsLoGainFitRanges; // Are low-gain fit ranges defined?
71
72 TString fHistName; //! Histogram names
73 TString fHistTitle; //! Histogram titles
74 TString fHistXTitle; //! Histogram x-axis titles
75 TString fHistYTitle; //! Histogram y-axis titles
76
77 Float_t fNumHiGainSaturationLimit; // Rel. amount sat. higain FADC slices until pixel is called saturated
78 Float_t fNumLoGainSaturationLimit; // Rel. amount sat. logain FADC slices until pixel is called saturated
79
80 Int_t fMaxNumEvts; // Max Number of events
81 Int_t fCurrentNumEvts; //! Current number of events
82
83 MArrayI fRunNumbers; // Numbers of runs used
84
85 MArrayF fAverageAreaRelSigma; // Re-normalized relative sigmas in average pixels per area
86 MArrayF fAverageAreaRelSigmaVar; // Variance Re-normalized relative sigmas in average pixels per area
87 MArrayI fAverageAreaSat; // Number of saturated slices in average pixels per area
88 MArrayF fAverageAreaSigma; // Re-normalized sigmas in average pixels per area
89 MArrayF fAverageAreaSigmaVar; // Variance Re-normalized sigmas in average pixels per area
90 MArrayI fAverageAreaNum; // Number of pixels in average pixels per area
91 MArrayI fAverageSectorNum; // Number of pixels in average pixels per sector
92
93 TOrdCollection *fAverageHiGainAreas; // Array of calibration pixels, one per pixel area
94 TOrdCollection *fAverageHiGainSectors; // Array of calibration pixels, one per camera sector
95 TOrdCollection *fAverageLoGainAreas; // Array of calibration pixels, one per pixel area
96 TOrdCollection *fAverageLoGainSectors; // Array of calibration pixels, one per camera sector
97
98 MCalibrationCam::PulserColor_t fColor; // Colour of the pulsed LEDs
99
100 MBadPixelsCam *fBadPixels; //! Bad Pixels storage container
101 MCalibrationCam *fCam; //! Calibration Cam with the results
102 MGeomCam *fGeom; //! Camera geometry
103 MRawRunHeader *fRunHeader; //! Run Header
104
105 TOrdCollection *fHiGainArray; // Array of calibration pixels, one per pixel
106 TOrdCollection *fLoGainArray; // Array of calibration pixels, one per pixel
107
108 Int_t fPulserFrequency; // Light pulser frequency
109
110 enum {
111 kDebug,
112 kLoGain,
113 kAverageing,
114 kOscillations,
115 kSizeCheck,
116 kIsReset
117 }; // Possible global flags
118
119 Byte_t fFlags; // Bit-field to hold the global flags
120
121 virtual Bool_t SetupHists ( const MParList *pList ) { return kTRUE; }
122 virtual Bool_t ReInitHists( MParList *pList ) { return kTRUE; }
123 virtual Bool_t FillHists ( const MParContainer *par, const Stat_t w=1) { return kTRUE; }
124 virtual Bool_t FinalizeHists() { return kTRUE; }
125
126 virtual void FinalizeBadPixels() { }
127
128 virtual void CalcAverageSigma();
129
130 virtual void InitHiGainArrays( const Int_t npix, const Int_t nareas, const Int_t nsectors );
131 virtual void InitLoGainArrays( const Int_t npix, const Int_t nareas, const Int_t nsectors );
132
133 virtual void ResetHistTitles();
134
135 void DrawAverageSigma( Bool_t sat, Bool_t inner,
136 Float_t sigma, Float_t sigmaerr,
137 Float_t relsigma, Float_t relsigmaerr) const;
138
139 void FitHiGainArrays ( MCalibrationCam &calcam, MBadPixelsCam &badcam,
140 MBadPixelsPix::UncalibratedType_t fittyp,
141 MBadPixelsPix::UncalibratedType_t osctyp);
142
143 void FitHiGainHists ( MHCalibrationPix &hist,
144 MCalibrationPix &pix,
145 MBadPixelsPix &bad,
146 MBadPixelsPix::UncalibratedType_t fittyp,
147 MBadPixelsPix::UncalibratedType_t osctyp);
148
149 void FitLoGainArrays ( MCalibrationCam &calcam, MBadPixelsCam &badcam,
150 MBadPixelsPix::UncalibratedType_t fittyp,
151 MBadPixelsPix::UncalibratedType_t osctyp);
152
153 void FitLoGainHists ( MHCalibrationPix &hist,
154 MCalibrationPix &pix,
155 MBadPixelsPix &bad,
156 MBadPixelsPix::UncalibratedType_t fittyp,
157 MBadPixelsPix::UncalibratedType_t osctyp);
158
159 void InitHists ( MHCalibrationPix &hist, MBadPixelsPix &bad, const Int_t i);
160 Bool_t InitCams ( MParList *plist, const TString name );
161
162 Bool_t IsLoGain() const;
163 Bool_t IsAverageing () const { return TESTBIT(fFlags,kAverageing); }
164 Bool_t IsDebug () const { return TESTBIT(fFlags,kDebug); }
165 Bool_t IsOscillations() const { return TESTBIT(fFlags,kOscillations); }
166 Bool_t IsSizeCheck () const { return TESTBIT(fFlags,kSizeCheck); }
167 Bool_t IsReset () const { return TESTBIT(fFlags,kIsReset); }
168
169 void ToggleFlag(Bool_t b, Byte_t flag) { b ? SETBIT(fFlags, flag) : CLRBIT(fFlags,flag); }
170
171 void Remove ( TOrdCollection *col );
172
173 Int_t ReadEnv ( const TEnv &env, TString prefix, Bool_t print );
174
175public:
176
177 MHCalibrationCam(const char *name=NULL, const char *title=NULL);
178 virtual ~MHCalibrationCam();
179
180 Bool_t SetupFill(const MParList *pList);
181 Bool_t ReInit ( MParList *pList);
182 Int_t Fill (const MParContainer *par, const Stat_t w=1);
183 Bool_t Finalize ( );
184
185 virtual void ResetHists();
186
187 // Draw
188 void Draw(const Option_t *opt); // *MENU*
189
190 Bool_t GetPixelContent ( Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const { return kTRUE; }
191 void DrawPixelContent( Int_t num ) const {}
192
193 const MArrayI &GetAverageAreaNum () const { return fAverageAreaNum; }
194 const Int_t GetAverageAreas () const;
195 MHCalibrationPix &GetAverageHiGainArea (UInt_t i);
196 const MHCalibrationPix &GetAverageHiGainArea (UInt_t i) const;
197 MHCalibrationPix &GetAverageLoGainArea (UInt_t i);
198 const MHCalibrationPix &GetAverageLoGainArea (UInt_t i) const;
199 MHCalibrationPix &GetAverageHiGainSector(UInt_t i);
200 const MHCalibrationPix &GetAverageHiGainSector(UInt_t i) const;
201 MHCalibrationPix &GetAverageLoGainSector(UInt_t i);
202 const MHCalibrationPix &GetAverageLoGainSector(UInt_t i) const;
203 const MArrayI &GetAverageSectorNum () const { return fAverageSectorNum; }
204 const Int_t GetAverageSectors () const;
205 const MCalibrationCam::PulserColor_t GetColor () const { return fColor; }
206 const Float_t GetNumHiGainSaturationLimit() const { return fNumHiGainSaturationLimit; }
207 const Float_t GetNumLoGainSaturationLimit() const { return fNumLoGainSaturationLimit; }
208 const MArrayI &GetRunNumbers () const { return fRunNumbers; }
209 const Int_t GetSize () const;
210
211 MHCalibrationPix &operator[] (UInt_t i);
212 const MHCalibrationPix &operator[] (UInt_t i) const;
213 MHCalibrationPix &operator() (UInt_t i);
214 const MHCalibrationPix &operator() (UInt_t i) const;
215
216 void SetColor(const MCalibrationCam::PulserColor_t color) { fColor = color; }
217
218 void SetAverageing(const Bool_t b=kTRUE) { ToggleFlag(b,kAverageing); }
219 void SetDebug(const Bool_t b=kTRUE) { ToggleFlag(b,kDebug); }
220 void SetLoGain(const Bool_t b=kTRUE) { ToggleFlag(b,kLoGain); }
221 void SetOscillations(const Bool_t b=kTRUE) { ToggleFlag(b,kOscillations); }
222 void SetSizeCheck(const Bool_t b=kTRUE) { ToggleFlag(b,kSizeCheck); }
223 void SetIsReset(const Bool_t b=kTRUE) { ToggleFlag(b,kIsReset); }
224
225 void SetHistName ( const char *name ) { fHistName = name; }
226 void SetHistTitle ( const char *name ) { fHistTitle = name; }
227 void SetHistXTitle( const char *name ) { fHistXTitle = name; }
228 void SetHistYTitle( const char *name ) { fHistYTitle = name; }
229
230 void SetLowerFitLimitHiGain( const Double_t d=fgLowerFitLimitHiGain) { fLowerFitLimitHiGain = d; }
231 void SetUpperFitLimitHiGain( const Double_t d=fgUpperFitLimitHiGain) { fUpperFitLimitHiGain = d; }
232 void SetLowerFitLimitLoGain( const Double_t d=fgLowerFitLimitLoGain) { fLowerFitLimitLoGain = d; }
233 void SetUpperFitLimitLoGain( const Double_t d=fgUpperFitLimitLoGain) { fUpperFitLimitLoGain = d; }
234
235 void SetBinning(Int_t n, Axis_t lo, Axis_t up) { fNbins=n; fFirst=lo; fLast=up; }
236
237 void SetMaxNumEvts ( const Int_t i=fgMaxNumEvts ) { fMaxNumEvts = i; }
238
239 void SetProbLimit ( const Float_t f=fgProbLimit) { fProbLimit = f; }
240
241 void SetNumLoGainSaturationLimit( const Float_t lim ) { fNumLoGainSaturationLimit = lim; }
242 void SetNumHiGainSaturationLimit( const Float_t lim ) { fNumHiGainSaturationLimit = lim; }
243 void SetOverflowLimit ( const Float_t f=fgOverflowLimit ) { fOverflowLimit = f; }
244 void SetPulserFrequency ( const Int_t i=fgPulserFrequency ) { fPulserFrequency = i; }
245
246 ClassDef(MHCalibrationCam, 6) // Base Histogram class for Calibration Camera
247};
248
249#endif
Note: See TracBrowser for help on using the repository browser.