+//_____________________________________________________________________________
+Bool_t AliTRDdataArray::CheckBounds(Int_t idx1, Int_t idx2)
+{
+ //
+ // Does the boundary checking
+ //
+
+ if ((idx2 >= fNdim2) ||
+ (idx2 < 0)) {
+ return OutOfBoundsError(idx1,idx2);
+ }
+
+ Int_t index = (*fIndex).At(idx2) + idx1;
+ if ((index < 0) ||
+ (index > fNelems)) {
+ return OutOfBoundsError(idx1,idx2);
+ }
+
+ return kTRUE;
+
+}
+
+//_____________________________________________________________________________
+Bool_t AliTRDdataArray::OutOfBoundsError(Int_t idx1, Int_t idx2)
+{
+ //
+ // Generate an out-of-bounds error. Always returns false.
+ //
+
+ AliError(Form("idx1 %d idx2 %d out of bounds (size: %d x %d, this: 0x%08x)"
+ ,idx1,idx2,fNdim1,fNdim2,this));
+
+ return kFALSE;
+
+}
+