]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TRD/AliTRDdataArray.h
Only one initializer for a default argument
[u/mrichter/AliRoot.git] / TRD / AliTRDdataArray.h
CommitLineData
f7336fa3 1#ifndef TRDdataArray_H
2#define TRDdataArray_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$ */
8
9#include "AliTRDarrayI.h"
6f1e466d 10#include "AliTRDarrayF.h"
f7336fa3 11#include "AliTRDsegmentID.h"
12
13/////////////////////////////////////////////////////////////
14// General container for data from TRD detector segments //
15// Adapted from AliDigits, origin M.Ivanov //
16/////////////////////////////////////////////////////////////
17
18class AliTRDdataArray : public AliTRDsegmentID {
19
20 public:
21
22 AliTRDdataArray();
6f1e466d 23 AliTRDdataArray(Int_t nrow, Int_t ncol,Int_t ntime);
f7336fa3 24 ~AliTRDdataArray();
25
6f1e466d 26 virtual void Allocate(Int_t nrow, Int_t ncol,Int_t ntime);
27 virtual void Reset();
f7336fa3 28
f7336fa3 29 virtual Int_t GetNRow() { return fNrow; };
30 virtual Int_t GetNCol() { return fNcol; };
31 virtual Int_t GetNtime() { return fNtime; };
32
9d0b222b 33 Int_t GetIndex(Int_t row, Int_t col, Int_t time);
f7336fa3 34
35 protected:
36
9d0b222b 37 Int_t GetIdx1(Int_t row, Int_t col);
f7336fa3 38 inline Bool_t CheckBounds(const char *where, Int_t idx1, Int_t idx2);
39 inline Bool_t OutOfBoundsError(const char *where, Int_t idx1, Int_t idx2);
f7336fa3 40
41 Int_t fNrow; // Number of rows of the detector segement
42 Int_t fNcol; // Number of columns of the detector segment
43 Int_t fNtime; // Number of timebins of the detector segment
44
45 Int_t fNdim1; // First dimension of the array (row * column)
46 Int_t fNdim2; // Second dimension of the array (time, not compressed)
f7336fa3 47
f7336fa3 48 AliTRDarrayI *fIndex; // Index position of column
49 Int_t fBufType; // Type of the buffer - defines the compression algorithm
f7336fa3 50 Int_t fNelems; // Total number of elements
51 Int_t fCurrentIdx1; // !Current index 1
52 Int_t fCurrentIdx2; // !Current index 2
53 Int_t fCurrentIndex; // !Current index in field
54
55 ClassDef(AliTRDdataArray,1) // Data container for one TRD detector segment
56
57};
58
f7336fa3 59//_____________________________________________________________________________
60inline Bool_t AliTRDdataArray::CheckBounds(const char *where
61 , Int_t idx1, Int_t idx2)
62{
63 //
64 // Does the boundary checking
65 //
66
67 if ((idx2 >= fNdim2) || (idx2 < 0))
68 return OutOfBoundsError(where,idx1,idx2);
69
70 Int_t index = (*fIndex).At(idx2) + idx1;
71 if ((index < 0) || (index > fNelems))
72 return OutOfBoundsError(where,idx1,idx2);
73
74 return kTRUE;
75
76}
77
78//_____________________________________________________________________________
79inline Bool_t AliTRDdataArray::OutOfBoundsError(const char *where
80 , Int_t idx1, Int_t idx2)
81{
82 //
83 // Generate an out-of-bounds error. Always returns false.
84 //
85
6f1e466d 86 TObject::Error(where, "idx1 %d idx2 %d out of bounds (size: %d x %d, this: 0x%08x)"
87 ,idx1,idx2,fNdim1,fNdim2,this);
f7336fa3 88
89 return kFALSE;
90
91}
92
f7336fa3 93#endif
94