]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Change requested by Benjamin
authorcblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 18 Apr 2011 08:56:17 +0000 (08:56 +0000)
committercblume <cblume@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 18 Apr 2011 08:56:17 +0000 (08:56 +0000)
TRD/AliTRDarrayDictionary.cxx
TRD/AliTRDarrayDictionary.h

index c8e83f889e3ba3c45d46f717a42e47b1861d8811..96cf443dd218132b0f4eb354c6c99e7e40cfc5c0 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "AliTRDarrayDictionary.h"
 #include "AliTRDfeeParam.h"
+#include "AliLog.h"
 
 ClassImp(AliTRDarrayDictionary)
 
@@ -64,7 +65,6 @@ AliTRDarrayDictionary::AliTRDarrayDictionary(Int_t nrow, Int_t ncol, Int_t ntime
                      ,fNDdim(0)
                      ,fDictionary(0)
                       ,fFlag(kFALSE)
-
 {
   //
   // AliTRDarrayDictionary contructor
@@ -265,7 +265,6 @@ void AliTRDarrayDictionary::Compress()
       delete [] longArr;
       longArr=0;
     }
-  fFlag=kTRUE; // flag to signal compression
 
 }
 
@@ -276,8 +275,16 @@ void AliTRDarrayDictionary::Expand()
   //  Expand the array
   //  
 
+  if(fNDdim==0)
+    {
+      AliError("Called expand with dimension zero");
+      return;    
+    }
+
+
   Int_t dimexp=0;
-  if(!IsCompressed())
+  
+  if(WasExpandCalled()) 
     return;
 
   if(fDictionary&&fNDdim==1)
@@ -289,6 +296,7 @@ void AliTRDarrayDictionary::Expand()
       fNDdim = dimexp;
       // Re-initialize the array
       memset(fDictionary,-1,sizeof(Int_t)*dimexp);
+      fFlag=kTRUE; // Not expand again
       return;
     }
 
@@ -351,8 +359,7 @@ void AliTRDarrayDictionary::Expand()
     {
       delete [] longArr; 
     }
-
-  fFlag=kFALSE; // flag to signal that is not compressed anymore
+  fFlag=kTRUE; // Not expand again
 
 }
 //________________________________________________________________________________
index 53ad86b4fcc81488f7ae3443f9b9fcb0e426011b..a3db6d696be792b882cbc3d74355ba9dbeabf958 100644 (file)
@@ -38,7 +38,7 @@ class AliTRDarrayDictionary: public TObject
   Int_t GetData(Int_t nrow, Int_t ncol, Int_t ntime) const;\r
   void  SetData(Int_t nrow, Int_t ncol, Int_t ntime, Int_t value);\r
   static  void    CreateLut();\r
-  Bool_t IsCompressed() const {return fFlag;}; \r
+  Bool_t WasExpandCalled() const {return fFlag;};\r
 \r
  protected:\r
 \r
@@ -49,10 +49,10 @@ class AliTRDarrayDictionary: public TObject
   Int_t   fNtime;       //Number of time bins\r
   Int_t   fNDdim;       //Dimension of the Dictionary array\r
   Int_t*  fDictionary;  //[fNDdim]  //Pointer to integers array\r
-  Bool_t  fFlag;        //Flag in case of compressed array\r
+  Bool_t  fFlag;        // Has Expand() being called before?\r
   static Short_t *fgLutPadNumbering;   //  [fNcol] Look Up Table\r
 \r
-  ClassDef(AliTRDarrayDictionary,5) //Dictionary container class\r
+  ClassDef(AliTRDarrayDictionary,6) //Dictionary container class\r
     \r
 };\r
 #endif\r