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

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