source: trunk/MagicSoft/Mars/mbadpixels/MBadPixelsPix.h@ 8577

Last change on this file since 8577 was 8478, checked in by tbretz, 18 years ago
*** empty log message ***
File size: 4.9 KB
Line 
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
12class MBadPixelsPix : public MParContainer
13{
14private:
15 TArrayI fInfo;
16
17public:
18 MBadPixelsPix(const char* name=NULL, const char* title=NULL);
19
20 enum UnsuitableType_t {
21 kUnsuitableRun = BIT(1),
22 kUnsuitableEvt = BIT(2),
23 kUnsuitable = kUnsuitableRun|kUnsuitableEvt,
24 kUnreliableRun = BIT(3),
25 kUnreliableEvt = BIT(4),
26 kUnreliable = kUnreliableRun|kUnreliableEvt
27 };
28
29 static const Int_t fgRunMask; // All types which are not event wise determined
30
31 // All types are initialized to normal behaviour
32 enum UncalibratedType_t {
33 kPreviouslyExcluded = BIT(0),
34 kHiGainNotFitted = BIT(1),
35 kLoGainNotFitted = BIT(2),
36 kRelTimeNotFitted = BIT(3),
37 kHiGainOscillating = BIT(4),
38 kLoGainOscillating = BIT(5),
39 kRelTimeOscillating = BIT(6),
40 kLoGainSaturation = BIT(7),
41 kChargeIsPedestal = BIT(8),
42 kChargeErrNotValid = BIT(9),
43 kChargeRelErrNotValid = BIT(10),
44 kChargeSigmaNotValid = BIT(11),
45 kMeanTimeInFirstBin = BIT(12),
46 kMeanTimeInLast2Bins = BIT(13),
47 kDeviatingNumPhes = BIT(14),
48 kDeviatingNumPhots = BIT(15),
49 kDeviatingFFactor = BIT(16),
50 kDeviatingTimeResolution = BIT(17),
51 kConversionHiLoNotValid = BIT(18),
52 kHiGainOverFlow = BIT(19),
53 kLoGainOverFlow = BIT(20),
54 kHiLoNotFitted = BIT(21),
55 kHiLoOscillating = BIT(22),
56 kDeadPedestalRms = BIT(23),
57 kFluctuatingArrivalTimes = BIT(24),
58 kLoGainBlackout = BIT(25)
59 };
60
61 // This is just a start..
62 enum HardwareType_t {
63 kHVNotNominal = BIT(1)
64 };
65
66
67 void Reset();
68 void Clear(Option_t *o="");
69 void Copy(TObject &object) const
70 {
71 static_cast<MBadPixelsPix&>(object).fInfo = fInfo;
72 }
73
74 // Setter
75 void SetUnsuitable (UnsuitableType_t typ) { fInfo[0] |= typ; }
76 void SetUncalibrated(UncalibratedType_t typ) { fInfo[1] |= typ; }
77 void SetHardware (HardwareType_t typ) { fInfo[2] |= typ; }
78
79 // Getter
80 Bool_t IsUnsuitable (UnsuitableType_t typ) const { return fInfo[0]&typ; }
81 Bool_t IsUncalibrated(UncalibratedType_t typ) const { return fInfo[1]&typ; }
82 Bool_t IsHardwareBad (HardwareType_t typ) const { return fInfo[2]&typ; }
83
84 Bool_t IsUnsuitable() const { return fInfo[0]&kUnsuitable; }
85 Bool_t IsUnreliable() const { return fInfo[0]&kUnreliable; }
86 Bool_t IsUncalibrated() const { return fInfo[1]!=0; }
87
88 Bool_t IsOK() const { return fInfo[0]==0; }
89 Bool_t IsBad() const { return fInfo[0]!=0; }
90
91 Bool_t IsLoGainBad() const { return IsUnsuitable (kUnsuitableRun )
92 || IsUncalibrated(kLoGainSaturation )
93 || IsUncalibrated(kConversionHiLoNotValid)
94 || IsUncalibrated(kLoGainOscillating )
95 || IsUncalibrated(kLoGainBlackout ); }
96 Bool_t IsHiGainBad() const { return IsUnsuitable (kUnsuitableRun )
97 || IsUncalibrated(kHiGainOscillating ) ; }
98
99 Int_t GetUnsuitableCalLevel() const {
100 if (!IsUnsuitable()) return 0;
101 if (IsUncalibrated( kChargeIsPedestal )) return 1;
102 if (IsUncalibrated( kLoGainSaturation )) return 2;
103// if (IsUncalibrated( kMeanTimeInFirstBin )) return 3;
104// if (IsUncalibrated( kMeanTimeInLast2Bins )) return 4;
105 if (IsUncalibrated( kHiGainOverFlow )) return 3;
106 if (IsUncalibrated( kLoGainOverFlow )) return 4;
107 if (IsUncalibrated( kDeadPedestalRms )) return 5;
108 if (IsUncalibrated( kDeviatingNumPhes )) return 6;
109 if (IsUncalibrated( kFluctuatingArrivalTimes)) return 7;
110 if (IsUncalibrated( kDeviatingTimeResolution)) return 8;
111 if (IsUncalibrated( kLoGainBlackout )) return 9;
112 if (IsUncalibrated( kPreviouslyExcluded )) return 10;
113 return 11;
114 }
115
116 Int_t GetUnreliableCalLevel() const {
117 if (!IsUnreliable() || IsUnsuitable()) return 0;
118 if (IsUncalibrated( kChargeSigmaNotValid )) return 1;
119 if (IsUncalibrated( kHiGainNotFitted )) return 2;
120 if (IsUncalibrated( kLoGainNotFitted )) return 3;
121 if (IsUncalibrated( kRelTimeNotFitted )) return 4;
122 if (IsUncalibrated( kHiGainOscillating )) return 5;
123 if (IsUncalibrated( kLoGainOscillating )) return 6;
124 if (IsUncalibrated( kRelTimeOscillating )) return 7;
125 if (IsUncalibrated( kDeviatingFFactor )) return 8;
126 return 9;
127 }
128
129 void Merge(const MBadPixelsPix &pix);
130
131 const TArrayI &GetInfo() const { return fInfo; }
132
133 ClassDef(MBadPixelsPix, 1) // Storage Container for bad pixel information of a single pixel
134};
135
136#endif
137
Note: See TracBrowser for help on using the repository browser.