X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TRD%2FAliTRDarrayADC.h;h=93713012f724077c0c88909420735f921e673e4c;hb=1ba0214675e9bd40f7cd8c428f46c6129e9b235b;hp=9bcba83a6c8e717792e6ec59fa2bed80b9b9b19b;hpb=b65e5048d3907115b50d2f0321a8a68684c18261;p=u%2Fmrichter%2FAliRoot.git diff --git a/TRD/AliTRDarrayADC.h b/TRD/AliTRDarrayADC.h index 9bcba83a6c8..93713012f72 100644 --- a/TRD/AliTRDarrayADC.h +++ b/TRD/AliTRDarrayADC.h @@ -13,10 +13,15 @@ #include +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); @@ -26,12 +31,13 @@ class AliTRDarrayADC: public TObject 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 SetData(Int_t nrow, Int_t ncol, Int_t ntime, Short_t value) - {fADC[(nrow*fNcol+ncol)*fNtime+ntime]=value;}; + 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 GetData(Int_t nrow, Int_t ncol, Int_t ntime) const - {return fADC[(nrow*fNcol+ncol)*fNtime+ntime];}; - Short_t GetDataB(Int_t nrow, Int_t ncol, Int_t ntime) const; + 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); @@ -41,17 +47,79 @@ class AliTRDarrayADC: public TObject 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; //ID number of the chamber Int_t fNrow; //Number of rows - Int_t fNcol; //Number of columns + Int_t fNcol; //Number of columns(pads) + Int_t fNumberOfChannels; // Number of MCM channels per row Int_t fNtime; //Number of time bins Int_t fNAdim; //Dimension of the ADC array Short_t* fADC; //[fNAdim] //Pointer to adc values + static Short_t *fgLutPadNumbering; // [fNcol] Look Up Table - ClassDef(AliTRDarrayADC,1) //ADC container class + ClassDef(AliTRDarrayADC,4) //ADC container class }; + +//________________________________________________________________________________ +Short_t* AliTRDarrayADC::GetDataAddress(Int_t nrow, Int_t ncol, Int_t ntime) const +{ + // + // Get the address of the given pad + // + + 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 +{ + // + // 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 fADC[(nrow*fNumberOfChannels+corrcolumn)*fNtime+ntime]; + +} +//________________________________________________________________________________ +void AliTRDarrayADC::SetData(Int_t nrow, Int_t ncol, Int_t ntime, Short_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]; + + 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 +