-#ifndef TRDdataArray_H
-#define TRDdataArray_H
+#ifndef ALITRDDATAARRAY_H
+#define ALITRDDATAARRAY_H
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
/* $Id$ */
-#include "AliTRDarrayI.h"
-#include "AliTRDarrayF.h"
#include "AliTRDsegmentID.h"
/////////////////////////////////////////////////////////////
// Adapted from AliDigits, origin M.Ivanov //
/////////////////////////////////////////////////////////////
+class AliTRDarrayI;
+
class AliTRDdataArray : public AliTRDsegmentID {
public:
AliTRDdataArray();
AliTRDdataArray(Int_t nrow, Int_t ncol,Int_t ntime);
- ~AliTRDdataArray();
+ AliTRDdataArray(const AliTRDdataArray &d);
+ virtual ~AliTRDdataArray();
+ AliTRDdataArray &operator=(const AliTRDdataArray &d);
+ virtual void Copy(TObject &d) const;
virtual void Allocate(Int_t nrow, Int_t ncol,Int_t ntime);
virtual void Reset();
- virtual Int_t GetNRow() { return fNrow; };
- virtual Int_t GetNCol() { return fNcol; };
- virtual Int_t GetNtime() { return fNtime; };
+ virtual Int_t GetNrow() const { return fNrow; };
+ virtual Int_t GetNcol() const { return fNcol; };
+ virtual Int_t GetNtime() const { return fNtime; };
+ Int_t GetIndex(Int_t row, Int_t col, Int_t time) const;
+ Int_t GetIndexUnchecked(Int_t row, Int_t col, Int_t time) const
+ { return time * fNrow*fNcol
+ + GetIdx1Unchecked(row,col); };
+ Int_t GetBufType() const { return fBufType; };
+ virtual Int_t GetNelems() const { return fNelems; };
- inline Int_t GetIndex(Int_t row, Int_t col, Int_t time);
+ virtual Bool_t HasData() const { return fNtime ? 1 : 0; };
protected:
- inline Int_t GetIdx1(Int_t row, Int_t col);
- inline Bool_t CheckBounds(const char *where, Int_t idx1, Int_t idx2);
- inline Bool_t OutOfBoundsError(const char *where, Int_t idx1, Int_t idx2);
+ Int_t GetIdx1(Int_t row, Int_t col) const;
+ Int_t GetIdx1Unchecked(Int_t row, Int_t col) const
+ { return row + col * fNrow; };
+ inline Bool_t CheckBounds(Int_t idx1, Int_t idx2);
+ inline Bool_t OutOfBoundsError(Int_t idx1, Int_t idx2);
Int_t fNrow; // Number of rows of the detector segement
Int_t fNcol; // Number of columns of the detector segment
};
-//_____________________________________________________________________________
-inline Int_t AliTRDdataArray::GetIndex(Int_t row, Int_t col, Int_t time)
-{
- //
- // Maps the row/column/time into one number
- //
-
- if (time > fNtime) {
- TObject::Error("GetIdx1"
- ,"time %d out of bounds (size: %d, this: 0x%08x)"
- ,time,fNtime,this);
- return -1;
- }
-
- return time * fNrow*fNcol + GetIdx1(row,col);
-
-}
-
-//_____________________________________________________________________________
-inline Int_t AliTRDdataArray::GetIdx1(Int_t row, Int_t col)
-{
- //
- // Maps the two-dimensional row/column plane into an one-dimensional array.
- //
-
- if (row >= fNrow) {
- TObject::Error("GetIdx1"
- ,"row %d out of bounds (size: %d, this: 0x%08x)"
- ,row,fNrow,this);
- return -1;
- }
-
- if (col >= fNcol) {
- TObject::Error("GetIdx1"
- ,"col %d out of bounds (size: %d, this: 0x%08x)"
- ,col,fNcol,this);
- return -1;
- }
-
- return row + col * fNrow;
-
-}
-
-//_____________________________________________________________________________
-inline Bool_t AliTRDdataArray::CheckBounds(const char *where
- , Int_t idx1, Int_t idx2)
-{
- //
- // Does the boundary checking
- //
-
- if ((idx2 >= fNdim2) || (idx2 < 0))
- return OutOfBoundsError(where,idx1,idx2);
-
- Int_t index = (*fIndex).At(idx2) + idx1;
- if ((index < 0) || (index > fNelems))
- return OutOfBoundsError(where,idx1,idx2);
-
- return kTRUE;
-
-}
-
-//_____________________________________________________________________________
-inline Bool_t AliTRDdataArray::OutOfBoundsError(const char *where
- , Int_t idx1, Int_t idx2)
-{
- //
- // Generate an out-of-bounds error. Always returns false.
- //
-
- TObject::Error(where, "idx1 %d idx2 %d out of bounds (size: %d x %d, this: 0x%08x)"
- ,idx1,idx2,fNdim1,fNdim2,this);
-
- return kFALSE;
-
-}
-
#endif