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

Last change on this file since 4940 was 4929, checked in by gaug, 20 years ago
*** empty log message ***
File size: 7.6 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 fgAverageNbins; //! The default for fAverageNbins (now set to: 2000)
45 static const Int_t fgPulserFrequency; //! The default for fPulserFrequency (now set to: 500)
46
47protected:
48
49 Float_t fNumHiGainSaturationLimit; // Rel. amount sat. higain FADC slices until pixel is called saturated
50 Float_t fNumLoGainSaturationLimit; // Rel. amount sat. logain FADC slices until pixel is called saturated
51
52 TArrayI fAverageAreaNum; // Number of pixels in average pixels per area
53 TArrayF fAverageAreaRelSigma; // Re-normalized relative sigmas in average pixels per area
54 TArrayF fAverageAreaRelSigmaVar; // Variance Re-normalized relative sigmas in average pixels per area
55 TArrayI fAverageAreaSat; // Number of saturated slices in average pixels per area
56 TArrayF fAverageAreaSigma; // Re-normalized sigmas in average pixels per area
57 TArrayF fAverageAreaSigmaVar; // Variance Re-normalized sigmas in average pixels per area
58 Int_t fAverageNbins; // Number of bins for the average histograms
59 TObjArray *fAverageHiGainAreas; //-> Array of calibration pixels, one per pixel area
60 TObjArray *fAverageHiGainSectors; //-> Array of calibration pixels, one per camera sector
61 TObjArray *fAverageLoGainAreas; //-> Array of calibration pixels, one per pixel area
62 TObjArray *fAverageLoGainSectors; //-> Array of calibration pixels, one per camera sector
63 TArrayI fAverageSectorNum; // Number of pixels in average pixels per sector
64 TArrayI fRunNumbers; // Numbers of runs used
65
66 MCalibrationCam::PulserColor_t fColor; // Colour of the pulsed LEDs
67
68 MBadPixelsCam *fBadPixels; //! Bad Pixels storage container
69 MCalibrationIntensityCam *fIntensCam; //! Intensity Calibration Cam with the results
70 MCalibrationCam *fCam; //! Calibration Cam with the results
71 MGeomCam *fGeom; //! Camera geometry
72 MRawRunHeader *fRunHeader; //! Run Header
73
74 TObjArray *fHiGainArray; //-> Array of calibration pixels, one per pixel
75 TObjArray *fLoGainArray; //-> Array of calibration pixels, one per pixel
76
77 Int_t fPulserFrequency; // Light pulser frequency
78
79 enum { kDebug, kLoGain, kOscillations }; // Possible flags
80
81 Byte_t fFlags; // Bit-field to hold the flags
82
83 virtual Bool_t SetupHists(const MParList *pList);
84 virtual Bool_t ReInitHists(MParList *pList);
85 virtual Bool_t FillHists(const MParContainer *par, const Stat_t w=1);
86 virtual Bool_t FinalizeHists();
87 virtual void FinalizeBadPixels();
88
89 virtual void CalcAverageSigma();
90
91 void DrawAverageSigma(Bool_t sat, Bool_t inner,
92 Float_t sigma, Float_t sigmaerr,
93 Float_t relsigma, Float_t relsigmaerr) const;
94
95 void FitHiGainArrays(MCalibrationCam &calcam, MBadPixelsCam &badcam,
96 MBadPixelsPix::UncalibratedType_t fittyp,
97 MBadPixelsPix::UncalibratedType_t osctyp);
98
99 void FitHiGainHists(MHCalibrationPix &hist,
100 MCalibrationPix &pix,
101 MBadPixelsPix &bad,
102 MBadPixelsPix::UncalibratedType_t fittyp,
103 MBadPixelsPix::UncalibratedType_t osctyp);
104
105 void FitLoGainArrays(MCalibrationCam &calcam, MBadPixelsCam &badcam,
106 MBadPixelsPix::UncalibratedType_t fittyp,
107 MBadPixelsPix::UncalibratedType_t osctyp);
108
109 void FitLoGainHists(MHCalibrationPix &hist,
110 MCalibrationPix &pix,
111 MBadPixelsPix &bad,
112 MBadPixelsPix::UncalibratedType_t fittyp,
113 MBadPixelsPix::UncalibratedType_t osctyp);
114
115 void InitHists(MHCalibrationPix &hist, MBadPixelsPix &bad, const Int_t i);
116
117 Bool_t IsDebug () const { return TESTBIT(fFlags,kDebug); }
118 Bool_t IsOscillations() const { return TESTBIT(fFlags,kOscillations); }
119 Bool_t IsLoGain () const { return TESTBIT(fFlags,kLoGain); }
120
121 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print);
122
123public:
124
125 MHCalibrationCam(const char *name=NULL, const char *title=NULL);
126 virtual ~MHCalibrationCam();
127
128 Bool_t SetupFill(const MParList *pList);
129 Bool_t ReInit ( MParList *pList);
130 Bool_t Fill (const MParContainer *par, const Stat_t w=1);
131 Bool_t Finalize ( );
132
133 virtual void ResetHists();
134
135 // Clone
136 TObject *Clone(const char *name="") const;
137
138 // Draw
139 void Draw(const Option_t *opt);
140
141 Bool_t GetPixelContent ( Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
142 void DrawPixelContent( Int_t num ) const;
143
144 const Int_t GetAverageAreas () const;
145 MHCalibrationPix &GetAverageHiGainArea (UInt_t i);
146 const MHCalibrationPix &GetAverageHiGainArea (UInt_t i) const;
147 MHCalibrationPix &GetAverageLoGainArea (UInt_t i);
148 const MHCalibrationPix &GetAverageLoGainArea (UInt_t i) const;
149 MHCalibrationPix &GetAverageHiGainSector(UInt_t i);
150 const MHCalibrationPix &GetAverageHiGainSector(UInt_t i) const;
151 MHCalibrationPix &GetAverageLoGainSector(UInt_t i);
152 const MHCalibrationPix &GetAverageLoGainSector(UInt_t i) const;
153 const Int_t GetAverageSectors () const;
154 const MCalibrationCam::PulserColor_t GetColor () const { return fColor; }
155 const Float_t GetNumHiGainSaturationLimit() const { return fNumHiGainSaturationLimit; }
156 const Float_t GetNumLoGainSaturationLimit() const { return fNumLoGainSaturationLimit; }
157 const TArrayI &GetRunNumbers () const;
158 const Int_t GetSize () const;
159
160 MHCalibrationPix &operator[] (UInt_t i);
161 const MHCalibrationPix &operator[] (UInt_t i) const;
162 MHCalibrationPix &operator() (UInt_t i);
163 const MHCalibrationPix &operator() (UInt_t i) const;
164
165 void SetColor ( const MCalibrationCam::PulserColor_t color) { fColor = color; }
166 void SetDebug ( const Bool_t b=kTRUE ) { b
167 ? SETBIT(fFlags,kDebug)
168 : CLRBIT(fFlags,kDebug); }
169 void SetLoGain ( const Bool_t b=kTRUE ) { b
170 ? SETBIT(fFlags,kLoGain)
171 : CLRBIT(fFlags,kLoGain); }
172 void SetOscillations ( const Bool_t b=kTRUE ) { b
173 ? SETBIT(fFlags,kOscillations)
174 : CLRBIT(fFlags,kOscillations); }
175 void SetAverageNbins ( const Int_t bins=fgAverageNbins) { fAverageNbins = bins; }
176 void SetNumLoGainSaturationLimit( const Float_t lim ) { fNumLoGainSaturationLimit = lim; }
177 void SetNumHiGainSaturationLimit( const Float_t lim ) { fNumHiGainSaturationLimit = lim; }
178 void SetPulserFrequency ( const Int_t f=fgPulserFrequency) { fPulserFrequency = f; }
179
180 ClassDef(MHCalibrationCam, 1) // Base Histogram class for Calibration Camera
181};
182
183#endif
184
185
186
187
188
189
190
191
192
Note: See TracBrowser for help on using the repository browser.