// //
/////////////////////////////////////////////////////////
+#include <TArray.h>
+
#include "AliTRDarrayDictionary.h"
-#include "TArray.h"
+#include "AliTRDfeeParam.h"
ClassImp(AliTRDarrayDictionary)
+Short_t *AliTRDarrayDictionary::fgLutPadNumbering = 0x0;
+
//________________________________________________________________________________
AliTRDarrayDictionary::AliTRDarrayDictionary()
:TObject()
,fNdet(0)
,fNrow(0)
,fNcol(0)
+ ,fNumberOfChannels(0)
,fNtime(0)
,fNDdim(0)
,fDictionary(0)
// AliTRDarrayDictionary default contructor
//
+ CreateLut();
+
}
//________________________________________________________________________________
,fNdet(0)
,fNrow(0)
,fNcol(0)
+ ,fNumberOfChannels(0)
,fNtime(0)
,fNDdim(0)
,fDictionary(0)
// AliTRDarrayDictionary contructor
//
+ CreateLut();
Allocate(nrow,ncol,ntime);
}
,fNdet(a.fNdet)
,fNrow(a.fNrow)
,fNcol(a.fNcol)
+ ,fNumberOfChannels(a.fNumberOfChannels)
,fNtime(a.fNtime)
,fNDdim(a.fNDdim)
,fDictionary(0)
fNDdim=a.fNDdim;
fNrow=a.fNrow;
fNcol=a.fNcol;
+ fNumberOfChannels = a.fNumberOfChannels;
fNtime=a.fNtime;
fDictionary = new Int_t[fNDdim];
for(Int_t i=0; i<fNDdim; i++)
{
//
// Allocates memory for the dictionary array with dimensions
- // Row*Col*Time
+ // Row*NumberOfNecessaryMCMs*ADCchannelsInMCM*Time
+ // To be consistent with AliTRDarrayADC
// Object initialized to -1
//
fNrow=nrow;
fNcol=ncol;
fNtime=ntime;
- fNDdim=nrow*ncol*ntime;
+ Int_t adcchannelspermcm = AliTRDfeeParam::GetNadcMcm();
+ Int_t padspermcm = AliTRDfeeParam::GetNcolMcm();
+ Int_t numberofmcms = fNcol/padspermcm;
+ fNumberOfChannels = numberofmcms*adcchannelspermcm;
+ fNDdim=nrow*fNumberOfChannels*ntime;
if(fDictionary)
{
delete [] fDictionary;
memset(fDictionary,0,sizeof(Int_t)*fNDdim);
}
+//________________________________________________________________________________
+Int_t AliTRDarrayDictionary::GetData(Int_t nrow, Int_t ncol, Int_t ntime) const
+{
+ //
+ // Get the data using the pad numbering.
+ // To access data using the mcm scheme use instead
+ // the method GetDataByAdcCol
+ //
+
+ Int_t corrcolumn = fgLutPadNumbering[ncol];
+
+ return fDictionary[(nrow*fNumberOfChannels+corrcolumn)*fNtime+ntime];
+
+}
+//________________________________________________________________________________
+void AliTRDarrayDictionary::SetData(Int_t nrow, Int_t ncol, Int_t ntime, Int_t value)
+{
+ //
+ // Set the data using the pad numbering.
+ // To write data using the mcm scheme use instead
+ // the method SetDataByAdcCol
+ //
+
+ Int_t colnumb = fgLutPadNumbering[ncol];
+
+ fDictionary[(nrow*fNumberOfChannels+colnumb)*fNtime+ntime]=value;
+
+}
+
+//________________________________________________________________________________
+void AliTRDarrayDictionary::CreateLut()
+{
+ //
+ // Initializes the Look Up Table to relate
+ // pad numbering and mcm channel numbering
+ //
+
+ if(fgLutPadNumbering) return;
+
+ fgLutPadNumbering = new Short_t[AliTRDfeeParam::GetNcol()];
+ memset(fgLutPadNumbering,0,sizeof(Short_t)*AliTRDfeeParam::GetNcol());
+
+ for(Int_t mcm=0; mcm<8; mcm++)
+ {
+ Int_t lowerlimit=0+mcm*18;
+ Int_t upperlimit=18+mcm*18;
+ Int_t shiftposition = 1+3*mcm;
+ for(Int_t index=lowerlimit;index<upperlimit;index++)
+ {
+ fgLutPadNumbering[index]=index+shiftposition;
+ }
+ }
+}