1 #ifndef ALITRDRAWSTREAM_H
\r\r
2 #define ALITRDRAWSTREAM_H
\r\r
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
\r\r
5 * See cxx source for full Copyright notice */
\r\r
7 /* $Id: AliTRDrawStream.h 27696 2008-07-31 09:18:53Z cblume $ */
\r\r
9 ///////////////////////////////////////////////////////////////////////////////
\r\r
11 // This class provides access to TRD digits in raw data. //
\r\r
13 ///////////////////////////////////////////////////////////////////////////////
\r\r
15 #include "AliTRDrawStreamBase.h"
\r\r
17 class AliTRDgeometry;
\r\r
18 class AliRawReader;
\r\r
19 class AliTRDdigitsManager;
\r\r
20 class TTreeSRedirector;
\r\r
21 class AliTRDfeeParam;
\r\r
24 class AliTRDrawStream : public AliTRDrawStreamBase
\r\r
25 { // class def begin
\r\r
29 //--------------------------------------------------------
\r\r
31 //--------------------------------------------------------
\r\r
33 struct AliTRDrawADC
\r\r
36 UInt_t *fPos; //! position of ADC 1st word in the buffer
\r\r
37 Short_t fADCnumber; // number of the ADC 0 .. 20
\r\r
38 Short_t fExtendedCOL; // column - row from MCM
\r\r
39 Short_t fCOL; // column - row from MCM
\r\r
40 Int_t fSignals[TRDMAXTBINS]; // signals for this adc
\r\r
41 Bool_t fIsShared; // is pad chared between MCMs
\r\r
42 Short_t fCorrupted; // is adc word corrupted
\r\r
50 , fIsShared(kFALSE)
\r\r
53 // default constructor
\r\r
56 AliTRDrawADC(const AliTRDrawADC& p):
\r\r
58 , fADCnumber(p.fADCnumber)
\r\r
59 , fExtendedCOL(p.fExtendedCOL)
\r\r
62 , fIsShared(p.fIsShared)
\r\r
63 , fCorrupted(p.fCorrupted)
\r\r
65 // copy constructor
\r\r
68 AliTRDrawADC &operator=(const AliTRDrawADC &)
\r\r
70 // assignment operator
\r\r
71 // not implemented
\r\r
77 //--------------------------------------------------------
\r\r
79 struct AliTRDrawMCM
\r\r
81 Int_t fROB; // ROB number
\r\r
82 Int_t fMCM; // MCM number
\r\r
83 Int_t fROW; // row number filed during decoding
\r\r
85 UInt_t fEvCounter; // MCM event counter
\r\r
86 UInt_t fADCMask; // ADC mask
\r\r
87 UInt_t fADCMaskWord; // word with ADC mask in
\r\r
88 UInt_t fADCchannel[TRDMAXADC]; // channels to be decoded accrording to ADC mask
\r\r
90 Int_t fADCmax; // number of ADCs fired
\r\r
91 Int_t fADCcount; // number of ADCs fired from double checking bit
\r\r
92 Int_t fMCMADCWords; // mcm words to expect
\r\r
93 Int_t fSingleADCwords; // n of words per ADC
\r\r
95 Int_t fMCMhdCorrupted; // is mcm header corrupted
\r\r
96 Int_t fADCmaskCorrupted; // is mcm adc mask corrupted
\r\r
97 Int_t fCorrupted; // is mcm data missing
\r\r
99 UInt_t *fPos; //! position of mcm header in the buffer
\r\r
100 UInt_t *fAdcDataPos; //! start of ADC data for this mcm
\r\r
102 Int_t fADCcounter; // count the adcs decoded
\r\r
103 AliTRDrawADC fADCs[TRDMAXADC]; // 21 adcs
\r\r
111 , fADCMaskWord(0)
\r\r
115 , fMCMADCWords(0)
\r\r
116 , fSingleADCwords(0)
\r\r
117 , fMCMhdCorrupted(0)
\r\r
118 , fADCmaskCorrupted(0)
\r\r
125 // default constructor
\r\r
128 AliTRDrawMCM(const AliTRDrawMCM & p):
\r\r
132 , fEvCounter(p.fEvCounter)
\r\r
133 , fADCMask(p.fADCMask)
\r\r
134 , fADCMaskWord(p.fADCMaskWord)
\r\r
136 , fADCmax(p.fADCmax)
\r\r
137 , fADCcount(p.fADCcount)
\r\r
138 , fMCMADCWords(p.fMCMADCWords)
\r\r
139 , fSingleADCwords(p.fSingleADCwords)
\r\r
140 , fMCMhdCorrupted(p.fMCMhdCorrupted)
\r\r
141 , fADCmaskCorrupted(p.fADCmaskCorrupted)
\r\r
142 , fCorrupted(p.fCorrupted)
\r\r
144 , fAdcDataPos(p.fAdcDataPos)
\r\r
145 , fADCcounter(p.fADCcounter)
\r\r
148 // copy constructor
\r\r
151 AliTRDrawMCM &operator=(const AliTRDrawMCM &)
\r\r
153 // assignment operator
\r\r
154 // not implemented
\r\r
160 //--------------------------------------------------------
\r\r
162 struct AliTRDrawHC
\r\r
165 //tacklet words of given HC
\r\r
166 UInt_t fTrackletWords[MAXTRACKLETSPERHC]; // array to keep tracklet words [mj]
\r\r
167 Short_t fTrackletError; // tracklet error
\r\r
168 Short_t fNTracklets; // number of tracklet
\r\r
171 Int_t fSpecialRawV; // Raw data version
\r\r
172 Int_t fRawVMajor; // Raw data version
\r\r
173 Int_t fRawVMajorOpt; // Raw data version
\r\r
174 Int_t fRawVMinor; // Raw data version
\r\r
175 Int_t fNExtraWords; // N extra HC header words
\r\r
176 Int_t fDCSboard; // DCS board number
\r\r
177 Int_t fSM; // Super Module number
\r\r
178 Int_t fStack; // Stack number (some people might call it a chamber)
\r\r
179 Int_t fLayer; // Layer number (some people might call it a plane)
\r\r
180 Int_t fSide; // Side of HC
\r\r
183 Int_t fTimeBins; // N of t bins
\r\r
184 UInt_t fBunchCrossCounter; // Bunch crossing counter
\r\r
185 UInt_t fPreTriggerCounter; // Pre Trigger counter
\r\r
186 UInt_t fPreTriggerPhase; // Pre Trigger phase
\r\r
189 Int_t fH0Corrupted; // is hc header 0 corrupted
\r\r
190 Int_t fH1Corrupted; // is hc header 1 corrupted
\r\r
191 Int_t fCorrupted; // is hc data corrupted
\r\r
193 UInt_t *fPos[2]; //! position of the header words in buffer
\r\r
195 Int_t fDET; // filled while decoding
\r\r
196 Int_t fROC; // filled while decoding
\r\r
197 Int_t fRowMax; // filled while decoding
\r\r
198 Int_t fColMax; // filled while decoding
\r\r
201 Int_t fMCMmax; // number of mcm found
\r\r
202 AliTRDrawMCM fMCMs[TRDMAXMCM]; // 4 ROBS 16 each
\r\r
205 : fTrackletWords() //[mj]
\r\r
206 , fTrackletError(0)
\r\r
208 , fSpecialRawV(0)
\r\r
210 , fRawVMajorOpt(0)
\r\r
212 , fNExtraWords(0)
\r\r
219 , fBunchCrossCounter(0)
\r\r
220 , fPreTriggerCounter(0)
\r\r
221 , fPreTriggerPhase(0)
\r\r
222 , fH0Corrupted(0)
\r\r
223 , fH1Corrupted(0)
\r\r
233 // default constructor hc info
\r\r
236 AliTRDrawHC(const AliTRDrawHC & p):
\r\r
237 fTrackletWords() //[mj]
\r\r
238 , fTrackletError(p.fTrackletError)
\r\r
239 , fNTracklets(p.fNTracklets)
\r\r
240 , fSpecialRawV(p.fSpecialRawV)
\r\r
241 , fRawVMajor(p.fRawVMajor)
\r\r
242 , fRawVMajorOpt(p.fRawVMajorOpt)
\r\r
243 , fRawVMinor(p.fRawVMinor)
\r\r
244 , fNExtraWords(p.fNExtraWords)
\r\r
245 , fDCSboard(p.fDCSboard)
\r\r
247 , fStack(p.fStack)
\r\r
248 , fLayer(p.fLayer)
\r\r
250 , fTimeBins(p.fTimeBins)
\r\r
251 , fBunchCrossCounter(p.fBunchCrossCounter)
\r\r
252 , fPreTriggerCounter(p.fPreTriggerCounter)
\r\r
253 , fPreTriggerPhase(p.fPreTriggerPhase)
\r\r
254 , fH0Corrupted(p.fH0Corrupted)
\r\r
255 , fH1Corrupted(p.fH1Corrupted)
\r\r
256 , fCorrupted(p.fCorrupted)
\r\r
260 , fRowMax(p.fRowMax)
\r\r
261 , fColMax(p.fColMax)
\r\r
262 , fMCMmax(p.fMCMmax)
\r\r
265 // copy constructor
\r\r
268 AliTRDrawHC &operator=(const AliTRDrawHC &)
\r\r
270 // assignment operator
\r\r
271 // not implemented
\r\r
277 //--------------------------------------------------------
\r\r
279 struct AliTRDrawStack
\r\r
281 UInt_t fHeaderSize; // header size of the stack info
\r\r
282 Bool_t fLinksActive[12]; // data links active - 1 per half chamber
\r\r
283 Short_t fLinksDataType[12]; // 0 indicating real data for the front-end electronics
\r\r
284 Short_t fLinksMonitor[12]; // 0 indicating properly operating link
\r\r
285 Short_t fLinkMonitorError[12]; // record link monitor error
\r\r
286 Int_t fActiveLinks; // number of active links
\r\r
287 UInt_t *fPos; //! position in the buffer
\r\r
289 AliTRDrawHC fHalfChambers[12]; // 12 half chambers in a stack
\r\r
294 , fLinksDataType()
\r\r
295 , fLinksMonitor()
\r\r
296 , fLinkMonitorError()
\r\r
297 , fActiveLinks(0)
\r\r
299 , fHalfChambers()
\r\r
301 // default constructor
\r\r
304 AliTRDrawStack(const AliTRDrawStack & p):
\r\r
305 fHeaderSize(p.fHeaderSize)
\r\r
307 , fLinksDataType()
\r\r
308 , fLinksMonitor()
\r\r
309 , fLinkMonitorError()
\r\r
310 , fActiveLinks(p.fActiveLinks)
\r\r
312 , fHalfChambers()
\r\r
314 // copy constructor
\r\r
317 AliTRDrawStack &operator=(const AliTRDrawStack &)
\r\r
319 // assignment operator
\r\r
320 // not implemented
\r\r
326 //--------------------------------------------------------
\r\r
328 struct AliTRDrawSM
\r\r
330 UInt_t fHeaderSize; // size of the header in words
\r\r
331 Bool_t fTrackletEnable; // tracklet enable bit
\r\r
332 Bool_t fStackActive[5]; // map of active/expected stacks
\r\r
333 Int_t fActiveStacks; // number of active stacks
\r\r
334 Int_t fCorrupted; // is sm info corrupted
\r\r
335 Int_t fNexpectedHalfChambers; // number of half chambers to be read out in this sm
\r\r
336 Bool_t fClean; // true if everything went OK - false is some error occured
\r\r
337 UInt_t *fPos; // location of the sm info - should be the first word (after CDH if not DDL buffer)
\r\r
339 AliTRDrawStack fStacks[5]; // objects for 5 stacks
\r\r
343 , fTrackletEnable(0)
\r\r
345 , fActiveStacks(0)
\r\r
347 , fNexpectedHalfChambers(0)
\r\r
352 // Default constructor
\r\r
355 AliTRDrawSM(const AliTRDrawSM & p):
\r\r
356 fHeaderSize(p.fHeaderSize)
\r\r
357 , fTrackletEnable(p.fTrackletEnable)
\r\r
359 , fActiveStacks(p.fActiveStacks)
\r\r
360 , fCorrupted(p.fCorrupted)
\r\r
361 , fNexpectedHalfChambers(p.fNexpectedHalfChambers)
\r\r
362 , fClean(p.fClean)
\r\r
366 // copy constructor
\r\r
369 AliTRDrawSM &operator=(const AliTRDrawSM &)
\r\r
371 // assignment operator
\r\r
372 // not implemented
\r\r
378 //--------------------------------------------------------
\r\r
380 AliTRDrawStream();
\r\r
381 AliTRDrawStream(AliRawReader *rawReader);
\r\r
382 virtual ~AliTRDrawStream();
\r\r
384 //--------------------------------------------------------
\r\r
386 virtual Bool_t Next(); // read the next data in the memory
\r\r
387 //virtual Int_t NextChamber(AliTRDdigitsManager *man); // read next chamber data in the momory
\r\r
388 virtual Int_t NextChamber(AliTRDdigitsManager *man, UInt_t **trackletContainer, UShort_t **/*errorCodeContainer*/=NULL); // read next chamber data in the memory
\r\r
389 virtual Bool_t Init(); // initialize some internal variables
\r\r
391 Int_t NextBuffer(); // go and init next buffer if available - check the implementation file for return values
\r\r
393 Bool_t SetRawVersion(Int_t fraw); // set the raw version - used for backward compat.
\r\r
395 Bool_t IsCurrentPadShared() const {return fADC->fIsShared;} // is current pad shared between mcms
\r\r
396 void SetSharedPadReadout(Bool_t fv) {fSharedPadsOn = fv;} // set the flag on if the reader should return the shared pads
\r\r
398 Bool_t DecodeSM(void *buffer, UInt_t length); // decode a buffer
\r\r
399 Int_t DecodeSM(); // used with raw reader
\r\r
400 Int_t DecodeSM(AliRawReader *reader); // used with raw reader
\r\r
402 Bool_t SetReader(AliRawReader *reader); // set the raw reader to use
\r\r
404 // info from Supermodule Index Word
\r\r
405 Bool_t IsTrackletEnableBitSet() const {return fSM.fTrackletEnable;} // get status of tracklet enable bit
\r\r
406 Bool_t IsStackActive(Int_t is) const {return fSM.fStackActive[is];} // get status of stack enable bit
\r\r
407 Int_t GetNofActiveStacks() const {return fSM.fActiveStacks;} // get number of active stacks from stack mask
\r\r
408 UInt_t *GetGTUheaderWords() const {return fSM.fPos;} // get number of active stacks from stack mask
\r\r
410 // info from Stack Index Word
\r\r
411 Int_t GetNexpectedHalfChambers() const {return fSM.fNexpectedHalfChambers;} // get number of expected HC in a sm
\r\r
412 Int_t GetNofActiveLinksInStack(Int_t is) const {return fSM.fStacks[is].fActiveLinks;} // get number of active links in a stack
\r\r
413 Bool_t IsLinkActiveInStack(Int_t is, Int_t il) const {return fSM.fStacks[is].fLinksActive[il];} // check whether the link is active
\r\r
415 // info from Stack Header Word
\r\r
416 Short_t GetLinkMonitorError(Int_t is, Int_t il) const {return fSM.fStacks[is].fLinkMonitorError[il];} // get link monitor error
\r\r
418 // info from Tracklet Data
\r\r
419 Int_t GetTrackletErrorCode(Int_t is, Int_t il) const {return fSM.fStacks[is].fHalfChambers[il].fTrackletError;}
\r\r
420 Int_t GetNTracklets(Int_t is, Int_t il) const {return fSM.fStacks[is].fHalfChambers[il].fNTracklets;} // get number of tracklets
\r\r
422 // info from HC Header Word
\r\r
423 Int_t GetSM(Int_t is, Int_t il) const {return fSM.fStacks[is].fHalfChambers[il].fSM;}
\r\r
424 Int_t GetLayer(Int_t is, Int_t il) const {return fSM.fStacks[is].fHalfChambers[il].fLayer;}
\r\r
425 Int_t GetStack(Int_t is, Int_t il) const {return fSM.fStacks[is].fHalfChambers[il].fStack;}
\r\r
426 Int_t GetSide(Int_t is, Int_t il) const {return fSM.fStacks[is].fHalfChambers[il].fSide;}
\r\r
427 Int_t GetH0ErrorCode(Int_t is, Int_t il) const {return fSM.fStacks[is].fHalfChambers[il].fH0Corrupted;}
\r\r
428 Int_t GetH1ErrorCode(Int_t is, Int_t il) const {return fSM.fStacks[is].fHalfChambers[il].fH1Corrupted;}
\r\r
429 Int_t GetNumberOfTimeBins(Int_t is, Int_t il) const { return fSM.fStacks[is].fHalfChambers[il].fTimeBins;}
\r\r
430 UInt_t *GetTrackletWords(Int_t is, Int_t il) { return fSM.fStacks[is].fHalfChambers[il].fTrackletWords;}
\r\r
432 // info from HC data
\r\r
433 Int_t GetHCErrorCode(Int_t is, Int_t il) const {return fSM.fStacks[is].fHalfChambers[il].fCorrupted;}
\r\r
434 Int_t GetHCMCMmax(Int_t is, Int_t il) const {return fSM.fStacks[is].fHalfChambers[il].fMCMmax;}
\r\r
436 // from MCM Header Word
\r\r
437 // rob and mcm ordering
\r\r
438 // 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
439 // 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
440 Int_t GetMCM(Int_t stack, Int_t link, Int_t mcm) const {return fSM.fStacks[stack].fHalfChambers[link].fMCMs[mcm].fMCM;}
\r\r
441 Int_t GetROB(Int_t stack, Int_t link, Int_t mcm) const {return fSM.fStacks[stack].fHalfChambers[link].fMCMs[mcm].fROB;}
\r\r
442 Int_t GetMCMhdErrorCode(Int_t stack, Int_t link, Int_t mcm) const {return fSM.fStacks[stack].fHalfChambers[link].fMCMs[mcm].fMCMhdCorrupted;}
\r\r
443 Int_t GetMCMADCMaskErrorCode(Int_t stack, Int_t link, Int_t mcm) const {return fSM.fStacks[stack].fHalfChambers[link].fMCMs[mcm].fADCmaskCorrupted;}
\r\r
444 Int_t GetEventNumber(Int_t stack, Int_t link, Int_t mcm) const {return fSM.fStacks[stack].fHalfChambers[link].fMCMs[mcm].fEvCounter;}
\r\r
445 Int_t GetADCcount(Int_t stack, Int_t link, Int_t mcm) const {return fSM.fStacks[stack].fHalfChambers[link].fMCMs[mcm].fADCcount;}
\r\r
447 // info from MCM data words
\r\r
448 Int_t GetMCMErrorCode(Int_t stack, Int_t link, Int_t mcm) const {return fSM.fStacks[stack].fHalfChambers[link].fMCMs[mcm].fCorrupted;} // get MCM data error code
\r\r
449 Int_t GetADCErrorCode(Int_t stack, Int_t link, Int_t mcm, Int_t adc) const {return fSM.fStacks[stack].fHalfChambers[link].fMCMs[mcm].fADCs[adc].fCorrupted;} // get ADC error code
\r\r
450 Int_t GetADCnumber(Int_t stack, Int_t link, Int_t mcm, Int_t adc) const {return fSM.fStacks[stack].fHalfChambers[link].fMCMs[mcm].fADCs[adc].fADCnumber;} // get ADC error code
\r\r
452 Int_t GetRow(Int_t stack, Int_t link, Int_t mcm) const {return fSM.fStacks[stack].fHalfChambers[link].fMCMs[mcm].fROW;} // get current row number
\r\r
453 Int_t GetCol(Int_t stack, Int_t link, Int_t mcm, Int_t adc) const {return fSM.fStacks[stack].fHalfChambers[link].fMCMs[mcm].fADCs[adc].fCOL;} // get current column number
\r\r
454 Int_t GetExtendedCol(Int_t stack, Int_t link, Int_t mcm, Int_t adc) const {return fSM.fStacks[stack].fHalfChambers[link].fMCMs[mcm].fADCs[adc].fExtendedCOL;} // get current column number
\r\r
456 // info from ADC data words
\r\r
457 Int_t *GetSignalDirect(Int_t stack, Int_t link, Int_t mcm, Int_t adc) {return fSM.fStacks[stack].fHalfChambers[link].fMCMs[mcm].fADCs[adc].fSignals;}
\r\r
460 // from here, only works with returning ADC channel pointer using Next()
\r\r
461 UInt_t *GetTrackletWords() const { return fHC->fTrackletWords;} // return tracklet words pointer per hc [mj]
\r\r
462 Int_t GetTrackletErrorCode() const {return fHC ? fHC->fTrackletError : -1;} // get tracklet error code
\r\r
463 Int_t GetNTracklets() const {return fHC ? fHC->fNTracklets : -1;} // get number of tracklets
\r\r
465 Int_t GetSpecialRawVersion() const {return fHC ? fHC->fSpecialRawV : -1;} // return special raw version
\r\r
466 Int_t GetMajorRawVersion() const {return fHC ? fHC->fRawVMajor : -1;} // major raw version getter
\r\r
467 Int_t GetRawVersion() const {return fHC ? fHC->fRawVMajor : -1;} // compatibility see funtion above
\r\r
468 Int_t GetMinorRawVersion() const {return fHC ? fHC->fRawVMinor : -1;} // minor raw version
\r\r
470 Int_t GetSM() const {return fHC ? fHC->fSM : -1;} // SM Position of CURRENT half chamber in full TRD
\r\r
471 Int_t GetLayer() const {return fHC ? fHC->fLayer : -1;} // Layer Position of CURRENT half chamber in full TRD
\r\r
472 Int_t GetStack() const {return fHC ? fHC->fStack : -1;} // Stack Position of CURRENT half chamber in full TRD
\r\r
473 Int_t GetSide() const {return fHC ? fHC->fSide : -1;} // get side
\r\r
474 Int_t GetDCS() const { return fHC ? fHC->fDCSboard : -1;} // DCS board number read from data (HC header)
\r\r
475 Int_t GetROC() const { return fHC ? fHC->fROC : -1;} // ROB Position of CURRENT half chamber in full TRD
\r\r
476 Int_t GetNumberOfTimeBins() const { return fHC ? fHC->fTimeBins : 0;} // Get Ntime bins
\r\r
477 UInt_t GetBunchCrossCounter() const {return fHC ? fHC->fBunchCrossCounter : 0;} // get bunch cross counter
\r\r
478 UInt_t GetPreTriggerCounter() const {return fHC ? fHC->fPreTriggerCounter : 0;} // get pre trigger info
\r\r
479 UInt_t GetPreTriggerPhase() const {return fHC ? fHC->fPreTriggerPhase : 0;} // get trigger phase
\r\r
481 Int_t GetRow() const {return fMCM ? fMCM->fROW : -1;} // get current row number
\r\r
482 Int_t GetExtendedCol() const {return fADC ? fADC->fExtendedCOL : -1;} // get current column number
\r\r
483 Int_t GetCol() const {return fADC ? fADC->fCOL : -1;} // get current column number
\r\r
484 Int_t GetRowMax() const { return fHC ? fHC->fRowMax : -1;} // Get maximum rows in the current HC
\r\r
485 Int_t GetColMax() const { return fHC ? fHC->fColMax : -1;} // Get maximum cols in the current HC
\r\r
487 Int_t GetMaxRow() const { return fHC ? fHC->fRowMax : -1;} // Get maximum rows in the current HC
\r\r
488 Int_t GetMaxCol() const { return fHC ? fHC->fColMax : -1;} // Get maximum cols in the current HC
\r\r
490 UInt_t GetHCword0() const {return fHC ? *fHC->fPos[0] : 0;} // get the HC word 0
\r\r
491 UInt_t GetHCword1() const {return fHC ? *fHC->fPos[1] : 0;} // get the HC word 1
\r\r
493 Int_t GetDET() const {return fHC ? fHC->fDET : -1;} // get current det number
\r\r
494 Int_t GetDet() const {return fHC ? fHC->fDET : -1;} // get current det number
\r\r
496 Int_t GetROB() const {return fMCM ? fMCM->fROB : -1;} // get current ROB number
\r\r
497 Int_t GetMCM() const {return fMCM ? fMCM->fMCM : -1;} // get current MCM number
\r\r
498 Int_t GetEventNumber() const { return fMCM->fEvCounter;} // MCM Event number and position of current MCM on TRD chamber
\r\r
500 Int_t GetADC() const { return fADC ? fADC->fADCnumber : -1;} // MCM ADC channel and Time Bin of word 1
\r\r
501 Int_t GetTimeBin() const { return 0;} // MCM ADC channel and Time Bin of word 1
\r\r
502 Int_t *GetSignals() const { return fADC ? fADC->fSignals : (Int_t *)fgEmptySignals;} // signals in the n-time bins from data word
\r\r
504 Int_t GetHCErrorCode() const {return fHC ? fHC->fCorrupted : -1;} // get HC error code
\r\r
505 Int_t GetH0ErrorCode() const {return fHC ? fHC->fH0Corrupted : -1;} // get HC header word0 error code
\r\r
506 Int_t GetH1ErrorCode() const {return fHC ? fHC->fH1Corrupted : -1;} // get HC header word1 error code
\r\r
507 Int_t GetMCMErrorCode() const {return fMCM ? fMCM->fCorrupted : -1;} // get MCM data error code
\r\r
508 Int_t GetADCErrorCode() const {return fADC ? fADC->fCorrupted : -1;} // get ADC data error code
\r\r
509 Int_t GetMCMhdErrorCode() const {return fMCM ? fMCM->fMCMhdCorrupted: -1;} // get MCM header word error code
\r\r
510 Int_t GetMCMADCMaskErrorCode() const {return fMCM ? fMCM->fADCmaskCorrupted: -1;} // get MCM adc mask error code
\r\r
512 UInt_t *GetSMstreamPosition() const {return fSM.fPos;} // get position of the SM index word in the buffer
\r\r
514 Bool_t IsSMbufferClean() const {return fSM.fClean;} // is data clean
\r\r
516 //----------------------------------------------------------
\r\r
518 static void SetNoDebug() {fgDebugFlag = kFALSE;} // allow debug info
\r\r
519 static void EnableMemoryReset() {fgEnableMemoryReset = kTRUE;} // allow memory reset
\r\r
520 static void SetNoErrorWarning() {fgWarnError = kFALSE;} // disable warning and error info
\r\r
521 static void SetForceCleanDataOnly() {fgCleanDataOnly = kTRUE;} // clean data only
\r\r
522 static void AllowCorruptedData() {fgCleanDataOnly = kFALSE;} // accept corrupted data
\r\r
524 static void SetExtraWordsFix() {fgExtraSkip = kTRUE;} // extra skip of 24 32-bit words
\r\r
525 static void SetSkipCDH() {fgSkipCDH = kTRUE;} // skip of 8 32-bit words
\r\r
526 static void SetDumpHead(Int_t iv) {fgDumpHead = iv;}
\r\r
527 static void DisableStackNumberChecker() {fgStackNumberChecker = kFALSE;} // set false to cleanroom data
\r\r
528 static void DisableStackLinkNumberChecker() {fgStackLinkNumberChecker = kFALSE;}
\r\r
529 static void DisableSkipData() {fgSkipData = kFALSE;} // keep reading next words even previous words were corrupted - debugging purpose
\r\r
530 static void SetDumpingEnable() {fgDumpingEnable = kTRUE;}
\r\r
531 static void SetDumpingMCM(Int_t sm, Int_t stack, Int_t layer, Int_t rob, Int_t mcm) {fgDumpingSM = sm; fgDumpingStack = stack; fgDumpingLayer = layer; fgDumpingROB = rob; fgDumpingMCM = mcm;}
\r\r
533 // this is a temporary solution!
\r\r
534 // baseline should come with the HC header word 2 (count from 0!)
\r\r
535 static void SetSubtractBaseline(Int_t baseline) {fgCommonAdditive = baseline;}
\r\r
536 Int_t GetCommonAdditive() const {return fgCommonAdditive;} // return the common additive
\r\r
538 static void EnableDecodeConfigData() {fgEnableDecodeConfigData = kTRUE;} // allow configuration data decoding
\r\r
539 static Bool_t fgEnableDecodeConfigData; // flag to decode configuration data
\r\r
542 //--------------------------------------------------------
\r\r
543 // Decoding functions
\r\r
544 //--------------------------------------------------------
\r\r
546 void DecodeSMInfo(const UInt_t *word, struct AliTRDrawSM *sm) const ;
\r\r
547 const char *DumpSMInfo(const struct AliTRDrawSM *sm);
\r\r
548 void DecodeStackInfo(const UInt_t *word, struct AliTRDrawStack *st) const;
\r\r
549 void DecodeStackHeader(const UInt_t *word, struct AliTRDrawStack *st, Int_t iword) const;
\r\r
550 const char *DumpStackInfo(const struct AliTRDrawStack *st);
\r\r
551 Bool_t DecodeHCwordH0(const UInt_t *word, struct AliTRDrawHC *hc) const;
\r\r
552 Bool_t DecodeHCwordH1(const UInt_t *word, struct AliTRDrawHC *hc) const;
\r\r
553 const char *DumpHCinfoH0(const struct AliTRDrawHC *hc);
\r\r
554 const char *DumpHCinfoH1(const struct AliTRDrawHC *hc);
\r\r
555 void DecodeMCMheader(const UInt_t *word, struct AliTRDrawMCM *mcm) const;
\r\r
556 UInt_t GetMCMadcMask(const UInt_t *word, struct AliTRDrawMCM *mcm) const;
\r\r
557 void DecodeMask(const UInt_t *word, struct AliTRDrawMCM *mcm) const;
\r\r
558 void MCMADCwordsWithTbins(UInt_t fTbins, struct AliTRDrawMCM *mcm) const;
\r\r
559 const char *DumpMCMinfo(const struct AliTRDrawMCM *mcm);
\r\r
560 const char *DumpMCMadcMask(const struct AliTRDrawMCM *mcm);
\r\r
565 Bool_t InitBuffer(void *buffer, UInt_t length); // init the buffer - called by DecodeSM(void*, UInt_t)
\r\r
566 Bool_t DumpWords(UInt_t *px, UInt_t iw, UInt_t marker = 0); // dump some words onto the screen
\r\r
568 void SwapOnEndian(); // swap if endian is BIG
\r\r
569 Bool_t SkipWords(UInt_t iw); // skip number of words
\r\r
570 Bool_t DecodeGTUheader(); // decode data in GTU header
\r\r
571 Bool_t DecodeTracklets(); // decode tracklets
\r\r
572 Bool_t DecodeHC(); // decode data in HC
\r\r
574 Bool_t DecodeADC(); // decode 10 ADC words
\r\r
575 Bool_t DecodeADCExtended(); // decode TRAP data with ZS and more than 32 samples
\r\r
577 Bool_t DecodeHCheader(); // decode HC header
\r\r
578 Bool_t SeekEndOfData(); // go to next end of raw data marker (actually 1 word after)
\r\r
579 Bool_t SkipMCMdata(UInt_t iw); // skip this mcm data due to mcm header corruption
\r\r
580 Bool_t SeekNextMCMheader(); // go to next mcm header
\r\r
581 Bool_t DecodeMCMheader(); // decode mcm header
\r\r
583 Bool_t IsRowValid(); // check if row within the range
\r\r
584 Bool_t IsHCheaderOK(); // check if current hc header data make sense
\r\r
585 Bool_t IsMCMheaderOK(); // check if current mcm header data make sense
\r\r
587 void ResetCounters(); // reset some counters
\r\r
588 void ResetIterators(); // needed for Next()
\r\r
589 void ResetPerSM(); // reset every SM
\r\r
590 void ResetPerStack(); // reset every Stack
\r\r
591 void ResetPerHC(); // reset every HC
\r\r
592 void ResetPerMCM(); // reset every MCM
\r\r
593 void ResetPerADC(); // reset every ADC
\r\r
594 void ResetMemory(); // reset all data members
\r\r
596 AliTRDrawStream(const AliTRDrawStream& st);
\r\r
597 AliTRDrawStream &operator=(const AliTRDrawStream &);
\r\r
599 // ----------------- DATA MEMBERS START
\r\r
601 struct AliTRDrawSM fSM; // one SM per buffer
\r\r
602 struct AliTRDrawStack *fStack; //! pointer to the current stack
\r\r
603 struct AliTRDrawHC *fHC; //! current HC
\r\r
604 struct AliTRDrawHC *fLastHC; //! last HC
\r\r
605 struct AliTRDrawMCM *fMCM; //! current MCM
\r\r
606 struct AliTRDrawADC *fADC; //! current ADC
\r\r
608 UInt_t *fpPos; // current position in the buffer
\r\r
609 UInt_t *fpBegin; // begin - pointer to the buffer word 0
\r\r
610 UInt_t *fpEnd; // end of the buffer
\r\r
612 UInt_t fWordLength; // length of the buffer in 32bit words
\r\r
614 Bool_t fIsGlobalDigitsParamSet; // set true if the global digit parameters are already set
\r\r
616 Int_t fStackNumber; // current stack number
\r\r
617 Int_t fStackLinkNumber; // current link in the stack
\r\r
619 Int_t fhcMCMcounter; // mcm counter inside single hc - used in Next()
\r\r
620 Int_t fmcmADCcounter; // adc counrer inside single adc - used in Next()
\r\r
622 Int_t fLinkTrackletCounter; // count the tracklets in the current HC
\r\r
623 Int_t fEndOfTrackletCount; // count link by link (hc by hc) used for debug
\r\r
624 Int_t fNWordsCounter; // counts words of given hc having link monitor error
\r\r
626 UInt_t fMaskADCword; // temp mask when decoding adcs
\r\r
627 UInt_t fTbinADC; // temp adc
\r\r
628 Int_t fDecodedADCs; // counter of decoded adcs [mj] do we need?
\r\r
630 UInt_t fEventCounter; // stores the valid/current MCM event counter
\r\r
631 UInt_t fLastEventCounter; // last known event counter of MCM
\r\r
633 Bool_t fSharedPadsOn; // do we want to output shared pads - default is off
\r\r
634 Int_t fMaxADCgeom; // maximum ADC channels per mcm
\r\r
636 Bool_t fBufferRead; // set to be true if buffer is read for a given equipment
\r\r
638 AliTRDgeometry *fGeometry; //! TRD geometry
\r\r
639 AliRawReader *fRawReader; //! raw reader
\r\r
641 AliTRDfeeParam *fTRDfeeParam; // pointer to the fee params
\r\r
645 static Bool_t fgExtraSkip; // whether we should skip the leading 24 words
\r\r
646 static Bool_t fgSkipCDH; // whether we should skip CDH (8 words)
\r\r
647 static Bool_t fgWarnError; // no errors no warnings
\r\r
648 static Bool_t fgCleanDataOnly; // release only clean events = no errors
\r\r
649 static Bool_t fgDebugFlag; // allow debugging info
\r\r
650 static Bool_t fgEnableMemoryReset; // allow memory reset
\r\r
651 static Bool_t fgStackNumberChecker; // decide if we check stack number insanity - set false to cleanroom data
\r\r
652 static Bool_t fgStackLinkNumberChecker; // decide if we check stack link number insanity - debuging purpose
\r\r
653 static Bool_t fgSkipData; // decide if we skip corrupted data of given HC
\r\r
654 static Int_t fgDumpHead; // number of words to dump (from the start of the buffer) on each Init
\r\r
655 static Int_t fgEmptySignals[30]; // empty signals in case of ADC pointer = NULL
\r\r
656 static Short_t fgMCMordering[16]; // mcm number odering for mcm header corruption check
\r\r
657 static Short_t fgROBordering[16]; // mcm number odering for mcm header corruption check
\r\r
658 static Int_t fgLastHC; // HC number indicator to check HC numbering
\r\r
659 static Int_t fgLastROB; // ROB number indicator to check ROB numbering
\r\r
660 static Int_t fgLastIndex; // variable to check mcm number odering
\r\r
662 static Bool_t fgDumpingEnable; // flag to dump MCM data words
\r\r
664 static Int_t fgDumpingSM; // sm number to dump MCM data words
\r\r
665 static Int_t fgDumpingStack; // stack number to dump MCM data words
\r\r
666 static Int_t fgDumpingLayer; // layer number to dump MCM data words
\r\r
667 static Int_t fgDumpingROB; // rob number to dump MCM data words
\r\r
668 static Int_t fgDumpingMCM; // mcm number to dump MCM data words
\r\r
670 // this is a temporary solution!
\r\r
671 // baseline should come with the HC header word 2 (count from 0!)
\r\r
672 static Int_t fgCommonAdditive; // common additive - should be decoded! from HC word2
\r\r
674 // ----------------- DATA MEMBERS STOP
\r\r
676 enum ETRDzRawStreamError
\r\r
678 kDecodeStackInfo = 1 //
\r\r
679 , kMissingData = 2 //
\r\r
680 , kLinkDataMissing = 3 //
\r\r
681 , kHCdataMissing = 4 //
\r\r
682 , kTrackletOverflow = 5 //
\r\r
683 , kEOTrackeltsMissing = 6 //
\r\r
684 , kWrongPadrow = 7 //
\r\r
685 , kMCMheaderCorrupted = 8 //
\r\r
686 , kWrongMCMorROB = 9 //
\r\r
687 , kMCMeventMissmatch = 10 //
\r\r
688 , kMCMADCMaskMissing = 11 //
\r\r
689 , kHCHeaderCorrupt = 12 //
\r\r
690 , kHCHeaderWrongStack = 13 //
\r\r
691 , kHCHeaderWrongLayer = 14 //
\r\r
692 , kHCHeaderWrongSide = 15 //
\r\r
693 , kHCHeaderWrongSM = 16 //
\r\r
694 , kHCHeaderWrongDet = 17 //
\r\r
695 , kHCHeaderWrongROC = 18 //
\r\r
696 , kHCWordMissing = 19 //
\r\r
697 , kMCMdataMissing = 20 //
\r\r
698 , kMCMoverflow = 21 //
\r\r
699 , kADCdataMissing = 22 //
\r\r
700 , kADCmaskMissmatch = 23 //
\r\r
701 , kWrongPadcolumn = 24 //
\r\r
704 ClassDef(AliTRDrawStream, 0)
\r\r
705 }; //clas def end
\r\r