]>
Commit | Line | Data |
---|---|---|
5b4ed716 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | ***************************************************************************/ | |
15 | ||
16 | /* | |
17 | $Log: AliTOFDecoder.cxx,v $ | |
18 | Revision 1.4 2007/05/18 13:08:57 decaro | |
19 | Coding convention: RS1 violation -> suppression | |
20 | ||
21 | Revision 1.3 2007/05/08 11:56:05 arcelli | |
22 | improved verbosity in verbose mode (R.Preghenella) | |
23 | ||
24 | Revision 1.2 2007/05/03 11:34:43 decaro | |
25 | Coding convention: RS1 violation -> suppression | |
26 | ||
27 | Revision 1.1 2007/04/27 11:00:32 arcelli | |
28 | TOF Raw Data decoder | |
29 | ||
30 | author: Roberto Preghenella (R+), preghenella@bo.infn.it | |
31 | */ | |
32 | ||
33 | ||
34 | ////////////////////////////////////////////////////////////////////// | |
35 | // // | |
36 | // // | |
37 | // Class for raw data decoding // | |
38 | // // | |
39 | // // | |
40 | ////////////////////////////////////////////////////////////////////// | |
41 | ||
42 | ||
43 | #include "AliLog.h" | |
46b17363 | 44 | #include "AliTOFRawDataFormat.h" |
5b4ed716 | 45 | #include "AliTOFDecoderV2.h" |
46 | #include "AliTOFTDCHit.h" | |
46b17363 | 47 | #include "AliTOFDecoderSummaryData.h" |
48 | #include "AliTOFDRMSummaryData.h" | |
49 | #include "AliTOFLTMSummaryData.h" | |
50 | #include "AliTOFTRMSummaryData.h" | |
51 | #include "AliTOFChainSummaryData.h" | |
52 | #include "AliTOFTDCHitBuffer.h" | |
53 | #include "AliTOFTDCErrorBuffer.h" | |
54 | #include "AliRawDataHeader.h" | |
5b4ed716 | 55 | |
56 | ClassImp(AliTOFDecoderV2) | |
57 | ||
58 | //_________________________________________________________________ | |
59 | ||
60 | AliTOFDecoderV2::AliTOFDecoderV2(AliRawReader *reader) : | |
61 | TObject(), | |
62 | fRawReader(reader), | |
63 | fVerbose(kFALSE), | |
64 | fLogErrors(kTRUE), | |
65 | fV2718Patch(kFALSE), | |
66 | fRecoverError(kTRUE), | |
67 | fRecoverErrorThr(0), | |
68 | fSpider(kTRUE), | |
69 | fRunNumber(0), | |
70 | fEventNumber(0), | |
71 | fEquipmentID(0), | |
72 | fDecoderSummaryData(0x0), | |
73 | fDRMSummaryData(0x0), | |
74 | fLTMSummaryData(0x0), | |
75 | fTRMSummaryData(0x0), | |
76 | fChainSummaryData(0x0), | |
77 | fTDCHitBuffer(0x0), | |
78 | fTDCPackedHitBuffer(0x0), | |
79 | fTDCErrorBuffer(0x0), | |
80 | fDRMGlobalHeader(0x0), | |
81 | fDRMGlobalTrailer(0x0), | |
82 | fDRMStatusHeader1(0x0), | |
83 | fDRMStatusHeader2(0x0), | |
84 | fDRMStatusHeader3(0x0), | |
85 | fDRMStatusHeader4(0x0), | |
86 | fDRMEventCRC(0x0), | |
87 | fLTMGlobalHeader(0x0), | |
88 | fLTMGlobalTrailer(0x0), | |
89 | fLTMPDLData(0x0), | |
90 | fLTMADCData(0x0), | |
91 | fLTMORData(0x0), | |
92 | fTRMGlobalHeader(0x0), | |
93 | fTRMGlobalTrailer(0x0), | |
94 | fTRMChainHeader(0x0), | |
95 | fTRMChainTrailer(0x0), | |
96 | fTDCPackedHit(0x0), | |
97 | fTDCUnpackedHit(0x0), | |
98 | fTRMTDCError(0x0), | |
99 | fTRMDiagnosticErrorWord1(0x0), | |
100 | fTRMDiagnosticErrorWord2(0x0), | |
101 | fSpiderTDCID(-1), | |
102 | fSpiderTDCPackedHitBuffer(0x0) | |
103 | { | |
104 | //default constructor | |
105 | if (fRawReader) | |
106 | fRawReader->Select("TOF", 0, 71); | |
107 | ||
108 | fDecoderSummaryData = new AliTOFDecoderSummaryData(); | |
109 | ||
110 | for (Int_t iChan = 0; iChan < N_CHANNEL; iChan++) | |
111 | fSpiderBufferFull[iChan] = kFALSE; | |
112 | } | |
113 | ||
114 | //_________________________________________________________________ | |
115 | ||
116 | AliTOFDecoderV2::AliTOFDecoderV2(const AliTOFDecoderV2 &source) : | |
117 | TObject(), | |
118 | fRawReader(source.fRawReader), | |
119 | fVerbose(source.fVerbose), | |
120 | fLogErrors(source.fLogErrors), | |
121 | fV2718Patch(source.fV2718Patch), | |
122 | fRecoverError(source.fRecoverError), | |
123 | fRecoverErrorThr(source.fRecoverErrorThr), | |
124 | fSpider(source.fSpider), | |
125 | fRunNumber(source.fRunNumber), | |
126 | fEventNumber(source.fEventNumber), | |
127 | fEquipmentID(source.fEquipmentID), | |
128 | fDecoderSummaryData(0x0), | |
129 | fDRMSummaryData(0x0), | |
130 | fLTMSummaryData(0x0), | |
131 | fTRMSummaryData(0x0), | |
132 | fChainSummaryData(0x0), | |
133 | fTDCHitBuffer(0x0), | |
134 | fTDCPackedHitBuffer(0x0), | |
135 | fTDCErrorBuffer(0x0), | |
136 | fDRMGlobalHeader(0x0), | |
137 | fDRMGlobalTrailer(0x0), | |
138 | fDRMStatusHeader1(0x0), | |
139 | fDRMStatusHeader2(0x0), | |
140 | fDRMStatusHeader3(0x0), | |
141 | fDRMStatusHeader4(0x0), | |
142 | fDRMEventCRC(0x0), | |
143 | fLTMGlobalHeader(0x0), | |
144 | fLTMGlobalTrailer(0x0), | |
145 | fLTMPDLData(0x0), | |
146 | fLTMADCData(0x0), | |
147 | fLTMORData(0x0), | |
148 | fTRMGlobalHeader(0x0), | |
149 | fTRMGlobalTrailer(0x0), | |
150 | fTRMChainHeader(0x0), | |
151 | fTRMChainTrailer(0x0), | |
152 | fTDCPackedHit(0x0), | |
153 | fTDCUnpackedHit(0x0), | |
154 | fTRMTDCError(0x0), | |
155 | fTRMDiagnosticErrorWord1(0x0), | |
156 | fTRMDiagnosticErrorWord2(0x0), | |
157 | fSpiderTDCID(-1), | |
158 | fSpiderTDCPackedHitBuffer(0x0) | |
159 | { | |
160 | //copy constructor | |
161 | fDecoderSummaryData = new AliTOFDecoderSummaryData(*source.fDecoderSummaryData); | |
162 | ||
163 | for (Int_t iChan = 0; iChan < N_CHANNEL; iChan++) | |
164 | fSpiderBufferFull[iChan] = kFALSE; | |
165 | } | |
166 | ||
167 | //_________________________________________________________________ | |
168 | ||
169 | AliTOFDecoderV2 & | |
170 | AliTOFDecoderV2::operator = (const AliTOFDecoderV2 &source) | |
171 | { | |
172 | //operator = | |
173 | fRawReader = source.fRawReader; | |
174 | fVerbose = source.fVerbose; | |
175 | fLogErrors = source.fLogErrors; | |
176 | fV2718Patch = source.fV2718Patch; | |
177 | fRecoverError = source.fRecoverError; | |
178 | fRecoverErrorThr = source.fRecoverErrorThr; | |
179 | fSpider = source.fSpider; | |
180 | fRunNumber = source.fRunNumber; | |
181 | fEventNumber = source.fEventNumber; | |
182 | fEquipmentID = source.fEquipmentID; | |
183 | *fDecoderSummaryData = *source.fDecoderSummaryData; | |
184 | return *this; | |
185 | } | |
186 | ||
187 | AliTOFDecoderV2::~AliTOFDecoderV2() | |
188 | { | |
189 | delete fDecoderSummaryData; | |
190 | } | |
191 | ||
192 | //_________________________________________________________________ | |
193 | ||
194 | Bool_t | |
195 | AliTOFDecoderV2::Decode(UInt_t *rawData, UInt_t nWords) | |
196 | { | |
197 | /* main decoding routine. | |
198 | * it loops over nWords 32-bit words | |
199 | * starting at *rawData and decodes them. | |
200 | * it also fills some buffers in order to | |
201 | * have the decoded data available for other | |
202 | * classes. | |
203 | */ | |
204 | ||
205 | //reset decoder summary data | |
206 | fDecoderSummaryData->Reset(); | |
207 | ||
208 | //fill decoder summary data | |
209 | fDecoderSummaryData->SetRunNumber(fRunNumber); | |
210 | fDecoderSummaryData->SetEventNumber(fEventNumber); | |
211 | fDecoderSummaryData->SetEquipmentID(fEquipmentID); | |
212 | fDecoderSummaryData->SetInputWords(nWords); | |
213 | fDecoderSummaryData->SetRecoverError(fRecoverError); | |
214 | fDecoderSummaryData->SetSpider(fSpider); | |
215 | ||
216 | AliTOFTDCHit hit; | |
217 | AliTOFTDCError error; | |
218 | ||
219 | //decoder status | |
220 | UShort_t decoderStatus = 0x0; | |
221 | ||
222 | //CRC variables | |
46b17363 | 223 | UInt_t drmCRC = 0x0; |
224 | UInt_t ltmCRC = 0x0; | |
225 | UInt_t trmCRC = 0x0; | |
5b4ed716 | 226 | |
227 | // error warning counter | |
228 | Int_t errorWarning = 0; | |
229 | ||
230 | if (fRecoverError && fVerbose) | |
231 | AliInfo("Recover error option enabled: potentially dangerous!"); | |
232 | ||
233 | /*** V2718 patch ***/ | |
234 | if (fV2718Patch){ | |
235 | decoderStatus = decoderStatus | DRM_BIT; | |
236 | fDecoderSummaryData->SetDecoderStatus(decoderStatus); | |
237 | fDecoderSummaryData->SetCurrentDRMID(0x0); | |
238 | fDecoderSummaryData->SetV2718Patch(kTRUE); | |
239 | fDRMSummaryData = fDecoderSummaryData->GetDRMSummaryData(); | |
240 | fDRMSummaryData->SetHeader(kTRUE); | |
241 | fDRMSummaryData->SetDRMID(0x0); | |
242 | if (fVerbose) | |
243 | AliInfo("DRM not present: - V2718 patch decoding -"); | |
244 | } | |
245 | /*** V2718 patch ***/ | |
246 | ||
247 | if (fVerbose) | |
248 | AliInfo("Start decoding"); | |
249 | ||
250 | if (fVerbose) | |
251 | AliInfo("Loop over the data and decode"); | |
252 | ||
253 | if (fVerbose) | |
254 | AliInfo(" St Hex Word \t Decoded Word"); | |
255 | ||
256 | //loop over raw data | |
257 | for (UInt_t iWord = 0; | |
258 | iWord < nWords; | |
259 | iWord++, rawData++, fDecoderSummaryData->SetDecodedWords(iWord)){ | |
260 | ||
261 | //try to recover error | |
262 | if (fDecoderSummaryData->GetRecoveringError() && fVerbose) | |
263 | AliInfo(Form(" %02x - 0x%08x",decoderStatus,*rawData)); | |
264 | ||
265 | //compute CRC with current data | |
46b17363 | 266 | drmCRC ^= *rawData; |
267 | ltmCRC ^= *rawData; | |
268 | trmCRC ^= *rawData; | |
5b4ed716 | 269 | |
270 | //switch word type | |
271 | switch (*rawData & WORD_TYPE_MASK){ | |
272 | ||
273 | case GLOBAL_HEADER: | |
274 | ||
275 | //switch slot ID | |
276 | switch (*rawData & SLOT_ID_MASK){ | |
277 | ||
278 | //DRM global header (slotID=1) | |
279 | case 1: | |
280 | //try to recover error | |
281 | if (fDecoderSummaryData->GetRecoveringError()) | |
282 | continue; | |
283 | //check decode status | |
284 | if ( decoderStatus != DRM_HEADER_STATUS ){ | |
285 | if (fLogErrors) | |
286 | AliError(Form(" %02x - 0x%08x [ERROR] Unexpected DRM global header (curslot=%d)",decoderStatus,*rawData,fDecoderSummaryData->GetCurrentSlotID())); | |
287 | fDecoderSummaryData->SetErrorDetected(kTRUE); | |
288 | fDecoderSummaryData->SetErrorSlotID(fDecoderSummaryData->GetCurrentSlotID()); | |
289 | errorWarning++; | |
290 | //try to recover error | |
291 | if (fRecoverError){ | |
292 | if (errorWarning > fRecoverErrorThr) { | |
293 | if (fVerbose) | |
294 | AliInfo("Trying to recover the error: searching for the next header"); | |
295 | fDecoderSummaryData->SetRecoveringError(kTRUE); | |
296 | continue; | |
297 | } | |
298 | else { | |
299 | if (fVerbose) | |
300 | AliInfo("Do not try to recover error yet, go on with decoding process"); | |
301 | continue; | |
302 | } | |
303 | } | |
304 | return(fDecoderSummaryData->GetErrorDetected()); | |
305 | } | |
306 | //decode status ok | |
307 | errorWarning = 0; | |
308 | //set DRM global header | |
309 | fDRMGlobalHeader = (AliTOFDRMGlobalHeader *)rawData; | |
310 | //reset DRM CRC | |
46b17363 | 311 | drmCRC = 0x0; |
5b4ed716 | 312 | //fill decoder summary data |
313 | fDecoderSummaryData->SetCurrentDRMID(fDRMGlobalHeader->GetDRMID()); | |
314 | fDecoderSummaryData->SetCurrentSlotID(fDRMGlobalHeader->GetSlotID()); | |
315 | //get DRM summary data | |
316 | fDRMSummaryData = fDecoderSummaryData->GetDRMSummaryData(); | |
317 | //reset DRM summary data | |
318 | fDRMSummaryData->Reset(); | |
319 | //fill DRM summary data | |
320 | FillDRMSummaryData(fDRMGlobalHeader); | |
321 | //print verbose | |
322 | if (fVerbose) | |
323 | AliInfo(Form(" %02x - 0x%08x \t DRM global header",decoderStatus,*rawData)); | |
324 | //change decode status | |
325 | decoderStatus = decoderStatus | DRM_BIT; | |
326 | fDecoderSummaryData->SetDecoderStatus(decoderStatus); | |
327 | //decode DRM status headers | |
328 | for (Int_t i = 0; i < DRM_STATUS_HEADER_WORDS; i++){ | |
329 | iWord++; | |
330 | rawData++; | |
46b17363 | 331 | drmCRC ^= *rawData; |
5b4ed716 | 332 | |
333 | switch (i){ | |
334 | case 0: //DRM status header 1 | |
335 | fDRMStatusHeader1 = (AliTOFDRMStatusHeader1 *)rawData; | |
336 | FillDRMSummaryData(fDRMStatusHeader1); | |
337 | if (fVerbose) | |
338 | AliInfo(Form(" %02x - 0x%08x \t DRM status header 1",decoderStatus,*rawData)); | |
339 | break; | |
340 | case 1: //DRM status header 2 | |
341 | fDRMStatusHeader2 = (AliTOFDRMStatusHeader2 *)rawData; | |
342 | FillDRMSummaryData(fDRMStatusHeader2); | |
343 | if (fVerbose) | |
344 | AliInfo(Form(" %02x - 0x%08x \t DRM status header 2",decoderStatus,*rawData)); | |
345 | break; | |
346 | case 2: //DRM status header 3 | |
347 | fDRMStatusHeader3 = (AliTOFDRMStatusHeader3 *)rawData; | |
348 | FillDRMSummaryData(fDRMStatusHeader3); | |
349 | if (fVerbose) | |
350 | AliInfo(Form(" %02x - 0x%08x \t DRM status header 3",decoderStatus,*rawData)); | |
351 | break; | |
352 | case 3: //DRM status header 4 | |
353 | fDRMStatusHeader4 = (AliTOFDRMStatusHeader4 *)rawData; | |
354 | FillDRMSummaryData(fDRMStatusHeader4); | |
355 | if (fVerbose) | |
356 | AliInfo(Form(" %02x - 0x%08x \t DRM status header 4",decoderStatus,*rawData)); | |
357 | break; | |
358 | } | |
359 | } | |
360 | //decode DRM event CRC | |
361 | iWord++; | |
362 | rawData++; | |
46b17363 | 363 | drmCRC ^= *rawData; |
5b4ed716 | 364 | //remove DRM event CRC from DRM CRC |
46b17363 | 365 | drmCRC ^= *rawData; |
5b4ed716 | 366 | fDRMEventCRC = (AliTOFDRMEventCRC *)rawData; |
367 | FillDRMSummaryData(fDRMEventCRC); | |
368 | if (fVerbose) | |
369 | AliInfo(Form(" %02x - 0x%08x \t DRM event CRC",decoderStatus,*rawData)); | |
370 | break; | |
371 | ||
372 | //LTM global header (slotID=2) | |
373 | case 2: | |
374 | //recover error | |
375 | if (fDecoderSummaryData->GetRecoveringError()){ | |
376 | //change decode status | |
377 | decoderStatus = LTM_HEADER_STATUS; | |
378 | fDecoderSummaryData->SetDecoderStatus(decoderStatus); | |
379 | fDecoderSummaryData->SetRecoveringError(kFALSE); | |
380 | if (fVerbose) | |
381 | AliInfo("LTM global header found: error probably recovered"); | |
382 | } | |
383 | //check decode status | |
384 | if ( decoderStatus != LTM_HEADER_STATUS ){ | |
385 | if (fLogErrors) | |
386 | AliError(Form(" %02x - 0x%08x [ERROR] Unexpected LTM global header (curslot=%d)",decoderStatus,*rawData,fDecoderSummaryData->GetCurrentSlotID())); | |
387 | fDecoderSummaryData->SetErrorDetected(kTRUE); | |
388 | fDecoderSummaryData->SetErrorSlotID(fDecoderSummaryData->GetCurrentSlotID()); | |
389 | errorWarning++; | |
390 | //try to recover error | |
391 | if (fRecoverError){ | |
392 | if (errorWarning > fRecoverErrorThr) { | |
393 | if (fVerbose) | |
394 | AliInfo("Trying to recover the error: searching for the next header"); | |
395 | fDecoderSummaryData->SetRecoveringError(kTRUE); | |
396 | continue; | |
397 | } | |
398 | else { | |
399 | if (fVerbose) | |
400 | AliInfo("Do not try to recover error yet, go on with decoding process"); | |
401 | continue; | |
402 | } | |
403 | } | |
404 | return(fDecoderSummaryData->GetErrorDetected()); | |
405 | } | |
406 | //decode status ok | |
407 | errorWarning = 0; | |
408 | //set LTM global header | |
409 | fLTMGlobalHeader = (AliTOFLTMGlobalHeader *)rawData; | |
410 | //reset LTM CRC | |
46b17363 | 411 | ltmCRC = 0x0; |
5b4ed716 | 412 | //fill decoder summary data |
413 | fDecoderSummaryData->SetCurrentSlotID(fLTMGlobalHeader->GetSlotID()); | |
414 | //get LTM summary data | |
415 | fLTMSummaryData = fDRMSummaryData->GetLTMSummaryData(); | |
416 | //reset LTM summary data | |
417 | fLTMSummaryData->Reset(); | |
418 | //fill LTM summary data | |
419 | FillLTMSummaryData(fLTMGlobalHeader); | |
420 | //set DRM slot enable mask bit | |
421 | fDRMSummaryData->SetDecoderSlotEnableMaskBit(fLTMGlobalHeader->GetSlotID() - 2); | |
422 | //print verbose | |
423 | if (fVerbose) | |
424 | AliInfo(Form(" %02x - 0x%08x \t LTM global header",decoderStatus,*rawData)); | |
425 | //change decode status | |
426 | decoderStatus = decoderStatus | LTM_BIT; | |
427 | fDecoderSummaryData->SetDecoderStatus(decoderStatus); | |
428 | ||
429 | //decode LTM PDL data | |
430 | for (Int_t iPDLWord = 0; iPDLWord < LTM_PDL_DATA_WORDS; iPDLWord++){ | |
431 | iWord++; | |
432 | rawData++; | |
46b17363 | 433 | drmCRC ^= *rawData; |
434 | ltmCRC ^= *rawData; | |
5b4ed716 | 435 | //set LTM PDL data |
436 | fLTMPDLData = (AliTOFLTMPDLData *)rawData; | |
437 | //fill LTM summary data | |
438 | FillLTMSummaryData(fLTMPDLData, iPDLWord); | |
439 | //print verbose | |
440 | if (fVerbose) | |
441 | AliInfo(Form(" %02x - 0x%08x \t LTM PDL data \t\t PDL1=%03d PDL2=%03d PDL3=%03d PDL4=%03d",decoderStatus,*rawData,fLTMPDLData->GetPDLValue1(),fLTMPDLData->GetPDLValue2(),fLTMPDLData->GetPDLValue3(),fLTMPDLData->GetPDLValue4())); | |
442 | } | |
443 | //decode LTM ADC data | |
444 | for (Int_t iADCWord = 0; iADCWord < LTM_ADC_DATA_WORDS; iADCWord++){ | |
445 | iWord++; | |
446 | rawData++; | |
46b17363 | 447 | drmCRC ^= *rawData; |
448 | ltmCRC ^= *rawData; | |
5b4ed716 | 449 | //set LTM ADC data |
450 | fLTMADCData = (AliTOFLTMADCData *)rawData; | |
451 | //fill LTM summary data | |
452 | FillLTMSummaryData(fLTMADCData, iADCWord); | |
453 | //print verbose | |
454 | if (fVerbose) | |
455 | AliInfo(Form(" %02x - 0x%08x \t LTM ADC data \t\t ADC1=%04d ADC2=%04d ADC3=%04d",decoderStatus,*rawData,fLTMADCData->GetADCValue1(),fLTMADCData->GetADCValue2(),fLTMADCData->GetADCValue3())); | |
456 | } | |
457 | //decode LTM OR data | |
458 | for (Int_t iORWord = 0; iORWord < LTM_OR_DATA_WORDS; iORWord++){ | |
459 | iWord++; | |
460 | rawData++; | |
46b17363 | 461 | drmCRC ^= *rawData; |
462 | ltmCRC ^= *rawData; | |
5b4ed716 | 463 | //set LTM OR data |
464 | fLTMORData = (AliTOFLTMORData *)rawData; | |
465 | //fill LTM summary data | |
466 | FillLTMSummaryData(fLTMORData, iORWord); | |
467 | //print verbose | |
468 | if (fVerbose) | |
469 | AliInfo(Form(" %02x - 0x%08x \t LTM OR data \t\t ADC1=%04d ADC2=%04d ADC3=%04d",decoderStatus,*rawData,fLTMORData->GetORValue1(),fLTMORData->GetORValue2(),fLTMORData->GetORValue3())); | |
470 | } | |
471 | break; | |
472 | ||
473 | //TRM global header (slotID=3-12) | |
474 | case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 12: | |
475 | //recover error | |
476 | if (fDecoderSummaryData->GetRecoveringError()){ | |
477 | //change decode status | |
478 | decoderStatus = TRM_HEADER_STATUS; | |
479 | fDecoderSummaryData->SetDecoderStatus(decoderStatus); | |
480 | fDecoderSummaryData->SetRecoveringError(kFALSE); | |
481 | if (fVerbose) | |
482 | AliInfo("TRM global header found: error probably recovered"); | |
483 | } | |
484 | //check decode status | |
485 | if ( decoderStatus != TRM_HEADER_STATUS ){ | |
486 | if (fLogErrors) | |
487 | AliError(Form(" %02x - 0x%08x [ERROR] Unexpected TRM global header (curslot=%d)",decoderStatus,*rawData,fDecoderSummaryData->GetCurrentSlotID())); | |
488 | fDecoderSummaryData->SetErrorDetected(kTRUE); | |
489 | fDecoderSummaryData->SetErrorSlotID(fDecoderSummaryData->GetCurrentSlotID()); | |
490 | errorWarning++; | |
491 | //try to recover error | |
492 | if (fRecoverError){ | |
493 | if (errorWarning > fRecoverErrorThr) { | |
494 | if (fVerbose) | |
495 | AliInfo("Trying to recover the error: searching for the next header"); | |
496 | fDecoderSummaryData->SetRecoveringError(kTRUE); | |
497 | continue; | |
498 | } | |
499 | else { | |
500 | if (fVerbose) | |
501 | AliInfo("Do not try to recover error yet, go on with decoding process"); | |
502 | continue; | |
503 | } | |
504 | } | |
505 | return(fDecoderSummaryData->GetErrorDetected()); | |
506 | } | |
507 | //decode status ok | |
508 | errorWarning = 0; | |
509 | //set TRM global header | |
510 | fTRMGlobalHeader = (AliTOFTRMGlobalHeader *)rawData; | |
511 | //reset TRM CRC | |
46b17363 | 512 | trmCRC = 0x0; |
5b4ed716 | 513 | //fill decoder summary data |
514 | fDecoderSummaryData->SetCurrentSlotID(fTRMGlobalHeader->GetSlotID()); | |
515 | //get TRM summary data | |
516 | fTRMSummaryData = fDRMSummaryData->GetTRMSummaryData(fTRMGlobalHeader->GetSlotID() - TRM_FIRST_SLOT_ID); | |
517 | //reset TRM summary data | |
518 | fTRMSummaryData->Reset(); | |
519 | //fill TRM summary data | |
520 | FillTRMSummaryData(fTRMGlobalHeader); | |
521 | //set DRM slot enable mask bit | |
522 | fDRMSummaryData->SetDecoderSlotEnableMaskBit(fTRMGlobalHeader->GetSlotID() - 2); | |
523 | //print verbose | |
524 | if (fVerbose) | |
525 | AliInfo(Form(" %02x - 0x%08x \t TRM global header \t slotID=%02d ACQ=%01d L=%01d",decoderStatus,*rawData,fTRMGlobalHeader->GetSlotID(),fTRMGlobalHeader->GetACQBits(),fTRMGlobalHeader->GetLBit())); | |
526 | //change decode status | |
527 | decoderStatus = decoderStatus | TRM_BIT; | |
528 | fDecoderSummaryData->SetDecoderStatus(decoderStatus); | |
529 | break; | |
530 | ||
531 | default: | |
532 | if (fLogErrors) | |
533 | AliError(Form(" %02x - 0x%08x [ERROR] Not valid slotID in global header (curslot=%d)",decoderStatus,*rawData,fDecoderSummaryData->GetCurrentSlotID())); | |
534 | fDecoderSummaryData->SetErrorDetected(kTRUE); | |
535 | fDecoderSummaryData->SetErrorSlotID(fDecoderSummaryData->GetCurrentSlotID()); | |
536 | //try to recover error | |
537 | if (fRecoverError){ | |
538 | if (errorWarning > fRecoverErrorThr) { | |
539 | if (fVerbose) | |
540 | AliInfo("Trying to recover the error: searching for the next header"); | |
541 | fDecoderSummaryData->SetRecoveringError(kTRUE); | |
542 | continue; | |
543 | } | |
544 | else { | |
545 | if (fVerbose) | |
546 | AliInfo("Do not try to recover error yet, go on with decoding process"); | |
547 | continue; | |
548 | } | |
549 | } | |
550 | return(fDecoderSummaryData->GetErrorDetected()); | |
551 | break; | |
552 | ||
553 | } | |
554 | //end switch slotID | |
555 | break; | |
556 | ||
557 | case GLOBAL_TRAILER: | |
558 | ||
559 | //switch slot ID | |
560 | switch (*rawData & SLOT_ID_MASK){ | |
561 | ||
562 | //DRM global trailer (slotID=1) | |
563 | case 1: | |
564 | //recover error | |
565 | if (fDecoderSummaryData->GetRecoveringError()){ | |
566 | //change decode status | |
567 | decoderStatus = DRM_TRAILER_STATUS; | |
568 | fDecoderSummaryData->SetDecoderStatus(decoderStatus); | |
569 | fDecoderSummaryData->SetRecoveringError(kFALSE); | |
570 | if (fVerbose) | |
571 | AliInfo("DRM global trailer found: error probably recovered"); | |
572 | } | |
573 | //check decode status | |
574 | if ( decoderStatus != DRM_TRAILER_STATUS ){ | |
575 | if (fLogErrors) | |
576 | AliError(Form(" %02x - 0x%08x [ERROR] Unexpected DRM global trailer (curslot=%d)",decoderStatus,*rawData,fDecoderSummaryData->GetCurrentSlotID())); | |
577 | fDecoderSummaryData->SetErrorDetected(kTRUE); | |
578 | fDecoderSummaryData->SetErrorSlotID(fDecoderSummaryData->GetCurrentSlotID()); | |
579 | errorWarning++; | |
580 | //try to recover error | |
581 | if (fRecoverError){ | |
582 | if (errorWarning > fRecoverErrorThr) { | |
583 | if (fVerbose) | |
584 | AliInfo("Trying to recover the error: searching for the next header"); | |
585 | fDecoderSummaryData->SetRecoveringError(kTRUE); | |
586 | continue; | |
587 | } | |
588 | else { | |
589 | if (fVerbose) | |
590 | AliInfo("Do not try to recover error yet, go on with decoding process"); | |
591 | continue; | |
592 | } | |
593 | } | |
594 | return(fDecoderSummaryData->GetErrorDetected()); | |
595 | } | |
596 | //decode status ok | |
597 | errorWarning = 0; | |
598 | //set DRM global trailer | |
599 | fDRMGlobalTrailer = (AliTOFDRMGlobalTrailer *)rawData; | |
600 | //remove global trailer from DRM CRC | |
46b17363 | 601 | drmCRC ^= *rawData; |
5b4ed716 | 602 | //fill DRM summary data |
603 | FillDRMSummaryData(fDRMGlobalTrailer); | |
46b17363 | 604 | fDRMSummaryData->SetDecoderCRC(COMPUTE_DRM_CRC(drmCRC)); |
5b4ed716 | 605 | //print verbose |
606 | if (fVerbose) | |
607 | AliInfo(Form(" %02x - 0x%08x \t DRM global trailer",decoderStatus,*rawData)); | |
608 | //change decode status | |
609 | decoderStatus = decoderStatus & ~DRM_BIT; | |
610 | fDecoderSummaryData->SetDecoderStatus(decoderStatus); | |
611 | break; | |
612 | ||
613 | //LTM global trailer (slotID=2) | |
614 | case 2: | |
615 | //try to recover error | |
616 | if (fDecoderSummaryData->GetRecoveringError()) | |
617 | continue; | |
618 | //check decode status | |
619 | if ( decoderStatus != LTM_TRAILER_STATUS ){ | |
620 | if (fLogErrors) | |
621 | AliError(Form(" %02x - 0x%08x [ERROR] Unexpected LTM global trailer (curslot=%d)",decoderStatus,*rawData,fDecoderSummaryData->GetCurrentSlotID())); | |
622 | fDecoderSummaryData->SetErrorDetected(kTRUE); | |
623 | fDecoderSummaryData->SetErrorSlotID(fDecoderSummaryData->GetCurrentSlotID()); | |
624 | errorWarning++; | |
625 | //try to recover error | |
626 | if (fRecoverError){ | |
627 | if (errorWarning > fRecoverErrorThr) { | |
628 | if (fVerbose) | |
629 | AliInfo("Trying to recover the error: searching for the next header"); | |
630 | fDecoderSummaryData->SetRecoveringError(kTRUE); | |
631 | continue; | |
632 | } | |
633 | else { | |
634 | if (fVerbose) | |
635 | AliInfo("Do not try to recover error yet, go on with decoding process"); | |
636 | continue; | |
637 | } | |
638 | } | |
639 | return(fDecoderSummaryData->GetErrorDetected()); | |
640 | } | |
641 | //decode status ok | |
642 | errorWarning = 0; | |
643 | //set LTM global trailer | |
644 | fLTMGlobalTrailer = (AliTOFLTMGlobalTrailer *)rawData; | |
645 | //remove global trailer from LTM CRC | |
46b17363 | 646 | ltmCRC ^= *rawData; |
5b4ed716 | 647 | //fill LTM summary data |
648 | FillLTMSummaryData(fLTMGlobalTrailer); | |
46b17363 | 649 | fLTMSummaryData->SetDecoderCRC(COMPUTE_LTM_CRC(ltmCRC)); |
5b4ed716 | 650 | //print verbose |
651 | if (fVerbose) | |
652 | AliInfo(Form(" %02x - 0x%08x \t LTM global trailer",decoderStatus,*rawData)); | |
653 | //change decode status | |
654 | decoderStatus = decoderStatus & ~LTM_BIT; | |
655 | fDecoderSummaryData->SetDecoderStatus(decoderStatus); | |
656 | break; | |
657 | ||
658 | //TRM global trailer (slotID=15) | |
659 | case 15: | |
660 | //try to recover error | |
661 | if (fDecoderSummaryData->GetRecoveringError()) | |
662 | continue; | |
663 | //check decode status | |
664 | if ( decoderStatus != TRM_TRAILER_STATUS ){ | |
665 | if (fLogErrors) | |
666 | AliError(Form(" %02x - 0x%08x [ERROR] Unexpected TRM global trailer (curslot=%d)",decoderStatus,*rawData,fDecoderSummaryData->GetCurrentSlotID())); | |
667 | fDecoderSummaryData->SetErrorDetected(kTRUE); | |
668 | fDecoderSummaryData->SetErrorSlotID(fDecoderSummaryData->GetCurrentSlotID()); | |
669 | errorWarning++; | |
670 | //try to recover error | |
671 | if (fRecoverError){ | |
672 | if (errorWarning > fRecoverErrorThr) { | |
673 | if (fVerbose) | |
674 | AliInfo("Trying to recover the error: searching for the next header"); | |
675 | fDecoderSummaryData->SetRecoveringError(kTRUE); | |
676 | continue; | |
677 | } | |
678 | else { | |
679 | if (fVerbose) | |
680 | AliInfo("Do not try to recover error yet, go on with decoding process"); | |
681 | continue; | |
682 | } | |
683 | } | |
684 | return(fDecoderSummaryData->GetErrorDetected()); | |
685 | } | |
686 | //decode status ok | |
687 | errorWarning = 0; | |
688 | //set TRM global trailer | |
689 | fTRMGlobalTrailer = (AliTOFTRMGlobalTrailer *)rawData; | |
690 | //remove global trailer from TRM CRC | |
46b17363 | 691 | trmCRC ^= *rawData; |
5b4ed716 | 692 | //fill TRM summary data |
693 | FillTRMSummaryData(fTRMGlobalTrailer); | |
46b17363 | 694 | fTRMSummaryData->SetDecoderCRC(COMPUTE_TRM_CRC(trmCRC)); |
5b4ed716 | 695 | //print verbose |
696 | if (fVerbose) | |
697 | AliInfo(Form(" %02x - 0x%08x \t TRM global trailer \t CRC=%04d eventCounter=%04d",decoderStatus,*rawData,fTRMGlobalTrailer->GetEventCRC(),fTRMGlobalTrailer->GetEventCounter())); | |
698 | //change decode status | |
699 | decoderStatus = decoderStatus & ~TRM_BIT; | |
700 | fDecoderSummaryData->SetDecoderStatus(decoderStatus); | |
701 | break; | |
702 | ||
703 | default: | |
704 | //try to recover error | |
705 | if (fDecoderSummaryData->GetRecoveringError()) | |
706 | continue; | |
707 | if (fLogErrors) | |
708 | AliError(Form(" %02x - 0x%08x [ERROR] Not valid slotID/pattern in global trailer (curslot=%d)",decoderStatus,*rawData,fDecoderSummaryData->GetCurrentSlotID())); | |
709 | fDecoderSummaryData->SetErrorDetected(kTRUE); | |
710 | fDecoderSummaryData->SetErrorSlotID(fDecoderSummaryData->GetCurrentSlotID()); | |
711 | errorWarning++; | |
712 | //try to recover error | |
713 | if (fRecoverError){ | |
714 | if (fVerbose) | |
715 | AliInfo("Trying to recover the error: searching for the next header"); | |
716 | fDecoderSummaryData->SetRecoveringError(kTRUE); | |
717 | continue; | |
718 | } | |
719 | return(fDecoderSummaryData->GetErrorDetected()); | |
720 | break; | |
721 | } | |
722 | break; | |
723 | ||
724 | case CHAIN_A_HEADER: | |
725 | ||
726 | //try to recover error | |
727 | if (fDecoderSummaryData->GetRecoveringError()) | |
728 | continue; | |
729 | //check decode status | |
730 | if ( decoderStatus != CHAIN_A_HEADER_STATUS && !fDecoderSummaryData->GetRecoveringError() ){ | |
731 | if (fLogErrors) | |
732 | AliError(Form(" %02x - 0x%08x [ERROR] Unexpected TRM chain A header (curslot=%d)",decoderStatus,*rawData,fDecoderSummaryData->GetCurrentSlotID())); | |
733 | fDecoderSummaryData->SetErrorDetected(kTRUE); | |
734 | fDecoderSummaryData->SetErrorSlotID(fDecoderSummaryData->GetCurrentSlotID()); | |
735 | errorWarning++; | |
736 | //try to recover error | |
737 | if (fRecoverError){ | |
738 | if (errorWarning > fRecoverErrorThr) { | |
739 | if (fVerbose) | |
740 | AliInfo("Trying to recover the error: searching for the next header"); | |
741 | fDecoderSummaryData->SetRecoveringError(kTRUE); | |
742 | continue; | |
743 | } | |
744 | else { | |
745 | if (fVerbose) | |
746 | AliInfo("Do not try to recover error yet, go on with decoding process"); | |
747 | continue; | |
748 | } | |
749 | } | |
750 | return(fDecoderSummaryData->GetErrorDetected()); | |
751 | } | |
752 | //decode status ok | |
753 | errorWarning = 0; | |
754 | //set TRM chain header | |
755 | fTRMChainHeader = (AliTOFTRMChainHeader *)rawData; | |
756 | //fill decoder summary data | |
757 | fDecoderSummaryData->SetCurrentChain(0); | |
758 | //get chain summary data | |
759 | fChainSummaryData = fTRMSummaryData->GetChainSummaryData(0); | |
760 | //reset chain summary data | |
761 | fChainSummaryData->Reset(); | |
762 | //fill chain summary data | |
763 | FillChainSummaryData(fTRMChainHeader); | |
764 | //get tdc hit buffer | |
765 | fTDCHitBuffer = fChainSummaryData->GetTDCHitBuffer(); | |
766 | //reset tdc hit buffer | |
767 | fTDCHitBuffer->Reset(); | |
768 | //get tdc packed hit buffer | |
769 | fTDCPackedHitBuffer = fChainSummaryData->GetTDCPackedHitBuffer(); | |
770 | //reset tdc packed hit buffer | |
771 | fTDCPackedHitBuffer->Reset(); | |
772 | //get tdc error buffer | |
773 | fTDCErrorBuffer = fChainSummaryData->GetTDCErrorBuffer(); | |
774 | //reset tdc error buffer | |
775 | fTDCErrorBuffer->Reset(); | |
776 | //print verbose | |
777 | if (fVerbose) | |
778 | AliInfo(Form(" %02x - 0x%08x \t TRM chain A header \t chain=%01d bunchID=%04d",decoderStatus,*rawData,0,fTRMChainHeader->GetBunchID())); | |
779 | //change decode status | |
780 | decoderStatus = decoderStatus | CHAIN_A_BIT; | |
781 | fDecoderSummaryData->SetDecoderStatus(decoderStatus); | |
782 | //reset spider | |
783 | if (fSpider) | |
784 | ResetSpider(); | |
785 | break; | |
786 | ||
787 | case CHAIN_A_TRAILER: | |
788 | ||
789 | //try to recover error | |
790 | if (fDecoderSummaryData->GetRecoveringError()) | |
791 | continue; | |
792 | //check decode status | |
793 | if ( decoderStatus != CHAIN_A_TRAILER_STATUS && !fDecoderSummaryData->GetRecoveringError()){ | |
794 | if (fLogErrors) | |
795 | AliError(Form(" %02x - 0x%08x [ERROR] Unexpected TRM chain A trailer (curslot=%d)",decoderStatus,*rawData,fDecoderSummaryData->GetCurrentSlotID())); | |
796 | fDecoderSummaryData->SetErrorDetected(kTRUE); | |
797 | fDecoderSummaryData->SetErrorSlotID(fDecoderSummaryData->GetCurrentSlotID()); | |
798 | errorWarning++; | |
799 | //try to recover error | |
800 | if (fRecoverError){ | |
801 | if (errorWarning > fRecoverErrorThr) { | |
802 | if (fVerbose) | |
803 | AliInfo("Trying to recover the error: searching for the next header"); | |
804 | fDecoderSummaryData->SetRecoveringError(kTRUE); | |
805 | continue; | |
806 | } | |
807 | else { | |
808 | if (fVerbose) | |
809 | AliInfo("Do not try to recover error yet, go on with decoding process"); | |
810 | continue; | |
811 | } | |
812 | } | |
813 | return(fDecoderSummaryData->GetErrorDetected()); | |
814 | } | |
815 | //decode status ok | |
816 | errorWarning = 0; | |
817 | //set TRM chain trailer | |
818 | fTRMChainTrailer = (AliTOFTRMChainTrailer *)rawData; | |
819 | //fill chain summary data | |
820 | FillChainSummaryData(fTRMChainTrailer); | |
821 | //print verbose | |
822 | if (fVerbose) | |
823 | AliInfo(Form(" %02x - 0x%08x \t TRM chain A trailer",decoderStatus,*rawData)); | |
824 | //change decode status | |
825 | decoderStatus = decoderStatus & ~CHAIN_A_BIT; | |
826 | fDecoderSummaryData->SetDecoderStatus(decoderStatus); | |
827 | break; | |
828 | ||
829 | case CHAIN_B_HEADER: | |
830 | ||
831 | //try to recover error | |
832 | if (fDecoderSummaryData->GetRecoveringError()) | |
833 | continue; | |
834 | //check decode status | |
835 | if ( decoderStatus != CHAIN_B_HEADER_STATUS && !fDecoderSummaryData->GetRecoveringError()){ | |
836 | if (fLogErrors) | |
837 | AliError(Form(" %02x - 0x%08x [ERROR] Unexpected TRM chain B header (curslot=%d)",decoderStatus,*rawData,fDecoderSummaryData->GetCurrentSlotID())); | |
838 | fDecoderSummaryData->SetErrorDetected(kTRUE); | |
839 | fDecoderSummaryData->SetErrorSlotID(fDecoderSummaryData->GetCurrentSlotID()); | |
840 | errorWarning++; | |
841 | //try to recover error | |
842 | if (fRecoverError){ | |
843 | if (errorWarning > fRecoverErrorThr) { | |
844 | if (fVerbose) | |
845 | AliInfo("Trying to recover the error: searching for the next header"); | |
846 | fDecoderSummaryData->SetRecoveringError(kTRUE); | |
847 | continue; | |
848 | } | |
849 | else { | |
850 | if (fVerbose) | |
851 | AliInfo("Do not try to recover error yet, go on with decoding process"); | |
852 | continue; | |
853 | } | |
854 | } | |
855 | return(fDecoderSummaryData->GetErrorDetected()); | |
856 | } | |
857 | //decode status ok | |
858 | errorWarning = 0; | |
859 | //set TRM chain header | |
860 | fTRMChainHeader = (AliTOFTRMChainHeader *)rawData; | |
861 | //fill decoder summary data | |
862 | fDecoderSummaryData->SetCurrentChain(1); | |
863 | //get chain summary data | |
864 | fChainSummaryData = fTRMSummaryData->GetChainSummaryData(1); | |
865 | //reset chain summary data | |
866 | fChainSummaryData->Reset(); | |
867 | //fill chain summary data | |
868 | FillChainSummaryData(fTRMChainHeader); | |
869 | //get tdc hit buffer | |
870 | fTDCHitBuffer = fChainSummaryData->GetTDCHitBuffer(); | |
871 | //reset tdc hit buffer | |
872 | fTDCHitBuffer->Reset(); | |
873 | //get tdc packed hit buffer | |
874 | fTDCPackedHitBuffer = fChainSummaryData->GetTDCPackedHitBuffer(); | |
875 | //reset tdc packed hit buffer | |
876 | fTDCPackedHitBuffer->Reset(); | |
877 | //get tdc error buffer | |
878 | fTDCErrorBuffer = fChainSummaryData->GetTDCErrorBuffer(); | |
879 | //reset tdc error buffer | |
880 | fTDCErrorBuffer->Reset(); | |
881 | //print verbose | |
882 | if (fVerbose) | |
883 | AliInfo(Form(" %02x - 0x%08x \t TRM chain B header \t chain=%01d bunchID=%04d",decoderStatus,*rawData,1,fTRMChainHeader->GetBunchID())); | |
884 | //change decode status | |
885 | decoderStatus = decoderStatus | CHAIN_B_BIT; | |
886 | fDecoderSummaryData->SetDecoderStatus(decoderStatus); | |
887 | //reset spider | |
888 | if (fSpider) | |
889 | ResetSpider(); | |
890 | break; | |
891 | ||
892 | case CHAIN_B_TRAILER: | |
893 | ||
894 | //try to recover error | |
895 | if (fDecoderSummaryData->GetRecoveringError()) | |
896 | continue; | |
897 | //check decode status | |
898 | if ( decoderStatus != CHAIN_B_TRAILER_STATUS && !fDecoderSummaryData->GetRecoveringError()){ | |
899 | if (fLogErrors) | |
900 | AliError(Form(" %02x - 0x%08x [ERROR] Unexpected TRM chain B trailer (curslot=%d)",decoderStatus,*rawData,fDecoderSummaryData->GetCurrentSlotID())); | |
901 | fDecoderSummaryData->SetErrorDetected(kTRUE); | |
902 | fDecoderSummaryData->SetErrorSlotID(fDecoderSummaryData->GetCurrentSlotID()); | |
903 | errorWarning++; | |
904 | //try to recover error | |
905 | if (fRecoverError){ | |
906 | if (errorWarning > fRecoverErrorThr) { | |
907 | if (fVerbose) | |
908 | AliInfo("Trying to recover the error: searching for the next header"); | |
909 | fDecoderSummaryData->SetRecoveringError(kTRUE); | |
910 | continue; | |
911 | } | |
912 | else { | |
913 | if (fVerbose) | |
914 | AliInfo("Do not try to recover error yet, go on with decoding process"); | |
915 | continue; | |
916 | } | |
917 | } | |
918 | return(fDecoderSummaryData->GetErrorDetected()); | |
919 | } | |
920 | //decode status ok | |
921 | errorWarning = 0; | |
922 | //set TRM chain trailer | |
923 | fTRMChainTrailer = (AliTOFTRMChainTrailer *)rawData; | |
924 | //fill chain summary data | |
925 | FillChainSummaryData(fTRMChainTrailer); | |
926 | //print verbose | |
927 | if (fVerbose) | |
928 | AliInfo(Form(" %02x - 0x%08x \t TRM chain B trailer",decoderStatus,*rawData)); | |
929 | //change decode status | |
930 | decoderStatus = decoderStatus & ~CHAIN_B_BIT; | |
931 | fDecoderSummaryData->SetDecoderStatus(decoderStatus); | |
932 | break; | |
933 | ||
934 | case ERROR: | |
935 | ||
936 | //try to recover error | |
937 | if (fDecoderSummaryData->GetRecoveringError()) | |
938 | continue; | |
939 | //decode TRM TDC error | |
940 | fTRMTDCError = (AliTOFTRMTDCError *)rawData; | |
941 | //check diagnostic word | |
942 | if (fTRMTDCError->GetTDCID() == 15) { | |
943 | if (fVerbose) | |
944 | AliInfo(Form(" %02x - 0x%08x \t Diagnostic error word",decoderStatus,*rawData)); | |
945 | break; | |
946 | } | |
947 | //set error data | |
948 | error.SetErrorFlags(fTRMTDCError->GetErrorFlags()); | |
949 | error.SetTDCID(fTRMTDCError->GetTDCID()); | |
950 | //fill TDC error buffer | |
951 | fTDCErrorBuffer->Add(error); | |
952 | if (fVerbose) | |
953 | AliInfo(Form(" %02x - 0x%08x \t TDC error",decoderStatus,*rawData)); | |
954 | break; | |
955 | ||
956 | case FILLER: | |
957 | ||
958 | //try to recover error | |
959 | if (fDecoderSummaryData->GetRecoveringError()) | |
960 | continue; | |
961 | if (fVerbose) | |
962 | AliInfo(Form(" %02x - 0x%08x \t Filler",decoderStatus,*rawData)); | |
963 | break; | |
964 | ||
965 | default: | |
966 | ||
967 | //try to recover error | |
968 | if (fDecoderSummaryData->GetRecoveringError()) | |
969 | continue; | |
970 | //check decode status | |
971 | if ( decoderStatus != CHAIN_A_TDC_HIT_STATUS && | |
972 | decoderStatus != CHAIN_B_TDC_HIT_STATUS && !fDecoderSummaryData->GetRecoveringError()){ | |
973 | if (fLogErrors) | |
974 | AliError(Form(" %02x - 0x%08x [ERROR] Unexpected or unknown word (curslot=%d)",decoderStatus,*rawData,fDecoderSummaryData->GetCurrentSlotID())); | |
975 | fDecoderSummaryData->SetErrorDetected(kTRUE); | |
976 | fDecoderSummaryData->SetErrorSlotID(fDecoderSummaryData->GetCurrentSlotID()); | |
977 | errorWarning++; | |
978 | //try to recover error | |
979 | if (fRecoverError){ | |
980 | if (errorWarning > fRecoverErrorThr) { | |
981 | if (fVerbose) | |
982 | AliInfo("Trying to recover the error: searching for the next header"); | |
983 | fDecoderSummaryData->SetRecoveringError(kTRUE); | |
984 | continue; | |
985 | } | |
986 | else { | |
987 | if (fVerbose) | |
988 | AliInfo("Do not try to recover error yet, go on with decoding process"); | |
989 | continue; | |
990 | } | |
991 | } | |
992 | return(fDecoderSummaryData->GetErrorDetected()); | |
993 | } | |
994 | //decode status ok | |
995 | errorWarning = 0; | |
996 | ||
997 | //switch TRM ACQ | |
998 | switch (fTRMSummaryData->GetACQBits()){ | |
999 | ||
1000 | case PACKING_ENABLED_ACQ: | |
1001 | //decode TDC packed/unpacked hit | |
1002 | fTDCPackedHit = (AliTOFTDCPackedHit *)rawData; | |
1003 | fTDCUnpackedHit = (AliTOFTDCUnpackedHit *)rawData; | |
1004 | //set hit data | |
1005 | hit.SetChan(fTDCUnpackedHit->GetChan()); | |
1006 | hit.SetTDCID(fTDCUnpackedHit->GetTDCID()); | |
1007 | hit.SetEBit(fTDCUnpackedHit->GetEBit()); | |
1008 | hit.SetPSBits(fTDCUnpackedHit->GetPSBits()); | |
1009 | //switch PS bits | |
1010 | switch (hit.GetPSBits()){ | |
1011 | //packed hit or overflow hit | |
1012 | case PACKED_HIT_PS: case TOT_OVF_HIT_PS: | |
1013 | hit.SetHitTime(fTDCPackedHit->GetHitTime()); | |
1014 | hit.SetTOTWidth(fTDCPackedHit->GetTOTWidth()); | |
1015 | //add hit | |
1016 | fTDCHitBuffer->Add(hit); | |
1017 | fTDCPackedHitBuffer->Add(hit); | |
1018 | break; | |
1019 | //orphane leading | |
1020 | case LEADING_HIT_PS: | |
1021 | hit.SetHitTime(fTDCUnpackedHit->GetHitTime()); | |
1022 | hit.SetTOTWidth(0); | |
1023 | //add hit | |
1024 | fTDCHitBuffer->Add(hit); | |
1025 | fTDCPackedHitBuffer->Add(hit); | |
1026 | break; | |
1027 | //orphane trailing | |
1028 | case TRAILING_HIT_PS: | |
1029 | hit.SetHitTime(fTDCUnpackedHit->GetHitTime()); | |
1030 | hit.SetTOTWidth(0); | |
1031 | //add hit | |
1032 | fTDCHitBuffer->Add(hit); | |
1033 | break; | |
1034 | } | |
1035 | //end switch PS bits | |
1036 | //print verbose | |
1037 | if (fVerbose) | |
1038 | switch (hit.GetPSBits()){ | |
1039 | case PACKED_HIT_PS: | |
1040 | AliInfo(Form(" %02x - 0x%08x \t TDC hit [packed] \t PS=%1d TDC=%1d chan=%1d TOT=%3d time=%4d (%7.1f ns)",decoderStatus,*rawData,hit.GetPSBits(),hit.GetTDCID(),hit.GetChan(),hit.GetTOTWidth(),hit.GetHitTime(),hit.GetHitTime()*TIME_BIN_WIDTH)); | |
1041 | break; | |
1042 | case LEADING_HIT_PS: | |
1043 | AliInfo(Form(" %02x - 0x%08x \t TDC hit [orp.lead] \t PS=%1d TDC=%1d chan=%1d time=%4d (%7.1f ns)",decoderStatus,*rawData,hit.GetPSBits(),hit.GetTDCID(),hit.GetChan(),hit.GetHitTime(),hit.GetHitTime()*TIME_BIN_WIDTH)); | |
1044 | break; | |
1045 | case TRAILING_HIT_PS: | |
1046 | AliInfo(Form(" %02x - 0x%08x \t TDC hit [orp.trai] \t PS=%1d TDC=%1d chan=%1d time=%4d (%7.1f ns)",decoderStatus,*rawData,hit.GetPSBits(),hit.GetTDCID(),hit.GetChan(),hit.GetHitTime(),hit.GetHitTime()*TIME_BIN_WIDTH)); | |
1047 | break; | |
1048 | case TOT_OVF_HIT_PS: | |
1049 | AliInfo(Form(" %02x - 0x%08x \t TDC hit [TOT ovfl] \t PS=%1d TDC=%1d chan=%1d TOT=%3d time=%4d (%7.1f ns)",decoderStatus,*rawData,hit.GetPSBits(),hit.GetTDCID(),hit.GetChan(),hit.GetTOTWidth(),hit.GetHitTime(),hit.GetHitTime()*TIME_BIN_WIDTH)); | |
1050 | break; | |
1051 | } | |
1052 | break; | |
1053 | ||
1054 | case LEADING_ONLY_ACQ: case TRAILING_ONLY_ACQ: | |
1055 | //decode TDC unpacked hit | |
1056 | fTDCUnpackedHit = (AliTOFTDCUnpackedHit *)rawData; | |
1057 | //set hit data | |
1058 | hit.SetChan(fTDCUnpackedHit->GetChan()); | |
1059 | hit.SetTDCID(fTDCUnpackedHit->GetTDCID()); | |
1060 | hit.SetEBit(fTDCUnpackedHit->GetEBit()); | |
1061 | hit.SetPSBits(fTDCUnpackedHit->GetPSBits()); | |
1062 | hit.SetHitTime(fTDCUnpackedHit->GetHitTime()); | |
1063 | hit.SetTOTWidth(0); | |
1064 | //add hit | |
1065 | fTDCHitBuffer->Add(hit); | |
1066 | //print verbose | |
1067 | if (fVerbose) | |
1068 | switch (hit.GetPSBits()){ | |
1069 | case LEADING_HIT_PS: | |
1070 | AliInfo(Form(" %02x - 0x%08x \t TDC hit [leading] \t PS=%1d TDC=%1d chan=%1d time=%4d (%7.1f ns)",decoderStatus,*rawData,hit.GetPSBits(),hit.GetTDCID(),hit.GetChan(),hit.GetHitTime(),hit.GetHitTime()*TIME_BIN_WIDTH)); | |
1071 | break; | |
1072 | case TRAILING_HIT_PS: | |
1073 | AliInfo(Form(" %02x - 0x%08x \t TDC hit [trailing] \t PS=%1d TDC=%1d chan=%1d time=%4d (%7.1f ns)",decoderStatus,*rawData,hit.GetPSBits(),hit.GetTDCID(),hit.GetChan(),hit.GetHitTime(),hit.GetHitTime()*TIME_BIN_WIDTH)); | |
1074 | } | |
1075 | break; | |
1076 | ||
1077 | case PACKING_DISABLED_ACQ: | |
1078 | //decode TDC unpacked hit | |
1079 | fTDCUnpackedHit = (AliTOFTDCUnpackedHit *)rawData; | |
1080 | //set hit data | |
1081 | hit.SetChan(fTDCUnpackedHit->GetChan()); | |
1082 | hit.SetTDCID(fTDCUnpackedHit->GetTDCID()); | |
1083 | hit.SetEBit(fTDCUnpackedHit->GetEBit()); | |
1084 | hit.SetPSBits(fTDCUnpackedHit->GetPSBits()); | |
1085 | hit.SetHitTime(fTDCUnpackedHit->GetHitTime()); | |
1086 | hit.SetTOTWidth(0); | |
1087 | //add hit | |
1088 | fTDCHitBuffer->Add(hit); | |
1089 | //print verbose | |
1090 | if (fVerbose) | |
1091 | switch (hit.GetPSBits()){ | |
1092 | case LEADING_HIT_PS: | |
1093 | AliInfo(Form(" %02x - 0x%08x \t TDC hit [leading] \t PS=%1d TDC=%1d chan=%1d time=%4d (%7.1f ns)",decoderStatus,*rawData,hit.GetPSBits(),hit.GetTDCID(),hit.GetChan(),hit.GetHitTime(),hit.GetHitTime()*TIME_BIN_WIDTH)); | |
1094 | break; | |
1095 | case TRAILING_HIT_PS: | |
1096 | AliInfo(Form(" %02x - 0x%08x \t TDC hit [trailing] \t PS=%1d TDC=%1d chan=%1d time=%4d (%7.1f ns)",decoderStatus,*rawData,hit.GetPSBits(),hit.GetTDCID(),hit.GetChan(),hit.GetHitTime(),hit.GetHitTime()*TIME_BIN_WIDTH)); | |
1097 | } //print verbose | |
1098 | //spider | |
1099 | if (fSpider) | |
1100 | Spider(hit); | |
1101 | ||
1102 | break; | |
1103 | } | |
1104 | //end switch TRM ACQ | |
1105 | ||
1106 | break; | |
1107 | ||
1108 | } | |
1109 | ||
1110 | } | |
1111 | //end equipment data loop | |
1112 | ||
1113 | if (fVerbose) | |
1114 | AliInfo("End of data loop"); | |
1115 | ||
1116 | //reset spider | |
1117 | if (fSpider) | |
1118 | ResetSpider(); | |
1119 | ||
1120 | /*** V2718 patch ***/ | |
1121 | if (fV2718Patch){ | |
1122 | decoderStatus = decoderStatus & ~DRM_BIT; | |
1123 | fDecoderSummaryData->SetDecoderStatus(decoderStatus); | |
1124 | fDRMSummaryData->SetTrailer(kTRUE); | |
1125 | fDRMSummaryData->SetSlotEnableMask(fDRMSummaryData->GetDecoderSlotEnableMask()); | |
1126 | fDRMSummaryData->SetCBit(1); | |
1127 | fDRMSummaryData->SetLocalEventCounter(fTRMSummaryData->GetEventCounter()); | |
1128 | if (fVerbose) | |
1129 | AliInfo("DRM was not present: - V2718 end patch decoding -"); | |
1130 | } | |
1131 | /*** V2718 patch ***/ | |
1132 | ||
1133 | if (fVerbose) | |
1134 | AliInfo("Decoder is exiting succesfully."); | |
1135 | ||
1136 | return(fDecoderSummaryData->GetErrorDetected()); | |
1137 | } | |
1138 | ||
1139 | //_________________________________________________________________ | |
1140 | ||
1141 | void | |
46b17363 | 1142 | AliTOFDecoderV2::FillDRMSummaryData(const AliTOFDRMGlobalHeader *DRMGlobalHeader) |
5b4ed716 | 1143 | { |
46b17363 | 1144 | /* |
1145 | * | |
1146 | * FillDRMSummaryData | |
1147 | * | |
1148 | */ | |
1149 | ||
5b4ed716 | 1150 | fDRMSummaryData->SetHeader(kTRUE); |
1151 | fDRMSummaryData->SetSlotID(DRMGlobalHeader->GetSlotID()); | |
1152 | fDRMSummaryData->SetEventWords(DRMGlobalHeader->GetEventWords()); | |
1153 | fDRMSummaryData->SetDRMID(DRMGlobalHeader->GetDRMID()); | |
1154 | } | |
1155 | ||
1156 | //_________________________________________________________________ | |
1157 | ||
1158 | void | |
46b17363 | 1159 | AliTOFDecoderV2::FillDRMSummaryData(const AliTOFDRMGlobalTrailer *DRMGlobalTrailer) |
5b4ed716 | 1160 | { |
46b17363 | 1161 | /* |
1162 | * | |
1163 | * FillDRMSummaryData | |
1164 | * | |
1165 | */ | |
1166 | ||
5b4ed716 | 1167 | fDRMSummaryData->SetTrailer(kTRUE); |
1168 | fDRMSummaryData->SetLocalEventCounter(DRMGlobalTrailer->GetLocalEventCounter()); | |
1169 | } | |
1170 | ||
1171 | //_________________________________________________________________ | |
1172 | ||
1173 | void | |
46b17363 | 1174 | AliTOFDecoderV2::FillDRMSummaryData(const AliTOFDRMStatusHeader1 *DRMStatusHeader1) |
5b4ed716 | 1175 | { |
46b17363 | 1176 | /* |
1177 | * | |
1178 | * FillDRMSummaryData | |
1179 | * | |
1180 | */ | |
1181 | ||
5b4ed716 | 1182 | fDRMSummaryData->SetPartecipatingSlotID(DRMStatusHeader1->GetPartecipatingSlotID()); |
1183 | fDRMSummaryData->SetCBit(DRMStatusHeader1->GetCBit()); | |
1184 | fDRMSummaryData->SetVersID(DRMStatusHeader1->GetVersID()); | |
1185 | fDRMSummaryData->SetDRMhSize(DRMStatusHeader1->GetDRMhSize()); | |
1186 | } | |
1187 | ||
1188 | //_________________________________________________________________ | |
1189 | ||
1190 | void | |
46b17363 | 1191 | AliTOFDecoderV2::FillDRMSummaryData(const AliTOFDRMStatusHeader2 *DRMStatusHeader2) |
5b4ed716 | 1192 | { |
46b17363 | 1193 | /* |
1194 | * | |
1195 | * FillDRMSummaryData | |
1196 | * | |
1197 | */ | |
1198 | ||
5b4ed716 | 1199 | fDRMSummaryData->SetSlotEnableMask(DRMStatusHeader2->GetSlotEnableMask()); |
1200 | fDRMSummaryData->SetFaultID(DRMStatusHeader2->GetFaultID()); | |
1201 | fDRMSummaryData->SetRTOBit(DRMStatusHeader2->GetRTOBit()); | |
1202 | } | |
1203 | ||
1204 | //_________________________________________________________________ | |
1205 | ||
1206 | void | |
46b17363 | 1207 | AliTOFDecoderV2::FillDRMSummaryData(const AliTOFDRMStatusHeader3 *DRMStatusHeader3) |
5b4ed716 | 1208 | { |
46b17363 | 1209 | /* |
1210 | * | |
1211 | * FillDRMSummaryData | |
1212 | * | |
1213 | */ | |
1214 | ||
5b4ed716 | 1215 | fDRMSummaryData->SetL0BCID(DRMStatusHeader3->GetL0BCID()); |
1216 | fDRMSummaryData->SetRunTimeInfo(DRMStatusHeader3->GetRunTimeInfo()); | |
1217 | } | |
1218 | ||
1219 | //_________________________________________________________________ | |
1220 | ||
1221 | void | |
46b17363 | 1222 | AliTOFDecoderV2::FillDRMSummaryData(const AliTOFDRMStatusHeader4 *DRMStatusHeader4) |
5b4ed716 | 1223 | { |
46b17363 | 1224 | /* |
1225 | * | |
1226 | * FillDRMSummaryData | |
1227 | * | |
1228 | */ | |
1229 | ||
5b4ed716 | 1230 | fDRMSummaryData->SetTemperature(DRMStatusHeader4->GetTemperature()); |
1231 | fDRMSummaryData->SetACKBit(DRMStatusHeader4->GetACKBit()); | |
1232 | fDRMSummaryData->SetSensAD(DRMStatusHeader4->GetSensAD()); | |
1233 | } | |
1234 | ||
1235 | //_________________________________________________________________ | |
1236 | ||
1237 | void | |
46b17363 | 1238 | AliTOFDecoderV2::FillDRMSummaryData(const AliTOFDRMEventCRC *DRMEventCRC) |
5b4ed716 | 1239 | { |
46b17363 | 1240 | /* |
1241 | * | |
1242 | * FillDRMSummaryData | |
1243 | * | |
1244 | */ | |
1245 | ||
5b4ed716 | 1246 | fDRMSummaryData->SetEventCRC(DRMEventCRC->GetEventCRC()); |
1247 | } | |
1248 | ||
1249 | //_________________________________________________________________ | |
1250 | ||
1251 | void | |
46b17363 | 1252 | AliTOFDecoderV2::FillLTMSummaryData(const AliTOFLTMGlobalHeader *LTMGlobalHeader) |
5b4ed716 | 1253 | { |
46b17363 | 1254 | /* |
1255 | * | |
1256 | * FillLTMSummaryData | |
1257 | * | |
1258 | */ | |
1259 | ||
5b4ed716 | 1260 | fLTMSummaryData->SetHeader(kTRUE); |
1261 | fLTMSummaryData->SetSlotID(LTMGlobalHeader->GetSlotID()); | |
1262 | fLTMSummaryData->SetEventWords(LTMGlobalHeader->GetEventWords()); | |
1263 | fLTMSummaryData->SetCBit(LTMGlobalHeader->GetCBit()); | |
1264 | fLTMSummaryData->SetFault(LTMGlobalHeader->GetFault()); | |
1265 | } | |
1266 | ||
1267 | //_________________________________________________________________ | |
1268 | ||
1269 | void | |
46b17363 | 1270 | AliTOFDecoderV2::FillLTMSummaryData(const AliTOFLTMGlobalTrailer *LTMGlobalTrailer) |
5b4ed716 | 1271 | { |
46b17363 | 1272 | /* |
1273 | * | |
1274 | * FillLTMSummaryData | |
1275 | * | |
1276 | */ | |
1277 | ||
5b4ed716 | 1278 | fLTMSummaryData->SetTrailer(kTRUE); |
1279 | fLTMSummaryData->SetEventCRC(LTMGlobalTrailer->GetEventCRC()); | |
1280 | fLTMSummaryData->SetEventNumber(LTMGlobalTrailer->GetEventNumber()); | |
1281 | } | |
1282 | ||
1283 | //_________________________________________________________________ | |
1284 | ||
1285 | void | |
46b17363 | 1286 | AliTOFDecoderV2::FillLTMSummaryData(const AliTOFLTMPDLData *LTMPDLData, Int_t PDLWord) |
5b4ed716 | 1287 | { |
46b17363 | 1288 | /* |
1289 | * | |
1290 | * FillLTMSummaryData | |
1291 | * | |
1292 | */ | |
1293 | ||
5b4ed716 | 1294 | fLTMSummaryData->SetPDL(4 * PDLWord + 0, LTMPDLData->GetPDLValue1()); |
1295 | fLTMSummaryData->SetPDL(4 * PDLWord + 1, LTMPDLData->GetPDLValue2()); | |
1296 | fLTMSummaryData->SetPDL(4 * PDLWord + 2, LTMPDLData->GetPDLValue3()); | |
1297 | fLTMSummaryData->SetPDL(4 * PDLWord + 3, LTMPDLData->GetPDLValue4()); | |
1298 | } | |
1299 | ||
1300 | //_________________________________________________________________ | |
1301 | ||
1302 | void | |
46b17363 | 1303 | AliTOFDecoderV2::FillLTMSummaryData(const AliTOFLTMADCData *LTMADCData, Int_t ADCWord) |
5b4ed716 | 1304 | { |
46b17363 | 1305 | /* |
1306 | * | |
1307 | * FillLTMSummaryData | |
1308 | * | |
1309 | */ | |
1310 | ||
5b4ed716 | 1311 | fLTMSummaryData->SetADC(3 * ADCWord + 0, LTMADCData->GetADCValue1()); |
1312 | fLTMSummaryData->SetADC(3 * ADCWord + 1, LTMADCData->GetADCValue2()); | |
1313 | fLTMSummaryData->SetADC(3 * ADCWord + 2, LTMADCData->GetADCValue3()); | |
1314 | } | |
1315 | ||
1316 | //_________________________________________________________________ | |
1317 | ||
1318 | void | |
46b17363 | 1319 | AliTOFDecoderV2::FillLTMSummaryData(const AliTOFLTMORData *LTMORData, Int_t ORWord) |
5b4ed716 | 1320 | { |
46b17363 | 1321 | /* |
1322 | * | |
1323 | * FillLTMSummaryData | |
1324 | * | |
1325 | */ | |
1326 | ||
5b4ed716 | 1327 | fLTMSummaryData->SetOR(3 * ORWord + 0, LTMORData->GetORValue1()); |
1328 | fLTMSummaryData->SetOR(3 * ORWord + 1, LTMORData->GetORValue2()); | |
1329 | fLTMSummaryData->SetOR(3 * ORWord + 2, LTMORData->GetORValue3()); | |
1330 | } | |
1331 | ||
1332 | //_________________________________________________________________ | |
1333 | ||
1334 | void | |
46b17363 | 1335 | AliTOFDecoderV2::FillTRMSummaryData(const AliTOFTRMGlobalHeader *TRMGlobalHeader) |
5b4ed716 | 1336 | { |
46b17363 | 1337 | /* |
1338 | * | |
1339 | * FillTRMSummaryData | |
1340 | * | |
1341 | */ | |
1342 | ||
5b4ed716 | 1343 | fTRMSummaryData->SetHeader(kTRUE); |
1344 | fTRMSummaryData->SetSlotID(TRMGlobalHeader->GetSlotID()); | |
1345 | fTRMSummaryData->SetEventWords(TRMGlobalHeader->GetEventWords()); | |
1346 | fTRMSummaryData->SetACQBits(TRMGlobalHeader->GetACQBits()); | |
1347 | fTRMSummaryData->SetLBit(TRMGlobalHeader->GetLBit()); | |
1348 | fTRMSummaryData->SetEBit(TRMGlobalHeader->GetEBit()); | |
1349 | } | |
1350 | ||
1351 | //_________________________________________________________________ | |
1352 | ||
1353 | void | |
46b17363 | 1354 | AliTOFDecoderV2::FillTRMSummaryData(const AliTOFTRMGlobalTrailer *TRMGlobalTrailer) |
5b4ed716 | 1355 | { |
46b17363 | 1356 | /* |
1357 | * | |
1358 | * FillTRMSummaryData | |
1359 | * | |
1360 | */ | |
1361 | ||
5b4ed716 | 1362 | fTRMSummaryData->SetTrailer(kTRUE); |
1363 | fTRMSummaryData->SetEventCRC(TRMGlobalTrailer->GetEventCRC()); | |
1364 | fTRMSummaryData->SetEventCounter(TRMGlobalTrailer->GetEventCounter()); | |
1365 | } | |
1366 | ||
1367 | //_________________________________________________________________ | |
1368 | ||
1369 | void | |
46b17363 | 1370 | AliTOFDecoderV2::FillChainSummaryData(const AliTOFTRMChainHeader *TRMChainHeader) |
5b4ed716 | 1371 | { |
46b17363 | 1372 | /* |
1373 | * | |
1374 | * FillChainSummaryData | |
1375 | * | |
1376 | */ | |
1377 | ||
5b4ed716 | 1378 | fChainSummaryData->SetHeader(kTRUE); |
1379 | switch (*(UInt_t *)TRMChainHeader & WORD_TYPE_MASK){ | |
1380 | case CHAIN_A_HEADER: | |
1381 | fChainSummaryData->SetChain(0); | |
1382 | break; | |
1383 | case CHAIN_B_HEADER: | |
1384 | fChainSummaryData->SetChain(1); | |
1385 | break; | |
1386 | } | |
1387 | fChainSummaryData->SetBunchID(TRMChainHeader->GetBunchID()); | |
1388 | fChainSummaryData->SetPB24Temp(TRMChainHeader->GetPB24Temp()); | |
1389 | fChainSummaryData->SetPB24ID(TRMChainHeader->GetPB24ID()); | |
1390 | fChainSummaryData->SetTSBit(TRMChainHeader->GetTSBit()); | |
1391 | } | |
1392 | ||
1393 | //_________________________________________________________________ | |
1394 | ||
1395 | void | |
46b17363 | 1396 | AliTOFDecoderV2::FillChainSummaryData(const AliTOFTRMChainTrailer *TRMChainTrailer) |
5b4ed716 | 1397 | { |
46b17363 | 1398 | /* |
1399 | * | |
1400 | * FillChainSummaryData | |
1401 | * | |
1402 | */ | |
1403 | ||
5b4ed716 | 1404 | fChainSummaryData->SetTrailer(kTRUE); |
1405 | fChainSummaryData->SetStatus(TRMChainTrailer->GetStatus()); | |
1406 | fChainSummaryData->SetEventCounter(TRMChainTrailer->GetEventCounter()); | |
1407 | } | |
1408 | ||
1409 | //_________________________________________________________________ | |
1410 | ||
1411 | void | |
1412 | AliTOFDecoderV2::ResetSpider() | |
1413 | { | |
1414 | //reset condition | |
1415 | if (fVerbose) | |
1416 | AliInfo("Reset signal received, empty and reset buffer"); | |
1417 | for (Int_t iChan = 0; iChan < N_CHANNEL; iChan++){ | |
1418 | if (fSpiderBufferFull[iChan]) { | |
1419 | if (fVerbose) | |
1420 | AliInfo(Form("Spider buffer is full for channel %d", iChan)); | |
1421 | fSpiderTDCPackedHitBuffer->Add(fSpiderBuffer[iChan]); | |
1422 | } | |
1423 | fSpiderBufferFull[iChan] = kFALSE; | |
1424 | } | |
1425 | fSpiderTDCID = -1; | |
1426 | return; | |
1427 | } | |
1428 | ||
1429 | void | |
1430 | AliTOFDecoderV2::Spider(AliTOFTDCHit &hit){ | |
1431 | ||
1432 | if (fVerbose) | |
1433 | AliInfo("Hit has been received from decode main routine"); | |
1434 | ||
1435 | //check new TDC | |
1436 | if (fSpiderTDCID != hit.GetTDCID()){ | |
1437 | if (fVerbose) | |
1438 | AliInfo("Data coming from a new TDC, empty and reset buffer"); | |
1439 | for (Int_t iChan = 0; iChan < N_CHANNEL; iChan++){ | |
1440 | if (fSpiderBufferFull[iChan]) | |
1441 | fSpiderTDCPackedHitBuffer->Add(fSpiderBuffer[iChan]); | |
1442 | fSpiderBufferFull[iChan] = kFALSE; | |
1443 | } | |
1444 | fSpiderTDCPackedHitBuffer = fTDCPackedHitBuffer; | |
1445 | fSpiderTDCID = hit.GetTDCID(); | |
1446 | } | |
1447 | ||
1448 | //switch PS bits | |
1449 | switch(hit.GetPSBits()){ | |
1450 | //leading hit | |
1451 | case LEADING_HIT_PS: | |
1452 | //check buffer status | |
1453 | if (fSpiderBufferFull[hit.GetChan()]){ //buffer full | |
1454 | fSpiderTDCPackedHitBuffer->Add(fSpiderBuffer[hit.GetChan()]); //buffered hit is orphane | |
1455 | fSpiderBuffer[hit.GetChan()] = hit; //current hit into buffer | |
1456 | if (fVerbose) | |
1457 | AliInfo("Leading hit and buffer full, buffered hit is a orphane leading hit"); | |
1458 | } | |
1459 | else{ //buffer empty | |
1460 | fSpiderBuffer[hit.GetChan()] = hit; //current hit into buffer | |
1461 | fSpiderBufferFull[hit.GetChan()] = kTRUE; //set buffer full | |
1462 | } | |
1463 | break; | |
1464 | //trailing hit | |
1465 | case TRAILING_HIT_PS: | |
1466 | //check buffer status | |
1467 | if (fSpiderBufferFull[hit.GetChan()]){ //buffer full | |
1468 | fSpiderTDCPackedHitBuffer->Add(fSpiderBuffer[hit.GetChan()] << hit); //pack hits (Leading << Trailing) and save | |
1469 | fSpiderBufferFull[hit.GetChan()] = kFALSE; //unset buffer full | |
1470 | if (fVerbose) | |
1471 | AliInfo("Trailing hit and buffer full, pack leading and trailing hit"); | |
1472 | } | |
1473 | else{ //buffer empty | |
1474 | ; //do nothing | |
1475 | if (fVerbose) | |
1476 | AliInfo("Trailing hit and buffer empty, trow trailing hit away"); | |
1477 | } | |
1478 | break; | |
1479 | } //switch PS bits | |
1480 | ||
1481 | } | |
1482 | ||
1483 | //_________________________________________________________________ | |
1484 | ||
1485 | Bool_t | |
1486 | AliTOFDecoderV2::DecodeNext() | |
1487 | { | |
1488 | /* decode next */ | |
1489 | ||
1490 | if (!fRawReader || !fRawReader->ReadHeader()) | |
1491 | return kFALSE; | |
1492 | ||
1493 | const Int_t size = fRawReader->GetDataSize(); | |
1494 | UChar_t *data = new UChar_t[size]; | |
1495 | if (fRawReader->ReadNext(data, size) != 1) { | |
1496 | delete [] data; | |
1497 | return kFALSE; | |
1498 | } | |
1499 | ||
1500 | /* decode equipment data */ | |
1501 | SetEquipmentID(fRawReader->GetEquipmentId()); | |
1502 | Decode((UInt_t *)data, size / 4); | |
1503 | ||
1504 | delete [] data; | |
1505 | return kTRUE; | |
1506 | } |