Fixes in the memory managment, additional protections
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDRawStream.h
CommitLineData
d2e2f542 1#ifndef ALIHMPIDRAWSTREAM_H
2#define ALIHMPIDRAWSTREAM_H
3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6///////////////////////////////////////////////////////////////////////////////
7///
8/// This is a class for reading raw data digits for HMPID.
9/// The data format is taken from the document provided by Paolo Martinengo.
10///
11/// cvetan.cheshkov@cern.ch 19/07/2007
12///
13///////////////////////////////////////////////////////////////////////////////
14
15#include <TObject.h>
21f61e25 16#include <TRandom.h>
17#include "AliHMPIDParam.h"
18#include <AliBitPacking.h>
19#include <AliFstream.h>
20#include "AliHMPIDDigit.h"
21#include "AliDAQ.h"
f7ee745b 22#include "AliRawDataHeaderSim.h"
d2e2f542 23class AliRawReader;
24
25class AliHMPIDRawStream: public TObject {
26 public :
27 AliHMPIDRawStream(AliRawReader* rawReader);
21f61e25 28 AliHMPIDRawStream();
29
d2e2f542 30 virtual ~AliHMPIDRawStream();
31
21f61e25 32 virtual void Reset();
33 virtual Bool_t Next();
56c73976 34 void InitVars(Int_t n);
35 void DelVars();
21f61e25 36
e96561a3 37 Int_t GetDDLNumber() const { return fDDLNumber; } // Provide current DDL number
38 static inline Int_t GetPad(Int_t ddl,Int_t row,Int_t dil,Int_t pad); //
56c73976 39 Int_t GetNPads() const { return fNPads;}
40 Int_t* GetPadArray() const { return fPad;}
41 Int_t* GetChargeArray() const { return fCharge;}
42 Int_t Pc ( Int_t ddl,Int_t row,Int_t dil,Int_t pad ) {return AliHMPIDParam::A2P(GetPad(ddl,row,dil,pad));} //PC position number
43 Int_t PadPcX ( Int_t ddl,Int_t row,Int_t dil,Int_t pad ) {return AliHMPIDParam::A2X(GetPad(ddl,row,dil,pad));} //pad pc x # 0..79
44 Int_t PadPcY ( Int_t ddl,Int_t row,Int_t dil,Int_t pad ) {return AliHMPIDParam::A2Y(GetPad(ddl,row,dil,pad));} //pad pc y # 0..47
21f61e25 45
46 inline Bool_t SetZeroSup (Bool_t isSup);
47 inline Bool_t GetZeroSup();
e96561a3 48 inline Int_t GetErrors(Int_t ddl,Int_t eType); //Get errors and occurance
fd8bfa30 49
50 Bool_t ReadHMPIDRawData(); // Read HMPID Raw data
56c73976 51 Bool_t ReadSegment(Int_t &cntSegment); // Read Segment
52 Bool_t ReadRow(Int_t &cntRow); // Read Row
53 Bool_t ReadDilogic(Int_t &cntDilogic); // Read Dilogic
fd8bfa30 54
56c73976 55 Bool_t CheckRow(UInt_t row); // Check Row
56 Bool_t CheckDilogic(UInt_t dilogic); // Check Dilogic
57 Bool_t CheckPad(UInt_t pad); // Check pad
58 Bool_t CheckEoE(Int_t &nDil); // Check EoE
59 Bool_t CheckRowMarker(); // Check RowMarker
60 Bool_t CheckSegment(); // Check Segment
61 void DumpData(Int_t nw); // Dump Data
62 void StorePosition(); //Debug purpose
fd8bfa30 63
56c73976 64// inline void Raw (UInt_t &w32,Int_t &ddl,Int_t &r,Int_t &d,Int_t &a); //digit->(w32,ddl,r,d,a)
65// inline void Raw (Int_t ddl,Int_t r,Int_t d,Int_t a); //raw->abs pad number
66// inline Bool_t Raw (UInt_t w32,Int_t ddl,AliRawReader *pRR); //(w32,ddl)->digit
21f61e25 67 inline void WriteRaw (TObjArray *pDigLst ); //write as raw stream
68 inline void WriteRowMarker (AliFstream *ddl,UInt_t size);
69 inline void WriteEoE (AliFstream *ddl,UInt_t row,UInt_t dil,UInt_t wordCnt);
91f2bfe5 70 inline void WriteSegMarker (AliFstream *ddl,UInt_t row, Int_t nwInSeg);
21f61e25 71
72// inline TClonesArray ReMap(TClonesArray *pDigIn);
fd8bfa30 73enum EDirection {kFwd,kBwd};
74
75enum Ebits {kbit0,kbit1 , kbit2, kbit3, kbit4, kbit5, kbit6, kbit7, kbit8,
76 kbit9 ,kbit10,kbit11,kbit12,kbit13,kbit14,kbit15,kbit16,
77 kbit17,kbit18,kbit19,kbit20,kbit21,kbit22,kbit23,kbit24,
78 kbit25,kbit26,kbit27,kbit28,kbit29,kbit30,kbit31,kbit32};
21f61e25 79
80 enum EHMPIDRawStreamError {
e96561a3 81 kRawDataSizeErr = 1,
82 kRowMarkerErr = 2,
83 kWrongRowErr = 3,
84 kWrongDilogicErr = 4,
85 kWrongPadErr = 5,
86 kEoEFlagErr = 6,
87 kEoESizeErr = 7,
88 kEoEDILOGICErr = 8,
89 kEoERowErr = 9,
90 kBadSegWordErr = 10,
91 kWrongSegErr = 11,
843bde9a 92 kRowMarkerSizeErr = 12,
e96561a3 93 kSumErr = 13 //This is always the last one, to retreive the number of errors
d2e2f542 94 };
21f61e25 95
d2e2f542 96 enum {
21f61e25 97 kNRows = 24, // Number of rows (starting from 1 !)//was25
98 kNDILOGICAdd = 10, // Number of DILOGIC addresses in a row (starting from 1 !) //was11
99 kNPadAdd = 48, // Number of pad row
100 kNRowsPerSegment = 8, // Number of rows per segment
101 kNDDL = 14
d2e2f542 102 };
21f61e25 103 enum EHMPIDRawError {
104 kInvalidRawDataWord = 1
105 };
d2e2f542 106
21f61e25 107
d2e2f542 108 private :
109
110 AliHMPIDRawStream& operator = (const AliHMPIDRawStream& stream);
111 AliHMPIDRawStream(const AliHMPIDRawStream& stream);
112
fd8bfa30 113 UInt_t GetWord(Int_t n=1,EDirection dir=kFwd); // Get n-th word
114 UInt_t GetNextWord(); // Get next word
56c73976 115 Int_t fNPads; // counter of pads in one DDL
e96561a3 116 Int_t *fCharge; // Array for charge values for all channels in one DDL
117 Int_t *fPad; // Array for abs pad values for all channels in one DDL
fd8bfa30 118 Int_t fDDLNumber; // index of current DDL number
e96561a3 119 AliRawReader *fRawReader; // object for reading the raw data
120 UChar_t *fData; // raw data
121 Int_t **fNumOfErr; // Store the numner of errors for a given error type and a given DDL
56c73976 122 Int_t fPosition; // current word
123 UInt_t fWord; // current position in fData
e96561a3 124 Bool_t fZeroSup; // set if zero suppression is applied
125 Int_t *fPos; // for debug purposes
126 Int_t iPos; // counter for debug
127
128 ClassDef(AliHMPIDRawStream, 2) // base class for reading HMPID raw digits
d2e2f542 129};
21f61e25 130//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
56c73976 131 /*
21f61e25 132void AliHMPIDRawStream::Raw(UInt_t &w32,Int_t &ddl,Int_t &r,Int_t &d,Int_t &a)
133{
134// Convert raw stream word to raw word format
135// Arguments: w32,ddl,r,d,a where to write the results
136// Returns: none
137 Int_t y2a[6]={5,3,1,0,2,4};
138
139 ddl=2*Ch(ddl,r,d,a)+Pc(ddl,r,d,a)%2; //DDL# 0..13
140 Int_t tmp=1+Pc(ddl,r,d,a)/2*8+PadPcY(ddl,r,d,a)/6; r=(Pc(ddl,r,d,a)%2)? 25-tmp:tmp; //row r=1..24
141 d=1+PadPcX(ddl,r,d,a)/8; //DILOGIC# 1..10
142 a=y2a[PadPcY(ddl,r,d,a)%6]+6*(PadPcX(ddl,r,d,a)%8); //ADDRESS 0..47
143
144 w32=0;
56c73976 145 AliBitPacking::PackWord((fCharge[fNPads]>4095)?4095:(UInt_t)fCharge[fNPads],w32, 0,11); // 0000 0rrr rrdd ddaa aaaa qqqq qqqq qqqq Qdc bits (00..11) counts (0..4095)
21f61e25 146 //molnarl: Since in simulation the the charge can be > than 4095 but not in real life we need to protect. If fQ>4095 after packing we will get 0 for the charge!
147 assert(0<=a&&a<=47);AliBitPacking::PackWord( a ,w32,12,17); // 3322 2222 2222 1111 1111 1000 0000 0000 DILOGIC address bits (12..17) counts (0..47)
148 assert(1<=d&&d<=10);AliBitPacking::PackWord( d ,w32,18,21); // 1098 7654 3210 9876 5432 1098 7654 3210 DILOGIC number bits (18..21) counts (1..10)
149 assert(1<=r&&r<=24);AliBitPacking::PackWord( r ,w32,22,26); // Row number bits (22..26) counts (1..24)
150}
56c73976 151*/
21f61e25 152//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
56c73976 153 /*
154Int_t AliHMPIDRawStream::Raw(Int_t ddl,Int_t r,Int_t d,Int_t a)
21f61e25 155{
156 //Assign absolute pad ID based on ddl,row,dil,pad
157 //Arguments: DDL, row number, dilogic number, dilogic address(pad)
158 //Returns : nothing
159
160 assert(0<=ddl&&ddl<=13); assert(1<=r&&r<=24); assert(1<=d&&d<=10); assert(0<=a&&a<=47);
161 Int_t a2y[6]={3,2,4,1,5,0};//pady for a given address (for single DILOGIC chip)
162 Int_t ch=ddl/2;
163 Int_t tmp=(r-1)/8; Int_t pc=(ddl%2)? 5-2*tmp:2*tmp;
164 Int_t px=(d-1)*8+a/6;
165 tmp=(ddl%2)?(24-r):r-1; Int_t py=6*(tmp%8)+a2y[a%6];
56c73976 166 return AliHMPIDParam::Abs(ch,pc,px,py);
21f61e25 167}
168//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
169Bool_t AliHMPIDRawStream::Raw(UInt_t w32,Int_t ddl, AliRawReader *pRR)
170{
171// Converts a given raw data word to a digit
172// Arguments: w32 - 32 bits raw data word
173// ddl - DDL idx 0 1 2 3 4 ... 13
174// Returns: none
175 Int_t r = AliBitPacking::UnpackWord(w32,22,26); assert(1<=r&&r<=24); // Row number (1..24)
176 Int_t d = AliBitPacking::UnpackWord(w32,18,21); assert(1<=d&&d<=10); // 3322 2222 2222 1111 1111 1000 0000 0000 DILOGIC number (1..10)
177 Int_t a = AliBitPacking::UnpackWord(w32,12,17); assert(0<=a&&a<=47); // 1098 7654 3210 9876 5432 1098 7654 3210 DILOGIC address (0..47)
178 Int_t q = AliBitPacking::UnpackWord(w32, 0,11); assert(0<=q&&q<=4095); // 0000 0rrr rrdd ddaa aaaa qqqq qqqq qqqq Qdc (0..4095)
179 if (r<1 || r>24 || d<1 || d>10 || a<0 || a>47 || q<0 || q>4095) {
180 AliWarning(Form("Invalid raw data word %x",w32));
181 pRR->AddMajorErrorLog(kInvalidRawDataWord,Form("w=%x",w32));
182 return kFALSE;
183 }
184 Raw(ddl,r,d,a);
185 fCharge[ddl][r][d][a]=q;
186 return kTRUE;
187}
56c73976 188*/
21f61e25 189//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
190Int_t AliHMPIDRawStream::GetPad(Int_t ddl,Int_t row,Int_t dil,Int_t pad)
191{
192 // The method returns the absolute pad number or -1
193 // in case the charge from the channels
194 // has not been read or invalid arguments
195
196 assert(0<=ddl&&ddl<=13);
197 assert(1<=row&&row<=24);
198 assert(1<=dil&&dil<=10);
199 assert(0<=pad&&pad<=47);
200
201 Int_t a2y[6]={3,2,4,1,5,0}; //pady for a given padress (for single DILOGIC chip)
202 Int_t ch=ddl/2;
203 Int_t tmp=(row-1)/8; Int_t pc=(ddl%2)? 5-2*tmp:2*tmp;
204 Int_t px=(dil-1)*8+pad/6;
205 tmp=(ddl%2)?(24-row):row-1;
206 Int_t py=6*(tmp%8)+a2y[pad%6];
207
56c73976 208 return AliHMPIDParam::Abs(ch,pc,px,py);
21f61e25 209}//GetPad()
210//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
21f61e25 211void AliHMPIDRawStream::WriteRowMarker(AliFstream *ddl,UInt_t size)
212{
213 //Writes the row marker for real data and pedestal into the ddl stream
214 //Arguments: ddl stream and the size of the block of the given row, the siye is at least the 10 EoE words!
215 //Returns: nothing
216 UInt_t w32=0;
91f2bfe5 217 UInt_t marker=13992; //for pedestal=12968 == 32a8 for zero suppressed 36a8
21f61e25 218 AliBitPacking::PackWord(size, w32, 16,31); //number of roaw written after row marker (digits and EoE)
91f2bfe5 219 AliBitPacking::PackWord(marker,w32,0,15); //the marker word
21f61e25 220 ddl->WriteBuffer((char*)&w32,sizeof(w32));
221}
222//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
223void AliHMPIDRawStream::WriteEoE(AliFstream *ddl,UInt_t row,UInt_t dil,UInt_t wordCnt )
224{
225 //Writes the EoE word from real data and pedestals into the ddl stream
226 //Arguments: ddl stream, row number, dilogic number and the number of words before the EoE
227 //Retursns: nothing
228 UInt_t e=1;
229 UInt_t w32=0;
230 assert(1<=row&&row<=24); AliBitPacking::PackWord((UInt_t)row ,w32,22,26); // row number (1...24)
231 assert(1<=dil&&dil<=10); AliBitPacking::PackWord((UInt_t)dil ,w32,18,21); // DILOGIC number (1...10)
232 AliBitPacking::PackWord( e ,w32, 7,17); // event number -- not used
233 AliBitPacking::PackWord((UInt_t)wordCnt ,w32, 0, 6); // word counter (0...47) AliBitPacking::PackWord((UInt_t)1 ,w32,27,27); // bit 27 is always 1 by definition of EoE
234 AliBitPacking::PackWord((UInt_t)1 ,w32,27,27); // bit 27 is always 1 by definition of EoE
235 ddl->WriteBuffer((char*)&w32,sizeof(w32));
236}
237//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
91f2bfe5 238void AliHMPIDRawStream::WriteSegMarker(AliFstream *ddl,UInt_t row, Int_t nwInSeg)
21f61e25 239{
240 //Writes the segment marker (after 8 rows) into the ddl stream
91f2bfe5 241 //Arguments: ddl stream and the segment: row 8 -> 0x5800, row 16 -> 5801, row 24 -> 5802 for pedestal
21f61e25 242 //Retruns: nothing
243 UInt_t w32=0;
e96561a3 244
91f2bfe5 245 //Segment marker: 2736 == ab0
e96561a3 246 //AliBitPacking::PackWord((UInt_t)0 ,w32,27,31); //zero out the rest of the bits, since they are not needed
91f2bfe5 247 AliBitPacking::PackWord((UInt_t)2736 ,w32,20,31); //ab0 the segment marker word
248 AliBitPacking::PackWord((UInt_t)nwInSeg,w32, 8,19); //number of words in the segment
249 AliBitPacking::PackWord((UInt_t)(row/8),w32, 0, 7); //segment 0,1,2
250 ddl->WriteBuffer((char*)&w32,sizeof(w32));
e96561a3 251 //Printf("Segment word created is: %x",w32);
21f61e25 252}
253//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
254Bool_t AliHMPIDRawStream::SetZeroSup (Bool_t isSup)
255{
256 //Prevision to turn OFF zero suppression
257 //Arguments: setter
258 //Returns: switch
259 fZeroSup=isSup;
260 return fZeroSup;
261}
262//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
263Bool_t AliHMPIDRawStream::GetZeroSup()
264{
265 if(fZeroSup==kTRUE) return kTRUE;
266 else return kFALSE;
267}
268//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
269void AliHMPIDRawStream::WriteRaw(TObjArray *pDigAll)
270{
271// Write a list of digits for a given chamber in raw data stream
272// Arguments: pDigAll- list of digits
273// Returns: none
274 Int_t ddl,r,d,a; //32 bits data word
275 Int_t cntLpad,cntRpad;
276 Int_t cntLrow,cntRrow;
277 Int_t cntL=0,cntR=0; //data words counters for DDLs
278 Int_t cntLeoe,cntReoe;
279 UInt_t posL,posR;
280 UInt_t cntLseg,cntRseg;
91f2bfe5 281 UInt_t cntwInLseg=0,cntwInRseg=0;
21f61e25 282 Int_t cntRdig=0,cntLdig=0;
283
284 UInt_t posLmarker,posRmarker;
285 Int_t digcnt=0;
286
287 Int_t isDigThere[14][25][11][48];
288
289 for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){//chambers loop
290 cntL=0;cntR=0;
291 for(Int_t iddl=0;iddl<14;iddl++){
292 for(Int_t irow=1;irow<=24;irow++){
293 for(Int_t idil=1;idil<=10;idil++){
294 for(Int_t ipad=0;ipad<48;ipad++){
295 isDigThere[iddl][irow][idil][ipad]=-1;
296 }
297 }
298 }
299 }
300
301 AliFstream* ddlL; //output streams, 2 per chamber
302 AliFstream* ddlR;
303
f7ee745b 304 AliRawDataHeaderSim header; header.SetAttribute(0); //empty DDL header
21f61e25 305
306 ddlL = new AliFstream(AliDAQ::DdlFileName("HMPID",2*iCh+1)); //left and right looking at the IP
307 ddlR = new AliFstream(AliDAQ::DdlFileName("HMPID",2*iCh)); //open both DDL of this chamber in parallel
308
309 ddlL->WriteBuffer((char*)&header,sizeof(header)); //write dummy header as place holder, actual
310 ddlR->WriteBuffer((char*)&header,sizeof(header)); //will be rewritten later when total size of DDL is known
311
312 UInt_t w32=0; //32 bits data word
313 digcnt=0;
314
315 TClonesArray *pDigCh=(TClonesArray *)pDigAll->At(iCh); //list of digits for current chamber
91f2bfe5 316
21f61e25 317 for(Int_t iDig=0;iDig<pDigCh->GetEntriesFast();iDig++){//digits loop
318 AliHMPIDDigit *pDig1=(AliHMPIDDigit*)pDigCh->At(iDig);
319 pDig1->Raw(w32,ddl,r,d,a);
320 isDigThere[ddl][r][d][a]=iDig;
321 }
322
323 for(Int_t row = 1; row <= AliHMPIDRawStream::kNRows; row++){ //AliHMPIDRawStream::kNRows=25!
324 cntRrow=0;cntLrow=0;cntLseg=0;cntRseg=0;//
325 cntLeoe=0;cntReoe=0;
91f2bfe5 326 posLmarker=ddlL->Tellp(); WriteRowMarker(ddlL,(UInt_t)1); cntL++; cntRrow++; cntwInRseg++;
327 posRmarker=ddlR->Tellp(); WriteRowMarker(ddlR,(UInt_t)1); cntR++; cntLrow++; cntwInLseg++;
21f61e25 328 for(Int_t dil = 1; dil <= AliHMPIDRawStream::kNDILOGICAdd; dil++){ //AliHMPIDRawStream::kNDILOGICAdd = 11!
329 cntLpad=0;cntRpad=0;
330 for(Int_t pad = 0; pad < AliHMPIDRawStream::kNPadAdd; pad++){ //AliHMPIDRawStream::kNPadAdd = 48
331 for ( Int_t iddl=2*iCh; iddl<=2*iCh+1;iddl++){
332 if (isDigThere[iddl][row][dil][pad]!=-1) {
333 AliHMPIDDigit *pDig=(AliHMPIDDigit*)pDigCh->At(isDigThere[iddl][row][dil][pad]);
334 pDig->Raw(w32,ddl,r,d,a);
335 if(pDig->Q() < 0 ) continue; //We can turn of the zero sup for pedestal simulation
336 //Printf("::::::::::::::: ddl from Digit : %d",ddl);
337 if(ddl%2){ //write raw digit selecting on DDL
91f2bfe5 338 ddlL->WriteBuffer((char*)&w32,sizeof(w32)); cntL++; cntLpad++; cntLrow++; cntLdig++; cntwInLseg++;//Printf(" WL: %x isDig: %d",w32,isDigThere[iddl][row][dil][pad]);
21f61e25 339 }else{
91f2bfe5 340 ddlR->WriteBuffer((char*)&w32,sizeof(w32)); cntR++; cntRpad++; cntRrow++; cntRdig++;cntwInRseg++;//Printf(" WR: %x isDig: %d",w32,isDigThere[iddl][row][dil][pad]);
21f61e25 341 }
342 }//ddl
343 }//isDig
344 }//pad
91f2bfe5 345 WriteEoE(ddlL,row,dil,cntLpad); cntL++; cntLrow++; cntLeoe++; cntwInLseg++; //molnarl: write EoE markers
346 WriteEoE(ddlR,row,dil,cntRpad); cntR++; cntRrow++; cntReoe++; cntwInRseg++;
21f61e25 347 }//dil
348 if(row%8==0){
91f2bfe5 349 WriteSegMarker(ddlL,row,cntwInLseg); cntL++; cntLseg++; cntwInLseg=0;
350 WriteSegMarker(ddlR,row,cntwInRseg); cntR++; cntRseg++; cntwInRseg=0;
21f61e25 351 }
352 posL=ddlL->Tellp(); ddlL->Seekp(posLmarker); WriteRowMarker(ddlL,(UInt_t)(cntLrow-1)); ddlL->Seekp(posL); //find the marker position write and go back to the actual position to continue writing
353 posR=ddlR->Tellp(); ddlR->Seekp(posRmarker); WriteRowMarker(ddlR,(UInt_t)(cntRrow-1)); ddlR->Seekp(posR);
354 }//row
355 header.fSize=sizeof(header)+cntL*sizeof(w32); ddlL->Seekp(0); ddlL->WriteBuffer((char*)&header,sizeof(header)); delete ddlL; //rewrite header with size set to
356 header.fSize=sizeof(header)+cntR*sizeof(w32); ddlR->Seekp(0); ddlR->WriteBuffer((char*)&header,sizeof(header)); delete ddlR; //number of bytes and close file
357
358 //Printf("In Ch %d # digits written to LDD %d RDDL %d",iCh,cntLdig,cntRdig);
359
360 }//chambers loop
361}//WriteRaw()
362//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
e96561a3 363Int_t AliHMPIDRawStream::GetErrors(Int_t ddl,Int_t eType)
843bde9a 364{
365// Return the number of errors for a given error tye during raw data reading
366// Arguments: errorType
367// Returns: error or -999 if error Type does not exist
368
369 if(eType < 1 || eType> kSumErr-1 ) return -999;
e96561a3 370 else if( ddl < 0 || ddl > kNDDL-1 ) return -999;
a66fe5e5 371 else if (!fNumOfErr) return -999;
372 else return fNumOfErr[ddl][eType];
843bde9a 373} //GetErrors()
374//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
e96561a3 375
d2e2f542 376#endif