]>
Commit | Line | Data |
---|---|---|
cc80f89e | 1 | #ifndef ALIDIGITS_H |
2 | #define ALIDIGITS_H | |
3 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
4 | * See cxx source for full Copyright notice */ | |
5 | ||
6 | /* $Id$ */ | |
7 | ||
8 | //////////////////////////////////////////////// | |
9 | // Manager class generaol Alice segment digits | |
10 | // segment is for example one pad row in TPC // | |
11 | //////////////////////////////////////////////// | |
12 | ||
13 | #include "AliArrayI.h" | |
14 | #include "AliArrayS.h" | |
15 | #include "AliSegmentID.h" | |
16 | class AliH2F; | |
17 | ||
18 | class AliDigits: public AliSegmentID{ | |
19 | public: | |
20 | AliDigits(); | |
73042f01 | 21 | AliDigits(const AliDigits &digits); //copy constructor |
22 | AliDigits &operator = (const AliDigits & digits); //assignment operator | |
23 | virtual ~AliDigits(); | |
24 | Short_t GetDigitFast(Int_t row, Int_t column); //return value at given row and collumn | |
25 | void SetDigitFast(Short_t value,Int_t row, Int_t column); //set value at given row and collumn | |
26 | Bool_t BoundsOK(const char *where, Int_t row, Int_t col) ; //Check If Bound Ok | |
cc80f89e | 27 | Bool_t OutOfBoundsError(const char *where, Int_t row, Int_t column); |
28 | virtual void Allocate(Int_t rows, Int_t columns); //construct empty buffer fDigits with size rows x columns | |
29 | virtual Short_t GetDigit(Int_t row, Int_t column); | |
30 | virtual void ExpandBuffer(); //expand buffer to twodimensional array | |
31 | virtual void CompresBuffer(Int_t bufferType,Int_t threshold); //compres buffer according buffertype algorithm | |
32 | virtual Bool_t First(); //adjust first valid current digit | |
33 | virtual Bool_t Next(); //addjust next valid current digit | |
73042f01 | 34 | void SetThreshold(Int_t th) {fThreshold = th;} //set threshold |
35 | Int_t GetThreshold() {return fThreshold;} //return threshold | |
36 | Int_t GetNRows(){return fNrows;} | |
37 | Int_t GetNCols(){return fNcols;} | |
cc80f89e | 38 | Int_t CurrentRow(){ return fCurrentRow;} //return current row |
39 | Int_t CurrentColumn(){ return fCurrentCol;} //return current column | |
40 | Int_t CurrentDigit() {return fElements->At(fCurrentIndex);} //return degit for current row and column | |
41 | void AcceptHisto(AliH2F * his); //update buffer for - it will content histogram values | |
42 | AliH2F * GenerHisto(); //generate 2 dimensional histogram with digits | |
73042f01 | 43 | AliH2F *DrawDigits( const char *option=0,Float_t x1=-1, Float_t x2=-1, Float_t y1=-1, Float_t y2=-1); //draw digits |
44 | ||
45 | Int_t GetSize();//return total size of object in bytes | |
46 | Int_t GetDigitSize(); //return total size of pure digits | |
47 | Int_t GetOverTh(Float_t threshold,Float_t x1=-1, Float_t x2=-1, Float_t y1=-1, Float_t y2=-1); //return number of digits over threshold | |
cc80f89e | 48 | protected: |
49 | virtual void Invalidate(); | |
50 | void ExpandBuffer1(); //expand buffer of type to twodimensional array | |
51 | void CompresBuffer1(); //compres buffer according algorithm 1 | |
52 | Bool_t First0(); //first for the buffer type 0 | |
53 | Bool_t Next0(); //next for the buffer type 0 | |
54 | Bool_t First1(); //first for the buffer type 1 | |
55 | Bool_t Next1();//next for the buffer type 1 | |
56 | Short_t GetDigit1(Int_t row, Int_t column); //return digit for given row and column | |
57 | ||
58 | Int_t fNrows; //number of rows in Segment | |
59 | Int_t fNcols; //number of collumns in Segment | |
60 | private: | |
61 | AliArrayS *fElements; //buffer of 2 bytes integers for digits | |
62 | AliArrayI *fIndex; //index position of column | |
63 | Int_t fBufType; //type of the buffer - define compression algorithm | |
64 | Int_t fThreshold; //treshold for zero suppresion | |
65 | Int_t fNelems; //total number of elements | |
66 | Int_t fCurrentRow; //!current row iteration | |
67 | Int_t fCurrentCol; //!current column iteration | |
68 | Int_t fCurrentIndex; //!current index in field | |
69 | ||
70 | ClassDef(AliDigits,1) | |
71 | }; | |
72 | ||
73 | ||
74 | ||
75 | inline Bool_t AliDigits::BoundsOK(const char *where, Int_t row, Int_t col) | |
76 | { | |
77 | //Check If Bound Ok | |
78 | if ( (col>=fNcols) || (col<0) ) return OutOfBoundsError(where,row,col); | |
79 | Int_t index =(*fIndex).At(col)+row; | |
80 | if ( (index<0) || (index>fNelems)) return OutOfBoundsError(where,row,col); | |
81 | return kTRUE; | |
82 | } | |
83 | ||
73042f01 | 84 | inline Short_t AliDigits::GetDigitFast(Int_t row, Int_t column) |
cc80f89e | 85 | { |
86 | // | |
87 | //return digit from fDigits array | |
88 | //if out of range return dummy value ( value at row = 0, collumn = 0) | |
89 | // | |
90 | return fElements->At(fIndex->At(column)+row); | |
91 | } | |
92 | ||
73042f01 | 93 | inline void AliDigits::SetDigitFast(Short_t value, Int_t row, Int_t column) |
cc80f89e | 94 | { |
95 | // | |
96 | //set digit | |
97 | // | |
98 | if ( (row<0) || (row>=fNrows) || (column<0) || (column>=fNrows) ) | |
73042f01 | 99 | Error("AliDigits::SetDigitFast", "row %d col %d out of bounds (size: %d x %d, this: 0x%08x)", |
cc80f89e | 100 | row, column, fNrows, fNcols, this); |
101 | (*fElements)[fIndex->At(column)+row]=value; | |
102 | } | |
103 | ||
104 | #endif | |
105 |