]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDdataArrayDigits.cxx
Tentative version of the new raw-reader class which will handle the online reconstruc...
[u/mrichter/AliRoot.git] / TRD / AliTRDdataArrayDigits.cxx
CommitLineData
fb44eb8e 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id: AliTRDdataArrayDigits.cxx,v 1.17 2006/08/28 14:37:05 cblume Exp $ */
17
18///////////////////////////////////////////////////////////////////////////////
19// //
20// Container for TRD signals type of short taking pad masking into account //
21// //
22// Author: //
23// Markus Fasel (markus.fasel@web.de) //
24// //
25///////////////////////////////////////////////////////////////////////////////
26
27#include <TROOT.h>
28
29#include "AliLog.h"
30#include "AliTRDarrayS.h"
31#include "Cal/AliTRDCalPadStatus.h"
32
33#include "AliTRDdataArrayDigits.h"
34
35ClassImp(AliTRDdataArrayDigits)
36
37//_____________________________________________________________________________
38AliTRDdataArrayDigits::AliTRDdataArrayDigits(Int_t nrow, Int_t ncol, Int_t ntime)
39 :AliTRDdataArrayS(nrow, ncol, ntime)
40{
41 //
42 // Constructor
43 //
44}
45
46//_____________________________________________________________________________
47Short_t AliTRDdataArrayDigits::GetDataUnchecked(Int_t row, Int_t col, Int_t time) const
48{
49 //
50 // Get the pad status without boundary checking
51 // (taking pad maskng into account)
52 //
53 Short_t value = GetDataFast(GetIdx1Unchecked(row,col),time);
54 // Be aware of Manipulations introduced by pad masking in the RawReader
55 // Only output the manipulated Value
56 CLRBIT(value, 10);
57 CLRBIT(value, 11);
58 CLRBIT(value, 12);
59 return value;
60}
61
62//_____________________________________________________________________________
63Short_t AliTRDdataArrayDigits::GetData(Int_t row, Int_t col, Int_t time) const
64{
65 //
66 // Get the pad signal
67 // (taking pad masking into account)
68 if ((row >= 0) && (col >= 0) && (time >= 0)) {
69 Int_t idx1 = GetIdx1(row,col);
70 if ((idx1 >= 0) && (time < fNdim2)) {
71 Short_t value = 0;
72 if (fBufType == 0)
73 {
74 value = GetDataFast(idx1,time);
75 }
76 if (fBufType == 1)
77 {
78 value = GetData1(idx1,time);
79 }
80 // Awareness of the bit masking
81 CLRBIT(value, 10);
82 CLRBIT(value, 11);
83 CLRBIT(value, 12);
84 return value;
85 }
86 else {
87 if (idx1 >= 0) {
88 AliError(Form("time %d out of bounds (size: %d, this: 0x%08x)"
89 ,time,fNdim2,this));
90 }
91 }
92 }
93
94 return -1;
95}
96
97
98//_____________________________________________________________________________
99Int_t AliTRDdataArrayDigits::GetOverThreshold(Short_t threshold)
100{
101 //
102 // Returns the number of entries over threshold
103 // (taking pad masking into account)
104 //
105
106 if ((fElements == 0) || (fElements->GetSize() <= 0))
107 return 0;
108
109 Int_t over = 0;
110 Short_t value = 0;
111
112 for (Bool_t cont = First(); cont == kTRUE; cont = Next()) {
113 if ((fCurrentIdx1 < 0) || (fCurrentIdx1 >= fNdim1)) continue;
114 if ((fCurrentIdx2 < 0) || (fCurrentIdx2 >= fNdim2)) continue;
115 value = fElements->At(fCurrentIndex);
116 CLRBIT(value, 10);
117 CLRBIT(value, 11);
118 CLRBIT(value, 12);
119 if (value > threshold) over++;
120 }
121
122 return over;
123
124}
125
126//_____________________________________________________________________________
127UChar_t AliTRDdataArrayDigits::GetPadStatus(Int_t row, Int_t col, Int_t time) const
128{
129 //
130 // Returns the pad status stored in the pad signal
131 //
132 // Output is a UChar_t value
133 // Status Codes:
134 // Noisy Masking: 2
135 // Bridged Left Masking 8
136 // Bridged Right Masking 8
137 // Not Connected Masking 32
138 //
139 UChar_t padstatus = 0;
140 Short_t signal = GetDataFast(GetIdx1Unchecked(row,col),time);
141 if(signal > 0 && TESTBIT(signal, 10)){
142 if(TESTBIT(signal, 11))
143 if(TESTBIT(signal, 12))
144 padstatus = AliTRDCalPadStatus::kPadBridgedRight;
145 else
146 padstatus = AliTRDCalPadStatus::kNotConnected;
147 else
148 if(TESTBIT(signal, 12))
149 padstatus = AliTRDCalPadStatus::kPadBridgedLeft;
150 else
151 padstatus = AliTRDCalPadStatus::kMasked;
152 }
153 return padstatus;
154}
155
156//_____________________________________________________________________________
157void AliTRDdataArrayDigits::SetPadStatus(Int_t row, Int_t col, Int_t time, UChar_t status)
158{
159 //
160 // Setting the pad status into the signal using the Bits 10 to 14
161 // (currently used: 10 to 12)
162 //
163 // Input codes (Unsigned char):
164 // Noisy Masking: 2
165 // Bridged Left Masking 8
166 // Bridged Right Masking 8
167 // Not Connected Masking 32
168 //
169 // Status codes: Any masking: Bit 10(1)
170 // Noisy masking: Bit 11(0), Bit 12(0)
171 // No Connection masking: Bit 11(1), Bit 12(0)
172 // Bridged Left masking: Bit 11(0), Bit 12(1)
173 // Bridged Right masking: Bit 11(1), Bit 12(1)
174 //
175 Short_t signal = GetDataFast(GetIdx1Unchecked(col, row), time);
176 // only set the Pad Status if the signal is > 0
177 if(signal > 0){
178 switch(status)
179 {
180 case AliTRDCalPadStatus::kMasked:
181 SETBIT(signal, 10);
182 CLRBIT(signal, 11);
183 CLRBIT(signal, 12);
184 break;
185 case AliTRDCalPadStatus::kNotConnected:
186 SETBIT(signal, 10);
187 SETBIT(signal, 11);
188 CLRBIT(signal, 12);
189 break;
190 case AliTRDCalPadStatus::kPadBridgedLeft:
191 SETBIT(signal, 10);
192 CLRBIT(signal, 11);
193 SETBIT(signal, 12);
194 break;
195 case AliTRDCalPadStatus::kPadBridgedRight:
196 SETBIT(signal, 10);
197 SETBIT(signal, 11);
198 SETBIT(signal, 12);
199 default:
200 CLRBIT(signal, 10);
201 CLRBIT(signal, 11);
202 CLRBIT(signal, 12);
203 }
204 SetDataUnchecked(row, col, time, signal);
205 }
206}
207
208//_____________________________________________________________________________
209Bool_t AliTRDdataArrayDigits::IsPadCorrupted(Int_t row, Int_t col, Int_t time)
210{
211 //
212 // Checks if the pad has any masking as corrupted (Bit 10 in signal set)
213 //
214 Short_t signal = GetDataFast(GetIdx1Unchecked(row, col), time);
215 return (signal > 0 && TESTBIT(signal, 10)) ? kTRUE : kFALSE;
216}
217