AliRoot Core  3dc7879 (3dc7879)
Go to the documentation of this file.
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 */
6 /* $Id$ */
13 #include <TArrayI.h>
14 #include <TArrayS.h>
15 #include "AliSegmentID.h"
16 class AliH2F;
18 class AliDigits: public AliSegmentID{
19 public:
20  AliDigits();
21  AliDigits(const AliDigits &digits); //copy constructor
22  AliDigits &operator = (const AliDigits & digits); //assignment operator
23  virtual ~AliDigits();
24  Short_t * GetDigits(){return fElements->GetArray();} //return row pointer to the array digits
25  Short_t GetDigitFast(Int_t row, Int_t column); //return value at given row and collumn
26  Short_t GetDigitUnchecked(Int_t row, Int_t column); //return value at given row and collumn
27  void SetDigitFast(Short_t value,Int_t row, Int_t column); //set value at given row and collumn
28  Bool_t BoundsOK(const char *where, Int_t row, Int_t col) ; //Check If Bound Ok
29  Bool_t OutOfBoundsError(const char *where, Int_t row, Int_t column);
30  virtual void Allocate(Int_t rows, Int_t columns); //construct empty buffer fDigits with size rows x columns
31  virtual Short_t GetDigit(Int_t row, Int_t column);
32  virtual void ExpandBuffer(); //expand buffer to twodimensional array
33  virtual void CompresBuffer(Int_t bufferType,Int_t threshold); //compres buffer according buffertype algorithm
34  virtual Bool_t First(); //adjust first valid current digit
35  virtual Bool_t Next(); //addjust next valid current digit
36  void SetThreshold(Int_t th) {fThreshold = th;} //set threshold
37  Int_t GetThreshold() {return fThreshold;} //return threshold
38  Int_t GetNRows(){return fNrows;}
39  Int_t GetNCols(){return fNcols;}
40  Int_t CurrentRow(){ return fCurrentRow;} //return current row
41  Int_t CurrentColumn(){ return fCurrentCol;} //return current column
42  Int_t CurrentDigit() {return fElements->At(fCurrentIndex);} //return degit for current row and column
43  void AcceptHisto(AliH2F * his); //update buffer for - it will content histogram values
44  AliH2F * GenerHisto(); //generate 2 dimensional histogram with digits
45  AliH2F *DrawDigits( const char *option=0,Float_t x1=-1, Float_t x2=-1, Float_t y1=-1, Float_t y2=-1); //draw digits
47  Int_t GetSize();//return total size of object in bytes
48  Int_t GetDigitSize(); //return total size of pure digits
49  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
51  inline Short_t * GetDigitsColumn(Int_t row); //return row pointer to the array digits
53 protected:
54  virtual void Invalidate();
55  void ExpandBuffer1(); //expand buffer of type to twodimensional array
56  void CompresBuffer1(); //compres buffer according algorithm 1
57  Bool_t First0(); //first for the buffer type 0
58  Bool_t Next0(); //next for the buffer type 0
59  Bool_t First1(); //first for the buffer type 1
60  Bool_t Next1();//next for the buffer type 1
61  Short_t GetDigit1(Int_t row, Int_t column); //return digit for given row and column
63  Int_t fNrows;
64  Int_t fNcols;
65 private:
66  TArrayS *fElements;
67  TArrayI *fIndex;
68  Int_t fBufType;
69  Int_t fThreshold;
70  Int_t fNelems;
71  Int_t fCurrentRow;
72  Int_t fCurrentCol;
73  Int_t fCurrentIndex;
76  ClassDef(AliDigits,2)
78 };
82 inline Bool_t AliDigits::BoundsOK(const char *where, Int_t row, Int_t col)
83 {
86  if ( (col>=fNcols) || (col<0) ) return OutOfBoundsError(where,row,col);
87  Int_t index =(*fIndex).At(col)+row;
88  if ( (index<0) || (index>fNelems)) return OutOfBoundsError(where,row,col);
89  return kTRUE;
90 }
92 inline Short_t AliDigits::GetDigitFast(Int_t row, Int_t column)
93 {
97  return fElements->At(fIndex->At(column)+row);
98 }
100 inline Short_t AliDigits::GetDigitUnchecked(Int_t row, Int_t column)
101 {
105  return fElements->fArray[fIndex->fArray[column]+row];
106 }
108 inline Short_t * AliDigits::GetDigitsColumn(Int_t column){
111  return &(fElements->fArray[fIndex->fArray[column]]);
112 }
115 inline void AliDigits::SetDigitFast(Short_t value, Int_t row, Int_t column)
116 {
119  if ( (row<0) || (row>=fNrows) || (column<0) || (column>=fNcols) )
120  Error("AliDigits::SetDigitFast", "row %d col %d out of bounds (size: %d x %d, this: 0x%08lx)",
121  row, column, fNrows, fNcols, (ULong_t)this);
122  (*fElements)[fIndex->At(column)+row]=value;
123 }
125 #endif
virtual void ExpandBuffer()
Definition: AliDigits.cxx:235
Bool_t First0()
Definition: AliDigits.cxx:428
AliSegmentID object.
Definition: AliSegmentID.h:15
Int_t GetDigitSize()
Definition: AliDigits.cxx:190
void CompresBuffer1()
Definition: AliDigits.cxx:377
Int_t CurrentDigit()
Definition: AliDigits.h:42
Int_t CurrentRow()
Definition: AliDigits.h:40
Int_t fCurrentRow
! current row iteration
Definition: AliDigits.h:71
Int_t fNelems
total number of elements
Definition: AliDigits.h:70
Short_t GetDigitUnchecked(Int_t row, Int_t column)
Definition: AliDigits.h:100
Bool_t First1()
Definition: AliDigits.cxx:461
Bool_t BoundsOK(const char *where, Int_t row, Int_t col)
Definition: AliDigits.h:82
void ExpandBuffer1()
Definition: AliDigits.cxx:344
Int_t GetNRows()
Definition: AliDigits.h:38
virtual Bool_t Next()
Definition: AliDigits.cxx:280
Bool_t OutOfBoundsError(const char *where, Int_t row, Int_t column)
Definition: AliDigits.cxx:126
Int_t GetSize()
Definition: AliDigits.cxx:177
virtual Bool_t First()
Definition: AliDigits.cxx:271
Short_t * GetDigits()
Definition: AliDigits.h:24
Int_t GetOverTh(Float_t threshold, Float_t x1=-1, Float_t x2=-1, Float_t y1=-1, Float_t y2=-1)
Definition: AliDigits.cxx:198
Int_t fCurrentIndex
! current index in field
Definition: AliDigits.h:73
Int_t fCurrentCol
! current column iteration
Definition: AliDigits.h:72
virtual ~AliDigits()
Definition: AliDigits.cxx:111
Short_t GetDigitFast(Int_t row, Int_t column)
Definition: AliDigits.h:92
virtual Short_t GetDigit(Int_t row, Int_t column)
Definition: AliDigits.cxx:224
Int_t GetThreshold()
Definition: AliDigits.h:37
Bool_t Next0()
Definition: AliDigits.cxx:444
virtual void Allocate(Int_t rows, Int_t columns)
Definition: AliDigits.cxx:153
void SetThreshold(Int_t th)
Definition: AliDigits.h:36
Int_t CurrentColumn()
Definition: AliDigits.h:41
virtual void Invalidate()
Definition: AliDigits.cxx:136
AliH2F * GenerHisto()
Definition: AliDigits.cxx:310
void AcceptHisto(AliH2F *his)
Definition: AliDigits.cxx:289
void SetDigitFast(Short_t value, Int_t row, Int_t column)
Definition: AliDigits.h:115
Int_t fThreshold
treshold for zero suppresion
Definition: AliDigits.h:69
Definition: AliH2F.h:16
TArrayS * fElements
buffer of 2 bytes integers for digits
Definition: AliDigits.h:66
Int_t fBufType
type of the buffer - define compression algorithm
Definition: AliDigits.h:68
Bool_t Next1()
Definition: AliDigits.cxx:486
Int_t GetNCols()
Definition: AliDigits.h:39
Int_t fNrows
number of rows in Segment
Definition: AliDigits.h:63
Int_t fNcols
number of collumns in Segment
Definition: AliDigits.h:64
Short_t * GetDigitsColumn(Int_t row)
Definition: AliDigits.h:108
AliDigits & operator=(const AliDigits &digits)
Definition: AliDigits.cxx:93
Short_t GetDigit1(Int_t row, Int_t column)
Definition: AliDigits.cxx:509
TArrayI * fIndex
index position of column
Definition: AliDigits.h:67
virtual void CompresBuffer(Int_t bufferType, Int_t threshold)
Definition: AliDigits.cxx:251
AliH2F * DrawDigits(const char *option=0, Float_t x1=-1, Float_t x2=-1, Float_t y1=-1, Float_t y2=-1)
Definition: AliDigits.cxx:328