X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TRD%2FAliTRDdataArrayI.cxx;h=f6816364f461d30b576f11113e857a7051a5dd6e;hb=2a13901768082d906381f5b2770fd6fc90144985;hp=62d216cb17807ba7f5998aa269b1130e3abd0aad;hpb=88cb7938ca21d4a80991d4e7aa564008c29340f7;p=u%2Fmrichter%2FAliRoot.git diff --git a/TRD/AliTRDdataArrayI.cxx b/TRD/AliTRDdataArrayI.cxx index 62d216cb178..f6816364f46 100644 --- a/TRD/AliTRDdataArrayI.cxx +++ b/TRD/AliTRDdataArrayI.cxx @@ -22,46 +22,50 @@ // // /////////////////////////////////////////////////////////////////////////////// +#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); - } //_____________________________________________________________________________ @@ -71,7 +75,10 @@ AliTRDdataArrayI::~AliTRDdataArrayI() // Destructor // - if (fElements) delete fElements; + if (fElements) { + delete fElements; + fElements = 0; + } } @@ -84,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 @@ -114,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); @@ -192,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)); } } } @@ -235,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) { @@ -245,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; } @@ -264,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) { @@ -632,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)); } } }