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.2 2000/05/08 16:17:27 cblume
21 Revision 1.1.4.1 2000/05/08 15:13:59 cblume
22 Introduce boundary checking
24 Revision 1.1 2000/02/28 18:59:19 cblume
29 ///////////////////////////////////////////////////////////////////////////////
31 // Base class of a general container for data of a TRD detector segment. //
32 // Adapted from AliDigits (origin: M.Ivanov). //
34 ///////////////////////////////////////////////////////////////////////////////
40 #include "AliTRDsegmentID.h"
41 #include "AliTRDarrayI.h"
42 #include "AliTRDdataArray.h"
44 ClassImp(AliTRDdataArray)
46 //_____________________________________________________________________________
47 AliTRDdataArray::AliTRDdataArray()
50 // Default constructor
67 //_____________________________________________________________________________
68 AliTRDdataArray::AliTRDdataArray(Int_t nrow, Int_t ncol, Int_t ntime)
71 // Creates a AliTRDdataArray with the dimensions <nrow>, <ncol>, and <ntime>.
72 // The row- and column dimensions are compressible.
75 Allocate(nrow,ncol,ntime);
79 //_____________________________________________________________________________
80 AliTRDdataArray::~AliTRDdataArray()
86 if (fIndex) fIndex->Delete();
90 //_____________________________________________________________________________
91 void AliTRDdataArray::Allocate(Int_t nrow, Int_t ncol,Int_t ntime)
94 // Allocates memory for a AliTRDdataArray with the dimensions
95 // <nrow>, <ncol>, and <ntime>.
96 // The row- and column dimensions are compressible.
100 Error("AliTRDdataArray::Allocate","The number of rows has to be positive");
104 Error("AliTRDdataArray::Allocate","The number of columns has to be positive");
108 Error("AliTRDdataArray::Allocate","The number of timebins has to be positive");
112 // The two-dimensional array row/column gets mapped into the first
113 // dimension of the array. The second array dimension, which is not compressible,
114 // corresponds to the time direction
115 fNdim1 = nrow * ncol;
117 fNelems = fNdim1 * fNdim2;
123 if (fIndex) delete fIndex;
124 fIndex = new AliTRDarrayI;
126 for (Int_t i = 0, k = 0; i < fNdim2; i++, k += fNdim1) {
134 //_____________________________________________________________________________
135 void AliTRDdataArray::Reset()
138 // Reset the array (old content gets deleted)
141 if (fIndex) delete fIndex;
142 fIndex = new AliTRDarrayI;