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