1 #ifndef ALITRDDATAARRAYI_H
2 #define ALITRDDATAARRAYI_H
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
7 /* $Id: AliTRDdataArrayI.h,v */
9 #include "AliTRDdataArray.h"
11 /////////////////////////////////////////////////////////////
13 // General container for integer data from TRD detector //
15 // Adapted from AliDigits, origin M.Ivanov //
17 /////////////////////////////////////////////////////////////
19 class AliTRDdataArrayI : public AliTRDdataArray {
24 AliTRDdataArrayI(Int_t nrow, Int_t ncol, Int_t ntime);
25 AliTRDdataArrayI(AliTRDdataArrayI &a);
26 virtual ~AliTRDdataArrayI();
28 virtual void Allocate(Int_t nrow, Int_t ncol, Int_t ntime);
29 virtual void Copy(AliTRDdataArrayI &a);
30 virtual void Compress(Int_t bufferType, Int_t threshold);
31 virtual void Compress(Int_t bufferType);
32 virtual void Expand();
33 virtual Bool_t First();
34 virtual Bool_t Next();
37 inline void SetData(Int_t row, Int_t col, Int_t time, Int_t value);
38 virtual void SetThreshold(Int_t threshold) { fThreshold = threshold; };
40 virtual Int_t GetData(Int_t row, Int_t col, Int_t time);
41 virtual Int_t GetThreshold() { return fThreshold; };
43 virtual Int_t GetSize();
44 virtual Int_t GetDataSize();
45 virtual Int_t GetOverThreshold(Int_t threshold);
47 inline AliTRDdataArrayI &operator=(AliTRDdataArrayI &a);
51 inline void SetDataFast(Int_t idx1, Int_t idx2, Int_t value);
52 inline Int_t GetDataFast(Int_t idx1, Int_t idx2);
54 Int_t GetData1(Int_t idx1, Int_t idx2);
64 AliTRDarrayI *fElements; // Buffer of 4 bytes integers for the array content
65 Int_t fThreshold; // Threshold for zero suppression
67 ClassDef(AliTRDdataArrayI,1) // Container for integer data of one TRD detector segment
72 //_____________________________________________________________________________
73 Int_t AliTRDdataArrayI::GetDataFast(Int_t idx1, Int_t idx2)
76 // Returns the value at a given position in the array
79 return fElements->At(fIndex->At(idx2) + idx1);
83 //_____________________________________________________________________________
84 void AliTRDdataArrayI::SetData(Int_t row, Int_t col, Int_t time, Int_t value)
87 // Sets the data value at a given position of the array
88 // Includes boundary checking
91 if ((row >= 0) && (col >= 0) && (time >= 0)) {
92 Int_t idx1 = GetIdx1(row,col);
93 if ((idx1 >= 0) && (time < fNdim2)) {
94 SetDataFast(idx1,time,value);
98 TObject::Error("SetData"
99 ,"time %d out of bounds (size: %d, this: 0x%08x)"
107 //_____________________________________________________________________________
108 void AliTRDdataArrayI::SetDataFast(Int_t idx1, Int_t idx2, Int_t value)
111 // Set the value at a given position in the array
114 if ((idx1 < 0) || (idx1 >= fNdim1) ||
115 (idx2 < 0) || (idx2 >= fNdim2)) {
116 TObject::Error("SetDataFast"
117 ,"idx1 %d idx2 %d out of bounds (size: %d x %d, this: 0x%08x)"
118 ,idx1,idx2,fNdim1,fNdim2,this);
121 (*fElements)[fIndex->fArray[idx2] + idx1] = value;
125 //_____________________________________________________________________________
126 AliTRDdataArrayI &AliTRDdataArrayI::operator=(AliTRDdataArrayI &a)
129 // Assignment operator
132 if (this != &a) a.Copy(*this);