1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 Revision 1.1.4.1 2000/05/08 15:13:59 cblume
19 Introduce boundary checking
21 Revision 1.1 2000/02/28 18:59:19 cblume
26 ///////////////////////////////////////////////////////////////////////////////
28 // Base class of a general container for data of a TRD detector segment. //
29 // Adapted from AliDigits (origin: M.Ivanov). //
31 ///////////////////////////////////////////////////////////////////////////////
35 #include "AliTRDsegmentID.h"
36 #include "AliTRDarrayI.h"
37 #include "AliTRDdataArray.h"
39 ClassImp(AliTRDdataArray)
41 //_____________________________________________________________________________
42 AliTRDdataArray::AliTRDdataArray()
45 // Default constructor
62 //_____________________________________________________________________________
63 AliTRDdataArray::AliTRDdataArray(Int_t nrow, Int_t ncol, Int_t ntime)
66 // Creates a AliTRDdataArray with the dimensions <nrow>, <ncol>, and <ntime>.
67 // The row- and column dimensions are compressible.
70 Allocate(nrow,ncol,ntime);
74 //_____________________________________________________________________________
75 AliTRDdataArray::~AliTRDdataArray()
81 if (fIndex) fIndex->Delete();
85 //_____________________________________________________________________________
86 void AliTRDdataArray::Allocate(Int_t nrow, Int_t ncol,Int_t ntime)
89 // Allocates memory for a AliTRDdataArray with the dimensions
90 // <nrow>, <ncol>, and <ntime>.
91 // The row- and column dimensions are compressible.
95 Error("AliTRDdataArray::Allocate","The number of rows has to be positive");
99 Error("AliTRDdataArray::Allocate","The number of columns has to be positive");
103 Error("AliTRDdataArray::Allocate","The number of timebins has to be positive");
107 // The two-dimensional array row/column gets mapped into the first
108 // dimension of the array. The second array dimension, which is not compressible,
109 // corresponds to the time direction
110 fNdim1 = nrow * ncol;
112 fNelems = fNdim1 * fNdim2;
118 if (fIndex) delete fIndex;
119 fIndex = new AliTRDarrayI;
121 for (Int_t i = 0, k = 0; i < fNdim2; i++, k += fNdim1) {
129 //_____________________________________________________________________________
130 void AliTRDdataArray::Reset()
133 // Reset the array (old content gets deleted)
136 if (fIndex) delete fIndex;
137 fIndex = new AliTRDarrayI;