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