1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 /* $Id: AliTRDdataArrayDigits.cxx,v 1.17 2006/08/28 14:37:05 cblume Exp $ */
18 ///////////////////////////////////////////////////////////////////////////////
20 // Container for TRD signals type of short taking pad masking into account //
23 // Markus Fasel (markus.fasel@web.de) //
25 ///////////////////////////////////////////////////////////////////////////////
30 #include "AliTRDarrayS.h"
31 #include "Cal/AliTRDCalPadStatus.h"
33 #include "AliTRDdataArrayDigits.h"
35 ClassImp(AliTRDdataArrayDigits)
37 //_____________________________________________________________________________
38 AliTRDdataArrayDigits::AliTRDdataArrayDigits(Int_t nrow, Int_t ncol, Int_t ntime)
39 :AliTRDdataArrayS(nrow, ncol, ntime)
46 //_____________________________________________________________________________
47 Short_t AliTRDdataArrayDigits::GetDataUnchecked(Int_t row, Int_t col, Int_t time) const
50 // Get the pad status without boundary checking
51 // (taking pad maskng into account)
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
62 //_____________________________________________________________________________
63 Short_t AliTRDdataArrayDigits::GetData(Int_t row, Int_t col, Int_t time) const
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)) {
74 value = GetDataFast(idx1,time);
78 value = GetData1(idx1,time);
80 // Awareness of the bit masking
88 AliError(Form("time %d out of bounds (size: %d, this: 0x%08x)"
98 //_____________________________________________________________________________
99 Int_t AliTRDdataArrayDigits::GetOverThreshold(Short_t threshold)
102 // Returns the number of entries over threshold
103 // (taking pad masking into account)
106 if ((fElements == 0) || (fElements->GetSize() <= 0))
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);
119 if (value > threshold) over++;
126 //_____________________________________________________________________________
127 UChar_t AliTRDdataArrayDigits::GetPadStatus(Int_t row, Int_t col, Int_t time) const
130 // Returns the pad status stored in the pad signal
132 // Output is a UChar_t value
135 // Bridged Left Masking 8
136 // Bridged Right Masking 8
137 // Not Connected Masking 32
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;
146 padstatus = AliTRDCalPadStatus::kNotConnected;
148 if(TESTBIT(signal, 12))
149 padstatus = AliTRDCalPadStatus::kPadBridgedLeft;
151 padstatus = AliTRDCalPadStatus::kMasked;
156 //_____________________________________________________________________________
157 void AliTRDdataArrayDigits::SetPadStatus(Int_t row, Int_t col, Int_t time, UChar_t status)
160 // Setting the pad status into the signal using the Bits 10 to 14
161 // (currently used: 10 to 12)
163 // Input codes (Unsigned char):
165 // Bridged Left Masking 8
166 // Bridged Right Masking 8
167 // Not Connected Masking 32
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)
175 Short_t signal = GetDataFast(GetIdx1Unchecked(col, row), time);
176 // only set the Pad Status if the signal is > 0
180 case AliTRDCalPadStatus::kMasked:
185 case AliTRDCalPadStatus::kNotConnected:
190 case AliTRDCalPadStatus::kPadBridgedLeft:
195 case AliTRDCalPadStatus::kPadBridgedRight:
204 SetDataUnchecked(row, col, time, signal);
208 //_____________________________________________________________________________
209 Bool_t AliTRDdataArrayDigits::IsPadCorrupted(Int_t row, Int_t col, Int_t time)
212 // Checks if the pad has any masking as corrupted (Bit 10 in signal set)
214 Short_t signal = GetDataFast(GetIdx1Unchecked(row, col), time);
215 return (signal > 0 && TESTBIT(signal, 10)) ? kTRUE : kFALSE;