From a97b3678d2b467065e293043d7caade7637dbcf8 Mon Sep 17 00:00:00 2001 From: masera Date: Thu, 19 Apr 2007 10:51:58 +0000 Subject: [PATCH] SDD raw data treatment: same format for real and simulated data --- ITS/AliITSClusterFinderV2SDD.cxx | 34 ++-- ITS/AliITSDDLRawData.cxx | 279 +++++++++++++++++++++++++++---- ITS/AliITSRawStreamSDD.cxx | 259 ++++++++++++++++++++++++---- ITS/AliITSRawStreamSDD.h | 45 ++--- ITS/AliITSRawStreamSDDv2.cxx | 44 ++--- ITS/AliITSRawStreamSDDv3.cxx | 48 +++--- 6 files changed, 564 insertions(+), 145 deletions(-) diff --git a/ITS/AliITSClusterFinderV2SDD.cxx b/ITS/AliITSClusterFinderV2SDD.cxx index 6cf853b3ca7..b5ab56bea9e 100644 --- a/ITS/AliITSClusterFinderV2SDD.cxx +++ b/ITS/AliITSClusterFinderV2SDD.cxx @@ -309,8 +309,7 @@ void AliITSClusterFinderV2SDD::FindClustersSDD(AliITSRawStream* input, FindClustersSDD(bins, kMaxBin, kNzBins, NULL, clusters[iModule]); Int_t nClusters = clusters[iModule]->GetEntriesFast(); nClustersSDD += nClusters; - bins[0] = bins[1] = NULL; - + bins[0] = bins[1] = NULL; } if (!next) break; @@ -322,12 +321,22 @@ void AliITSClusterFinderV2SDD::FindClustersSDD(AliITSRawStream* input, } // fill the current digit into the bins array - if(input->GetSignal()>=3) { + AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)GetResp(input->GetModuleID()); + AliITSresponseSDD* res = (AliITSresponseSDD*)cal->GetResponse(); + const char *option=res->ZeroSuppOption(); + Int_t q=input->GetSignal(); + if(!((strstr(option,"1D")) || (strstr(option,"2D")))){ + Float_t baseline = cal->GetBaseline(input->GetCoord1()); + if(q>baseline) q-=(Int_t)baseline; + else q=0; + } + if(q>=cal->GetThresholdAnode(input->GetCoord1())) { Int_t iz = input->GetCoord1()+1; - Int_t side = ((iz <= fNzSDD) ? 0 : 1); - iz -= side*fNzSDD; + //Int_t side = ((iz <= fNzSDD) ? 0 : 1); + Int_t side = ((AliITSRawStreamSDD*)input)->GetChannel(); + // iz -= side*fNzSDD; Int_t index = (input->GetCoord2()+1) * kNzBins + iz; - bins[side][index].SetQ(input->GetSignal()); + bins[side][index].SetQ(q); bins[side][index].SetMask(1); bins[side][index].SetIndex(index); } @@ -337,7 +346,6 @@ void AliITSClusterFinderV2SDD::FindClustersSDD(AliITSRawStream* input, delete[] binsSDDInit; Info("FindClustersSDD", "found clusters in ITS SDD: %d", nClustersSDD); - } @@ -347,18 +355,18 @@ void AliITSClusterFinderV2SDD::CorrectPosition(Float_t &z, Float_t&y){ //correction of coordinates using the maps stored in the DB AliITSCalibrationSDD* cal = (AliITSCalibrationSDD*)GetResp(fModule); - static const Int_t nbint = cal->GetMapTimeNBin(); - static const Int_t nbina = cal->Chips()*cal->Channels(); + static const Int_t knbint = cal->GetMapTimeNBin(); + static const Int_t knbina = cal->Chips()*cal->Channels(); Float_t stepa = (GetSeg()->Dpz(0))/10000.; //anode pitch in cm Float_t stept = (GetSeg()->Dx()/cal->GetMapTimeNBin()/2.)/10.; Int_t bint = TMath::Abs((Int_t)(y/stept)); - if(y>=0) bint+=(Int_t)(nbint/2.); - if(bint>nbint) AliError("Wrong bin number!"); + if(y>=0) bint+=(Int_t)(knbint/2.); + if(bint>knbint) AliError("Wrong bin number!"); Int_t bina = TMath::Abs((Int_t)(z/stepa)); - if(z>=0) bina+=(Int_t)(nbina/2.); - if(bina>nbina) AliError("Wrong bin number!"); + if(z>=0) bina+=(Int_t)(knbina/2.); + if(bina>knbina) AliError("Wrong bin number!"); Float_t devz = cal->GetMapACell(bina,bint)/10000.; Float_t devx = cal->GetMapTCell(bina,bint)/10000.; diff --git a/ITS/AliITSDDLRawData.cxx b/ITS/AliITSDDLRawData.cxx index bdbd9d40626..573ddf67142 100644 --- a/ITS/AliITSDDLRawData.cxx +++ b/ITS/AliITSDDLRawData.cxx @@ -114,17 +114,64 @@ void AliITSDDLRawData::GetDigitsSSD(TClonesArray *ITSdigits,Int_t mod,Int_t modR // void AliITSDDLRawData::GetDigitsSDD(TClonesArray *ITSdigits,Int_t mod,Int_t modR,Int_t ddl,UInt_t *buf){ - //This method packs the SSD digits in a proper 32 bits structure + //This method packs the SDD digits in a proper 32 bits structure Int_t ix; Int_t iz; Int_t is; - UInt_t word; - UInt_t baseWord; + UInt_t word=0; + UInt_t baseWord=0; Int_t ndigits = ITSdigits->GetEntries(); AliITSdigit *digs; ofstream ftxt; + Int_t digarr[512][256]; + for(Int_t i=0;i<512;i++){ + for(Int_t j=0;j<256;j++){ + digarr[i][j]=0; + } + } + //word to select the 12 carlos for the 12 modules + UInt_t carlosid=0; + if(mod==0) carlosid=805306368; + if(mod==1) carlosid=805306369; + if(mod==2) carlosid=805306370; + if(mod==3) carlosid=805306371; + if(mod==4) carlosid=805306372; + if(mod==5) carlosid=805306373; + if(mod==6) carlosid=805306374; + if(mod==7) carlosid=805306375; + if(mod==8) carlosid=805306376; + if(mod==9) carlosid=805306377; + if(mod==10) carlosid=805306378; + if(mod==11) carlosid=805306379; + + fIndex++; + buf[fIndex]=carlosid; + Int_t first=0; + Int_t last=0; + Int_t diff=0; + Int_t nbit=0; + UInt_t word2=0; + Bool_t flag = kFALSE; + baseWord=0; + Int_t bitinfo1[4] = {3,8,3,7}; //vector with info on bit for timebin info + Int_t wordinfo1[4]= {0,0,0,0}; //vector with word info for timebin info + Int_t bitinfo2[2] = {3,18}; //vector with info on bit for EOR (end of row) info + Int_t wordinfo2[3]= {1,65593}; //vector with word info for anode info + + /* for time bin info: word n bits meaning + 0 3 next info is timebin + 8 3 next word is 8 bit long + tb value 8 timebin value + n (2->7) 3 next info is n bit long + signal n signal value + + for anode info: 1 3 next 18 bits are for EOR + increments the anode value + + EOR 18 error codes + other info + */ + if(ndigits){ - //cout<<"Mudule "<GetCoord1(); // Anode ix=digs->GetCoord2(); // Time is=digs->GetCompressedSignal(); // ADC Signal - if (fVerbose==2) + digarr[iz][ix]=is; + if (fVerbose==2) ftxt<<"DDL:"<255){Error("GetDigitsSDD", "bits words is needed)!!!");} - baseWord=0; - /* - //10 bits words for amplitude value - word=is; - AliBitPacking::PackWord(word,baseWord,0,9);//ADC data - word=ix; - AliBitPacking::PackWord(word,baseWord,10,17);//Time bucket - word=iz; - AliBitPacking::PackWord(word,baseWord,18,26);//Anode Number - word=mod; - AliBitPacking::PackWord(word,baseWord,27,31);//Module number - */ + } - //8bits words for amplitude value - word=is; - AliBitPacking::PackWord(word,baseWord,0,7);//ADC data - word=ix; - AliBitPacking::PackWord(word,baseWord,8,15);//Time bucket - word=iz; - AliBitPacking::PackWord(word,baseWord,16,24);//Anode Number - word=mod; - AliBitPacking::PackWord(word,baseWord,25,31);//Module number - - fIndex++; - buf[fIndex]=baseWord; - }//end for - }//end if + for(Int_t anode=0;anode<512;anode++){ + if(flag){ + last = first+diff-1; + AliBitPacking::PackWord(word2,baseWord,first,last); + flag = kFALSE; + first = last+1; + diff=0; + } + + + if(anode == 256){ + last = 0; + first = 0; + flag = kFALSE; + diff = 0; + word2=0; + + } + + for(Int_t tb=0;tb<256;tb++){ + if(digarr[anode][tb]!=0){ + if(flag){ + last = first+diff-1; + AliBitPacking::PackWord(word2,baseWord,first,last); + flag = kFALSE; + first = last+1; + diff=0; + } + wordinfo1[1] = tb; + //non lossy compression as it is done in Carlos + //(data are already 10to8bit compressed by AMBRA + + /* if value < 8 value = value - (1 << 2) (word is 2 bit long) + if value < 16 value = value - (1 << 3) (word is 3 bit long) + if value < 32 value = value - (1 << 4) (word is 4 bit long) + if value < 64 value = value - (1 << 5) (word is 5 bit long) + if value <128 value = value - (1 << 6) (word is 6 bit long) + if value >=128value = value - (1 << 7) (word is 7 bit long) + + */ + if(digarr[anode][tb]<8){ + bitinfo1[3] = 2; + wordinfo1[2] = 2; + wordinfo1[3] = digarr[anode][tb]-(1 << bitinfo1[3]); + } + if(digarr[anode][tb]>=8 && digarr[anode][tb]<16){ + bitinfo1[3] = 3; + wordinfo1[2] = 3; + wordinfo1[3] = digarr[anode][tb]-(1 << bitinfo1[3]); + } + if(digarr[anode][tb]>=16 && digarr[anode][tb]<32){ + bitinfo1[3] = 4; + wordinfo1[2] = 4; + wordinfo1[3] = digarr[anode][tb]-(1 << bitinfo1[3]); + } + if(digarr[anode][tb]>=32 && digarr[anode][tb]<64){ + bitinfo1[3] = 5; + wordinfo1[2] = 5; + wordinfo1[3] = digarr[anode][tb]-(1 << bitinfo1[3]); + } + if(digarr[anode][tb]>=64 && digarr[anode][tb]<128){ + bitinfo1[3] = 6; + wordinfo1[2] = 6; + wordinfo1[3] = digarr[anode][tb]-(1 << bitinfo1[3]); + } + if(digarr[anode][tb]>=128){ + bitinfo1[3] = 7; + wordinfo1[2] = 7; + wordinfo1[3] = digarr[anode][tb]-(1 << bitinfo1[3]); + } + + for(Int_t ie=0;ie<4;ie++){ + + if(flag){ + last = first+diff-1; + AliBitPacking::PackWord(word2,baseWord,first,last); + flag = kFALSE; + first = last+1; + diff=0; + } + last = first+bitinfo1[ie]-1; + if(first < 30 && last < 30){ + AliBitPacking::PackWord(wordinfo1[ie],baseWord,first,last); + first = last+1; + } + else{ + if(first<=29){ + UInt_t w = AliBitPacking::UnpackWord(wordinfo1[ie],0,29-first); + AliBitPacking::PackWord(w,baseWord,first,29); + Int_t lb = 29-first+1; + diff = bitinfo1[ie]-lb; + word2 = AliBitPacking::UnpackWord(wordinfo1[ie],lb,lb+diff-1); + flag = kTRUE; + if(anode<256) word = 2;//channel 0 of carlos + else word = 3; //channel 1 of carlos + AliBitPacking::PackWord(word,baseWord,30,31); + fIndex++; + buf[fIndex]=baseWord; + first=0; + last = 0; + baseWord=0; + word = 0; + } + else{ + word2 = wordinfo1[ie]; + diff = bitinfo1[ie]; + flag = kTRUE; + if(anode<256) word = 2; //channel 0 of carlos + else word = 3; //channel 1 of carlos + AliBitPacking::PackWord(word,baseWord,30,31); + fIndex++; + buf[fIndex]=baseWord; + first=0; + last=0; + baseWord=0; + word = 0; + } + } + } + + }//END IF + + }//end loop on tb + + for(Int_t i=0;i<2;i++){ + if(flag){ + last = first+diff-1; + AliBitPacking::PackWord(word2,baseWord,first,last); + flag = kFALSE; + first = last+1; + diff=0; + } + + word = wordinfo2[i]; + nbit = bitinfo2[i]; + last = first+nbit-1; + if(first < 30 && last < 30){ + AliBitPacking::PackWord(word,baseWord,first,last); //3 bit code =1 -> next 18 bits for EOR + first = last+1; + } + + else{ + if(first<=29){ + UInt_t w = AliBitPacking::UnpackWord(word,0,29-first); + AliBitPacking::PackWord(w,baseWord,first,29); + Int_t lb = 29-first+1; + diff = nbit-lb; + word2 = AliBitPacking::UnpackWord(word,lb,lb+diff-1); + flag = kTRUE; + if(anode<256) word = 2; + else word = 3; + AliBitPacking::PackWord(word,baseWord,30,31); + fIndex++; + buf[fIndex]=baseWord; + first=0; + last = 0; + baseWord=0; + if(anode==255){ + flag=kFALSE; + word2=0; + } + } + else{ + word2 = word; + diff = nbit; + flag = kTRUE; + if(anode<256) word = 2; + else word = 3; + AliBitPacking::PackWord(word,baseWord,30,31); + fIndex++; + buf[fIndex]=baseWord; + first=0; + last=0; + baseWord=0; + if(anode==255){ + flag=kFALSE; + word2=0; + } + } + } + } + } //end for + + } if(fVerbose==2) ftxt.close(); return; @@ -328,6 +534,7 @@ Int_t AliITSDDLRawData::RawDataSPD(TBranch* branch){ ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Int_t AliITSDDLRawData::RawDataSSD(TBranch* branch){ + //This method creates the Raw data files for SSD detectors const Int_t kSize=1536;//768*2 Number of stripe * number of sides(N and P) UInt_t buf[kSize]; @@ -388,6 +595,7 @@ Int_t AliITSDDLRawData::RawDataSDD(TBranch* branch){ char fileName[15]; ofstream outfile; // logical name of the output file AliRawDataHeader header; + UInt_t skippedword = AliBitPacking::PackWord(2,skippedword,0,31); //loop over DDLs for(Int_t i=0;iClear(); branch->GetEvent(moduleNumber); + //For each Module, buf contains the array of data words in Binary format //fIndex gives the number of 32 bits words in the buffer for each module // cout<<"MODULE NUMBER:"<Reset(); fRawReader->Select("ITSSDD"); + //fRawReader->SelectEquipment(17, 101, 101);//select this for test data + //fNCarlos = 8; //select this for test data } UInt_t AliITSRawStreamSDD::ReadBits() { // read bits from the given channel - UInt_t result = (fChannelData[fChannel] & ((1<>= fReadBits[fChannel]; - fLastBit[fChannel] -= fReadBits[fChannel]; + UInt_t result = (fChannelData[fCarlosId][fChannel] & ((1<>= fReadBits[fCarlosId][fChannel]; + fLastBit[fCarlosId][fChannel] -= fReadBits[fCarlosId][fChannel]; return result; } Int_t AliITSRawStreamSDD::DecompAmbra(Int_t value) const { -// AMBRA decompression - + // AMBRA decompression (from 8 to 10 bit) + if ((value & 0x80) == 0) { return value & 0x7f; } else if ((value & 0x40) == 0) { @@ -89,6 +113,7 @@ Int_t AliITSRawStreamSDD::DecompAmbra(Int_t value) const } else { return 0x208 + ((value & 0x1f) << 4); } + } Bool_t AliITSRawStreamSDD::Next() @@ -97,14 +122,180 @@ Bool_t AliITSRawStreamSDD::Next() // returns kFALSE if there is no digit left fPrevModuleID = fModuleID; - if (!fRawReader->ReadNextInt(fData)) return kFALSE; + fDDL=fRawReader->GetDDLID(); + Int_t ddln = fRawReader->GetDDLID(); + if(ddln <0) ddln=0; + while (fSkip[ddln] < 9) { + if (!fRawReader->ReadNextInt(fData)) return kFALSE; + if ((fData >> 30) == 0x01) continue; // JTAG word + fSkip[ddln]++; + } + + + Int_t countFoot[kModulesPerDDL]; + for(Int_t i=0;iReadNextInt(fData)) return kFALSE; // read next word + ddln = fRawReader->GetDDLID(); + if(ddln!=fDDL){ + Reset(); + for(Int_t icr=0;icr (kDDLsNumber-1)) ddln = 0; + while (fSkip[ddln] < 9) { + if (!fRawReader->ReadNextInt(fData)) return kFALSE; + if ((fData >> 30) == 0x01) continue; // JTAG word + fSkip[ddln]++; + } + + fChannel = -1; + + + if( ((fData << 4) >> 4) == 0){ + fCarlosId = 0;fNfifo0 = fCarlosId; + } + else if (((fData << 4) >> 4) == 1){ + fCarlosId = 1;fNfifo0 = fCarlosId; + } + else if (((fData << 4) >> 4) == 2){ + fCarlosId = 2; + if(fNCarlos == 8) fNfifo1 = fCarlosId; + else fNfifo0 = fCarlosId; + } + else if (((fData << 4) >> 4) == 3){ + fCarlosId = 3;fNfifo1 = fCarlosId; + } + else if (((fData << 4) >> 4) == 4){ + fCarlosId = 4; + if(fNCarlos == 8) fNfifo2 = fCarlosId; + else fNfifo1 = fCarlosId; + } + else if (((fData << 4) >> 4) == 5){ + fCarlosId = 5; + if(fNCarlos == 8) fNfifo2 = fCarlosId; + else fNfifo1 = fCarlosId; + } + else if (((fData << 4) >> 4) == 6){ + fCarlosId = 6; + if(fNCarlos == 8) fNfifo3 = fCarlosId; + else fNfifo2 = fCarlosId; + } + else if (((fData << 4) >> 4) == 7){ + fCarlosId = 7; + if(fNCarlos == 8) fNfifo3 = fCarlosId; + else fNfifo2 = fCarlosId; + } + else if (((fData << 4) >> 4) == 8){ + fCarlosId = 8;fNfifo2 = fCarlosId; + } + else if (((fData << 4) >> 4) == 9){ + fCarlosId = 9;fNfifo3 = fCarlosId; + } + else if (((fData << 4) >> 4) == 10){ + fCarlosId = 10;fNfifo3 = fCarlosId; + } + else if (((fData << 4) >> 4) == 11){ + fCarlosId = 11;fNfifo3 = fCarlosId; + } + else if (((fData << 4) >> 4) == 16){ + fCarlosId = fNfifo0; + } + else if (((fData << 4) >> 4) == 17){ + fCarlosId = fNfifo1; + } + else if (((fData << 4) >> 4) == 18){ + fCarlosId = fNfifo2; + } + else if (((fData << 4) >> 4) == 19){ + fCarlosId = fNfifo3; + } + if(fData==1059004191) continue; + if (fNCarlos == 8 && (fCarlosId == 8 || fCarlosId == 9 || + fCarlosId ==10 || fCarlosId == 11))continue; + + fModuleID = fgkDDLModuleMap[fRawReader->GetDDLID()][fCarlosId]; + + if ((fData >> 28) == 0x02) { // header + fEventId = (fData >> 3) & 0x07FF; + } else if ((fData >> 28) == 0x03) { // footer + countFoot[fCarlosId]++; // stop before the last word (last word=jitter) + if(countFoot[fCarlosId]==3){ + return kFALSE; + } + } else if ((fData >> 29) == 0x00) { // error - UInt_t relModuleID = (fData >> 25) & 0x0000007F; - fModuleID = fgkDDLModuleMap[fRawReader->GetDDLID()][relModuleID]; - fCoord1 = (fData >> 16) & 0x000001FF; - fCoord2 = (fData >> 8) & 0x000000FF; - fSignal = fData & 0x000000FF; + if ((fData & 0x00000163) != 0) { + + Error("Next", "error codes = %8.8x",fData); + return kFALSE; + + } + } else if ((fData >> 30) == 0x01) { // JTAG word + // ignored + } else if ((fData >> 30) == 0x02) { // channel 0 data + + fChannel = 0; + } else if ((fData >> 30) == 0x03) { // channel 1 data + fChannel = 1; + } else { // unknown data format + Error("Next", "invalid data: %8.8x\n", fData); + return kFALSE; + } + + if (fChannel >= 0) { // add read word to the data + fChannelData[fCarlosId][fChannel] += + (ULong64_t(fData & 0x3FFFFFFF) << fLastBit[fCarlosId][fChannel]); + fLastBit[fCarlosId][fChannel] += 30; + } + + } else { // decode data + + if (fReadCode[fCarlosId][fChannel]) {// read the next code word + fChannelCode[fCarlosId][fChannel] = ReadBits(); + fReadCode[fCarlosId][fChannel] = kFALSE; + fReadBits[fCarlosId][fChannel] = fgkCodeLength[fChannelCode[fCarlosId][fChannel]]; + + } else { // read the next data word + UInt_t data = ReadBits(); + fReadCode[fCarlosId][fChannel] = kTRUE; + fReadBits[fCarlosId][fChannel] = 3; + if (fChannelCode[fCarlosId][fChannel] == 0) { // set the time bin + fTimeBin[fCarlosId][fChannel] = data; + } else if (fChannelCode[fCarlosId][fChannel] == 1) { // next anode + fTimeBin[fCarlosId][fChannel] = 0; + fAnode[fCarlosId][fChannel]++; + + }else { // ADC signal data + fSignal = DecompAmbra(data + (1 << fChannelCode[fCarlosId][fChannel]) + fLowThreshold[fChannel]); + fCoord1 = fAnode[fCarlosId][fChannel]; + fCoord2 = fTimeBin[fCarlosId][fChannel]; + fTimeBin[fCarlosId][fChannel]++; + return kTRUE; + } + } + } + } + return kFALSE; - return kTRUE; } +void AliITSRawStreamSDD::Reset(){ + //reset data member for a new ddl + + for(Int_t i=0;i<2;i++){ + for(Int_t ic=0;icGetDDLID(); +} diff --git a/ITS/AliITSRawStreamSDD.h b/ITS/AliITSRawStreamSDD.h index 341b2db619c..db17118191b 100644 --- a/ITS/AliITSRawStreamSDD.h +++ b/ITS/AliITSRawStreamSDD.h @@ -9,7 +9,6 @@ /// /// This class provides access to ITS SDD digits in raw data /// (default=simulated data). -/// /////////////////////////////////////////////////////////////////////////////// #include "AliITSRawStream.h" @@ -27,15 +26,16 @@ class AliITSRawStreamSDD: public AliITSRawStream { virtual Int_t GetAnode() const {return fCoord1;} virtual Int_t GetTime() const {return fCoord2;} virtual Int_t GetChannel() const {return fChannel;} - virtual Int_t ReadJitter() {return 0;} - - virtual void SetLowCarlosThreshold(Int_t th, Int_t i) {fLowThreshold[i]=th;} - + virtual Int_t ReadJitter() const {return 0;} + virtual Int_t GetCarlosId() const {return fCarlosId;} + virtual void SetLowCarlosThreshold(Int_t th, Int_t i) + {fLowThreshold[i]=th;} static Int_t GetModuleNumber(UInt_t iDDL, UInt_t iModule) {return fgkDDLModuleMap[iDDL][iModule];} + virtual void Reset(); - enum {kDDLsNumber = 12}; // number of DDLs in SDD - enum {kModulesPerDDL = 22}; // number of modules in each DDL + enum {kDDLsNumber = 24}; // number of DDLs in SDD + enum {kModulesPerDDL = 12}; // number of modules in each DDL protected: @@ -47,22 +47,27 @@ class AliITSRawStreamSDD: public AliITSRawStream { static const UInt_t fgkCodeLength[8]; //code length UInt_t fData; // data read for file - Int_t fSkip; // number of skipped words - Int_t fEventId; // event ID from the header - Int_t fCarlosId; // carlos ID from the header + Int_t fSkip[kDDLsNumber];// number of skipped words + Int_t fCarlosId; // carlos ID + Int_t fEventId; // event ID from header Int_t fChannel; // current channel Int_t fJitter; // jitter between L0 and pascal stop (x25ns) - ULong64_t fChannelData[2]; // packed data for the 2 channels - UInt_t fLastBit[2]; // last filled bit in fChannelData - UInt_t fChannelCode[2]; // current channel code - Bool_t fReadCode[2]; // next bits are code or data - UInt_t fReadBits[2]; // number of bits to read - Int_t fTimeBin[2]; // current time bin - Int_t fAnode[2]; // current anode number + ULong64_t fChannelData[kModulesPerDDL][2];// packed data for the 2 channels + UInt_t fLastBit[kModulesPerDDL][2]; // last filled bit in fChannelData + UInt_t fChannelCode[kModulesPerDDL][2];// current channel code + Bool_t fReadCode[kModulesPerDDL][2]; // next bits are code or data + UInt_t fReadBits[kModulesPerDDL][2]; // number of bits to read Int_t fLowThreshold[2]; // low Carlos threshold - - - ClassDef(AliITSRawStreamSDD, 1) // class for reading ITS SDD raw digits + Int_t fNCarlos; // number of Carlos + Int_t fNfifo0; // fifo n. 0 + Int_t fNfifo1; // fifo n. 1 + Int_t fNfifo2; // fifo n. 2 + Int_t fNfifo3; // fifo n. 3 + Int_t fTimeBin[kModulesPerDDL][2]; // current timebin [ncarlos][nchannels] + Int_t fAnode[kModulesPerDDL][2]; // current anode [ncarlos][nchannels] + Int_t fDDL; //current ddl number + + ClassDef(AliITSRawStreamSDD, 2) // class for reading ITS SDD raw digits }; #endif diff --git a/ITS/AliITSRawStreamSDDv2.cxx b/ITS/AliITSRawStreamSDDv2.cxx index 3805c39e244..efc54485fb2 100644 --- a/ITS/AliITSRawStreamSDDv2.cxx +++ b/ITS/AliITSRawStreamSDDv2.cxx @@ -45,20 +45,20 @@ Bool_t AliITSRawStreamSDDv2::Next() // returns kFALSE if there is no digit left // skip the first 8 words - while (fSkip < 8) { + while (fSkip[0] < 8) { if (!fRawReader->ReadNextInt(fData)) return kFALSE; if ((fData >> 30) == 0x01) continue; // JTAG word - if (fSkip == 4) { + if (fSkip[0] == 4) { if (fData != 0) { Error("Next", "data not valid: %8.8d", fData); return kFALSE; } } - fSkip++; + fSkip[0]++; } while (kTRUE) { - if ((fChannel < 0) || (fLastBit[fChannel] < fReadBits[fChannel])) { + if ((fChannel < 0) || (fLastBit[0][fChannel] < fReadBits[0][fChannel])) { if (!fRawReader->ReadNextInt(fData)) return kFALSE; // read next word fChannel = -1; @@ -85,32 +85,32 @@ Bool_t AliITSRawStreamSDDv2::Next() } if (fChannel >= 0) { // add read word to the data - fChannelData[fChannel] += - (ULong64_t(fData & 0x3FFFFFFF) << fLastBit[fChannel]); - fLastBit[fChannel] += 30; + fChannelData[0][fChannel] += + (ULong64_t(fData & 0x3FFFFFFF) << fLastBit[0][fChannel]); + fLastBit[0][fChannel] += 30; } } else { // decode data - if (fReadCode[fChannel]) { // read the next code word - fChannelCode[fChannel] = ReadBits(); - fReadCode[fChannel] = kFALSE; - fReadBits[fChannel] = fgkCodeLength[fChannelCode[fChannel]]; + if (fReadCode[0][fChannel]) { // read the next code word + fChannelCode[0][fChannel] = ReadBits(); + fReadCode[0][fChannel] = kFALSE; + fReadBits[0][fChannel] = fgkCodeLength[fChannelCode[0][fChannel]]; } else { // read the next data word UInt_t data = ReadBits(); - fReadCode[fChannel] = kTRUE; - fReadBits[fChannel] = 3; - if (fChannelCode[fChannel] == 0) { // set the time bin - fTimeBin[fChannel] = data; - } else if (fChannelCode[fChannel] == 1) { // next anode - fTimeBin[fChannel] = 0; - fAnode[fChannel]++; + fReadCode[0][fChannel] = kTRUE; + fReadBits[0][fChannel] = 3; + if (fChannelCode[0][fChannel] == 0) { // set the time bin + fTimeBin[0][fChannel] = data; + } else if (fChannelCode[0][fChannel] == 1) { // next anode + fTimeBin[0][fChannel] = 0; + fAnode[0][fChannel]++; } else { // ADC signal data - fSignal = DecompAmbra(data + (1 << fChannelCode[fChannel]) + + fSignal = DecompAmbra(data + (1 << fChannelCode[0][fChannel]) + fLowThreshold[fChannel]); - fCoord1 = fAnode[fChannel]; - fCoord2 = fTimeBin[fChannel]; - fTimeBin[fChannel]++; + fCoord1 = fAnode[0][fChannel]; + fCoord2 = fTimeBin[0][fChannel]; + fTimeBin[0][fChannel]++; return kTRUE; } } diff --git a/ITS/AliITSRawStreamSDDv3.cxx b/ITS/AliITSRawStreamSDDv3.cxx index d7d8beb0a1c..c92f41ff8dd 100644 --- a/ITS/AliITSRawStreamSDDv3.cxx +++ b/ITS/AliITSRawStreamSDDv3.cxx @@ -66,15 +66,15 @@ Bool_t AliITSRawStreamSDDv3::Next() // read the next raw digit // returns kFALSE if there is no digit left // skip the first 8 words - while (fSkip < 9) { + while (fSkip[0] < 9) { if (!fRawReader->ReadNextInt(fData)) return kFALSE; if ((fData >> 30) == 0x01) continue; // JTAG word - fSkip++; + fSkip[0]++; } Int_t countFoot=0; while (kTRUE) { - if ((fChannel < 0) || (fLastBit[fChannel] < fReadBits[fChannel])) { + if ((fChannel < 0) || (fLastBit[0][fChannel] < fReadBits[0][fChannel])) { if (!fRawReader->ReadNextInt(fData)) return kFALSE; // read next word fChannel = -1; if ((fData >> 28) == 0x02) { // header @@ -85,9 +85,9 @@ Bool_t AliITSRawStreamSDDv3::Next() if(countFoot==3) return kFALSE; } else if ((fData >> 29) == 0x00) { // error - if ((fData & 0x00000163) != 0) { - Error("Next", "error codes = %8.8x",fData); - return kFALSE; + if ((fData & 0x00000163) != 0) { + Error("Next", "error codes = %8.8x",fData); + return kFALSE; } } else if ((fData >> 30) == 0x01) { // JTAG word // ignored @@ -102,32 +102,32 @@ Bool_t AliITSRawStreamSDDv3::Next() if (fChannel >= 0) { // add read word to the data - fChannelData[fChannel] += - (ULong64_t(fData & 0x3FFFFFFF) << fLastBit[fChannel]); - fLastBit[fChannel] += 30; + fChannelData[0][fChannel] += + (ULong64_t(fData & 0x3FFFFFFF) << fLastBit[0][fChannel]); + fLastBit[0][fChannel] += 30; } } else { // decode data - if (fReadCode[fChannel]) { // read the next code word - fChannelCode[fChannel] = ReadBits(); - fReadCode[fChannel] = kFALSE; - fReadBits[fChannel] = fgkCodeLength[fChannelCode[fChannel]]; + if (fReadCode[0][fChannel]) { // read the next code word + fChannelCode[0][fChannel] = ReadBits(); + fReadCode[0][fChannel] = kFALSE; + fReadBits[0][fChannel] = fgkCodeLength[fChannelCode[0][fChannel]]; } else { // read the next data word UInt_t data = ReadBits(); - fReadCode[fChannel] = kTRUE; - fReadBits[fChannel] = 3; - if (fChannelCode[fChannel] == 0) { // set the time bin - fTimeBin[fChannel] = data; - } else if (fChannelCode[fChannel] == 1) { // next anode - fTimeBin[fChannel] = 0; - fAnode[fChannel]++; + fReadCode[0][fChannel] = kTRUE; + fReadBits[0][fChannel] = 3; + if (fChannelCode[0][fChannel] == 0) { // set the time bin + fTimeBin[0][fChannel] = data; + } else if (fChannelCode[0][fChannel] == 1) { // next anode + fTimeBin[0][fChannel] = 0; + fAnode[0][fChannel]++; } else { // ADC signal data - fSignal = DecompAmbra(data + (1 << fChannelCode[fChannel]) + + fSignal = DecompAmbra(data + (1 << fChannelCode[0][fChannel]) + fLowThreshold[fChannel]); - fCoord1 = fAnode[fChannel]; - fCoord2 = fTimeBin[fChannel]; - fTimeBin[fChannel]++; + fCoord1 = fAnode[0][fChannel]; + fCoord2 = fTimeBin[0][fChannel]; + fTimeBin[0][fChannel]++; return kTRUE; } } -- 2.43.0