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

Last change on this file since 4965 was 4959, checked in by gaug, 20 years ago
*** empty log message ***
File size: 9.0 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, kOscillations }; // Possible flags
93
94 Byte_t fFlags; // Bit-field to hold the flags
95
96 virtual Bool_t SetupHists ( const MParList *pList ) { return kTRUE; }
97 virtual Bool_t ReInitHists( MParList *pList ) { return kTRUE; }
98 virtual Bool_t FillHists ( const MParContainer *par, const Stat_t w=1) { return kTRUE; }
99 virtual Bool_t FinalizeHists() { return kTRUE; }
100
101 virtual void FinalizeBadPixels() { }
102
103 virtual void CalcAverageSigma();
104
105 virtual void InitHiGainArrays( const Int_t npix, const Int_t nareas, const Int_t nsectors );
106 virtual void InitLoGainArrays( const Int_t npix, const Int_t nareas, const Int_t nsectors );
107
108 void DrawAverageSigma( Bool_t sat, Bool_t inner,
109 Float_t sigma, Float_t sigmaerr,
110 Float_t relsigma, Float_t relsigmaerr) const;
111
112 void FitHiGainArrays ( MCalibrationCam &calcam, MBadPixelsCam &badcam,
113 MBadPixelsPix::UncalibratedType_t fittyp,
114 MBadPixelsPix::UncalibratedType_t osctyp);
115
116 void FitHiGainHists ( MHCalibrationPix &hist,
117 MCalibrationPix &pix,
118 MBadPixelsPix &bad,
119 MBadPixelsPix::UncalibratedType_t fittyp,
120 MBadPixelsPix::UncalibratedType_t osctyp);
121
122 void FitLoGainArrays ( MCalibrationCam &calcam, MBadPixelsCam &badcam,
123 MBadPixelsPix::UncalibratedType_t fittyp,
124 MBadPixelsPix::UncalibratedType_t osctyp);
125
126 void FitLoGainHists ( MHCalibrationPix &hist,
127 MCalibrationPix &pix,
128 MBadPixelsPix &bad,
129 MBadPixelsPix::UncalibratedType_t fittyp,
130 MBadPixelsPix::UncalibratedType_t osctyp);
131
132 void InitHists ( MHCalibrationPix &hist, MBadPixelsPix &bad, const Int_t i);
133
134 Bool_t IsDebug () const { return TESTBIT(fFlags,kDebug); }
135 Bool_t IsOscillations() const { return TESTBIT(fFlags,kOscillations); }
136 Bool_t IsLoGain () const { return TESTBIT(fFlags,kLoGain); }
137
138 Int_t ReadEnv ( const TEnv &env, TString prefix, Bool_t print);
139
140public:
141
142 MHCalibrationCam(const char *name=NULL, const char *title=NULL);
143 virtual ~MHCalibrationCam();
144
145 Bool_t SetupFill(const MParList *pList);
146 Bool_t ReInit ( MParList *pList);
147 Bool_t Fill (const MParContainer *par, const Stat_t w=1);
148 Bool_t Finalize ( );
149
150 virtual void ResetHists();
151
152 // Clone
153 TObject *Clone(const char *name="") const;
154
155 // Draw
156 void Draw(const Option_t *opt);
157
158 Bool_t GetPixelContent ( Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
159 void DrawPixelContent( Int_t num ) const;
160
161 const Int_t GetAverageAreas () const;
162 MHCalibrationPix &GetAverageHiGainArea (UInt_t i);
163 const MHCalibrationPix &GetAverageHiGainArea (UInt_t i) const;
164 MHCalibrationPix &GetAverageLoGainArea (UInt_t i);
165 const MHCalibrationPix &GetAverageLoGainArea (UInt_t i) const;
166 MHCalibrationPix &GetAverageHiGainSector(UInt_t i);
167 const MHCalibrationPix &GetAverageHiGainSector(UInt_t i) const;
168 MHCalibrationPix &GetAverageLoGainSector(UInt_t i);
169 const MHCalibrationPix &GetAverageLoGainSector(UInt_t i) const;
170 const Int_t GetAverageSectors () const;
171 const MCalibrationCam::PulserColor_t GetColor () const { return fColor; }
172 const Float_t GetNumHiGainSaturationLimit() const { return fNumHiGainSaturationLimit; }
173 const Float_t GetNumLoGainSaturationLimit() const { return fNumLoGainSaturationLimit; }
174 const TArrayI &GetRunNumbers () const { return fRunNumbers; }
175 const Int_t GetSize () const;
176
177 MHCalibrationPix &operator[] (UInt_t i);
178 const MHCalibrationPix &operator[] (UInt_t i) const;
179 MHCalibrationPix &operator() (UInt_t i);
180 const MHCalibrationPix &operator() (UInt_t i) const;
181
182 void SetColor ( const MCalibrationCam::PulserColor_t color) { fColor = color; }
183 void SetDebug ( const Bool_t b=kTRUE ) { b
184 ? SETBIT(fFlags,kDebug)
185 : CLRBIT(fFlags,kDebug); }
186 void SetLoGain ( const Bool_t b=kTRUE ) { b
187 ? SETBIT(fFlags,kLoGain)
188 : CLRBIT(fFlags,kLoGain); }
189 void SetOscillations ( const Bool_t b=kTRUE ) { b
190 ? SETBIT(fFlags,kOscillations)
191 : CLRBIT(fFlags,kOscillations); }
192 void SetHistName ( const char *name ) { fHistName = name; }
193 void SetHistTitle ( const char *name ) { fHistTitle = name; }
194 void SetHistXTitle( const char *name ) { fHistXTitle = name; }
195 void SetHistYTitle( const char *name ) { fHistYTitle = name; }
196
197 void SetNbins ( const Int_t i ) { fNbins = i; }
198 void SetFirst ( const Axis_t f ) { fFirst = f; }
199 void SetLast ( const Axis_t f ) { fLast = f; }
200
201 void SetNumLoGainSaturationLimit( const Float_t lim ) { fNumLoGainSaturationLimit = lim; }
202 void SetNumHiGainSaturationLimit( const Float_t lim ) { fNumHiGainSaturationLimit = lim; }
203 void SetPulserFrequency ( const Int_t f=fgPulserFrequency) { fPulserFrequency = f; }
204
205 ClassDef(MHCalibrationCam, 1) // Base Histogram class for Calibration Camera
206};
207
208#endif
209
210
211
212
213
214
215
216
217
Note: See TracBrowser for help on using the repository browser.