+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
+
+////////////////////////////////////////////////////////////////////////////
+// //
+// Decoding data from the TRD raw stream //
+// and translation into ADC values //
+// //
+// Author: J. Klein (jochen.klein@cern.ch) //
+// //
+////////////////////////////////////////////////////////////////////////////
+
+#include <cstdio>
+#include <cstdarg>
+
#include "TClonesArray.h"
#include "TTree.h"
#include "AliTRDarrayDictionary.h"
#include "AliTRDSignalIndex.h"
#include "AliTRDtrackletWord.h"
+#include "AliESDTrdTrack.h"
+#include "AliTreeLoader.h"
#include "AliTRDrawStream.h"
// some static information
const Int_t AliTRDrawStream::fgkMcmOrder[] = {12, 13, 14, 15,
- 8, 9, 10, 11,
- 4, 5, 6, 7,
- 0, 1, 2, 3};
+ 8, 9, 10, 11,
+ 4, 5, 6, 7,
+ 0, 1, 2, 3};
const Int_t AliTRDrawStream::fgkRobOrder [] = {0, 1, 2, 3};
const Int_t AliTRDrawStream::fgkNlinks = 12;
const Int_t AliTRDrawStream::fgkNstacks = 5;
const UInt_t AliTRDrawStream::fgkDataEndmarker = 0x00000000;
const UInt_t AliTRDrawStream::fgkTrackletEndmarker = 0x10001000;
-char* AliTRDrawStream::fgErrorMessages[] = {
+const char* AliTRDrawStream::fgkErrorMessages[] = {
"Unknown error",
"Link monitor active",
"Pretrigger counter mismatch",
"Missing MCM headers"
};
+Int_t AliTRDrawStream::fgErrorDebugLevel[] = {
+ 0,
+ 0,
+ 2,
+ 1,
+ 0,
+ 1,
+ 1,
+ 1,
+ 1,
+ 2,
+ 1,
+ 1,
+ 1,
+ 1,
+ 2,
+ 1,
+ 1,
+ 1
+};
+
+AliTRDrawStream::ErrorBehav_t AliTRDrawStream::fgErrorBehav[] = {
+ AliTRDrawStream::kTolerate,
+ AliTRDrawStream::kDiscardHC,
+ AliTRDrawStream::kTolerate,
+ AliTRDrawStream::kAbort,
+ AliTRDrawStream::kAbort,
+ AliTRDrawStream::kAbort,
+ AliTRDrawStream::kAbort,
+ AliTRDrawStream::kDiscardHC,
+ AliTRDrawStream::kDiscardHC,
+ AliTRDrawStream::kTolerate,
+ AliTRDrawStream::kTolerate,
+ AliTRDrawStream::kTolerate,
+ AliTRDrawStream::kTolerate,
+ AliTRDrawStream::kTolerate,
+ AliTRDrawStream::kTolerate,
+ AliTRDrawStream::kTolerate,
+ AliTRDrawStream::kTolerate,
+ AliTRDrawStream::kTolerate
+};
+
AliTRDrawStream::AliTRDrawStream(AliRawReader *rawReader) :
+ fStats(),
+ fStoreError(&AliTRDrawStream::StoreErrorTree),
fRawReader(rawReader),
fDigitsManager(0x0),
fDigitsParam(0x0),
fErrors(0x0),
fLastError(),
+ fErrorFlags(0),
fPayloadStart(0x0),
fPayloadCurr(0x0),
fPayloadSize(0),
fCurrBC(-1),
fCurrPtrgCnt(-1),
fCurrPtrgPhase(-1),
+ fNDumpMCMs(0),
fTrackletArray(0x0),
fAdcArray(0x0),
fSignalIndex(0x0),
- fTrackletTree(0x0)
+ fTrackletTree(0x0),
+ fTracklets(0x0),
+ fTracks(0x0),
+ fMarkers(0x0)
{
// default constructor
fCurrLinkMonitorFlags = new UInt_t[fgkNstacks * fgkNlinks];
fCurrLinkDataTypeFlags = new UInt_t[fgkNstacks * fgkNlinks];
fCurrLinkDebugFlags = new UInt_t[fgkNstacks * fgkNlinks];
+ for (Int_t i = 0; i < 100; i++)
+ fDumpMCM[i] = 0;
// preparing TClonesArray
fTrackletArray = new TClonesArray("AliTRDtrackletWord", 256);
// setting up the error tree
fErrors = new TTree("errorStats", "Error statistics");
fErrors->SetDirectory(0x0);
- fErrors->Branch("error", &fLastError, "sector/I:stack:link:error:rob:mcm");
+ fErrors->Branch("error", &fLastError);
fErrors->SetCircular(1000);
+ for (Int_t i = 0; i < 100; i++) {
+ fErrorBuffer[i] = 0;
+ }
+
}
AliTRDrawStream::~AliTRDrawStream()
}
// tracklet output
- fTrackletTree = trackletTree;
- if (fTrackletTree) {
- if (!fTrackletTree->GetBranch("trkl")) {
- fTrackletTree->Branch("hc", &fCurrHC, "hc/I");
- fTrackletTree->Branch("trkl", &fTrackletArray);
- }
- else {
- fTrackletTree->SetBranchAddress("hc", &fCurrHC);
- fTrackletTree->SetBranchAddress("trkl", &fTrackletArray);
- }
- }
+ ConnectTracklets(trackletTree);
// some preparations
fDigitsParam = 0x0;
AliDebug(2, Form("equipment: %i", fCurrEquipmentId));
if (fCurrEquipmentId < 1024 || fCurrEquipmentId > 1041) {
- AliError(EquipmentError(kNonTrdEq, "Skipping"));
+ EquipmentError(kNonTrdEq, "Skipping");
continue;
}
// setting the pointer to data and current reading position
fPayloadCurr = fPayloadStart = (UInt_t*) (buffer);
fPayloadSize = fRawReader->GetDataSize() / sizeof(UInt_t);
+ fStats.fStatsSector[fCurrEquipmentId - 1024].fBytes = fRawReader->GetDataSize();
AliDebug(2, Form("Read buffer of size: %i", fRawReader->GetDataSize()));
// read SMU index header
// read stack index header
for (Int_t iStack = 0; iStack < 5; iStack++) {
- if (fCurrStackMask & (1 << iStack) != 0)
+ if ((fCurrStackMask & (1 << iStack)) != 0)
ReadStackIndexHeader(iStack);
}
for (Int_t iStack = 0; iStack < 5; iStack++) {
fCurrSlot = iStack;
- if (fCurrStackMask & (1 << fCurrSlot) == 0)
+ if ((fCurrStackMask & (1 << fCurrSlot)) == 0)
continue;
AliDebug(2, Form("Stack %i, Link mask: 0x%02x", fCurrSlot, fCurrLinkMask[fCurrSlot]));
for (Int_t iLink = 0; iLink < 12; iLink++) {
fCurrLink = iLink;
- fCurrHC = fCurrSm * 60 + fCurrSlot * 12 + iLink;
+ fCurrHC = (fCurrEquipmentId - 1024) * 60 + fCurrSlot * 12 + iLink;
if ((fCurrLinkMask[fCurrSlot] & (1 << fCurrLink)) == 0)
continue;
+ fErrorFlags = 0;
+ // check for link monitor error flag
if (fCurrLinkMonitorFlags[fCurrSlot*fgkNlinks + fCurrLink] != 0)
LinkError(kLinkMonitor);
- AliDebug(2, Form("Payload for S%il%i", fCurrSlot, fCurrLink));
- for (Int_t i = 0; i < 10; i++) //???
- AliDebug(5, Form("%3i: 0x%08x 0x%08x 0x%08x 0x%08x", i*4,
- fPayloadCurr[4*i], fPayloadCurr[4*i+1],
- fPayloadCurr[4*i+2], fPayloadCurr[4*i+3]));
// read the data from one HC
ReadLinkData();
// read all data endmarkers
- while (fPayloadCurr - fPayloadStart < fPayloadSize &&
- *fPayloadCurr == fgkDataEndmarker)
- fPayloadCurr++;
-
+ SeekNextLink();
}
}
}
Bool_t AliTRDrawStream::NextDDL()
{
+ // continue reading with the next equipment
+
if (!fRawReader)
return kFALSE;
AliDebug(2, Form("equipment: %i", fCurrEquipmentId));
if (fCurrEquipmentId < 1024 || fCurrEquipmentId > 1041) {
- AliError(EquipmentError(kNonTrdEq, "Skipping"));
+ EquipmentError(kNonTrdEq, "Skipping");
continue;
}
// read stack index header
for (Int_t iStack = 0; iStack < 5; iStack++) {
- if (fCurrStackMask & (1 << iStack) != 0) {
+ if ((fCurrStackMask & (1 << iStack)) != 0) {
ReadStackIndexHeader(iStack);
}
}
Int_t AliTRDrawStream::NextChamber(AliTRDdigitsManager *digMgr, UInt_t ** /* trackletContainer */, UShort_t ** /* errorContainer */)
{
+ // read the data for the next chamber
+ // in case you only want to read the data of a single chamber
+ // to read all data ReadEvent(...) is recommended
+
fDigitsManager = digMgr;
fDigitsParam = 0x0;
+ fErrorFlags = 0;
+
// tracklet output preparation
- fTrackletTree = 0x0;
- //AliDataLoader *trklLoader = AliRunLoader::Instance()->GetLoader("TRDLoader")->GetDataLoader("tracklets");
- //if (trklLoader)
- // fTrackletTree = trklLoader->Tree();
+ TTree *trklTree = 0x0;
+ AliRunLoader *rl = AliRunLoader::Instance();
+ AliLoader* trdLoader = rl ? rl->GetLoader("TRDLoader") : NULL;
+ AliDataLoader *trklLoader = trdLoader ? trdLoader->GetDataLoader("tracklets") : NULL;
+ if (trklLoader) {
+ AliTreeLoader *trklTreeLoader = (AliTreeLoader*) trklLoader->GetBaseLoader("tracklets-raw");
+ if (trklTreeLoader)
+ trklTree = trklTreeLoader->Tree();
+ else
+ trklTree = trklLoader->Tree();
+ }
+
+ if (fTrackletTree != trklTree)
+ ConnectTracklets(trklTree);
if (!fRawReader) {
AliError("No raw reader available");
return -1;
}
- if (fCurrSlot < 0 || fCurrSlot >= 5) {
+ while (fCurrSlot < 0 || fCurrSlot >= 5) {
if (!NextDDL()) {
fCurrSlot = -1;
return -1;
}
+ while ((fCurrSlot < 5) &&
+ (((fCurrStackMask & (1 << fCurrSlot)) == 0) ||
+ ((fCurrLinkMask[fCurrSlot] & (1 << fCurrLink))) == 0)) {
+ fCurrLink++;
+ if (fCurrLink > 11) {
+ fCurrLink = 0;
+ fCurrSlot++;
+ }
+ }
}
AliDebug(2, Form("Stack %i, Link %i, mask: 0x%02x", fCurrSlot, fCurrLink, fCurrLinkMask[fCurrSlot]));
ReadLinkData();
// read all data endmarkers
- while (fPayloadCurr - fPayloadStart < fPayloadSize &&
- *fPayloadCurr == fgkDataEndmarker)
- fPayloadCurr++;
+ SeekNextLink();
if (fCurrLink % 2 == 0) {
// if we just read the A-side HC then also check the B-side
fCurrLink++;
+ fCurrHC++;
if (fCurrLinkMask[fCurrSlot] & (1 << fCurrLink)) {
ReadLinkData();
- while (fPayloadCurr - fPayloadStart < fPayloadSize &&
- *fPayloadCurr == fgkDataEndmarker)
- fPayloadCurr++;
+ SeekNextLink();
}
}
fCurrSlot++;
}
} while ((fCurrSlot < 5) &&
- ((fCurrStackMask & (1 << fCurrSlot) == 0) ||
- (fCurrLinkMask[fCurrSlot] & (1 << fCurrLink)) == 0));
-
- return fCurrHC / 2;
+ (((fCurrStackMask & (1 << fCurrSlot)) == 0) ||
+ ((fCurrLinkMask[fCurrSlot] & (1 << fCurrLink))) == 0));
+
+ // return chamber information from HC if it is valid
+ // otherwise return information from link position
+ if (fCurrSm < 0 || fCurrSm > 17 || fCurrStack < 0 || fCurrStack > 4 || fCurrLayer < 0 || fCurrLayer > 5)
+ return ((fCurrEquipmentId-1024) + fCurrSlot * 6 + fCurrLink/2);
+ else
+ return (fCurrSm * 30 + fCurrStack * 6 + fCurrLayer);
}
// and store the information in the corresponding variables
if (fPayloadCurr - fPayloadStart >= fPayloadSize - 1) {
- AliError(EquipmentError(kUnknown, "SM Header aborted"));
+ EquipmentError(kUnknown, "SM Header incomplete");
return -1;
}
fCurrSmuIndexHeaderSize = ((*fPayloadCurr) >> 16) & 0xffff;
fCurrSmuIndexHeaderVersion = ((*fPayloadCurr) >> 12) & 0xf;
+ // fCurrSmuIndexHeaderTrgAvail = ((*fPayloadCurr) >> 9) & 0x1;
+ // fCurrSmuIndexHeaderEvType = ((*fPayloadCurr) >> 7) & 0x3;
fCurrTrackEnable = ((*fPayloadCurr) >> 6) & 0x1;
fCurrTrackletEnable = ((*fPayloadCurr) >> 5) & 0x1;
fCurrStackMask = ((*fPayloadCurr) ) & 0x1f;
fCurrTrackEnable,
fCurrTrackletEnable,
fCurrStackMask));
-
+
+ // decode GTU track words
+ UInt_t trackWord[2] = { 0, 0 };
+ Int_t stack = 0;
+ Int_t idx = 0;
+ for (UInt_t iWord = 4; iWord < fCurrSmuIndexHeaderSize; iWord++) {
+ if (fPayloadCurr[iWord] == 0x10000000) {
+ stack++;
+ idx = 0;
+ }
+ else {
+ if ((idx == 0) &&
+ ((fPayloadCurr[iWord] & 0xfffff0f0) == 0x13370000)) {
+ AliDebug(1,Form("stack %i: fast trigger word: 0x%08x", stack, fPayloadCurr[iWord]));
+ continue;
+ }
+ else if ((idx & 0x1)==0x1) {
+ trackWord[idx&0x1] = fPayloadCurr[iWord];
+ AliDebug(1,Form("track debug word: 0x%08x%08x", trackWord[1], trackWord[0]));
+// if (fTracks)
+// new ((*fTracks)[fTracks->GetEntriesFast()]) AliESDTrdTrack(0, 0, trackWord[0], trackWord[1], fCurrEquipmentId-1024);
+ }
+ else {
+ trackWord[idx&0x1] = fPayloadCurr[iWord];
+ }
+ idx++;
+ }
+ }
+
fPayloadCurr += fCurrSmuIndexHeaderSize + 1;
return fCurrSmuIndexHeaderSize + 1;
fCurrStackHeaderVersion[stack] = ((*fPayloadCurr) >> 12) & 0xf;
fCurrLinkMask[stack] = (*fPayloadCurr) & 0xfff;
- if (fPayloadCurr - fPayloadStart >= fPayloadSize - fCurrStackHeaderSize[stack]) {
- AliError(StackError(kStackHeaderInvalid, "Stack index header aborted"));
+ if (fPayloadCurr - fPayloadStart >= fPayloadSize - (Int_t) fCurrStackHeaderSize[stack]) {
+ StackError(kStackHeaderInvalid, "Stack index header aborted");
return -1;
}
switch (fCurrStackHeaderVersion[stack]) {
case 0xa:
if (fCurrStackHeaderSize[stack] < 8) {
- AliError(StackError(kStackHeaderInvalid, "Stack header smaller than expected!"));
+ StackError(kStackHeaderInvalid, "Stack header smaller than expected!");
return -1;
}
break;
default:
- AliError(StackError(kStackHeaderInvalid, Form("Invalid Stack Index Header version %x",
- fCurrStackHeaderVersion[stack])));
+ StackError(kStackHeaderInvalid, "Invalid Stack Index Header version %x", fCurrStackHeaderVersion[stack]);
}
fPayloadCurr += fCurrStackHeaderSize[stack];
Int_t AliTRDrawStream::ReadLinkData()
{
// read the data in one link (one HC) until the data endmarker is reached
+ // returns the number of words read!
Int_t count = 0;
+ UInt_t* startPosLink = fPayloadCurr;
+
+// printf("----- HC: %i -----\n", fCurrHC);
+// for (Int_t i = 0; i < 3; i++) {
+// printf("0x%08x 0x%08x 0x%08x 0x%08x\n",
+// fPayloadCurr[i*4+0], fPayloadCurr[i*4+1], fPayloadCurr[i*4+2], fPayloadCurr[i*4+3]);
+// }
+
+ if (fMarkers)
+ new ((*fMarkers)[fMarkers->GetEntriesFast()])
+ AliTRDrawStreamError(-kHCactive, fCurrSm, fCurrStack, fCurrLink);
+
+ if (fErrorFlags & kDiscardHC)
+ return count;
count += ReadTracklets();
+ if (fErrorFlags & kDiscardHC)
+ return count;
count += ReadHcHeader();
+ if (fErrorFlags & kDiscardHC)
+ return count;
Int_t det = fCurrSm * 30 + fCurrStack * 6 + fCurrLayer;
fAdcArray->Allocate(16, 144, fCurrNtimebins);
}
else {
- AliError(LinkError(kNoDigits));
+ LinkError(kNoDigits);
}
if (!fDigitsParam) {
// feeding TRAP config
AliTRDtrapConfig *trapcfg = AliTRDtrapConfig::Instance();
- // trapcfg->ReadPackedConfig(fCurrHC, startPos, fPayloadCurr - startPos);
+ trapcfg->ReadPackedConfig(fCurrHC, startPos, fPayloadCurr - startPos);
}
else {
Int_t tpmode = fCurrMajor & 0x7;
}
}
else {
- AliError(LinkError(kInvalidDetector, Form("%i", det)));
- UInt_t *startPos = fPayloadCurr;
+ LinkError(kInvalidDetector, "%i", det);
while (fPayloadCurr - fPayloadStart < fPayloadSize &&
*fPayloadCurr != fgkDataEndmarker)
fPayloadCurr++;
- count += fPayloadCurr - startPos;
}
-
+
+ if (fCurrSm > -1 && fCurrSm < 18) {
+ fStats.fStatsSector[fCurrSm].fStatsHC[fCurrHC%60].fBytes += (fPayloadCurr - startPosLink) * sizeof(UInt_t);
+ fStats.fStatsSector[fCurrSm].fStatsHC[fCurrHC%60].fBytesRead += count * sizeof(UInt_t);
+ fStats.fStatsSector[fCurrSm].fBytesRead += count * sizeof(UInt_t);
+ fStats.fBytesRead += count * sizeof(UInt_t);
+ }
+
return count;
}
while (*(fPayloadCurr) != fgkTrackletEndmarker &&
fPayloadCurr - fPayloadStart < fPayloadSize) {
- new ((*fTrackletArray)[fTrackletArray->GetEntriesFast()]) AliTRDtrackletWord(*(fPayloadCurr));
+ new ((*fTrackletArray)[fTrackletArray->GetEntriesFast()]) AliTRDtrackletWord(*(fPayloadCurr), fCurrHC);
fPayloadCurr++;
}
if (fTrackletArray->GetEntriesFast() > 0) {
AliDebug(1, Form("Found %i tracklets in %i %i %i (ev. %i)", fTrackletArray->GetEntriesFast(),
- fCurrSm, fCurrSlot, fCurrLink, fRawReader->GetEventIndex()));
+ (fCurrEquipmentId-1024), fCurrSlot, fCurrLink, fRawReader->GetEventIndex()));
+ if (fCurrSm > -1 && fCurrSm < 18) {
+ fStats.fStatsSector[fCurrSm].fStatsHC[fCurrHC%60].fNTracklets += fTrackletArray->GetEntriesFast();
+ fStats.fStatsSector[fCurrSm].fNTracklets += fTrackletArray->GetEntriesFast();
+ }
if (fTrackletTree)
fTrackletTree->Fill();
+ if (fTracklets)
+ for (Int_t iTracklet = 0; iTracklet < fTrackletArray->GetEntriesFast(); iTracklet++) {
+ new ((*fTracklets)[fTracklets->GetEntriesFast()]) AliTRDtrackletWord(*((AliTRDtrackletWord*)(*fTrackletArray)[iTracklet]));
+ }
}
// loop over remaining tracklet endmarkers
fPayloadCurr - fPayloadStart < fPayloadSize))
fPayloadCurr++;
- return (fPayloadCurr - start) / sizeof(UInt_t);
+ return fPayloadCurr - start;
}
Int_t AliTRDrawStream::ReadHcHeader()
fCurrSide = (*fPayloadCurr >> 2) & 0x1;
fCurrCheck = (*fPayloadCurr) & 0x3;
- if (fCurrSm != (fCurrEquipmentId - 1024) ||
+ if (fCurrSm != (((Int_t) fCurrEquipmentId) - 1024) ||
fCurrStack != fCurrSlot ||
fCurrLayer != fCurrLink / 2 ||
fCurrSide != fCurrLink % 2) {
- AliError(LinkError(kHCmismatch,
- Form("HC: %i, %i, %i, %i\n 0x%08x 0x%08x 0x%08x 0x%08x",
- fCurrSm, fCurrStack, fCurrLayer, fCurrSide,
- fPayloadCurr[0], fPayloadCurr[1], fPayloadCurr[2], fPayloadCurr[3]) ));
+ LinkError(kHCmismatch,
+ "HC: %i, %i, %i, %i\n 0x%08x 0x%08x 0x%08x 0x%08x",
+ fCurrSm, fCurrStack, fCurrLayer, fCurrSide,
+ fPayloadCurr[0], fPayloadCurr[1], fPayloadCurr[2], fPayloadCurr[3]);;
}
if (fCurrCheck != 0x1) {
- AliError(LinkError(kHCcheckFailed));
+ LinkError(kHCcheckFailed);
}
if (fCurrAddHcWords > 0) {
fPayloadCurr += 1 + fCurrAddHcWords;
- return (fPayloadCurr - start) / sizeof(UInt_t);
+ return (fPayloadCurr - start);
}
Int_t AliTRDrawStream::ReadTPData(Int_t mode)
lastrobpos = GetROBReadoutPos(ROB(*fPayloadCurr) / 2);
}
else {
- AliError(ROBError(kPosUnexp));
+ ROBError(kPosUnexp);
}
fCurrRobPos = ROB(*fPayloadCurr);
lastmcmpos = GetMCMReadoutPos(MCM(*fPayloadCurr));
}
else {
- AliError(MCMError(kPosUnexp));
+ MCMError(kPosUnexp);
}
fCurrMcmPos = MCM(*fPayloadCurr);
}
else {
expword = 0;
- AliError(LinkError(kTPmodeInvalid, "Just reading"));
+ LinkError(kTPmodeInvalid, "Just reading");
}
diff = *fPayloadCurr ^ expword;
if (diff != 0) {
- AliError(MCMError(kTPmismatch,
- Form("Seen 0x%08x, expected 0x%08x, diff: 0x%08x (0x%02x)",
- *fPayloadCurr, expword, diff, 0xff & (diff | diff >> 8 | diff >> 16 | diff >> 24)) ));
+ MCMError(kTPmismatch,
+ "Seen 0x%08x, expected 0x%08x, diff: 0x%08x (0x%02x)",
+ *fPayloadCurr, expword, diff, 0xff & (diff | diff >> 8 | diff >> 16 | diff >> 24));;
}
fPayloadCurr++;
count++;
UInt_t *start = fPayloadCurr;
Int_t mcmcount = 0;
- Int_t mcmcount_exp = fCurrStack == 2 ? 48 : 64;
+ Int_t mcmcountExp = fCurrStack == 2 ? 48 : 64;
Int_t channelcount = 0;
- Int_t channelcount_exp = 0;
- Int_t channelcount_max = 0;
+ Int_t channelcountExp = 0;
+ Int_t channelcountMax = 0;
Int_t timebins;
Int_t currentTimebin = 0;
Int_t adcwc = 0;
if (fCurrNtimebins != fNtimebins) {
if (fNtimebins > 0)
- AliError(LinkError(kNtimebinsChanged,
- Form("No. of timebins changed from %i to %i", fNtimebins, fCurrNtimebins) ));
+ LinkError(kNtimebinsChanged,
+ "No. of timebins changed from %i to %i", fNtimebins, fCurrNtimebins);
fNtimebins = fCurrNtimebins;
}
// ----- Checking MCM Header -----
AliDebug(2, Form("MCM header: 0x%08x", *fPayloadCurr));
+ UInt_t *startPosMCM = fPayloadCurr;
// ----- checking for proper readout order - ROB -----
if (GetROBReadoutPos(ROB(*fPayloadCurr) / 2) >= lastrobpos) {
lastrobpos = GetROBReadoutPos(ROB(*fPayloadCurr) / 2);
}
else {
- AliError(ROBError(kPosUnexp));
+ ROBError(kPosUnexp);
}
fCurrRobPos = ROB(*fPayloadCurr);
lastmcmpos = GetMCMReadoutPos(lastmcmpos);
}
else {
- AliError(MCMError(kPosUnexp));
+ MCMError(kPosUnexp);
}
fCurrMcmPos = MCM(*fPayloadCurr);
if (evno == -1)
evno = EvNo(*fPayloadCurr);
else {
- AliError(MCMError(kPtrgCntMismatch,
- Form("%i <-> %i", evno, EvNo(*fPayloadCurr)) ));
+ MCMError(kPtrgCntMismatch, "%i <-> %i", evno, EvNo(*fPayloadCurr));
}
}
Int_t adccoloff = AdcColOffset(*fPayloadCurr);
// ----- analysing the ADC mask -----
channelcount = 0;
- channelcount_exp = GetNActiveChannelsFromMask(*fPayloadCurr);
- channelcount_max = GetNActiveChannels(*fPayloadCurr);
+ channelcountExp = GetNActiveChannelsFromMask(*fPayloadCurr);
+ channelcountMax = GetNActiveChannels(*fPayloadCurr);
Int_t channelmask = GetActiveChannels(*fPayloadCurr);
Int_t channelno = -1;
fPayloadCurr++;
- if (channelcount_exp != channelcount_max) {
- if (channelcount_exp > channelcount_max) {
- Int_t temp = channelcount_exp;
- channelcount_exp = channelcount_max;
- channelcount_max = temp;
+ if (channelcountExp != channelcountMax) {
+ if (channelcountExp > channelcountMax) {
+ Int_t temp = channelcountExp;
+ channelcountExp = channelcountMax;
+ channelcountMax = temp;
}
- while (channelcount_exp < channelcount_max && channelcount_exp < 21 &&
- fPayloadCurr - fPayloadStart < fPayloadSize - 10 * channelcount_exp - 1) {
- AliError(MCMError(kAdcMaskInconsistent,
- Form("Possible MCM-H: 0x%08x, possible ADC-mask: 0x%08x",
- *(fPayloadCurr + 10 * channelcount_exp),
- *(fPayloadCurr + 10 * channelcount_exp + 1) ) ));
- if (!CouldBeMCMhdr( *(fPayloadCurr + 10 * channelcount_exp)) && !CouldBeADCmask( *(fPayloadCurr + 10 * channelcount_exp + 1)))
- channelcount_exp++;
+ while (channelcountExp < channelcountMax && channelcountExp < 21 &&
+ fPayloadCurr - fPayloadStart < fPayloadSize - 10 * channelcountExp - 1) {
+ MCMError(kAdcMaskInconsistent,
+ "Possible MCM-H: 0x%08x, possible ADC-mask: 0x%08x",
+ *(fPayloadCurr + 10 * channelcountExp),
+ *(fPayloadCurr + 10 * channelcountExp + 1) );
+ if (!CouldBeMCMhdr( *(fPayloadCurr + 10 * channelcountExp)) && !CouldBeADCmask( *(fPayloadCurr + 10 * channelcountExp + 1)))
+ channelcountExp++;
else {
break;
}
}
- AliError(MCMError(kAdcMaskInconsistent,
- Form("Inconsistency in no. of active channels: Counter: %i, Mask: %i, chosen: %i!",
- GetNActiveChannels(fPayloadCurr[-1]), GetNActiveChannelsFromMask(fPayloadCurr[-1]), channelcount_exp) ));
+ MCMError(kAdcMaskInconsistent,
+ "Inconsistency in no. of active channels: Counter: %i, Mask: %i, chosen: %i!",
+ GetNActiveChannels(fPayloadCurr[-1]), GetNActiveChannelsFromMask(fPayloadCurr[-1]), channelcountExp);
}
- AliDebug(2, Form("expecting %i active channels, timebins: %i", channelcount_exp, fCurrNtimebins));
+ AliDebug(2, Form("expecting %i active channels, timebins: %i", channelcountExp, fCurrNtimebins));
// ----- reading marked ADC channels -----
- while (channelcount < channelcount_exp && *(fPayloadCurr) != fgkDataEndmarker) {
- if (channelno < 21)
+ while (channelcount < channelcountExp && *(fPayloadCurr) != fgkDataEndmarker) {
+ if (channelno < 20)
channelno++;
- while (channelno < 21 && (channelmask & 1 << channelno) == 0)
+ while (channelno < 20 && (channelmask & 1 << channelno) == 0)
channelno++;
if (fCurrNtimebins > 30) {
AliDebug(2, Form("Now looking %i words", timebins / 3));
Int_t adccol = adccoloff - channelno;
Int_t padcol = padcoloff - channelno;
+// if (adccol < 3 || adccol > 165)
+// AliInfo(Form("writing channel %i of det %3i %i:%2i to adcrow/-col: %i/%i padcol: %i",
+// channelno, fCurrHC/2, fCurrRobPos, fCurrMcmPos, row, adccol, padcol));
+
while (adcwc < timebins / 3 &&
*(fPayloadCurr) != fgkDataEndmarker &&
fPayloadCurr - fPayloadStart < fPayloadSize) {
int check = 0x3 & *fPayloadCurr;
if (channelno % 2 != 0) { // odd channel
if (check != 0x2 && channelno < 21) {
- AliError(MCMError(kAdcCheckInvalid,
- Form("Invalid check bits: %i for %2i. ADC word in odd channel: %i",
- check, adcwc+1, channelno) ));
+ MCMError(kAdcCheckInvalid,
+ "%i for %2i. ADC word in odd channel %i",
+ check, adcwc+1, channelno);
}
}
else { // even channel
if (check != 0x3 && channelno < 21) {
- AliError(MCMError(kAdcCheckInvalid,
- Form("Invalid check bits: %i for %2i. ADC word in even channel: %i",
- check, adcwc+1, channelno) ));
+ MCMError(kAdcCheckInvalid,
+ "%i for %2i. ADC word in even channel %i",
+ check, adcwc+1, channelno);
}
}
}
if (adcwc != timebins / 3)
- AliError(MCMError(kAdcDataAbort));
+ MCMError(kAdcDataAbort);
// adding index
if (padcol > 0 && padcol < 144) {
channelcount++;
}
-
- if (channelcount != channelcount_exp)
- AliError(MCMError(kAdcChannelsMiss));
+
+ if (fCurrSm > -1 && fCurrSm < 18) {
+ fStats.fStatsSector[fCurrSm].fStatsHC[fCurrHC%60].fNChannels += channelcount;
+ fStats.fStatsSector[fCurrSm].fNChannels += channelcount;
+ }
+ if (channelcount != channelcountExp)
+ MCMError(kAdcChannelsMiss);
mcmcount++;
+ if (fCurrSm > -1 && fCurrSm < 18) {
+ fStats.fStatsSector[fCurrSm].fStatsHC[fCurrHC%60].fNMCMs++;
+ fStats.fStatsSector[fCurrSm].fNMCMs++;
+ }
+
+ if (IsDumping() && DumpingMCM(fCurrHC/2, fCurrRobPos, fCurrMcmPos)) {
+ DumpRaw(Form("Event %i: Det %3i ROB %i MCM %2i", fRawReader->GetEventIndex(), fCurrHC/2, fCurrRobPos, fCurrMcmPos),
+ startPosMCM, fPayloadCurr - startPosMCM);
+ }
+
// continue with next MCM
}
// check for missing MCMs (if header suppression is inactive)
- if (fCurrMajor & 0x1 == 0 && mcmcount != mcmcount_exp) {
- AliError(LinkError(kMissMcmHeaders,
- Form("No. of MCM headers %i not as expected: %i",
- mcmcount, mcmcount_exp) ));
+ if (((fCurrMajor & 0x1) == 0) && (mcmcount != mcmcountExp)) {
+ LinkError(kMissMcmHeaders,
+ "No. of MCM headers %i not as expected: %i",
+ mcmcount, mcmcountExp);
}
return (fPayloadCurr - start);
UInt_t *start = fPayloadCurr;
Int_t mcmcount = 0;
- Int_t mcmcount_exp = fCurrStack == 2 ? 48 : 64;
+ Int_t mcmcountExp = fCurrStack == 2 ? 48 : 64;
Int_t channelcount = 0;
- Int_t channelcount_exp = 0;
+ Int_t channelcountExp = 0;
Int_t timebins;
Int_t currentTimebin = 0;
Int_t adcwc = 0;
if (fCurrNtimebins != fNtimebins) {
if (fNtimebins > 0)
- AliError(LinkError(kNtimebinsChanged,
- Form("No. of timebins changed from %i to %i", fNtimebins, fCurrNtimebins) ));
+ LinkError(kNtimebinsChanged,
+ "No. of timebins changed from %i to %i", fNtimebins, fCurrNtimebins);
fNtimebins = fCurrNtimebins;
}
lastrobpos = GetROBReadoutPos(ROB(*fPayloadCurr) / 2);
}
else {
- AliError(ROBError(kPosUnexp));
+ ROBError(kPosUnexp);
}
fCurrRobPos = ROB(*fPayloadCurr);
lastmcmpos = GetMCMReadoutPos(*fPayloadCurr);
}
else {
- AliError(MCMError(kPosUnexp));
+ MCMError(kPosUnexp);
}
fCurrMcmPos = MCM(*fPayloadCurr);
if (evno == -1)
evno = EvNo(*fPayloadCurr);
else {
- AliError(MCMError(kPtrgCntMismatch,
- Form("%i <-> %i", evno, EvNo(*fPayloadCurr)) ));
+ MCMError(kPtrgCntMismatch, "%i <-> %i", evno, EvNo(*fPayloadCurr));
}
}
channelcount = 0;
- channelcount_exp = 21;
+ channelcountExp = 21;
int channelno = -1;
Int_t adccoloff = AdcColOffset(*fPayloadCurr);
fPayloadCurr++;
// ----- reading marked ADC channels -----
- while (channelcount < channelcount_exp &&
+ while (channelcount < channelcountExp &&
*(fPayloadCurr) != fgkDataEndmarker) {
- if (channelno < 21)
+ if (channelno < 20)
channelno++;
currentTimebin = 0;
int check = 0x3 & *fPayloadCurr;
if (channelno % 2 != 0) { // odd channel
if (check != 0x2 && channelno < 21) {
- AliError(MCMError(kAdcCheckInvalid,
- Form("Invalid check bits: %i for %2i. ADC word in odd channel: %i",
- check, adcwc+1, channelno) ));
+ MCMError(kAdcCheckInvalid,
+ "%i for %2i. ADC word in odd channel %i",
+ check, adcwc+1, channelno);
}
}
else { // even channel
if (check != 0x3 && channelno < 21) {
- AliError(MCMError(kAdcCheckInvalid,
- Form("Invalid check bits: %i for %2i. ADC word in even channel: %i",
- check, adcwc+1, channelno) ));
+ MCMError(kAdcCheckInvalid,
+ "%i for %2i. ADC word in even channel %i",
+ check, adcwc+1, channelno);
}
}
}
if (adcwc != timebins / 3)
- AliError(MCMError(kAdcDataAbort));
+ MCMError(kAdcDataAbort);
// adding index
if (padcol > 0 && padcol < 144) {
channelcount++;
}
- if (channelcount != channelcount_exp)
- AliError(MCMError(kAdcChannelsMiss));
+ if (channelcount != channelcountExp)
+ MCMError(kAdcChannelsMiss);
mcmcount++;
// continue with next MCM
}
// check for missing MCMs (if header suppression is inactive)
- if (mcmcount != mcmcount_exp) {
- AliError(LinkError(kMissMcmHeaders,
- Form("%i not as expected: %i", mcmcount, mcmcount_exp) ));
+ if (mcmcount != mcmcountExp) {
+ LinkError(kMissMcmHeaders,
+ "%i not as expected: %i", mcmcount, mcmcountExp);
}
return (fPayloadCurr - start);
}
+Int_t AliTRDrawStream::SeekNextLink()
+{
+ // proceed in raw data stream till the next link
+
+ UInt_t *start = fPayloadCurr;
+
+ // read until data endmarkers
+ while (fPayloadCurr - fPayloadStart < fPayloadSize &&
+ *fPayloadCurr != fgkDataEndmarker)
+ fPayloadCurr++;
+
+ // read all data endmarkers
+ while (fPayloadCurr - fPayloadStart < fPayloadSize &&
+ *fPayloadCurr == fgkDataEndmarker)
+ fPayloadCurr++;
+
+ return (fPayloadCurr - start);
+}
-Int_t AliTRDrawStream::GetNActiveChannelsFromMask(UInt_t adcmask)
+Bool_t AliTRDrawStream::ConnectTracklets(TTree *trklTree)
{
- adcmask = GetActiveChannels(adcmask);
- adcmask = adcmask - ((adcmask >> 1) & 0x55555555);
- adcmask = (adcmask & 0x33333333) + ((adcmask >> 2) & 0x33333333);
- return (((adcmask + (adcmask >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24;
+ // connect the tracklet tree used to store the tracklet output
+
+ fTrackletTree = trklTree;
+ if (!fTrackletTree)
+ return kTRUE;
+
+ if (!fTrackletTree->GetBranch("hc"))
+ fTrackletTree->Branch("hc", &fCurrHC, "hc/I");
+ else
+ fTrackletTree->SetBranchAddress("hc", &fCurrHC);
+
+ if (!fTrackletTree->GetBranch("trkl"))
+ fTrackletTree->Branch("trkl", &fTrackletArray);
+ else
+ fTrackletTree->SetBranchAddress("trkl", &fTrackletArray);
+
+ return kTRUE;
}
-TString AliTRDrawStream::EquipmentError(ErrorCode_t err, TString msg)
+void AliTRDrawStream::EquipmentError(ErrorCode_t err, const char *const msg, ...)
{
+ // register error according to error code on equipment level
+ // and return the corresponding error message
+
fLastError.fSector = fCurrEquipmentId - 1024;
fLastError.fStack = -1;
fLastError.fLink = -1;
fLastError.fRob = -1;
fLastError.fMcm = -1;
fLastError.fError = err;
- fErrors->Fill();
-
- return (Form("Event %6i: Eq. %2d - %s : ",
- fRawReader->GetEventIndex(), fCurrEquipmentId, fgErrorMessages[err]) + msg);
+ (this->*fStoreError)();
+
+ va_list ap;
+ if (fgErrorDebugLevel[err] > 10)
+ AliDebug(fgErrorDebugLevel[err],
+ Form("Event %6i: Eq. %2d - %s : %s",
+ fRawReader->GetEventIndex(), fCurrEquipmentId, fgkErrorMessages[err],
+ (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) ));
+ else
+ AliError(Form("Event %6i: Eq. %2d - %s : %s",
+ fRawReader->GetEventIndex(), fCurrEquipmentId, fgkErrorMessages[err],
+ (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) ));
+ fErrorFlags |= fgErrorBehav[err];
}
-TString AliTRDrawStream::StackError(ErrorCode_t err, TString msg)
+void AliTRDrawStream::StackError(ErrorCode_t err, const char *const msg, ...)
{
+ // register error according to error code on stack level
+ // and return the corresponding error message
+
fLastError.fSector = fCurrEquipmentId - 1024;
fLastError.fStack = fCurrSlot;
fLastError.fLink = -1;
fLastError.fRob = -1;
fLastError.fMcm = -1;
fLastError.fError = err;
- fErrors->Fill();
-
- return (Form("Event %6i: Eq. %2d S %i - %s : ",
- fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fgErrorMessages[err]) + msg);
+ (this->*fStoreError)();
+
+ va_list ap;
+ if (fgErrorDebugLevel[err] > 0)
+ AliDebug(fgErrorDebugLevel[err],
+ Form("Event %6i: Eq. %2d S %i - %s : %s",
+ fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fgkErrorMessages[err],
+ (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) ));
+ else
+ AliError(Form("Event %6i: Eq. %2d S %i - %s : %s",
+ fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fgkErrorMessages[err],
+ (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) ));
+ fErrorFlags |= fgErrorBehav[err];
}
-TString AliTRDrawStream::LinkError(ErrorCode_t err, TString msg)
+void AliTRDrawStream::LinkError(ErrorCode_t err, const char *const msg, ...)
{
+ // register error according to error code on link level
+ // and return the corresponding error message
+
fLastError.fSector = fCurrEquipmentId - 1024;
fLastError.fStack = fCurrSlot;
fLastError.fLink = fCurrLink;
fLastError.fRob = -1;
fLastError.fMcm = -1;
fLastError.fError = err;
- fErrors->Fill();
-
- return (Form("Event %6i: Eq. %2d S %i l %2i - %s : ",
- fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fCurrLink, fgErrorMessages[err]) + msg);
+ (this->*fStoreError)();
+
+ va_list ap;
+ if (fgErrorDebugLevel[err] > 0)
+ AliDebug(fgErrorDebugLevel[err],
+ Form("Event %6i: Eq. %2d S %i l %2i - %s : %s",
+ fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fCurrLink, fgkErrorMessages[err],
+ (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) ));
+ else
+ AliError(Form("Event %6i: Eq. %2d S %i l %2i - %s : %s",
+ fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fCurrLink, fgkErrorMessages[err],
+ (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) ));
+ fErrorFlags |= fgErrorBehav[err];
}
-TString AliTRDrawStream::ROBError(ErrorCode_t err, TString msg)
+void AliTRDrawStream::ROBError(ErrorCode_t err, const char *const msg, ...)
{
+ // register error according to error code on ROB level
+ // and return the corresponding error message
+
fLastError.fSector = fCurrEquipmentId - 1024;
fLastError.fStack = fCurrSlot;
fLastError.fLink = fCurrLink;
fLastError.fRob = fCurrRobPos;
fLastError.fMcm = -1;
fLastError.fError = err;
- fErrors->Fill();
-
- return (Form("Event %6i: Eq. %2d S %i l %2i ROB %i - %s : ",
- fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fCurrLink, fCurrRobPos, fgErrorMessages[err]) + msg);
+ (this->*fStoreError)();
+
+ va_list ap;
+ if (fgErrorDebugLevel[err] > 0)
+ AliDebug(fgErrorDebugLevel[err],
+ Form("Event %6i: Eq. %2d S %i l %2i ROB %i - %s : %s",
+ fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fCurrLink, fCurrRobPos, fgkErrorMessages[err],
+ (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) ));
+ else
+ AliError(Form("Event %6i: Eq. %2d S %i l %2i ROB %i - %s : %s",
+ fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fCurrLink, fCurrRobPos, fgkErrorMessages[err],
+ (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) ));
+ fErrorFlags |= fgErrorBehav[err];
}
-TString AliTRDrawStream::MCMError(ErrorCode_t err, TString msg)
+void AliTRDrawStream::MCMError(ErrorCode_t err, const char *const msg, ...)
{
+ // register error according to error code on MCM level
+ // and return the corresponding error message
+
fLastError.fSector = fCurrEquipmentId - 1024;
fLastError.fStack = fCurrSlot;
fLastError.fLink = fCurrLink;
fLastError.fRob = fCurrRobPos;
fLastError.fMcm = fCurrMcmPos;
fLastError.fError = err;
- fErrors->Fill();
-
- return (Form("Event %6i: Eq. %2d S %i l %2i ROB %i MCM %2i - %s : ",
- fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fCurrLink, fCurrRobPos, fCurrMcmPos, fgErrorMessages[err]) + msg);
+ (this->*fStoreError)();
+
+ va_list ap;
+ if (fgErrorDebugLevel[err] > 0)
+ AliDebug(fgErrorDebugLevel[err],
+ Form("Event %6i: Eq. %2d S %i l %2i ROB %i MCM %2i - %s : %s",
+ fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fCurrLink, fCurrRobPos, fCurrMcmPos, fgkErrorMessages[err],
+ (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) ));
+ else
+ AliError(Form("Event %6i: Eq. %2d S %i l %2i ROB %i MCM %2i - %s : %s",
+ fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fCurrLink, fCurrRobPos, fCurrMcmPos, fgkErrorMessages[err],
+ (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) ));
+ fErrorFlags |= fgErrorBehav[err];
}
const char* AliTRDrawStream::GetErrorMessage(ErrorCode_t errCode)
{
+ // return the error message for the given error code
+
if (errCode > 0 && errCode < kLastErrorCode)
- return fgErrorMessages[errCode];
+ return fgkErrorMessages[errCode];
else
return "";
}
+
+void AliTRDrawStream::AliTRDrawStats::ClearStats()
+{
+ // clear statistics (includes clearing sector-wise statistics)
+
+ fBytesRead = 0;
+ for (Int_t iSector = 0; iSector < 18; iSector++) {
+ fStatsSector[iSector].ClearStats();
+ }
+
+}
+
+void AliTRDrawStream::AliTRDrawStats::AliTRDrawStatsSector::ClearStats()
+{
+ // clear statistics (includes clearing HC-wise statistics)
+
+ fBytes = 0;
+ fBytesRead = 0;
+ fNTracklets = 0;
+ fNMCMs = 0;
+ fNChannels = 0;
+
+ for (Int_t iHC = 0; iHC < 60; iHC++) {
+ fStatsHC[iHC].ClearStats();
+ }
+}
+
+void AliTRDrawStream::AliTRDrawStats::AliTRDrawStatsSector::AliTRDrawStatsHC::ClearStats()
+{
+ // clear statistics
+
+ fBytes = 0;
+ fBytesRead = 0;
+ fNTracklets = 0;
+ fNMCMs = 0;
+ fNChannels = 0;
+}
+
+void AliTRDrawStream::SetDumpMCM(Int_t det, Int_t rob, Int_t mcm, Bool_t dump)
+{
+ // mark MCM for dumping of raw data
+
+ if (dump) {
+ fDumpMCM[fNDumpMCMs++] = (det << 7) | (rob << 4) | mcm;
+ }
+ else {
+ Int_t iMCM;
+ for (iMCM = 0; iMCM < fNDumpMCMs; iMCM++) {
+ if (fDumpMCM[iMCM] == ((det << 7) | (rob << 4) | mcm)) {
+ fNDumpMCMs--;
+ break;
+ }
+ }
+ for ( ; iMCM < fNDumpMCMs; iMCM++) {
+ fDumpMCM[iMCM] = fDumpMCM[iMCM+1];
+ }
+ }
+}
+
+Bool_t AliTRDrawStream::DumpingMCM(Int_t det, Int_t rob, Int_t mcm) const
+{
+ // check if MCM data should be dumped
+
+ for (Int_t iMCM = 0; iMCM < fNDumpMCMs; iMCM++) {
+ if (fDumpMCM[iMCM] == ((det << 7) | (rob << 4) | mcm)) {
+ return kTRUE;
+ }
+ }
+ return kFALSE;
+}
+
+void AliTRDrawStream::DumpRaw(TString title, UInt_t *start, Int_t length)
+{
+ // dump raw data
+
+ title += "\n";
+ Int_t pos = 0;
+ for ( ; pos+3 < length; pos += 4) {
+ title += Form("0x%08x 0x%08x 0x%08x 0x%08x\n",
+ start[pos+0], start[pos+1], start[pos+2], start[pos+3]);
+ }
+ for ( ; pos < length; pos++) {
+ title += Form("0x%08x ", start[pos]);
+ }
+ AliInfo(title);
+}
+
+AliTRDrawStream::AliTRDrawStreamError::AliTRDrawStreamError(Int_t error, Int_t sector, Int_t stack, Int_t link, Int_t rob, Int_t mcm) :
+ fError(error),
+ fSector(sector),
+ fStack(stack),
+ fLink(link),
+ fRob(rob),
+ fMcm(mcm)
+{
+ // ctor
+
+}