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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // This class provides access to TRD digits in raw data. //
22 // It loops over all TRD digits in the raw data given by the AliRawReader. //
23 // The Next method goes to the next digit. If there are no digits left //
24 // it returns kFALSE. //
25 // Several getters provide information about the current digit. //
27 // Author: M. Ploskon (ploskon@ikf.uni-frankfurt.de) //
29 ///////////////////////////////////////////////////////////////////////////////
33 #include "TTreeStream.h"
35 #include "AliTRDrawStreamTB.h"
36 #include "AliTRDgeometry.h"
37 #include "AliTRDfeeParam.h"
38 #include "AliTRDdigitsManager.h"
39 #include "AliTRDdataArrayS.h"
40 #include "AliTRDdataArrayI.h"
41 #include "AliTRDdataArrayDigits.h"
42 #include "AliTRDSignalIndex.h"
43 #include "AliTRDReconstructor.h"
44 #include "AliTRDrecoParam.h"
45 #include "AliTRDcalibDB.h"
46 #include "Cal/AliTRDCalPadStatus.h"
49 #include "AliRawReader.h"
51 #define END_OF_TRACKLET_MARKEROLD 0xaaaaaaaa
52 #define END_OF_TRACKLET_MARKERNEW 0x10001000
53 #define ENDOFRAWDATAMARKER 0x00000000
55 #define WORD_SIZE sizeof(UInt_t) // size of a word in bytes
56 #define EXTRA_LEAD_WORDS 24
59 #define IS_BIT_SET(w,b) ( ((w) >> (b)) & 0x1 ) // 1 if bit b is set in word w
60 #define GET_VALUE_AT(w,m,s) (( (w) >> (s)) & (m) ) // get value of word w rshifted by s and mask with m
62 // SM index word masks:
63 #define SM_HEADER_SIZE(w) GET_VALUE_AT(w,0xffff,16)
64 #define TRACKLETS_ENABLED(w) IS_BIT_SET(w,5)
65 #define STACK_MASK(w) ((w) & 0x1f)
68 #define STACK_HEADER_SIZE(w) GET_VALUE_AT(w,0xffff,16)
69 #define STACK_LINK_WORD(w) ((w) & 0xfff)
72 //#define HC_HEADER_MASK_ERR(w) ( ((w) & (0x80000003)) == (0x80000001) ? 0 : 1) // 0 if OK!!!
73 #define HC_HEADER_MASK_ERR(w) ( ((w) & (0x3)) == (0x1) ? 0 : 1) // 0 if OK!!!
76 #define HC_SPECIAL_RAW_VERSION(w) IS_BIT_SET(w,31)
77 #define HC_MAJOR_RAW_VERSION(w) GET_VALUE_AT(w,0x7f,24)
78 #define HC_MAJOR_RAW_VERSION_OPT(w) GET_VALUE_AT(w,0x7,24)
79 #define HC_MINOR_RAW_VERSION(w) GET_VALUE_AT(w,0x7f,17)
80 #define HC_EXTRA_WORDS(w) GET_VALUE_AT(w,0x7,14)
81 #define HC_DCS_BOARD(w) GET_VALUE_AT(w,0xfff<<20,20)
82 #define HC_SM_NUMBER(w) GET_VALUE_AT(w,0x1f,9)
83 #define HC_LAYER_NUMBER(w) GET_VALUE_AT(w,0x7,6)
84 #define HC_STACK_NUMBER(w) GET_VALUE_AT(w,0x7,3)
85 #define HC_SIDE_NUMBER(w) IS_BIT_SET(w,2)
88 #define HC_NTIMEBINS(w) GET_VALUE_AT(w,0x3f,26)
89 #define HC_BUNCH_CROSS_COUNTER(w) GET_VALUE_AT(w,0xffff,10)
90 #define HC_PRETRIGGER_COUNTER(w) GET_VALUE_AT(w,0xf,6)
91 #define HC_PRETRIGGER_PHASE(w) GET_VALUE_AT(w,0xf,6)
93 //--------------------------------------------------------
95 // MCM word and ADC mask
96 #define MCM_HEADER_MASK_ERR(w) ( ((w) & (0xf)) == (0xc) ? 0 : 1) // 0 if OK!!!
97 #define MCM_ADCMASK_MASK_ERR(w) ( ((w) & (0xf)) == (0xc) ? 0 : 1) // 0 if OK!!!
98 #define MCM_MCM_NUMBER(w) GET_VALUE_AT(w,0x0f,24)
99 #define MCM_ROB_NUMBER(w) GET_VALUE_AT(w,0x7,28)
100 #define MCM_EVENT_COUNTER(w) GET_VALUE_AT(w,0x00fffff,4)
101 #define MCM_ADCMASK_VAL(w) GET_VALUE_AT(w,0x1fffff,4)
102 #define MCM_ADCMASK_NADC(w) GET_VALUE_AT(w,0x1f,25)
104 #define MCM_DUMMY_ADCMASK_VAL 0x015fffffc // updated
105 //#define MCM_DUMMY_ADCMASK_VAL 0x001fffffc
106 //--------------------------------------------------------
108 #define MAX_TRACKLETS_PERHC 256 // max number of tracklets per HC - large number for now
110 //--------------------------------------------------------
111 #define ADC_WORD_MASK(w) ((w) & 0x3)
112 //--------------------------------------------------------
115 ClassImp(AliTRDrawStreamTB)
117 Bool_t AliTRDrawStreamTB::fgExtraSkip = kFALSE;
118 Bool_t AliTRDrawStreamTB::fgSkipCDH = kFALSE;
119 Bool_t AliTRDrawStreamTB::fgWarnError = kTRUE;
120 Bool_t AliTRDrawStreamTB::fgCleanDataOnly = kTRUE;
121 Bool_t AliTRDrawStreamTB::fgDebugFlag = kTRUE;
122 Bool_t AliTRDrawStreamTB::fgDebugStreamFlag = kFALSE;
123 Bool_t AliTRDrawStreamTB::fgStackNumberChecker = kTRUE;
124 Bool_t AliTRDrawStreamTB::fgStackLinkNumberChecker = kTRUE;
125 Bool_t AliTRDrawStreamTB::fgSkipData = kTRUE;
126 TTreeSRedirector *AliTRDrawStreamTB::fgDebugStreamer = 0;
127 UInt_t AliTRDrawStreamTB::fgStreamEventCounter = 0;
128 UInt_t AliTRDrawStreamTB::fgFirstEquipmentID = 0;
129 UInt_t AliTRDrawStreamTB::fgDumpHead = 0;
130 Int_t AliTRDrawStreamTB::fgCommonAdditive = 0;
131 Int_t AliTRDrawStreamTB::fgEmptySignals[] =
133 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
134 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
137 AliTRDrawStreamTB::AliTRDrawStreamTB()
138 : AliTRDrawStreamBase()
151 , fStackLinkNumber(-1)
154 , fLinkTrackletCounter(-1)
155 , fEndOfTrackletCount(-1)
160 , fLastEventCounter(0)
161 , fSharedPadsOn(kFALSE)
166 , fDebugStreamOwned(kFALSE)
169 // default constructor
172 if (Init() == kFALSE)
174 AliWarning("Unable to Init.");
178 //--------------------------------------------------------
179 AliTRDrawStreamTB::AliTRDrawStreamTB(AliRawReader *rawReader)
180 : AliTRDrawStreamBase(rawReader)
193 , fStackLinkNumber(-1)
196 , fLinkTrackletCounter(-1)
197 , fEndOfTrackletCount(-1)
202 , fLastEventCounter(0)
203 , fSharedPadsOn(kFALSE)
206 , fRawReader(rawReader)
208 , fDebugStreamOwned(kFALSE)
211 // default constructor
215 if (Init() == kFALSE)
217 AliWarning("Unable to Init. Try setting up the reader with SetReader or buffer with Init(void *, UInt_t )");
222 AliWarning("Unable to setup reader. Use SetReader(AliRawReader*).");
226 //------------------------------------------------------------
228 AliTRDrawStreamTB::AliTRDrawStreamTB(const AliTRDrawStreamTB& /*st*/)
229 : AliTRDrawStreamBase()
242 , fStackLinkNumber(-1)
245 , fLinkTrackletCounter(-1)
246 , fEndOfTrackletCount(-1)
251 , fLastEventCounter(0)
252 , fSharedPadsOn(kFALSE)
257 , fDebugStreamOwned(kFALSE)
262 AliError("Not implemeneted.");
265 //------------------------------------------------------------
266 Bool_t AliTRDrawStreamTB::SetRawVersion(Int_t fraw)
269 // function provided for backward compatibility
271 AliWarning("Raw data version is read from raw data stream! No point of setting it in here.");
272 fraw = 0; // avoid warnings
276 //------------------------------------------------------------
277 AliTRDrawStreamTB::~AliTRDrawStreamTB()
284 if (fDebugStreamOwned == kTRUE)
288 delete fgDebugStreamer;
294 //------------------------------------------------------------
297 AliTRDrawStreamTB::operator=(const AliTRDrawStreamTB &)
300 // we are not using this functionality
302 AliFatal("May not use.");
306 //------------------------------------------------------------
309 AliTRDrawStreamTB::EnableDebug(TTreeSRedirector *debugStream)
312 // replace the current debug streamer or create a new one if owned
315 if (debugStream == 0)
317 if (fDebugStreamOwned == kTRUE)
320 delete fgDebugStreamer;
323 fDebugStreamOwned = kTRUE;
324 fgDebugStreamer = new TTreeSRedirector("TRDrawDataDebug.root");
325 fgStreamEventCounter = 0;
330 if (fDebugStreamOwned == kTRUE)
333 delete fgDebugStreamer;
336 fgDebugStreamer = debugStream;
337 fDebugStreamOwned = kFALSE;
341 //___________________________________________________________
343 AliTRDrawStreamTB::SwapOnEndian()
346 // Check the endian and swap if needed
350 char* ptemp = (char*) &itemp;
354 if (fgDebugFlag) AliDebug(8, "Swapping.");
358 while (fpPos < fpEnd)
361 iutmp = (((*fpPos & 0x000000ffU) << 24) | ((*fpPos & 0x0000ff00U) << 8) |
362 ((*fpPos & 0x00ff0000U) >> 8) | ((*fpPos & 0xff000000U) >> 24));
363 // here we override the value in the buffer!
370 //------------------------------------------------------------
372 AliTRDrawStreamTB::DumpErrorCount()
375 // print the error statistics into the stdout
379 // AliInfo(Form("Error counts: HC0 %d HC1 %d MCM %d ADCmask %d ADC %d",
380 // fHC->fH0ErrorCounter, fHC->fH1ErrorCounter, fMCM->fErrorCounter, fMCM->fMaskErrorCounter, adc.fErrorCounter));
383 //------------------------------------------------------------
385 AliTRDrawStreamTB::DumpWords(UInt_t *px, UInt_t iw, UInt_t marker)
389 // note: can be made faster
392 TString tsreturn = Form("\n[ Dump Sequence at 0x%08x ] : ", px);
393 for (UInt_t i = 0; i < iw; i++)
395 if (px + iw >= fpEnd)
400 if (marker != 0 && marker == px[i])
401 tsreturn += Form(" *>0x%08x<* ", px[i]);
403 tsreturn += Form("0x%08x ", px[i]);
407 AliInfo(tsreturn.Data());
412 //------------------------------------------------------------
414 AliTRDrawStreamTB::SkipWords(UInt_t iw)
418 // note: can be made faster
421 if ( fpPos + iw < fpEnd )
428 if (fgWarnError) AliWarning(Form("Skip %d words failed. %d available", iw, fpEnd - fpPos - 1));
431 TTreeSRedirector &cstream = *fgDebugStreamer;
432 cstream << "SkipWords"
433 << "Event=" << fgStreamEventCounter
435 // << ".read=" << (Char_t*)(fpPos - fpBegin)
436 // << ".togo=" << (Char_t*)(fpEnd - fpPos)
437 // << ".length=" << (Char_t*)(fpEnd - fpBegin)
446 //------------------------------------------------------------
448 AliTRDrawStreamTB::SetReader(AliRawReader *reader)
463 AliWarning("Unable to setup reader.");
469 AliWarning("AliRawReader argument is 0.");
476 //------------------------------------------------------------
478 AliTRDrawStreamTB::NextBuffer()
481 // return -1 if no more buffers available
482 // return 0 DecodeSM failed (clean data required for example) but still maybe more data to come
483 // return 1 DecodeSM OK
490 Bool_t kBufferSet = fRawReader->ReadNextData(buffer);
491 if (kBufferSet == kTRUE)
493 if (fgDebugFlag) AliDebug(9, "Buffer is set.");
494 length = fRawReader->GetDataSize();
495 if (fgExtraSkip == kTRUE)
497 buffer += EXTRA_LEAD_WORDS * WORD_SIZE;
498 length -= EXTRA_LEAD_WORDS * WORD_SIZE;
501 if (fgSkipCDH == kTRUE)
503 buffer += CDH_WORDS * WORD_SIZE;
504 length -= CDH_WORDS * WORD_SIZE;
509 if (fgDebugFlag) AliDebug(9, Form("Buffer length : %d", length));
510 //return InitBuffer((void*)buffer, length);
511 if (DecodeSM((void*)buffer, length) == kTRUE)
526 //------------------------------------------------------------
528 AliTRDrawStreamTB::ResetCounters()
531 // reset some global counters
535 fStackLinkNumber = 0;
539 fSM.fActiveStacks = 0;
540 fSM.fNexpectedHalfChambers = 0;
542 fLinkTrackletCounter = 0;
544 fLastEventCounter = 0;
548 //------------------------------------------------------------
550 AliTRDrawStreamTB::ResetIterators()
553 // reset the data iterators used in the Next()
556 fStackLinkNumber = 0;
561 //------------------------------------------------------------
564 AliTRDrawStreamTB::Next()
567 // returns with true on next adc read
568 // returns false on errors and end of buffer
571 while (fStackNumber < 5 && fSM.fActiveStacks > 0)
573 if(fSM.fStackActive[fStackNumber] == kTRUE)
575 fStack = &fSM.fStacks[fStackNumber];
576 while (fStackLinkNumber < 12)
578 if (fStack->fLinksActive[fStackLinkNumber] == kTRUE)
580 fHC = &fStack->fHalfChambers[fStackLinkNumber];
583 AliError(Form("Super Strange. HC missing at stack %d link %d", fStackNumber, fStackLinkNumber));
586 if (fHC->fCorrupted == 0)
588 while (fhcMCMcounter < fHC->fMCMmax)
590 fMCM = &fHC->fMCMs[fhcMCMcounter];
593 AliError(Form("Super Strange. HC missing at stack %d link %d atMCMslot %d",
594 fStackNumber, fStackLinkNumber, fhcMCMcounter));
597 while(fmcmADCcounter < fMCM->fADCmax)
599 fADC = &fMCM->fADCs[fmcmADCcounter];
602 AliError(Form("Super Strange. ADC missing at stack %d link %d MCMslot %d ADCslot %d",
603 fStackNumber, fStackLinkNumber, fhcMCMcounter, fmcmADCcounter));
613 if (fADC->fIsShared == kFALSE)
618 // next MCM should go through all active ADCs
624 // next stack link (HC) should go through all active MCMs
629 // next stack should go through all links - start from 0
630 fStackLinkNumber = 0;
633 // in case rawreader manages the mem buffers
634 // lets go for the next buffer
637 Int_t nextBuff = NextBuffer();
638 while (nextBuff != -1)
642 nextBuff = NextBuffer();
649 //------------------------------------------------------------
652 AliTRDrawStreamTB::NextChamber(AliTRDdigitsManager *digitsManager)
655 // Fills single chamber digit array
656 // Return value is the detector number
659 AliTRDcalibDB *cal = AliTRDcalibDB::Instance();
660 AliTRDdataArrayDigits *digits = 0;
661 AliTRDdataArrayI *track0 = 0;
662 AliTRDdataArrayI *track1 = 0;
663 AliTRDdataArrayI *track2 = 0;
664 AliTRDSignalIndex *indexes = 0;
666 // Get the ADC baseline
667 Int_t adcBaseline = 0;
668 if (!AliTRDReconstructor::RecoParam())
670 AliError("RecoParam does not exist\n");
675 adcBaseline = ((Int_t) AliTRDReconstructor::RecoParam()->GetADCbaseline());
678 // Loop through the digits
681 // Int_t returnDet = -1;
689 // If new detector found
699 if (det < 0 || det >= AliTRDgeometry::kNdet)
701 if (fSM.fClean == kTRUE)
703 AliError(Form("Strange Det Number %d BUT event buffer seems to be clean.", det));
707 AliError(Form("Strange Det Number %d. Event buffer marked NOT clean!", det));
712 // Add a container for the digits of this detector
713 digits = (AliTRDdataArrayDigits *) digitsManager->GetDigits(det);
715 if (digitsManager->UsesDictionaries())
717 track0 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,0);
718 track1 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,1);
719 track2 = (AliTRDdataArrayI *) digitsManager->GetDictionary(det,2);
724 if (fSM.fClean == kTRUE)
726 AliError(Form("Unable to get digits for det %d BUT event buffer seems to be clean.", det));
730 AliError(Form("Unable to get digits for det %d. Event buffer is NOT clean!", det));
736 Int_t rowMax = GetRowMax();
737 Int_t colMax = GetColMax();
738 Int_t ntbins = GetNumberOfTimeBins();
740 // Allocate memory space for the digits buffer
741 if (digits->GetNtime() == 0)
743 digits->Allocate(rowMax, colMax, ntbins);
744 if (digitsManager->UsesDictionaries())
746 track0->Allocate(rowMax, colMax, ntbins);
747 track1->Allocate(rowMax, colMax, ntbins);
748 track2->Allocate(rowMax, colMax, ntbins);
752 indexes = digitsManager->GetIndexes(det);
753 indexes->SetSM(GetSM());
754 indexes->SetStack(GetStack());
755 indexes->SetLayer(GetLayer());
756 indexes->SetDetNumber(det);
757 if (indexes->IsAllocated() == kFALSE)
758 indexes->Allocate(rowMax, colMax, ntbins);
761 Char_t padStatus = cal->GetPadStatus(det, GetCol(), GetRow());
763 // ntimebins data are ready to read
764 for (it = 0; it < GetNumberOfTimeBins(); it++)
766 if ((GetSignals()[it] - adcBaseline) > 0)
768 digits->SetDataUnchecked(GetRow(), GetCol(), it, GetSignals()[it] - adcBaseline);
769 digits->SetPadStatus(GetRow(), GetCol(), it, padStatus);
771 indexes->AddIndexTBin(GetRow(), GetCol(), it);
772 if (digitsManager->UsesDictionaries())
774 track0->SetDataUnchecked(GetRow(), GetCol(), it, 0);
775 track1->SetDataUnchecked(GetRow(), GetCol(), it, 0);
776 track2->SetDataUnchecked(GetRow(), GetCol(), it, 0);
782 // what happens if the last HC is turned off?
787 //------------------------------------------------------------
789 AliTRDrawStreamTB::Init()
795 TDirectory *saveDir = gDirectory;
799 fGeometry = new AliTRDgeometry();
804 AliError("Geometry FAILED!");
808 fTRDfeeParam = AliTRDfeeParam::Instance();
811 AliError("AliTRDfeeParam FAILED!");
815 fMaxADCgeom = (Int_t)fGeometry->ADCmax();
817 // common additive is moved to be static for temp solution
818 // common additive should be delivered in the HC word 2 (3rd word)
819 //fCommonAdditive = 10;
823 if (fgDebugStreamFlag == kTRUE)
825 if (!fgDebugStreamer)
827 fgDebugStreamer = new TTreeSRedirector("TRDrawDataDebug.root");
828 fgStreamEventCounter = 0;
832 AliInfo(Form("Debug Streamer Initialized! Remember to delete! %s::DeleteDebugStream()", this->IsA()->GetName()));
833 //fDebugStreamOwned = kTRUE;
837 AliError("Unable to init debug stream");
842 // in case rawreader manages the mem buffers
843 // lets go for the next buffer
846 Int_t nextBuff = NextBuffer();
847 while (nextBuff != -1)
851 nextBuff = NextBuffer();
860 void AliTRDrawStreamTB::DeleteDebugStream()
863 // static helper function
868 delete fgDebugStreamer;
874 //------------------------------------------------------------
876 AliTRDrawStreamTB::InitBuffer(void *buffer, UInt_t length)
879 // init the class before reading from the buffer
880 // and read SM heading info:
881 // -- super module header
882 // -- stack headers + link status words
885 // not in the pre scan mode
887 if(fgStreamEventCounter == 0) fgFirstEquipmentID = fRawReader->GetEquipmentId();
888 fEquipmentID = fRawReader->GetEquipmentId();
889 //fgStreamEventCounter++;
890 if(fEquipmentID == fgFirstEquipmentID) fgStreamEventCounter++;
895 fpBegin = (UInt_t *)buffer;
899 AliFatal("Strange! Size of UInt_t == 0");
903 fWordLength = length/WORD_SIZE;
904 fpEnd = fpBegin + fWordLength;
907 if (fpBegin == 0 || length <= 0)
909 AliError(Form("This will not work! Pointer to the buffer is 0x%08x of size %d", fpBegin, length));
917 AliInfo("------------------------------------------------");
918 if (DumpWords(fpBegin, fgDumpHead) == kFALSE)
920 AliError("Dump failed. Not enough data.");
922 AliInfo("------------------------------------------------");
926 DecodeSMInfo(fpPos, &fSM);
928 if (fgDebugFlag) AliDebug(5, DumpSMInfo(&fSM));
933 if (SkipWords(fSM.fHeaderSize) == kTRUE)
936 //for (Int_t istack = 0; istack < fSM.fActiveStacks; istack++)
937 for (Int_t istack = 0; istack < 5; istack++)
939 if (fSM.fStackActive[istack] == kFALSE)
942 fStack = &fSM.fStacks[istack];
943 DecodeStackInfo(fpPos, fStack);
946 fSM.fNexpectedHalfChambers += fStack->fActiveLinks;
948 if (fgDebugFlag) AliDebug(5, DumpStackInfo(fStack));
950 if (SkipWords(fStack->fHeaderSize) == kFALSE)
952 if (fRawReader) fRawReader->AddMajorErrorLog(kDecodeStackInfo, "Stack head words missing");
964 if (fgWarnError) AliWarning("No Stack info present. Strange.");
965 if (fRawReader) fRawReader->AddMajorErrorLog(kDecodeStackInfo, "Stack info missing");
969 if (fgDebugFlag) AliDebug(5, Form("Expected half chambers : %d", fSM.fNexpectedHalfChambers));
974 if (fgDebugFlag) AliDebug(5, "Init OK.");
978 if (fgWarnError) AliWarning("No data just after init. Strange.");
979 if (fRawReader) fRawReader->AddMajorErrorLog(kMissingData, "Missing data");
986 //------------------------------------------------------------
988 AliTRDrawStreamTB::DecodeSM(void *buffer, UInt_t length)
991 // decode all sm at once
992 // still here for devel and debug
995 //memset(&fSM, 0, sizeof(fSM));
1000 if (InitBuffer(buffer, length) == kTRUE)
1002 // no we are already set!
1007 if (fgWarnError) AliError("--- INIT failed. ---------------");
1008 fSM.fClean = kFALSE;
1014 for (Int_t istack = 0; istack < 5; istack++)
1016 fStackNumber = istack;
1017 if (fSM.fStackActive[istack] == kFALSE)
1020 fStack = &fSM.fStacks[istack];
1022 //fStack[istack].fActiveLinks // max is 12
1023 for (Int_t ilink = 0; ilink < 12; ilink++)
1025 fStackLinkNumber = ilink;
1026 if (fStack->fLinksActive[ilink] == kFALSE)
1031 if (fRawReader) fRawReader->AddMajorErrorLog(kLinkDataMissing, "Link data missing");
1032 fSM.fClean = kFALSE;
1036 fHC = &fStack->fHalfChambers[ilink];
1038 if (fgDebugStreamer)
1040 TTreeSRedirector &cstream = *fgDebugStreamer;
1041 cstream << "LINKDataStream"
1042 << "Event=" << fgStreamEventCounter
1043 << ".equipID=" << fEquipmentID
1044 << ".stack=" << fStackNumber
1045 << ".link=" << fStackLinkNumber
1050 if (fSM.fTrackletEnable == kTRUE)
1052 if (DecodeTracklets() == kFALSE)
1054 if (fgDebugStreamer)
1056 TTreeSRedirector &cstream = *fgDebugStreamer;
1057 cstream << "TrackletDecodeError"
1058 << "Event=" << fgStreamEventCounter
1059 << ".Stack=" << fStackNumber
1060 << ".Link=" << fStackLinkNumber
1061 << ".EndOfTrackletCount=" << fEndOfTrackletCount
1065 fSM.fClean = kFALSE;
1070 AliError(Form("Failed stack %d link %d", fStackNumber, fStackLinkNumber));
1071 AliError(Form("Debug Event Counter : %d", fgStreamEventCounter));
1080 if (fRawReader) fRawReader->AddMajorErrorLog(kHCdataMissing, "HC data missing");
1081 fSM.fClean = kFALSE;
1085 if (DecodeHC() == kFALSE)
1087 fSM.fClean = kFALSE;
1090 AliError(Form("Dumping Words for Debugging Purpose =========================>"));
1091 DumpWords(fpPos-8, 16);
1092 AliError(Form("Dumping Done!"));
1094 if (fHC->fCorrupted < 16) SeekEndOfData(); // In case that we meet END_OF_TRACKLET_MARKERNEW during ADC data decoding or MCM header decoding
1095 // we don't seek ENDOFRAWDATAMARKER
1099 AliError(Form("Failed HC : %s", DumpHCinfoH0(fHC)));
1100 AliError(Form("Failed HC : %s", DumpHCinfoH1(fHC)));
1101 AliError(Form("Debug Event Counter : %d\n\n\n", fgStreamEventCounter));
1109 SeekEndOfData(); // make sure that finish off with the end of data markers
1118 if (fSM.fClean == kTRUE)
1121 if (fgCleanDataOnly && (fSM.fClean == kFALSE))
1125 AliWarning("Buffer with errors. Returning FALSE.");
1126 AliWarning(Form("--- Failed SM : %s ---", DumpSMInfo(&fSM)));
1128 fSM.fActiveStacks = 0; // Next will not give data
1135 //------------------------------------------------------------
1137 AliTRDrawStreamTB::DecodeSM()
1140 // decode SM data in case AliRawReader is in use
1144 Int_t nextBuff = NextBuffer();
1145 while (nextBuff != -1)
1149 nextBuff = NextBuffer();
1155 AliWarning("AliRawReader not set.");
1160 //------------------------------------------------------------
1162 AliTRDrawStreamTB::DecodeSM(AliRawReader *reader)
1165 // decode SM with the AliRawReader
1169 fRawReader = reader;
1174 AliWarning("Argument AliRawReader is 0.");
1179 //------------------------------------------------------------
1181 AliTRDrawStreamTB::SeekEndOfData()
1184 // go to end of data marker
1186 Int_t fEndOfDataCount = 0;
1188 while ( *fpPos != ENDOFRAWDATAMARKER && fpPos < fpEnd )
1193 while (*fpPos == ENDOFRAWDATAMARKER && fpPos < fpEnd )
1199 // if (fEndOfDataCount == 0)
1201 // if (fgWarnError) AliWarning("End of buffer reached first. No end of data marker?");
1208 //------------------------------------------------------------
1210 AliTRDrawStreamTB::SeekNextMCMheader()
1216 // move back to the mcm pos
1217 fpPos = fMCM->fPos + 1;
1219 while ( *fpPos != ENDOFRAWDATAMARKER && fpPos < fpEnd )
1221 if (MCM_HEADER_MASK_ERR(*fpPos) == 0)
1223 if (fgWarnError) AliWarning(Form("^^^ Found : Pos 0x%08x : Val 0x%08x", fpPos, *fpPos));
1233 //------------------------------------------------------------
1236 AliTRDrawStreamTB::DecodeTracklets()
1242 fLinkTrackletCounter = 0;
1243 fEndOfTrackletCount = 0;
1245 if (fgDebugFlag) AliDebug(10, Form("Decode tracklets at 0x%08x : 0x%08x", fpPos, *fpPos));
1247 while ( *fpPos != END_OF_TRACKLET_MARKEROLD && *fpPos != END_OF_TRACKLET_MARKERNEW && fpPos < fpEnd )
1250 if (fgDebugFlag) AliDebug(10, Form("Tracklet found at 0x%08x : 0x%08x", fpPos, *fpPos));
1252 fLinkTrackletCounter++;
1254 if (fLinkTrackletCounter > MAX_TRACKLETS_PERHC)
1256 if (fgWarnError) AliWarning(Form("Max number of tracklets exceeded %d > %d. Something is wrong with the input data!",
1257 fLinkTrackletCounter, MAX_TRACKLETS_PERHC));
1261 AliError(Form("Dumping Words for Debugging Purpose =========================>"));
1262 DumpWords(fpPos-300, 320);
1263 AliError(Form("Dumping Done!"));
1267 if (fRawReader) fRawReader->AddMajorErrorLog(kTrackletOverflow,"Too many tracklets");
1271 if (fgDebugStreamer)
1287 row = (val >> 20) & 0xF;
1288 defl = (val >> 13) & 0x7F;
1289 defl = defl << 25 >> 25;
1290 ypos = val & 0x1FFF;
1291 ypos = ypos << 19 >> 19;
1293 deflm = defl * 140.0e-6; /* m */
1294 yposm = ypos * 160.0e-6; /* m */
1296 TTreeSRedirector &cstream = *fgDebugStreamer;
1297 cstream << "MCMtracklets"
1298 << "Event=" << fgStreamEventCounter
1299 << ".stack=" << fStackNumber
1300 << ".link=" << fStackLinkNumber
1305 << ".deflm=" << deflm
1306 << ".yposm=" << yposm
1312 while ( ( *fpPos == END_OF_TRACKLET_MARKEROLD || *fpPos == END_OF_TRACKLET_MARKERNEW ) && fpPos < fpEnd )
1314 if (fgDebugFlag) AliDebug(10, Form("EoTracklets found at 0x%08x : 0x%08x", fpPos, *fpPos));
1316 fEndOfTrackletCount++;
1320 if ( fEndOfTrackletCount < 2 )
1322 if (fRawReader) fRawReader->AddMajorErrorLog(kEOTrackeltsMissing, "End of tracklets word missing");
1329 //------------------------------------------------------------
1331 AliTRDrawStreamTB::IsRowValid()
1334 if ( (fHC->fStack == 2 && fMCM->fROW >= fGeometry->RowmaxC0()) ||
1335 (fHC->fStack != 2 && fMCM->fROW >= fGeometry->RowmaxC1()) || fMCM->fROW < 0 )
1337 if (fgWarnError) AliWarning(Form("SM%d L%dS%d: Wrong Padrow (%d) fROB=%d, fSIDE=%d, fMCM=%02d"
1338 , fHC->fSM, fHC->fLayer, fHC->fStack, fMCM->fROW, fMCM->fROB, fHC->fSide, fMCM->fMCM ));
1339 if (fRawReader) fRawReader->AddMajorErrorLog(kWrongPadrow, "Wrong Row");
1345 //------------------------------------------------------------
1347 AliTRDrawStreamTB::IsMCMheaderOK()
1350 // check the mcm header
1353 if ( fMCM->fCorrupted > 1 )
1355 if (fRawReader) fRawReader->AddMajorErrorLog(kMCMheaderCorrupted,"ADC mask Corrupted");
1356 if (fgWarnError) AliWarning(Form("Wrong ADC Mask word 0x%08x %s. Error : %d\n", *fMCM->fPos, DumpMCMadcMask(fMCM), fMCM->fCorrupted));
1360 if ( fMCM->fCorrupted > 0 )
1362 if (fRawReader) fRawReader->AddMajorErrorLog(kMCMheaderCorrupted,"Corrupted");
1363 if (fgWarnError) AliWarning(Form("Wrong MCM word 0x%08x %s. Error : %d\n", *fMCM->fPos, DumpMCMinfo(fMCM), fMCM->fCorrupted));
1367 if ( fMCM->fMCM < 0 || fMCM->fMCM > 15 || fMCM->fROB < 0 || fMCM->fROB > 7 )
1369 if (fRawReader) fRawReader->AddMajorErrorLog(kWrongMCMorROB,"Wrong ROB or MCM");
1370 if (fgWarnError) AliWarning(Form("Wrong fMCM or fROB. %s\n", DumpMCMinfo(fMCM)));
1374 if (IsRowValid() == kFALSE)
1380 //------------------------------------------------------------
1382 AliTRDrawStreamTB::IsMCMevCounterOK()
1385 // Check the MCM event counter
1388 if (fEventCounter == 0)
1390 fEventCounter = fMCM->fEvCounter;
1393 if (fEventCounter < fLastEventCounter)
1395 fMCM->fCorrupted += 4;
1396 if (fgWarnError) AliWarning(Form("Event from the past? Current %d Last %d %s. Error : %d\n", fEventCounter, fLastEventCounter, DumpMCMinfo(fMCM), fMCM->fCorrupted));
1397 if (fRawReader) fRawReader->AddMajorErrorLog(kMCMeventMissmatch, "Wrong MCM event counter ? Past-Future");
1401 if (fEventCounter != fMCM->fEvCounter)
1403 fMCM->fCorrupted += 4;
1404 if (fgWarnError) AliWarning(Form("Event missmatch? FirstMCMs %d ThisMCMs %d %s. Error : %d\n", fEventCounter, fMCM->fEvCounter, DumpMCMinfo(fMCM), fMCM->fCorrupted));
1405 if (fRawReader) fRawReader->AddMajorErrorLog(kMCMeventMissmatch, "Wrong MCM event counter ?");
1412 //------------------------------------------------------------
1414 AliTRDrawStreamTB::DecodeMCMheader()
1417 // decode the mcm header
1420 DecodeMCMheader(fpPos, fMCM);
1421 if (fHC->fCorrupted >= 16)
1427 fMCM->fROW = fTRDfeeParam->GetPadRowFromMCM(fMCM->fROB, fMCM->fMCM);
1429 if ((fHC->fRawVMajor > 2 && fHC->fRawVMajor <5) || (fHC->fRawVMajor > 31 && fHC->fRawVMajor < 64)) //cover old and new version definition of ZS data
1432 if ( fpPos < fpEnd )
1434 DecodeMask(fpPos, fMCM);
1435 if (fHC->fCorrupted >= 16)
1440 MCMADCwordsWithTbins(fHC->fTimeBins, fMCM);
1441 fMCM->fAdcDataPos = fpPos + 1;
1445 if (fgWarnError) AliWarning("Expected ADC mask word. Fail due to buffer END.");
1446 if (fRawReader) fRawReader->AddMajorErrorLog(kMCMADCMaskMissing,"Missing");
1452 UInt_t dummyMask = MCM_DUMMY_ADCMASK_VAL;
1453 DecodeMask(&dummyMask, fMCM);
1454 MCMADCwordsWithTbins(fHC->fTimeBins, fMCM);
1455 fMCM->fAdcDataPos = fpPos + 1;
1460 AliDebug(6, DumpMCMinfo(fMCM));
1461 AliDebug(7, DumpMCMadcMask(fMCM));
1464 if (IsMCMheaderOK() == kFALSE)
1467 if (IsMCMevCounterOK() == kFALSE)
1473 //------------------------------------------------------------
1475 AliTRDrawStreamTB::IsHCheaderOK()
1478 // check the half chamber header
1481 if (fHC->fCorrupted > 0)
1483 if (fgWarnError) AliWarning(Form("Wrong HC Header word. Word 0x%08x Error : %d", *fHC->fPos, fHC->fCorrupted));
1484 if (fRawReader) fRawReader->AddMajorErrorLog(kHCHeaderCorrupt, "Corrupted");
1489 if (fHC->fStack < 0 || fHC->fStack > 4)
1491 if (fgWarnError) AliWarning(Form("Wrong Stack %d", fHC->fStack));
1492 if (fRawReader) fRawReader->AddMajorErrorLog(kHCHeaderWrongStack, "Wrong Stack");
1496 if (fgStackNumberChecker)
1498 if (fHC->fStack != fStackNumber)
1500 if (fgWarnError) AliWarning(Form("Missmatch: Stack in HC header %d HW-stack %d",
1501 fHC->fStack, fStackNumber));
1502 if (fRawReader) fRawReader->AddMajorErrorLog(kHCHeaderWrongStack, "Stack-HWstack");
1508 if (fHC->fLayer < 0 || fHC->fLayer >= AliTRDgeometry::kNplan)
1510 if (fgWarnError) AliWarning(Form("Wrong plane(layer) %d", fHC->fLayer));
1511 if (fRawReader) fRawReader->AddMajorErrorLog(kHCHeaderWrongLayer, "Wrong Plane");
1515 if (fgStackLinkNumberChecker)
1518 if ((fHC->fLayer * 2 != fStackLinkNumber) && (fHC->fLayer * 2 != fStackLinkNumber - 1))
1520 if (fgWarnError) AliWarning(Form("Missmatch: plane(layer) in HCheader %d HW-Link %d | %s",
1521 fHC->fLayer, fStackLinkNumber, DumpStackInfo(fStack)));
1522 if (fRawReader) fRawReader->AddMajorErrorLog(kHCHeaderWrongLayer, "Plane-Link missmatch");
1523 fStackLinkNumber = -1;
1528 if (fHC->fSide < 0 || fHC->fSide > 1)
1530 if (fgWarnError) AliWarning(Form("Wrong Side %d", fHC->fSide));
1531 if (fRawReader) fRawReader->AddMajorErrorLog(kHCHeaderWrongSide, "Wrong Side");
1536 fHC->fDET = fGeometry->GetDetector(fHC->fLayer, fHC->fStack, fHC->fSM);
1537 if (fHC->fDET < 0 || fHC->fDET >= AliTRDgeometry::kNdet)
1539 if (fgWarnError) AliWarning(Form("Wrong detector %d", fHC->fDET));
1540 if (fRawReader) fRawReader->AddMajorErrorLog(kHCHeaderWrongDet, "Wrong Det");
1545 // this check fails - raw data inconsistent with geometry?
1546 if (fHC->fSM != fGeometry->GetSector(fHC->fDET)
1547 || fHC->fSM <0 || fHC->fSM >= AliTRDgeometry::kNsect)
1549 if (fgWarnError) AliWarning(Form("Wrong SM(sector) %d (Geometry says: %d) Stack=%d Layer=%d Det=%d",
1550 fHC->fSM, fGeometry->GetSector(fHC->fDET),
1551 fHC->fStack, fHC->fLayer, fHC->fDET));
1552 if (fRawReader) fRawReader->AddMajorErrorLog(kHCHeaderWrongSM, "Wrong SM");
1558 fHC->fROC = fGeometry->GetDetectorSec(fHC->fLayer, fHC->fStack);
1561 if (fRawReader) fRawReader->AddMajorErrorLog(kHCHeaderWrongROC, "Wrong ROC");
1565 fHC->fRowMax = fGeometry->GetRowMax(fHC->fLayer, fHC->fStack, fHC->fSM);
1566 if (fHC->fRowMax < 1)
1568 if (fRawReader) fRawReader->AddMajorErrorLog(kHCHeaderWrongROC, "Wrong ROC Row Max");
1572 fHC->fColMax = fGeometry->GetColMax(fHC->fROC);
1573 if (fHC->fColMax < 1)
1575 if (fRawReader) fRawReader->AddMajorErrorLog(kHCHeaderWrongROC, "Wrong ROC Col Max");
1578 // extra - not needed
1579 // if (fHC->fSM <0 || fHC->fSM >= AliTRDgeometry::kNsect)
1581 // if (fgWarnError) AliWarning(Form("Wrong SM(sector) %d (Geometry says: %d) Stack=%d Layer=%d",
1582 // fHC->fSM, fGeometry->GetDetectorSec(fHC->fLayer, fHC->fStack),
1583 // fHC->fStack, fHC->fLayer));
1590 //------------------------------------------------------------
1592 AliTRDrawStreamTB::DecodeHCheader()
1595 // decode the half chamber header
1598 DecodeHCwordH0(fpPos, fHC);
1600 if (fHC->fNExtraWords > 0)
1605 DecodeHCwordH1(fpPos, fHC);
1609 if (fgWarnError) AliWarning("Expected HC header word 1. Fail due to buffer END.");
1610 if (fRawReader) fRawReader->AddMajorErrorLog(kHCWordMissing,"Next HC word 1 (count from 0) missing");
1615 if (fgDebugFlag) AliDebug(5, DumpHCinfoH0(fHC));
1616 if (fgDebugFlag) AliDebug(5, DumpHCinfoH1(fHC));
1619 if (IsHCheaderOK() == kFALSE)
1621 fHC->fCorrupted +=4;
1628 //------------------------------------------------------------
1630 AliTRDrawStreamTB::DecodeHC()
1633 // decode the hc data
1634 // function for devel & debug
1637 if (DecodeHCheader() == kFALSE)
1639 if (fgDebugStreamer)
1641 TTreeSRedirector &cstream = *fgDebugStreamer;
1642 cstream << "HCDecodeError"
1643 << "Event=" << fgStreamEventCounter
1644 << ".stack=" << fStackNumber
1645 << ".link=" << fStackLinkNumber
1646 << ".hcCorrupted=" << fHC->fCorrupted
1647 << ".hcRVmajor=" << fHC->fRawVMajor
1648 << ".hcDCSboard=" << fHC->fDCSboard
1649 << ".hcSM=" << fHC->fSM
1650 << ".hcStack=" << fHC->fStack
1651 << ".hcLayer=" << fHC->fLayer
1652 << ".hcSide=" << fHC->fSide
1653 << ".hcTbins=" << fHC->fTimeBins
1654 << ".hcBunchCross=" << fHC->fBunchCrossCounter
1655 << ".hcPreTrig=" << fHC->fPreTriggerCounter
1656 << ".hcPreTrigPh=" << fHC->fPreTriggerPhase
1657 << ".hcDet=" << fHC->fDET
1658 << ".hcROC=" << fHC->fROC
1659 << ".hcRowMax=" << fHC->fRowMax
1660 << ".hcColMax=" << fHC->fColMax
1664 if (fgWarnError) AliWarning("Header decode failed.");
1672 if (fgWarnError) AliWarning("No MCM data? Not enough data in the buffer.");
1673 if (fRawReader) fRawReader->AddMajorErrorLog(kMCMdataMissing, "MCM data missing");
1679 while (*fpPos != ENDOFRAWDATAMARKER && fpPos < fpEnd)
1681 if (fHC->fMCMmax > TRD_MAX_MCM)
1683 if (fgWarnError) AliWarning("More mcm data than expected!");
1684 if (fRawReader) fRawReader->AddMajorErrorLog(kMCMoverflow, "Too many mcms found!");
1688 fMCM = &fHC->fMCMs[fHC->fMCMmax];
1690 if (DecodeMCMheader() == kFALSE)
1692 if (fgDebugStreamer)
1694 TTreeSRedirector &cstream = *fgDebugStreamer;
1695 cstream << "MCMDecodeError"
1696 << "Event=" << fgStreamEventCounter
1697 << ".stack=" << fStackNumber
1698 << ".link=" << fStackLinkNumber
1699 << ".hcDCSboard=" << fHC->fDCSboard
1700 << ".hcSM=" << fHC->fSM
1701 << ".hcStack=" << fHC->fStack
1702 << ".hcLayer=" << fHC->fLayer
1703 << ".hcSide=" << fHC->fSide
1704 << ".hcBunchCross=" << fHC->fBunchCrossCounter
1705 << ".hcPreTrig=" << fHC->fPreTriggerCounter
1706 << ".hcPreTrigPh=" << fHC->fPreTriggerPhase
1707 << ".hcDet=" << fHC->fDET
1709 << ".mcmCorrupted=" << fMCM->fCorrupted
1710 << ".mcmROB=" << fMCM->fROB
1711 << ".mcmMCM=" << fMCM->fMCM
1712 << ".mcmADCMaskWord=" << fMCM->fADCMaskWord
1713 << ".mcmEventCounter=" << fMCM->fEvCounter
1715 << ".fEventCounter=" << fEventCounter
1716 << ".fLastEventCounter=" << fLastEventCounter
1720 if (fgSkipData == kTRUE || fHC->fCorrupted >= 16)
1721 return kFALSE; //if(true), keep reading next words even previous words were corrupted - debugging purpose
1726 if (fMCM->fADCmax > 0)
1731 if (fgDebugFlag) AliDebug(9, Form("Buffer short of data. ADC data expected."));
1732 if (fRawReader) fRawReader->AddMajorErrorLog(kADCdataMissing, "ADC data missing");
1735 unsigned long randVal, iniVal, expectedVal;
1736 Int_t endbits = ENDBITS;
1738 for (Int_t iadc = 0; iadc < fMCM->fADCmax; iadc++)
1740 fADC = &fMCM->fADCs[iadc];
1741 fADC->fADCnumber = fMCM->fADCchannel[iadc];
1743 if (fgDebugFlag) AliDebug(9, Form("This is ADC %d of %d. ADC number is %d.",
1744 iadc+1, fMCM->fADCmax, fMCM->fADCchannel[iadc]));
1746 if (fpPos + fMCM->fSingleADCwords >= fpEnd)
1748 if (fgDebugStreamer)
1750 TTreeSRedirector &cstream = *fgDebugStreamer;
1752 cstream << "ADCDecodeError"
1753 << "Event=" << fgStreamEventCounter
1754 << ".hcSM=" << fHC->fSM
1755 << ".hcStack=" << fHC->fStack
1756 << ".hcLayer=" << fHC->fLayer
1757 << ".hcSide=" << fHC->fSide
1758 << ".hcDet=" << fHC->fDET
1759 << ".mcmROB=" << fMCM->fROB
1760 << ".mcmMCM=" << fMCM->fMCM
1761 << ".mcmADCMaskWord=" << fMCM->fADCMaskWord
1762 << ".adcErr=" << ierr
1763 << ".adcNumber=" << ierr
1767 if (fgWarnError) AliWarning(Form("This is ADC %d of %d. ADC number is %d.", iadc+1, fMCM->fADCmax, fMCM->fADCchannel[iadc]));
1768 if (fgWarnError) AliWarning("--> ADC (10 words) expected. Not enough data in the buffer.");
1769 if (fgWarnError) AliWarning(Form("--> ADC mask : %s", DumpMCMadcMask(fMCM)));
1771 if (fRawReader) fRawReader->AddMajorErrorLog(kADCdataMissing, "ADC data missing - less than expected");
1775 if (fHC->fRawVMajor < 64) // normal(real) ADC data
1777 if (DecodeADC() == kFALSE)
1779 // check if we are out of the det when the pad is shared
1780 if (fADC->fIsShared && fADC->fCorrupted == 4)
1783 fpPos = fADC->fPos + fMCM->fSingleADCwords;
1787 if (fgWarnError) AliWarning(Form("ADC decode failed."));
1789 if (fgDebugStreamer)
1791 TTreeSRedirector &cstream = *fgDebugStreamer;
1792 cstream << "ADCDecodeError"
1793 << "Event=" << fgStreamEventCounter
1794 << ".hcSM=" << fHC->fSM
1795 << ".hcStack=" << fHC->fStack
1796 << ".hcLayer=" << fHC->fLayer
1797 << ".hcSide=" << fHC->fSide
1798 << ".hcDet=" << fHC->fDET
1799 << ".mcmROB=" << fMCM->fROB
1800 << ".mcmMCM=" << fMCM->fMCM
1801 << ".mcmADCMaskWord=" << fMCM->fADCMaskWord
1802 << ".adcErr=" << fADC->fCorrupted
1803 << ".adcNumber=" << fADC->fADCnumber
1806 if (fHC->fCorrupted < 16)
1807 fpPos = fADC->fPos + fMCM->fSingleADCwords;
1809 if (fgSkipData == kTRUE || fHC->fCorrupted >= 16)
1810 return kFALSE; //if(true), keep reading next words even previous words were corrupted - debugging purpose
1814 else // test pattern data
1816 if (fHC->fRawVMajorOpt == 1) //test pattern 1
1818 Int_t iCpu = iadc/5;
1819 if(iadc==20) iCpu = 3;
1820 if(iadc%5==0 && iadc!=20) randVal = (1 << 9) | (fMCM->fROB << 6) | (fMCM->fMCM << 2) | iCpu;
1821 if (DecodeADCTP1(&randVal,&endbits) == kFALSE)
1823 if (fgWarnError) AliWarning(Form("Summary: Test Pattern ADC data are corrupted in channel %d %s\n", iadc, DumpMCMinfo(fMCM)));
1824 if (fgDebugStreamer)
1826 TTreeSRedirector &cstream = *fgDebugStreamer;
1827 cstream << "ADCDecodeError"
1828 << "Event=" << fgStreamEventCounter
1829 << ".hcSM=" << fHC->fSM
1830 << ".hcStack=" << fHC->fStack
1831 << ".hcLayer=" << fHC->fLayer
1832 << ".hcSide=" << fHC->fSide
1833 << ".hcDet=" << fHC->fDET
1834 << ".mcmROB=" << fMCM->fROB
1835 << ".mcmMCM=" << fMCM->fMCM
1836 << ".mcmADCMaskWord=" << fMCM->fADCMaskWord
1837 << ".adcErr=" << fADC->fCorrupted
1838 << ".adcNumber=" << fADC->fADCnumber
1841 if (fHC->fCorrupted < 16)
1842 fpPos = fADC->fPos + fMCM->fSingleADCwords;
1844 if (fgSkipData == kTRUE || fHC->fCorrupted >= 16)
1845 return kFALSE; //if(true), keep reading next words even previous words were corrupted - debugging purpose
1849 if (fHC->fRawVMajorOpt == 2 || fHC->fRawVMajorOpt == 3) //test pattern 2 or 3
1851 iniVal = (fHC->fSM << 6) | (fHC->fStack << 0) | (fHC->fLayer << 3);
1852 iniVal = iniVal + 0x49;
1853 iniVal = (iniVal << 9) | (fMCM->fROB << 6) | (fMCM->fMCM << 2) | (fMCM->fEvCounter << 20);
1854 Int_t iCpu = iadc/5;
1855 if (iadc==20) iCpu = 3;
1856 if (iadc%5==0 && iadc!=20)
1858 if (fHC->fRawVMajorOpt == 2) { expectedVal = ((iniVal | iCpu) << 6) + 1; };
1859 if (fHC->fRawVMajorOpt == 3) { expectedVal = iniVal | iCpu; };
1861 if (DecodeADCTP23(&expectedVal) == kFALSE)
1863 if (fgWarnError) AliWarning(Form("Summary: Test Pattern ADC data are corrupted in channel %d %s\n", iadc, DumpMCMinfo(fMCM)));
1864 if (fgDebugStreamer)
1866 TTreeSRedirector &cstream = *fgDebugStreamer;
1867 cstream << "ADCDecodeError"
1868 << "Event=" << fgStreamEventCounter
1869 << ".hcSM=" << fHC->fSM
1870 << ".hcStack=" << fHC->fStack
1871 << ".hcLayer=" << fHC->fLayer
1872 << ".hcSide=" << fHC->fSide
1873 << ".hcDet=" << fHC->fDET
1874 << ".mcmROB=" << fMCM->fROB
1875 << ".mcmMCM=" << fMCM->fMCM
1876 << ".mcmADCMaskWord=" << fMCM->fADCMaskWord
1877 << ".adcErr=" << fADC->fCorrupted
1878 << ".adcNumber=" << fADC->fADCnumber
1881 if (fHC->fCorrupted < 16)
1882 fpPos = fADC->fPos + fMCM->fSingleADCwords;
1884 if (fgSkipData == kTRUE || fHC->fCorrupted >= 16)
1885 return kFALSE; //if(true), keep reading next words even previous words were corrupted - debugging purpose
1899 if (fgWarnError) AliWarning("We are at the end of buffer. There should be one more word left.");
1905 //------------------------------------------------------------
1908 AliTRDrawStreamTB::DecodeADC()
1911 // decode single ADC channel
1914 fADC->fCorrupted = 0;
1915 fMaskADCword = ADC_WORD_MASK(*fpPos);
1919 for (Int_t i = 0; i < TRD_MAX_TBINS; i++)
1920 fADC->fSignals[i] = 0;
1922 for (Int_t iw = 0; iw < fMCM->fSingleADCwords; iw++)
1924 if (HC_HEADER_MASK_ERR(*fpPos) == 0 || *fpPos == END_OF_TRACKLET_MARKERNEW)
1926 if (fgWarnError) AliError(Form("There should be ADC data. We meet HC header or END_OF_TRACKLET_MARKER 0x%08x",*fpPos));
1927 fADC->fCorrupted += 16;
1928 fHC->fCorrupted += 16;
1933 if (fMaskADCword != ADC_WORD_MASK(*fpPos))
1935 fADC->fCorrupted += 1;
1936 if (fgWarnError) AliWarning(Form("Mask Change in ADC data Previous word (%d) : 0x%08x Previous mask : 0x%08x Current word(%d) : 0x%08x Current mask : 0x%08x",
1937 iw - 1, *(fpPos-1), fMaskADCword, iw, *fpPos, ADC_WORD_MASK(*fpPos)));
1938 if (fRawReader) fRawReader->AddMajorErrorLog(kADCmaskMissmatch, "Mask change inside single channel");
1942 // here we subtract the baseline ( == common additive)
1943 fADC->fSignals[fTbinADC + 0] = ((*fpPos & 0x00000ffc) >> 2) - fgCommonAdditive;
1944 fADC->fSignals[fTbinADC + 1] = ((*fpPos & 0x003ff000) >> 12) - fgCommonAdditive;
1945 fADC->fSignals[fTbinADC + 2] = ((*fpPos & 0xffc00000) >> 22) - fgCommonAdditive;
1951 if (fADC->fADCnumber <= 1 || fADC->fADCnumber == fMaxADCgeom - 1)
1953 fADC->fIsShared = kTRUE;
1957 fADC->fIsShared = kFALSE;
1960 if ( fADC->fADCnumber >= fMaxADCgeom - 1)
1962 // let us guess the Column
1963 // take the one before last ADC and shift by one column
1964 // later we check if we are inside the limits of the chamber
1965 fADC->fCOL = AliTRDfeeParam::Instance()->GetPadColFromADC(fMCM->fROB, fMCM->fMCM, fADC->fADCnumber - 1);
1970 fADC->fCOL = fTRDfeeParam->GetPadColFromADC(fMCM->fROB, fMCM->fMCM, fADC->fADCnumber);
1973 if (fADC->fCOL >= fHC->fColMax || fADC->fCOL < 0)
1975 if (fADC->fIsShared == kFALSE)
1977 fADC->fCorrupted += 2;
1978 if (fgWarnError) AliWarning(Form("Wrong column! ADCnumber %d MaxIs %d Col %d MaxIs %d MCM= %s",
1979 fADC->fADCnumber, fMaxADCgeom, fADC->fCOL, fHC->fColMax, DumpMCMinfo(fMCM)));
1980 if (fRawReader) fRawReader->AddMajorErrorLog(kWrongPadcolumn, "Wrong column");
1984 // flag it - we are out of the det when the pad is shared
1985 if (fgDebugFlag) AliDebug(10, Form("Column out of the detector! ADCnumber %d MaxIs %d Col %d MaxIs %d MCM= %s",
1986 fADC->fADCnumber, fMaxADCgeom, fADC->fCOL, fHC->fColMax, DumpMCMinfo(fMCM)));
1987 fADC->fCorrupted += 4;
1991 if (fADC->fCorrupted > 0)
1999 //------------------------------------------------------------
2002 AliTRDrawStreamTB::DecodeADCTP1(unsigned long *randVal, Int_t *endbits)
2005 // decode test pattern ADC channel
2008 unsigned long expected;
2010 fADC->fCorrupted = 0;
2014 for (Int_t i = 0; i < TRD_MAX_TBINS; i++)
2015 fADC->fSignals[i] = 0;
2017 for (Int_t iw = 0; iw < fMCM->fSingleADCwords; iw++)
2019 if (HC_HEADER_MASK_ERR(*fpPos) == 0 || *fpPos == END_OF_TRACKLET_MARKERNEW)
2021 if (fgWarnError) AliError(Form("There should be ADC data. We meet HC header or END_OF_TRACKLET_MARKER 0x%08x",*fpPos));
2022 fADC->fCorrupted += 16;
2023 fHC->fCorrupted += 16;
2028 expected = (AdvancePseudoRandom(randVal) << 2) | *endbits;
2029 expected |= AdvancePseudoRandom(randVal) << 12;
2030 expected |= AdvancePseudoRandom(randVal) << 22;
2031 if (*fpPos != expected)
2033 if (fgWarnError) AliError(Form("Error: fpPos=%d, size=%d, found=0x%08lx, expected=0x%08lx",iw, fMCM->fSingleADCwords, *fpPos, expected));
2034 fADC->fCorrupted += 32; //test pattern corrupted
2036 fADC->fSignals[fTbinADC + 0] = ((*fpPos & 0x00000ffc) >> 2);
2037 fADC->fSignals[fTbinADC + 1] = ((*fpPos & 0x003ff000) >> 12);
2038 fADC->fSignals[fTbinADC + 2] = ((*fpPos & 0xffc00000) >> 22);
2043 *endbits = *endbits ^ 0x01;
2045 if (fADC->fADCnumber <= 1 || fADC->fADCnumber == fMaxADCgeom - 1)
2047 fADC->fIsShared = kTRUE;
2051 fADC->fIsShared = kFALSE;
2054 if ( fADC->fADCnumber >= fMaxADCgeom - 1)
2056 fADC->fCOL = AliTRDfeeParam::Instance()->GetPadColFromADC(fMCM->fROB, fMCM->fMCM, fADC->fADCnumber - 1);
2061 fADC->fCOL = fTRDfeeParam->GetPadColFromADC(fMCM->fROB, fMCM->fMCM, fADC->fADCnumber);
2064 if (fADC->fCorrupted > 0)
2072 //--------------------------------------------------------
2075 AliTRDrawStreamTB::DecodeADCTP23(unsigned long *expected)
2078 // decode test pattern ADC channel
2081 fADC->fCorrupted = 0;
2085 for (Int_t i = 0; i < TRD_MAX_TBINS; i++)
2086 fADC->fSignals[i] = 0;
2088 for (Int_t iw = 0; iw < fMCM->fSingleADCwords; iw++)
2090 if (*fpPos == END_OF_TRACKLET_MARKERNEW)
2092 if (fgWarnError) AliError(Form("There should be ADC data. We meet END_OF_TRACKLET_MARKER 0x%08x",*fpPos));
2093 fADC->fCorrupted += 16;
2094 fHC->fCorrupted += 16;
2099 if (*fpPos != *expected)
2103 if (fHC->fRawVMajorOpt == 2)
2105 AliError(Form("Error: fpPos=%d, size=%d, found=0x%08lx, expected=0x%08lx",iw, fMCM->fSingleADCwords, *fpPos, *expected));
2106 AliError(Form("Found ev.cnt. %ld, expected %ld", (*fpPos >> 26), (*expected >> 26)));
2107 AliError(Form("Found sector %ld, expected %ld", (*fpPos >> 21) & 0x1f - 1, (*expected >> 21) & 0x1f - 1));
2108 AliError(Form("Found layer %ld, expected %ld", (*fpPos >> 18) & 0x07 - 1, (*expected >> 18) & 0x07 - 1));
2109 AliError(Form("Found chamber %ld, expected %ld", (*fpPos >> 15) & 0x07 - 1, (*expected >> 15) & 0x07 - 1));
2110 AliError(Form("Found ROB %ld, expected %ld", (*fpPos >> 12) & 0x07, (*expected >> 12) & 0x07));
2111 AliError(Form("Found MCM %ld, expected %ld", (*fpPos >> 8) & 0x0f, (*expected >> 8) & 0x0f));
2112 AliError(Form("Found CPU %ld, expected %ld", (*fpPos >> 6) & 0x03, (*expected >> 6) & 0x03));
2113 AliError(Form("Found counter %ld, expected %ld\n", (*fpPos >> 0) & 0x3f, (*expected >> 0) & 0xf));
2115 if (fHC->fRawVMajorOpt == 3)
2117 AliError(Form("Error: fpPos=%d, size=%d, found=0x%08lx, expected=0x%08lx",iw, fMCM->fSingleADCwords, *fpPos, *expected));
2118 AliError(Form("Found ev.cnt. %ld, expected %ld", (*fpPos >> 20), (*expected >> 20)));
2119 AliError(Form("Found sector %ld, expected %ld", (*fpPos >> 15) & 0x1f - 1, (*expected >> 15) & 0x1f - 1));
2120 AliError(Form("Found layer %ld, expected %ld", (*fpPos >> 12) & 0x07 - 1, (*expected >> 12) & 0x07 - 1));
2121 AliError(Form("Found chamber %ld, expected %ld", (*fpPos >> 9) & 0x07 - 1, (*expected >> 9) & 0x07 - 1));
2122 AliError(Form("Found ROB %ld, expected %ld", (*fpPos >> 6) & 0x07, (*expected >> 6) & 0x07));
2123 AliError(Form("Found MCM %ld, expected %ld", (*fpPos >> 2) & 0x0f, (*expected >> 2) & 0x0f));
2124 AliError(Form("Found CPU %ld, expected %ld\n", (*fpPos >> 0) & 0x03, (*expected >> 0) & 0x03));
2128 fADC->fCorrupted += 32; //test pattern corrupted
2130 fADC->fSignals[fTbinADC + 0] = ((*fpPos & 0x00000ffc) >> 2);
2131 fADC->fSignals[fTbinADC + 1] = ((*fpPos & 0x003ff000) >> 12);
2132 fADC->fSignals[fTbinADC + 2] = ((*fpPos & 0xffc00000) >> 22);
2136 if (fHC->fRawVMajorOpt == 2) (*expected)++;
2139 if (fADC->fADCnumber <= 1 || fADC->fADCnumber == fMaxADCgeom - 1)
2141 fADC->fIsShared = kTRUE;
2145 fADC->fIsShared = kFALSE;
2148 if ( fADC->fADCnumber >= fMaxADCgeom - 1)
2150 fADC->fCOL = AliTRDfeeParam::Instance()->GetPadColFromADC(fMCM->fROB, fMCM->fMCM, fADC->fADCnumber - 1);
2155 fADC->fCOL = fTRDfeeParam->GetPadColFromADC(fMCM->fROB, fMCM->fMCM, fADC->fADCnumber);
2158 if (fADC->fCorrupted > 0)
2166 //--------------------------------------------------------
2169 void AliTRDrawStreamTB::DecodeSMInfo(const UInt_t *word, struct AliTRDrawSM *sm) const
2172 // Decode the data *word into SM info structure
2175 sm->fPos = (UInt_t*)word;
2178 UInt_t vword = *word;
2179 sm->fHeaderSize = SM_HEADER_SIZE(vword);
2181 if (TRACKLETS_ENABLED(vword) > 0)
2182 sm->fTrackletEnable = kTRUE;
2184 sm->fTrackletEnable = kFALSE;
2186 UInt_t stackMask = STACK_MASK(vword);
2187 sm->fActiveStacks = 0;
2188 for (Int_t i = 0; i < 5; i++)
2190 //if ((stackMask >> i) & 0x1 > 0)
2191 if (IS_BIT_SET(stackMask,i) > 0)
2193 sm->fStackActive[i] = kTRUE;
2194 sm->fActiveStacks++;
2198 sm->fStackActive[i] = kFALSE;
2203 //--------------------------------------------------------
2204 const char *AliTRDrawStreamTB::DumpSMInfo(const struct AliTRDrawSM *sm)
2207 // Get SM structure into a const char
2210 return Form("[ SM Info 0x%08x] : Hsize %d TrackletEnable %d Stacks %d %d %d %d %d",
2212 sm->fHeaderSize, sm->fTrackletEnable,
2213 sm->fStackActive[0], sm->fStackActive[1], sm->fStackActive[2],
2214 sm->fStackActive[3], sm->fStackActive[4]);
2217 //--------------------------------------------------------
2218 void AliTRDrawStreamTB::DecodeStackInfo(const UInt_t *word, struct AliTRDrawStack *st) const
2221 // Decode stack info - active links
2224 st->fPos = (UInt_t*)word;
2227 UInt_t vword = *word;
2228 st->fHeaderSize = STACK_HEADER_SIZE(vword);
2230 UInt_t linkMask = STACK_LINK_WORD(vword);
2231 st->fActiveLinks = 0;
2232 for (Int_t i = 0; i < 12; i++)
2234 //if (linkMask & (0x1 << i) > 0)
2235 if (IS_BIT_SET(linkMask,i) > 0)
2237 st->fLinksActive[i] = kTRUE;
2238 st->fTrackletDecode[i] = kTRUE;
2239 st->fHCDecode[i] = kTRUE;
2244 st->fTrackletDecode[i] = kFALSE;
2245 st->fLinksActive[i] = kFALSE;
2246 st->fHCDecode[i] = kFALSE;
2251 //--------------------------------------------------------
2252 const char *AliTRDrawStreamTB::DumpStackInfo(const struct AliTRDrawStack *st)
2255 // format the string with the stack info
2257 return Form("[ Stack Info 0x%08x ] : Hsize %d Links Active %d %d %d %d %d %d %d %d %d %d %d %d",
2260 st->fLinksActive[0], st->fLinksActive[1], st->fLinksActive[2], st->fLinksActive[3],
2261 st->fLinksActive[4], st->fLinksActive[5], st->fLinksActive[6], st->fLinksActive[7],
2262 st->fLinksActive[8], st->fLinksActive[9], st->fLinksActive[10], st->fLinksActive[11]);
2265 //--------------------------------------------------------
2266 void AliTRDrawStreamTB::DecodeHCwordH0(const UInt_t *word, struct AliTRDrawHC *hc) const
2269 // decode the hc header word 0
2273 UInt_t vword = *word;
2275 hc->fCorrupted = HC_HEADER_MASK_ERR(vword);
2276 if (hc->fCorrupted > 0)
2278 hc->fH0ErrorCounter++;
2281 hc->fSpecialRawV = HC_SPECIAL_RAW_VERSION(vword);
2282 hc->fRawVMajor = HC_MAJOR_RAW_VERSION(vword);
2283 hc->fRawVMajorOpt = HC_MAJOR_RAW_VERSION_OPT(vword);
2284 hc->fRawVMinor = HC_MINOR_RAW_VERSION(vword);
2285 hc->fNExtraWords = HC_EXTRA_WORDS(vword);
2286 hc->fDCSboard = HC_DCS_BOARD(vword);
2287 hc->fSM = HC_SM_NUMBER(vword);
2288 hc->fStack = HC_STACK_NUMBER(vword);
2289 hc->fLayer = HC_LAYER_NUMBER(vword);
2290 hc->fSide = HC_SIDE_NUMBER(vword);
2292 hc->fPos[0] = (UInt_t*)word;
2296 //--------------------------------------------------------
2297 void AliTRDrawStreamTB::DecodeHCwordH1(const UInt_t *word, struct AliTRDrawHC *hc) const
2304 UInt_t vword = *word;
2306 hc->fCorrupted += 2 * HC_HEADER_MASK_ERR(vword);
2307 if (hc->fCorrupted >= 2)
2309 hc->fH1ErrorCounter++;
2312 hc->fTimeBins = HC_NTIMEBINS(vword);
2313 hc->fBunchCrossCounter = HC_BUNCH_CROSS_COUNTER(vword);
2314 hc->fPreTriggerCounter = HC_PRETRIGGER_COUNTER(vword);
2315 hc->fPreTriggerPhase = HC_PRETRIGGER_PHASE(vword);
2317 hc->fPos[1] = (UInt_t*)word;
2320 //--------------------------------------------------------
2321 const char *AliTRDrawStreamTB::DumpHCinfoH0(const struct AliTRDrawHC *hc)
2327 return Form("Unable to dump. Null received as parameter!?!");
2329 return Form("[ HC[0] at 0x%08x ] : 0x%08x Info is : RawV %d SM %d Stack %d Layer %d Side %d DCSboard %d",
2330 hc->fPos[0], *(hc->fPos[0]), hc->fRawVMajor, hc->fSM, hc->fStack, hc->fLayer, hc->fSide, hc->fDCSboard);
2333 //--------------------------------------------------------
2334 const char *AliTRDrawStreamTB::DumpHCinfoH1(const struct AliTRDrawHC *hc)
2340 return Form("Unable to dump. Null received as parameter!?!");
2342 return Form("[ HC[1] at 0x%08x ] : 0x%08x Info is : TBins %d BCcount %d PreTrigCount %d PreTrigPhase %d",
2343 hc->fPos[1], *(hc->fPos[1]), hc->fTimeBins, hc->fBunchCrossCounter, hc->fPreTriggerCounter, hc->fPreTriggerPhase);
2346 //--------------------------------------------------------
2347 void AliTRDrawStreamTB::DecodeMCMheader(const UInt_t *word, struct AliTRDrawMCM *mcm) const
2350 // decode the mcm header
2353 UInt_t vword = *word;
2355 if (vword == END_OF_TRACKLET_MARKERNEW)
2357 if (fgWarnError) AliError(Form("There should be MCM header. We meet END_OF_TRACKLET_MARKER 0x%08x",vword));
2358 mcm->fCorrupted += 16;
2359 fHC->fCorrupted += 16; //to finish data reading of this HC
2361 mcm->fCorrupted = MCM_HEADER_MASK_ERR(vword); //if MCM header mask has error, set mcm->fCorrupted = 1
2362 if (mcm->fCorrupted)
2363 mcm->fErrorCounter++;
2364 mcm->fROB = MCM_ROB_NUMBER(vword);
2365 mcm->fMCM = MCM_MCM_NUMBER(vword);
2366 mcm->fEvCounter = MCM_EVENT_COUNTER(vword);
2367 mcm->fPos = (UInt_t*)word;
2370 //--------------------------------------------------------
2371 UInt_t AliTRDrawStreamTB::GetMCMadcMask(const UInt_t *word, struct AliTRDrawMCM *mcm) const
2377 UInt_t vword = *word;
2383 mcm->fADCMaskWord = vword;
2385 if (vword == END_OF_TRACKLET_MARKERNEW)
2387 if (fgWarnError) AliError(Form("There should be MCMadcMask. We meet END_OF_TRACKLET_MARKER 0x%08x",vword));
2388 mcm->fCorrupted += 16;
2389 fHC->fCorrupted += 16; //to finish data reading of this HC
2392 if ( MCM_ADCMASK_MASK_ERR(vword) == 0 )
2394 mcm->fADCMask = MCM_ADCMASK_VAL(vword);
2395 mcm->fADCcount = MCM_ADCMASK_NADC(~vword);
2399 mcm->fADCMask = 0xffffffff;
2400 mcm->fCorrupted += 2;
2401 mcm->fMaskErrorCounter++;
2404 return mcm->fADCMask;
2407 //--------------------------------------------------------
2408 void AliTRDrawStreamTB::DecodeMask(const UInt_t *word, struct AliTRDrawMCM *mcm) const
2411 // decode the adc mask - adcs to be read out
2414 mcm->fMCMADCWords = 0;
2415 mcm->fSingleADCwords = 0;
2417 mcm->fADCMask = GetMCMadcMask(word, mcm);
2419 if (mcm->fADCMask > 0)
2421 for (Int_t i = 0; i < TRD_MAX_ADC; i++)
2423 mcm->fADCchannel[mcm->fADCmax] = 0;
2424 if( IS_BIT_SET(mcm->fADCMask,i) )
2426 mcm->fADCchannel[mcm->fADCmax] = i;
2431 if (mcm->fADCcount != mcm->fADCmax && fHC->fRawVMajor >= 32) // backward compatibility
2433 mcm->fCorrupted += 8;
2437 //--------------------------------------------------------
2438 void AliTRDrawStreamTB::MCMADCwordsWithTbins(UInt_t fTbins, struct AliTRDrawMCM *mcm) const
2441 // count the expected mcm words for a given tbins
2443 mcm->fMCMADCWords = ( mcm->fADCmax ) * ( fTbins / 3 );
2444 mcm->fSingleADCwords = 0;
2445 if (mcm->fADCmax > 0)
2447 mcm->fSingleADCwords = mcm->fMCMADCWords/mcm->fADCmax;
2451 //--------------------------------------------------------
2452 const unsigned long AliTRDrawStreamTB::AdvancePseudoRandom(unsigned long *val) const
2455 // pseudo random number generator for test pattern data
2457 unsigned long currentVal = *val;
2459 *val = ( (*val << 1) | (((*val >> 9) ^ (*val >> 6)) & 1) ) & 0x3FF;
2463 //--------------------------------------------------------
2464 const char *AliTRDrawStreamTB::DumpMCMinfo(const struct AliTRDrawMCM *mcm)
2467 // mcm info in a string
2470 return Form("Unable to dump. Null received as parameter!?!");
2472 return Form("[ MCM 0x%08x ] : ROB %d MCM %d EvCounter %d", *(mcm->fPos), mcm->fROB, mcm->fMCM, mcm->fEvCounter);
2475 //--------------------------------------------------------
2476 //TString DumpMCMadcMask(const struct AliTRDrawMCMInfo *mcm)
2477 const char *AliTRDrawStreamTB::DumpMCMadcMask(const struct AliTRDrawMCM *mcm)
2480 // mcm adc mask in a string
2483 return Form("Unable to dump. Null received as parameter!?!");
2485 TString tsreturn = Form("[Word] : 0x%08x => [Mask] : 0x%08x : ", mcm->fADCMaskWord, mcm->fADCMask);
2486 for (Int_t i = 0; i < 21; i++)
2488 tsreturn += Form("%d ", mcm->fADCchannel[i]);
2491 return tsreturn.Data();