]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDdataArrayI.cxx
Changed timebin 0 to be the one closest to the readout
[u/mrichter/AliRoot.git] / TRD / AliTRDdataArrayI.cxx
index b6dff588eb2ca3dcd0274dc4f7bdf2bd1958423d..e9e007f3544abc743b5740c57981c10717d9cc6e 100644 (file)
 
 /*
 $Log$
+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
 
@@ -55,6 +64,17 @@ AliTRDdataArrayI::AliTRDdataArrayI(Int_t nrow, Int_t ncol, Int_t ntime)
   
 }
 
+//_____________________________________________________________________________
+AliTRDdataArrayI::AliTRDdataArrayI(const AliTRDdataArrayI &a)
+{
+  //
+  // AliTRDdataArrayI copy constructor
+  //
+
+  ((AliTRDdataArrayI &) a).Copy(*this);
+
+}
+
 //_____________________________________________________________________________
 AliTRDdataArrayI::~AliTRDdataArrayI()
 {
@@ -83,6 +103,21 @@ void AliTRDdataArrayI::Allocate(Int_t nrow, Int_t ncol, Int_t ntime)
 
 }
 
+//_____________________________________________________________________________
+void AliTRDdataArrayI::Copy(TObject &a)
+{
+  //
+  // Copy function
+  //
+
+  fElements->Copy(*((AliTRDdataArrayI &) a).fElements);
+
+  ((AliTRDdataArrayI &) a).fThreshold = fThreshold;
+
+  AliTRDdataArray::Copy(a);
+
+}
+
 //_____________________________________________________________________________
 void AliTRDdataArrayI::Reset() 
 { 
@@ -287,9 +322,9 @@ void AliTRDdataArrayI::Expand1()
 
   Int_t idx1 = 0;
   Int_t idx2 = 0;
-  Int_t N    = fElements->fN;
+  Int_t n    = fElements->fN;
 
-  for (i = 0; i < N; i++){
+  for (i = 0; i < n; i++){
 
     // Negative sign counts the unwritten values (under threshold)
     if ((*fElements)[i] < 0) {
@@ -391,8 +426,8 @@ void AliTRDdataArrayI::Expand2()
 
   Int_t idx1 = 0;
   Int_t idx2 = 0;
-  Int_t N    = fElements->fN;
-  for (i = 0; i < N; i++){
+  Int_t n    = fElements->fN;
+  for (i = 0; i < n; i++){
     // Negative sign counts the unwritten values (under threshold)
     if ((*fElements)[i] < 0) {
       idx1 -= fElements->At(i); 
@@ -420,6 +455,9 @@ void AliTRDdataArrayI::Expand2()
 //_____________________________________________________________________________
 void AliTRDdataArrayI::Compress2()
 {
+  //
+  // Compress a buffer of type 2 - not implemented!
+  //
 
 }
 
@@ -573,3 +611,67 @@ Int_t AliTRDdataArrayI::GetData1(Int_t idx1, Int_t idx2)
 
 }
 
+//_____________________________________________________________________________
+Int_t AliTRDdataArrayI::GetDataFast(Int_t idx1, Int_t idx2)
+{
+  //
+  // Returns the value at a given position in the array
+  //
+  
+  return fElements->At(fIndex->At(idx2) + idx1); 
+
+}
+
+//_____________________________________________________________________________
+void AliTRDdataArrayI::SetData(Int_t row, Int_t col, Int_t time, Int_t value)
+{
+  //
+  // Sets the data value at a given position of the array
+  // Includes boundary checking
+  //
+
+  if ((row >= 0) && (col >= 0) && (time >= 0)) {
+    Int_t idx1 = GetIdx1(row,col);
+    if ((idx1 >= 0) && (time < fNdim2)) {
+       SetDataFast(idx1,time,value);
+    }
+    else {
+      if (idx1 >= 0) {
+        TObject::Error("SetData"
+                      ,"time %d out of bounds (size: %d, this: 0x%08x)"
+                      ,time,fNdim2,this);
+      }
+    }
+  }
+
+}
+
+//_____________________________________________________________________________
+void  AliTRDdataArrayI::SetDataFast(Int_t idx1, Int_t idx2, Int_t value)
+{
+  //
+  // Set the value at a given position in the array
+  //
+
+  if ((idx1 < 0) || (idx1 >= fNdim1) || 
+      (idx2 < 0) || (idx2 >= fNdim2)) { 
+    TObject::Error("SetDataFast"
+                  ,"idx1 %d  idx2 %d out of bounds (size: %d x %d, this: 0x%08x)"
+                  ,idx1,idx2,fNdim1,fNdim2,this);
+  }
+
+  (*fElements)[fIndex->fArray[idx2] + idx1] = value; 
+
+}
+
+//_____________________________________________________________________________
+AliTRDdataArrayI &AliTRDdataArrayI::operator=(const AliTRDdataArrayI &a)
+{
+  //
+  // Assignment operator
+  //
+
+  if (this != &a) ((AliTRDdataArrayI &) a).Copy(*this);
+  return *this;
+
+}