]>
Commit | Line | Data |
---|---|---|
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> | |
16 | #include <TRandom.h> | |
17 | #include "AliHMPIDParam.h" | |
18 | #include <AliBitPacking.h> | |
19 | #include <AliFstream.h> | |
20 | #include "AliHMPIDDigit.h" | |
21 | #include "AliDAQ.h" | |
22 | #include "AliRawDataHeaderSim.h" | |
23 | class AliRawReader; | |
24 | ||
25 | class AliHMPIDRawStream: public TObject { | |
26 | public : | |
27 | AliHMPIDRawStream(AliRawReader* rawReader); | |
28 | AliHMPIDRawStream(); | |
29 | ||
30 | virtual ~AliHMPIDRawStream(); | |
31 | ||
32 | virtual void Reset(); | |
33 | virtual Bool_t Next(); | |
34 | void Init(); | |
35 | ||
36 | Int_t Ch( Int_t ddl,Int_t row,Int_t dil,Int_t pad ) {return AliHMPIDParam::A2C(fPad[ddl][row][dil][pad]); } //chamber number | |
37 | ||
38 | Int_t GetDDLNumber() const { return fDDLNumber; } // Provide current DDL number | |
39 | inline Int_t GetCharge(Int_t ddl,Int_t row, Int_t dilogic, Int_t pad); // Provide the charge observed in certain row,dilogic,pad channel | |
40 | inline Int_t GetPad(Int_t ddl,Int_t row,Int_t dil,Int_t pad); // | |
41 | ||
42 | Int_t Pc ( Int_t ddl,Int_t row,Int_t dil,Int_t pad ) {return AliHMPIDParam::A2P(fPad[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(fPad[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(fPad[ddl][row][dil][pad]);} //pad pc y # 0..47 | |
45 | ||
46 | inline Bool_t SetZeroSup (Bool_t isSup); | |
47 | inline Bool_t GetZeroSup(); | |
48 | inline Int_t GetErrors(Int_t eType); //Get errors and occurance | |
49 | ||
50 | inline void Raw (UInt_t &w32,Int_t &ddl,Int_t &r,Int_t &d,Int_t &a); //digit->(w32,ddl,r,d,a) | |
51 | inline void Raw (Int_t ddl,Int_t r,Int_t d,Int_t a); //raw->abs pad number | |
52 | inline Bool_t Raw (UInt_t w32,Int_t ddl,AliRawReader *pRR); //(w32,ddl)->digit | |
53 | inline void SetCharge (Int_t ddl,Int_t row,Int_t dil,Int_t pad,Int_t q); | |
54 | inline void WriteRaw (TObjArray *pDigLst ); //write as raw stream | |
55 | inline void WriteRowMarker (AliFstream *ddl,UInt_t size); | |
56 | inline void WriteEoE (AliFstream *ddl,UInt_t row,UInt_t dil,UInt_t wordCnt); | |
57 | inline void WriteSegMarker (AliFstream *ddl,UInt_t row); | |
58 | ||
59 | // inline TClonesArray ReMap(TClonesArray *pDigIn); | |
60 | ||
61 | enum EHMPIDRawStreamError { | |
62 | kRawDataSizeErr = 1, | |
63 | kRowMarkerErr = 2, | |
64 | kWrongRowErr = 3, | |
65 | kWrongDilogicErr = 4, | |
66 | kWrongPadErr = 5, | |
67 | kEoEFlagErr = 6, | |
68 | kEoESizeErr = 7, | |
69 | kEoEDILOGICErr = 8, | |
70 | kEoERowErr = 9, | |
71 | kBadSegWordErr = 10, | |
72 | kWrongSegErr = 11, | |
73 | kRowMarkerSizeErr = 12, | |
74 | kSumErr=13 //This is always the last one, to retreive the number of errors | |
75 | }; | |
76 | ||
77 | enum { | |
78 | kNRows = 24, // Number of rows (starting from 1 !)//was25 | |
79 | kNDILOGICAdd = 10, // Number of DILOGIC addresses in a row (starting from 1 !) //was11 | |
80 | kNPadAdd = 48, // Number of pad row | |
81 | kNRowsPerSegment = 8, // Number of rows per segment | |
82 | kNDDL = 14 | |
83 | }; | |
84 | enum EHMPIDRawError { | |
85 | kInvalidRawDataWord = 1 | |
86 | }; | |
87 | ||
88 | ||
89 | private : | |
90 | ||
91 | AliHMPIDRawStream& operator = (const AliHMPIDRawStream& stream); | |
92 | AliHMPIDRawStream(const AliHMPIDRawStream& stream); | |
93 | ||
94 | UInt_t GetNextWord(); | |
95 | ||
96 | Int_t fCharge[kNDDL][kNRows+1][kNDILOGICAdd+1][kNPadAdd]; // Array for charge values for all channels in one DDL | |
97 | ||
98 | Int_t fPad[kNDDL][kNRows+1][kNDILOGICAdd+1][kNPadAdd]; // Array for abs pad values for all channels in one DDL | |
99 | ||
100 | UInt_t fRawWord[kNDDL][kNRows+1][kNDILOGICAdd+1][kNPadAdd]; | |
101 | ||
102 | Int_t fNumOfErr[kSumErr]; // Store the numner of errors for a given error type | |
103 | ||
104 | Int_t fDDLNumber; // index of current DDL number | |
105 | ||
106 | AliRawReader* fRawReader; // object for reading the raw data | |
107 | ||
108 | UChar_t* fData; // raw data | |
109 | ||
110 | Int_t fPosition; // current position in fData | |
111 | ||
112 | Bool_t fZeroSup; | |
113 | ||
114 | ClassDef(AliHMPIDRawStream, 1) // base class for reading HMPID raw digits | |
115 | }; | |
116 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
117 | void AliHMPIDRawStream::Raw(UInt_t &w32,Int_t &ddl,Int_t &r,Int_t &d,Int_t &a) | |
118 | { | |
119 | // Convert raw stream word to raw word format | |
120 | // Arguments: w32,ddl,r,d,a where to write the results | |
121 | // Returns: none | |
122 | Int_t y2a[6]={5,3,1,0,2,4}; | |
123 | ||
124 | ddl=2*Ch(ddl,r,d,a)+Pc(ddl,r,d,a)%2; //DDL# 0..13 | |
125 | 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 | |
126 | d=1+PadPcX(ddl,r,d,a)/8; //DILOGIC# 1..10 | |
127 | a=y2a[PadPcY(ddl,r,d,a)%6]+6*(PadPcX(ddl,r,d,a)%8); //ADDRESS 0..47 | |
128 | ||
129 | w32=0; | |
130 | AliBitPacking::PackWord((fCharge[ddl][r][d][a]>4095)?4095:(UInt_t)fCharge[ddl][r][d][a],w32, 0,11); // 0000 0rrr rrdd ddaa aaaa qqqq qqqq qqqq Qdc bits (00..11) counts (0..4095) | |
131 | //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! | |
132 | 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) | |
133 | 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) | |
134 | assert(1<=r&&r<=24);AliBitPacking::PackWord( r ,w32,22,26); // Row number bits (22..26) counts (1..24) | |
135 | } | |
136 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
137 | void AliHMPIDRawStream::Raw(Int_t ddl,Int_t r,Int_t d,Int_t a) | |
138 | { | |
139 | //Assign absolute pad ID based on ddl,row,dil,pad | |
140 | //Arguments: DDL, row number, dilogic number, dilogic address(pad) | |
141 | //Returns : nothing | |
142 | ||
143 | assert(0<=ddl&&ddl<=13); assert(1<=r&&r<=24); assert(1<=d&&d<=10); assert(0<=a&&a<=47); | |
144 | Int_t a2y[6]={3,2,4,1,5,0};//pady for a given address (for single DILOGIC chip) | |
145 | Int_t ch=ddl/2; | |
146 | Int_t tmp=(r-1)/8; Int_t pc=(ddl%2)? 5-2*tmp:2*tmp; | |
147 | Int_t px=(d-1)*8+a/6; | |
148 | tmp=(ddl%2)?(24-r):r-1; Int_t py=6*(tmp%8)+a2y[a%6]; | |
149 | fPad[ddl][r][d][a]=AliHMPIDParam::Abs(ch,pc,px,py); | |
150 | } | |
151 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
152 | Bool_t AliHMPIDRawStream::Raw(UInt_t w32,Int_t ddl, AliRawReader *pRR) | |
153 | { | |
154 | // Converts a given raw data word to a digit | |
155 | // Arguments: w32 - 32 bits raw data word | |
156 | // ddl - DDL idx 0 1 2 3 4 ... 13 | |
157 | // Returns: none | |
158 | Int_t r = AliBitPacking::UnpackWord(w32,22,26); assert(1<=r&&r<=24); // Row number (1..24) | |
159 | 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) | |
160 | 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) | |
161 | Int_t q = AliBitPacking::UnpackWord(w32, 0,11); assert(0<=q&&q<=4095); // 0000 0rrr rrdd ddaa aaaa qqqq qqqq qqqq Qdc (0..4095) | |
162 | if (r<1 || r>24 || d<1 || d>10 || a<0 || a>47 || q<0 || q>4095) { | |
163 | AliWarning(Form("Invalid raw data word %x",w32)); | |
164 | pRR->AddMajorErrorLog(kInvalidRawDataWord,Form("w=%x",w32)); | |
165 | return kFALSE; | |
166 | } | |
167 | Raw(ddl,r,d,a); | |
168 | fCharge[ddl][r][d][a]=q; | |
169 | return kTRUE; | |
170 | } | |
171 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
172 | void AliHMPIDRawStream::SetCharge(Int_t ddl,Int_t row,Int_t dil,Int_t pad,Int_t q) | |
173 | { | |
174 | //Setter for the charger in the raw stream | |
175 | //Arguments: DDL, row number, dilogic number, dilogic address(pad), charge | |
176 | //Returns: Charge from the raw stream | |
177 | fCharge[ddl][row][dil][pad]=q; | |
178 | // return fCharge[ddl][row][dil][pad]; | |
179 | ||
180 | } | |
181 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
182 | Int_t AliHMPIDRawStream::GetPad(Int_t ddl,Int_t row,Int_t dil,Int_t pad) | |
183 | { | |
184 | // The method returns the absolute pad number or -1 | |
185 | // in case the charge from the channels | |
186 | // has not been read or invalid arguments | |
187 | ||
188 | assert(0<=ddl&&ddl<=13); | |
189 | assert(1<=row&&row<=24); | |
190 | assert(1<=dil&&dil<=10); | |
191 | assert(0<=pad&&pad<=47); | |
192 | ||
193 | Int_t a2y[6]={3,2,4,1,5,0}; //pady for a given padress (for single DILOGIC chip) | |
194 | Int_t ch=ddl/2; | |
195 | Int_t tmp=(row-1)/8; Int_t pc=(ddl%2)? 5-2*tmp:2*tmp; | |
196 | Int_t px=(dil-1)*8+pad/6; | |
197 | tmp=(ddl%2)?(24-row):row-1; | |
198 | Int_t py=6*(tmp%8)+a2y[pad%6]; | |
199 | ||
200 | return fPad[ddl][row][dil][pad]=AliHMPIDParam::Abs(ch,pc,px,py); | |
201 | }//GetPad() | |
202 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
203 | Int_t AliHMPIDRawStream::GetCharge(Int_t ddl,Int_t row, Int_t dilogic, Int_t pad) | |
204 | { | |
205 | // The method returns the charge collected | |
206 | // in a particular channel | |
207 | // Return -1 in case the charge from the channels | |
208 | // has not been read or invalid arguments | |
209 | if (ddl < 0 || ddl > kNDDL) { | |
210 | AliError(Form("Wrong DDL index %d!",ddl)); | |
211 | return 0; | |
212 | } | |
213 | if (row < 1 || row > kNRows) { | |
214 | AliError(Form("Wrong row index %d!",row)); | |
215 | return 0; | |
216 | } | |
217 | ||
218 | if (dilogic < 1 || dilogic > kNDILOGICAdd) { | |
219 | AliError(Form("Wrong DILOGIC address %d!",dilogic)); | |
220 | return 0; | |
221 | } | |
222 | ||
223 | if (pad >= kNPadAdd) { | |
224 | AliError(Form("Wrong pad index %d!",pad)); | |
225 | return 0; | |
226 | } | |
227 | ||
228 | return fCharge[ddl][row][dilogic][pad]; | |
229 | ||
230 | } | |
231 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
232 | void AliHMPIDRawStream::WriteRowMarker(AliFstream *ddl,UInt_t size) | |
233 | { | |
234 | //Writes the row marker for real data and pedestal into the ddl stream | |
235 | //Arguments: ddl stream and the size of the block of the given row, the siye is at least the 10 EoE words! | |
236 | //Returns: nothing | |
237 | UInt_t w32=0; | |
238 | UInt_t marker=12968; //ror marker: 32a8 in hexa; 12968 in decimal | |
239 | AliBitPacking::PackWord(size, w32, 16,31); //number of roaw written after row marker (digits and EoE) | |
240 | AliBitPacking::PackWord(marker,w32,0,15); //32a8=12968 | |
241 | ddl->WriteBuffer((char*)&w32,sizeof(w32)); | |
242 | } | |
243 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
244 | void AliHMPIDRawStream::WriteEoE(AliFstream *ddl,UInt_t row,UInt_t dil,UInt_t wordCnt ) | |
245 | { | |
246 | //Writes the EoE word from real data and pedestals into the ddl stream | |
247 | //Arguments: ddl stream, row number, dilogic number and the number of words before the EoE | |
248 | //Retursns: nothing | |
249 | UInt_t e=1; | |
250 | UInt_t w32=0; | |
251 | assert(1<=row&&row<=24); AliBitPacking::PackWord((UInt_t)row ,w32,22,26); // row number (1...24) | |
252 | assert(1<=dil&&dil<=10); AliBitPacking::PackWord((UInt_t)dil ,w32,18,21); // DILOGIC number (1...10) | |
253 | AliBitPacking::PackWord( e ,w32, 7,17); // event number -- not used | |
254 | 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 | |
255 | AliBitPacking::PackWord((UInt_t)1 ,w32,27,27); // bit 27 is always 1 by definition of EoE | |
256 | ddl->WriteBuffer((char*)&w32,sizeof(w32)); | |
257 | } | |
258 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
259 | void AliHMPIDRawStream::WriteSegMarker(AliFstream *ddl,UInt_t row) | |
260 | { | |
261 | //Writes the segment marker (after 8 rows) into the ddl stream | |
262 | //Arguments: ddl stream and the segment: row 8 -> 0x5900, row 16 -> 5901, row 24 -> 5902 | |
263 | //Retruns: nothing | |
264 | UInt_t w32=0; | |
265 | AliBitPacking::PackWord((UInt_t)43791, w32,16,31); //43791==AB0F | |
266 | AliBitPacking::PackWord((UInt_t)(22784+row/8),w32, 0,15); //22784==5900 | |
267 | ddl->WriteBuffer((char*)&w32,sizeof(w32)); | |
268 | } | |
269 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
270 | Bool_t AliHMPIDRawStream::SetZeroSup (Bool_t isSup) | |
271 | { | |
272 | //Prevision to turn OFF zero suppression | |
273 | //Arguments: setter | |
274 | //Returns: switch | |
275 | fZeroSup=isSup; | |
276 | return fZeroSup; | |
277 | } | |
278 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
279 | Bool_t AliHMPIDRawStream::GetZeroSup() | |
280 | { | |
281 | if(fZeroSup==kTRUE) return kTRUE; | |
282 | else return kFALSE; | |
283 | } | |
284 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
285 | void AliHMPIDRawStream::WriteRaw(TObjArray *pDigAll) | |
286 | { | |
287 | // Write a list of digits for a given chamber in raw data stream | |
288 | // Arguments: pDigAll- list of digits | |
289 | // Returns: none | |
290 | Int_t ddl,r,d,a; //32 bits data word | |
291 | Int_t cntLpad,cntRpad; | |
292 | Int_t cntLrow,cntRrow; | |
293 | Int_t cntL=0,cntR=0; //data words counters for DDLs | |
294 | Int_t cntLeoe,cntReoe; | |
295 | UInt_t posL,posR; | |
296 | UInt_t cntLseg,cntRseg; | |
297 | Int_t cntRdig=0,cntLdig=0; | |
298 | ||
299 | UInt_t posLmarker,posRmarker; | |
300 | Int_t digcnt=0; | |
301 | ||
302 | Int_t isDigThere[14][25][11][48]; | |
303 | ||
304 | for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++){//chambers loop | |
305 | cntL=0;cntR=0; | |
306 | for(Int_t iddl=0;iddl<14;iddl++){ | |
307 | for(Int_t irow=1;irow<=24;irow++){ | |
308 | for(Int_t idil=1;idil<=10;idil++){ | |
309 | for(Int_t ipad=0;ipad<48;ipad++){ | |
310 | isDigThere[iddl][irow][idil][ipad]=-1; | |
311 | } | |
312 | } | |
313 | } | |
314 | } | |
315 | ||
316 | AliFstream* ddlL; //output streams, 2 per chamber | |
317 | AliFstream* ddlR; | |
318 | ||
319 | AliRawDataHeaderSim header; header.SetAttribute(0); //empty DDL header | |
320 | ||
321 | ddlL = new AliFstream(AliDAQ::DdlFileName("HMPID",2*iCh+1)); //left and right looking at the IP | |
322 | ddlR = new AliFstream(AliDAQ::DdlFileName("HMPID",2*iCh)); //open both DDL of this chamber in parallel | |
323 | ||
324 | ddlL->WriteBuffer((char*)&header,sizeof(header)); //write dummy header as place holder, actual | |
325 | ddlR->WriteBuffer((char*)&header,sizeof(header)); //will be rewritten later when total size of DDL is known | |
326 | ||
327 | UInt_t w32=0; //32 bits data word | |
328 | digcnt=0; | |
329 | ||
330 | TClonesArray *pDigCh=(TClonesArray *)pDigAll->At(iCh); //list of digits for current chamber | |
331 | //Printf("::::::::::::::::::; Number of Digits to write: %d == %d",pDigCh->GetEntriesFast(),pDigCh->GetEntries()); | |
332 | for(Int_t iDig=0;iDig<pDigCh->GetEntriesFast();iDig++){//digits loop | |
333 | AliHMPIDDigit *pDig1=(AliHMPIDDigit*)pDigCh->At(iDig); | |
334 | pDig1->Raw(w32,ddl,r,d,a); | |
335 | isDigThere[ddl][r][d][a]=iDig; | |
336 | } | |
337 | ||
338 | for(Int_t row = 1; row <= AliHMPIDRawStream::kNRows; row++){ //AliHMPIDRawStream::kNRows=25! | |
339 | cntRrow=0;cntLrow=0;cntLseg=0;cntRseg=0;// | |
340 | cntLeoe=0;cntReoe=0; | |
341 | posLmarker=ddlL->Tellp(); WriteRowMarker(ddlL,(UInt_t)1); cntL++; cntRrow++; | |
342 | posRmarker=ddlR->Tellp(); WriteRowMarker(ddlR,(UInt_t)1); cntR++; cntLrow++; | |
343 | for(Int_t dil = 1; dil <= AliHMPIDRawStream::kNDILOGICAdd; dil++){ //AliHMPIDRawStream::kNDILOGICAdd = 11! | |
344 | cntLpad=0;cntRpad=0; | |
345 | for(Int_t pad = 0; pad < AliHMPIDRawStream::kNPadAdd; pad++){ //AliHMPIDRawStream::kNPadAdd = 48 | |
346 | for ( Int_t iddl=2*iCh; iddl<=2*iCh+1;iddl++){ | |
347 | if (isDigThere[iddl][row][dil][pad]!=-1) { | |
348 | AliHMPIDDigit *pDig=(AliHMPIDDigit*)pDigCh->At(isDigThere[iddl][row][dil][pad]); | |
349 | pDig->Raw(w32,ddl,r,d,a); | |
350 | if(pDig->Q() < 0 ) continue; //We can turn of the zero sup for pedestal simulation | |
351 | //Printf("::::::::::::::: ddl from Digit : %d",ddl); | |
352 | if(ddl%2){ //write raw digit selecting on DDL | |
353 | ddlL->WriteBuffer((char*)&w32,sizeof(w32)); cntL++; cntLpad++; cntLrow++; cntLdig++;//Printf(" WL: %x isDig: %d",w32,isDigThere[iddl][row][dil][pad]); | |
354 | }else{ | |
355 | ddlR->WriteBuffer((char*)&w32,sizeof(w32)); cntR++; cntRpad++; cntRrow++; cntRdig++;//Printf(" WR: %x isDig: %d",w32,isDigThere[iddl][row][dil][pad]); | |
356 | } | |
357 | }//ddl | |
358 | }//isDig | |
359 | }//pad | |
360 | WriteEoE(ddlL,row,dil,cntLpad); cntL++; cntLrow++; cntLeoe++; //molnarl: write EoE markers | |
361 | WriteEoE(ddlR,row,dil,cntRpad); cntR++; cntRrow++; cntReoe++; | |
362 | }//dil | |
363 | if(row%8==0){ | |
364 | WriteSegMarker(ddlL,row); cntL++; cntLseg++; | |
365 | WriteSegMarker(ddlR,row); cntR++; cntRseg++; | |
366 | } | |
367 | 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 | |
368 | posR=ddlR->Tellp(); ddlR->Seekp(posRmarker); WriteRowMarker(ddlR,(UInt_t)(cntRrow-1)); ddlR->Seekp(posR); | |
369 | }//row | |
370 | header.fSize=sizeof(header)+cntL*sizeof(w32); ddlL->Seekp(0); ddlL->WriteBuffer((char*)&header,sizeof(header)); delete ddlL; //rewrite header with size set to | |
371 | header.fSize=sizeof(header)+cntR*sizeof(w32); ddlR->Seekp(0); ddlR->WriteBuffer((char*)&header,sizeof(header)); delete ddlR; //number of bytes and close file | |
372 | ||
373 | //Printf("In Ch %d # digits written to LDD %d RDDL %d",iCh,cntLdig,cntRdig); | |
374 | ||
375 | }//chambers loop | |
376 | }//WriteRaw() | |
377 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
378 | Int_t AliHMPIDRawStream::GetErrors(Int_t eType) | |
379 | { | |
380 | // Return the number of errors for a given error tye during raw data reading | |
381 | // Arguments: errorType | |
382 | // Returns: error or -999 if error Type does not exist | |
383 | ||
384 | if(eType < 1 || eType> kSumErr-1 ) return -999; | |
385 | else | |
386 | return fNumOfErr[eType]; | |
387 | ||
388 | ||
389 | } //GetErrors() | |
390 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
391 | #endif |