]>
Commit | Line | Data |
---|---|---|
fb44eb8e | 1 | #include <TROOT.h> |
2 | ||
3 | #include "AliLog.h" | |
4 | #include "AliTRDarrayS.h" | |
5 | #include "Cal/AliTRDCalPadStatus.h" | |
6 | ||
7 | #include "AliTRDdataArrayDigits.h" | |
8 | ||
9 | ClassImp(AliTRDdataArrayDigits) | |
10 | ||
11 | //_____________________________________________________________________________ | |
f5375dcb | 12 | AliTRDdataArrayDigits::AliTRDdataArrayDigits(Int_t nrow, Int_t ncol, Int_t ntime): AliTRDdataArrayS(nrow, ncol, ntime) |
fb44eb8e | 13 | { |
14 | // | |
15 | // Constructor | |
16 | // | |
17 | } | |
18 | ||
19 | //_____________________________________________________________________________ | |
20 | Short_t AliTRDdataArrayDigits::GetDataUnchecked(Int_t row, Int_t col, Int_t time) const | |
21 | { | |
22 | // | |
23 | // Get the pad status without boundary checking | |
24 | // (taking pad maskng into account) | |
25 | // | |
26 | Short_t value = GetDataFast(GetIdx1Unchecked(row,col),time); | |
27 | // Be aware of Manipulations introduced by pad masking in the RawReader | |
28 | // Only output the manipulated Value | |
29 | CLRBIT(value, 10); | |
30 | CLRBIT(value, 11); | |
31 | CLRBIT(value, 12); | |
32 | return value; | |
33 | } | |
34 | ||
35 | //_____________________________________________________________________________ | |
36 | Short_t AliTRDdataArrayDigits::GetData(Int_t row, Int_t col, Int_t time) const | |
37 | { | |
38 | // | |
39 | // Get the pad signal | |
40 | // (taking pad masking into account) | |
41 | if ((row >= 0) && (col >= 0) && (time >= 0)) { | |
42 | Int_t idx1 = GetIdx1(row,col); | |
43 | if ((idx1 >= 0) && (time < fNdim2)) { | |
44 | Short_t value = 0; | |
45 | if (fBufType == 0) | |
46 | { | |
47 | value = GetDataFast(idx1,time); | |
48 | } | |
49 | if (fBufType == 1) | |
50 | { | |
51 | value = GetData1(idx1,time); | |
52 | } | |
53 | // Awareness of the bit masking | |
54 | CLRBIT(value, 10); | |
55 | CLRBIT(value, 11); | |
56 | CLRBIT(value, 12); | |
57 | return value; | |
58 | } | |
59 | else { | |
60 | if (idx1 >= 0) { | |
61 | AliError(Form("time %d out of bounds (size: %d, this: 0x%08x)" | |
62 | ,time,fNdim2,this)); | |
63 | } | |
64 | } | |
65 | } | |
66 | ||
67 | return -1; | |
68 | } | |
69 | ||
70 | ||
71 | //_____________________________________________________________________________ | |
72 | Int_t AliTRDdataArrayDigits::GetOverThreshold(Short_t threshold) | |
73 | { | |
74 | // | |
75 | // Returns the number of entries over threshold | |
76 | // (taking pad masking into account) | |
77 | // | |
78 | ||
79 | if ((fElements == 0) || (fElements->GetSize() <= 0)) | |
80 | return 0; | |
81 | ||
82 | Int_t over = 0; | |
83 | Short_t value = 0; | |
84 | ||
85 | for (Bool_t cont = First(); cont == kTRUE; cont = Next()) { | |
86 | if ((fCurrentIdx1 < 0) || (fCurrentIdx1 >= fNdim1)) continue; | |
87 | if ((fCurrentIdx2 < 0) || (fCurrentIdx2 >= fNdim2)) continue; | |
88 | value = fElements->At(fCurrentIndex); | |
89 | CLRBIT(value, 10); | |
90 | CLRBIT(value, 11); | |
91 | CLRBIT(value, 12); | |
92 | if (value > threshold) over++; | |
93 | } | |
94 | ||
95 | return over; | |
96 | ||
97 | } | |
98 | ||
99 | //_____________________________________________________________________________ | |
100 | UChar_t AliTRDdataArrayDigits::GetPadStatus(Int_t row, Int_t col, Int_t time) const | |
101 | { | |
102 | // | |
103 | // Returns the pad status stored in the pad signal | |
104 | // | |
105 | // Output is a UChar_t value | |
106 | // Status Codes: | |
107 | // Noisy Masking: 2 | |
108 | // Bridged Left Masking 8 | |
109 | // Bridged Right Masking 8 | |
110 | // Not Connected Masking 32 | |
111 | // | |
112 | UChar_t padstatus = 0; | |
113 | Short_t signal = GetDataFast(GetIdx1Unchecked(row,col),time); | |
114 | if(signal > 0 && TESTBIT(signal, 10)){ | |
115 | if(TESTBIT(signal, 11)) | |
116 | if(TESTBIT(signal, 12)) | |
117 | padstatus = AliTRDCalPadStatus::kPadBridgedRight; | |
118 | else | |
119 | padstatus = AliTRDCalPadStatus::kNotConnected; | |
120 | else | |
121 | if(TESTBIT(signal, 12)) | |
122 | padstatus = AliTRDCalPadStatus::kPadBridgedLeft; | |
123 | else | |
124 | padstatus = AliTRDCalPadStatus::kMasked; | |
125 | } | |
126 | return padstatus; | |
127 | } | |
128 | ||
129 | //_____________________________________________________________________________ | |
130 | void AliTRDdataArrayDigits::SetPadStatus(Int_t row, Int_t col, Int_t time, UChar_t status) | |
131 | { | |
132 | // | |
133 | // Setting the pad status into the signal using the Bits 10 to 14 | |
134 | // (currently used: 10 to 12) | |
135 | // | |
136 | // Input codes (Unsigned char): | |
137 | // Noisy Masking: 2 | |
138 | // Bridged Left Masking 8 | |
139 | // Bridged Right Masking 8 | |
140 | // Not Connected Masking 32 | |
141 | // | |
142 | // Status codes: Any masking: Bit 10(1) | |
143 | // Noisy masking: Bit 11(0), Bit 12(0) | |
144 | // No Connection masking: Bit 11(1), Bit 12(0) | |
145 | // Bridged Left masking: Bit 11(0), Bit 12(1) | |
146 | // Bridged Right masking: Bit 11(1), Bit 12(1) | |
147 | // | |
f5375dcb | 148 | Short_t signal = GetDataFast(GetIdx1Unchecked(row, col), time); |
fb44eb8e | 149 | // only set the Pad Status if the signal is > 0 |
150 | if(signal > 0){ | |
151 | switch(status) | |
152 | { | |
153 | case AliTRDCalPadStatus::kMasked: | |
154 | SETBIT(signal, 10); | |
155 | CLRBIT(signal, 11); | |
156 | CLRBIT(signal, 12); | |
157 | break; | |
158 | case AliTRDCalPadStatus::kNotConnected: | |
159 | SETBIT(signal, 10); | |
160 | SETBIT(signal, 11); | |
161 | CLRBIT(signal, 12); | |
162 | break; | |
163 | case AliTRDCalPadStatus::kPadBridgedLeft: | |
164 | SETBIT(signal, 10); | |
165 | CLRBIT(signal, 11); | |
166 | SETBIT(signal, 12); | |
167 | break; | |
168 | case AliTRDCalPadStatus::kPadBridgedRight: | |
169 | SETBIT(signal, 10); | |
170 | SETBIT(signal, 11); | |
171 | SETBIT(signal, 12); | |
172 | default: | |
173 | CLRBIT(signal, 10); | |
174 | CLRBIT(signal, 11); | |
175 | CLRBIT(signal, 12); | |
176 | } | |
177 | SetDataUnchecked(row, col, time, signal); | |
178 | } | |
179 | } | |
180 | ||
181 | //_____________________________________________________________________________ | |
182 | Bool_t AliTRDdataArrayDigits::IsPadCorrupted(Int_t row, Int_t col, Int_t time) | |
183 | { | |
184 | // | |
185 | // Checks if the pad has any masking as corrupted (Bit 10 in signal set) | |
186 | // | |
187 | Short_t signal = GetDataFast(GetIdx1Unchecked(row, col), time); | |
188 | return (signal > 0 && TESTBIT(signal, 10)) ? kTRUE : kFALSE; | |
189 | } | |
190 |