-#ifndef ALITRDRAWFASTSTREAM_H\r
-#define ALITRDRAWFASTSTREAM_H\r
-\r
-/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
- * See cxx source for full Copyright notice */\r
-\r
-/* $Id: AliTRDrawFastStream.h 27696 2008-07-31 09:18:53Z cblume $ */\r
-\r
-/////////////////////////////////////////////////////////////////////////////////\r
-// //\r
-// This class provides access to TRD digits in raw data in a way of streaming. //\r
-// //\r
-/////////////////////////////////////////////////////////////////////////////////\r
-\r
-#include "AliTRDrawStreamBase.h"\r
-#include "AliTRDarrayADC.h"\r
-#include "AliTRDarrayDictionary.h"\r
-#include "AliTRDSignalIndex.h"\r
-\r
-class AliTRDgeometry;\r
-class AliRawReader;\r
-class AliTRDdigitsManager;\r
-class TTreeSRedirector;\r
-class AliTRDfeeParam;\r
-\r
-\r
-class AliTRDrawFastStream : public AliTRDrawStreamBase\r
-{ // class def begin\r
-\r
- public:\r
- \r
- //--------------------------------------------------------\r
- // THE STRUCTURES\r
- //--------------------------------------------------------\r
-\r
- struct AliTRDrawMCM\r
- { // mcm struct\r
- Int_t fROB; // ROB number\r
- Int_t fMCM; // MCM number\r
- Int_t fROW; // row number filed during decoding\r
- \r
- UInt_t fEvCounter; // MCM event counter\r
- UInt_t fADCMask; // ADC mask\r
- UInt_t fADCMaskWord; // word with ADC mask in\r
- UInt_t fADCchannel[TRDMAXADC]; // channels to be decoded accrording to ADC mask\r
- \r
- Int_t fADCmax; // number of ADCs fired\r
- Int_t fADCcount; // number of ADCs fired from double checking bit\r
- Int_t fSingleADCwords; // n of words per ADC\r
- \r
- Int_t fMCMhdCorrupted; // is mcm header corrupted\r
- Int_t fADCmaskCorrupted; // is mcm adc mask corrupted\r
- Bool_t fDataCorrupted; // true if the corruption is in ADC data level \r
- \r
- UInt_t *fPos; //! position of mcm header in the buffer\r
- UInt_t *fAdcDataPos; //! start of ADC data for this mcm\r
-\r
- Int_t fADCcounter; // count the adcs decoded\r
- \r
-\r
- AliTRDrawMCM()\r
- : fROB(-1)\r
- , fMCM(-1)\r
- , fROW(-1)\r
- , fEvCounter(0)\r
- , fADCMask(0)\r
- , fADCMaskWord(0)\r
- , fADCchannel() \r
- , fADCmax(0)\r
- , fADCcount(0)\r
- , fSingleADCwords(0)\r
- , fMCMhdCorrupted(0) \r
- , fADCmaskCorrupted(0) \r
- , fDataCorrupted(0) \r
- , fPos(0)\r
- , fAdcDataPos(0)\r
- , fADCcounter(0)\r
- {\r
- // default constructor\r
- };\r
-\r
- AliTRDrawMCM(const AliTRDrawMCM & p):\r
- fROB(p.fROB)\r
- , fMCM(p.fMCM)\r
- , fROW(p.fROW)\r
- , fEvCounter(p.fEvCounter)\r
- , fADCMask(p.fADCMask)\r
- , fADCMaskWord(p.fADCMaskWord)\r
- , fADCchannel() \r
- , fADCmax(p.fADCmax)\r
- , fADCcount(p.fADCcount)\r
- , fSingleADCwords(p.fSingleADCwords)\r
- , fMCMhdCorrupted(p.fMCMhdCorrupted) \r
- , fADCmaskCorrupted(p.fADCmaskCorrupted) \r
- , fDataCorrupted(p.fDataCorrupted) \r
- , fPos(p.fPos)\r
- , fAdcDataPos(p.fAdcDataPos)\r
- , fADCcounter(p.fADCcounter)\r
- {\r
- // copy constructor\r
- };\r
-\r
- AliTRDrawMCM &operator=(const AliTRDrawMCM &)\r
- {\r
- // assignment operator\r
- // not implemented\r
- return *this;\r
- };\r
-\r
- };\r
-\r
- //--------------------------------------------------------\r
-\r
- struct AliTRDrawHC\r
- { // hc struct\r
- \r
- //tacklet words of given HC\r
- UInt_t fTrackletWords[MAXTRACKLETSPERHC]; // array to keep tracklet words \r
- Short_t fNTracklets; // number of tracklet \r
-\r
- // header word 0\r
- Int_t fSpecialRawV; // Raw data version\r
- Int_t fRawVMajor; // Raw data version\r
- Int_t fRawVMajorOpt; // Raw data version\r
- Int_t fRawVMinor; // Raw data version\r
- Int_t fNExtraWords; // N extra HC header words\r
- Int_t fDCSboard; // DCS board number\r
- Int_t fSM; // Super Module number\r
- Int_t fSMHCheader; // Super Module number from HC header\r
- Int_t fStack; // Stack number (some people might call it a chamber)\r
- Int_t fStackHCheader; // Stack number from HC header(some people might call it a chamber)\r
- Int_t fLayer; // Layer number (some people might call it a plane)\r
- Int_t fLayerHCheader; // Layer number from HC header(some people might call it a plane)\r
- Int_t fSide; // Side of HC\r
- Int_t fSideHCheader; // Side of HC from HC header\r
- \r
- // header word 1\r
- Int_t fTimeBins; // N of t bins\r
- UInt_t fBunchCrossCounter; // Bunch crossing counter\r
- UInt_t fPreTriggerCounter; // Pre Trigger counter\r
- UInt_t fPreTriggerPhase; // Pre Trigger phase\r
- \r
- // error \r
- UShort_t fErrorCodes[1411]; // array to keep encoded errors\r
- UInt_t fNErrors; // number of total errors of given hc \r
-\r
- Short_t fH0Corrupted; // is hc header 0 corrupted \r
- Short_t fH1Corrupted; // is hc header 1 corrupted\r
- Short_t fCorrupted; // is hc data corrupted \r
- Bool_t fEOTECorrupted; // if the corruption is due to meet END_OF_TRACKLET_MARKERNEW\r
- Bool_t fBufferCorrupted; // if the corruption is due to buffer end\r
- Bool_t fDataCorrupted; // if the corruption is on the MCM data\r
-\r
- Short_t fMCMCorrupted[TRDMAXMCM]; // is hc data corrupted \r
-\r
- UInt_t *fPos[2]; //! position of the header words in buffer\r
- \r
- Int_t fDET; // filled while decoding\r
- Int_t fROC; // filled while decoding\r
- Int_t fRowMax; // filled while decoding\r
- Int_t fColMax; // filled while decoding\r
-\r
- // hc data\r
- Int_t fMCMmax; // number of mcm found\r
-\r
- AliTRDrawHC()\r
- : fTrackletWords() \r
- , fNTracklets(0)\r
- , fSpecialRawV(0)\r
- , fRawVMajor(0)\r
- , fRawVMajorOpt(0)\r
- , fRawVMinor(0)\r
- , fNExtraWords(0)\r
- , fDCSboard(-1)\r
- , fSM(-1)\r
- , fSMHCheader(-1)\r
- , fStack(-1)\r
- , fStackHCheader(-1)\r
- , fLayer(-1)\r
- , fLayerHCheader(-1)\r
- , fSide(-1)\r
- , fSideHCheader(-1)\r
- , fTimeBins(0)\r
- , fBunchCrossCounter(0)\r
- , fPreTriggerCounter(0)\r
- , fPreTriggerPhase(0)\r
- , fNErrors(0)\r
- , fH0Corrupted(0)\r
- , fH1Corrupted(0)\r
- , fCorrupted(0)\r
- , fEOTECorrupted(0)\r
- , fBufferCorrupted(0)\r
- , fDataCorrupted(0)\r
- , fPos()\r
- , fDET(-1)\r
- , fROC(-1)\r
- , fRowMax(-1)\r
- , fColMax(-1)\r
- , fMCMmax(0)\r
- {\r
- // default constructor hc info \r
- };\r
-\r
- AliTRDrawHC(const AliTRDrawHC & p):\r
- fTrackletWords() \r
- , fNTracklets(p.fNTracklets)\r
- , fSpecialRawV(p.fSpecialRawV)\r
- , fRawVMajor(p.fRawVMajor)\r
- , fRawVMajorOpt(p.fRawVMajorOpt)\r
- , fRawVMinor(p.fRawVMinor)\r
- , fNExtraWords(p.fNExtraWords)\r
- , fDCSboard(p.fDCSboard)\r
- , fSM(p.fSM)\r
- , fSMHCheader(p.fSMHCheader)\r
- , fStack(p.fStack)\r
- , fStackHCheader(p.fStackHCheader)\r
- , fLayer(p.fLayer)\r
- , fLayerHCheader(p.fLayerHCheader)\r
- , fSide(p.fSide)\r
- , fSideHCheader(p.fSideHCheader)\r
- , fTimeBins(p.fTimeBins)\r
- , fBunchCrossCounter(p.fBunchCrossCounter)\r
- , fPreTriggerCounter(p.fPreTriggerCounter)\r
- , fPreTriggerPhase(p.fPreTriggerPhase)\r
- , fNErrors(p.fNErrors)\r
- , fH0Corrupted(p.fH0Corrupted)\r
- , fH1Corrupted(p.fH1Corrupted)\r
- , fCorrupted(p.fCorrupted)\r
- , fEOTECorrupted(p.fEOTECorrupted)\r
- , fBufferCorrupted(p.fBufferCorrupted)\r
- , fDataCorrupted(p.fDataCorrupted)\r
- , fPos()\r
- , fDET(p.fDET)\r
- , fROC(p.fROC)\r
- , fRowMax(p.fRowMax)\r
- , fColMax(p.fColMax)\r
- , fMCMmax(p.fMCMmax)\r
- {\r
- // copy constructor\r
- };\r
-\r
- AliTRDrawHC &operator=(const AliTRDrawHC &)\r
- {\r
- // assignment operator\r
- // not implemented\r
- return *this;\r
- };\r
-\r
- };\r
-\r
- //--------------------------------------------------------\r
- \r
- struct AliTRDrawStack\r
- {\r
- UInt_t fHeaderSize; // header size of the stack info\r
- Bool_t fLinksActive[12]; // data links active - 1 per half chamber\r
- Short_t fLinksDataType[12]; // 0 indicating real data for the front-end electronics \r
- Short_t fLinksMonitor[12]; // 0 indicating properly operating link \r
- Short_t fLinkMonitorError[12]; // record link monitor error\r
- Int_t fActiveLinks; // number of active links\r
- UInt_t *fPos; //! position in the buffer\r
- \r
- AliTRDrawHC fHalfChambers[12]; // 12 half chambers in a stack\r
- \r
- AliTRDrawStack()\r
- : fHeaderSize(0)\r
- , fLinksActive()\r
- , fLinksDataType()\r
- , fLinksMonitor()\r
- , fLinkMonitorError()\r
- , fActiveLinks(0)\r
- , fPos(0)\r
- , fHalfChambers()\r
- {\r
- // default constructor\r
- }; \r
-\r
- AliTRDrawStack(const AliTRDrawStack & p):\r
- fHeaderSize(p.fHeaderSize)\r
- , fLinksActive()\r
- , fLinksDataType()\r
- , fLinksMonitor()\r
- , fLinkMonitorError()\r
- , fActiveLinks(p.fActiveLinks)\r
- , fPos(p.fPos)\r
- , fHalfChambers()\r
- {\r
- // copy constructor\r
- };\r
-\r
- AliTRDrawStack &operator=(const AliTRDrawStack &)\r
- {\r
- // assignment operator\r
- // not implemented\r
- return *this;\r
- };\r
-\r
- };\r
-\r
- //--------------------------------------------------------\r
-\r
- struct AliTRDrawSM\r
- {\r
- UInt_t fHeaderSize; // size of the header in words\r
- Bool_t fTrackletEnable; // tracklet enable bit\r
- Bool_t fStackActive[5]; // map of active/expected stacks\r
- Int_t fActiveStacks; // number of active stacks\r
- Int_t fCorrupted; // is sm info corrupted\r
- Int_t fNexpectedHalfChambers; // number of half chambers to be read out in this sm\r
- UInt_t *fPos; // location of the sm info - should be the first word (after CDH if not DDL buffer)\r
-\r
- AliTRDrawStack fStacks[5]; // 5 stacks\r
-\r
- AliTRDrawSM()\r
- : fHeaderSize(0)\r
- , fTrackletEnable(0)\r
- , fStackActive()\r
- , fActiveStacks(0)\r
- , fCorrupted(0)\r
- , fNexpectedHalfChambers(0)\r
- , fPos(0)\r
- , fStacks()\r
- {\r
- // Default constructor\r
- }; \r
-\r
- AliTRDrawSM(const AliTRDrawSM & p):\r
- fHeaderSize(p.fHeaderSize)\r
- , fTrackletEnable(p.fTrackletEnable)\r
- , fStackActive()\r
- , fActiveStacks(p.fActiveStacks)\r
- , fCorrupted(p.fCorrupted)\r
- , fNexpectedHalfChambers(p.fNexpectedHalfChambers)\r
- , fPos(p.fPos)\r
- , fStacks()\r
- {\r
- // copy constructor\r
- };\r
-\r
- AliTRDrawSM &operator=(const AliTRDrawSM &)\r
- {\r
- // assignment operator\r
- // not implemented\r
- return *this;\r
- };\r
-\r
- };\r
- \r
- //--------------------------------------------------------\r
- \r
- AliTRDrawFastStream();\r
- AliTRDrawFastStream(AliRawReader *rawReader);\r
- virtual ~AliTRDrawFastStream();\r
-\r
- //--------------------------------------------------------\r
-\r
- virtual Bool_t Next(); // read the next data in the memory\r
- virtual Int_t NextChamber(AliTRDdigitsManager *man, UInt_t **trackletContainer, UShort_t **errorCodeContainer); // read next chamber data in the memory\r
- virtual Bool_t Init(); // initialize some internal variables\r
-\r
- Int_t NextBuffer(); // go and init next buffer if available - check the implementation file for return values\r
-\r
- Bool_t SetRawVersion(Int_t fraw); // set the raw version - used for backward compat.\r
- \r
- void SetSharedPadReadout(Bool_t fv) {fSharedPadsOn = fv;} // set the flag on if the reader should return the shared pads\r
- \r
- Bool_t DecodeSMHeader(void *buffer, UInt_t length); // decode a buffer\r
- Bool_t SetReader(AliRawReader *reader); // set the raw reader to use\r
- void SetNoErrorWarning() {fWarnError = kFALSE;} // disable warning and error info\r
- \r
- // from MCM Header Word\r
- // rob and mcm ordering\r
- // side 0(even link) - ROB: 0 2 4 6 MCM: 12 13 14 15 8 9 10 11 4 5 6 7 0 1 2 3 \r
- // side 1( odd link) - ROB: 1 3 5 7 MCM: 12 13 14 15 8 9 10 11 4 5 6 7 0 1 2 3 \r
-\r
-\r
- UShort_t *GetErrorCodes() const { return fHC->fErrorCodes;} // return error codes pointer per hc \r
- UInt_t GetNErrors() const {return fHC ? fHC->fNErrors: 0;} // [mj temp]\r
-\r
- // info from ADC data words\r
- // from here, only works with returning ADC channel pointer using Next() \r
-\r
- UInt_t *GetTrackletWords() const { return fHC->fTrackletWords;} // return tracklet words pointer per hc \r
- Int_t GetNTracklets() const {return fHC ? fHC->fNTracklets : -1;} // get number of tracklets \r
-\r
- Int_t GetSpecialRawVersion() const {return fHC ? fHC->fSpecialRawV : -1;} // return special raw version\r
- Int_t GetMajorRawVersion() const {return fHC ? fHC->fRawVMajor : -1;} // major raw version getter\r
- Int_t GetRawVersion() const {return fHC ? fHC->fRawVMajor : -1;} // compatibility see funtion above\r
- Int_t GetMinorRawVersion() const {return fHC ? fHC->fRawVMinor : -1;} // minor raw version\r
-\r
- Int_t GetSM() const {return fHC ? fHC->fSM : -1;} // SM Position of CURRENT half chamber in full TRD\r
- Int_t GetLayer() const {return fHC ? fHC->fLayer : -1;} // Layer Position of CURRENT half chamber in full TRD\r
- Int_t GetStack() const {return fHC ? fHC->fStack : -1;} // Stack Position of CURRENT half chamber in full TRD\r
- Int_t GetSide() const {return fHC ? fHC->fSide : -1;} // get side\r
- Int_t GetDCS() const { return fHC ? fHC->fDCSboard : -1;} // DCS board number read from data (HC header)\r
- Int_t GetROC() const { return fHC ? fHC->fROC : -1;} // ROB Position of CURRENT half chamber in full TRD\r
- Int_t GetNumberOfTimeBins() const { return fHC ? fHC->fTimeBins : 0;} // Get Ntime bins\r
- UInt_t GetBunchCrossCounter() const {return fHC ? fHC->fBunchCrossCounter : 0;} // get bunch cross counter\r
- UInt_t GetPreTriggerCounter() const {return fHC ? fHC->fPreTriggerCounter : 0;} // get pre trigger info\r
- UInt_t GetPreTriggerPhase() const {return fHC ? fHC->fPreTriggerPhase : 0;} // get trigger phase\r
-\r
- Int_t GetRow() const {return fMCM.fROW;} // get current row number\r
- Int_t GetCol() const {return fCOL;} \r
- Int_t GetExtendedCol() const {return fExtendedCOL;} \r
- Int_t GetRowMax() const { return fHC ? fHC->fRowMax : -1;} // Get maximum rows in the current HC\r
- Int_t GetColMax() const { return fHC ? fHC->fColMax : -1;} // Get maximum cols in the current HC\r
- // compatibility\r
- Int_t GetMaxRow() const { return fHC ? fHC->fRowMax : -1;} // Get maximum rows in the current HC\r
- Int_t GetMaxCol() const { return fHC ? fHC->fColMax : -1;} // Get maximum cols in the current HC\r
-\r
- UInt_t GetHCword0() const {return fHC ? *fHC->fPos[0] : 0;} // get the HC word 0\r
- UInt_t GetHCword1() const {return fHC ? *fHC->fPos[1] : 0;} // get the HC word 1\r
- \r
- Int_t GetDET() const {return fHC ? fHC->fDET : -1;} // get current det number\r
- Int_t GetDet() const {return fHC ? fHC->fDET : -1;} // get current det number\r
- \r
- Int_t GetROB() const {return fMCM.fROB;} // get current ROB number\r
- Int_t GetMCM() const {return fMCM.fMCM;} // get current MCM number\r
- Int_t GetEventNumber() const { return fMCM.fEvCounter;} // MCM Event number and position of current MCM on TRD chamber\r
-\r
- Int_t GetTimeBin() const { return 0;} // MCM ADC channel and Time Bin of word 1\r
-\r
- UInt_t *GetSMstreamPosition() const {return fSM.fPos;} // get position of the SM index word in the buffer\r
-\r
-\r
- //----------------------------------------------------------\r
- \r
- static void SetNoDebug() {fgDebugFlag = kFALSE;} // allow debug info\r
- static void EnableMemoryReset() {fgEnableMemoryReset = kTRUE;} // allow memory reset\r
- static void SetForceCleanDataOnly() {fgCleanDataOnly = kTRUE;} // clean data only\r
- static void AllowCorruptedData() {fgCleanDataOnly = kFALSE;} // accept corrupted data\r
-\r
- static void SetExtraWordsFix() {fgExtraSkip = kTRUE;} // extra skip of 24 32-bit words \r
- static void SetSkipCDH() {fgSkipCDH = kTRUE;} // skip of 8 32-bit words \r
- static void SetDumpHead(Int_t iv) {fgDumpHead = iv;}\r
- static void DisableStackNumberChecker() {fgStackNumberChecker = kFALSE;} // set false to cleanroom data \r
- static void DisableStackLinkNumberChecker() {fgStackLinkNumberChecker = kFALSE;} \r
- static void DisableSkipData() {fgSkipData = kFALSE;} // keep reading next words even previous words were corrupted - debugging purpose \r
-\r
- static void EnableDecodeConfigData() {fgEnableDecodeConfigData = kTRUE;} // allow configuration data decoding\r
- static Bool_t fgEnableDecodeConfigData; // flag to decode configuration data\r
-\r
- Int_t GetGlobalNTimeBins() const {return fGlobalNTimeBins;} // get number of time information for the digit container\r
-\r
- //--------------------------------------------------------\r
- // Decoding functions\r
- //--------------------------------------------------------\r
-\r
- void DecodeSMInfo(const UInt_t *word, struct AliTRDrawSM *sm) const ;\r
- const char *DumpSMInfo(const struct AliTRDrawSM *sm);\r
- void DecodeStackInfo(const UInt_t *word, struct AliTRDrawStack *st) const;\r
- void DecodeStackHeader(const UInt_t *word, struct AliTRDrawStack *st, Int_t iword) const;\r
- const char *DumpStackInfo(const struct AliTRDrawStack *st);\r
- Bool_t DecodeHCwordH0(const UInt_t *word, struct AliTRDrawHC *hc) const;\r
- Bool_t DecodeHCwordH1(const UInt_t *word, struct AliTRDrawHC *hc) const;\r
- const char *DumpHCinfoH0(const struct AliTRDrawHC *hc);\r
- const char *DumpHCinfoH1(const struct AliTRDrawHC *hc);\r
- void DecodeMCMheader(const UInt_t *word, struct AliTRDrawMCM *mcm) const;\r
- UInt_t GetMCMadcMask(const UInt_t *word, struct AliTRDrawMCM *mcm) const;\r
- void DecodeMask(const UInt_t *word, struct AliTRDrawMCM *mcm) const;\r
- void MCMADCwordsWithTbins(UInt_t fTbins, struct AliTRDrawMCM *mcm) const;\r
- const char *DumpMCMinfo(const struct AliTRDrawMCM *mcm);\r
- const char *DumpMCMadcMask(const struct AliTRDrawMCM *mcm);\r
-\r
-\r
- protected:\r
-\r
- Bool_t InitBuffer(void *buffer, UInt_t length); // init the buffer - called by DecodeSM(void*, UInt_t)\r
- Bool_t DumpWords(UInt_t *px, UInt_t iw, UInt_t marker = 0); // dump some words onto the screen\r
-\r
- void SwapOnEndian(); // swap if endian is BIG\r
- Bool_t SkipWords(UInt_t iw); // skip number of words\r
- Bool_t DecodeGTUheader(); // decode data in GTU header\r
- Bool_t DecodeTracklets(); // decode tracklets\r
- Bool_t DecodeHC(AliTRDdigitsManager *digitsManager, AliTRDarrayADC *digits, AliTRDarrayDictionary *track0, AliTRDarrayDictionary *track1, AliTRDarrayDictionary *track2, AliTRDSignalIndex *indexes); // decode data in HC\r
-\r
- Bool_t DecodeADC(AliTRDdigitsManager *digitsManager, AliTRDarrayADC *digits, AliTRDarrayDictionary *track0, AliTRDarrayDictionary *track1, AliTRDarrayDictionary *track2, AliTRDSignalIndex *indexes); // decode 10 ADC words\r
- Bool_t DecodeADCExtended(AliTRDdigitsManager *digitsManager, AliTRDarrayADC *digits, AliTRDarrayDictionary *track0, AliTRDarrayDictionary *track1, AliTRDarrayDictionary *track2, AliTRDSignalIndex *indexes); // decode 10 ADC words\r
-\r
- Bool_t DecodeHCheader(); // decode HC header\r
- Bool_t SeekEndOfData(); // go to next end of raw data marker (actually 1 word after)\r
- Bool_t SkipMCMdata(UInt_t iw); // skip this mcm data due to mcm header corruption\r
- Bool_t SeekNextMCMheader(); // go to next mcm header\r
- Bool_t DecodeMCMheader(); // decode mcm header\r
-\r
- Bool_t IsRowValid(); // check if row within the range\r
- Bool_t IsHCheaderOK(); // check if current hc header data make sense\r
- Bool_t IsMCMheaderOK(); // check if current mcm header data make sense\r
- \r
- Bool_t SetGlobalNTimebins(); // set number of timebin based on the value read from HC header, this value will be used in the digit container\r
- Bool_t SetNTimebins(); // set number of timebin based on the value read from HC header\r
-\r
- void ResetCounters(); // reset some counters\r
- void ResetIterators(); // needed for Next()\r
- void ResetPerSM(); // reset every SM \r
- void ResetPerStack(); // reset every Stack \r
- void ResetPerHC(); // reset every HC \r
- void ResetPerMCM(); // reset every MCM \r
- void ResetMemory(); // reset all data members\r
-\r
- AliTRDrawFastStream(const AliTRDrawFastStream& st);\r
- AliTRDrawFastStream &operator=(const AliTRDrawFastStream &);\r
-\r
- // ----------------- DATA MEMBERS START\r
-\r
- struct AliTRDrawSM fSM; // one SM per buffer\r
- struct AliTRDrawStack *fStack; //! pointer to the current stack\r
- struct AliTRDrawHC *fHC; //! current HC\r
- struct AliTRDrawHC *fLastHC; //! last HC\r
- struct AliTRDrawMCM fMCM; //! current MCM\r
- \r
- UInt_t *fpPos; // current position in the buffer\r
- UInt_t *fpBegin; // begin - pointer to the buffer word 0\r
- UInt_t *fpEnd; // end of the buffer\r
-\r
- UInt_t fWordLength; // length of the buffer in 32bit words\r
-\r
- UInt_t *fpPosTemp; // specific position in the buffer \r
- Int_t fGlobalNTimeBins; // number of time bin to be used in the digit container\r
- Bool_t fIsTimeBinSet; // set true if the global time bin is set to avoid multiple search\r
-\r
- Int_t fStackNumber; // current stack number\r
- Int_t fStackLinkNumber; // current link in the stack\r
-\r
- Int_t fLinkTrackletCounter; // count the tracklets in the current HC\r
- Int_t fEndOfTrackletCount; // count link by link (hc by hc) used for debug\r
- Int_t fNWordsCounter; // counts words of given hc having link monitor error\r
-\r
- UInt_t fMaskADCword; // temp mask when decoding adcs\r
- UInt_t fTbinADC; // temp adc \r
-\r
- UInt_t fEventCounter; // stores the valid/current MCM event counter\r
- UInt_t fLastEventCounter; // last known event counter of MCM\r
-\r
- Bool_t fSharedPadsOn; // do we want to output shared pads - default is off\r
- Int_t fMaxADCgeom; // maximum ADC channels per mcm\r
-\r
- Short_t fADCnumber; // number of the ADC 0 .. 20\r
- Short_t fCOL; // column - row from MCM\r
- Short_t fExtendedCOL; // virtual column for extended digit container\r
- Bool_t fIsShared; // true if the pad is shared pad\r
- Bool_t fWarnError; // no errors no warnings\r
-\r
- Bool_t fBufferRead; // set true if the buffer for one ddl is read\r
-\r
- AliTRDgeometry *fGeometry; //! TRD geometry\r
- AliRawReader *fRawReader; //! raw reader \r
-\r
- AliTRDfeeParam *fTRDfeeParam; // pointer to the fee params\r
- Int_t fCommonAdditive; // baseline value \r
-\r
- // STATIC \r
-\r
- static Bool_t fgExtraSkip; // whether we should skip the leading 24 words\r
- static Bool_t fgSkipCDH; // whether we should skip CDH (8 words)\r
- static Bool_t fgCleanDataOnly; // release only clean events = no errors\r
- static Bool_t fgDebugFlag; // allow debugging info\r
- static Bool_t fgEnableMemoryReset; // allow memory reset\r
- static Bool_t fgStackNumberChecker; // decide if we check stack number insanity - set false to cleanroom data\r
- static Bool_t fgStackLinkNumberChecker; // decide if we check stack link number insanity - debuging purpose\r
- static Bool_t fgSkipData; // decide if we skip corrupted data of given HC\r
- static Int_t fgDumpHead; // number of words to dump (from the start of the buffer) on each Init\r
- static Short_t fgMCMordering[16]; // mcm number odering for mcm header corruption check\r
- static Short_t fgROBordering[16]; // mcm number odering for mcm header corruption check\r
- static Int_t fgLastHC; // HC number indicator to check HC numbering\r
- static Int_t fgLastROB; // ROB number indicator to check ROB numbering \r
- static Int_t fgLastIndex; // variable to check mcm number odering\r
-\r
- // ----------------- DATA MEMBERS STOP\r
-\r
- enum ETRDzRawStreamError \r
- {\r
- kDecodeStackInfo = 1 //\r
- , kMissingData = 2 //\r
- , kLinkDataMissing = 3 //\r
- , kHCdataMissing = 4 //\r
- , kTrackletOverflow = 5 //\r
- , kEOTrackeltsMissing = 6 //\r
- , kWrongPadrow = 7 //\r
- , kMCMheaderCorrupted = 8 //\r
- , kWrongMCMorROB = 9 //\r
- , kMCMeventMissmatch = 10 //\r
- , kMCMADCMaskMissing = 11 //\r
- , kHCHeaderCorrupt = 12 //\r
- , kHCHeaderWrongStack = 13 //\r
- , kHCHeaderWrongLayer = 14 //\r
- , kHCHeaderWrongSide = 15 //\r
- , kHCHeaderWrongSM = 16 //\r
- , kHCHeaderWrongDet = 17 //\r
- , kHCHeaderWrongROC = 18 //\r
- , kHCWordMissing = 19 //\r
- , kMCMdataMissing = 20 //\r
- , kMCMoverflow = 21 //\r
- , kADCdataMissing = 22 //\r
- , kADCmaskMissmatch = 23 //\r
- , kWrongPadcolumn = 24 //\r
- }; \r
-\r
- ClassDef(AliTRDrawFastStream, 1)\r
-}; //clas def end\r
-\r
-#endif\r
+#ifndef ALITRDRAWFASTSTREAM_H\r\r
+#define ALITRDRAWFASTSTREAM_H\r\r
+\r\r
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r\r
+ * See cxx source for full Copyright notice */\r\r
+\r\r
+/* $Id: AliTRDrawFastStream.h 27696 2008-07-31 09:18:53Z cblume $ */\r\r
+\r\r
+/////////////////////////////////////////////////////////////////////////////////\r\r
+// //\r\r
+// This class provides access to TRD digits in raw data in a way of streaming. //\r\r
+// //\r\r
+/////////////////////////////////////////////////////////////////////////////////\r\r
+\r\r
+#include "AliTRDrawStreamBase.h"\r\r
+#include "AliTRDarrayADC.h"\r\r
+#include "AliTRDarrayDictionary.h"\r\r
+#include "AliTRDSignalIndex.h"\r\r
+\r\r
+class AliTRDgeometry;\r\r
+class AliRawReader;\r\r
+class AliTRDdigitsManager;\r\r
+class TTreeSRedirector;\r\r
+class AliTRDfeeParam;\r\r
+\r\r
+\r\r
+class AliTRDrawFastStream : public AliTRDrawStreamBase\r\r
+{ // class def begin\r\r
+\r\r
+ public:\r\r
+ \r\r
+ //--------------------------------------------------------\r\r
+ // THE STRUCTURES\r\r
+ //--------------------------------------------------------\r\r
+\r\r
+ struct AliTRDrawMCM\r\r
+ { // mcm struct\r\r
+ Int_t fROB; // ROB number\r\r
+ Int_t fMCM; // MCM number\r\r
+ Int_t fROW; // row number filed during decoding\r\r
+ \r\r
+ UInt_t fEvCounter; // MCM event counter\r\r
+ UInt_t fADCMask; // ADC mask\r\r
+ UInt_t fADCMaskWord; // word with ADC mask in\r\r
+ UInt_t fADCchannel[TRDMAXADC]; // channels to be decoded accrording to ADC mask\r\r
+ \r\r
+ Int_t fADCmax; // number of ADCs fired\r\r
+ Int_t fADCcount; // number of ADCs fired from double checking bit\r\r
+ Int_t fSingleADCwords; // n of words per ADC\r\r
+ \r\r
+ Int_t fMCMhdCorrupted; // is mcm header corrupted\r\r
+ Int_t fADCmaskCorrupted; // is mcm adc mask corrupted\r\r
+ Bool_t fDataCorrupted; // true if the corruption is in ADC data level \r\r
+ \r\r
+ UInt_t *fPos; //! position of mcm header in the buffer\r\r
+ UInt_t *fAdcDataPos; //! start of ADC data for this mcm\r\r
+\r\r
+ Int_t fADCcounter; // count the adcs decoded\r\r
+ \r\r
+\r\r
+ AliTRDrawMCM()\r\r
+ : fROB(-1)\r\r
+ , fMCM(-1)\r\r
+ , fROW(-1)\r\r
+ , fEvCounter(0)\r\r
+ , fADCMask(0)\r\r
+ , fADCMaskWord(0)\r\r
+ , fADCchannel() \r\r
+ , fADCmax(0)\r\r
+ , fADCcount(0)\r\r
+ , fSingleADCwords(0)\r\r
+ , fMCMhdCorrupted(0) \r\r
+ , fADCmaskCorrupted(0) \r\r
+ , fDataCorrupted(0) \r\r
+ , fPos(0)\r\r
+ , fAdcDataPos(0)\r\r
+ , fADCcounter(0)\r\r
+ {\r\r
+ // default constructor\r\r
+ };\r\r
+\r\r
+ AliTRDrawMCM(const AliTRDrawMCM & p):\r\r
+ fROB(p.fROB)\r\r
+ , fMCM(p.fMCM)\r\r
+ , fROW(p.fROW)\r\r
+ , fEvCounter(p.fEvCounter)\r\r
+ , fADCMask(p.fADCMask)\r\r
+ , fADCMaskWord(p.fADCMaskWord)\r\r
+ , fADCchannel() \r\r
+ , fADCmax(p.fADCmax)\r\r
+ , fADCcount(p.fADCcount)\r\r
+ , fSingleADCwords(p.fSingleADCwords)\r\r
+ , fMCMhdCorrupted(p.fMCMhdCorrupted) \r\r
+ , fADCmaskCorrupted(p.fADCmaskCorrupted) \r\r
+ , fDataCorrupted(p.fDataCorrupted) \r\r
+ , fPos(p.fPos)\r\r
+ , fAdcDataPos(p.fAdcDataPos)\r\r
+ , fADCcounter(p.fADCcounter)\r\r
+ {\r\r
+ // copy constructor\r\r
+ };\r\r
+\r\r
+ AliTRDrawMCM &operator=(const AliTRDrawMCM &)\r\r
+ {\r\r
+ // assignment operator\r\r
+ // not implemented\r\r
+ return *this;\r\r
+ };\r\r
+\r\r
+ };\r\r
+\r\r
+ //--------------------------------------------------------\r\r
+\r\r
+ struct AliTRDrawHC\r\r
+ { // hc struct\r\r
+ \r\r
+ //tacklet words of given HC\r\r
+ UInt_t fTrackletWords[MAXTRACKLETSPERHC]; // array to keep tracklet words \r\r
+ Short_t fNTracklets; // number of tracklet \r\r
+\r\r
+ // header word 0\r\r
+ Int_t fSpecialRawV; // Raw data version\r\r
+ Int_t fRawVMajor; // Raw data version\r\r
+ Int_t fRawVMajorOpt; // Raw data version\r\r
+ Int_t fRawVMinor; // Raw data version\r\r
+ Int_t fNExtraWords; // N extra HC header words\r\r
+ Int_t fDCSboard; // DCS board number\r\r
+ Int_t fSM; // Super Module number\r\r
+ Int_t fSMHCheader; // Super Module number from HC header\r\r
+ Int_t fStack; // Stack number (some people might call it a chamber)\r\r
+ Int_t fStackHCheader; // Stack number from HC header(some people might call it a chamber)\r\r
+ Int_t fLayer; // Layer number (some people might call it a plane)\r\r
+ Int_t fLayerHCheader; // Layer number from HC header(some people might call it a plane)\r\r
+ Int_t fSide; // Side of HC\r\r
+ Int_t fSideHCheader; // Side of HC from HC header\r\r
+ \r\r
+ // header word 1\r\r
+ Int_t fTimeBins; // N of t bins\r\r
+ UInt_t fBunchCrossCounter; // Bunch crossing counter\r\r
+ UInt_t fPreTriggerCounter; // Pre Trigger counter\r\r
+ UInt_t fPreTriggerPhase; // Pre Trigger phase\r\r
+ \r\r
+ // error \r\r
+ UShort_t fErrorCodes[1411]; // array to keep encoded errors\r\r
+ UInt_t fNErrors; // number of total errors of given hc \r\r
+\r\r
+ Short_t fH0Corrupted; // is hc header 0 corrupted \r\r
+ Short_t fH1Corrupted; // is hc header 1 corrupted\r\r
+ Short_t fCorrupted; // is hc data corrupted \r\r
+ Bool_t fEOTECorrupted; // if the corruption is due to meet END_OF_TRACKLET_MARKERNEW\r\r
+ Bool_t fBufferCorrupted; // if the corruption is due to buffer end\r\r
+ Bool_t fDataCorrupted; // if the corruption is on the MCM data\r\r
+\r\r
+ Short_t fMCMCorrupted[TRDMAXMCM]; // is hc data corrupted \r\r
+\r\r
+ UInt_t *fPos[2]; //! position of the header words in buffer\r\r
+ \r\r
+ Int_t fDET; // filled while decoding\r\r
+ Int_t fROC; // filled while decoding\r\r
+ Int_t fRowMax; // filled while decoding\r\r
+ Int_t fColMax; // filled while decoding\r\r
+\r\r
+ // hc data\r\r
+ Int_t fMCMmax; // number of mcm found\r\r
+\r\r
+ AliTRDrawHC()\r\r
+ : fTrackletWords() \r\r
+ , fNTracklets(0)\r\r
+ , fSpecialRawV(0)\r\r
+ , fRawVMajor(0)\r\r
+ , fRawVMajorOpt(0)\r\r
+ , fRawVMinor(0)\r\r
+ , fNExtraWords(0)\r\r
+ , fDCSboard(-1)\r\r
+ , fSM(-1)\r\r
+ , fSMHCheader(-1)\r\r
+ , fStack(-1)\r\r
+ , fStackHCheader(-1)\r\r
+ , fLayer(-1)\r\r
+ , fLayerHCheader(-1)\r\r
+ , fSide(-1)\r\r
+ , fSideHCheader(-1)\r\r
+ , fTimeBins(0)\r\r
+ , fBunchCrossCounter(0)\r\r
+ , fPreTriggerCounter(0)\r\r
+ , fPreTriggerPhase(0)\r\r
+ , fNErrors(0)\r\r
+ , fH0Corrupted(0)\r\r
+ , fH1Corrupted(0)\r\r
+ , fCorrupted(0)\r\r
+ , fEOTECorrupted(0)\r\r
+ , fBufferCorrupted(0)\r\r
+ , fDataCorrupted(0)\r\r
+ , fPos()\r\r
+ , fDET(-1)\r\r
+ , fROC(-1)\r\r
+ , fRowMax(-1)\r\r
+ , fColMax(-1)\r\r
+ , fMCMmax(0)\r\r
+ {\r\r
+ // default constructor hc info \r\r
+ };\r\r
+\r\r
+ AliTRDrawHC(const AliTRDrawHC & p):\r\r
+ fTrackletWords() \r\r
+ , fNTracklets(p.fNTracklets)\r\r
+ , fSpecialRawV(p.fSpecialRawV)\r\r
+ , fRawVMajor(p.fRawVMajor)\r\r
+ , fRawVMajorOpt(p.fRawVMajorOpt)\r\r
+ , fRawVMinor(p.fRawVMinor)\r\r
+ , fNExtraWords(p.fNExtraWords)\r\r
+ , fDCSboard(p.fDCSboard)\r\r
+ , fSM(p.fSM)\r\r
+ , fSMHCheader(p.fSMHCheader)\r\r
+ , fStack(p.fStack)\r\r
+ , fStackHCheader(p.fStackHCheader)\r\r
+ , fLayer(p.fLayer)\r\r
+ , fLayerHCheader(p.fLayerHCheader)\r\r
+ , fSide(p.fSide)\r\r
+ , fSideHCheader(p.fSideHCheader)\r\r
+ , fTimeBins(p.fTimeBins)\r\r
+ , fBunchCrossCounter(p.fBunchCrossCounter)\r\r
+ , fPreTriggerCounter(p.fPreTriggerCounter)\r\r
+ , fPreTriggerPhase(p.fPreTriggerPhase)\r\r
+ , fNErrors(p.fNErrors)\r\r
+ , fH0Corrupted(p.fH0Corrupted)\r\r
+ , fH1Corrupted(p.fH1Corrupted)\r\r
+ , fCorrupted(p.fCorrupted)\r\r
+ , fEOTECorrupted(p.fEOTECorrupted)\r\r
+ , fBufferCorrupted(p.fBufferCorrupted)\r\r
+ , fDataCorrupted(p.fDataCorrupted)\r\r
+ , fPos()\r\r
+ , fDET(p.fDET)\r\r
+ , fROC(p.fROC)\r\r
+ , fRowMax(p.fRowMax)\r\r
+ , fColMax(p.fColMax)\r\r
+ , fMCMmax(p.fMCMmax)\r\r
+ {\r\r
+ // copy constructor\r\r
+ };\r\r
+\r\r
+ AliTRDrawHC &operator=(const AliTRDrawHC &)\r\r
+ {\r\r
+ // assignment operator\r\r
+ // not implemented\r\r
+ return *this;\r\r
+ };\r\r
+\r\r
+ };\r\r
+\r\r
+ //--------------------------------------------------------\r\r
+ \r\r
+ struct AliTRDrawStack\r\r
+ {\r\r
+ UInt_t fHeaderSize; // header size of the stack info\r\r
+ Bool_t fLinksActive[12]; // data links active - 1 per half chamber\r\r
+ Short_t fLinksDataType[12]; // 0 indicating real data for the front-end electronics \r\r
+ Short_t fLinksMonitor[12]; // 0 indicating properly operating link \r\r
+ Short_t fLinkMonitorError[12]; // record link monitor error\r\r
+ Int_t fActiveLinks; // number of active links\r\r
+ UInt_t *fPos; //! position in the buffer\r\r
+ \r\r
+ AliTRDrawHC fHalfChambers[12]; // 12 half chambers in a stack\r\r
+ \r\r
+ AliTRDrawStack()\r\r
+ : fHeaderSize(0)\r\r
+ , fLinksActive()\r\r
+ , fLinksDataType()\r\r
+ , fLinksMonitor()\r\r
+ , fLinkMonitorError()\r\r
+ , fActiveLinks(0)\r\r
+ , fPos(0)\r\r
+ , fHalfChambers()\r\r
+ {\r\r
+ // default constructor\r\r
+ }; \r\r
+\r\r
+ AliTRDrawStack(const AliTRDrawStack & p):\r\r
+ fHeaderSize(p.fHeaderSize)\r\r
+ , fLinksActive()\r\r
+ , fLinksDataType()\r\r
+ , fLinksMonitor()\r\r
+ , fLinkMonitorError()\r\r
+ , fActiveLinks(p.fActiveLinks)\r\r
+ , fPos(p.fPos)\r\r
+ , fHalfChambers()\r\r
+ {\r\r
+ // copy constructor\r\r
+ };\r\r
+\r\r
+ AliTRDrawStack &operator=(const AliTRDrawStack &)\r\r
+ {\r\r
+ // assignment operator\r\r
+ // not implemented\r\r
+ return *this;\r\r
+ };\r\r
+\r\r
+ };\r\r
+\r\r
+ //--------------------------------------------------------\r\r
+\r\r
+ struct AliTRDrawSM\r\r
+ {\r\r
+ UInt_t fHeaderSize; // size of the header in words\r\r
+ Bool_t fTrackletEnable; // tracklet enable bit\r\r
+ Bool_t fStackActive[5]; // map of active/expected stacks\r\r
+ Int_t fActiveStacks; // number of active stacks\r\r
+ Int_t fCorrupted; // is sm info corrupted\r\r
+ Int_t fNexpectedHalfChambers; // number of half chambers to be read out in this sm\r\r
+ UInt_t *fPos; // location of the sm info - should be the first word (after CDH if not DDL buffer)\r\r
+\r\r
+ AliTRDrawStack fStacks[5]; // 5 stacks\r\r
+\r\r
+ AliTRDrawSM()\r\r
+ : fHeaderSize(0)\r\r
+ , fTrackletEnable(0)\r\r
+ , fStackActive()\r\r
+ , fActiveStacks(0)\r\r
+ , fCorrupted(0)\r\r
+ , fNexpectedHalfChambers(0)\r\r
+ , fPos(0)\r\r
+ , fStacks()\r\r
+ {\r\r
+ // Default constructor\r\r
+ }; \r\r
+\r\r
+ AliTRDrawSM(const AliTRDrawSM & p):\r\r
+ fHeaderSize(p.fHeaderSize)\r\r
+ , fTrackletEnable(p.fTrackletEnable)\r\r
+ , fStackActive()\r\r
+ , fActiveStacks(p.fActiveStacks)\r\r
+ , fCorrupted(p.fCorrupted)\r\r
+ , fNexpectedHalfChambers(p.fNexpectedHalfChambers)\r\r
+ , fPos(p.fPos)\r\r
+ , fStacks()\r\r
+ {\r\r
+ // copy constructor\r\r
+ };\r\r
+\r\r
+ AliTRDrawSM &operator=(const AliTRDrawSM &)\r\r
+ {\r\r
+ // assignment operator\r\r
+ // not implemented\r\r
+ return *this;\r\r
+ };\r\r
+\r\r
+ };\r\r
+ \r\r
+ //--------------------------------------------------------\r\r
+ \r\r
+ AliTRDrawFastStream();\r\r
+ AliTRDrawFastStream(AliRawReader *rawReader);\r\r
+ virtual ~AliTRDrawFastStream();\r\r
+\r\r
+ //--------------------------------------------------------\r\r
+\r\r
+ virtual Bool_t Next(); // read the next data in the memory\r\r
+ virtual Int_t NextChamber(AliTRDdigitsManager *man, UInt_t **trackletContainer, UShort_t **errorCodeContainer); // read next chamber data in the memory\r\r
+ virtual Bool_t Init(); // initialize some internal variables\r\r
+\r\r
+ Int_t NextBuffer(); // go and init next buffer if available - check the implementation file for return values\r\r
+\r\r
+ Bool_t SetRawVersion(Int_t fraw); // set the raw version - used for backward compat.\r\r
+ \r\r
+ void SetSharedPadReadout(Bool_t fv) {fSharedPadsOn = fv;} // set the flag on if the reader should return the shared pads\r\r
+ \r\r
+ Bool_t DecodeSMHeader(void *buffer, UInt_t length); // decode a buffer\r\r
+ Bool_t SetReader(AliRawReader *reader); // set the raw reader to use\r\r
+ void SetNoErrorWarning() {fWarnError = kFALSE;} // disable error info\r\r
+ void SetarnWarning() {fWarnWarning = kTRUE;} // enable warning \r\r
+ \r\r
+ // from MCM Header Word\r\r
+ // rob and mcm ordering\r\r
+ // side 0(even link) - ROB: 0 2 4 6 MCM: 12 13 14 15 8 9 10 11 4 5 6 7 0 1 2 3 \r\r
+ // side 1( odd link) - ROB: 1 3 5 7 MCM: 12 13 14 15 8 9 10 11 4 5 6 7 0 1 2 3 \r\r
+\r\r
+\r\r
+ UShort_t *GetErrorCodes() const { return fHC->fErrorCodes;} // return error codes pointer per hc \r\r
+ UInt_t GetNErrors() const {return fHC ? fHC->fNErrors: 0;} // [mj temp]\r\r
+\r\r
+ // info from ADC data words\r\r
+ // from here, only works with returning ADC channel pointer using Next() \r\r
+\r\r
+ UInt_t *GetTrackletWords() const { return fHC->fTrackletWords;} // return tracklet words pointer per hc \r\r
+ Int_t GetNTracklets() const {return fHC ? fHC->fNTracklets : -1;} // get number of tracklets \r\r
+\r\r
+ Int_t GetSpecialRawVersion() const {return fHC ? fHC->fSpecialRawV : -1;} // return special raw version\r\r
+ Int_t GetMajorRawVersion() const {return fHC ? fHC->fRawVMajor : -1;} // major raw version getter\r\r
+ Int_t GetRawVersion() const {return fHC ? fHC->fRawVMajor : -1;} // compatibility see funtion above\r\r
+ Int_t GetMinorRawVersion() const {return fHC ? fHC->fRawVMinor : -1;} // minor raw version\r\r
+\r\r
+ Int_t GetSM() const {return fHC ? fHC->fSM : -1;} // SM Position of CURRENT half chamber in full TRD\r\r
+ Int_t GetLayer() const {return fHC ? fHC->fLayer : -1;} // Layer Position of CURRENT half chamber in full TRD\r\r
+ Int_t GetStack() const {return fHC ? fHC->fStack : -1;} // Stack Position of CURRENT half chamber in full TRD\r\r
+ Int_t GetSide() const {return fHC ? fHC->fSide : -1;} // get side\r\r
+ Int_t GetDCS() const { return fHC ? fHC->fDCSboard : -1;} // DCS board number read from data (HC header)\r\r
+ Int_t GetROC() const { return fHC ? fHC->fROC : -1;} // ROB Position of CURRENT half chamber in full TRD\r\r
+ Int_t GetNumberOfTimeBins() const { return fHC ? fHC->fTimeBins : 0;} // Get Ntime bins\r\r
+ UInt_t GetBunchCrossCounter() const {return fHC ? fHC->fBunchCrossCounter : 0;} // get bunch cross counter\r\r
+ UInt_t GetPreTriggerCounter() const {return fHC ? fHC->fPreTriggerCounter : 0;} // get pre trigger info\r\r
+ UInt_t GetPreTriggerPhase() const {return fHC ? fHC->fPreTriggerPhase : 0;} // get trigger phase\r\r
+\r\r
+ Int_t GetRow() const {return fMCM.fROW;} // get current row number\r\r
+ Int_t GetCol() const {return fCOL;} \r\r
+ Int_t GetExtendedCol() const {return fExtendedCOL;} \r\r
+ Int_t GetRowMax() const { return fHC ? fHC->fRowMax : -1;} // Get maximum rows in the current HC\r\r
+ Int_t GetColMax() const { return fHC ? fHC->fColMax : -1;} // Get maximum cols in the current HC\r\r
+ // compatibility\r\r
+ Int_t GetMaxRow() const { return fHC ? fHC->fRowMax : -1;} // Get maximum rows in the current HC\r\r
+ Int_t GetMaxCol() const { return fHC ? fHC->fColMax : -1;} // Get maximum cols in the current HC\r\r
+\r\r
+ UInt_t GetHCword0() const {return fHC ? *fHC->fPos[0] : 0;} // get the HC word 0\r\r
+ UInt_t GetHCword1() const {return fHC ? *fHC->fPos[1] : 0;} // get the HC word 1\r\r
+ \r\r
+ Int_t GetDET() const {return fHC ? fHC->fDET : -1;} // get current det number\r\r
+ Int_t GetDet() const {return fHC ? fHC->fDET : -1;} // get current det number\r\r
+ \r\r
+ Int_t GetROB() const {return fMCM.fROB;} // get current ROB number\r\r
+ Int_t GetMCM() const {return fMCM.fMCM;} // get current MCM number\r\r
+ Int_t GetEventNumber() const { return fMCM.fEvCounter;} // MCM Event number and position of current MCM on TRD chamber\r\r
+\r\r
+ Int_t GetTimeBin() const { return 0;} // MCM ADC channel and Time Bin of word 1\r\r
+\r\r
+ UInt_t *GetSMstreamPosition() const {return fSM.fPos;} // get position of the SM index word in the buffer\r\r
+\r\r
+\r\r
+ //----------------------------------------------------------\r\r
+ \r\r
+ static void SetNoDebug() {fgDebugFlag = kFALSE;} // allow debug info\r\r
+ static void EnableMemoryReset() {fgEnableMemoryReset = kTRUE;} // allow memory reset\r\r
+ static void SetForceCleanDataOnly() {fgCleanDataOnly = kTRUE;} // clean data only\r\r
+ static void AllowCorruptedData() {fgCleanDataOnly = kFALSE;} // accept corrupted data\r\r
+\r\r
+ static void SetExtraWordsFix() {fgExtraSkip = kTRUE;} // extra skip of 24 32-bit words \r\r
+ static void SetSkipCDH() {fgSkipCDH = kTRUE;} // skip of 8 32-bit words \r\r
+ static void SetDumpHead(Int_t iv) {fgDumpHead = iv;}\r\r
+ static void DisableStackNumberChecker() {fgStackNumberChecker = kFALSE;} // set false to cleanroom data \r\r
+ static void DisableStackLinkNumberChecker() {fgStackLinkNumberChecker = kFALSE;} \r\r
+ static void DisableSkipData() {fgSkipData = kFALSE;} // keep reading next words even previous words were corrupted - debugging purpose \r\r
+\r\r
+ static void EnableDecodeConfigData() {fgEnableDecodeConfigData = kTRUE;} // allow configuration data decoding\r\r
+ static Bool_t fgEnableDecodeConfigData; // flag to decode configuration data\r\r
+\r\r
+ Int_t GetGlobalNTimeBins() const {return fGlobalNTimeBins;} // get number of time information for the digit container\r\r
+\r\r
+ //--------------------------------------------------------\r\r
+ // Decoding functions\r\r
+ //--------------------------------------------------------\r\r
+\r\r
+ void DecodeSMInfo(const UInt_t *word, struct AliTRDrawSM *sm) const ;\r\r
+ const char *DumpSMInfo(const struct AliTRDrawSM *sm);\r\r
+ void DecodeStackInfo(const UInt_t *word, struct AliTRDrawStack *st) const;\r\r
+ void DecodeStackHeader(const UInt_t *word, struct AliTRDrawStack *st, Int_t iword) const;\r\r
+ const char *DumpStackInfo(const struct AliTRDrawStack *st);\r\r
+ Bool_t DecodeHCwordH0(const UInt_t *word, struct AliTRDrawHC *hc) const;\r\r
+ Bool_t DecodeHCwordH1(const UInt_t *word, struct AliTRDrawHC *hc) const;\r\r
+ const char *DumpHCinfoH0(const struct AliTRDrawHC *hc);\r\r
+ const char *DumpHCinfoH1(const struct AliTRDrawHC *hc);\r\r
+ void DecodeMCMheader(const UInt_t *word, struct AliTRDrawMCM *mcm) const;\r\r
+ UInt_t GetMCMadcMask(const UInt_t *word, struct AliTRDrawMCM *mcm) const;\r\r
+ void DecodeMask(const UInt_t *word, struct AliTRDrawMCM *mcm) const;\r\r
+ void MCMADCwordsWithTbins(UInt_t fTbins, struct AliTRDrawMCM *mcm) const;\r\r
+ const char *DumpMCMinfo(const struct AliTRDrawMCM *mcm);\r\r
+ const char *DumpMCMadcMask(const struct AliTRDrawMCM *mcm);\r\r
+\r\r
+\r\r
+ protected:\r\r
+\r\r
+ Bool_t InitBuffer(void *buffer, UInt_t length); // init the buffer - called by DecodeSM(void*, UInt_t)\r\r
+ Bool_t DumpWords(UInt_t *px, UInt_t iw, UInt_t marker = 0); // dump some words onto the screen\r\r
+\r\r
+ void SwapOnEndian(); // swap if endian is BIG\r\r
+ Bool_t SkipWords(UInt_t iw); // skip number of words\r\r
+ Bool_t DecodeGTUheader(); // decode data in GTU header\r\r
+ Bool_t DecodeTracklets(); // decode tracklets\r\r
+ Bool_t DecodeHC(AliTRDdigitsManager *digitsManager, AliTRDarrayADC *digits, AliTRDarrayDictionary *track0, AliTRDarrayDictionary *track1, AliTRDarrayDictionary *track2, AliTRDSignalIndex *indexes); // decode data in HC\r\r
+\r\r
+ Bool_t DecodeADC(AliTRDdigitsManager *digitsManager, AliTRDarrayADC *digits, AliTRDarrayDictionary *track0, AliTRDarrayDictionary *track1, AliTRDarrayDictionary *track2, AliTRDSignalIndex *indexes); // decode 10 ADC words\r\r
+ Bool_t DecodeADCExtended(AliTRDdigitsManager *digitsManager, AliTRDarrayADC *digits, AliTRDarrayDictionary *track0, AliTRDarrayDictionary *track1, AliTRDarrayDictionary *track2, AliTRDSignalIndex *indexes); // decode 10 ADC words\r\r
+\r\r
+ Bool_t DecodeHCheader(); // decode HC header\r\r
+ Bool_t SeekEndOfData(); // go to next end of raw data marker (actually 1 word after)\r\r
+ Bool_t SkipMCMdata(UInt_t iw); // skip this mcm data due to mcm header corruption\r\r
+ Bool_t SeekNextMCMheader(); // go to next mcm header\r\r
+ Bool_t DecodeMCMheader(); // decode mcm header\r\r
+\r\r
+ Bool_t IsRowValid(); // check if row within the range\r\r
+ Bool_t IsHCheaderOK(); // check if current hc header data make sense\r\r
+ Bool_t IsMCMheaderOK(); // check if current mcm header data make sense\r\r
+ \r\r
+ Bool_t SetGlobalNTimebins(); // set number of timebin based on the value read from HC header, this value will be used in the digit container\r\r
+ Bool_t SetNTimebins(); // set number of timebin based on the value read from HC header\r\r
+\r\r
+ void ResetCounters(); // reset some counters\r\r
+ void ResetIterators(); // needed for Next()\r\r
+ void ResetPerSM(); // reset every SM \r\r
+ void ResetPerStack(); // reset every Stack \r\r
+ void ResetPerHC(); // reset every HC \r\r
+ void ResetPerMCM(); // reset every MCM \r\r
+ void ResetMemory(); // reset all data members\r\r
+\r\r
+ AliTRDrawFastStream(const AliTRDrawFastStream& st);\r\r
+ AliTRDrawFastStream &operator=(const AliTRDrawFastStream &);\r\r
+\r\r
+ // ----------------- DATA MEMBERS START\r\r
+\r\r
+ struct AliTRDrawSM fSM; // one SM per buffer\r\r
+ struct AliTRDrawStack *fStack; //! pointer to the current stack\r\r
+ struct AliTRDrawHC *fHC; //! current HC\r\r
+ struct AliTRDrawHC *fLastHC; //! last HC\r\r
+ struct AliTRDrawMCM fMCM; //! current MCM\r\r
+ \r\r
+ UInt_t *fpPos; // current position in the buffer\r\r
+ UInt_t *fpBegin; // begin - pointer to the buffer word 0\r\r
+ UInt_t *fpEnd; // end of the buffer\r\r
+\r\r
+ UInt_t fWordLength; // length of the buffer in 32bit words\r\r
+\r\r
+ UInt_t *fpPosTemp; // specific position in the buffer \r\r
+ Int_t fGlobalNTimeBins; // number of time bin to be used in the digit container\r\r
+ Bool_t fIsTimeBinSet; // set true if the global time bin is set to avoid multiple search\r\r
+\r\r
+ Int_t fStackNumber; // current stack number\r\r
+ Int_t fStackLinkNumber; // current link in the stack\r\r
+\r\r
+ Int_t fLinkTrackletCounter; // count the tracklets in the current HC\r\r
+ Int_t fEndOfTrackletCount; // count link by link (hc by hc) used for debug\r\r
+ Int_t fNWordsCounter; // counts words of given hc having link monitor error\r\r
+\r\r
+ UInt_t fMaskADCword; // temp mask when decoding adcs\r\r
+ UInt_t fTbinADC; // temp adc \r\r
+\r\r
+ UInt_t fEventCounter; // stores the valid/current MCM event counter\r\r
+ UInt_t fLastEventCounter; // last known event counter of MCM\r\r
+\r\r
+ Bool_t fSharedPadsOn; // do we want to output shared pads - default is off\r\r
+ Int_t fMaxADCgeom; // maximum ADC channels per mcm\r\r
+\r\r
+ Short_t fADCnumber; // number of the ADC 0 .. 20\r\r
+ Short_t fCOL; // column - row from MCM\r\r
+ Short_t fExtendedCOL; // virtual column for extended digit container\r\r
+ Bool_t fIsShared; // true if the pad is shared pad\r\r
+ Bool_t fWarnError; // no errors no warnings\r\r
+ Bool_t fWarnWarning; // flag to report warning \r\r
+\r\r
+ Bool_t fBufferRead; // set true if the buffer for one ddl is read\r\r
+\r\r
+ AliTRDgeometry *fGeometry; //! TRD geometry\r\r
+ AliRawReader *fRawReader; //! raw reader \r\r
+\r\r
+ AliTRDfeeParam *fTRDfeeParam; // pointer to the fee params\r\r
+ Int_t fCommonAdditive; // baseline value \r\r
+\r\r
+ // STATIC \r\r
+\r\r
+ static Bool_t fgExtraSkip; // whether we should skip the leading 24 words\r\r
+ static Bool_t fgSkipCDH; // whether we should skip CDH (8 words)\r\r
+ static Bool_t fgCleanDataOnly; // release only clean events = no errors\r\r
+ static Bool_t fgDebugFlag; // allow debugging info\r\r
+ static Bool_t fgEnableMemoryReset; // allow memory reset\r\r
+ static Bool_t fgStackNumberChecker; // decide if we check stack number insanity - set false to cleanroom data\r\r
+ static Bool_t fgStackLinkNumberChecker; // decide if we check stack link number insanity - debuging purpose\r\r
+ static Bool_t fgSkipData; // decide if we skip corrupted data of given HC\r\r
+ static Int_t fgDumpHead; // number of words to dump (from the start of the buffer) on each Init\r\r
+ static Short_t fgMCMordering[16]; // mcm number odering for mcm header corruption check\r\r
+ static Short_t fgROBordering[16]; // mcm number odering for mcm header corruption check\r\r
+ static Int_t fgLastHC; // HC number indicator to check HC numbering\r\r
+ static Int_t fgLastROB; // ROB number indicator to check ROB numbering \r\r
+ static Int_t fgLastIndex; // variable to check mcm number odering\r\r
+\r\r
+ // ----------------- DATA MEMBERS STOP\r\r
+\r\r
+ enum ETRDzRawStreamError \r\r
+ {\r\r
+ kDecodeStackInfo = 1 //\r\r
+ , kMissingData = 2 //\r\r
+ , kLinkDataMissing = 3 //\r\r
+ , kHCdataMissing = 4 //\r\r
+ , kTrackletOverflow = 5 //\r\r
+ , kEOTrackeltsMissing = 6 //\r\r
+ , kWrongPadrow = 7 //\r\r
+ , kMCMheaderCorrupted = 8 //\r\r
+ , kWrongMCMorROB = 9 //\r\r
+ , kMCMeventMissmatch = 10 //\r\r
+ , kMCMADCMaskMissing = 11 //\r\r
+ , kHCHeaderCorrupt = 12 //\r\r
+ , kHCHeaderWrongStack = 13 //\r\r
+ , kHCHeaderWrongLayer = 14 //\r\r
+ , kHCHeaderWrongSide = 15 //\r\r
+ , kHCHeaderWrongSM = 16 //\r\r
+ , kHCHeaderWrongDet = 17 //\r\r
+ , kHCHeaderWrongROC = 18 //\r\r
+ , kHCWordMissing = 19 //\r\r
+ , kMCMdataMissing = 20 //\r\r
+ , kMCMoverflow = 21 //\r\r
+ , kADCdataMissing = 22 //\r\r
+ , kADCmaskMissmatch = 23 //\r\r
+ , kWrongPadcolumn = 24 //\r\r
+ }; \r\r
+\r\r
+ ClassDef(AliTRDrawFastStream, 1)\r\r
+}; //clas def end\r\r
+\r\r
+#endif\r\r