source: branches/Mars_McMismatchStudy/mbadpixels/MBadPixelsPix.h@ 18066

Last change on this file since 18066 was 8988, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 6.4 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 kDeviatingRelTimeResolution = 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 kDeviatingAbsTimeResolution = 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( kDeviatingAbsTimeResolution)) return 7;
111 if (IsUncalibrated( kDeviatingRelTimeResolution)) return 8;
112 if (IsUncalibrated( kLoGainBlackout )) return 9;
113 if (IsUncalibrated( kPreviouslyExcluded )) return 10;
114 return 11;
115 }
116
117 static TString GetUnsuitableName(Int_t lvl)
118 {
119 switch (lvl)
120 {
121 case 1: return "Signal smaller 4.5 Pedestal RMS";
122 case 2: return "Low Gain Saturation";
123 case 3: return "High-Gain Histogram Overflow";
124 case 4: return "Low-Gain Histogram Overflow";
125 case 5: return "Presumably dead from Ped. Rms";
126 case 6: return "Deviating Number of Photo-electrons";
127 case 7: return "Deviation from median abs.arr-time rms";
128 case 8: return "Deviation from median rel.arr-time rms";
129 case 9: return "Too many Low-Gain Blackout Events";
130 case 10: return "Previously Excluded";
131 default: return "";
132 }
133 }
134
135 static Int_t GetNumUnsuitable() { return 10; }
136
137 Int_t GetUnreliableCalLevel() const {
138 if (!IsUnreliable() || IsUnsuitable()) return 0;
139 if (IsUncalibrated( kChargeSigmaNotValid )) return 1;
140 if (IsUncalibrated( kHiGainNotFitted )) return 2;
141 if (IsUncalibrated( kLoGainNotFitted )) return 3;
142 if (IsUncalibrated( kRelTimeNotFitted )) return 4;
143 if (IsUncalibrated( kHiGainOscillating )) return 5;
144 if (IsUncalibrated( kLoGainOscillating )) return 6;
145 if (IsUncalibrated( kRelTimeOscillating )) return 7;
146 if (IsUncalibrated( kDeviatingFFactor )) return 8;
147 return 9;
148 }
149
150 static TString GetUnreliableName(Int_t lvl)
151 {
152 switch (lvl)
153 {
154 case 1: return "Signal Sigma smaller Pedestal RMS";
155 case 2: return "High Gain Signals could not be fitted";
156 case 3: return "Low Gain Signals could not be fitted";
157 case 4: return "Relative Arr. Times could not be fitted";
158 case 5: return "High Gain Signals Oscillation";
159 case 6: return "Low Gain Signals Oscillation";
160 case 7: return "Relative Arr. Times Oscillation";
161 case 8: return "Deviating global F-Factor";
162 default: return "";
163 }
164 }
165
166 static Int_t GetNumUnreliable() { return 8; }
167
168 void Merge(const MBadPixelsPix &pix);
169
170 const TArrayI &GetInfo() const { return fInfo; }
171
172 ClassDef(MBadPixelsPix, 1) // Storage Container for bad pixel information of a single pixel
173};
174
175#endif
176
Note: See TracBrowser for help on using the repository browser.