X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TRD%2FAliTRDarrayADC.cxx;h=a55ac220876d94895ea330c2186a07070c56ab9b;hb=53442b369bfc572e6c8d0cf8bcd1b696a91f12ec;hp=91f96ccd504ea1298b3e43520ce3a58e3895c1c7;hpb=064d808ddc1fca8e6167c1a98d341ac62e85f258;p=u%2Fmrichter%2FAliRoot.git diff --git a/TRD/AliTRDarrayADC.cxx b/TRD/AliTRDarrayADC.cxx index 91f96ccd504..a55ac220876 100644 --- a/TRD/AliTRDarrayADC.cxx +++ b/TRD/AliTRDarrayADC.cxx @@ -25,16 +25,22 @@ //////////////////////////////////////////////////////// #include "AliTRDarrayADC.h" -#include "Cal/AliTRDCalPadStatus.h" +#include "Cal/AliTRDCalPadStatus.h" +#include "AliTRDfeeParam.h" +#include "AliTRDSignalIndex.h" +#include "AliLog.h" ClassImp(AliTRDarrayADC) +Short_t *AliTRDarrayADC::fgLutPadNumbering = 0x0; + //____________________________________________________________________________________ AliTRDarrayADC::AliTRDarrayADC() :TObject() ,fNdet(0) ,fNrow(0) ,fNcol(0) + ,fNumberOfChannels(0) ,fNtime(0) ,fNAdim(0) ,fADC(0) @@ -43,6 +49,8 @@ AliTRDarrayADC::AliTRDarrayADC() // AliTRDarrayADC default constructor // + CreateLut(); + } //____________________________________________________________________________________ @@ -51,6 +59,7 @@ AliTRDarrayADC::AliTRDarrayADC(Int_t nrow, Int_t ncol, Int_t ntime) ,fNdet(0) ,fNrow(0) ,fNcol(0) + ,fNumberOfChannels(0) ,fNtime(0) ,fNAdim(0) ,fADC(0) @@ -59,26 +68,28 @@ AliTRDarrayADC::AliTRDarrayADC(Int_t nrow, Int_t ncol, Int_t ntime) // AliTRDarrayADC constructor // + CreateLut(); Allocate(nrow,ncol,ntime); } //____________________________________________________________________________________ AliTRDarrayADC::AliTRDarrayADC(const AliTRDarrayADC &b) - :TObject() + :TObject(b) ,fNdet(b.fNdet) ,fNrow(b.fNrow) ,fNcol(b.fNcol) + ,fNumberOfChannels(b.fNumberOfChannels) ,fNtime(b.fNtime) ,fNAdim(b.fNAdim) - ,fADC(0) + ,fADC(0) { // // AliTRDarrayADC copy constructor // fADC = new Short_t[fNAdim]; - memcpy(fADC,b.fADC, fNAdim*sizeof(Short_t)); + memcpy(fADC,b.fADC, fNAdim*sizeof(Short_t)); } @@ -89,11 +100,8 @@ AliTRDarrayADC::~AliTRDarrayADC() // AliTRDarrayADC destructor // - if(fADC) - { - delete [] fADC; - fADC=0; - } + delete [] fADC; + fADC=0; } @@ -108,19 +116,20 @@ AliTRDarrayADC &AliTRDarrayADC::operator=(const AliTRDarrayADC &b) { return *this; } - if(fADC) { delete [] fADC; } + TObject::operator=(b); fNdet=b.fNdet; fNrow=b.fNrow; fNcol=b.fNcol; + fNumberOfChannels = b.fNumberOfChannels; fNtime=b.fNtime; fNAdim=b.fNAdim; fADC = new Short_t[fNAdim]; memcpy(fADC,b.fADC, fNAdim*sizeof(Short_t)); - + return *this; } @@ -130,13 +139,17 @@ void AliTRDarrayADC::Allocate(Int_t nrow, Int_t ncol, Int_t ntime) { // // Allocate memory for an AliTRDarrayADC array with dimensions - // Row*Col*Time + // Row*NumberOfNecessaryMCMs*ADCchannelsInMCM*Time // fNrow=nrow; fNcol=ncol; fNtime=ntime; - fNAdim=nrow*ncol*ntime; + Int_t adcchannelspermcm = AliTRDfeeParam::GetNadcMcm(); + Int_t padspermcm = AliTRDfeeParam::GetNcolMcm(); + Int_t numberofmcms = fNcol/padspermcm; + fNumberOfChannels = numberofmcms*adcchannelspermcm; + fNAdim=nrow*fNumberOfChannels*ntime; if(fADC) { @@ -149,16 +162,16 @@ void AliTRDarrayADC::Allocate(Int_t nrow, Int_t ncol, Int_t ntime) } //____________________________________________________________________________________ -Short_t AliTRDarrayADC::GetDataB(Int_t row, Int_t col, Int_t time) const +Short_t AliTRDarrayADC::GetDataBits(Int_t row, Int_t col, Int_t time) const { // // Get the ADC value for a given position: row, col, time // Taking bit masking into account // - // Adapted from code of the class AliTRDdataArrayDigits + // Adapted from code of the class AliTRDclusterizer // - Short_t tempval = fADC[(row*fNcol+col)*fNtime+time]; + Short_t tempval = GetData(row,col,time); // Be aware of manipulations introduced by pad masking in the RawReader // Only output the manipulated Value CLRBIT(tempval, 10); @@ -181,7 +194,7 @@ UChar_t AliTRDarrayADC::GetPadStatus(Int_t row, Int_t col, Int_t time) const // Bridged Right Masking 8 // Not Connected Masking Digits // - // Adapted from code of the class AliTRDdataArrayDigits + // Adapted from code of the class AliTRDclusterizer // UChar_t padstatus = 0; @@ -222,7 +235,7 @@ void AliTRDarrayADC::SetPadStatus(Int_t row, Int_t col, Int_t time, UChar_t stat // Bridged Left masking: Bit 11(0), Bit 12(1) // Bridged Right masking: Bit 11(1), Bit 12(1) // - // Adapted from code of the class AliTRDdataArrayDigits + // Adapted from code of the class AliTRDclusterizer // Short_t signal = GetData(row,col,time); @@ -251,6 +264,7 @@ void AliTRDarrayADC::SetPadStatus(Int_t row, Int_t col, Int_t time, UChar_t stat SETBIT(signal, 10); SETBIT(signal, 11); SETBIT(signal, 12); + break; default: CLRBIT(signal, 10); CLRBIT(signal, 11); @@ -267,7 +281,7 @@ Bool_t AliTRDarrayADC::IsPadCorrupted(Int_t row, Int_t col, Int_t time) // // Checks if the pad has any masking as corrupted (Bit 10 in signal set) // - // Adapted from code of the class AliTRDdataArrayDigits + // Adapted from code of the class AliTRDclusterizer // Short_t signal = GetData(row,col,time); @@ -282,135 +296,146 @@ void AliTRDarrayADC::Compress() // Compress the array // + if(fNAdim!=fNrow*fNumberOfChannels*fNtime) + { + AliDebug(1,"The ADC array is already compressed"); + return; + } + Int_t counter=0; Int_t newDim=0; Int_t j; Int_t l; Int_t r=0; Int_t s=0; - Int_t *longm; - longm = new Int_t[fNAdim]; - Int_t *longz; - longz = new Int_t[fNAdim]; Int_t k=0; - memset(longz,0,sizeof(Int_t)*fNAdim); - memset(longm,0,sizeof(Int_t)*fNAdim); - for(Int_t i=0;i0) - { - i=i+1; - } - i=i+j+(l-16001-1); - } - - //Calculate the size of the compressed array - for(Int_t i=0; i0) + if(fADC[i]>0) { - buffer[i]=fADC[counterTwo]; + i=i+1; } - if(fADC[counterTwo]==-1) + i=i+j+(l-16001-1); + } + + //Calculate the size of the compressed array + for(Int_t i=0; i0) + { + buffer[i]=fADC[counterTwo]; + } + if(fADC[counterTwo]==-1) + { + buffer[i]=-(longm[g]); + counterTwo=counterTwo+longm[g]-1; + g++; + } + if(fADC[counterTwo]==0) + { + buffer[i]=-(longz[h]); + counterTwo=counterTwo+(longz[h]-16001)-1; + h++; + } + counterTwo++; + } + } + + //Copy the buffer + delete [] fADC; + fADC=0; + fADC = new Short_t[newDim]; + fNAdim = newDim; + for(Int_t i=0; i=-16000)) - { - longm[r2]=-fADC[i]; - r2++; - } - if(fADC[i]<-16000) - { - longz[r3]=-fADC[i]-16001; - r3++; - } - } - //Calculate the new dimensions of the array - for(Int_t i=0; i0) - { - bufferE[i]=fADC[contaexp]; - } + Int_t dimexp=0; + Int_t *longz = new Int_t[fNAdim]; + Int_t *longm = new Int_t[fNAdim]; - if((fADC[contaexp]<0)&&(fADC[contaexp]>=-16000)) + if (longz && longm) { - for(Int_t j=0; j=-16000)) + { + longm[r2]=-fADC[i]; + r2++; + } + if(fADC[i]<-16000) + { + longz[r3]=-fADC[i]-16001; + r3++; + } + } + + //Calculate the new dimensions of the array + for(Int_t i=0; i0) + { + bufferE[i]=fADC[contaexp]; + } + if((fADC[contaexp]<0)&&(fADC[contaexp]>=-16000)) + { + for(Int_t j=0; jGetNoOfIndexes()>25) + memset(fADC,0,sizeof(Short_t)*fNAdim); + else + { + Int_t row, col; + while(idx->NextRCIndex(row, col)){ + Int_t colnumb = fgLutPadNumbering[col]; + memset(&fADC[(row*fNumberOfChannels+colnumb)*fNtime],0,fNtime); + } + } + +} + +//________________________________________________________________________________ +void AliTRDarrayADC::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