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