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

Last change on this file since 4851 was 4793, checked in by gaug, 20 years ago
*** empty log message ***
File size: 4.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 kHiGainNotFitted = BIT(1),
34 kLoGainNotFitted = BIT(2),
35 kRelTimeNotFitted = BIT(3),
36 kHiGainOscillating = BIT(4),
37 kLoGainOscillating = BIT(5),
38 kRelTimeOscillating = BIT(6),
39 kLoGainSaturation = BIT(7),
40 kChargeIsPedestal = BIT(8),
41 kChargeErrNotValid = BIT(9),
42 kChargeRelErrNotValid = BIT(10),
43 kChargeSigmaNotValid = BIT(11),
44 kMeanTimeInFirstBin = BIT(12),
45 kMeanTimeInLast2Bins = BIT(13),
46 kDeviatingNumPhes = BIT(14),
47 kDeviatingNumPhots = BIT(15),
48 kDeviatingFFactor = BIT(16),
49 kDeviatingTimeResolution = BIT(17),
50 kConversionHiLoNotValid = BIT(18),
51 kHiGainOverFlow = BIT(19),
52 kLoGainOverFlow = BIT(20)
53 };
54
55 // This is just a start..
56 enum HardwareType_t {
57 kHVNotNominal = BIT(1)
58 };
59
60
61 void Reset();
62 void Clear(Option_t *o="");
63 void Copy(TObject &object) const
64 {
65 static_cast<MBadPixelsPix&>(object).fInfo = fInfo;
66 }
67
68 // Setter
69 void SetUnsuitable (UnsuitableType_t typ) { fInfo[0] |= typ; }
70 void SetUncalibrated(UncalibratedType_t typ) { fInfo[1] |= typ; }
71 void SetHardware (HardwareType_t typ) { fInfo[2] |= typ; }
72
73 // Getter
74 Bool_t IsUnsuitable (UnsuitableType_t typ) const { return fInfo[0]&typ; }
75 Bool_t IsUncalibrated(UncalibratedType_t typ) const { return fInfo[1]&typ; }
76 Bool_t IsHardwareBad (HardwareType_t typ) const { return fInfo[2]&typ; }
77
78 Bool_t IsUnsuitable() const { return fInfo[0]&kUnsuitable; }
79 Bool_t IsUnreliable() const { return fInfo[0]&kUnreliable; }
80
81 Bool_t IsOK() const { return fInfo[0]==0; }
82 Bool_t IsBad() const { return fInfo[0]!=0; }
83
84 Bool_t IsLoGainBad() const { return IsUnsuitable (kUnsuitableRun )
85 || IsUncalibrated(kLoGainSaturation )
86 || IsUncalibrated(kConversionHiLoNotValid)
87 || IsUncalibrated(kLoGainOscillating ) ; }
88 Bool_t IsHiGainBad() const { return IsUnsuitable (kUnsuitableRun )
89 || IsUncalibrated(kHiGainOscillating ) ; }
90
91 Int_t GetUnsuitableCalibration() const {
92 if (!IsUnsuitable()) return 0;
93 if (IsUncalibrated( kChargeIsPedestal )) return 1;
94 if (IsUncalibrated( kChargeRelErrNotValid)) return 2;
95 if (IsUncalibrated( kLoGainSaturation )) return 3;
96 if (IsUncalibrated( kMeanTimeInFirstBin )) return 4;
97 if (IsUncalibrated( kMeanTimeInLast2Bins )) return 5;
98 if (IsUncalibrated( kDeviatingNumPhes )) return 6;
99 if (IsUncalibrated( kDeviatingFFactor )) return 7;
100 if (IsUncalibrated( kDeviatingNumPhots )) return 8;
101 if (IsUncalibrated( kHiGainOverFlow )) return 9;
102 if (IsUncalibrated( kLoGainOverFlow )) return 10;
103 return 11;
104 }
105
106 Int_t GetUnreliableCalibration() const {
107 if (!IsUnreliable() || IsUnsuitable()) return 0;
108 if (IsUncalibrated( kChargeSigmaNotValid )) return 1;
109 if (IsUncalibrated( kHiGainNotFitted )) return 2;
110 if (IsUncalibrated( kLoGainNotFitted )) return 3;
111 if (IsUncalibrated( kRelTimeNotFitted )) return 4;
112 if (IsUncalibrated( kHiGainOscillating )) return 5;
113 if (IsUncalibrated( kLoGainOscillating )) return 6;
114 if (IsUncalibrated( kRelTimeOscillating )) return 7;
115 return 8;
116 }
117
118
119
120 void Merge(const MBadPixelsPix &pix);
121
122 const TArrayI &GetInfo() const { return fInfo; }
123
124 ClassDef(MBadPixelsPix, 1) // Storage Container for bad pixel information of a single pixel
125};
126
127#endif
128
Note: See TracBrowser for help on using the repository browser.