]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - HMPID/AliHMPIDRawStream.cxx
Fix from Mateusz
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDRawStream.cxx
... / ...
CommitLineData
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///
18/// This is a class for reading the HMPID raw data
19/// The format of the raw data corresponds to the one
20/// which was documented by Paolo Martinengo.
21///
22///////////////////////////////////////////////////////////////////////////////
23
24#include "AliHMPIDRawStream.h"
25#include "AliRawReader.h"
26#include "AliLog.h"
27
28ClassImp(AliHMPIDRawStream)
29
30//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
31AliHMPIDRawStream::AliHMPIDRawStream(AliRawReader* rawReader) :
32 fNPads(0),
33 fCharge(0x0),
34 fPad(0x0),
35 fDDLNumber(-1),
36 fnDDLInStream(0x0),
37 fnDDLOutStream(0x0),
38 fLDCNumber( 0),
39 fTimeStamp( 0),
40 fRawReader(rawReader),
41 fData(0x0),
42 fNumOfErr(0x0),
43 fPosition(-1),
44 fWord(0),
45 fZeroSup(kTRUE),
46 fPos(0x0),
47 fiPos(0),
48 fTurbo(kFALSE),
49 fRawDataSize(0)
50{
51 //
52 // Constructor
53 //
54 fNumOfErr = new Int_t*[kNDDL]; // Store the numner of errors for a given error type and a given DD
55 for(Int_t i=0;i<kNDDL;i++) {
56 fNumOfErr[i] = new Int_t [kSumErr];
57 }
58
59 fnDDLInStream=new Int_t[kNDDL];
60 fnDDLOutStream=new Int_t[kNDDL];
61 for(Int_t iddl=0;iddl<kNDDL;iddl++) { fnDDLInStream[iddl]=-1;fnDDLOutStream[iddl]=-1;}
62
63 for(Int_t iddl=0;iddl<kNDDL;iddl++)
64 for(Int_t ierr=0; ierr < kSumErr; ierr++) fNumOfErr[iddl][ierr]=0; //reset errors
65 fRawReader->Reset();
66 fRawReader->Select("HMPID");
67
68
69
70}
71//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
72AliHMPIDRawStream::AliHMPIDRawStream() :
73 fNPads(0),
74 fCharge(0x0),
75 fPad(0x0),
76 fDDLNumber(-1),
77 fnDDLInStream(0x0),
78 fnDDLOutStream(0x0),
79 fLDCNumber( 0),
80 fTimeStamp( 0),
81 fRawReader(0x0),
82 fData(0x0),
83 fNumOfErr(0x0),
84 fPosition(-1),
85 fWord(0),
86 fZeroSup(kTRUE),
87 fPos(0x0),
88 fiPos(0),
89 fTurbo(kFALSE) ,
90 fRawDataSize(0)
91{
92 //
93 // Constructor
94 //
95 fNumOfErr = new Int_t*[kNDDL]; // Store the numner of errors for a given error type and a given DD
96 for(Int_t i=0;i<kNDDL;i++) {
97 fNumOfErr[i] = new Int_t [kSumErr];
98 }
99 fnDDLInStream=new Int_t[kNDDL];
100 fnDDLOutStream=new Int_t[kNDDL];
101 for(Int_t iddl=0;iddl<kNDDL;iddl++) { fnDDLInStream[iddl]=-1;fnDDLOutStream[iddl]=-1;}
102
103
104 for(Int_t iddl=0;iddl<kNDDL;iddl++)
105 for(Int_t ierr=0; ierr < kSumErr; ierr++) fNumOfErr[iddl][ierr]=0; //reset errors
106
107
108}
109//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
110AliHMPIDRawStream::~AliHMPIDRawStream()
111{
112 //
113 // destructor
114 //
115 DelVars();
116
117
118 fDDLNumber=0;
119 fLDCNumber=0;
120 fTimeStamp=0;
121 fPosition=0;
122 fWord=0;
123 fZeroSup=0;
124 fTurbo=0;
125 fRawDataSize=0;
126 for(Int_t i=0;i<kNDDL;i++) delete [] fNumOfErr[i];
127 delete [] fNumOfErr;
128
129 delete [] fnDDLInStream;
130 delete [] fnDDLOutStream;
131}
132//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
133void AliHMPIDRawStream::Reset()
134{
135 // reset raw stream params
136 // Reinitalize the containers
137 fDDLNumber = -1;
138 fLDCNumber = 0;
139 fTimeStamp = 0;
140 fPosition = -1;
141 fData = NULL;
142 if (fRawReader) fRawReader->Reset();
143}
144//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
145Bool_t AliHMPIDRawStream::Turbo()
146{
147
148 Int_t row,dilogic;UInt_t pad;
149 Int_t cntGlob = fRawReader->GetDataSize()/4;
150 fPosition=0;
151 fNPads=0;
152// Int_t gw=0;
153 for(Int_t i=1;i<cntGlob;i++) {
154 if(!GetWord(1)) return kFALSE;
155 if (((fWord >> kbit27) & 1)) continue;
156 UInt_t statusControlRow = 0x32a8;
157 UInt_t rowControlWord = fWord >> kbit0 & 0xfbff;
158 if(rowControlWord == statusControlRow) continue;
159
160 row = (fWord >> kbit22) & 0x1f;
161 dilogic = (fWord >> kbit18) & 0xf; //dilogic info in raw word is between bits: 18...21
162
163 pad = (fWord >> kbit12) & 0x3f; //pad info in raw word is between bits: 12...17
164 if(!CheckPad(pad)) continue;
165 Int_t charge = fWord & 0xfff;
166 if(GetPad(fDDLNumber,row,dilogic,pad)<0) continue;
167 fPad[fNPads] = GetPad(fDDLNumber,row,dilogic,pad);
168 fCharge[fNPads] = charge;
169 fNPads++;
170 if(charge==0) fNumOfErr[fDDLNumber][kPedQZero]++;
171 }//word loop
172 //Printf("Size: %i DDL %i row %i dilogic %i pad %i fPos %i fNPads: %i Charge: %d Word %4.4x GoodW: %i",cntGlob,fDDLNumber,row,dilogic,pad,fPosition,fNPads,fCharge[fNPads-1],fWord,gw++);
173 return kTRUE;
174}//Turbo()
175//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
176Bool_t AliHMPIDRawStream::Next()
177{
178 // read next DDL raw data from the HMPID raw data stream
179 // return kFALSE in case of error or no data left
180 AliDebug(1,"Start.");
181 do {
182 if (!fRawReader->ReadNextData(fData)) return kFALSE;
183 } while (fRawReader->GetDataSize() == 0);
184
185
186 /*
187 Event type is selected as in $ALICE_ROOT/RAW/event.h
188 #define START_OF_RUN ((eventTypeType) 1)
189 #define END_OF_RUN ((eventTypeType) 2)
190 #define START_OF_RUN_FILES ((eventTypeType) 3)
191 #define END_OF_RUN_FILES ((eventTypeType) 4)
192 #define START_OF_BURST ((eventTypeType) 5)
193 #define END_OF_BURST ((eventTypeType) 6)
194 #define PHYSICS_EVENT ((eventTypeType) 7) <<---------------
195 #define CALIBRATION_EVENT ((eventTypeType) 8)
196 #define EVENT_FORMAT_ERROR ((eventTypeType) 9)
197 #define START_OF_DATA ((eventTypeType)10)
198 #define END_OF_DATA ((eventTypeType)11)
199 #define SYSTEM_SOFTWARE_TRIGGER_EVENT ((eventTypeType)12)
200 #define DETECTOR_SOFTWARE_TRIGGER_EVENT ((eventTypeType)13)
201 #define EVENT_TYPE_MIN 1
202 #define EVENT_TYPE_MAX 13
203 */
204
205 fPosition = 0;
206 Bool_t status=kFALSE;
207 fRawDataSize=0;
208 fDDLNumber = fRawReader->GetDDLID();
209
210 if(fDDLNumber<0) {
211 AliWarning(Form("fDDLNumber not a acceptable value %i",fDDLNumber));
212 return kFALSE;
213 }
214
215 if(fRawReader->GetType() == 7 || fRawReader->GetType() == 8 ) { //New: Select Physics events, Old: Raw data size is not 0 and not 47148 (pedestal)
216 fnDDLInStream[fDDLNumber]=1; fnDDLOutStream[fDDLNumber]=0;
217
218 fLDCNumber = fRawReader->GetLDCId();
219 fTimeStamp = fRawReader->GetTimestamp();
220
221 AliDebug(1,Form("DDL %i started to be decoded!",fDDLNumber));
222 fRawDataSize=fRawReader->GetDataSize()/4;
223 DelVars(); //We have to delete the variables initialized in the InitVars before recall IntiVars!!!
224 InitVars(fRawDataSize); //To read the charge and pads we cannot delete before the status return
225
226 if(fTurbo==kTRUE) status=Turbo();
227 else status = ReadHMPIDRawData();
228
229 if(status) AliDebug(1,Form("Event DDL %i successfully decoded!.",fDDLNumber));
230 else AliDebug(1,Form("Event DDL %i ERROR in decoding!.",fDDLNumber));
231 //DumpData(fRawReader->GetDataSize());
232
233
234 }
235 if(status==kTRUE) {fnDDLOutStream[fDDLNumber]++; }//Printf("fnDDLOutStream[%d]=%d",fDDLNumber,fnDDLOutStream[fDDLNumber]); } //Count the number of events when the DDL was succesfully decoded
236
237// return status; // temporary solution...
238 return kTRUE;
239}
240//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
241void AliHMPIDRawStream::InitVars(Int_t n)
242{
243 //
244 //
245 //
246 fNPads = 0;
247 fCharge = new Int_t[n];
248 fPad = new Int_t[n];
249 //for debug purpose
250 fPos = new Int_t[4*n+4]; //reset debug
251 for(Int_t ie = 0 ; ie < 4*n+4; ie++) fPos[ie] = 0; //initialize for 0, otherwise the position is considered filled and will not be updated for the dump
252 fiPos = 0;
253}
254//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
255void AliHMPIDRawStream::DelVars()
256{
257 //
258 //
259 //
260 //Clean the initvars!!!!!!!!
261 fNPads = 0;
262 if (fCharge) { delete [] fCharge; fCharge = 0x0; }
263 if (fPad) { delete [] fPad; fPad = 0x0; }
264 if (fPos) { delete [] fPos; fPos = 0x0; }
265
266 fiPos=0;
267
268
269}
270//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
271Bool_t AliHMPIDRawStream::ReadHMPIDRawData()
272{
273 //Here the loop on the decoding the raw bank
274 //for one ddl starts.
275 //It returns: kFALSE if any error occurs
276 // kTRUE if all OK
277 Int_t cntGlob = fRawReader->GetDataSize()/4;
278 if(cntGlob==0) {fNumOfErr[fDDLNumber][kRawDataSizeErr]++; return kFALSE; }
279
280 Int_t cnt = cntGlob;
281 Int_t nwSeg;
282 Int_t cntSegment;
283
284 if(!GetWord(cnt)) return kFALSE;
285 cnt--;
286
287
288 while (cnt>20) { //counter limit is changed from 0 to 20 to take into account (skipp) the 5 extra words in the equipment header
289 nwSeg = (fWord >> kbit8) & 0xfff;
290 if(!CheckSegment()) return kFALSE;
291 if(!ReadSegment(cntSegment)) return kFALSE;
292
293 if(nwSeg != cntSegment) {AliDebug(1,Form("Error in Segment counters: %i different wrt %i",nwSeg,cntSegment)); return kFALSE;}
294 if(!GetWord(cntSegment+1,kBwd)) return kFALSE;
295 cnt-=cntSegment+1;
296 }
297
298 return kTRUE;
299
300}
301//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
302Bool_t AliHMPIDRawStream::ReadSegment(Int_t &cntSegment)
303{
304 //Read the segment
305 //It returns: kFALSE if any error occurs
306 // kTRUE if all OK
307 cntSegment = (fWord >> kbit8) & 0xfff;
308 Int_t cnt = cntSegment;
309 Int_t cntRow;
310 Int_t nwRow;
311
312 if(!GetWord(cnt,kBwd)) return kFALSE;
313
314 while (cnt>0) {
315
316 cntRow = (fWord >> kbit16) & 0xfff;
317 if(!CheckRowMarker()) return kFALSE;
318 if(!ReadRow(nwRow)) return kFALSE;
319
320 if(nwRow != cntRow) {AliDebug(1,Form("Error in Row counters: %i different wrt %i",nwRow,cntRow)); return kFALSE;}
321 if(!GetWord(cntRow+1)) return kFALSE;
322 cnt -= cntRow+1;
323
324 }
325
326 cntSegment -= cnt;
327
328 return kTRUE;
329
330}
331//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
332Bool_t AliHMPIDRawStream::ReadRow(Int_t &cntRow)
333{
334 // Read the row
335 //It returns: kFALSE if any error occurs
336 // kTRUE if all OK
337
338 Int_t cnt;
339 Int_t cntDilogic;
340 Int_t nwDil;
341
342 cntRow = (fWord >> kbit16) & 0xfff;
343 cnt = cntRow;
344
345 if(!GetWord(cntRow)) return kFALSE;
346
347 while (cnt>0) {
348
349 if(!CheckEoE(nwDil)) return kFALSE;
350 if(!ReadDilogic(cntDilogic)) return kFALSE;
351
352 if(nwDil != cntDilogic) {AliDebug(1,Form("Error in Dilogic counters: %i different wrt %i",nwDil,cntDilogic));return kFALSE;}
353 cnt -= cntDilogic;
354 if(!GetWord(1,kBwd)) return kFALSE; // go to next Dilogic bank...
355 cnt--;
356// Printf(" cnt %i cntDilogic %i ",cnt,cntDilogic);
357 }
358
359 cntRow -= cnt;
360
361 return kTRUE;
362
363}
364//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
365Bool_t AliHMPIDRawStream::ReadDilogic(Int_t &cntDilogic)
366{
367 // Read the dilogic bank
368 //It returns: kFALSE if any error occurs
369 // kTRUE if all OK
370
371 cntDilogic = fWord & 0x7f;
372
373 Int_t cnt = cntDilogic;
374
375// Printf(" cnt DILOGIC %i at %i word %08X",cnt,fPosition,fWord);
376
377 for(Int_t iDil=0;iDil<cntDilogic;iDil++) {
378 UInt_t dilogic = 0, row = 0;
379 if(!GetWord(1,kBwd)) return kFALSE;
380//check on row number
381 cnt--;
382 row = (fWord >> kbit22) & 0x1f;
383 if(!CheckRow(row)) continue;
384//check dilogic number
385 dilogic = (fWord >> kbit18) & 0xf; //dilogic info in raw word is between bits: 18...21
386 if(!CheckDilogic(dilogic)) continue;
387//check pad number
388 UInt_t pad = (fWord >> kbit12) & 0x3f; //pad info in raw word is between bits: 12...17
389 if(!CheckPad(pad)) continue;
390 Int_t charge = fWord & 0xfff;
391 if(GetPad(fDDLNumber,row,dilogic,pad)<0) continue;
392 fPad[fNPads] = GetPad(fDDLNumber,row,dilogic,pad);
393 fCharge[fNPads] = charge;
394 fNPads++;
395
396 if(charge==0)
397 {
398 AliDebug(1,Form("If PEDESTAL run -> WARNING: ZERO charge is read from DDL: %d row: %d dil: %d pad: %d",fDDLNumber,row,dilogic,pad));
399 fNumOfErr[fDDLNumber][kPedQZero]++;
400 }
401
402 }//iDil
403
404 cntDilogic -= cnt;
405 return kTRUE;
406}
407//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
408Bool_t AliHMPIDRawStream::CheckSegment()
409{
410 // Check the segment marker
411 //It returns: kFALSE if any error occurs
412 // kTRUE if all OK
413
414 UInt_t markSegment = 0xAB0;
415 /*
416 if (iRow%8 == 0) {
417 UInt_t segWord = GetWord();
418 if ((segWord >> 20) != statusSegWord) {
419 fRawReader->AddMajorErrorLog(kBadSegWordErr);
420 AliDebug(1,Form("Wrong segment word signature: %x, expected 0xab0!",(segWord >> 20)));
421 fNumOfErr[kBadSegWordErr]++;
422 return kTRUE;
423 }
424*/
425 UInt_t segMarker = (fWord >> kbit20) & 0xfff;
426 if (segMarker != markSegment ) {
427 //fRawReader->AddMajorErrorLog(kWrongSegErr,Form("Segment marker %0X wrong (expected %0X) at %i in word %0X!",segMarker,markSegment,fPosition,fWord));
428 AliDebug(1,Form("Segment marker %X wrong (expected %0X)! at %i in word %0X!",segMarker,markSegment,fPosition,fWord));
429 fNumOfErr[fDDLNumber][kWrongSegErr]++;
430 return kFALSE;
431 }
432
433 UInt_t segAddress = fWord & 0xff;
434 if (segAddress<1 ||segAddress>3) {
435 //fRawReader->AddMajorErrorLog(kWrongSegErr,Form("Segment address %d not in the valid range [1-3] at %i in word %0X",segAddress,fPosition,fWord));
436 AliDebug(1,Form("Segment address %d not in the valid range [1-3]",segAddress));
437 fNumOfErr[fDDLNumber][kWrongSegErr]++;
438 return kFALSE;
439 }
440// Printf("Segment Marker found at %i! Number of segment is %i",fPosition,segAddress);
441 return kTRUE;
442}
443//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
444Bool_t AliHMPIDRawStream::CheckRow(UInt_t row)
445{
446 //check on row number
447 //It returns: kFALSE if any error occurs
448 // kTRUE if all OK
449// Printf("ROW %i word %0X",row,fWord);
450 if(row>=1 && row <=kNRows) return kTRUE;
451
452 //fRawReader->AddMajorErrorLog(kWrongRowErr,Form("row %d",row));
453 AliDebug(1,Form("Wrong row index: %d, expected (1 -> %d) word %0X at %i...",row,kNRows,fWord,fPosition));
454 fNumOfErr[fDDLNumber][kWrongRowErr]++;
455 return kFALSE;
456}
457//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
458Bool_t AliHMPIDRawStream::CheckDilogic(UInt_t dilogic)
459{
460//check dilogic number
461 //It returns: kFALSE if any error occurs
462 // kTRUE if all OK
463 if (dilogic>= 1 && dilogic <=kNDILOGICAdd) return kTRUE;
464
465 //fRawReader->AddMajorErrorLog(kWrongDilogicErr,Form("dil %d",dilogic));
466 AliDebug(1,Form("Wrong DILOGIC index: %d, expected (1 -> %d)!",dilogic,kNDILOGICAdd));
467 fNumOfErr[fDDLNumber][kWrongDilogicErr]++;
468 //dilogic = iDILOGIC;
469 return kFALSE;
470}
471//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
472Bool_t AliHMPIDRawStream::CheckPad(UInt_t pad)
473{
474//check pad number
475 //It returns: kFALSE if any error occurs
476 // kTRUE if all OK
477 if (pad < kNPadAdd) return kTRUE;
478
479 //fRawReader->AddMajorErrorLog(kWrongPadErr,Form("pad %d",pad));
480 AliDebug(1,Form("Wrong pad index: %d, expected (0 -> %d)!",pad,kNPadAdd));
481 fNumOfErr[fDDLNumber][kWrongPadErr]++;
482 return kFALSE;
483}
484//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
485Bool_t AliHMPIDRawStream::CheckEoE(Int_t &nDil)
486{
487 //check the End of Event
488 //It returns: kFALSE if any error occurs
489 // kTRUE if all OK
490 if (!((fWord >> kbit27) & 0x1)) { //check 27th bit in EoE. It must be 1!
491 //fRawReader->AddMajorErrorLog(kEoEFlagErr);
492 AliDebug(1,Form("Missing end-of-event flag! (%08X) at %i",fWord,fPosition));
493 fNumOfErr[fDDLNumber][kEoEFlagErr]++;
494 return kFALSE;
495 }
496 nDil = fWord & 0x7f; //nDil=EoE word count
497 if(nDil < 0 || nDil > 48 ) {
498
499 //fRawReader->AddMajorErrorLog(kEoESizeErr,Form("EoE size=%d",nDil));
500 AliDebug(1,Form("Wrong end-of-event word-count: %08X",fWord));
501 fNumOfErr[fDDLNumber][kEoESizeErr]++;
502 return kFALSE;
503 }
504// UInt_t da = (eOfEvent >> 18) & 0xf;
505// if (cntData!=0 && da != dilogic) {
506// fRawReader->AddMajorErrorLog(kEoEDILOGICErr,Form("eoe dil %d != %d",da,dilogic));
507// AliDebug(1,Form("Wrong DILOGIC address found in end-of-event: %d, expected %d!",da,dilogic));
508// fNumOfErr[kEoEDILOGICErr]++;
509// return kFALSE; AliQAChecker::Instance()->Run(AliQAv1::kHMPID, task, obj) ;
510
511// }
512// UInt_t ca = (eOfEvent >> 22) & 0x1f;
513// if (cntData!=0 && ca != row) {
514// fRawReader->AddMajorErrorLog(kEoERowErr,Form("eoe row %d != %d",ca,row));
515// AliDebug(1,Form("Wrong row index found in end-of-event: %d, expected %d!",ca,row));
516// fNumOfErr[kEoERowErr]++;
517// return kFALSE;
518// }
519 return kTRUE;
520}
521//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
522Bool_t AliHMPIDRawStream::CheckRowMarker()
523{
524 //check the row marker
525 //It returns: kFALSE if any error occurs
526 // kTRUE if all OK
527 UInt_t nMAXwordsInRow = 0x1EA;
528 UInt_t statusControlRow = 0x32a8; // 0x36a8 for zero suppression
529//First check on row marker
530 UInt_t rowControlWord = fWord >> kbit0 & 0xfbff;
531
532 if(rowControlWord != statusControlRow) {
533 //fRawReader->AddMajorErrorLog(kRowMarkerErr);
534 AliDebug(1,Form("Wrong row marker %x expected 0x32a8!",rowControlWord));
535 fNumOfErr[fDDLNumber][kRowMarkerErr]++;
536 return kFALSE;
537 }
538//Second check on row marker
539 UInt_t wordsInRow = fWord >> kbit16 & 0x0fff; // Number of words after the row marker, bit 10 is skipped in this check
540
541 if (wordsInRow > nMAXwordsInRow) {
542 //fRawReader->AddMajorErrorLog(kRowMarkerSizeErr);
543 AliDebug(1,Form(" FATAL: Number of words %x in a row exceeds the expected value: 0x1EA !",wordsInRow));
544 fNumOfErr[fDDLNumber][kRowMarkerSizeErr]++;
545 return kFALSE;
546 }
547
548 return kTRUE;
549}
550//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
551Bool_t AliHMPIDRawStream::GetWord(Int_t n,EDirection dir)
552{
553 // This method returns the n-th 32 bit word
554 // inside the raw data payload.
555 // The method is supposed to be endian (platform)
556 // independent.
557
558 fWord = 0;
559 if (fPosition < 0) {
560 AliError("fPosition < 0 !!! Event skipped.");
561 fRawReader->AddMajorErrorLog(kRawDataSizeErr,"fPosition<0");
562 return kFALSE;
563 }
564
565 if(dir==kBwd) n = -n;
566 fPosition+=4*n-4;
567
568 if(fPosition==-4) return kTRUE;
569
570 if(fPosition<0 || fPosition > fRawReader->GetDataSize()) {
571 AliWarning(Form("fPosition out of boundaries %i",fPosition));
572 return kFALSE;
573 }
574
575 StorePosition();
576
577 fWord |= fData[fPosition++];
578 fWord |= fData[fPosition++] << 8;
579 fWord |= fData[fPosition++] << 16;
580 fWord |= fData[fPosition++] << 24;
581
582 return kTRUE;
583}
584//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
585void AliHMPIDRawStream::DumpData(Int_t nw)
586{
587 //just a simple raw data dump
588 // in () is the position in bytes
589 //--
590 for(Int_t i=0;i<nw;i+=4) {
591 if(!(i%16)) printf(" \n %8i) ",i);
592 printf("%02X%02X%02X%02X [ %06i ] ",fData[i+3],fData[i+2],fData[i+1],fData[i+0],fPos[i]);
593 }
594 Printf(" \n -----end of dump ----------- ");
595}
596//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
597void AliHMPIDRawStream::StorePosition()
598{
599 //just for debug purpose
600 // it stores the position
601 //read for the first time
602// Printf("@@@@@@@@@ fPos: %x fPosition: %d",fPos,fPosition);
603 if(fPos[fPosition]!=0) {
604// Printf("Position already stored!!! Value %i at address %i",fPos[fPosition],fPosition);
605 return;
606 }
607 fiPos++;
608 fPos[fPosition] = fiPos;
609// if(stDeb)Printf("%i - Actual position %i",iPos,fPosition);
610}
611//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++