]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDdataArrayF.cxx
Move to gRandom
[u/mrichter/AliRoot.git] / TRD / AliTRDdataArrayF.cxx
index c32a50030e193b18ea2ec6f28998c149c5c25985..dad99146e0d1749800f8ef50de76c3efe0318b6e 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.10  2002/02/11 14:27:54  cblume
-Geometry and hit structure update
-
-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$ */
 
 ///////////////////////////////////////////////////////////////////////////////
 //                                                                           //
@@ -60,6 +22,8 @@ Add new data array classes
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
+#include "AliLog.h"
+
 #include "AliTRDdataArrayF.h"
 #include "AliTRDarrayI.h"
 #include "AliTRDarrayF.h"
@@ -67,40 +31,42 @@ Add new data array classes
 ClassImp(AliTRDdataArrayF)
 
 //_____________________________________________________________________________
-AliTRDdataArrayF::AliTRDdataArrayF():AliTRDdataArray()
+AliTRDdataArrayF::AliTRDdataArrayF()
+   :AliTRDdataArray()
+   ,fElements(0)
+   ,fThreshold(0)
 {
   //
   // Default constructor
   //
 
-  fElements = 0;
-
 }
 
 //_____________________________________________________________________________
 AliTRDdataArrayF::AliTRDdataArrayF(Int_t nrow, Int_t ncol, Int_t ntime)
-                 :AliTRDdataArray(nrow,ncol,ntime)
+   :AliTRDdataArray(nrow,ncol,ntime)
+   ,fElements(0)
+   ,fThreshold(0)
 {
   //
   // Creates a AliTRDdataArrayF with the dimensions <nrow>, <ncol>, and <ntime>.
   // The row- and column dimensions are compressible.
   //
 
-  fElements = 0;
-
   Allocate(nrow,ncol,ntime);
   
 }
 
 //_____________________________________________________________________________
 AliTRDdataArrayF::AliTRDdataArrayF(const AliTRDdataArrayF &a)
+   :AliTRDdataArray(a)
+   ,fElements(a.fElements)
+   ,fThreshold(a.fThreshold)
 {
   //
   // AliTRDdataArrayF copy constructor
   //
 
-  ((AliTRDdataArrayF &) a).Copy(*this);
-
 }
 
 //_____________________________________________________________________________
@@ -110,7 +76,10 @@ AliTRDdataArrayF::~AliTRDdataArrayF()
   // Destructor
   //
 
-  if (fElements) delete fElements;
+  if (fElements) {
+    delete fElements;
+    fElements = 0;
+  }
   
 }
 
@@ -123,16 +92,21 @@ void AliTRDdataArrayF::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 AliTRDarrayF();
   fElements->Set(fNelems);
 
 }
 
 //_____________________________________________________________________________
-void AliTRDdataArrayF::Copy(TObject &a)
+void AliTRDdataArrayF::Copy(TObject &a) const
 {
   //
   // Copy function
@@ -153,7 +127,10 @@ void AliTRDdataArrayF::Reset()
   // Reset the array (old content gets deleted)
   //
   
-  if (fElements) delete fElements;
+  if (fElements) {
+    delete fElements;
+  }
+
   fElements = new AliTRDarrayF();
   fElements->Set(0); 
 
@@ -231,9 +208,8 @@ Float_t AliTRDdataArrayF::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));
       }
     }
   }
@@ -274,7 +250,7 @@ void AliTRDdataArrayF::Compress(Int_t bufferType)
   //
 
   if (fBufType  < 0) {
-    Error("AliTRDdataArrayF::Compress","Buffer does not exist");
+    AliError("Buffer does not exist");
     return;
   }
   if (fBufType == bufferType) {
@@ -284,7 +260,7 @@ void AliTRDdataArrayF::Compress(Int_t bufferType)
     Expand();
   }
   if (fBufType !=0)  {
-    Error("AliTRDdataArrayF::Compress","Buffer does not exist");
+    AliError("Buffer does not exist");
     return;
   }
 
@@ -303,7 +279,7 @@ void AliTRDdataArrayF::Expand()
   //
 
   if (fBufType  < 0) {
-    Error("AliTRDdataArrayF::Expand","Buffer does not exist");
+    AliError("Buffer does not exist");
     return;
   }
   if (fBufType == 0) {  
@@ -541,7 +517,7 @@ Bool_t AliTRDdataArrayF::Next0()
   Int_t i;
   for (i = fCurrentIndex + 1; 
        ((i < fNelems) && (fElements->At(i) <= fThreshold)); 
-       i++);
+       i++) {}
   if (i >= fNelems)  {
     fCurrentIndex = -1;
     return kFALSE;
@@ -675,9 +651,8 @@ void AliTRDdataArrayF::SetData(Int_t row, Int_t col, Int_t time, Float_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));
       }
     }
   }