| 1 | #ifndef MARS_MBadPixelsPix
|
|---|
| 2 | #define MARS_MBadPixelsPix
|
|---|
| 3 |
|
|---|
| 4 | #ifndef MARS_MParContainer
|
|---|
| 5 | #include "MParContainer.h"
|
|---|
| 6 | #endif
|
|---|
| 7 |
|
|---|
| 8 | #ifndef ROOT_TArrayI
|
|---|
| 9 | #include <TArrayI.h>
|
|---|
| 10 | #endif
|
|---|
| 11 |
|
|---|
| 12 | class MBadPixelsPix : public MParContainer
|
|---|
| 13 | {
|
|---|
| 14 | private:
|
|---|
| 15 | TArrayI fInfo;
|
|---|
| 16 |
|
|---|
| 17 | public:
|
|---|
| 18 | MBadPixelsPix(const char* name=NULL, const char* title=NULL);
|
|---|
| 19 |
|
|---|
| 20 | enum UnsuitableType_t {
|
|---|
| 21 | kUnsuitableRun = BIT(1),
|
|---|
| 22 | kUnsuitableEvt = BIT(2),
|
|---|
| 23 | kUnreliableRun = BIT(3)
|
|---|
| 24 | };
|
|---|
| 25 |
|
|---|
| 26 | static const Int_t fgRunMask; // All types which are not event wise determined
|
|---|
| 27 |
|
|---|
| 28 | // All types are initialized to normal behaviour
|
|---|
| 29 | enum CalibrationType_t {
|
|---|
| 30 | kHiGainSaturation = BIT(1),
|
|---|
| 31 | kLoGainSaturation = BIT(2),
|
|---|
| 32 | kHiGainNotFitted = BIT(3),
|
|---|
| 33 | kLoGainNotFitted = BIT(4),
|
|---|
| 34 | kChargeIsPedestal = BIT(5),
|
|---|
| 35 | kChargeErrNotValid = BIT(6),
|
|---|
| 36 | kChargeRelErrNotValid = BIT(7),
|
|---|
| 37 | kChargeSigmaNotValid = BIT(8),
|
|---|
| 38 | kConvHiLoNotValid = BIT(9),
|
|---|
| 39 | kHiGainOscillating = BIT(10),
|
|---|
| 40 | kLoGainOscillating = BIT(11),
|
|---|
| 41 | kMeanTimeInFirstBin = BIT(12),
|
|---|
| 42 | kMeanTimeInLastBin = BIT(13),
|
|---|
| 43 | kNotCalibrated = BIT(14)
|
|---|
| 44 | };
|
|---|
| 45 |
|
|---|
| 46 | void Reset();
|
|---|
| 47 | void Clear(Option_t *o="");
|
|---|
| 48 | void Copy(TObject &object) const
|
|---|
| 49 | {
|
|---|
| 50 | static_cast<MBadPixelsPix&>(object).fInfo = fInfo;
|
|---|
| 51 | }
|
|---|
| 52 |
|
|---|
| 53 | // Setter
|
|---|
| 54 | void SetUnsuitable(UnsuitableType_t typ) { fInfo[0] |= typ; }
|
|---|
| 55 |
|
|---|
| 56 | // Calibration
|
|---|
| 57 | void SetHiGainSaturation () { fInfo[1] |= kHiGainSaturation; }
|
|---|
| 58 | void SetLoGainSaturation () { fInfo[1] |= kLoGainSaturation; }
|
|---|
| 59 | void SetNotCalibrated () { fInfo[1] |= kNotCalibrated; }
|
|---|
| 60 | void SetMeanTimeInLastBin () { fInfo[1] |= kMeanTimeInLastBin; }
|
|---|
| 61 | void SetMeanTimeInFirstBin () { fInfo[1] |= kMeanTimeInFirstBin; }
|
|---|
| 62 | void SetLoGainOscillating () { fInfo[1] |= kLoGainOscillating; }
|
|---|
| 63 | void SetHiGainOscillating () { fInfo[1] |= kHiGainOscillating; }
|
|---|
| 64 | void SetConvHiLoNotValid () { fInfo[1] |= kConvHiLoNotValid; }
|
|---|
| 65 | void SetChargeSigmaNotValid () { fInfo[1] |= kChargeSigmaNotValid; }
|
|---|
| 66 | void SetChargeRelErrNotValid () { fInfo[1] |= kChargeRelErrNotValid; }
|
|---|
| 67 | void SetChargeErrNotValid () { fInfo[1] |= kChargeErrNotValid; }
|
|---|
| 68 | void SetChargeIsPedestal () { fInfo[1] |= kChargeIsPedestal; }
|
|---|
| 69 | void SetLoGainNotFitted () { fInfo[1] |= kLoGainNotFitted; }
|
|---|
| 70 | void SetHiGainNotFitted () { fInfo[1] |= kHiGainNotFitted; }
|
|---|
| 71 |
|
|---|
| 72 | // Getter
|
|---|
| 73 | Bool_t IsUnsuitable(UnsuitableType_t typ) const { return fInfo[0]&typ; }
|
|---|
| 74 |
|
|---|
| 75 | Bool_t IsOK() const { return fInfo[0]==0; }
|
|---|
| 76 | Bool_t IsBad() const { return fInfo[0]!=0; }
|
|---|
| 77 |
|
|---|
| 78 | Bool_t IsHiGainSaturation () const { return fInfo[1] & kHiGainSaturation ; }
|
|---|
| 79 | Bool_t IsLoGainSaturation () const { return fInfo[1] & kLoGainSaturation ; }
|
|---|
| 80 | Bool_t IsNotCalibrated () const { return fInfo[1] & kNotCalibrated; }
|
|---|
| 81 | Bool_t IsMeanTimeInLastBin () const { return fInfo[1] & kMeanTimeInLastBin; }
|
|---|
| 82 | Bool_t IsMeanTimeInFirstBin () const { return fInfo[1] & kMeanTimeInFirstBin; }
|
|---|
| 83 | Bool_t IsLoGainOscillating () const { return fInfo[1] & kLoGainOscillating; }
|
|---|
| 84 | Bool_t IsHiGainOscillating () const { return fInfo[1] & kHiGainOscillating; }
|
|---|
| 85 | Bool_t IsConvHiLoNotValid () const { return fInfo[1] & kConvHiLoNotValid; }
|
|---|
| 86 | Bool_t IsChargeSigmaNotValid () const { return fInfo[1] & kChargeSigmaNotValid; }
|
|---|
| 87 | Bool_t IsChargeRelErrNotValid () const { return fInfo[1] & kChargeRelErrNotValid; }
|
|---|
| 88 | Bool_t IsChargeErrNotValid () const { return fInfo[1] & kChargeErrNotValid; }
|
|---|
| 89 | Bool_t IsChargeIsPedestal () const { return fInfo[1] & kChargeIsPedestal; }
|
|---|
| 90 | Bool_t IsLoGainNotFitted () const { return fInfo[1] & kLoGainNotFitted; }
|
|---|
| 91 | Bool_t IsHiGainNotFitted () const { return fInfo[1] & kHiGainNotFitted; }
|
|---|
| 92 |
|
|---|
| 93 | Bool_t IsLoGainBad() const { return IsLoGainSaturation() || IsConvHiLoNotValid() || IsLoGainOscillating() ;}
|
|---|
| 94 | Bool_t IsHiGainBad() const { return (IsHiGainSaturation() && IsConvHiLoNotValid()) || IsHiGainOscillating(); }
|
|---|
| 95 |
|
|---|
| 96 | Bool_t IsCalibrationSignalOK() const { return !( IsChargeIsPedestal()
|
|---|
| 97 | || IsChargeErrNotValid()
|
|---|
| 98 | || IsChargeRelErrNotValid()
|
|---|
| 99 | || IsChargeSigmaNotValid()
|
|---|
| 100 | || IsMeanTimeInFirstBin()
|
|---|
| 101 | || IsMeanTimeInLastBin() ); }
|
|---|
| 102 | Bool_t IsCalibrationFitOK() const { return !( (!IsHiGainSaturation() && IsHiGainNotFitted())
|
|---|
| 103 | || ( IsHiGainSaturation() && IsLoGainNotFitted()) ); }
|
|---|
| 104 | Bool_t IsCalibrationOscillating() const { return ( !IsHiGainSaturation() && IsHiGainOscillating())
|
|---|
| 105 | || ( IsHiGainSaturation() && IsLoGainOscillating()) ; }
|
|---|
| 106 | Bool_t IsCalibrationResultOK() const { return !IsUnsuitable(kUnsuitableRun) &&
|
|---|
| 107 | IsCalibrationSignalOK()
|
|---|
| 108 | && !IsCalibrationOscillating()
|
|---|
| 109 | && ( (!IsHiGainSaturation() && !IsHiGainBad())
|
|---|
| 110 | || (IsHiGainSaturation() && !IsLoGainBad()) ) ;}
|
|---|
| 111 |
|
|---|
| 112 | void Merge(const MBadPixelsPix &pix);
|
|---|
| 113 |
|
|---|
| 114 | const TArrayI &GetInfo() const { return fInfo; }
|
|---|
| 115 |
|
|---|
| 116 | ClassDef(MBadPixelsPix, 1) // Storage Container for bad pixel information of a single pixel
|
|---|
| 117 | };
|
|---|
| 118 |
|
|---|
| 119 | #endif
|
|---|
| 120 |
|
|---|