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