]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TRD/AliTRDrawFastStream.h
Introduce the digits parameter class which is supposed to store digits information...
[u/mrichter/AliRoot.git] / TRD / AliTRDrawFastStream.h
1 #ifndef ALITRDRAWHLTSTREAM_H\r
2 #define ALITRDRAWHLTSTREAM_H\r
3 \r
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
5  * See cxx source for full Copyright notice                               */\r
6 \r
7 /* $Id: AliTRDrawFastStream.h 27696 2008-07-31 09:18:53Z cblume $ */\r
8 \r
9 /////////////////////////////////////////////////////////////////////////////////\r
10 //                                                                             //\r
11 // This class provides access to TRD digits in raw data in a way of streaming. //\r
12 //                                                                             //\r
13 /////////////////////////////////////////////////////////////////////////////////\r
14 \r
15 #include "TObject.h"\r
16 #include "TString.h"\r
17 #include "AliTRDrawStreamBase.h"\r
18 #include "AliTRDarrayADC.h"\r
19 #include "AliTRDarrayDictionary.h"\r
20 #include "AliTRDSignalIndex.h"\r
21 \r
22 class AliTRDgeometry;\r
23 class AliRawReader;\r
24 class AliTRDdigitsManager;\r
25 class TTreeSRedirector;\r
26 class AliTRDfeeParam;\r
27 \r
28 \r
29 class AliTRDrawFastStream : public AliTRDrawStreamBase\r
30 { // class def begin\r
31 \r
32  public:\r
33     \r
34   //--------------------------------------------------------\r
35   // THE STRUCTURES\r
36   //--------------------------------------------------------\r
37 \r
38   struct AliTRDrawMCM\r
39   { // mcm struct\r
40     Int_t               fROB;                     // ROB number\r
41     Int_t               fMCM;                     // MCM number\r
42     Int_t               fROW;                     // row number filed during decoding\r
43       \r
44     UInt_t              fEvCounter;               // MCM event counter\r
45     UInt_t              fADCMask;                 // ADC mask\r
46     UInt_t              fADCMaskWord;             // word with ADC mask in\r
47     UInt_t              fADCchannel[TRDMAXADC]; // channels to be decoded accrording to ADC mask\r
48       \r
49     Int_t               fADCmax;                  // number of ADCs fired\r
50     Int_t               fADCcount;                // number of ADCs fired from double checking bit\r
51     Int_t               fMCMADCWords;             // mcm words to expect\r
52     Int_t               fSingleADCwords;          // n of words per ADC\r
53       \r
54     Int_t               fMCMhdCorrupted;          // is mcm header corrupted\r
55     Int_t               fADCmaskCorrupted;        // is mcm adc mask corrupted\r
56     Bool_t              fDataCorrupted;           // true if the corruption is in ADC data level \r
57       \r
58     UInt_t             *fPos;                     //! position of mcm header in the buffer\r
59     UInt_t             *fAdcDataPos;              //! start of ADC data for this mcm\r
60 \r
61     Int_t               fADCcounter;              // count the adcs decoded\r
62       \r
63 \r
64     AliTRDrawMCM()\r
65       : fROB(-1)\r
66       , fMCM(-1)\r
67       , fROW(-1)\r
68       , fEvCounter(0)\r
69       , fADCMask(0)\r
70       , fADCMaskWord(0)\r
71       , fADCchannel()      \r
72       , fADCmax(0)\r
73       , fADCcount(0)\r
74       , fMCMADCWords(0)      \r
75       , fSingleADCwords(0)\r
76       , fMCMhdCorrupted(0)      \r
77       , fADCmaskCorrupted(0)      \r
78       , fDataCorrupted(0)      \r
79       , fPos(0)\r
80       , fAdcDataPos(0)\r
81       , fADCcounter(0)\r
82     {\r
83       // default constructor\r
84     };\r
85 \r
86     AliTRDrawMCM(const AliTRDrawMCM & p):\r
87         fROB(p.fROB)\r
88       , fMCM(p.fMCM)\r
89       , fROW(p.fROW)\r
90       , fEvCounter(p.fEvCounter)\r
91       , fADCMask(p.fADCMask)\r
92       , fADCMaskWord(p.fADCMaskWord)\r
93       , fADCchannel()      \r
94       , fADCmax(p.fADCmax)\r
95       , fADCcount(p.fADCcount)\r
96       , fMCMADCWords(p.fMCMADCWords)      \r
97       , fSingleADCwords(p.fSingleADCwords)\r
98       , fMCMhdCorrupted(p.fMCMhdCorrupted)      \r
99       , fADCmaskCorrupted(p.fADCmaskCorrupted)      \r
100       , fDataCorrupted(p.fDataCorrupted)      \r
101       , fPos(p.fPos)\r
102       , fAdcDataPos(p.fAdcDataPos)\r
103       , fADCcounter(p.fADCcounter)\r
104     {\r
105       // copy constructor\r
106     };\r
107 \r
108     AliTRDrawMCM &operator=(const AliTRDrawMCM &)\r
109     {\r
110       // assignment operator\r
111       // not implemented\r
112       return *this;\r
113     };\r
114 \r
115   };\r
116 \r
117   //--------------------------------------------------------\r
118 \r
119   struct AliTRDrawHC\r
120   { // hc struct\r
121       \r
122     //tacklet words of given HC\r
123     UInt_t              fTrackletWords[MAXTRACKLETSPERHC]; // array to keep tracklet words \r
124     Short_t             fNTracklets;                    // number of tracklet  \r
125 \r
126     // header word 0\r
127     Int_t               fSpecialRawV;       // Raw data version\r
128     Int_t               fRawVMajor;         // Raw data version\r
129     Int_t               fRawVMajorOpt;      // Raw data version\r
130     Int_t               fRawVMinor;         // Raw data version\r
131     Int_t               fNExtraWords;       // N extra HC header words\r
132     Int_t               fDCSboard;          // DCS board number\r
133     Int_t               fSM;                // Super Module number\r
134     Int_t               fSMHCheader;        // Super Module number from HC header\r
135     Int_t               fStack;             // Stack number (some people might call it a chamber)\r
136     Int_t               fStackHCheader;     // Stack number from HC header(some people might call it a chamber)\r
137     Int_t               fLayer;             // Layer number (some people might call it a plane)\r
138     Int_t               fLayerHCheader;     // Layer number from HC header(some people might call it a plane)\r
139     Int_t               fSide;              // Side of HC\r
140     Int_t               fSideHCheader;      // Side of HC from HC header\r
141       \r
142     // header word 1\r
143     Int_t               fTimeBins;          // N of t bins\r
144     UInt_t              fBunchCrossCounter; // Bunch crossing counter\r
145     UInt_t              fPreTriggerCounter; // Pre Trigger counter\r
146     UInt_t              fPreTriggerPhase;   // Pre Trigger phase\r
147       \r
148     // error \r
149     UShort_t            fErrorCodes[1411];  // array to keep encoded errors\r
150     UInt_t              fNErrors;           // number of total errors of given hc \r
151 \r
152     Short_t             fH0Corrupted;       // is hc header 0 corrupted \r
153     Short_t             fH1Corrupted;       // is hc header 1 corrupted\r
154     Short_t             fCorrupted;         // is hc data corrupted \r
155     Bool_t              fEOTECorrupted;     // if the corruption is due to meet END_OF_TRACKLET_MARKERNEW\r
156     Bool_t              fBufferCorrupted;   // if the corruption is due to buffer end\r
157     Bool_t              fDataCorrupted;     // if the corruption is on the MCM data\r
158 \r
159     Short_t             fMCMCorrupted[TRDMAXMCM]; // is hc data corrupted \r
160 \r
161     UInt_t             *fPos[2];            //! position of the header words in buffer\r
162       \r
163     Int_t               fDET;               // filled while decoding\r
164     Int_t               fROC;               // filled while decoding\r
165     Int_t               fRowMax;            // filled while decoding\r
166     Int_t               fColMax;            // filled while decoding\r
167 \r
168     // hc data\r
169     Int_t               fMCMmax;            // number of mcm found\r
170 \r
171     AliTRDrawHC()\r
172       : fTrackletWords() \r
173       , fNTracklets(0)\r
174       , fSpecialRawV(0)\r
175       , fRawVMajor(0)\r
176       , fRawVMajorOpt(0)\r
177       , fRawVMinor(0)\r
178       , fNExtraWords(0)\r
179       , fDCSboard(-1)\r
180       , fSM(-1)\r
181       , fSMHCheader(-1)\r
182       , fStack(-1)\r
183       , fStackHCheader(-1)\r
184       , fLayer(-1)\r
185       , fLayerHCheader(-1)\r
186       , fSide(-1)\r
187       , fSideHCheader(-1)\r
188       , fTimeBins(0)\r
189       , fBunchCrossCounter(0)\r
190       , fPreTriggerCounter(0)\r
191       , fPreTriggerPhase(0)\r
192       , fNErrors(0)\r
193       , fH0Corrupted(0)\r
194       , fH1Corrupted(0)\r
195       , fCorrupted(0)\r
196       , fEOTECorrupted(0)\r
197       , fBufferCorrupted(0)\r
198       , fDataCorrupted(0)\r
199       , fPos()\r
200       , fDET(-1)\r
201       , fROC(-1)\r
202       , fRowMax(-1)\r
203       , fColMax(-1)\r
204       , fMCMmax(0)\r
205     {\r
206       // default constructor hc info \r
207     };\r
208 \r
209     AliTRDrawHC(const AliTRDrawHC & p):\r
210         fTrackletWords() \r
211       , fNTracklets(p.fNTracklets)\r
212       , fSpecialRawV(p.fSpecialRawV)\r
213       , fRawVMajor(p.fRawVMajor)\r
214       , fRawVMajorOpt(p.fRawVMajorOpt)\r
215       , fRawVMinor(p.fRawVMinor)\r
216       , fNExtraWords(p.fNExtraWords)\r
217       , fDCSboard(p.fDCSboard)\r
218       , fSM(p.fSM)\r
219       , fSMHCheader(p.fSMHCheader)\r
220       , fStack(p.fStack)\r
221       , fStackHCheader(p.fStackHCheader)\r
222       , fLayer(p.fLayer)\r
223       , fLayerHCheader(p.fLayerHCheader)\r
224       , fSide(p.fSide)\r
225       , fSideHCheader(p.fSideHCheader)\r
226       , fTimeBins(p.fTimeBins)\r
227       , fBunchCrossCounter(p.fBunchCrossCounter)\r
228       , fPreTriggerCounter(p.fPreTriggerCounter)\r
229       , fPreTriggerPhase(p.fPreTriggerPhase)\r
230       , fNErrors(p.fNErrors)\r
231       , fH0Corrupted(p.fH0Corrupted)\r
232       , fH1Corrupted(p.fH1Corrupted)\r
233       , fCorrupted(p.fCorrupted)\r
234       , fEOTECorrupted(p.fEOTECorrupted)\r
235       , fBufferCorrupted(p.fBufferCorrupted)\r
236       , fDataCorrupted(p.fDataCorrupted)\r
237       , fPos()\r
238       , fDET(p.fDET)\r
239       , fROC(p.fROC)\r
240       , fRowMax(p.fRowMax)\r
241       , fColMax(p.fColMax)\r
242       , fMCMmax(p.fMCMmax)\r
243     {\r
244       // copy constructor\r
245     };\r
246 \r
247     AliTRDrawHC &operator=(const AliTRDrawHC &)\r
248     {\r
249       // assignment operator\r
250       // not implemented\r
251       return *this;\r
252     };\r
253 \r
254   };\r
255 \r
256   //--------------------------------------------------------\r
257     \r
258   struct AliTRDrawStack\r
259   {\r
260     UInt_t           fHeaderSize;            // header size of the stack info\r
261     Bool_t           fLinksActive[12];       // data links active - 1 per half chamber\r
262     Short_t          fLinksDataType[12];     // 0 indicating real data for the front-end electronics \r
263     Short_t          fLinksMonitor[12];      // 0 indicating properly operating link \r
264     Short_t          fLinkMonitorError[12];  // record link monitor error\r
265     Int_t            fActiveLinks;           // number of active links\r
266     UInt_t          *fPos;                   //! position in the buffer\r
267                     \r
268     AliTRDrawHC      fHalfChambers[12];      // 12 half chambers in a stack\r
269       \r
270     AliTRDrawStack()\r
271       : fHeaderSize(0)\r
272       , fLinksActive()\r
273       , fLinksDataType()\r
274       , fLinksMonitor()\r
275       , fLinkMonitorError()\r
276       , fActiveLinks(0)\r
277       , fPos(0)\r
278       , fHalfChambers()\r
279     {\r
280       // default constructor\r
281     };      \r
282 \r
283     AliTRDrawStack(const AliTRDrawStack & p):\r
284         fHeaderSize(p.fHeaderSize)\r
285       , fLinksActive()\r
286       , fLinksDataType()\r
287       , fLinksMonitor()\r
288       , fLinkMonitorError()\r
289       , fActiveLinks(p.fActiveLinks)\r
290       , fPos(p.fPos)\r
291       , fHalfChambers()\r
292     {\r
293       // copy constructor\r
294     };\r
295 \r
296     AliTRDrawStack &operator=(const AliTRDrawStack &)\r
297     {\r
298       // assignment operator\r
299       // not implemented\r
300       return *this;\r
301     };\r
302 \r
303   };\r
304 \r
305   //--------------------------------------------------------\r
306 \r
307   struct AliTRDrawSM\r
308   {\r
309     UInt_t            fHeaderSize;            // size of the header in words\r
310     Bool_t            fTrackletEnable;        // tracklet enable bit\r
311     Bool_t            fStackActive[5];        // map of active/expected stacks\r
312     Int_t             fActiveStacks;          // number of active stacks\r
313     Int_t             fCorrupted;             // is sm info corrupted\r
314     Int_t             fNexpectedHalfChambers; // number of half chambers to be read out in this sm\r
315     UInt_t           *fPos;                   // location of the sm info - should be the first word (after CDH if not DDL buffer)\r
316 \r
317     AliTRDrawStack    fStacks[5];             \r
318 \r
319     AliTRDrawSM()\r
320       : fHeaderSize(0)\r
321       , fTrackletEnable(0)\r
322       , fStackActive()\r
323       , fActiveStacks(0)\r
324       , fCorrupted(0)\r
325       , fNexpectedHalfChambers(0)\r
326       , fPos(0)\r
327       , fStacks()\r
328       {\r
329         // Default constructor\r
330       };      \r
331 \r
332     AliTRDrawSM(const AliTRDrawSM & p):\r
333         fHeaderSize(p.fHeaderSize)\r
334       , fTrackletEnable(p.fTrackletEnable)\r
335       , fStackActive()\r
336       , fActiveStacks(p.fActiveStacks)\r
337       , fCorrupted(p.fCorrupted)\r
338       , fNexpectedHalfChambers(p.fNexpectedHalfChambers)\r
339       , fPos(p.fPos)\r
340       , fStacks()\r
341     {\r
342       // copy constructor\r
343     };\r
344 \r
345     AliTRDrawSM &operator=(const AliTRDrawSM &)\r
346     {\r
347       // assignment operator\r
348       // not implemented\r
349       return *this;\r
350     };\r
351 \r
352   };\r
353   \r
354   //--------------------------------------------------------\r
355      \r
356   AliTRDrawFastStream();\r
357   AliTRDrawFastStream(AliRawReader *rawReader);\r
358   virtual ~AliTRDrawFastStream();\r
359 \r
360   //--------------------------------------------------------\r
361 \r
362   virtual Bool_t       Next();                           // read the next data in the memory\r
363   virtual Int_t        NextChamber(AliTRDdigitsManager *man, UInt_t **trackletContainer, UShort_t **errorCodeContainer); // read next chamber data in the memory\r
364   virtual Bool_t       Init();                           // initialize some internal variables\r
365 \r
366   Int_t    NextBuffer(); // go and init next buffer if available - check the implementation file for return values\r
367 \r
368   Bool_t   SetRawVersion(Int_t fraw); // set the raw version - used for backward compat.\r
369   \r
370   void     SetSharedPadReadout(Bool_t fv) {fSharedPadsOn = fv;} // set the flag on if the reader should return the shared pads\r
371   \r
372   Bool_t   DecodeSMHeader(void *buffer, UInt_t length); // decode a buffer\r
373   Bool_t   SetReader(AliRawReader *reader); // set the raw reader to use\r
374            \r
375   // from MCM Header Word\r
376   // rob and mcm ordering\r
377   // 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
378   // 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
379 \r
380 \r
381   UShort_t   *GetErrorCodes() const { return fHC->fErrorCodes;}                       // return error codes pointer per hc \r
382   UInt_t      GetNErrors() const {return fHC ? fHC->fNErrors: 0;}                     // [mj temp]\r
383 \r
384   // info from ADC data words\r
385   // from here, only works with returning ADC channel pointer using Next() \r
386 \r
387   UInt_t   *GetTrackletWords() const { return fHC->fTrackletWords;}                 // return tracklet words pointer per hc \r
388   Int_t     GetNTracklets() const {return fHC ? fHC->fNTracklets : -1;}             // get number of tracklets \r
389 \r
390   Int_t     GetSpecialRawVersion() const {return fHC ? fHC->fSpecialRawV : -1;}     // return special raw version\r
391   Int_t     GetMajorRawVersion() const {return fHC ? fHC->fRawVMajor : -1;}         // major raw version getter\r
392   Int_t     GetRawVersion() const {return fHC ? fHC->fRawVMajor : -1;}              // compatibility see funtion above\r
393   Int_t     GetMinorRawVersion() const {return fHC ? fHC->fRawVMinor : -1;}         // minor raw version\r
394 \r
395   Int_t     GetSM() const {return fHC ? fHC->fSM : -1;}                              //  SM Position of CURRENT half chamber in full TRD\r
396   Int_t     GetLayer() const {return fHC ? fHC->fLayer : -1;}                        //  Layer Position of CURRENT half chamber in full TRD\r
397   Int_t     GetStack() const {return fHC ? fHC->fStack : -1;}                        //  Stack Position of CURRENT half chamber in full TRD\r
398   Int_t     GetSide() const {return fHC ? fHC->fSide : -1;}                          // get side\r
399   Int_t     GetDCS() const { return fHC ? fHC->fDCSboard : -1;}                      //  DCS board number read from data (HC header)\r
400   Int_t     GetROC() const { return fHC ? fHC->fROC : -1;}                           //  ROB Position of CURRENT half chamber in full TRD\r
401   Int_t     GetNumberOfTimeBins() const { return fHC ? fHC->fTimeBins : 0;}          // Get Ntime bins\r
402   UInt_t    GetBunchCrossCounter() const {return fHC ? fHC->fBunchCrossCounter : 0;} // get bunch cross counter\r
403   UInt_t    GetPreTriggerCounter() const {return fHC ? fHC->fPreTriggerCounter : 0;} // get pre trigger info\r
404   UInt_t    GetPreTriggerPhase() const {return fHC ? fHC->fPreTriggerPhase : 0;}     // get trigger phase\r
405 \r
406   Int_t     GetRow() const {return fMCM.fROW;}         // get current row number\r
407   Int_t     GetExtendedCol() const {return fExtendedCOL;} \r
408   Int_t     GetCol() const {return fCOL;} \r
409   Int_t     GetRowMax() const { return fHC ? fHC->fRowMax : -1;}    // Get maximum rows in the current HC\r
410   Int_t     GetColMax() const { return fHC ? fHC->fColMax : -1;}    // Get maximum cols in the current HC\r
411   // compatibility\r
412   Int_t     GetMaxRow() const { return fHC ? fHC->fRowMax : -1;}    // Get maximum rows in the current HC\r
413   Int_t     GetMaxCol() const { return fHC ? fHC->fColMax : -1;}    // Get maximum cols in the current HC\r
414 \r
415   UInt_t    GetHCword0() const {return fHC ? *fHC->fPos[0] : 0;}    // get the HC word 0\r
416   UInt_t    GetHCword1() const {return fHC ? *fHC->fPos[1] : 0;}    // get the HC word 1\r
417             \r
418   Int_t     GetDET() const {return fHC ? fHC->fDET : -1;}           // get current det number\r
419   Int_t     GetDet() const {return fHC ? fHC->fDET : -1;}           // get current det number\r
420             \r
421   Int_t     GetROB() const {return fMCM.fROB;}         // get current ROB number\r
422   Int_t     GetMCM() const {return fMCM.fMCM;}         // get current MCM number\r
423   Int_t     GetEventNumber() const { return fMCM.fEvCounter;}      //  MCM Event number and position of current MCM on TRD chamber\r
424 \r
425   Int_t     GetTimeBin() const { return 0;}                         //  MCM ADC channel and Time Bin of word 1\r
426 \r
427   UInt_t   *GetSMstreamPosition() const {return fSM.fPos;} // get position of the SM index word in the buffer\r
428 \r
429 \r
430   //----------------------------------------------------------\r
431  \r
432   static void    SetNoDebug() {fgDebugFlag = kFALSE;} // allow debug info\r
433   static void    EnableMemoryReset() {fgEnableMemoryReset = kTRUE;} // allow memory reset\r
434   static void    SetNoErrorWarning() {fgWarnError = kFALSE;} // disable warning and error info\r
435   static void    SetForceCleanDataOnly() {fgCleanDataOnly = kTRUE;} // clean data only\r
436   static void    AllowCorruptedData() {fgCleanDataOnly = kFALSE;} // accept corrupted data\r
437 \r
438   static void    SetExtraWordsFix() {fgExtraSkip = kTRUE;} // extra skip of 24 32-bit words \r
439   static void    SetSkipCDH() {fgSkipCDH = kTRUE;} // skip of 8 32-bit words \r
440   static void    SetDumpHead(Int_t iv) {fgDumpHead = iv;}\r
441   static void    DisableStackNumberChecker() {fgStackNumberChecker = kFALSE;}  // set false to cleanroom data \r
442   static void    DisableStackLinkNumberChecker() {fgStackLinkNumberChecker = kFALSE;}  \r
443   static void    DisableSkipData() {fgSkipData = kFALSE;} // keep reading next words even previous words were corrupted - debugging purpose  \r
444   static void    SetDumpingEnable() {fDumpingEnable = kTRUE;} \r
445 \r
446   static void    SetSubtractBaseline(Int_t baseline) {fgCommonAdditive = baseline;}\r
447   Int_t          GetCommonAdditive() const {return fgCommonAdditive;}           // return the common additive\r
448 \r
449   static void    EnableDecodeConfigData() {fgEnableDecodeConfigData = kTRUE;} // allow configuration data decoding\r
450   static Bool_t  fgEnableDecodeConfigData;\r
451 \r
452 \r
453   //--------------------------------------------------------\r
454   // Decoding functions\r
455   //--------------------------------------------------------\r
456 \r
457   void DecodeSMInfo(const UInt_t *word, struct AliTRDrawSM *sm) const ;\r
458   const char *DumpSMInfo(const struct AliTRDrawSM *sm);\r
459   void DecodeStackInfo(const UInt_t *word, struct AliTRDrawStack *st) const;\r
460   void DecodeStackHeader(const UInt_t *word, struct AliTRDrawStack *st, Int_t iword) const;\r
461   const char *DumpStackInfo(const struct AliTRDrawStack *st);\r
462   Bool_t DecodeHCwordH0(const UInt_t *word, struct AliTRDrawHC *hc) const;\r
463   Bool_t DecodeHCwordH1(const UInt_t *word, struct AliTRDrawHC *hc) const;\r
464   const char *DumpHCinfoH0(const struct AliTRDrawHC *hc);\r
465   const char *DumpHCinfoH1(const struct AliTRDrawHC *hc);\r
466   void DecodeMCMheader(const UInt_t *word, struct AliTRDrawMCM *mcm) const;\r
467   UInt_t GetMCMadcMask(const UInt_t *word, struct AliTRDrawMCM *mcm) const;\r
468   void DecodeMask(const UInt_t *word, struct AliTRDrawMCM *mcm) const;\r
469   void MCMADCwordsWithTbins(UInt_t fTbins, struct AliTRDrawMCM *mcm) const;\r
470   const char *DumpMCMinfo(const struct AliTRDrawMCM *mcm);\r
471   const char *DumpMCMadcMask(const struct AliTRDrawMCM *mcm);\r
472 \r
473 \r
474  protected:\r
475 \r
476   Bool_t InitBuffer(void *buffer, UInt_t length); // init the buffer - called by DecodeSM(void*, UInt_t)\r
477   Bool_t DumpWords(UInt_t *px, UInt_t iw, UInt_t marker = 0); // dump some words onto the screen\r
478 \r
479   void   SwapOnEndian();         // swap if endian is BIG\r
480   Bool_t SkipWords(UInt_t iw);   // skip number of words\r
481   Bool_t DecodeGTUheader();      // decode data in GTU header\r
482   Bool_t DecodeTracklets();      // decode tracklets\r
483   Bool_t DecodeHC(AliTRDdigitsManager *digitsManager, AliTRDarrayADC *digits, AliTRDarrayDictionary *track0, AliTRDarrayDictionary *track1, AliTRDarrayDictionary *track2, AliTRDSignalIndex *indexes);       // decode data in HC\r
484 \r
485   Bool_t DecodeADC(AliTRDdigitsManager *digitsManager, AliTRDarrayADC *digits, AliTRDarrayDictionary *track0, AliTRDarrayDictionary *track1, AliTRDarrayDictionary *track2, AliTRDSignalIndex *indexes);      // decode 10 ADC words\r
486 \r
487   Bool_t DecodeHCheader();       // decode HC  header\r
488   Bool_t SeekEndOfData();        // go to next end of raw data marker (actually 1 word after)\r
489   Bool_t SkipMCMdata(UInt_t iw);  // skip this mcm data due to mcm header corruption\r
490   Bool_t SeekNextMCMheader();    // go to next mcm header\r
491   Bool_t DecodeMCMheader();      // decode mcm header\r
492 \r
493   Bool_t IsRowValid();       // check if row within the range\r
494   Bool_t IsHCheaderOK();     // check if current hc header data make sense\r
495   Bool_t IsMCMheaderOK();    // check if current mcm header data make sense\r
496     \r
497   void   ResetCounters();    // reset some counters\r
498   void   ResetIterators();   // needed for Next()\r
499   void   ResetPerSM();       // reset every SM \r
500   void   ResetPerStack();    // reset every Stack \r
501   void   ResetPerHC();       // reset every HC \r
502   void   ResetPerMCM();      // reset every MCM  \r
503   void   ResetMemory();      // reset all data members\r
504 \r
505   AliTRDrawFastStream(const AliTRDrawFastStream& st);\r
506   AliTRDrawFastStream &operator=(const AliTRDrawFastStream &);\r
507 \r
508   // ----------------- DATA MEMBERS START\r
509 \r
510   struct AliTRDrawSM       fSM;    //  one SM per buffer\r
511   struct AliTRDrawStack   *fStack; //! pointer to the current stack\r
512   struct AliTRDrawHC      *fHC;    //! current HC\r
513   struct AliTRDrawMCM     fMCM;    //! current MCM\r
514   \r
515   UInt_t *fpPos;   // current position in the buffer\r
516   UInt_t *fpBegin; // begin - pointer to the buffer word 0\r
517   UInt_t *fpEnd;   // end of the buffer\r
518 \r
519   UInt_t  fWordLength;  // length of the buffer in 32bit words\r
520 \r
521   Int_t   fStackNumber;     // current stack number\r
522   Int_t   fStackLinkNumber; // current link in the stack\r
523 \r
524   Int_t   fLinkTrackletCounter; // count the tracklets in the current HC\r
525   Int_t   fEndOfTrackletCount;  // count link by link (hc by hc) used for debug\r
526   Int_t   fNWordsCounter;       // counts words of given hc having link monitor error\r
527 \r
528   UInt_t  fMaskADCword; // temp mask when decoding adcs\r
529   UInt_t  fTbinADC;     // temp adc \r
530 \r
531   UInt_t  fEventCounter;     // stores the valid/current MCM event counter\r
532   UInt_t  fLastEventCounter; // last known event counter of MCM\r
533 \r
534   Bool_t  fSharedPadsOn; // do we want to output shared pads - default is off\r
535   Int_t   fMaxADCgeom;   // maximum ADC channels per mcm\r
536 \r
537   Short_t fADCnumber;    // number of the ADC 0 .. 20\r
538   Short_t fCOL;          // column - row from MCM\r
539   Short_t fExtendedCOL;  // virtual column for extended digit container\r
540   Bool_t  fIsShared;\r
541 \r
542   Bool_t  fBufferRead;\r
543 \r
544   AliTRDgeometry *fGeometry;  //! TRD geometry\r
545   AliRawReader   *fRawReader; //! raw reader    \r
546 \r
547   AliTRDfeeParam      *fTRDfeeParam; // pointer to the fee params\r
548 \r
549   // STATIC \r
550 \r
551   static Bool_t fgExtraSkip; // whether we should skip the leading 24 words\r
552   static Bool_t fgSkipCDH; // whether we should skip CDH (8 words)\r
553   static Bool_t fgWarnError; // no errors no warnings\r
554   static Bool_t fgCleanDataOnly; // release only clean events = no errors\r
555   static Bool_t fgDebugFlag; // allow debugging info\r
556   static Bool_t fgEnableMemoryReset; // allow memory reset\r
557   static Bool_t fgStackNumberChecker; // decide if we check stack number insanity - set false to cleanroom data\r
558   static Bool_t fgStackLinkNumberChecker; // decide if we check stack link number insanity - debuging purpose\r
559   static Bool_t fgSkipData; // decide if we skip corrupted data of given HC\r
560   static Int_t fgDumpHead; // number of words to dump (from the start of the buffer) on each Init\r
561   static Short_t  fgMCMordering[16]; // mcm number odering for mcm header corruption check\r
562   static Short_t  fgROBordering[16]; // mcm number odering for mcm header corruption check\r
563   static Int_t  fgLastHC;  // HC number indicator to check HC numbering\r
564   static Int_t  fgLastROB; // ROB number indicator to check ROB numbering \r
565   static Int_t  fgLastIndex; // variable to check mcm number odering\r
566 \r
567   static Bool_t fDumpingEnable; \r
568 \r
569   static Int_t  fDumpingSM;\r
570   static Int_t  fDumpingStack;\r
571   static Int_t  fDumpingLayer;\r
572   static Int_t  fDumpingROB;\r
573   static Int_t  fDumpingMCM;\r
574 \r
575   // this is a temporary solution!\r
576   // baseline should come with the HC header word 2 (count from 0!)\r
577   static Int_t   fgCommonAdditive; // common additive  - should be decoded! from HC word2\r
578 \r
579   // ----------------- DATA MEMBERS STOP\r
580 \r
581   enum ETRDzRawStreamError \r
582     {\r
583       kDecodeStackInfo          = 1 //\r
584       , kMissingData            = 2 //\r
585       , kLinkDataMissing        = 3 //\r
586       , kHCdataMissing          = 4 //\r
587       , kTrackletOverflow       = 5 //\r
588       , kEOTrackeltsMissing     = 6 //\r
589       , kWrongPadrow            = 7 //\r
590       , kMCMheaderCorrupted     = 8 //\r
591       , kWrongMCMorROB          = 9 //\r
592       , kMCMeventMissmatch      = 10 //\r
593       , kMCMADCMaskMissing      = 11 //\r
594       , kHCHeaderCorrupt        = 12 //\r
595       , kHCHeaderWrongStack     = 13 //\r
596       , kHCHeaderWrongLayer     = 14 //\r
597       , kHCHeaderWrongSide      = 15 //\r
598       , kHCHeaderWrongSM        = 16 //\r
599       , kHCHeaderWrongDet       = 17 //\r
600       , kHCHeaderWrongROC       = 18 //\r
601       , kHCWordMissing          = 19 //\r
602       , kMCMdataMissing         = 20 //\r
603       , kMCMoverflow            = 21 //\r
604       , kADCdataMissing         = 22 //\r
605       , kADCmaskMissmatch       = 23 //\r
606       , kWrongPadcolumn         = 24 //\r
607     };                         \r
608 \r
609   ClassDef(AliTRDrawFastStream, 0)\r
610 }; //clas def end\r
611 \r
612 #endif\r