#include "AliTRDarrayDictionary.h"
#include "AliTRDfeeParam.h"
+#include "AliLog.h"
ClassImp(AliTRDarrayDictionary)
,fNtime(0)
,fNDdim(0)
,fDictionary(0)
- ,fFlag(kTRUE)
+ ,fFlag(kFALSE)
{
//
// AliTRDarrayDictionary default contructor
,fNtime(0)
,fNDdim(0)
,fDictionary(0)
- ,fFlag(kTRUE)
-
+ ,fFlag(kFALSE)
{
//
// AliTRDarrayDictionary contructor
fDictionary=0;
}
fDictionary = new Int_t[fNDdim];
- for(Int_t i=0; i<fNDdim; i++)
- {
- fDictionary[i] = -1;
- }
+ memset(fDictionary,-1,sizeof(Int_t)*fNDdim);
}
}
newDim=fNDdim-counter; //Size of the compressed array
- //Set the flag if the array has no data
- if(newDim==1)
- fFlag=kFALSE;
-
//Fill the buffer of the compressed array
Int_t* buffer = new Int_t[newDim];
Int_t counterTwo=0;
delete [] fDictionary;
fDictionary=0;
}
- fDictionary = new Int_t[newDim];
+ fDictionary = buffer;
fNDdim = newDim;
- for(Int_t i=0; i<newDim; i++)
- {
- fDictionary[i] = buffer[i];
- }
-
- delete [] buffer;
- buffer=0;
-
}
delete [] longArr;
longArr=0;
-
}
-
+ fFlag=kFALSE; // This way it can be expanded afterwards
}
//________________________________________________________________________________
// Expand the array
//
+ if(fNDdim==0)
+ {
+ AliError("Called expand with dimension zero");
+ return;
+ }
+
+
Int_t dimexp=0;
+
+// if(WasExpandCalled())
+// return;
- if(!HasData()) //if the array has no data
- {
- if(fDictionary)
- {
- dimexp = -fDictionary[0];
- delete [] fDictionary;
- fDictionary=0;
- fDictionary = new Int_t[dimexp];
- fNDdim = dimexp;
- // Re-initialize the array
- for(Int_t i=0; i<dimexp; i++)
- fDictionary[i] = -1;
- }
+ if(fNDdim==fNrow*fNumberOfChannels*fNtime)
+ return;
+
+ if(fDictionary&&fNDdim==1)
+ {
+ dimexp = -fDictionary[0];
+ delete [] fDictionary;
+ fDictionary=0;
+ fDictionary = new Int_t[dimexp];
+ fNDdim = dimexp;
+ // Re-initialize the array
+ memset(fDictionary,-1,sizeof(Int_t)*dimexp);
+ fFlag=kTRUE; // Not expand again
return;
}
Int_t *longArr = new Int_t[fNDdim];
if(longArr && fDictionary)
{
-
//Initialize the array
memset(longArr,0,sizeof(Int_t)*fNDdim);
for(Int_t i=0; i<fNDdim;i++)
{
if(longArr[i]!=0)
- {
- dimexp=dimexp+longArr[i]-1;
- }
+ dimexp=dimexp+longArr[i]-1;
+ if(longArr[i]==0)
+ break;
}
dimexp=dimexp+fNDdim;
if(bufferE)
{
-
+ memset(bufferE,-1,sizeof(Int_t)*dimexp);
for(Int_t i=0; i<dimexp; i++)
{
if(fDictionary[contaexp]>=-1)
}
if(fDictionary[contaexp]<-1)
{
- for(Int_t j=0; j<longArr[h];j++)
- {
- bufferE[i+j]=-1;
- }
i=i+longArr[h]-1;
h++;
}
//Copy the buffer
delete [] fDictionary;
- fDictionary=0;
- fDictionary = new Int_t[dimexp];
+ fDictionary=bufferE;
fNDdim = dimexp;
- for(Int_t i=0; i<dimexp; i++)
- {
- fDictionary[i] = bufferE[i];
- }
- delete [] bufferE;
-
}
-
- delete [] longArr;
-
}
+ if (longArr)
+ {
+ delete [] longArr;
+ }
+ fFlag=kTRUE; // Not expand again
}
//________________________________________________________________________________
Int_t shiftposition = 1+3*mcm;
for(Int_t index=lowerlimit;index<upperlimit;index++)
{
- fgLutPadNumbering[index]=index+shiftposition;
+ fgLutPadNumbering[index]= index+shiftposition;
}
}
}