X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TRD%2FAliTRDrawStream.cxx;h=ccd6698f924816a307e4f563d1a73b3a672c0264;hb=894840ad647b8b97bb9cd30fbf2c83590bc56f46;hp=a94779ad995c0bbf37edb478b5004fd8e2dec37b;hpb=20ebb9d0f206403d1b7753df3487898a4a632b85;p=u%2Fmrichter%2FAliRoot.git diff --git a/TRD/AliTRDrawStream.cxx b/TRD/AliTRDrawStream.cxx index a94779ad995..ccd6698f924 100644 --- a/TRD/AliTRDrawStream.cxx +++ b/TRD/AliTRDrawStream.cxx @@ -110,7 +110,6 @@ ClassImp(AliTRDrawStream) Bool_t AliTRDrawStream::fgExtraSkip = kFALSE; Bool_t AliTRDrawStream::fgSkipCDH = kFALSE; -Bool_t AliTRDrawStream::fgWarnError = kTRUE; Bool_t AliTRDrawStream::fgCleanDataOnly = kFALSE; Bool_t AliTRDrawStream::fgDebugFlag = kTRUE; Bool_t AliTRDrawStream::fgEnableMemoryReset = kTRUE; @@ -119,7 +118,6 @@ Bool_t AliTRDrawStream::fgStackLinkNumberChecker = kFALSE; Bool_t AliTRDrawStream::fgSkipData = kTRUE; Bool_t AliTRDrawStream::fgEnableDecodeConfigData = kFALSE; Int_t AliTRDrawStream::fgDumpHead = -1; -Int_t AliTRDrawStream::fgCommonAdditive = 0; Int_t AliTRDrawStream::fgEmptySignals[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 @@ -175,6 +173,8 @@ AliTRDrawStream::AliTRDrawStream() , fGeometry(0) , fRawReader(0) , fTRDfeeParam(0) + , fCommonAdditive(0) + , fWarnError(kTRUE) { // // default constructor @@ -216,6 +216,8 @@ AliTRDrawStream::AliTRDrawStream(AliRawReader *rawReader) , fGeometry(0) , fRawReader(rawReader) , fTRDfeeParam(0) + , fCommonAdditive(0) + , fWarnError(kTRUE) { // // default constructor @@ -263,6 +265,8 @@ AliTRDrawStream::AliTRDrawStream(const AliTRDrawStream& /*st*/) , fGeometry(0) , fRawReader(0) , fTRDfeeParam(0) + , fCommonAdditive(0) + , fWarnError(kTRUE) { // // Copy constructor @@ -358,7 +362,7 @@ Bool_t AliTRDrawStream::SkipWords(UInt_t iw) return kTRUE; } else { - if (fgWarnError) AliWarning(Form("Skip %d words failed. %d available", iw, fpEnd - fpPos - 1)); + if (fWarnError) AliWarning(Form("Skip %d words failed. %d available", iw, fpEnd - fpPos - 1)); return kFALSE; } @@ -545,7 +549,6 @@ void AliTRDrawStream::ResetPerMCM() fMCM->fADCMaskWord = 0; fMCM->fADCmax = 0; fMCM->fADCcount = 0; - fMCM->fMCMADCWords = 0; fMCM->fSingleADCwords = 0; fMCM->fMCMhdCorrupted = 0; fMCM->fADCmaskCorrupted = 0; @@ -671,7 +674,7 @@ Bool_t AliTRDrawStream::Next() } //------------------------------------------------------------ -Int_t AliTRDrawStream::NextChamber(AliTRDdigitsManager *const digitsManager, UInt_t **trackletContainer, UShort_t **errorCodeContainer) +Int_t AliTRDrawStream::NextChamber(AliTRDdigitsManager *const digitsManager, UInt_t **trackletContainer, UShort_t **/*errorCodeContainer*/) { // // Fills single chamber digit array @@ -757,15 +760,18 @@ Int_t AliTRDrawStream::NextChamber(AliTRDdigitsManager *const digitsManager, UIn return -1; } - Int_t rowMax = GetRowMax(); + //Int_t rowMax = GetRowMax(); + Int_t rowMax = fGeometry->RowmaxC1(); // we use maximum row number among all detectors to reuse memory Int_t colMax = GetColMax(); Int_t ntbins = GetNumberOfTimeBins(); - // Set number of timebin into digitparam + // Set digitparam variables + digitsparam = (AliTRDdigitsParam *) digitsManager->GetDigitsParam(); + digitsparam->SetPretiggerPhase(det,GetPreTriggerPhase()); if (!fIsGlobalDigitsParamSet){ - digitsparam = (AliTRDdigitsParam *) digitsManager->GetDigitsParam(); - digitsparam->SetCheckOCDB(kFALSE); digitsparam->SetNTimeBins(ntbins); + fCommonAdditive=10; + digitsparam->SetADCbaseline(fCommonAdditive); fIsGlobalDigitsParamSet = kTRUE; } @@ -790,19 +796,12 @@ Int_t AliTRDrawStream::NextChamber(AliTRDdigitsManager *const digitsManager, UIn // ntimebins data are ready to read for (it = 0; it < GetNumberOfTimeBins(); it++) { - if (GetSignals()[it] > 0) { - - if (fSharedPadsOn) - digits->SetDataByAdcCol(GetRow(), GetExtendedCol(), it, GetSignals()[it]); - else - digits->SetData(GetRow(), GetCol(), it, GetSignals()[it]); - - indexes->AddIndexRC(GetRow(), GetCol()); - if (digitsManager->UsesDictionaries()) { - track0->SetData(GetRow(), GetCol(), it, 0); - track1->SetData(GetRow(), GetCol(), it, 0); - track2->SetData(GetRow(), GetCol(), it, 0); - } + digits->SetDataByAdcCol(GetRow(), GetExtendedCol(), it, GetSignals()[it]); + if (!(GetCol()<0)) indexes->AddIndexRC(GetRow(), GetCol()); + if (digitsManager->UsesDictionaries()) { + track0->SetData(GetRow(), GetCol(), it, 0); + track1->SetData(GetRow(), GetCol(), it, 0); + track2->SetData(GetRow(), GetCol(), it, 0); } } // it } // while Next() @@ -928,7 +927,7 @@ Bool_t AliTRDrawStream::DecodeGTUheader() } } else { - if (fgWarnError) AliWarning("No additional sm headers and stack index words present."); + if (fWarnError) AliWarning("No additional sm headers and stack index words present."); if (fRawReader) fRawReader->AddMajorErrorLog(kDecodeStackInfo, "Stack info missing"); return kFALSE; } @@ -937,7 +936,7 @@ Bool_t AliTRDrawStream::DecodeGTUheader() if (fgDebugFlag) AliDebug(5, "GTU headers are OK."); } else { - if (fgWarnError) AliWarning("No data just after GTU headers."); + if (fWarnError) AliWarning("No data just after GTU headers."); if (fRawReader) fRawReader->AddMajorErrorLog(kMissingData, "Missing sm data"); return kFALSE; } @@ -957,7 +956,7 @@ Bool_t AliTRDrawStream::DecodeSM(void * const buffer, UInt_t length) fSM.fClean = kTRUE; if (InitBuffer(buffer, length) == kFALSE) { - if (fgWarnError) AliError("InitBuffer failed."); + if (fWarnError) AliError("InitBuffer failed."); fSM.fClean = kFALSE; return kFALSE; } @@ -988,7 +987,7 @@ Bool_t AliTRDrawStream::DecodeSM(void * const buffer, UInt_t length) if (fpPos >= fpEnd) { if (fRawReader) fRawReader->AddMajorErrorLog(kLinkDataMissing, "Link data missing"); - if (fgWarnError) AliError("Link data missing."); + if (fWarnError) AliError("Link data missing."); fSM.fClean = kFALSE; break; } @@ -1001,7 +1000,7 @@ Bool_t AliTRDrawStream::DecodeSM(void * const buffer, UInt_t length) fSM.fClean = kFALSE; SeekEndOfData(); - if (fgWarnError) { + if (fWarnError) { AliError(Form("Tracklet decoding failed stack %d link %d", fStackNumber, fStackLinkNumber)); } continue; @@ -1010,7 +1009,7 @@ Bool_t AliTRDrawStream::DecodeSM(void * const buffer, UInt_t length) if (fpPos >= fpEnd) { if (fRawReader) fRawReader->AddMajorErrorLog(kHCdataMissing, "HC data missing"); - if (fgWarnError) AliError("HC data missing."); + if (fWarnError) AliError("HC data missing."); fSM.fClean = kFALSE; break; } @@ -1022,7 +1021,7 @@ Bool_t AliTRDrawStream::DecodeSM(void * const buffer, UInt_t length) if (fHC->fCorrupted < 16) SeekEndOfData(); // In case that we meet END_OF_TRACKLET_MARKERNEW // during ADC data decoding or MCM header decoding // we don't seek ENDOFRAWDATAMARKER - if (fgWarnError) { + if (fWarnError) { AliError(Form("Failed HC : %s", DumpHCinfoH0(fHC))); AliError(Form("Failed HC : %s", DumpHCinfoH1(fHC))); } @@ -1041,7 +1040,7 @@ Bool_t AliTRDrawStream::DecodeSM(void * const buffer, UInt_t length) return kTRUE; if (fgCleanDataOnly && (fSM.fClean == kFALSE)) { - if (fgWarnError) { + if (fWarnError) { AliWarning("Buffer with errors. Returning FALSE."); AliWarning(Form("--- Failed SM : %s ---", DumpSMInfo(&fSM))); } @@ -1310,11 +1309,13 @@ Bool_t AliTRDrawStream::IsMCMheaderOK() if (fgDebugFlag) AliDebug(11,Form("Event from the past? Current %d Last %d %s.\n", fEventCounter, fLastEventCounter, DumpMCMinfo(fMCM))); } - if ( fMCM->fADCmaskCorrupted > 0 ) + if ( fMCM->fADCmaskCorrupted > 0 ) { return kFALSE; + } - if ( fMCM->fMCMhdCorrupted > 0 ) + if ( fMCM->fMCMhdCorrupted > 0 ) { return kFALSE; + } return kTRUE; } @@ -1345,7 +1346,6 @@ Bool_t AliTRDrawStream::DecodeMCMheader() fpPos--; return kFALSE; } - fMCM->fROW = fTRDfeeParam->GetPadRowFromMCM(fMCM->fROB, fMCM->fMCM); if ((fHC->fRawVMajor > 2 && fHC->fRawVMajor <5) || ((fHC->fRawVMajor & 32) == 32)) { //cover old and new version definition of ZS data @@ -1378,9 +1378,10 @@ Bool_t AliTRDrawStream::DecodeMCMheader() AliDebug(7, DumpMCMadcMask(fMCM)); } - if (IsMCMheaderOK() == kFALSE) + if (IsMCMheaderOK() == kFALSE) { return kFALSE; - + } + return kTRUE; } @@ -1502,8 +1503,9 @@ Bool_t AliTRDrawStream::DecodeHC() // // decode hc header and data // + if (DecodeHCheader() == kFALSE) { - if (fgWarnError) AliWarning(Form("HC Header decode failed. H0 Error: %d H1 Error: %d",fHC->fH0Corrupted,fHC->fH1Corrupted)); + if (fWarnError) AliWarning(Form("HC Header decode failed. H0 Error: %d H1 Error: %d",fHC->fH0Corrupted,fHC->fH1Corrupted)); if (fRawReader) fRawReader->AddMajorErrorLog(kHCHeaderCorrupt, "HC header corrupted"); return kFALSE; } @@ -1520,7 +1522,7 @@ Bool_t AliTRDrawStream::DecodeHC() if ((fHC->fRawVMajor & 64) == 64) { // test pattern data AliTRDrawTPStream *tpStream = new AliTRDrawTPStream(fHC->fRawVMajorOpt, fpPos); if (tpStream->DecodeTPdata() == kFALSE) { - if (fgWarnError) AliError("failed to decode test pattern data"); + if (fWarnError) AliError("failed to decode test pattern data"); return kFALSE; } return kTRUE; @@ -1541,7 +1543,7 @@ Bool_t AliTRDrawStream::DecodeHC() if (fHC->fCorrupted < 4) fHC->fCorrupted += 4; // benchmark hc data corruption as 4 if (fgSkipData == kTRUE || fHC->fCorrupted >= 16) { // stop HC data reading - fHC->fMCMmax++; + fHC->fMCMmax++; return kFALSE; } @@ -1617,11 +1619,11 @@ Bool_t AliTRDrawStream::DecodeHC() } } else { // nsamples = 31, 32 are not implemented in the TRAP and should never happen - if (fgWarnError) AliError("nsamples are 31 or 32. These are not implemented in the TRAP and should never happen!"); + if (fWarnError) AliError("nsamples are 31 or 32. These are not implemented in the TRAP and should never happen!"); } } // if fHC->fRawVMajor else { // test pattern data - if (fgWarnError) AliError("These are test pattern data. You need other reader"); // will be served in other class + if (fWarnError) AliError("These are test pattern data. You need other reader"); // will be served in other class } } // for iadc } // if fMCM->fADCmax @@ -1644,6 +1646,7 @@ Bool_t AliTRDrawStream::DecodeADC() // // decode single ADC channel // + fADC->fCorrupted = 0; if(fADC->fADCnumber%2==1) fMaskADCword = ADC_WORD_MASK(ADCDATA_VAL1); if(fADC->fADCnumber%2==0) fMaskADCword = ADC_WORD_MASK(ADCDATA_VAL2); @@ -1657,7 +1660,7 @@ Bool_t AliTRDrawStream::DecodeADC() for (Int_t iw = 0; iw < fMCM->fSingleADCwords; iw++) { if (HC_HEADER_MASK_ERR(*fpPos) == 0 || *fpPos == END_OF_TRACKLET_MARKERNEW) { - if (fgWarnError) AliError(Form("There should be ADC data. We meet HC header or END_OF_TRACKLET_MARKER 0x%08x",*fpPos)); + if (fWarnError) AliError(Form("There should be ADC data. We meet HC header or END_OF_TRACKLET_MARKER 0x%08x",*fpPos)); fADC->fCorrupted += 16; fHC->fCorrupted += 16; fpPos--; @@ -1671,10 +1674,9 @@ Bool_t AliTRDrawStream::DecodeADC() continue; } - // here we subtract the baseline ( == common additive) - fADC->fSignals[fTbinADC + 0] = ((*fpPos & 0x00000ffc) >> 2) - fgCommonAdditive; - fADC->fSignals[fTbinADC + 1] = ((*fpPos & 0x003ff000) >> 12) - fgCommonAdditive; - fADC->fSignals[fTbinADC + 2] = ((*fpPos & 0xffc00000) >> 22) - fgCommonAdditive; + fADC->fSignals[fTbinADC + 0] = ((*fpPos & 0x00000ffc) >> 2); + fADC->fSignals[fTbinADC + 1] = ((*fpPos & 0x003ff000) >> 12); + fADC->fSignals[fTbinADC + 2] = ((*fpPos & 0xffc00000) >> 22); fTbinADC += 3; fpPos++; @@ -1719,6 +1721,7 @@ Bool_t AliTRDrawStream::DecodeADCExtended() // // decode single ADC channel // + fADC->fCorrupted = 0; if(fADC->fADCnumber%2==1) fMaskADCword = ADC_WORD_MASK(ADCDATA_VAL1); if(fADC->fADCnumber%2==0) fMaskADCword = ADC_WORD_MASK(ADCDATA_VAL2); @@ -1727,13 +1730,13 @@ Bool_t AliTRDrawStream::DecodeADCExtended() fTbinADC = ((*fpPos & 0x000000fc) >> 2); fMCM->fSingleADCwords = ((*fpPos & 0x00000f00) >> 8); - fADC->fSignals[fTbinADC] = ((*fpPos & 0x003ff000) >> 12) - fgCommonAdditive; - fADC->fSignals[fTbinADC+1] = ((*fpPos & 0xffc00000) >> 22) - fgCommonAdditive; + fADC->fSignals[fTbinADC] = ((*fpPos & 0x003ff000) >> 12); + fADC->fSignals[fTbinADC+1] = ((*fpPos & 0xffc00000) >> 22); fpPos++; for (Int_t iw = 0; iw < fMCM->fSingleADCwords-1; iw++) { // it goes up to fMCM->fSingleADCwords-1 since the first word was already decoded above if (HC_HEADER_MASK_ERR(*fpPos) == 0 || *fpPos == END_OF_TRACKLET_MARKERNEW) { - if (fgWarnError) AliError(Form("There should be ADC data. We meet HC header or END_OF_TRACKLET_MARKER 0x%08x",*fpPos)); + if (fWarnError) AliError(Form("There should be ADC data. We meet HC header or END_OF_TRACKLET_MARKER 0x%08x",*fpPos)); fADC->fCorrupted += 16; fHC->fCorrupted += 16; fpPos--; @@ -1747,10 +1750,9 @@ Bool_t AliTRDrawStream::DecodeADCExtended() continue; } - // here we subtract the baseline ( == common additive) - fADC->fSignals[fTbinADC + 2] = ((*fpPos & 0x00000ffc) >> 2) - fgCommonAdditive; - fADC->fSignals[fTbinADC + 3] = ((*fpPos & 0x003ff000) >> 12) - fgCommonAdditive; - fADC->fSignals[fTbinADC + 4] = ((*fpPos & 0xffc00000) >> 22) - fgCommonAdditive; + fADC->fSignals[fTbinADC + 2] = ((*fpPos & 0x00000ffc) >> 2); + fADC->fSignals[fTbinADC + 3] = ((*fpPos & 0x003ff000) >> 12); + fADC->fSignals[fTbinADC + 4] = ((*fpPos & 0xffc00000) >> 22); fTbinADC += 3; fpPos++; @@ -1977,7 +1979,7 @@ void AliTRDrawStream::DecodeMCMheader(const UInt_t *word, struct AliTRDrawMCM *m UInt_t vword = *word; if (vword == END_OF_TRACKLET_MARKERNEW) { - if (fgWarnError) AliError(Form("There should be MCM header. We meet END_OF_TRACKLET_MARKER 0x%08x",vword)); + if (fWarnError) AliError(Form("There should be MCM header. We meet END_OF_TRACKLET_MARKER 0x%08x",vword)); mcm->fMCMhdCorrupted += 16; fHC->fCorrupted += 16; //to finish data reading of this HC } @@ -2005,7 +2007,7 @@ UInt_t AliTRDrawStream::GetMCMadcMask(const UInt_t *word, struct AliTRDrawMCM *m mcm->fADCMaskWord = vword; if (vword == END_OF_TRACKLET_MARKERNEW) { - if (fgWarnError) AliError(Form("There should be MCMadcMask. We meet END_OF_TRACKLET_MARKER 0x%08x",vword)); + if (fWarnError) AliError(Form("There should be MCMadcMask. We meet END_OF_TRACKLET_MARKER 0x%08x",vword)); mcm->fADCmaskCorrupted += 16; fHC->fCorrupted += 16; //to finish data reading of this HC } @@ -2029,7 +2031,6 @@ void AliTRDrawStream::DecodeMask(const UInt_t *word, struct AliTRDrawMCM *mcm) c // // decode the adc mask - adcs to be read out // - mcm->fMCMADCWords = 0; mcm->fSingleADCwords = 0; mcm->fADCmax = 0; mcm->fADCMask = GetMCMadcMask(word, mcm); @@ -2055,11 +2056,8 @@ void AliTRDrawStream::MCMADCwordsWithTbins(UInt_t fTbins, struct AliTRDrawMCM *m // // count the expected mcm words for a given tbins // - mcm->fMCMADCWords = ( mcm->fADCmax ) * ( fTbins / 3 ); mcm->fSingleADCwords = 0; - if (mcm->fADCmax > 0) { - mcm->fSingleADCwords = mcm->fMCMADCWords/mcm->fADCmax; - } + mcm->fSingleADCwords = (fTbins-1)/3+1; if (fTbins > 32) mcm->fSingleADCwords = 10; // if the timebin is more than 30, then fix the number of adc words to 10 }