X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=FMD%2FAliFMDRawStream.cxx;h=34337e67d9956892c6fb5d489024e340e0c833d8;hb=d97f1dbeec08289789d6b55b4c984c22d3f46b6b;hp=8fc23a9f0048921022141f0aa5811d47ef3ab05c;hpb=02a27b508bdd34a6febe776298cc20b18fdbb2ed;p=u%2Fmrichter%2FAliRoot.git diff --git a/FMD/AliFMDRawStream.cxx b/FMD/AliFMDRawStream.cxx index 8fc23a9f004..34337e67d99 100644 --- a/FMD/AliFMDRawStream.cxx +++ b/FMD/AliFMDRawStream.cxx @@ -28,9 +28,12 @@ #include "AliFMDRawStream.h" // ALIFMDRAWSTREAM_H // #include // ALIRAWREADER_H #include "AliFMDParameters.h" -#include +// #include +#include "AliFMDDebug.h" // Better debug macros // #include // #include +#include "AliRawReader.h" +#include //____________________________________________________________________ ClassImp(AliFMDRawStream) @@ -43,15 +46,15 @@ AliFMDRawStream::AliFMDRawStream(AliRawReader* reader) : AliAltroRawStream(reader) { // CTOR - fNoAltroMapping = kFALSE; + reader->Reset(); // Select FMD DDL's - SelectRawData(AliFMDParameters::kBaseDDL>>8); + SelectRawData("FMD"); } //_____________________________________________________________________________ Bool_t AliFMDRawStream::ReadChannel(UInt_t& ddl, UInt_t& addr, - UInt_t& len, UShort_t* data) + UInt_t& len, volatile UShort_t* data) { // Read one channel and return. Returns 0 when there's no more // data. @@ -61,24 +64,54 @@ AliFMDRawStream::ReadChannel(UInt_t& ddl, UInt_t& addr, do { Int_t signal = last; if (last > 0x3FF) { - AliDebug(30, Form("Last is 0x%x, so reading a new word", last)); + AliFMDDebug(30, ("Last is 0x%x, so reading a new word", last)); next = Next(); - if (!next) break; + if(!next){ + AliFMDDebug(15, ("Read word # %d (!next)", l)); + addr = GetPrevHWAddress(); + ddl = (GetPrevDDLNumber() < 0 ? UINT_MAX: GetPrevDDLNumber()); + len = l+1; // Need to add one - l points to last valid index + last = signal; + break; + } signal = GetSignal(); if (GetHWAddress() != GetPrevHWAddress() && GetPrevHWAddress() >= 0) { - AliDebug(15, Form("New hardware address, was 0x%x, now 0x%x", + AliFMDDebug(15, ("New hardware address, was 0x%x, now 0x%x", GetPrevHWAddress(), GetHWAddress())); addr = GetPrevHWAddress(); - ddl = AliFMDParameters::kBaseDDL + GetPrevDDLNumber(); + ddl = (GetPrevDDLNumber() < 0 ? UINT_MAX : GetPrevDDLNumber()); len = l+1; // Need to add one - l points to last valid index last = signal; break; } } + // Sanity check - if the total bunch length is less than 1, then + // read until we get the next bunch. + Int_t b = GetTimeLength(); + if (b < 1) { + AliWarning(Form("Bunch length %0d is less than 0 for " + "DDL %4d address 0x%03x", + b, ddl, addr)); + last = 0xFFFF; + continue; + } + + // Sanity check - if the current time is less than 0, then read + // until we get a new bunch. Int_t t = GetTime(); + if (t < 0) { + AliWarning(Form("Time %0d is less than 0 for DDL %4d address 0x%03x", + t, ddl, addr)); + last = 0xFFFF; + continue; + } l = TMath::Max(l, t); data[t] = signal; last = 0xFFFF; +#if 0 + AliFMDDebug(signal > 512 ? 1 : 0, ("Signal @ %d (%d) is %d", + time, t, data[t])); +#endif } while (next); return next; }