X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TRD%2FAliTRDdataArrayI.cxx;h=20f259d767e1fb9add669982fffe033c7580c904;hb=6da3eee3b60858f1e8ab6da4e90c5717a1527800;hp=948b75d5ffa1e9044de65d62a59031bd00b91c78;hpb=855bfffd05a6e15e65a2b7bbc2622a7c9535d59b;p=u%2Fmrichter%2FAliRoot.git diff --git a/TRD/AliTRDdataArrayI.cxx b/TRD/AliTRDdataArrayI.cxx index 948b75d5ffa..20f259d767e 100644 --- a/TRD/AliTRDdataArrayI.cxx +++ b/TRD/AliTRDdataArrayI.cxx @@ -13,42 +13,7 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.9 2001/05/07 08:08:05 cblume -Update of TRD code - -Revision 1.8 2000/11/23 14:34:08 cblume -Fixed bug in expansion routine of arrays (initialize buffers properly) - -Revision 1.7 2000/11/20 08:56:07 cblume -Cleanup of data arrays - -Revision 1.6 2000/11/01 14:53:20 cblume -Merge with TRD-develop - -Revision 1.1.2.3 2000/10/06 16:49:46 cblume -Made Getters const - -Revision 1.1.2.2 2000/10/04 16:34:58 cblume -Replace include files by forward declarations - -Revision 1.5 2000/06/27 13:08:50 cblume -Changed to Copy(TObject &A) to appease the HP-compiler - -Revision 1.4 2000/06/09 11:10:07 cblume -Compiler warnings and coding conventions, next round - -Revision 1.3 2000/06/08 18:32:58 cblume -Make code compliant to coding conventions - -Revision 1.2 2000/05/08 16:17:27 cblume -Merge TRD-develop - -Revision 1.1.2.1 2000/05/08 15:14:34 cblume -Add new data array classes - -*/ +/* $Id$ */ /////////////////////////////////////////////////////////////////////////////// // // @@ -57,46 +22,50 @@ Add new data array classes // // /////////////////////////////////////////////////////////////////////////////// +#include "AliLog.h" + #include "AliTRDdataArrayI.h" #include "AliTRDarrayI.h" ClassImp(AliTRDdataArrayI) //_____________________________________________________________________________ -AliTRDdataArrayI::AliTRDdataArrayI():AliTRDdataArray() +AliTRDdataArrayI::AliTRDdataArrayI() + :AliTRDdataArray() + ,fElements(0) + ,fThreshold(0) { // // Default constructor // - fElements = 0; - } //_____________________________________________________________________________ AliTRDdataArrayI::AliTRDdataArrayI(Int_t nrow, Int_t ncol, Int_t ntime) - :AliTRDdataArray(nrow,ncol,ntime) + :AliTRDdataArray(nrow,ncol,ntime) + ,fElements(0) + ,fThreshold(0) { // // Creates a AliTRDdataArrayI with the dimensions , , and . // The row- and column dimensions are compressible. // - fElements = 0; - Allocate(nrow,ncol,ntime); } //_____________________________________________________________________________ AliTRDdataArrayI::AliTRDdataArrayI(const AliTRDdataArrayI &a) + :AliTRDdataArray(a) + ,fElements(a.fElements) + ,fThreshold(a.fThreshold) { // // AliTRDdataArrayI copy constructor // - ((AliTRDdataArrayI &) a).Copy(*this); - } //_____________________________________________________________________________ @@ -106,7 +75,10 @@ AliTRDdataArrayI::~AliTRDdataArrayI() // Destructor // - if (fElements) delete fElements; + if (fElements) { + delete fElements; + fElements = 0; + } } @@ -119,16 +91,21 @@ void AliTRDdataArrayI::Allocate(Int_t nrow, Int_t ncol, Int_t ntime) // The row- and column dimensions are compressible. // - if (fNelems < 0) AliTRDdataArray::Allocate(nrow,ncol,ntime); + if (fNelems < 0) { + AliTRDdataArray::Allocate(nrow,ncol,ntime); + } + + if (fElements) { + delete fElements; + } - if (fElements) delete fElements; fElements = new AliTRDarrayI(); fElements->Set(fNelems); } //_____________________________________________________________________________ -void AliTRDdataArrayI::Copy(TObject &a) +void AliTRDdataArrayI::Copy(TObject &a) const { // // Copy function @@ -149,7 +126,11 @@ void AliTRDdataArrayI::Reset() // Reset the array (old content gets deleted) // - if (fElements) delete fElements; + if (fElements) { + delete fElements; + } + + fElements = new AliTRDarrayI(); fElements->Set(0); @@ -159,7 +140,7 @@ void AliTRDdataArrayI::Reset() } //_____________________________________________________________________________ -Int_t AliTRDdataArrayI::GetSize() +Int_t AliTRDdataArrayI::GetSize() const { // // Returns the size of the complete object @@ -177,7 +158,7 @@ Int_t AliTRDdataArrayI::GetSize() } //_____________________________________________________________________________ -Int_t AliTRDdataArrayI::GetDataSize() +Int_t AliTRDdataArrayI::GetDataSize() const { // // Returns the size of only the data part @@ -227,9 +208,8 @@ Int_t AliTRDdataArrayI::GetData(Int_t row, Int_t col, Int_t time) const } else { if (idx1 >= 0) { - TObject::Error("GetData" - ,"time %d out of bounds (size: %d, this: 0x%08x)" - ,time,fNdim2,this); + AliError(Form("time %d out of bounds (size: %d, this: 0x%08x)" + ,time,fNdim2,this)); } } } @@ -270,7 +250,7 @@ void AliTRDdataArrayI::Compress(Int_t bufferType) // if (fBufType < 0) { - Error("AliTRDdataArrayI::Compress","Buffer does not exist"); + AliError("Buffer does not exist"); return; } if (fBufType == bufferType) { @@ -280,7 +260,7 @@ void AliTRDdataArrayI::Compress(Int_t bufferType) Expand(); } if (fBufType !=0) { - Error("AliTRDdataArrayI::Compress","Buffer does not exist"); + AliError("Buffer does not exist"); return; } @@ -299,7 +279,7 @@ void AliTRDdataArrayI::Expand() // if (fBufType < 0) { - Error("AliTRDdataArrayI::Expand","Buffer does not exist"); + AliError("Buffer does not exist"); return; } if (fBufType == 0) { @@ -536,7 +516,7 @@ Bool_t AliTRDdataArrayI::Next0() Int_t i; for (i = fCurrentIndex + 1; ((i < fNelems) && (fElements->At(i) <= fThreshold)); - i++); + i++) {} if (i >= fNelems) { fCurrentIndex = -1; return kFALSE; @@ -667,9 +647,8 @@ void AliTRDdataArrayI::SetData(Int_t row, Int_t col, Int_t time, Int_t value) } else { if (idx1 >= 0) { - TObject::Error("SetData" - ,"time %d out of bounds (size: %d, this: 0x%08x)" - ,time,fNdim2,this); + AliError(Form("time %d out of bounds (size: %d, this: 0x%08x)" + ,time,fNdim2,this)); } } }