1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 ////////////////////////////////////////////////////////////////////////////
18 // Decoding data from the TRD raw stream //
19 // and translation into ADC values //
21 // Author: J. Klein (jochen.klein@cern.ch) //
23 ////////////////////////////////////////////////////////////////////////////
28 #include "TClonesArray.h"
32 #include "AliRawReader.h"
33 #include "AliTRDdigitsManager.h"
34 #include "AliTRDdigitsParam.h"
35 #include "AliTRDtrapConfig.h"
36 #include "AliTRDarrayADC.h"
37 #include "AliTRDarrayDictionary.h"
38 #include "AliTRDSignalIndex.h"
39 #include "AliTRDtrackletWord.h"
40 #include "AliESDTrdTrack.h"
41 #include "AliTreeLoader.h"
43 #include "AliTRDrawStream.h"
46 #include "AliRunLoader.h"
48 ClassImp(AliTRDrawStream)
50 // some static information
51 const Int_t AliTRDrawStream::fgkMcmOrder[] = {12, 13, 14, 15,
55 const Int_t AliTRDrawStream::fgkRobOrder [] = {0, 1, 2, 3};
56 const Int_t AliTRDrawStream::fgkNlinks = 12;
57 const Int_t AliTRDrawStream::fgkNstacks = 5;
58 const UInt_t AliTRDrawStream::fgkDataEndmarker = 0x00000000;
59 const UInt_t AliTRDrawStream::fgkTrackletEndmarker = 0x10001000;
61 const char* AliTRDrawStream::fgkErrorMessages[] = {
63 "Link monitor active",
64 "Pretrigger counter mismatch",
65 "not a TRD equipment (1024-1041)",
66 "Invalid Stack header",
67 "Invalid detector number",
68 "No digits could be retrieved from the digitsmanager",
70 "HC check bits wrong",
71 "Unexpected position in readout stream",
72 "Invalid testpattern mode",
73 "Testpattern mismatch",
74 "Number of timebins changed",
75 "ADC mask inconsistent",
76 "ADC check bits invalid",
78 "Missing expected ADC channels",
82 Int_t AliTRDrawStream::fgErrorDebugLevel[] = {
103 AliTRDrawStream::ErrorBehav_t AliTRDrawStream::fgErrorBehav[] = {
104 AliTRDrawStream::kTolerate,
105 AliTRDrawStream::kDiscardHC,
106 AliTRDrawStream::kTolerate,
107 AliTRDrawStream::kAbort,
108 AliTRDrawStream::kAbort,
109 AliTRDrawStream::kAbort,
110 AliTRDrawStream::kAbort,
111 AliTRDrawStream::kDiscardHC,
112 AliTRDrawStream::kDiscardHC,
113 AliTRDrawStream::kTolerate,
114 AliTRDrawStream::kTolerate,
115 AliTRDrawStream::kTolerate,
116 AliTRDrawStream::kTolerate,
117 AliTRDrawStream::kTolerate,
118 AliTRDrawStream::kTolerate,
119 AliTRDrawStream::kTolerate,
120 AliTRDrawStream::kTolerate,
121 AliTRDrawStream::kTolerate
124 AliTRDrawStream::AliTRDrawStream(AliRawReader *rawReader) :
126 fStoreError(&AliTRDrawStream::StoreErrorTree),
127 fRawReader(rawReader),
143 fCurrSmuIndexHeaderSize(0),
144 fCurrSmuIndexHeaderVersion(0),
146 fCurrTrackletEnable(0),
148 fCurrStackIndexWord(0x0),
149 fCurrStackHeaderSize(0x0),
150 fCurrStackHeaderVersion(0x0),
152 fCurrCleanCheckout(0x0),
155 fCurrLinkMonitorFlags(0x0),
156 fCurrLinkDataTypeFlags(0x0),
157 fCurrLinkDebugFlags(0x0),
181 // default constructor
183 fCurrStackIndexWord = new UInt_t[fgkNstacks];
184 fCurrStackHeaderSize = new UInt_t[fgkNstacks];
185 fCurrStackHeaderVersion = new UInt_t[fgkNstacks];
186 fCurrLinkMask = new UInt_t[fgkNstacks];
187 fCurrCleanCheckout = new UInt_t[fgkNstacks];
188 fCurrBoardId = new UInt_t[fgkNstacks];
189 fCurrHwRev = new UInt_t[fgkNstacks];
190 fCurrLinkMonitorFlags = new UInt_t[fgkNstacks * fgkNlinks];
191 fCurrLinkDataTypeFlags = new UInt_t[fgkNstacks * fgkNlinks];
192 fCurrLinkDebugFlags = new UInt_t[fgkNstacks * fgkNlinks];
193 for (Int_t i = 0; i < 100; i++)
196 // preparing TClonesArray
197 fTrackletArray = new TClonesArray("AliTRDtrackletWord", 256);
199 // setting up the error tree
200 fErrors = new TTree("errorStats", "Error statistics");
201 fErrors->SetDirectory(0x0);
202 fErrors->Branch("error", &fLastError);
203 fErrors->SetCircular(1000);
204 for (Int_t i = 0; i < 100; i++) {
210 AliTRDrawStream::~AliTRDrawStream()
216 delete [] fCurrStackIndexWord;
217 delete [] fCurrStackHeaderSize;
218 delete [] fCurrStackHeaderVersion;
219 delete [] fCurrLinkMask;
220 delete [] fCurrCleanCheckout;
221 delete [] fCurrBoardId;
222 delete [] fCurrHwRev;
223 delete [] fCurrLinkMonitorFlags;
224 delete [] fCurrLinkDataTypeFlags;
225 delete [] fCurrLinkDebugFlags;
228 Bool_t AliTRDrawStream::ReadEvent(TTree *trackletTree)
230 // read the current event from the raw reader and fill it to the digits manager
233 AliError("No raw reader available");
238 ConnectTracklets(trackletTree);
243 // loop over all DDLs
244 // data starts with GTU payload, i.e. SMU index word
245 UChar_t *buffer = 0x0;
247 while (fRawReader->ReadNextData(buffer)) {
249 fCurrEquipmentId = fRawReader->GetEquipmentId();
250 AliDebug(2, Form("equipment: %i", fCurrEquipmentId));
252 if (fCurrEquipmentId < 1024 || fCurrEquipmentId > 1041) {
253 EquipmentError(kNonTrdEq, "Skipping");
257 // setting the pointer to data and current reading position
258 fPayloadCurr = fPayloadStart = (UInt_t*) (buffer);
259 fPayloadSize = fRawReader->GetDataSize() / sizeof(UInt_t);
260 fStats.fStatsSector[fCurrEquipmentId - 1024].fBytes = fRawReader->GetDataSize();
261 AliDebug(2, Form("Read buffer of size: %i", fRawReader->GetDataSize()));
263 // read SMU index header
264 if (ReadSmHeader() < 0) {
265 AliError(Form("Reading SMU header failed, skipping this DDL %i", fCurrEquipmentId));
269 // read stack index header
270 for (Int_t iStack = 0; iStack < 5; iStack++) {
271 if ((fCurrStackMask & (1 << iStack)) != 0)
272 ReadStackIndexHeader(iStack);
275 for (Int_t iStack = 0; iStack < 5; iStack++) {
277 if ((fCurrStackMask & (1 << fCurrSlot)) == 0)
280 AliDebug(2, Form("Stack %i, Link mask: 0x%02x", fCurrSlot, fCurrLinkMask[fCurrSlot]));
281 for (Int_t iLink = 0; iLink < 12; iLink++) {
283 fCurrHC = (fCurrEquipmentId - 1024) * 60 + fCurrSlot * 12 + iLink;
284 if ((fCurrLinkMask[fCurrSlot] & (1 << fCurrLink)) == 0)
288 // check for link monitor error flag
289 if (fCurrLinkMonitorFlags[fCurrSlot*fgkNlinks + fCurrLink] != 0)
290 LinkError(kLinkMonitor);
292 // read the data from one HC
295 // read all data endmarkers
304 Bool_t AliTRDrawStream::NextDDL()
306 // continue reading with the next equipment
311 fCurrEquipmentId = 0;
315 UChar_t *buffer = 0x0;
317 while (fRawReader->ReadNextData(buffer)) {
319 fCurrEquipmentId = fRawReader->GetEquipmentId();
320 AliDebug(2, Form("equipment: %i", fCurrEquipmentId));
322 if (fCurrEquipmentId < 1024 || fCurrEquipmentId > 1041) {
323 EquipmentError(kNonTrdEq, "Skipping");
327 // setting the pointer to data and current reading position
328 fPayloadCurr = fPayloadStart = (UInt_t*) (buffer);
329 fPayloadSize = fRawReader->GetDataSize() / sizeof(UInt_t);
330 AliDebug(2, Form("Read buffer of size: %i", fRawReader->GetDataSize()));
332 // read SMU index header
333 if (ReadSmHeader() < 0) {
334 AliError(Form("Reading SMU header failed, skipping this DDL %i", fCurrEquipmentId));
338 // read stack index header
339 for (Int_t iStack = 0; iStack < 5; iStack++) {
340 if ((fCurrStackMask & (1 << iStack)) != 0) {
341 ReadStackIndexHeader(iStack);
351 Int_t AliTRDrawStream::NextChamber(AliTRDdigitsManager *digMgr, UInt_t ** /* trackletContainer */, UShort_t ** /* errorContainer */)
353 // read the data for the next chamber
354 // in case you only want to read the data of a single chamber
355 // to read all data ReadEvent(...) is recommended
357 fDigitsManager = digMgr;
362 // tracklet output preparation
363 TTree *trklTree = 0x0;
364 AliRunLoader *rl = AliRunLoader::Instance();
365 AliLoader* trdLoader = rl ? rl->GetLoader("TRDLoader") : NULL;
366 AliDataLoader *trklLoader = trdLoader ? trdLoader->GetDataLoader("tracklets") : NULL;
368 AliTreeLoader *trklTreeLoader = (AliTreeLoader*) trklLoader->GetBaseLoader("tracklets-raw");
370 trklTree = trklTreeLoader->Tree();
372 trklTree = trklLoader->Tree();
375 if (fTrackletTree != trklTree)
376 ConnectTracklets(trklTree);
379 AliError("No raw reader available");
383 while (fCurrSlot < 0 || fCurrSlot >= 5) {
388 while ((fCurrSlot < 5) &&
389 (((fCurrStackMask & (1 << fCurrSlot)) == 0) ||
390 ((fCurrLinkMask[fCurrSlot] & (1 << fCurrLink))) == 0)) {
392 if (fCurrLink > 11) {
399 AliDebug(2, Form("Stack %i, Link %i, mask: 0x%02x", fCurrSlot, fCurrLink, fCurrLinkMask[fCurrSlot]));
400 fCurrHC = (fCurrEquipmentId - 1024) * 60 + fCurrSlot * 12 + fCurrLink;
402 if (fCurrLinkMonitorFlags[fCurrSlot*fgkNlinks + fCurrLink] != 0)
403 LinkError(kLinkMonitor);
405 // read the data from one HC
408 // read all data endmarkers
411 if (fCurrLink % 2 == 0) {
412 // if we just read the A-side HC then also check the B-side
415 if (fCurrLinkMask[fCurrSlot] & (1 << fCurrLink)) {
424 if (fCurrLink > 11) {
428 } while ((fCurrSlot < 5) &&
429 (((fCurrStackMask & (1 << fCurrSlot)) == 0) ||
430 ((fCurrLinkMask[fCurrSlot] & (1 << fCurrLink))) == 0));
432 // return chamber information from HC if it is valid
433 // otherwise return information from link position
434 if (fCurrSm < 0 || fCurrSm > 17 || fCurrStack < 0 || fCurrStack > 4 || fCurrLayer < 0 || fCurrLayer > 5)
435 return ((fCurrEquipmentId-1024) + fCurrSlot * 6 + fCurrLink/2);
437 return (fCurrSm * 30 + fCurrStack * 6 + fCurrLayer);
441 Int_t AliTRDrawStream::ReadSmHeader()
443 // read the SMU index header at the current reading position
444 // and store the information in the corresponding variables
446 if (fPayloadCurr - fPayloadStart >= fPayloadSize - 1) {
447 EquipmentError(kUnknown, "SM Header incomplete");
451 fCurrSmuIndexHeaderSize = ((*fPayloadCurr) >> 16) & 0xffff;
452 fCurrSmuIndexHeaderVersion = ((*fPayloadCurr) >> 12) & 0xf;
453 // fCurrSmuIndexHeaderTrgAvail = ((*fPayloadCurr) >> 9) & 0x1;
454 // fCurrSmuIndexHeaderEvType = ((*fPayloadCurr) >> 7) & 0x3;
455 fCurrTrackEnable = ((*fPayloadCurr) >> 6) & 0x1;
456 fCurrTrackletEnable = ((*fPayloadCurr) >> 5) & 0x1;
457 fCurrStackMask = ((*fPayloadCurr) ) & 0x1f;
459 AliDebug(5, Form("SMU header: size: %i, version: %i, track enable: %i, tracklet enable: %i, stack mask: %2x",
460 fCurrSmuIndexHeaderSize,
461 fCurrSmuIndexHeaderVersion,
466 // decode GTU track words
467 UInt_t trackWord[2] = { 0, 0 };
470 for (UInt_t iWord = 4; iWord < fCurrSmuIndexHeaderSize; iWord++) {
471 if (fPayloadCurr[iWord] == 0x10000000) {
477 ((fPayloadCurr[iWord] & 0xfffff0f0) == 0x13370000)) {
478 AliDebug(1,Form("stack %i: fast trigger word: 0x%08x", stack, fPayloadCurr[iWord]));
481 else if ((idx & 0x1)==0x1) {
482 trackWord[idx&0x1] = fPayloadCurr[iWord];
483 AliDebug(1,Form("track debug word: 0x%08x%08x", trackWord[1], trackWord[0]));
485 // new ((*fTracks)[fTracks->GetEntriesFast()]) AliESDTrdTrack(0, 0, trackWord[0], trackWord[1], fCurrEquipmentId-1024);
488 trackWord[idx&0x1] = fPayloadCurr[iWord];
494 fPayloadCurr += fCurrSmuIndexHeaderSize + 1;
496 return fCurrSmuIndexHeaderSize + 1;
499 Int_t AliTRDrawStream::ReadStackIndexHeader(Int_t stack)
501 // read the stack index header
502 // and store the information in the corresponding variables
504 fCurrStackIndexWord[stack] = *fPayloadCurr;
505 fCurrStackHeaderSize[stack] = (((*fPayloadCurr) >> 16) & 0xffff) + 1;
506 fCurrStackHeaderVersion[stack] = ((*fPayloadCurr) >> 12) & 0xf;
507 fCurrLinkMask[stack] = (*fPayloadCurr) & 0xfff;
509 if (fPayloadCurr - fPayloadStart >= fPayloadSize - (Int_t) fCurrStackHeaderSize[stack]) {
510 StackError(kStackHeaderInvalid, "Stack index header aborted");
514 switch (fCurrStackHeaderVersion[stack]) {
516 if (fCurrStackHeaderSize[stack] < 8) {
517 StackError(kStackHeaderInvalid, "Stack header smaller than expected!");
521 fCurrCleanCheckout[stack] = fPayloadCurr[1] & 0x1;
522 fCurrBoardId[stack] = (fPayloadCurr[1] >> 8) & 0xff;
523 fCurrHwRev[stack] = (fPayloadCurr[1] >> 16) & 0xffff;
525 for (Int_t iLayer = 0; iLayer < 6; iLayer++) {
527 fCurrLinkMonitorFlags [stack*fgkNlinks + iLayer*2] = fPayloadCurr[iLayer+2] & 0xf;
528 fCurrLinkDataTypeFlags [stack*fgkNlinks + iLayer*2] = (fPayloadCurr[iLayer+2] >> 4) & 0x3;
529 fCurrLinkDebugFlags [stack*fgkNlinks + iLayer*2] = (fPayloadCurr[iLayer+2] >> 12) & 0xf;
531 fCurrLinkMonitorFlags [stack*fgkNlinks + iLayer*2 + 1] = (fPayloadCurr[iLayer+2] >> 16) & 0xf;
532 fCurrLinkDataTypeFlags [stack*fgkNlinks + iLayer*2 + 1] = (fPayloadCurr[iLayer+2] >> 20) & 0x3;
533 fCurrLinkDebugFlags [stack*fgkNlinks + iLayer*2 + 1] = (fPayloadCurr[iLayer+2] >> 28) & 0xf;
538 StackError(kStackHeaderInvalid, "Invalid Stack Index Header version %x", fCurrStackHeaderVersion[stack]);
541 fPayloadCurr += fCurrStackHeaderSize[stack];
543 return fCurrStackHeaderSize[stack];
546 Int_t AliTRDrawStream::ReadLinkData()
548 // read the data in one link (one HC) until the data endmarker is reached
549 // returns the number of words read!
552 UInt_t* startPosLink = fPayloadCurr;
554 // printf("----- HC: %i -----\n", fCurrHC);
555 // for (Int_t i = 0; i < 3; i++) {
556 // printf("0x%08x 0x%08x 0x%08x 0x%08x\n",
557 // fPayloadCurr[i*4+0], fPayloadCurr[i*4+1], fPayloadCurr[i*4+2], fPayloadCurr[i*4+3]);
561 new ((*fMarkers)[fMarkers->GetEntriesFast()])
562 AliTRDrawStreamError(-kHCactive, fCurrSm, fCurrStack, fCurrLink);
564 if (fErrorFlags & kDiscardHC)
567 count += ReadTracklets();
568 if (fErrorFlags & kDiscardHC)
571 count += ReadHcHeader();
572 if (fErrorFlags & kDiscardHC)
575 Int_t det = fCurrSm * 30 + fCurrStack * 6 + fCurrLayer;
577 if (det > -1 && det < 540) {
579 if ((fAdcArray = fDigitsManager->GetDigits(det))) {
580 //fAdcArray->Expand();
581 if (fAdcArray->GetNtime() != fCurrNtimebins)
582 fAdcArray->Allocate(16, 144, fCurrNtimebins);
585 LinkError(kNoDigits);
589 fDigitsParam = fDigitsManager->GetDigitsParam();
592 fDigitsParam->SetPretriggerPhase(det, fCurrPtrgPhase);
593 fDigitsParam->SetNTimeBins(det, fCurrNtimebins);
594 fDigitsParam->SetADCbaseline(det, 10);
597 if (fDigitsManager->UsesDictionaries()) {
598 fDigitsManager->GetDictionary(det, 0)->Reset();
599 fDigitsManager->GetDictionary(det, 1)->Reset();
600 fDigitsManager->GetDictionary(det, 2)->Reset();
603 if ((fSignalIndex = fDigitsManager->GetIndexes(det))) {
604 fSignalIndex->SetSM(fCurrSm);
605 fSignalIndex->SetStack(fCurrStack);
606 fSignalIndex->SetLayer(fCurrLayer);
607 fSignalIndex->SetDetNumber(det);
608 if (!fSignalIndex->IsAllocated())
609 fSignalIndex->Allocate(16, 144, fCurrNtimebins);
612 // ----- check which kind of data -----
613 if (fCurrMajor & 0x40) {
614 if ((fCurrMajor & 0x7) == 0x7) {
615 AliDebug(1, "This is a config event");
616 UInt_t *startPos = fPayloadCurr;
617 while (fPayloadCurr - fPayloadStart < fPayloadSize &&
618 *fPayloadCurr != fgkDataEndmarker)
620 count += fPayloadCurr - startPos;
622 // feeding TRAP config
623 AliTRDtrapConfig *trapcfg = AliTRDtrapConfig::Instance();
624 trapcfg->ReadPackedConfig(fCurrHC, startPos, fPayloadCurr - startPos);
627 Int_t tpmode = fCurrMajor & 0x7;
628 AliDebug(1, Form("Checking testpattern (mode %i) data", tpmode));
632 else if (fCurrMajor & 0x20) {
633 AliDebug(1, "This is a zs event");
634 count += ReadZSData();
637 AliDebug(1, "This is a nozs event");
638 count += ReadNonZSData();
642 LinkError(kInvalidDetector, "%i", det);
643 while (fPayloadCurr - fPayloadStart < fPayloadSize &&
644 *fPayloadCurr != fgkDataEndmarker)
648 if (fCurrSm > -1 && fCurrSm < 18) {
649 fStats.fStatsSector[fCurrSm].fStatsHC[fCurrHC%60].fBytes += (fPayloadCurr - startPosLink) * sizeof(UInt_t);
650 fStats.fStatsSector[fCurrSm].fStatsHC[fCurrHC%60].fBytesRead += count * sizeof(UInt_t);
651 fStats.fStatsSector[fCurrSm].fBytesRead += count * sizeof(UInt_t);
652 fStats.fBytesRead += count * sizeof(UInt_t);
658 Int_t AliTRDrawStream::ReadTracklets()
660 // read the tracklets from one HC
662 fTrackletArray->Clear();
664 UInt_t *start = fPayloadCurr;
665 while (*(fPayloadCurr) != fgkTrackletEndmarker &&
666 fPayloadCurr - fPayloadStart < fPayloadSize) {
668 new ((*fTrackletArray)[fTrackletArray->GetEntriesFast()]) AliTRDtrackletWord(*(fPayloadCurr), fCurrHC);
673 if (fTrackletArray->GetEntriesFast() > 0) {
674 AliDebug(1, Form("Found %i tracklets in %i %i %i (ev. %i)", fTrackletArray->GetEntriesFast(),
675 (fCurrEquipmentId-1024), fCurrSlot, fCurrLink, fRawReader->GetEventIndex()));
676 if (fCurrSm > -1 && fCurrSm < 18) {
677 fStats.fStatsSector[fCurrSm].fStatsHC[fCurrHC%60].fNTracklets += fTrackletArray->GetEntriesFast();
678 fStats.fStatsSector[fCurrSm].fNTracklets += fTrackletArray->GetEntriesFast();
681 fTrackletTree->Fill();
683 for (Int_t iTracklet = 0; iTracklet < fTrackletArray->GetEntriesFast(); iTracklet++) {
684 new ((*fTracklets)[fTracklets->GetEntriesFast()]) AliTRDtrackletWord(*((AliTRDtrackletWord*)(*fTrackletArray)[iTracklet]));
688 // loop over remaining tracklet endmarkers
689 while ((*(fPayloadCurr) == fgkTrackletEndmarker &&
690 fPayloadCurr - fPayloadStart < fPayloadSize))
693 return fPayloadCurr - start;
696 Int_t AliTRDrawStream::ReadHcHeader()
698 // read and parse the HC header of one HC
699 // and store the information in the corresponding variables
701 UInt_t *start = fPayloadCurr;
702 // check not to be at the data endmarker
703 if (*fPayloadCurr == fgkDataEndmarker)
706 fCurrSpecial = (*fPayloadCurr >> 31) & 0x1;
707 fCurrMajor = (*fPayloadCurr >> 24) & 0x7f;
708 fCurrMinor = (*fPayloadCurr >> 17) & 0x7f;
709 fCurrAddHcWords = (*fPayloadCurr >> 14) & 0x7;
710 fCurrSm = (*fPayloadCurr >> 9) & 0x1f;
711 fCurrLayer = (*fPayloadCurr >> 6) & 0x7;
712 fCurrStack = (*fPayloadCurr >> 3) & 0x7;
713 fCurrSide = (*fPayloadCurr >> 2) & 0x1;
714 fCurrCheck = (*fPayloadCurr) & 0x3;
716 if (fCurrSm != (((Int_t) fCurrEquipmentId) - 1024) ||
717 fCurrStack != fCurrSlot ||
718 fCurrLayer != fCurrLink / 2 ||
719 fCurrSide != fCurrLink % 2) {
720 LinkError(kHCmismatch,
721 "HC: %i, %i, %i, %i\n 0x%08x 0x%08x 0x%08x 0x%08x",
722 fCurrSm, fCurrStack, fCurrLayer, fCurrSide,
723 fPayloadCurr[0], fPayloadCurr[1], fPayloadCurr[2], fPayloadCurr[3]);;
725 if (fCurrCheck != 0x1) {
726 LinkError(kHCcheckFailed);
729 if (fCurrAddHcWords > 0) {
730 fCurrNtimebins = (fPayloadCurr[1] >> 26) & 0x3f;
731 fCurrBC = (fPayloadCurr[1] >> 10) & 0xffff;
732 fCurrPtrgCnt = (fPayloadCurr[1] >> 6) & 0xf;
733 fCurrPtrgPhase = (fPayloadCurr[1] >> 2) & 0xf;
736 fPayloadCurr += 1 + fCurrAddHcWords;
738 return (fPayloadCurr - start);
741 Int_t AliTRDrawStream::ReadTPData(Int_t mode)
743 // testing of testpattern 1 to 3 (hardcoded), 0 missing
744 // evcnt checking missing
746 Int_t cpufromchannel[] = {0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3};
751 Int_t channelcount = 0;
753 UInt_t expadcval = 0;
755 Int_t lastmcmpos = -1;
756 Int_t lastrobpos = -1;
758 UInt_t* start = fPayloadCurr;
760 while (*(fPayloadCurr) != fgkDataEndmarker &&
761 fPayloadCurr - fPayloadStart < fPayloadSize - 1) {
763 // ----- Checking MCM Header -----
764 AliDebug(2, Form("MCM header: 0x%08x", *fPayloadCurr));
767 // ----- checking for proper readout order - ROB -----
768 if (GetROBReadoutPos(ROB(*fPayloadCurr) / 2) >= lastrobpos) {
769 lastrobpos = GetROBReadoutPos(ROB(*fPayloadCurr) / 2);
774 fCurrRobPos = ROB(*fPayloadCurr);
776 // ----- checking for proper readout order - MCM -----
777 if (GetMCMReadoutPos(MCM(*fPayloadCurr)) >= (lastmcmpos + 1) % 16) {
778 lastmcmpos = GetMCMReadoutPos(MCM(*fPayloadCurr));
783 fCurrMcmPos = MCM(*fPayloadCurr);
788 evcnt = 0x3f & *fPayloadCurr >> 26;
791 while (channelcount < 21) {
793 if (cpu != cpufromchannel[channelcount]) {
794 cpu = cpufromchannel[channelcount];
795 expadcval = (1 << 9) | (fCurrRobPos << 6) | (fCurrMcmPos << 2) | cpu;
800 if (channelcount % 2 == 0)
807 expword |= expadcval << 2;
808 expadcval = ( (expadcval << 1) | ( ( (expadcval >> 9) ^ (expadcval >> 6) ) & 1) ) & 0x3FF;
809 expword |= expadcval << 12;
810 expadcval = ( (expadcval << 1) | ( ( (expadcval >> 9) ^ (expadcval >> 6) ) & 1) ) & 0x3FF;
811 expword |= expadcval << 22;
812 expadcval = ( (expadcval << 1) | ( ( (expadcval >> 9) ^ (expadcval >> 6) ) & 1) ) & 0x3FF;
814 else if (mode == 2) {
816 expword = ((0x3f & evcnt) << 26) | ((fCurrSm + 1) << 21) | ((fCurrLayer + 1) << 18) |
817 ((fCurrStack + 1) << 15) |
818 (fCurrRobPos << 12) | (fCurrMcmPos << 8) | (cpu << 6) | (wordcount + 1);
820 else if (mode == 3) {
822 expword = ((0xfff & evcnt) << 20) | (fCurrSm << 15) | (fCurrLink/2 << 12) | (fCurrStack << 9) |
823 (fCurrRobPos << 6) | (fCurrMcmPos << 2) | (cpu << 0);
827 LinkError(kTPmodeInvalid, "Just reading");
830 diff = *fPayloadCurr ^ expword;
832 MCMError(kTPmismatch,
833 "Seen 0x%08x, expected 0x%08x, diff: 0x%08x (0x%02x)",
834 *fPayloadCurr, expword, diff, 0xff & (diff | diff >> 8 | diff >> 16 | diff >> 24));;
842 // continue with next MCM
844 return fPayloadCurr - start;
848 Int_t AliTRDrawStream::ReadZSData()
850 // read the zs data from one link from the current reading position
852 UInt_t *start = fPayloadCurr;
855 Int_t mcmcountExp = fCurrStack == 2 ? 48 : 64;
856 Int_t channelcount = 0;
857 Int_t channelcountExp = 0;
858 Int_t channelcountMax = 0;
860 Int_t currentTimebin = 0;
863 Int_t lastmcmpos = -1;
864 Int_t lastrobpos = -1;
866 if (fCurrNtimebins != fNtimebins) {
868 LinkError(kNtimebinsChanged,
869 "No. of timebins changed from %i to %i", fNtimebins, fCurrNtimebins);
870 fNtimebins = fCurrNtimebins;
873 timebins = fNtimebins;
875 while (*(fPayloadCurr) != fgkDataEndmarker &&
876 fPayloadCurr - fPayloadStart < fPayloadSize) {
878 // ----- Checking MCM Header -----
879 AliDebug(2, Form("MCM header: 0x%08x", *fPayloadCurr));
880 UInt_t *startPosMCM = fPayloadCurr;
882 // ----- checking for proper readout order - ROB -----
883 if (GetROBReadoutPos(ROB(*fPayloadCurr) / 2) >= lastrobpos) {
884 lastrobpos = GetROBReadoutPos(ROB(*fPayloadCurr) / 2);
889 fCurrRobPos = ROB(*fPayloadCurr);
891 // ----- checking for proper readout order - MCM -----
892 if (GetMCMReadoutPos(MCM(*fPayloadCurr)) > lastmcmpos) {
893 lastmcmpos = GetMCMReadoutPos(lastmcmpos);
898 fCurrMcmPos = MCM(*fPayloadCurr);
900 if (EvNo(*fPayloadCurr) != evno) {
902 evno = EvNo(*fPayloadCurr);
904 MCMError(kPtrgCntMismatch, "%i <-> %i", evno, EvNo(*fPayloadCurr));
907 Int_t adccoloff = AdcColOffset(*fPayloadCurr);
908 Int_t padcoloff = PadColOffset(*fPayloadCurr);
909 Int_t row = Row(*fPayloadCurr);
912 // ----- Reading ADC channels -----
913 AliDebug(2, Form("ADC mask: 0x%08x", *fPayloadCurr));
915 // ----- analysing the ADC mask -----
917 channelcountExp = GetNActiveChannelsFromMask(*fPayloadCurr);
918 channelcountMax = GetNActiveChannels(*fPayloadCurr);
919 Int_t channelmask = GetActiveChannels(*fPayloadCurr);
920 Int_t channelno = -1;
923 if (channelcountExp != channelcountMax) {
924 if (channelcountExp > channelcountMax) {
925 Int_t temp = channelcountExp;
926 channelcountExp = channelcountMax;
927 channelcountMax = temp;
929 while (channelcountExp < channelcountMax && channelcountExp < 21 &&
930 fPayloadCurr - fPayloadStart < fPayloadSize - 10 * channelcountExp - 1) {
931 MCMError(kAdcMaskInconsistent,
932 "Possible MCM-H: 0x%08x, possible ADC-mask: 0x%08x",
933 *(fPayloadCurr + 10 * channelcountExp),
934 *(fPayloadCurr + 10 * channelcountExp + 1) );
935 if (!CouldBeMCMhdr( *(fPayloadCurr + 10 * channelcountExp)) && !CouldBeADCmask( *(fPayloadCurr + 10 * channelcountExp + 1)))
941 MCMError(kAdcMaskInconsistent,
942 "Inconsistency in no. of active channels: Counter: %i, Mask: %i, chosen: %i!",
943 GetNActiveChannels(fPayloadCurr[-1]), GetNActiveChannelsFromMask(fPayloadCurr[-1]), channelcountExp);
945 AliDebug(2, Form("expecting %i active channels, timebins: %i", channelcountExp, fCurrNtimebins));
947 // ----- reading marked ADC channels -----
948 while (channelcount < channelcountExp && *(fPayloadCurr) != fgkDataEndmarker) {
951 while (channelno < 20 && (channelmask & 1 << channelno) == 0)
954 if (fCurrNtimebins > 30) {
955 currentTimebin = ((*fPayloadCurr >> 2) & 0x3f);
956 timebins = ((*fPayloadCurr >> 8) & 0xf) * 3;
963 AliDebug(2, Form("Now looking %i words", timebins / 3));
964 Int_t adccol = adccoloff - channelno;
965 Int_t padcol = padcoloff - channelno;
966 // if (adccol < 3 || adccol > 165)
967 // AliInfo(Form("writing channel %i of det %3i %i:%2i to adcrow/-col: %i/%i padcol: %i",
968 // channelno, fCurrHC/2, fCurrRobPos, fCurrMcmPos, row, adccol, padcol));
970 while (adcwc < timebins / 3 &&
971 *(fPayloadCurr) != fgkDataEndmarker &&
972 fPayloadCurr - fPayloadStart < fPayloadSize) {
973 int check = 0x3 & *fPayloadCurr;
974 if (channelno % 2 != 0) { // odd channel
975 if (check != 0x2 && channelno < 21) {
976 MCMError(kAdcCheckInvalid,
977 "%i for %2i. ADC word in odd channel %i",
978 check, adcwc+1, channelno);
981 else { // even channel
982 if (check != 0x3 && channelno < 21) {
983 MCMError(kAdcCheckInvalid,
984 "%i for %2i. ADC word in even channel %i",
985 check, adcwc+1, channelno);
989 // filling the actual timebin data
990 int tb2 = 0x3ff & *fPayloadCurr >> 22;
991 int tb1 = 0x3ff & *fPayloadCurr >> 12;
992 int tb0 = 0x3ff & *fPayloadCurr >> 2;
993 if (adcwc != 0 || fCurrNtimebins <= 30)
994 fAdcArray->SetDataByAdcCol(row, adccol, currentTimebin++, tb0);
997 fAdcArray->SetDataByAdcCol(row, adccol, currentTimebin++, tb1);
998 fAdcArray->SetDataByAdcCol(row, adccol, currentTimebin++, tb2);
1004 if (adcwc != timebins / 3)
1005 MCMError(kAdcDataAbort);
1008 if (padcol > 0 && padcol < 144) {
1009 fSignalIndex->AddIndexRC(row, padcol);
1015 if (fCurrSm > -1 && fCurrSm < 18) {
1016 fStats.fStatsSector[fCurrSm].fStatsHC[fCurrHC%60].fNChannels += channelcount;
1017 fStats.fStatsSector[fCurrSm].fNChannels += channelcount;
1019 if (channelcount != channelcountExp)
1020 MCMError(kAdcChannelsMiss);
1023 if (fCurrSm > -1 && fCurrSm < 18) {
1024 fStats.fStatsSector[fCurrSm].fStatsHC[fCurrHC%60].fNMCMs++;
1025 fStats.fStatsSector[fCurrSm].fNMCMs++;
1028 if (IsDumping() && DumpingMCM(fCurrHC/2, fCurrRobPos, fCurrMcmPos)) {
1029 DumpRaw(Form("Event %i: Det %3i ROB %i MCM %2i", fRawReader->GetEventIndex(), fCurrHC/2, fCurrRobPos, fCurrMcmPos),
1030 startPosMCM, fPayloadCurr - startPosMCM);
1033 // continue with next MCM
1036 // check for missing MCMs (if header suppression is inactive)
1037 if (((fCurrMajor & 0x1) == 0) && (mcmcount != mcmcountExp)) {
1038 LinkError(kMissMcmHeaders,
1039 "No. of MCM headers %i not as expected: %i",
1040 mcmcount, mcmcountExp);
1043 return (fPayloadCurr - start);
1046 Int_t AliTRDrawStream::ReadNonZSData()
1048 // read the non-zs data from one link from the current reading position
1050 UInt_t *start = fPayloadCurr;
1053 Int_t mcmcountExp = fCurrStack == 2 ? 48 : 64;
1054 Int_t channelcount = 0;
1055 Int_t channelcountExp = 0;
1057 Int_t currentTimebin = 0;
1060 Int_t lastmcmpos = -1;
1061 Int_t lastrobpos = -1;
1063 if (fCurrNtimebins != fNtimebins) {
1065 LinkError(kNtimebinsChanged,
1066 "No. of timebins changed from %i to %i", fNtimebins, fCurrNtimebins);
1067 fNtimebins = fCurrNtimebins;
1070 timebins = fNtimebins;
1072 while (*(fPayloadCurr) != fgkDataEndmarker &&
1073 fPayloadCurr - fPayloadStart < fPayloadSize - 2) {
1075 // ----- Checking MCM Header -----
1076 AliDebug(2, Form("MCM header: 0x%08x", *fPayloadCurr));
1078 // ----- checking for proper readout order - ROB -----
1079 if (GetROBReadoutPos(ROB(*fPayloadCurr) / 2) >= lastrobpos) {
1080 lastrobpos = GetROBReadoutPos(ROB(*fPayloadCurr) / 2);
1083 ROBError(kPosUnexp);
1085 fCurrRobPos = ROB(*fPayloadCurr);
1087 // ----- checking for proper readout order - MCM -----
1088 if (GetMCMReadoutPos(MCM(*fPayloadCurr)) >= (lastmcmpos + 1) % 16) {
1089 lastmcmpos = GetMCMReadoutPos(*fPayloadCurr);
1092 MCMError(kPosUnexp);
1094 fCurrMcmPos = MCM(*fPayloadCurr);
1096 if (EvNo(*fPayloadCurr) != evno) {
1098 evno = EvNo(*fPayloadCurr);
1100 MCMError(kPtrgCntMismatch, "%i <-> %i", evno, EvNo(*fPayloadCurr));
1105 channelcountExp = 21;
1108 Int_t adccoloff = AdcColOffset(*fPayloadCurr);
1109 Int_t padcoloff = PadColOffset(*fPayloadCurr);
1110 Int_t row = Row(*fPayloadCurr);
1114 // ----- reading marked ADC channels -----
1115 while (channelcount < channelcountExp &&
1116 *(fPayloadCurr) != fgkDataEndmarker) {
1123 AliDebug(2, Form("Now looking %i words", timebins / 3));
1124 Int_t adccol = adccoloff - channelno;
1125 Int_t padcol = padcoloff - channelno;
1126 while (adcwc < timebins / 3 &&
1127 *(fPayloadCurr) != fgkDataEndmarker &&
1128 fPayloadCurr - fPayloadStart < fPayloadSize) {
1129 int check = 0x3 & *fPayloadCurr;
1130 if (channelno % 2 != 0) { // odd channel
1131 if (check != 0x2 && channelno < 21) {
1132 MCMError(kAdcCheckInvalid,
1133 "%i for %2i. ADC word in odd channel %i",
1134 check, adcwc+1, channelno);
1137 else { // even channel
1138 if (check != 0x3 && channelno < 21) {
1139 MCMError(kAdcCheckInvalid,
1140 "%i for %2i. ADC word in even channel %i",
1141 check, adcwc+1, channelno);
1145 // filling the actual timebin data
1146 int tb2 = 0x3ff & *fPayloadCurr >> 22;
1147 int tb1 = 0x3ff & *fPayloadCurr >> 12;
1148 int tb0 = 0x3ff & *fPayloadCurr >> 2;
1149 if (adcwc != 0 || fCurrNtimebins <= 30)
1150 fAdcArray->SetDataByAdcCol(row, adccol, currentTimebin++, tb0);
1153 fAdcArray->SetDataByAdcCol(row, adccol, currentTimebin++, tb1);
1154 fAdcArray->SetDataByAdcCol(row, adccol, currentTimebin++, tb2);
1160 if (adcwc != timebins / 3)
1161 MCMError(kAdcDataAbort);
1164 if (padcol > 0 && padcol < 144) {
1165 fSignalIndex->AddIndexRC(row, padcol);
1171 if (channelcount != channelcountExp)
1172 MCMError(kAdcChannelsMiss);
1174 // continue with next MCM
1177 // check for missing MCMs (if header suppression is inactive)
1178 if (mcmcount != mcmcountExp) {
1179 LinkError(kMissMcmHeaders,
1180 "%i not as expected: %i", mcmcount, mcmcountExp);
1183 return (fPayloadCurr - start);
1186 Int_t AliTRDrawStream::SeekNextLink()
1188 // proceed in raw data stream till the next link
1190 UInt_t *start = fPayloadCurr;
1192 // read until data endmarkers
1193 while (fPayloadCurr - fPayloadStart < fPayloadSize &&
1194 *fPayloadCurr != fgkDataEndmarker)
1197 // read all data endmarkers
1198 while (fPayloadCurr - fPayloadStart < fPayloadSize &&
1199 *fPayloadCurr == fgkDataEndmarker)
1202 return (fPayloadCurr - start);
1205 Bool_t AliTRDrawStream::ConnectTracklets(TTree *trklTree)
1207 // connect the tracklet tree used to store the tracklet output
1209 fTrackletTree = trklTree;
1213 if (!fTrackletTree->GetBranch("hc"))
1214 fTrackletTree->Branch("hc", &fCurrHC, "hc/I");
1216 fTrackletTree->SetBranchAddress("hc", &fCurrHC);
1218 if (!fTrackletTree->GetBranch("trkl"))
1219 fTrackletTree->Branch("trkl", &fTrackletArray);
1221 fTrackletTree->SetBranchAddress("trkl", &fTrackletArray);
1227 void AliTRDrawStream::EquipmentError(ErrorCode_t err, const char *const msg, ...)
1229 // register error according to error code on equipment level
1230 // and return the corresponding error message
1232 fLastError.fSector = fCurrEquipmentId - 1024;
1233 fLastError.fStack = -1;
1234 fLastError.fLink = -1;
1235 fLastError.fRob = -1;
1236 fLastError.fMcm = -1;
1237 fLastError.fError = err;
1238 (this->*fStoreError)();
1241 if (fgErrorDebugLevel[err] > 10)
1242 AliDebug(fgErrorDebugLevel[err],
1243 Form("Event %6i: Eq. %2d - %s : %s",
1244 fRawReader->GetEventIndex(), fCurrEquipmentId, fgkErrorMessages[err],
1245 (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) ));
1247 AliError(Form("Event %6i: Eq. %2d - %s : %s",
1248 fRawReader->GetEventIndex(), fCurrEquipmentId, fgkErrorMessages[err],
1249 (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) ));
1250 fErrorFlags |= fgErrorBehav[err];
1254 void AliTRDrawStream::StackError(ErrorCode_t err, const char *const msg, ...)
1256 // register error according to error code on stack level
1257 // and return the corresponding error message
1259 fLastError.fSector = fCurrEquipmentId - 1024;
1260 fLastError.fStack = fCurrSlot;
1261 fLastError.fLink = -1;
1262 fLastError.fRob = -1;
1263 fLastError.fMcm = -1;
1264 fLastError.fError = err;
1265 (this->*fStoreError)();
1268 if (fgErrorDebugLevel[err] > 0)
1269 AliDebug(fgErrorDebugLevel[err],
1270 Form("Event %6i: Eq. %2d S %i - %s : %s",
1271 fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fgkErrorMessages[err],
1272 (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) ));
1274 AliError(Form("Event %6i: Eq. %2d S %i - %s : %s",
1275 fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fgkErrorMessages[err],
1276 (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) ));
1277 fErrorFlags |= fgErrorBehav[err];
1281 void AliTRDrawStream::LinkError(ErrorCode_t err, const char *const msg, ...)
1283 // register error according to error code on link level
1284 // and return the corresponding error message
1286 fLastError.fSector = fCurrEquipmentId - 1024;
1287 fLastError.fStack = fCurrSlot;
1288 fLastError.fLink = fCurrLink;
1289 fLastError.fRob = -1;
1290 fLastError.fMcm = -1;
1291 fLastError.fError = err;
1292 (this->*fStoreError)();
1295 if (fgErrorDebugLevel[err] > 0)
1296 AliDebug(fgErrorDebugLevel[err],
1297 Form("Event %6i: Eq. %2d S %i l %2i - %s : %s",
1298 fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fCurrLink, fgkErrorMessages[err],
1299 (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) ));
1301 AliError(Form("Event %6i: Eq. %2d S %i l %2i - %s : %s",
1302 fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fCurrLink, fgkErrorMessages[err],
1303 (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) ));
1304 fErrorFlags |= fgErrorBehav[err];
1308 void AliTRDrawStream::ROBError(ErrorCode_t err, const char *const msg, ...)
1310 // register error according to error code on ROB level
1311 // and return the corresponding error message
1313 fLastError.fSector = fCurrEquipmentId - 1024;
1314 fLastError.fStack = fCurrSlot;
1315 fLastError.fLink = fCurrLink;
1316 fLastError.fRob = fCurrRobPos;
1317 fLastError.fMcm = -1;
1318 fLastError.fError = err;
1319 (this->*fStoreError)();
1322 if (fgErrorDebugLevel[err] > 0)
1323 AliDebug(fgErrorDebugLevel[err],
1324 Form("Event %6i: Eq. %2d S %i l %2i ROB %i - %s : %s",
1325 fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fCurrLink, fCurrRobPos, fgkErrorMessages[err],
1326 (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) ));
1328 AliError(Form("Event %6i: Eq. %2d S %i l %2i ROB %i - %s : %s",
1329 fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fCurrLink, fCurrRobPos, fgkErrorMessages[err],
1330 (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) ));
1331 fErrorFlags |= fgErrorBehav[err];
1335 void AliTRDrawStream::MCMError(ErrorCode_t err, const char *const msg, ...)
1337 // register error according to error code on MCM level
1338 // and return the corresponding error message
1340 fLastError.fSector = fCurrEquipmentId - 1024;
1341 fLastError.fStack = fCurrSlot;
1342 fLastError.fLink = fCurrLink;
1343 fLastError.fRob = fCurrRobPos;
1344 fLastError.fMcm = fCurrMcmPos;
1345 fLastError.fError = err;
1346 (this->*fStoreError)();
1349 if (fgErrorDebugLevel[err] > 0)
1350 AliDebug(fgErrorDebugLevel[err],
1351 Form("Event %6i: Eq. %2d S %i l %2i ROB %i MCM %2i - %s : %s",
1352 fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fCurrLink, fCurrRobPos, fCurrMcmPos, fgkErrorMessages[err],
1353 (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) ));
1355 AliError(Form("Event %6i: Eq. %2d S %i l %2i ROB %i MCM %2i - %s : %s",
1356 fRawReader->GetEventIndex(), fCurrEquipmentId, fCurrSlot, fCurrLink, fCurrRobPos, fCurrMcmPos, fgkErrorMessages[err],
1357 (va_start(ap, msg), vsprintf(fErrorBuffer, msg, ap), va_end(ap), fErrorBuffer) ));
1358 fErrorFlags |= fgErrorBehav[err];
1361 const char* AliTRDrawStream::GetErrorMessage(ErrorCode_t errCode)
1363 // return the error message for the given error code
1365 if (errCode > 0 && errCode < kLastErrorCode)
1366 return fgkErrorMessages[errCode];
1371 void AliTRDrawStream::AliTRDrawStats::ClearStats()
1373 // clear statistics (includes clearing sector-wise statistics)
1376 for (Int_t iSector = 0; iSector < 18; iSector++) {
1377 fStatsSector[iSector].ClearStats();
1382 void AliTRDrawStream::AliTRDrawStats::AliTRDrawStatsSector::ClearStats()
1384 // clear statistics (includes clearing HC-wise statistics)
1392 for (Int_t iHC = 0; iHC < 60; iHC++) {
1393 fStatsHC[iHC].ClearStats();
1397 void AliTRDrawStream::AliTRDrawStats::AliTRDrawStatsSector::AliTRDrawStatsHC::ClearStats()
1408 void AliTRDrawStream::SetDumpMCM(Int_t det, Int_t rob, Int_t mcm, Bool_t dump)
1410 // mark MCM for dumping of raw data
1413 fDumpMCM[fNDumpMCMs++] = (det << 7) | (rob << 4) | mcm;
1417 for (iMCM = 0; iMCM < fNDumpMCMs; iMCM++) {
1418 if (fDumpMCM[iMCM] == ((det << 7) | (rob << 4) | mcm)) {
1423 for ( ; iMCM < fNDumpMCMs; iMCM++) {
1424 fDumpMCM[iMCM] = fDumpMCM[iMCM+1];
1429 Bool_t AliTRDrawStream::DumpingMCM(Int_t det, Int_t rob, Int_t mcm) const
1431 // check if MCM data should be dumped
1433 for (Int_t iMCM = 0; iMCM < fNDumpMCMs; iMCM++) {
1434 if (fDumpMCM[iMCM] == ((det << 7) | (rob << 4) | mcm)) {
1441 void AliTRDrawStream::DumpRaw(TString title, UInt_t *start, Int_t length)
1447 for ( ; pos+3 < length; pos += 4) {
1448 title += Form("0x%08x 0x%08x 0x%08x 0x%08x\n",
1449 start[pos+0], start[pos+1], start[pos+2], start[pos+3]);
1451 for ( ; pos < length; pos++) {
1452 title += Form("0x%08x ", start[pos]);
1457 AliTRDrawStream::AliTRDrawStreamError::AliTRDrawStreamError(Int_t error, Int_t sector, Int_t stack, Int_t link, Int_t rob, Int_t mcm) :