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