]>
Commit | Line | Data |
---|---|---|
8230f242 | 1 | #ifndef ALITRDDATAARRAYI_H |
2 | #define ALITRDDATAARRAYI_H | |
6f1e466d | 3 | |
4 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
5 | * See cxx source for full Copyright notice */ | |
6 | ||
7 | /* $Id: AliTRDdataArrayI.h,v */ | |
8 | ||
9 | #include "AliTRDdataArray.h" | |
10 | ||
11 | ///////////////////////////////////////////////////////////// | |
12 | // // | |
13 | // General container for integer data from TRD detector // | |
14 | // segments. // | |
15 | // Adapted from AliDigits, origin M.Ivanov // | |
16 | // // | |
17 | ///////////////////////////////////////////////////////////// | |
18 | ||
19 | class AliTRDdataArrayI : public AliTRDdataArray { | |
20 | ||
21 | public: | |
22 | ||
23 | AliTRDdataArrayI(); | |
24 | AliTRDdataArrayI(Int_t nrow, Int_t ncol, Int_t ntime); | |
8230f242 | 25 | AliTRDdataArrayI(AliTRDdataArrayI &a); |
26 | virtual ~AliTRDdataArrayI(); | |
6f1e466d | 27 | |
28 | virtual void Allocate(Int_t nrow, Int_t ncol, Int_t ntime); | |
8230f242 | 29 | virtual void Copy(AliTRDdataArrayI &a); |
6f1e466d | 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(); | |
35 | virtual void Reset(); | |
36 | ||
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; }; | |
39 | ||
40 | virtual Int_t GetData(Int_t row, Int_t col, Int_t time); | |
41 | virtual Int_t GetThreshold() { return fThreshold; }; | |
42 | ||
43 | virtual Int_t GetSize(); | |
44 | virtual Int_t GetDataSize(); | |
45 | virtual Int_t GetOverThreshold(Int_t threshold); | |
46 | ||
8230f242 | 47 | inline AliTRDdataArrayI &operator=(AliTRDdataArrayI &a); |
48 | ||
6f1e466d | 49 | protected: |
50 | ||
51 | inline void SetDataFast(Int_t idx1, Int_t idx2, Int_t value); | |
52 | inline Int_t GetDataFast(Int_t idx1, Int_t idx2); | |
53 | ||
54 | Int_t GetData1(Int_t idx1, Int_t idx2); | |
55 | void Expand1(); | |
56 | void Compress1(); | |
57 | void Expand2(); | |
58 | void Compress2(); | |
59 | Bool_t First0(); | |
60 | Bool_t Next0(); | |
61 | Bool_t First1(); | |
62 | Bool_t Next1(); | |
63 | ||
64 | AliTRDarrayI *fElements; // Buffer of 4 bytes integers for the array content | |
65 | Int_t fThreshold; // Threshold for zero suppression | |
66 | ||
67 | ClassDef(AliTRDdataArrayI,1) // Container for integer data of one TRD detector segment | |
68 | ||
69 | }; | |
70 | ||
71 | ||
72 | //_____________________________________________________________________________ | |
8230f242 | 73 | Int_t AliTRDdataArrayI::GetDataFast(Int_t idx1, Int_t idx2) |
6f1e466d | 74 | { |
75 | // | |
76 | // Returns the value at a given position in the array | |
77 | // | |
78 | ||
79 | return fElements->At(fIndex->At(idx2) + idx1); | |
80 | ||
81 | } | |
82 | ||
83 | //_____________________________________________________________________________ | |
8230f242 | 84 | void AliTRDdataArrayI::SetData(Int_t row, Int_t col, Int_t time, Int_t value) |
6f1e466d | 85 | { |
86 | // | |
87 | // Sets the data value at a given position of the array | |
88 | // Includes boundary checking | |
89 | // | |
90 | ||
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); | |
95 | } | |
96 | else { | |
97 | if (idx1 >= 0) { | |
98 | TObject::Error("SetData" | |
99 | ,"time %d out of bounds (size: %d, this: 0x%08x)" | |
100 | ,time,fNdim2,this); | |
101 | } | |
102 | } | |
103 | } | |
104 | ||
105 | } | |
106 | ||
107 | //_____________________________________________________________________________ | |
8230f242 | 108 | void AliTRDdataArrayI::SetDataFast(Int_t idx1, Int_t idx2, Int_t value) |
6f1e466d | 109 | { |
110 | // | |
111 | // Set the value at a given position in the array | |
112 | // | |
113 | ||
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); | |
119 | } | |
120 | ||
121 | (*fElements)[fIndex->fArray[idx2] + idx1] = value; | |
122 | ||
123 | } | |
124 | ||
8230f242 | 125 | //_____________________________________________________________________________ |
126 | AliTRDdataArrayI &AliTRDdataArrayI::operator=(AliTRDdataArrayI &a) | |
127 | { | |
128 | // | |
129 | // Assignment operator | |
130 | // | |
131 | ||
132 | if (this != &a) a.Copy(*this); | |
133 | return *this; | |
134 | ||
135 | } | |
136 | ||
6f1e466d | 137 | #endif |
138 |