]>
Commit | Line | Data |
---|---|---|
d4232bb6 | 1 | #ifndef ALITRDRAWSTREAMTB_H |
2 | #define ALITRDRAWSTREAMTB_H | |
3 | ||
4 | /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
5 | * See cxx source for full Copyright notice */ | |
6 | ||
7 | /* $Id$ */ | |
8 | ||
9 | /////////////////////////////////////////////////////////////////////////////// | |
10 | // // | |
11 | // This class provides access to TRD digits in raw data. // | |
12 | // // | |
13 | /////////////////////////////////////////////////////////////////////////////// | |
14 | ||
15 | #include "TObject.h" | |
16 | #include "TString.h" | |
dfbb4bb9 | 17 | #include "AliTRDrawStreamBase.h" |
d4232bb6 | 18 | |
19 | class AliTRDgeometry; | |
20 | class AliRawReader; | |
21 | class AliTRDdigitsManager; | |
22 | class TTreeSRedirector; | |
23 | class AliTRDfeeParam; | |
24 | ||
dfbb4bb9 | 25 | // definitions in AliTRDrawStreamBase.h: |
26 | /* #define TRD_MAX_TBINS 30 */ | |
27 | /* #define TRD_MAX_ADC 21 */ | |
28 | /* #define TRD_MAX_MCM 4 * 16 */ | |
d4232bb6 | 29 | |
dfbb4bb9 | 30 | //class AliTRDrawStreamTB : public TObject |
31 | class AliTRDrawStreamTB : public AliTRDrawStreamBase | |
d4232bb6 | 32 | { // class def begin |
33 | ||
34 | public: | |
35 | ||
36 | //-------------------------------------------------------- | |
37 | ||
38 | // THE STRUCTURES | |
39 | ||
40 | //-------------------------------------------------------- | |
41 | ||
42 | struct AliTRDrawADC | |
43 | {//adc struct | |
44 | ||
45 | UInt_t *fPos; //! position of ADC 1st word in the buffer | |
46 | Short_t fADCnumber; // number of the ADC 0 .. 20 | |
47 | Short_t fCOL; // column - row from MCM | |
48 | Int_t fSignals[TRD_MAX_TBINS]; // signals for this adc | |
49 | Bool_t fIsShared; // is pad chared between MCMs | |
50 | Short_t fCorrupted; // is adc word corrupted | |
51 | ||
52 | AliTRDrawADC() | |
53 | : fPos(0) | |
54 | , fADCnumber(0) | |
55 | , fCOL(0) | |
56 | , fSignals() | |
57 | , fIsShared(kFALSE) | |
58 | , fCorrupted(0) | |
59 | { | |
60 | // default constructor | |
61 | ; | |
62 | } | |
63 | ||
6bd744d3 | 64 | AliTRDrawADC(const AliTRDrawADC& p): |
65 | fPos(p.fPos) | |
66 | , fADCnumber(p.fADCnumber) | |
67 | , fCOL(p.fCOL) | |
68 | , fSignals() | |
69 | , fIsShared(p.fIsShared) | |
70 | , fCorrupted(p.fCorrupted) | |
71 | { | |
72 | // copy constructor | |
73 | ; | |
74 | } | |
75 | ||
76 | AliTRDrawADC &operator=(const AliTRDrawADC &) | |
77 | { | |
78 | // assignment operator | |
79 | // not implemented | |
80 | return *this; | |
81 | } | |
82 | ||
83 | ||
d4232bb6 | 84 | }; |
85 | ||
86 | //-------------------------------------------------------- | |
87 | ||
88 | struct AliTRDrawMCM | |
89 | { // mcm struct | |
90 | Int_t fROB; // ROB number | |
91 | Int_t fMCM; // MCM number | |
92 | Int_t fROW; //filed during decoding! | |
93 | ||
94 | UInt_t fEvCounter; // MCM event counter | |
95 | UInt_t fADCMask; // ADC mask | |
96 | UInt_t fADCMaskWord; // word with ADC mask in | |
97 | UInt_t fADCchannel[30]; // channels to be decoded accrording to ADC mask | |
98 | ||
99 | Int_t fADCindex; // index of current ADC (comment: 1 ADC is 1 pad) | |
100 | Int_t fADCmax; // number of ADCs fired | |
101 | Int_t fMCMADCWords; // mcm words to expect | |
102 | Int_t fSingleADCwords; // n of words per ADC | |
103 | ||
104 | Int_t fCorrupted; // is mcm word corrupted | |
105 | ||
106 | UInt_t fErrorCounter; // count the mcm header errors | |
107 | UInt_t fMaskErrorCounter; // count the adc mask errors | |
108 | ||
109 | UInt_t *fPos; //! position of mcm header in the buffer | |
110 | UInt_t *fAdcDataPos; //! start of ADC data for this mcm | |
111 | ||
112 | Int_t fADCcounter; // count the adcs decoded | |
113 | AliTRDrawADC fADCs[TRD_MAX_ADC]; // 21 adcs | |
114 | ||
115 | AliTRDrawMCM() | |
116 | : fROB(-1) | |
117 | , fMCM(-1) | |
118 | , fROW(-1) | |
119 | , fEvCounter(0) | |
120 | , fADCMask(0) | |
121 | , fADCMaskWord(0) | |
122 | , fADCchannel() | |
123 | , fADCindex(0) | |
124 | , fADCmax(0) | |
125 | , fMCMADCWords(0) | |
126 | , fSingleADCwords(0) | |
127 | , fCorrupted(0) | |
128 | , fErrorCounter(0) | |
129 | , fMaskErrorCounter(0) | |
130 | , fPos(0) | |
131 | , fAdcDataPos(0) | |
132 | , fADCcounter(0) | |
133 | , fADCs() | |
134 | { | |
135 | // default constructor | |
136 | /* the following violates coding conventions */ | |
137 | //for (Int_t i = 0; i < 30; i++) fADCchannel[i] = 0; | |
138 | } | |
6bd744d3 | 139 | |
140 | AliTRDrawMCM(const AliTRDrawMCM & p): | |
141 | fROB(p.fROB) | |
142 | , fMCM(p.fMCM) | |
143 | , fROW(p.fROW) | |
144 | , fEvCounter(p.fEvCounter) | |
145 | , fADCMask(p.fADCMask) | |
146 | , fADCMaskWord(p.fADCMaskWord) | |
147 | , fADCchannel() | |
148 | , fADCindex(p.fADCindex) | |
149 | , fADCmax(p.fADCmax) | |
150 | , fMCMADCWords(p.fMCMADCWords) | |
151 | , fSingleADCwords(p.fSingleADCwords) | |
152 | , fCorrupted(p.fCorrupted) | |
153 | , fErrorCounter(p.fErrorCounter) | |
154 | , fMaskErrorCounter(p.fMaskErrorCounter) | |
155 | , fPos(p.fPos) | |
156 | , fAdcDataPos(p.fAdcDataPos) | |
157 | , fADCcounter(p.fADCcounter) | |
158 | , fADCs() | |
159 | { | |
160 | // copy constructor | |
161 | ; | |
162 | } | |
163 | ||
164 | AliTRDrawMCM &operator=(const AliTRDrawMCM &) | |
165 | { | |
166 | // assignment operator | |
167 | // not implemented | |
168 | return *this; | |
169 | } | |
170 | ||
d4232bb6 | 171 | }; |
172 | ||
173 | //-------------------------------------------------------- | |
174 | ||
175 | struct AliTRDrawHC | |
176 | { // hc struct | |
177 | // global | |
178 | Int_t fCorrupted; // Zero if not corrupted | |
179 | ||
180 | UInt_t fH0ErrorCounter; // Count the H0 word errors | |
181 | UInt_t fH1ErrorCounter; // Count the H1 word errors | |
182 | ||
183 | // word 0 | |
184 | Int_t fSpecialRawV; // Raw data version | |
185 | Int_t fRawVMajor; // Raw data version | |
186 | Int_t fRawVMinor; // Raw data version | |
187 | Int_t fNExtraWords; // N extra HC header words | |
188 | Int_t fDCSboard; // DCS board number | |
189 | Int_t fSM; // Super Module number | |
190 | Int_t fStack; // Stack number (some people might call it a chamber) | |
191 | Int_t fLayer; // Layer number (some people might call it a plane) | |
192 | Int_t fSide; // Side of HC | |
193 | ||
194 | //word 1 | |
195 | Int_t fTimeBins; // N of t bins | |
196 | UInt_t fBunchCrossCounter; // Bunch crossing counter | |
197 | UInt_t fPreTriggerCounter; // Pre Trigger counter | |
198 | UInt_t fPreTriggerPhase; // Pre Trigger phase | |
199 | ||
200 | UInt_t *fPos[2]; //! position of the header words in buffer | |
201 | ||
202 | Int_t fDET; // filled while decoding | |
203 | Int_t fROC; // filled while decoding | |
204 | Int_t fRowMax; // filled while decoding | |
205 | Int_t fColMax; // filled while decoding | |
206 | ||
207 | //AliTRDrawMCM fMCMs[4][16]; // 4 ROBS 16 each - that is max! | |
208 | Int_t fMCMmax; // number of mcm found | |
209 | AliTRDrawMCM fMCMs[TRD_MAX_MCM]; // 4 ROBS 16 each - that is max! | |
210 | ||
211 | AliTRDrawHC() | |
212 | : fCorrupted(0) | |
213 | , fH0ErrorCounter(0) | |
214 | , fH1ErrorCounter(0) | |
215 | , fSpecialRawV(0) | |
216 | , fRawVMajor(0) | |
217 | , fRawVMinor(0) | |
218 | , fNExtraWords(0) | |
219 | , fDCSboard(-1) | |
220 | , fSM(-1) | |
221 | , fStack(-1) | |
222 | , fLayer(-1) | |
223 | , fSide(-1) | |
224 | , fTimeBins(0) | |
225 | , fBunchCrossCounter(0) | |
226 | , fPreTriggerCounter(0) | |
227 | , fPreTriggerPhase(0) | |
228 | , fPos() | |
229 | , fDET(-1) | |
230 | , fROC(-1) | |
231 | , fRowMax(-1) | |
232 | , fColMax(-1) | |
233 | , fMCMmax(0) | |
234 | , fMCMs() | |
235 | { | |
236 | // default constructor hc info | |
237 | /* the following violates coding conventions */ | |
238 | //fPos[0] = fPos[0] = 0; | |
239 | } | |
6bd744d3 | 240 | |
241 | AliTRDrawHC(const AliTRDrawHC & p): | |
242 | fCorrupted(p.fCorrupted) | |
243 | , fH0ErrorCounter(p.fH0ErrorCounter) | |
244 | , fH1ErrorCounter(p.fH1ErrorCounter) | |
245 | , fSpecialRawV(p.fSpecialRawV) | |
246 | , fRawVMajor(p.fRawVMajor) | |
247 | , fRawVMinor(p.fRawVMinor) | |
248 | , fNExtraWords(p.fNExtraWords) | |
249 | , fDCSboard(p.fDCSboard) | |
250 | , fSM(p.fSM) | |
251 | , fStack(p.fStack) | |
252 | , fLayer(p.fLayer) | |
253 | , fSide(p.fSide) | |
254 | , fTimeBins(p.fTimeBins) | |
255 | , fBunchCrossCounter(p.fBunchCrossCounter) | |
256 | , fPreTriggerCounter(p.fPreTriggerCounter) | |
257 | , fPreTriggerPhase(p.fPreTriggerPhase) | |
258 | , fPos() | |
259 | , fDET(p.fDET) | |
260 | , fROC(p.fROC) | |
261 | , fRowMax(p.fRowMax) | |
262 | , fColMax(p.fColMax) | |
263 | , fMCMmax(p.fMCMmax) | |
264 | , fMCMs() | |
265 | { | |
266 | // copy constructor | |
267 | ; | |
268 | } | |
269 | ||
270 | AliTRDrawHC &operator=(const AliTRDrawHC &) | |
271 | { | |
272 | // assignment operator | |
273 | // not implemented | |
274 | return *this; | |
275 | } | |
276 | ||
d4232bb6 | 277 | }; |
278 | ||
279 | //-------------------------------------------------------- | |
280 | ||
281 | struct AliTRDrawStack | |
282 | { | |
283 | UInt_t fHeaderSize; // header size of the stack info | |
284 | Bool_t fLinksActive[12]; // data links active - 1 per half chamber | |
285 | Bool_t fTrackletDecode[12]; // book keeping while decoding - set false after decoding | |
286 | Bool_t fHCDecode[12]; // book keeping while decoding - set false after HC header decoding | |
287 | Int_t fActiveLinks; // number of active links | |
288 | UInt_t *fPos; //! position in the buffer | |
289 | ||
290 | AliTRDrawHC fHalfChambers[12]; // 6 chambers in a stack | |
291 | ||
292 | AliTRDrawStack() | |
293 | : fHeaderSize(0) | |
294 | , fLinksActive() | |
295 | , fTrackletDecode() //book keeping while decoding - set false after decoding | |
296 | , fHCDecode() //book keeping while decoding - set false after HC header decoding | |
297 | , fActiveLinks(0) | |
298 | , fPos(0) | |
299 | , fHalfChambers() | |
300 | { | |
301 | // default constructor | |
302 | } | |
6bd744d3 | 303 | |
304 | AliTRDrawStack(const AliTRDrawStack & p): | |
305 | fHeaderSize(p.fHeaderSize) | |
306 | , fLinksActive() | |
307 | , fTrackletDecode() //book keeping while decoding - set false after decoding | |
308 | , fHCDecode() //book keeping while decoding - set false after HC header decoding | |
309 | , fActiveLinks(p.fActiveLinks) | |
310 | , fPos(p.fPos) | |
311 | , fHalfChambers() | |
312 | { | |
313 | // copy constructor | |
314 | ; | |
315 | } | |
316 | ||
317 | AliTRDrawStack &operator=(const AliTRDrawStack &) | |
318 | { | |
319 | // assignment operator | |
320 | // not implemented | |
321 | return *this; | |
322 | } | |
323 | ||
d4232bb6 | 324 | }; |
325 | ||
326 | /* the following violates coding conventions */ | |
327 | /* for (Int_t i = 0; i < 12; i++) */ | |
328 | /* { */ | |
329 | /* fLinksActive[i] = fTrackletDecode[i] = fHCDecode[i] = kFALSE; */ | |
330 | /* } */ | |
331 | ||
332 | //-------------------------------------------------------- | |
333 | ||
334 | struct AliTRDrawSM | |
335 | { | |
336 | UInt_t fHeaderSize; // size of the header in words | |
337 | Bool_t fTrackletEnable; // tracklet enable bit | |
338 | Bool_t fStackActive[5]; // map of active/expected stacks | |
339 | Int_t fActiveStacks; // number of active stacks | |
340 | Int_t fCorrupted; // is sm info corrupted | |
341 | Int_t fNexpectedHalfChambers; // number of half chambers to be read out | |
342 | Bool_t fClean; // true if everything went OK - false is some error occured | |
343 | UInt_t *fPos; //! location of the sm info - should be the first word (after CDH if not DDL buffer) | |
344 | ||
345 | AliTRDrawStack fStacks[5]; // we do have only five stacks ;) | |
346 | ||
347 | AliTRDrawSM() | |
348 | : fHeaderSize(0) | |
349 | , fTrackletEnable(0) | |
350 | , fStackActive() | |
351 | , fActiveStacks(0) | |
352 | , fCorrupted(0) | |
353 | , fNexpectedHalfChambers(0) | |
354 | , fClean(kTRUE) | |
355 | , fPos(0) | |
356 | , fStacks() | |
357 | { | |
358 | // Default constructor | |
359 | // coding rule violation in the next line | |
360 | //for (Int_t i = 0; i < 5; i++) fStackActive[i] = kFALSE; | |
361 | }; | |
6bd744d3 | 362 | |
363 | AliTRDrawSM(const AliTRDrawSM & p): | |
364 | fHeaderSize(p.fHeaderSize) | |
365 | , fTrackletEnable(p.fTrackletEnable) | |
366 | , fStackActive() | |
367 | , fActiveStacks(p.fActiveStacks) | |
368 | , fCorrupted(p.fCorrupted) | |
369 | , fNexpectedHalfChambers(p.fNexpectedHalfChambers) | |
370 | , fClean(p.fClean) | |
371 | , fPos(p.fPos) | |
372 | , fStacks() | |
373 | { | |
374 | // copy constructor | |
375 | ; | |
376 | } | |
377 | ||
378 | AliTRDrawSM &operator=(const AliTRDrawSM &) | |
379 | { | |
380 | // assignment operator | |
381 | // not implemented | |
382 | return *this; | |
383 | } | |
384 | ||
d4232bb6 | 385 | }; |
386 | ||
387 | //-------------------------------------------------------- | |
388 | ||
389 | AliTRDrawStreamTB(); | |
390 | AliTRDrawStreamTB(AliRawReader *rawReader); | |
391 | virtual ~AliTRDrawStreamTB(); | |
392 | ||
393 | //-------------------------------------------------------- | |
394 | ||
395 | virtual Bool_t Next(); // Read the next data | |
396 | virtual Int_t NextChamber(AliTRDdigitsManager *man); // read next chamber data | |
397 | virtual Bool_t Init(); // Init some internal variables | |
398 | ||
dfbb4bb9 | 399 | Bool_t SetRawVersion(Int_t fraw); // set the raw version - used for backward compat. |
d4232bb6 | 400 | |
d4232bb6 | 401 | Bool_t IsCurrentPadShared() const {return fADC->fIsShared;} // is current pad shared between mcms |
402 | void SetSharedPadReadout(Bool_t fv) {fSharedPadsOn = fv;} // set the flag on if the reader should return the shared pads | |
403 | Bool_t IsDataZeroSuppressed() const {return (fHC->fRawVMajor > 2) ? kTRUE : kFALSE;} // check the version and tell if ZS is on | |
404 | ||
405 | Bool_t DecodeSM(void *buffer, UInt_t length); //decode a buffer | |
406 | Int_t DecodeSM(); // used with raw reader | |
407 | Int_t DecodeSM(AliRawReader *reader); // used with raw reader | |
408 | ||
409 | Bool_t SetReader(AliRawReader *reader); // set the raw reader to use | |
410 | ||
411 | Bool_t IsTrackletEnableBitSet() const {return fSM.fTrackletEnable;} // get status of the tracklets enable bit | |
412 | Bool_t IsStackActive(Int_t is) const {return fSM.fStackActive[is];} // get status of a stack | |
413 | Int_t GetNofActiveStacks() const {return fSM.fActiveStacks;} // get number of active stacks | |
414 | UInt_t *GetSMstreamPosition() const {return fSM.fPos;} // get position of the SM index word in the buffer | |
415 | ||
416 | Bool_t IsSMbufferClean() const {return fSM.fClean;} // is data clean | |
417 | ||
418 | Bool_t IsLinkActiveInStack(Int_t is, Int_t il) const {return fSM.fStacks[is].fLinksActive[il];} // check whether the link is active | |
419 | Int_t GetActiveLinksInStack(Int_t is) const {return fSM.fStacks[is].fActiveLinks;} //get active links in a stack | |
420 | ||
421 | Int_t GetSpecialRawVersion() const {return fHC ? fHC->fSpecialRawV : -1;} // return special raw version | |
422 | Int_t GetMajorRawVersion() const {return fHC ? fHC->fRawVMajor : -1;} // major raw version getter | |
423 | Int_t GetRawVersion() const {return fHC ? fHC->fRawVMajor : -1;} // compatibility see funtion above | |
424 | Int_t GetMinorRawVersion() const {return fHC ? fHC->fRawVMinor : -1;} // minor raw version | |
425 | ||
426 | Int_t GetSM() const {return fHC ? fHC->fSM : -1;} // Position of CURRENT half chamber in full TRD | |
427 | Int_t GetLayer() const {return fHC ? fHC->fLayer : -1;} // PLANE = Position of CURRENT half chamber in full TRD | |
428 | Int_t GetStack() const {return fHC ? fHC->fStack : -1;} // CHAMBER = Position of CURRENT half chamber in full TRD | |
429 | Int_t GetSide() const {return fHC ? fHC->fSide : -1;} // get side | |
430 | Int_t GetDCS() const { return fHC ? fHC->fDCSboard : -1;} // DCS board number read from data (HC header) | |
431 | //Int_t GetDCSboard() {return fHC ? fHC->fDCSboard : -1;} // DCS board number read from data (HC header) | |
432 | Int_t GetROC() const { return fHC ? fHC->fROC : -1;} // Position of CURRENT half chamber in full TRD | |
433 | Int_t GetNumberOfTimeBins() const { return fHC ? fHC->fTimeBins : 0;} // Get Ntime bins | |
434 | UInt_t GetBunchCrossCounter() const {return fHC ? fHC->fBunchCrossCounter : 0;} // get bunch cross counter | |
435 | UInt_t GetPreTriggerCounter() const {return fHC ? fHC->fPreTriggerCounter : 0;} // get pre trigger info | |
436 | UInt_t GetPreTriggerPhase() const {return fHC ? fHC->fPreTriggerPhase : 0;} // get trigger phase | |
437 | ||
438 | Int_t GetRow() const {return fMCM ? fMCM->fROW : -1;} // get current row number | |
439 | Int_t GetCol() const {return fADC ? fADC->fCOL : -1;} // get current column number | |
440 | Int_t GetRowMax() const { return fHC ? fHC->fRowMax : -1;} // Get maximum rows in the current HC | |
441 | Int_t GetColMax() const { return fHC ? fHC->fColMax : -1;} // Get maximum cols in the current HC | |
442 | // compatibility | |
443 | Int_t GetMaxRow() const { return fHC ? fHC->fRowMax : -1;} // Get maximum rows in the current HC | |
444 | Int_t GetMaxCol() const { return fHC ? fHC->fColMax : -1;} // Get maximum cols in the current HC | |
445 | ||
446 | UInt_t GetHCword0() const {return fHC ? *fHC->fPos[0] : 0;} // get the HC word 0 | |
447 | UInt_t GetHCword1() const {return fHC ? *fHC->fPos[1] : 0;} // get the HC word 1 | |
448 | ||
449 | Int_t GetDET() const {return fHC ? fHC->fDET : -1;} // get current det number | |
450 | Int_t GetDet() const {return fHC ? fHC->fDET : -1;} // get current det number | |
451 | ||
452 | Int_t GetROB() const {return fMCM ? fMCM->fROB : -1;} // get current ROB number | |
453 | Int_t GetMCM() const {return fMCM ? fMCM->fMCM : -1;} // get current MCM number | |
454 | Int_t GetEventNumber() const { return fMCM->fEvCounter;} // MCM Event number and position of current MCM on TRD chamber | |
455 | ||
456 | Int_t IsMCMcorrupted() const {return fMCM ? fMCM->fCorrupted : -1;} // is current MCM header corrupted | |
457 | ||
458 | Int_t *GetSignals() const { return fADC ? fADC->fSignals : (Int_t *)fgEmptySignals;}//Signals in the n-time bins from Data Word | |
459 | Int_t GetADC() const { return fADC ? fADC->fADCnumber : -1 ;} // MCM ADC channel and Time Bin of word 1 | |
460 | Int_t GetTimeBin() const { return 0;} // MCM ADC channel and Time Bin of word 1 | |
461 | ||
462 | //---------------------------------------------------------- | |
463 | ||
464 | static void SetNoDebug() {fgDebugFlag = kFALSE;} // allow debug info | |
465 | static void SetNoErrorWarning() {fgWarnError = kFALSE;} // disable warning and error info | |
466 | static void SetForceCleanDataOnly() {fgCleanDataOnly = kTRUE;} // clean data only | |
467 | static void AllowCorruptedData() {fgCleanDataOnly = kFALSE;} // accept corrupted data | |
468 | ||
469 | static void SetExtraWordsFix() {fgExtraSkip = kTRUE;} // extra skip of 24 32-bit words | |
470 | static void SetSkipCDH() {fgSkipCDH = kTRUE;} // skip of 8 32-bit words | |
471 | void EnableDebug(TTreeSRedirector *debugStream = 0); // enable the debug stream - use the paramter if non zero | |
472 | static void EnableDebugStream() {fgDebugStreamFlag = kTRUE;} //global enable of the dbug stream | |
473 | static void DeleteDebugStream(); // helper function to delete the debug streamer | |
474 | static void SetDumpHead(UInt_t iv) {fgDumpHead = iv;} | |
6bd744d3 | 475 | static void DisableStackNumberChecker() {fgStackNumberChecker = kFALSE;} // set false to cleanroom data |
d4232bb6 | 476 | |
1ced3838 | 477 | // this is a temporary solution! |
478 | // baseline should come with the HC header word 2 (count from 0!) | |
479 | static void SetSubtractBaseline(Int_t baseline) {fgCommonAdditive = baseline;} | |
480 | Int_t GetCommonAdditive() const {return fgCommonAdditive;} // return the common additive | |
481 | ||
d4232bb6 | 482 | void DumpErrorCount(); |
483 | void ReSetStreamEventCounter(Int_t ival = 0) {fgStreamEventCounter = ival;} // reset the event counter for the debug streamer | |
484 | ||
485 | //-------------------------------------------------------- | |
486 | // Decoding functions | |
487 | //-------------------------------------------------------- | |
488 | ||
489 | void DecodeSMInfo(const UInt_t *word, struct AliTRDrawSM *sm) const ; | |
490 | const char *DumpSMInfo(const struct AliTRDrawSM *sm); | |
491 | void DecodeStackInfo(const UInt_t *word, struct AliTRDrawStack *st) const; | |
492 | const char *DumpStackInfo(const struct AliTRDrawStack *st); | |
493 | void DecodeHCwordH0(const UInt_t *word, struct AliTRDrawHC *hc) const; | |
494 | void DecodeHCwordH1(const UInt_t *word, struct AliTRDrawHC *hc) const; | |
495 | const char *DumpHCinfoH0(const struct AliTRDrawHC *hc); | |
496 | const char *DumpHCinfoH1(const struct AliTRDrawHC *hc); | |
497 | void DecodeMCMheader(const UInt_t *word, struct AliTRDrawMCM *mcm) const; | |
498 | UInt_t GetMCMadcMask(const UInt_t *word, struct AliTRDrawMCM *mcm) const; | |
499 | void DecodeMask(const UInt_t *word, struct AliTRDrawMCM *mcm) const; | |
500 | void MCMADCwordsWithTbins(UInt_t fTbins, struct AliTRDrawMCM *mcm) const; | |
501 | const char *DumpMCMinfo(const struct AliTRDrawMCM *mcm); | |
502 | const char *DumpMCMadcMask(const struct AliTRDrawMCM *mcm); | |
503 | ||
504 | protected: | |
505 | ||
506 | private: | |
507 | ||
508 | Bool_t InitBuffer(void *buffer, UInt_t length); // init the buffer - called by DecodeSM(void*, UInt_t) | |
509 | Bool_t DumpWords(UInt_t *px, UInt_t iw, UInt_t marker = 0); // dump some words onto the screen | |
510 | ||
511 | Int_t NextBuffer(); // go and init next buffer if available - check the implementation file for return values | |
512 | ||
513 | void SwapOnEndian(); // swap if endian is BIG | |
514 | Bool_t SkipWords(UInt_t iw); // skip number of words | |
515 | Bool_t DecodeTracklets(); // decode tracklets | |
516 | Bool_t DecodeHC(); // decode data in HC | |
517 | ||
518 | Bool_t DecodeADC(); // decode 10 ADC words | |
519 | ||
520 | Bool_t DecodeHCheader(); // decode HC header | |
521 | Bool_t SeekEndOfData(); // go to next end of raw data marker (actually 1 word after) | |
522 | Bool_t SeekNextMCMheader(); // go to next mcm header | |
523 | Bool_t DecodeMCMheader(); // decode mcm header | |
524 | ||
525 | Bool_t IsRowValid(); // check if row within the range | |
526 | Bool_t IsHCheaderOK(); // check if current hc header data make sense | |
527 | Bool_t IsMCMheaderOK(); // check if current mcm header data make sense | |
528 | ||
529 | void ResetCounters(); // reset some counters | |
530 | void ResetIterators(); // needed for Next() | |
531 | AliTRDrawStreamTB(const AliTRDrawStreamTB& st); | |
532 | AliTRDrawStreamTB &operator=(const AliTRDrawStreamTB &); | |
533 | ||
534 | // ----------------- DATA MEMBERS START | |
535 | ||
536 | struct AliTRDrawSM fSM; // one SM per buffer | |
537 | struct AliTRDrawStack *fStack; //! pointer to the current stack | |
538 | struct AliTRDrawHC *fHC; //! current HC | |
539 | struct AliTRDrawMCM *fMCM; //! current MCM | |
540 | struct AliTRDrawADC *fADC; //! current ADC | |
541 | ||
542 | UInt_t *fpPos; // current position in the buffer | |
543 | UInt_t *fpBegin; // begin - pointer to the buffer word 0 | |
544 | UInt_t *fpEnd; // end of the buffer | |
545 | ||
546 | UInt_t fWordLength; // length of the buffer in 32bit words | |
547 | ||
548 | Int_t fStackNumber; // current stack number | |
549 | Int_t fStackLinkNumber; // current link in the stack | |
550 | ||
551 | Int_t fhcMCMcounter; // mcm counter inside single hc - used in Next() | |
552 | Int_t fmcmADCcounter; // adc counrer inside single adc - used in Next() | |
553 | ||
554 | Int_t fLinkTrackletCounter; // count the tracklets in the current HC | |
555 | Int_t fEndOfTrackletCount; // count link by link (hc by hc) used for debug | |
556 | ||
557 | UInt_t fMaskADCword; // temp mask when decoding adcs | |
558 | UInt_t fTbinADC; // temp adc | |
559 | Int_t fDecodedADCs; // counter of decoded adcs | |
560 | ||
561 | UInt_t fEventCounter; // stores the valid/current MCM event counter | |
562 | UInt_t fLastEventCounter; // last known event counter of MCM | |
563 | ||
d4232bb6 | 564 | Bool_t fSharedPadsOn; // do we want to output shared pads - default is off |
565 | Int_t fMaxADCgeom; // maximum ADC channels per mcm | |
566 | ||
567 | AliTRDgeometry *fGeometry; //! TRD geometry | |
568 | AliRawReader *fRawReader; //! raw reader | |
569 | ||
570 | AliTRDfeeParam *fTRDfeeParam; // pointer to the fee params | |
571 | ||
572 | Bool_t fDebugStreamOwned; // created in this case by this - allowed to delete? | |
573 | ||
574 | // STATIC | |
575 | ||
576 | static Bool_t fgExtraSkip; // whether we should skip the leading 24 words | |
577 | static Bool_t fgSkipCDH; // whether we should skip CDH (8 words) | |
578 | static Bool_t fgWarnError; // no errors no warnings | |
579 | static Bool_t fgCleanDataOnly; // release only clean events = no errors | |
580 | static Bool_t fgDebugFlag; // allow debugging info | |
581 | static Bool_t fgDebugStreamFlag; // set on debug streamer | |
6bd744d3 | 582 | static Bool_t fgStackNumberChecker; // decide if we check stack number insanity - set false to cleanroom data |
d4232bb6 | 583 | static TTreeSRedirector *fgDebugStreamer; //!Debug streamer |
584 | static UInt_t fgStreamEventCounter; // event counter for debug streamer | |
585 | static UInt_t fgDumpHead; // number of words to dump (from the start of the buffer) on each Init | |
586 | static Int_t fgEmptySignals[30]; // empty signals in case of ADC pointer = NULL | |
587 | ||
588 | ||
1ced3838 | 589 | // this is a temporary solution! |
590 | // baseline should come with the HC header word 2 (count from 0!) | |
591 | static Int_t fgCommonAdditive; // common additive - should be decoded! from HC word2 | |
592 | ||
d4232bb6 | 593 | // ----------------- DATA MEMBERS STOP |
594 | ||
595 | enum ETRDzRawStreamError | |
596 | { | |
597 | kDecodeStackInfo = 1 // | |
598 | , kMissingData = 2 // | |
599 | , kLinkDataMissing = 3 // | |
600 | , kHCdataMissing = 4 // | |
601 | , kTrackletOverflow = 5 // | |
602 | , kEOTrackeltsMissing = 6 // | |
603 | , kWrongPadrow = 7 // | |
604 | , kMCMheaderCorrupted = 8 // | |
605 | , kWrongMCMorROB = 9 // | |
606 | , kMCMeventMissmatch = 10 // | |
607 | , kMCMADCMaskMissing = 11 // | |
608 | , kHCHeaderCorrupt = 12 // | |
609 | , kHCHeaderWrongStack = 13 // | |
610 | , kHCHeaderWrongLayer = 14 // | |
611 | , kHCHeaderWrongSide = 15 // | |
612 | , kHCHeaderWrongSM = 16 // | |
613 | , kHCHeaderWrongDet = 17 // | |
614 | , kHCHeaderWrongROC = 18 // | |
615 | , kHCWordMissing = 19 // | |
616 | , kMCMdataMissing = 20 // | |
617 | , kMCMoverflow = 21 // | |
618 | , kADCdataMissing = 22 // | |
619 | , kADCmaskMissmatch = 23 // | |
620 | , kWrongPadcolumn = 24 // | |
621 | }; | |
622 | ||
623 | ClassDef(AliTRDrawStreamTB, 0) | |
624 | }; //clas def end | |
625 | ||
626 | #endif | |
627 | ||
628 | ||
629 | ||
630 | ||
631 | ||
632 | ||
633 | ||
634 | ||
635 | ||
636 | ||
637 | ||
638 | ||
639 | ||
640 | ||
641 | ||
642 | ||
643 | ||
644 | ||
645 | ||
646 | ||
647 | ||
648 | ||
649 | ||
650 |