#ifndef ALITRDARRAYADC_H
#define ALITRDARRAYADC_H
#include <TObject.h>
class AliTRDSignalIndex;
class AliTRDarrayADC: public TObject
{
public:
enum {
kDataInvalid = 14
};
AliTRDarrayADC();
AliTRDarrayADC(Int_t nrow, Int_t ncol, Int_t ntime);
AliTRDarrayADC(const AliTRDarrayADC &b);
~AliTRDarrayADC();
AliTRDarrayADC &operator=(const AliTRDarrayADC &b);
void Allocate(Int_t nrow, Int_t ncol, Int_t ntime);
void SetNdet(Int_t ndet) {fNdet=ndet;};
Int_t GetNdet() const {return fNdet;};
void SetDataByAdcCol(Int_t nrow, Int_t ncol, Int_t ntime, Short_t value)
{fADC[(nrow*fNumberOfChannels+ncol)*fNtime+ntime]=value;}
Bool_t HasData() const {return fNtime ? 1 : 0;};
Short_t GetDataByAdcCol(Int_t nrow, Int_t ncol, Int_t ntime) const
{return fADC[(nrow*fNumberOfChannels+ncol)*fNtime+ntime];};
inline void GetData(Int_t r, Int_t c, Int_t t, Int_t n, Short_t *vals) const;
Short_t GetDataBits(Int_t nrow, Int_t ncol, Int_t ntime) const;
UChar_t GetPadStatus(Int_t nrow, Int_t ncol, Int_t ntime) const;
void SetPadStatus(Int_t nrow, Int_t ncol, Int_t ntime, UChar_t status);
Bool_t IsPadCorrupted(Int_t nrow, Int_t ncol, Int_t ntime);
void Compress();
void Expand();
Int_t GetNtime() const {return fNtime;};
Int_t GetNrow() const {return fNrow;};
Int_t GetNcol() const {return fNcol;};
Int_t GetDim() const {return fNAdim;};
void DeleteNegatives();
void Reset();
void ConditionalReset(AliTRDSignalIndex* idx);
inline Short_t* GetDataAddress(Int_t nrow, Int_t ncol, Int_t ntime = 0) const;
inline Short_t GetData(Int_t nrow, Int_t ncol, Int_t ntime) const;
inline void SetData(Int_t nrow, Int_t ncol, Int_t ntime, Short_t value);
static void CreateLut();
Bool_t IsValid() { return !TestBit(kDataInvalid); }
void SetDataInvalid() { SetBit(kDataInvalid); }
void SetDataValid() { ResetBit(kDataInvalid); }
protected:
Int_t fNdet;
Int_t fNrow;
Int_t fNcol;
Int_t fNumberOfChannels;
Int_t fNtime;
Int_t fNAdim;
Short_t* fADC;
static Short_t *fgLutPadNumbering;
ClassDef(AliTRDarrayADC,4)
};
Short_t* AliTRDarrayADC::GetDataAddress(Int_t nrow, Int_t ncol, Int_t ntime) const
{
Int_t corrcolumn = fgLutPadNumbering[ncol];
return &fADC[(nrow*fNumberOfChannels+corrcolumn)*fNtime+ntime];
}
Short_t AliTRDarrayADC::GetData(Int_t nrow, Int_t ncol, Int_t ntime) const
{
Int_t corrcolumn = fgLutPadNumbering[ncol];
return fADC[(nrow*fNumberOfChannels+corrcolumn)*fNtime+ntime];
}
void AliTRDarrayADC::SetData(Int_t nrow, Int_t ncol, Int_t ntime, Short_t value)
{
Int_t colnumb = fgLutPadNumbering[ncol];
fADC[(nrow*fNumberOfChannels+colnumb)*fNtime+ntime] = value;
}
void AliTRDarrayADC::GetData(Int_t r, Int_t c, Int_t t, Int_t n, Short_t *vals) const
{
Int_t colNum = fgLutPadNumbering[c];
for(Int_t ic=n, idx = (r*fNumberOfChannels+colNum)*fNtime+t; ic--; idx+=fNtime) vals[ic] = fADC[idx];
}
#endif