]>
Commit | Line | Data |
---|---|---|
571dda3d | 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 | /* | |
d0eb8f39 | 17 | $Log$ |
f1aa96cc | 18 | Revision 1.9 2006/10/13 11:22:27 arcelli |
19 | remove warnings due to uninitialized AliTOFtdcDigit data members | |
20 | ||
36f66fad | 21 | Revision 1.8 2006/08/22 13:30:17 arcelli |
22 | removal of effective c++ warnings (C.Zampolli) | |
23 | ||
655e379f | 24 | Revision 1.7 2006/08/10 14:46:54 decaro |
25 | TOF raw data format: updated version | |
26 | ||
d0eb8f39 | 27 | Revision 1.6.1 2006/06/28 A. De Caro, R. Preghenella: |
28 | Update TOF raw data format | |
29 | according to the final version | |
30 | (see the ALICE internal note in preparation | |
31 | 'ALICE TOF raw data format') | |
32 | Added the methods for the correspoonding numbering | |
33 | between the equipment IDs and the volume IDs: | |
34 | Equip2VolNPlate(...) | |
35 | Equip2VolNStrip(...) | |
36 | Equip2VolNPad(...) | |
37 | ||
571dda3d | 38 | Revision 0.02 2005/07/28 A. De Caro: |
39 | Update format TOF raw data | |
40 | (temporary solution) | |
41 | Correction of few wrong corrispondences | |
42 | between 'software' and 'hardware' numberings | |
43 | ||
44 | Revision 0.01 2005/07/22 A. De Caro | |
45 | Implement methods Next() | |
46 | GetSector(), | |
47 | GetPlate(), | |
48 | GetStrip(), | |
49 | GetPadZ(), | |
50 | GetPadX() | |
51 | */ | |
52 | ||
0e46b9ae | 53 | //////////////////////////////////////////////////////////////////////// |
54 | // // | |
55 | // This class provides access to TOF raw data in DDL files. // | |
56 | // // | |
57 | // It loops over all TOF raw data given by the AliRawReader. // | |
58 | // // | |
59 | //////////////////////////////////////////////////////////////////////// | |
571dda3d | 60 | |
d0eb8f39 | 61 | #include "AliLog.h" |
571dda3d | 62 | #include "AliRawReader.h" |
63 | ||
64 | #include "AliTOFGeometry.h" | |
303e152f | 65 | #include "AliTOFGeometryV5.h" |
571dda3d | 66 | #include "AliTOFRawStream.h" |
67 | ||
d0eb8f39 | 68 | |
69 | /****************************************** | |
70 | GENERAL DATA FORMAT | |
71 | ******************************************/ | |
72 | ||
73 | //filler | |
74 | #define FILLER 0x70000000 | |
75 | ||
76 | //word type mask/position | |
77 | #define WORD_TYPE_MASK 0xf0000000 | |
78 | #define WORD_TYPE_POSITION 28 | |
79 | ||
80 | //global header word required bit pattern | |
81 | #define GLOBAL_HEADER 0x40000000 | |
82 | ||
83 | //global trailer word required bit pattern | |
84 | #define GLOBAL_TRAILER 0x50000000 | |
85 | ||
86 | //error word required bit pattern | |
87 | #define ERROR 0x30000000 | |
88 | ||
89 | //header slot ID mask/position | |
90 | #define HEADER_SLOT_ID_MASK 0x0000000f | |
91 | #define HEADER_SLOT_ID_POSITION 0 | |
92 | ||
93 | //word types | |
94 | #define GLOBAL_HEADER_TYPE 4 | |
95 | #define GLOBAL_TRAILER_TYPE 5 | |
96 | #define ERROR_TYPE 6 | |
97 | #define FILLER_TYPE 7 | |
98 | #define TRM_CHAIN0_HEADER_TYPE 0 | |
99 | #define TRM_CHAIN0_TRAILER_TYPE 1 | |
100 | #define TRM_CHAIN1_HEADER_TYPE 2 | |
101 | #define TRM_CHAIN1_TRAILER_TYPE 3 | |
102 | ||
103 | //slot types | |
104 | #define DRM_ID_NUMBER 1 | |
105 | #define LTM_ID_NUMBER 2 | |
106 | ||
107 | ||
108 | /****************************************** | |
109 | DRM DATA FORMAT | |
110 | ******************************************/ | |
111 | ||
112 | //DRM global header word required bit pattern | |
113 | #define DRM_GLOBAL_HEADER 0x40000001 | |
114 | ||
115 | //DRM event words mask/position | |
116 | #define DRM_EVENT_WORDS_MASK 0x001ffff0 | |
117 | #define DRM_EVENT_WORDS_POSITION 4 | |
118 | ||
119 | //DRM DRM ID mask/position | |
120 | #define DRM_DRM_ID_MASK 0x0fe00000 | |
121 | #define DRM_DRM_ID_POSITION 21 | |
122 | ||
123 | //DRM status header 1 word required bit pattern | |
124 | #define DRM_STATUS_HEADER_1 0x40000001 | |
125 | ||
126 | //DRM slot ID mask/position | |
127 | #define DRM_SLOT_ID_MASK 0x00007ff0 | |
128 | #define DRM_SLOT_ID_POSITION 4 | |
129 | ||
130 | //DRM C-bit mask/position | |
131 | #define DRM_C_BIT_MASK 0x00008000 | |
132 | #define DRM_C_BIT_POSITION 15 | |
133 | ||
134 | //DRM status header 2 word required bit pattern | |
135 | #define DRM_STATUS_HEADER_2 0x40000001 | |
136 | ||
137 | //DRM enable ID mask/position | |
138 | #define DRM_ENABLE_ID_MASK 0x00007ff0 | |
139 | #define DRM_ENABLE_ID_POSITION 4 | |
140 | ||
141 | //DRM fault ID mask/position | |
142 | #define DRM_FAULT_ID_MASK 0x07ff0000 | |
143 | #define DRM_FAULT_ID_POSITION 16 | |
144 | ||
145 | //DRM status header 3 word required bit pattern | |
146 | #define DRM_STATUS_HEADER_3 0x40000001 | |
147 | ||
148 | //DRM TTC event counter mask/position | |
149 | #define DRM_TTC_EVENT_COUNTER_MASK 0x0ffffff0 | |
150 | #define DRM_TTC_EVENT_COUNTER_POSITION 4 | |
151 | ||
152 | //DRM event CRC mask/position | |
153 | //#define DRM_EVENT_CRC_MASK 0x001ffff0 | |
154 | #define DRM_EVENT_CRC_MASK 0x000ffff0 | |
155 | #define DRM_EVENT_CRC_POSITION 4 | |
156 | ||
157 | //DRM global trailer word required bit pattern | |
158 | #define DRM_GLOBAL_TRAILER 0x50000001 | |
159 | ||
160 | //DRM local event counter mask/position | |
161 | #define DRM_LOCAL_EVENT_COUNTER_MASK 0x0000fff0 | |
162 | #define DRM_LOCAL_EVENT_COUNTER_POSITION 4 | |
163 | ||
164 | ||
165 | /****************************************** | |
166 | TRM DATA FORMAT | |
167 | ******************************************/ | |
168 | ||
169 | //TRM global header word required bit pattern | |
170 | #define TRM_GLOBAL_HEADER 0x40000000 | |
171 | ||
172 | //TRM slot ID mask/position | |
173 | #define TRM_SLOT_ID_MASK 0x0000000f | |
174 | #define TRM_SLOT_ID_POSITION 0 | |
175 | ||
176 | //TRM event words mask/position | |
177 | #define TRM_EVENT_WORDS_MASK 0x0001fff0 | |
178 | #define TRM_EVENT_WORDS_POSITION 4 | |
179 | ||
180 | //TRM ACQ-bits mask/position | |
181 | #define TRM_ACQ_BITS_MASK 0x00060000 | |
182 | #define TRM_ACQ_BITS_POSITION 17 | |
183 | ||
184 | //TRM L-bit mask/position | |
185 | #define TRM_L_BIT_MASK 0x00080000 | |
186 | #define TRM_L_BIT_POSITION 19 | |
187 | ||
188 | //TRM chain-0 header word required bit pattern | |
189 | #define TRM_CHAIN_0_HEADER 0x00000000 | |
190 | ||
191 | //TRM chain-1 header word required bit pattern | |
192 | #define TRM_CHAIN_1_HEADER 0x20000000 | |
193 | ||
194 | //TRM bunch ID mask/position | |
195 | #define TRM_BUNCH_ID_MASK 0x0000fff0 | |
196 | #define TRM_BUNCH_ID_POSITION 4 | |
197 | ||
198 | //TRM PB24 temp mask/position | |
199 | #define TRM_PB24_TEMP_MASK 0x00ff0000 | |
200 | #define TRM_PB24_TEMP_POSITION 16 | |
201 | ||
202 | //TRM PB24 ID mask/position | |
203 | #define TRM_PB24_ID_MASK 0x07000000 | |
204 | #define TRM_PB24_ID_POSITION 24 | |
205 | ||
206 | //TRM TS-bit mask/position | |
207 | #define TRM_TS_BIT_MASK 0x08000000 | |
208 | #define TRM_TS_BIT_POSITION 27 | |
209 | ||
210 | //TRM chain-0 trailer word required bit pattern | |
211 | #define TRM_CHAIN_0_TRAILER 0x10000000 | |
212 | ||
213 | //TRM chain-1 trailer word required bit pattern | |
214 | #define TRM_CHAIN_1_TRAILER 0x30000000 | |
215 | ||
216 | //TRM status mask/position | |
217 | #define TRM_STATUS_MASK 0x0000000f | |
218 | #define TRM_STATUS_POSITION 0 | |
219 | ||
220 | ||
221 | //TDC digit | |
222 | ||
223 | //TRM TDC digit word required bit pattern | |
224 | #define TRM_TDC_DIGIT 0x8000000 | |
225 | ||
226 | //TRM digit time mask/position | |
227 | #define TRM_DIGIT_TIME_MASK 0x00001fff | |
228 | #define TRM_DIGIT_TIME_POSITION 0 | |
229 | ||
230 | //TRM long digit time mask/position | |
231 | #define TRM_LONG_DIGIT_TIME_MASK 0x001fffff | |
232 | #define TRM_LONG_DIGIT_TIME_POSITION 0 | |
233 | ||
234 | //TRM TOT width mask/position | |
235 | #define TRM_TOT_WIDTH_MASK 0x001fe000 | |
236 | #define TRM_TOT_WIDTH_POSITION 13 | |
237 | ||
238 | //TRM chan mask/position | |
239 | #define TRM_CHAN_MASK 0x00e00000 | |
240 | #define TRM_CHAN_POSITION 21 | |
241 | ||
242 | //TRM TDC ID mask/position | |
243 | #define TRM_TDC_ID_MASK 0x0f000000 | |
244 | #define TRM_TDC_ID_POSITION 24 | |
245 | ||
246 | //TRM E-bit mask/position | |
247 | #define TRM_E_BIT_MASK 0x10000000 | |
248 | #define TRM_E_BIT_POSITION 28 | |
249 | ||
250 | //TRM PS-bits mask/position | |
251 | #define TRM_PS_BITS_MASK 0x60000000 | |
252 | #define TRM_PS_BITS_POSITION 29 | |
253 | ||
254 | ||
255 | //TRM errors | |
256 | ||
257 | //TRM TDC error word required bit pattern | |
258 | #define TRM_TDC_ERROR 0x6000000 | |
259 | ||
260 | //TRM TDC diagnostic error word required bit pattern | |
261 | #define TRM_TDC_DIAGNOSTIC_ERROR 0x6f00000 | |
262 | ||
263 | //TRM TDC error flags mask/position | |
264 | #define TRM_TDC_ERROR_FLAGS_MASK 0x00007fff | |
265 | #define TRM_TDC_ERROR_FLAGS_POSITION 0 | |
266 | ||
267 | //TRM TDC error TDC ID mask/position | |
268 | #define TRM_TDC_ERROR_TDC_ID_MASK 0x0f00000 | |
269 | #define TRM_TDC_ERROR_TDC_ID_POSITION 24 | |
270 | ||
271 | //TRM TDC fault chip flag ID mask/position | |
272 | #define TRM_TDC_ERROR_FAULT_CHIP_FLAG_ID_MASK 0x00007fff | |
273 | #define TRM_TDC_ERROR_FAULT_CHIP_FLAG_ID_POSITION 0 | |
274 | ||
275 | //TRM TDC error C-bit mask/position | |
276 | #define TRM_TDC_ERROR_C_BIT_MASK 0x00008000 | |
277 | #define TRM_TDC_ERROR_C_BIT_POSITION 15 | |
278 | ||
279 | //TRM TDC JTAG error code mask/position | |
280 | #define TRM_TDC_ERROR_JTAG_ERROR_CODE_MASK 0x000007ff | |
281 | #define TRM_TDC_ERROR_JTAG_ERROR_CODE_POSITION 0 | |
282 | ||
283 | //TRM TDC disgnostic error TDC ID mask/position | |
284 | #define TRM_TDC_DIAGNOSTIC_ERROR_TDC_ID_MASK 0x00007800 | |
285 | #define TRM_TDC_DIAGNOSTIC_ERROR_TDC_ID_POSITION 11 | |
286 | ||
287 | //TRM global trailer word required bit pattern | |
288 | //#define TRM_GLOBAL_TRAILER 0x50000000 | |
289 | #define TRM_GLOBAL_TRAILER 0x5000000f | |
290 | ||
291 | //TRM event CRC mask/position | |
292 | #define TRM_EVENT_CRC_MASK 0x0000fff0 | |
293 | #define TRM_EVENT_CRC_POSITION 4 | |
294 | ||
295 | //TRM event counter mask/position | |
296 | #define TRM_EVENT_COUNTER_MASK 0x0fff0000 | |
297 | #define TRM_EVENT_COUNTER_POSITION 16 | |
298 | ||
299 | ||
300 | /****************************************** | |
301 | LTM DATA FORMAT | |
302 | ******************************************/ | |
303 | ||
304 | //LTM global header word required bit pattern | |
305 | #define LTM_GLOBAL_HEADER 0x40000002 | |
306 | ||
307 | //LTM event words mask/position | |
308 | #define LTM_EVENT_WORDS_MASK 0x0001fff0 | |
309 | #define LTM_EVENT_WORDS_POSITION 4 | |
310 | ||
311 | //LTM C-bit mask/position | |
312 | #define LTM_C_BIT_MASK 0x00020000 | |
313 | #define LTM_C_BIT_POSITION 17 | |
314 | ||
315 | //LTM fault mask/position | |
316 | #define LTM_FAULT_MASK 0x00fc0000 | |
317 | #define LTM_FAULT_POSITION 18 | |
318 | ||
319 | //PDL data | |
320 | ||
321 | //PDL value 1 mask/position | |
322 | #define LTM_PDL_VALUE_1_MASK 0x000000ff | |
323 | #define LTM_PDL_VALUE_1_POSITION 0 | |
324 | ||
325 | //PDL value 2 mask/position | |
326 | #define LTM_PDL_VALUE_2_MASK 0x0000ff00 | |
327 | #define LTM_PDL_VALUE_2_POSITION 8 | |
328 | ||
329 | //PDL value 3 mask/position | |
330 | #define LTM_PDL_VALUE_3_MASK 0x00ff0000 | |
331 | #define LTM_PDL_VALUE_3_POSITION 16 | |
332 | ||
333 | //PDL value 4 mask/position | |
334 | #define LTM_PDL_VALUE_4_MASK 0xff000000 | |
335 | #define LTM_PDL_VALUE_4_POSITION 24 | |
336 | ||
337 | //ADC data | |
338 | ||
339 | //ADC value 1 mask/position | |
340 | #define LTM_ADC_VALUE_1_MASK 0x000003ff | |
341 | #define LTM_ADC_VALUE_1_POSITION 0 | |
342 | ||
343 | //ADC value 2 mask/position | |
344 | #define LTM_ADC_VALUE_2_MASK 0x000ffc00 | |
345 | #define LTM_ADC_VALUE_2_POSITION 10 | |
346 | ||
347 | //ADC value 3 mask/position | |
348 | #define LTM_ADC_VALUE_3_MASK 0x3ff00000 | |
349 | #define LTM_ADC_VALUE_3_POSITION 20 | |
350 | ||
351 | //LTM global trailer word required bit pattern | |
352 | #define LTM_GLOBAL_TRAILER 0x50000002 | |
353 | ||
354 | //LTM event CRC mask/position | |
355 | #define LTM_EVENT_CRC_MASK 0x0000fff0 | |
356 | #define LTM_EVENT_CRC_POSITION 4 | |
357 | ||
358 | //LTM event number mask/position | |
359 | #define LTM_EVENT_NUMBER_MASK 0x0fff0000 | |
360 | #define LTM_EVENT_NUMBER_POSITION 16 | |
361 | ||
362 | ||
571dda3d | 363 | ClassImp(AliTOFRawStream) |
364 | ||
365 | ||
366 | //_____________________________________________________________________________ | |
655e379f | 367 | AliTOFRawStream::AliTOFRawStream(AliRawReader* rawReader): |
368 | fRawReader(0x0), | |
369 | fDDL(-1), | |
370 | fTRM(-1), | |
371 | fTDC(-1), | |
372 | fTRMchain(-1), | |
373 | fTDCchannel(-1), | |
374 | fTof(-1), | |
375 | fToT(-1), | |
376 | fErrorFlag(-1), | |
377 | ||
378 | fSector(-1), | |
379 | fPlate(-1), | |
380 | fStrip(-1), | |
381 | fPadX(-1), | |
382 | fPadZ(-1), | |
383 | fTOFGeometry(new AliTOFGeometryV5()), | |
384 | fWordType(-1), | |
385 | fSlotID(-1), | |
386 | fACQ(-1), | |
387 | fPSbit(-1), | |
388 | fTime(-1), | |
389 | fTDCerrorFlag(-1), | |
390 | fInsideDRM(kFALSE), | |
391 | fInsideTRM(kFALSE), | |
392 | fInsideLTM(kFALSE), | |
393 | fInsideTRMchain0(kFALSE), | |
394 | fInsideTRMchain1(kFALSE), | |
395 | fLeadingOrphane(kFALSE) | |
571dda3d | 396 | { |
397 | // | |
398 | // create an object to read TOF raw digits | |
399 | // | |
400 | ||
401 | fRawReader = rawReader; | |
655e379f | 402 | /* |
571dda3d | 403 | fDDL = -1; |
404 | fTRM = -1; | |
405 | fTDC = -1; | |
d0eb8f39 | 406 | fTRMchain = -1; |
407 | fTDCchannel = -1; | |
571dda3d | 408 | fTof = -1; |
d0eb8f39 | 409 | fToT = -1; |
571dda3d | 410 | fErrorFlag = -1; |
d0eb8f39 | 411 | |
412 | fSector = -1; | |
413 | fPlate = -1; | |
414 | fStrip = -1; | |
415 | fPadX = -1; | |
416 | fPadZ = -1; | |
303e152f | 417 | fTOFGeometry = new AliTOFGeometryV5(); |
655e379f | 418 | */ |
362c9d61 | 419 | fRawReader->Select("TOF"); |
655e379f | 420 | /* |
d0eb8f39 | 421 | fWordType = -1; |
422 | fSlotID = -1; | |
423 | fACQ = -1; | |
424 | fPSbit = -1; | |
425 | fTime = -1; | |
426 | fTDCerrorFlag = -1; | |
427 | fInsideDRM = kFALSE; | |
428 | fInsideTRM = kFALSE; | |
429 | fInsideLTM = kFALSE; | |
430 | fInsideTRMchain0 = kFALSE; | |
431 | fInsideTRMchain1 = kFALSE; | |
432 | fLeadingOrphane = kFALSE; | |
655e379f | 433 | */ |
571dda3d | 434 | } |
435 | ||
436 | //_____________________________________________________________________________ | |
655e379f | 437 | AliTOFRawStream::AliTOFRawStream(): |
438 | fRawReader(0x0), | |
439 | fDDL(-1), | |
440 | fTRM(-1), | |
441 | fTDC(-1), | |
442 | fTRMchain(-1), | |
443 | fTDCchannel(-1), | |
444 | fTof(-1), | |
445 | fToT(-1), | |
446 | fErrorFlag(-1), | |
447 | ||
448 | fSector(-1), | |
449 | fPlate(-1), | |
450 | fStrip(-1), | |
451 | fPadX(-1), | |
452 | fPadZ(-1), | |
453 | fTOFGeometry(new AliTOFGeometryV5()), | |
454 | fWordType(-1), | |
455 | fSlotID(-1), | |
456 | fACQ(-1), | |
457 | fPSbit(-1), | |
458 | fTime(-1), | |
459 | fTDCerrorFlag(-1), | |
460 | fInsideDRM(kFALSE), | |
461 | fInsideTRM(kFALSE), | |
462 | fInsideLTM(kFALSE), | |
463 | fInsideTRMchain0(kFALSE), | |
464 | fInsideTRMchain1(kFALSE), | |
465 | fLeadingOrphane(kFALSE) | |
571dda3d | 466 | { |
467 | // | |
d0eb8f39 | 468 | // default ctr |
571dda3d | 469 | // |
655e379f | 470 | /* |
d0eb8f39 | 471 | fRawReader = 0x0; |
571dda3d | 472 | fDDL = -1; |
473 | fTRM = -1; | |
474 | fTDC = -1; | |
d0eb8f39 | 475 | fTRMchain = -1; |
476 | fTDCchannel = -1; | |
571dda3d | 477 | fTof = -1; |
d0eb8f39 | 478 | fToT = -1; |
571dda3d | 479 | fErrorFlag = -1; |
d0eb8f39 | 480 | |
481 | fSector = -1; | |
482 | fPlate = -1; | |
483 | fStrip = -1; | |
484 | fPadX = -1; | |
485 | fPadZ = -1; | |
303e152f | 486 | fTOFGeometry = new AliTOFGeometryV5(); |
d0eb8f39 | 487 | fWordType = -1; |
488 | fSlotID = -1; | |
489 | fACQ = -1; | |
490 | fPSbit = -1; | |
491 | fTime = -1; | |
492 | fTDCerrorFlag = -1; | |
493 | fInsideDRM = kFALSE; | |
494 | fInsideTRM = kFALSE; | |
495 | fInsideLTM = kFALSE; | |
496 | fInsideTRMchain0 = kFALSE; | |
497 | fInsideTRMchain1 = kFALSE; | |
498 | fLeadingOrphane = kFALSE; | |
655e379f | 499 | */ |
d0eb8f39 | 500 | } |
501 | ||
502 | //_____________________________________________________________________________ | |
503 | AliTOFRawStream::AliTOFRawStream(const AliTOFRawStream& stream) : | |
655e379f | 504 | TObject(stream), |
505 | fRawReader(0x0), | |
506 | fDDL(-1), | |
507 | fTRM(-1), | |
508 | fTDC(-1), | |
509 | fTRMchain(-1), | |
510 | fTDCchannel(-1), | |
511 | fTof(-1), | |
512 | fToT(-1), | |
513 | fErrorFlag(-1), | |
514 | ||
515 | fSector(-1), | |
516 | fPlate(-1), | |
517 | fStrip(-1), | |
518 | fPadX(-1), | |
519 | fPadZ(-1), | |
520 | fTOFGeometry(new AliTOFGeometryV5()), | |
521 | fWordType(-1), | |
522 | fSlotID(-1), | |
523 | fACQ(-1), | |
524 | fPSbit(-1), | |
525 | fTime(-1), | |
526 | fTDCerrorFlag(-1), | |
527 | fInsideDRM(kFALSE), | |
528 | fInsideTRM(kFALSE), | |
529 | fInsideLTM(kFALSE), | |
530 | fInsideTRMchain0(kFALSE), | |
531 | fInsideTRMchain1(kFALSE), | |
532 | fLeadingOrphane(kFALSE) | |
d0eb8f39 | 533 | { |
534 | // | |
535 | // copy constructor | |
536 | // | |
537 | ||
538 | fRawReader = stream.fRawReader; | |
539 | fDDL = stream.fDDL; | |
540 | fTRM = stream.fTRM; | |
541 | fTDC = stream.fTDC; | |
542 | fTRMchain = stream.fTRMchain; | |
543 | fTDCchannel = stream.fTDCchannel; | |
544 | fTof = stream.fTof; | |
545 | fToT = stream.fToT; | |
546 | fErrorFlag = stream.fErrorFlag; | |
547 | ||
548 | fSector = stream.fSector; | |
549 | fPlate = stream.fPlate; | |
550 | fStrip = stream.fStrip; | |
551 | fPadX = stream.fPadX; | |
552 | fPadZ = stream.fPadZ; | |
553 | ||
554 | fTOFGeometry = stream.fTOFGeometry; | |
555 | ||
556 | fWordType = stream.fWordType; | |
557 | fSlotID = stream.fSlotID; | |
558 | fACQ = stream.fACQ; | |
559 | fPSbit = stream.fPSbit; | |
560 | fTime = stream.fTime; | |
561 | fTDCerrorFlag = stream.fTDCerrorFlag; | |
562 | fInsideDRM = stream.fInsideDRM; | |
563 | fInsideTRM = stream.fInsideTRM; | |
564 | fInsideLTM = stream.fInsideLTM; | |
565 | fInsideTRMchain0 = stream.fInsideTRMchain0; | |
566 | fInsideTRMchain1 = stream.fInsideTRMchain1; | |
567 | fLeadingOrphane = stream.fLeadingOrphane; | |
568 | ||
571dda3d | 569 | } |
570 | ||
571 | //_____________________________________________________________________________ | |
572 | AliTOFRawStream& AliTOFRawStream::operator = (const AliTOFRawStream& stream) | |
573 | { | |
574 | // | |
575 | // assignment operator | |
576 | // | |
577 | ||
578 | fRawReader = stream.fRawReader; | |
579 | fDDL = stream.fDDL; | |
580 | fTRM = stream.fTRM; | |
581 | fTDC = stream.fTDC; | |
d0eb8f39 | 582 | fTRMchain = stream.fTRMchain; |
583 | fTDCchannel = stream.fTDCchannel; | |
571dda3d | 584 | fTof = stream.fTof; |
d0eb8f39 | 585 | fToT = stream.fToT; |
571dda3d | 586 | fErrorFlag = stream.fErrorFlag; |
d0eb8f39 | 587 | |
588 | fSector = stream.fSector; | |
589 | fPlate = stream.fPlate; | |
590 | fStrip = stream.fStrip; | |
591 | fPadX = stream.fPadX; | |
592 | fPadZ = stream.fPadZ; | |
571dda3d | 593 | |
d3c7bfac | 594 | fTOFGeometry = stream.fTOFGeometry; |
595 | ||
d0eb8f39 | 596 | fWordType = stream.fWordType; |
597 | fSlotID = stream.fSlotID; | |
598 | fACQ = stream.fACQ; | |
599 | fPSbit = stream.fPSbit; | |
600 | fTime = stream.fTime; | |
601 | fTDCerrorFlag = stream.fTDCerrorFlag; | |
602 | fInsideDRM = stream.fInsideDRM; | |
603 | fInsideTRM = stream.fInsideTRM; | |
604 | fInsideLTM = stream.fInsideLTM; | |
605 | fInsideTRMchain0 = stream.fInsideTRMchain0; | |
606 | fInsideTRMchain1 = stream.fInsideTRMchain1; | |
607 | fLeadingOrphane = stream.fLeadingOrphane; | |
608 | ||
571dda3d | 609 | return *this; |
610 | ||
611 | } | |
612 | ||
613 | //_____________________________________________________________________________ | |
614 | AliTOFRawStream::~AliTOFRawStream() | |
615 | { | |
616 | // destructor | |
617 | ||
f1aa96cc | 618 | delete fTOFGeometry; |
d3c7bfac | 619 | |
571dda3d | 620 | } |
621 | ||
622 | ||
623 | //_____________________________________________________________________________ | |
624 | Bool_t AliTOFRawStream::Next() | |
625 | { | |
d0eb8f39 | 626 | // |
627 | // Read next 32-bit word in TOF raw data files | |
628 | // returns kFALSE if there is no word left | |
629 | // | |
571dda3d | 630 | |
631 | UInt_t data; | |
632 | ||
571dda3d | 633 | if (!fRawReader->ReadNextInt(data)) return kFALSE; |
634 | ||
d0eb8f39 | 635 | if (fSector!=-1 && fPlate!=-1 && fStrip!=-1 && fPadZ!=-1 && fPadX!=-1) { |
636 | fSector = -1; | |
637 | fPlate = -1; | |
638 | fStrip = -1; | |
639 | fPadZ = -1; | |
640 | fPadX = -1; | |
641 | } | |
571dda3d | 642 | |
571dda3d | 643 | |
644 | fDDL = fRawReader->GetDDLID(); | |
645 | ||
d0eb8f39 | 646 | // orphane digits |
36f66fad | 647 | AliTOFtdcDigit orphaneLeadingDigit={0,0,0,0,0,0,0}; |
d0eb8f39 | 648 | |
649 | fWordType = GetField(data,WORD_TYPE_MASK,WORD_TYPE_POSITION); | |
650 | ||
651 | switch (fWordType) { // switch word type | |
652 | ||
653 | case GLOBAL_HEADER_TYPE: // global header | |
654 | fSlotID = GetField(data, HEADER_SLOT_ID_MASK, HEADER_SLOT_ID_POSITION); | |
655 | fTRM = fSlotID; | |
656 | ||
657 | ||
658 | switch (fSlotID) { // switch global header slot ID | |
659 | ||
660 | case DRM_ID_NUMBER: //DRM global header | |
661 | if (fInsideDRM) { // unexpected DRM global headers -> exit | |
662 | break; | |
663 | } | |
664 | fInsideDRM = kTRUE; // DRM global header accepted | |
665 | break; | |
666 | ||
667 | case LTM_ID_NUMBER: // LTM global header | |
668 | if (fInsideLTM) { // unexpected LTM global headers -> exit | |
669 | break; | |
670 | } | |
671 | fInsideLTM = kTRUE; // LTM global header accepted | |
672 | break; | |
673 | ||
674 | case 3: //TRM header | |
675 | case 4: //TRM header | |
676 | case 5: //TRM header | |
677 | case 6: //TRM header | |
678 | case 7: //TRM header | |
679 | case 8: //TRM header | |
680 | case 9: //TRM header | |
681 | case 10: //TRM header | |
682 | case 11: //TRM header | |
683 | case 12: //TRM header | |
684 | if (fInsideTRM) { // unexpected TRM global headers -> exit | |
685 | break; | |
686 | } | |
687 | fInsideTRM = kTRUE; // TRM global header accepted | |
688 | fACQ = GetField(data,TRM_ACQ_BITS_MASK,TRM_ACQ_BITS_POSITION); | |
689 | break; | |
690 | ||
691 | default: // unexpected global header slot ID | |
692 | break; | |
693 | ||
694 | } //end switch global header slot id | |
695 | ||
696 | break; | |
697 | ||
698 | ||
699 | case GLOBAL_TRAILER_TYPE: // global trailer | |
700 | fSlotID = GetField(data,HEADER_SLOT_ID_MASK,HEADER_SLOT_ID_POSITION); | |
701 | ||
702 | ||
703 | switch (fSlotID) { // switch global trailer slot ID | |
704 | ||
705 | case DRM_ID_NUMBER: // DRM global trailer | |
706 | if (!fInsideDRM) { // unexpected DRM global trailers -> exit | |
707 | break; | |
708 | } | |
709 | fInsideDRM = kFALSE; // DRM global trailer accepted | |
710 | fInsideTRM = kFALSE; | |
711 | fInsideLTM = kFALSE; | |
712 | fInsideTRMchain0 = kFALSE; | |
713 | fInsideTRMchain1 = kFALSE; | |
714 | fLeadingOrphane = kFALSE; | |
715 | fSector = -1; | |
716 | fPlate = -1; | |
717 | fStrip = -1; | |
718 | fPadZ = -1; | |
719 | fPadX = -1; | |
720 | fDDL = -1; | |
721 | fTRM = -1; | |
722 | fTDC = -1; | |
723 | fTRMchain = -1; | |
724 | fTDCchannel = -1; | |
725 | fTof = -1; | |
726 | fToT = -1; | |
727 | fErrorFlag = -1; | |
728 | fACQ = -1; | |
729 | fPSbit = -1; | |
730 | fTime = -1; | |
731 | fTDCerrorFlag = -1; | |
732 | break; | |
733 | case LTM_ID_NUMBER: // LTM global trailer | |
734 | if (!fInsideLTM) { // unexpected LTM global trailer -> exit | |
735 | break; | |
736 | } | |
737 | fInsideLTM = kFALSE; // LTM global trailer accepted | |
738 | break; | |
739 | case 15: //TRM global trailer | |
740 | if (!fInsideTRM) { // unexpected TRM global trailers -> exit | |
741 | break; | |
742 | } | |
743 | fInsideTRM = kFALSE; // TRM global trailer accepted | |
744 | break; | |
745 | default: // unexpected global trailer slot ID | |
746 | break; | |
747 | } //end switch global trailer slot id | |
748 | ||
749 | ||
750 | break; | |
751 | ||
752 | ||
753 | case ERROR_TYPE: // TDC error | |
754 | fTDC = GetField(data,TRM_TDC_ERROR_TDC_ID_MASK,TRM_TDC_ERROR_TDC_ID_POSITION); | |
755 | fTDCerrorFlag = GetField(data,TRM_TDC_ERROR_FLAGS_MASK,TRM_TDC_ERROR_FLAGS_POSITION); | |
756 | break; | |
757 | ||
758 | ||
759 | case FILLER_TYPE: // filler | |
760 | break; | |
761 | ||
762 | ||
763 | default: // other word types | |
764 | ||
765 | if (fInsideTRM) { // inside TRM | |
766 | ||
767 | switch (fWordType) { // switch word type inside TRM | |
768 | case TRM_CHAIN0_HEADER_TYPE: // TRM chain0 header | |
769 | if (fInsideTRMchain0) { // unexpected TRM chain0 header | |
770 | break; | |
771 | } | |
772 | fInsideTRMchain0 = kTRUE; | |
773 | fTRMchain = 0; | |
774 | break; | |
775 | case TRM_CHAIN0_TRAILER_TYPE: // TRM chain0 trailer | |
776 | if (!fInsideTRMchain0) { // unexpected TRM chain0 trailer | |
777 | break; | |
778 | } | |
779 | fInsideTRMchain0 = kFALSE; | |
780 | fTRMchain = -1; | |
781 | break; | |
782 | case TRM_CHAIN1_HEADER_TYPE: // TRM chain1 header | |
783 | if (fInsideTRMchain1) { // unexpected TRM chain1 header | |
784 | break; | |
785 | } | |
786 | fInsideTRMchain1 = kTRUE; | |
787 | fTRMchain = 1; | |
788 | break; | |
789 | case TRM_CHAIN1_TRAILER_TYPE: // TRM chain1 trailer | |
790 | if (!fInsideTRMchain1) { // unexpected TRM chain1 trailer | |
791 | break; | |
792 | } | |
793 | fInsideTRMchain1 = kFALSE; | |
794 | fTRMchain = -1; | |
795 | break; | |
796 | } // end switch word type inside TRM | |
797 | ||
798 | } // end if (fInsideTRM) | |
799 | ||
800 | ||
801 | if ( | |
802 | ((fInsideTRMchain0&&!fInsideTRMchain1) || (!fInsideTRMchain0&&fInsideTRMchain1)) | |
803 | && fWordType!=TRM_CHAIN0_HEADER_TYPE && fWordType!=TRM_CHAIN0_TRAILER_TYPE | |
804 | && fWordType!=TRM_CHAIN1_HEADER_TYPE && fWordType!=TRM_CHAIN1_TRAILER_TYPE | |
805 | ){ // inside TRM chains | |
806 | fPSbit = GetField(data,TRM_PS_BITS_MASK,TRM_PS_BITS_POSITION); | |
807 | fTDC = GetField(data,TRM_TDC_ID_MASK,TRM_TDC_ID_POSITION); | |
808 | fTDCchannel = GetField(data,TRM_CHAN_MASK,TRM_CHAN_POSITION); | |
809 | ||
810 | switch (fPSbit) { // switch fPSbit bits inside TRM chains | |
811 | case 0: // packing ok, digit time and tot | |
812 | fToT = GetField(data,TRM_TOT_WIDTH_MASK,TRM_TOT_WIDTH_POSITION); | |
813 | fTime = GetField(data,TRM_DIGIT_TIME_MASK,TRM_DIGIT_TIME_POSITION); | |
814 | fTof = fTime; | |
815 | SetSector(); | |
816 | SetPlate(); | |
817 | SetStrip(); | |
818 | SetPadZ(); | |
819 | SetPadX(); | |
820 | break; | |
821 | ||
822 | case 1: // leading edge digit, long digit time, no TOT | |
823 | fToT = -1; | |
824 | fTime = GetField(data,TRM_LONG_DIGIT_TIME_MASK,TRM_LONG_DIGIT_TIME_POSITION); | |
825 | fTof = fTime; | |
826 | SetSector(); | |
827 | SetPlate(); | |
828 | SetStrip(); | |
829 | SetPadZ(); | |
830 | SetPadX(); | |
831 | // always set it as orphane leading | |
832 | fLeadingOrphane=1; | |
833 | orphaneLeadingDigit.fSlotID = fSlotID; | |
834 | orphaneLeadingDigit.fChain = fTRMchain; | |
835 | orphaneLeadingDigit.fPS = fPSbit; | |
836 | orphaneLeadingDigit.fTDC = fTDC; | |
837 | orphaneLeadingDigit.fChannel = fTDCchannel; | |
838 | orphaneLeadingDigit.fTOT = fToT; | |
839 | orphaneLeadingDigit.fTime = fTime; | |
840 | break; | |
841 | ||
842 | case 2: // trailing edge digit, long digit time, no TOT | |
843 | fToT = -1; | |
844 | fTime = GetField(data,TRM_LONG_DIGIT_TIME_MASK,TRM_LONG_DIGIT_TIME_POSITION); | |
845 | fTof = fTime; | |
846 | SetSector(); | |
847 | SetPlate(); | |
848 | SetStrip(); | |
849 | SetPadZ(); | |
850 | SetPadX(); | |
851 | if (fACQ!=3) // check if packing is disabled | |
852 | break; | |
853 | if (!fLeadingOrphane) // check for a orphane leading edge | |
854 | break; | |
855 | if (orphaneLeadingDigit.fSlotID != fSlotID || | |
856 | orphaneLeadingDigit.fChain != fTRMchain || | |
857 | orphaneLeadingDigit.fTDC != fTDC || | |
858 | orphaneLeadingDigit.fChannel != fTDCchannel) // check leading edge compatibility (fSlotID, fTRMchain, fTDC, fTDCchannel) | |
859 | break; | |
860 | fLeadingOrphane = 0; // orphane leading is no longer orphane | |
861 | SetSector(); | |
862 | SetPlate(); | |
863 | SetStrip(); | |
864 | SetPadZ(); | |
865 | SetPadX(); | |
866 | break; | |
867 | case 3: // TOT overflow | |
868 | fToT = GetField(data,TRM_TOT_WIDTH_MASK,TRM_TOT_WIDTH_POSITION); | |
869 | fTime = GetField(data,TRM_DIGIT_TIME_MASK,TRM_DIGIT_TIME_POSITION); | |
870 | fTof = fTime; | |
871 | SetSector(); | |
872 | SetPlate(); | |
873 | SetStrip(); | |
874 | SetPadZ(); | |
875 | SetPadX(); | |
876 | break; | |
877 | } // end switch fPSbit bits inside TRM chains | |
878 | ||
879 | ||
880 | } // end if is inside TRM chains | |
881 | ||
882 | } // end switch on fWordType | |
571dda3d | 883 | |
884 | return kTRUE; | |
d0eb8f39 | 885 | |
571dda3d | 886 | } |
887 | //_____________________________________________________________________________ | |
888 | ||
d0eb8f39 | 889 | void AliTOFRawStream::SetSector() |
571dda3d | 890 | { |
891 | // | |
d0eb8f39 | 892 | // Evaluate the TOF sector number -> [ 0;17] |
893 | // corresponding to the TOF equipment IDs: | |
894 | // fDDL -> [ 0;71] | |
895 | // fTRM -> [ 3;12] | |
896 | // fTRMchain -> [0; 1] | |
897 | // fTDC -> [ 0;14] | |
898 | // fTDCchannel -> [ 0; 7] | |
571dda3d | 899 | // |
900 | ||
901 | Int_t iSector = -1; | |
571dda3d | 902 | |
d0eb8f39 | 903 | if (!(fDDL==-1)) iSector = Int_t((Float_t)(fDDL)/AliTOFGeometry::NDDL()); |
904 | ||
905 | fSector = iSector; | |
571dda3d | 906 | |
907 | } | |
908 | //_____________________________________________________________________________ | |
909 | ||
d0eb8f39 | 910 | |
911 | void AliTOFRawStream::SetPlate() | |
571dda3d | 912 | { |
913 | // | |
d0eb8f39 | 914 | // Evaluate the TOF plate number ->[ 0; 4] |
915 | // corresponding to the TOF equipment IDs: | |
916 | // fDDL -> [ 0;71] | |
917 | // fTRM -> [ 3;12] | |
918 | // fTRMchain -> [0; 1] | |
919 | // fTDC -> [ 0;14] | |
920 | // fTDCchannel -> [ 0; 7] | |
571dda3d | 921 | // |
922 | ||
923 | Int_t iPlate = -1; | |
d0eb8f39 | 924 | if (!(fDDL==-1 || fTRM==-1 || fTDC==-1 |
925 | || fSector==-1)) | |
926 | iPlate = Equip2VolNplate(GetDDLnumberPerSector(fDDL), fTRM, fTDC); | |
571dda3d | 927 | |
d0eb8f39 | 928 | fPlate = iPlate; |
571dda3d | 929 | |
930 | } | |
931 | //_____________________________________________________________________________ | |
932 | ||
d0eb8f39 | 933 | void AliTOFRawStream::SetStrip() |
571dda3d | 934 | { |
935 | // | |
d0eb8f39 | 936 | // Evaluate the TOF strip number per module -> [ 0; 14/18] |
937 | // corresponding to the TOF equipment IDs: | |
938 | // fDDL -> [ 0;71] | |
939 | // fTRM -> [ 3;12] | |
940 | // fTRMchain -> [0; 1] | |
941 | // fTDC -> [ 0;14] | |
942 | // fTDCchannel -> [ 0; 7] | |
571dda3d | 943 | // |
944 | ||
945 | Int_t iStrip = -1; | |
946 | ||
d0eb8f39 | 947 | if (!(fDDL==-1 || fTRM==-1 || fTDC==-1 |
948 | || fSector==-1 || fPlate==-1)) | |
949 | iStrip = Equip2VolNstrip(GetDDLnumberPerSector(fDDL), fTRM, fTDC); | |
571dda3d | 950 | |
d0eb8f39 | 951 | fStrip = iStrip; |
571dda3d | 952 | |
953 | } | |
954 | //_____________________________________________________________________________ | |
955 | ||
d0eb8f39 | 956 | void AliTOFRawStream::SetPadZ() |
571dda3d | 957 | { |
958 | // | |
d0eb8f39 | 959 | // Evaluate the TOF padRow number per strip -> [ 0; 1] |
960 | // corresponding to the TOF equipment IDs: | |
961 | // fDDL -> [ 0;71] | |
962 | // fTRM -> [ 3;12] | |
963 | // fTRMchain -> [0; 1] | |
964 | // fTDC -> [ 0;14] | |
965 | // fTDCchannel -> [ 0; 7] | |
571dda3d | 966 | // |
967 | ||
968 | Int_t iPadZ = -1; | |
969 | ||
d0eb8f39 | 970 | if (!(fDDL==-1 || fTRM==-1 || fTRMchain==-1 || fTDC==-1 || fTDCchannel==-1 |
971 | || fSector==-1 || fPlate==-1 || fStrip==-1)) | |
972 | { | |
973 | Int_t iPadAlongTheStrip = Equip2VolNpad(GetDDLnumberPerSector(fDDL), fTRMchain, fTDC, fTDCchannel); | |
974 | if (iPadAlongTheStrip!=-1) | |
975 | iPadZ = iPadAlongTheStrip%AliTOFGeometry::NpadZ(); | |
976 | } | |
571dda3d | 977 | |
d0eb8f39 | 978 | fPadZ = iPadZ; |
571dda3d | 979 | |
d0eb8f39 | 980 | } |
981 | //_____________________________________________________________________________ | |
982 | ||
983 | void AliTOFRawStream::SetPadX() | |
984 | { | |
985 | // | |
986 | // Evaluate the TOF pad number per strip padRow -> [ 0;47] | |
987 | // corresponding to the TOF equipment IDs: | |
988 | // fDDL -> [ 0;71] | |
989 | // fTRM -> [ 3;12] | |
990 | // fTRMchain -> [0; 1] | |
991 | // fTDC -> [ 0;14] | |
992 | // fTDCchannel -> [ 0; 7] | |
993 | // | |
571dda3d | 994 | |
d0eb8f39 | 995 | Int_t iPadX = -1; |
571dda3d | 996 | |
d0eb8f39 | 997 | if (!(fDDL==-1 || fTRM==-1 || fTRMchain==-1 || fTDC==-1 || fTDCchannel==-1 |
998 | || fSector==-1 || fPlate==-1 || fStrip==-1)) | |
999 | { | |
1000 | Int_t iPadAlongTheStrip = Equip2VolNpad(GetDDLnumberPerSector(fDDL), fTRMchain, fTDC, fTDCchannel); | |
1001 | if (iPadAlongTheStrip!=-1) | |
1002 | iPadX = (Int_t)(iPadAlongTheStrip/(Float_t(AliTOFGeometry::NpadZ()))); | |
1003 | } | |
1004 | ||
1005 | fPadX = iPadX; | |
571dda3d | 1006 | |
1007 | } | |
571dda3d | 1008 | |
d0eb8f39 | 1009 | //---------------------------------------------------------------------------- |
1010 | Int_t AliTOFRawStream::GetField(UInt_t word, Int_t fieldMask, Int_t fieldPosition) const | |
1011 | { | |
1012 | // | |
1013 | // | |
1014 | // | |
1015 | ||
1016 | return ((word & fieldMask) >> fieldPosition); | |
1017 | } | |
1018 | ||
1019 | //---------------------------------------------------------------------------- | |
1020 | Int_t AliTOFRawStream::Equip2VolNplate(Int_t iDDL, Int_t nTRM, Int_t nTDC) const | |
571dda3d | 1021 | { |
1022 | // | |
d0eb8f39 | 1023 | // Returns the TOF plate number [0;4] |
1024 | // corresponding to the TOF equipment ID numbers: | |
1025 | // iDDL -> DDL number per sector [0;3] | |
1026 | // nTRM -> TRM number [3;12] | |
1027 | // nTDC -> TDC number [0;14] | |
571dda3d | 1028 | // |
1029 | ||
d0eb8f39 | 1030 | Int_t iPlate = -1; |
1031 | if (iDDL==0) { | |
1032 | ||
1033 | if (nTRM>=4 && nTRM<7) { | |
1034 | iPlate = 0; | |
1035 | } else if (nTRM==7) { | |
1036 | if (nTDC<12) iPlate = 0; | |
1037 | else iPlate = 1; | |
1038 | } else if (nTRM>=8 && nTRM<11) { | |
1039 | iPlate = 1; | |
1040 | } else if (nTRM==11) { | |
1041 | if (nTDC<9) iPlate = 1; | |
1042 | else iPlate = 2; | |
1043 | }else if (nTRM==12) { | |
1044 | iPlate = 2; | |
1045 | } | |
1046 | ||
1047 | } else if (iDDL==1) { | |
1048 | ||
1049 | if (nTRM==3) { | |
1050 | if (nTDC<3) iPlate = 0; | |
1051 | } else if (nTRM>=4 && nTRM<7) { | |
1052 | iPlate = 0; | |
1053 | } else if (nTRM==7) { | |
1054 | if (nTDC<6) iPlate = 1; | |
1055 | else iPlate = 0; | |
1056 | } else if (nTRM>=8 && nTRM<11) { | |
1057 | iPlate = 1; | |
1058 | } else if (nTRM==11) { | |
1059 | if (nTDC<9) iPlate = 2; | |
1060 | else iPlate = 1; | |
1061 | } else if (nTRM==12) { | |
1062 | iPlate = 2; | |
1063 | } | |
1064 | ||
1065 | } else if (iDDL==2) { | |
1066 | ||
1067 | if (nTRM>=4 && nTRM<7) { | |
1068 | iPlate = 4; | |
1069 | } else if (nTRM==7) { | |
1070 | if (nTDC<12) iPlate = 4; | |
1071 | else iPlate = 3; | |
1072 | } else if (nTRM>=8 && nTRM<11) { | |
1073 | iPlate = 3; | |
1074 | } else if (nTRM==11) { | |
1075 | if (nTDC<9) iPlate = 3; | |
1076 | else iPlate = 2; | |
1077 | }else if (nTRM==12) { | |
1078 | iPlate = 2; | |
1079 | } | |
1080 | ||
1081 | } else if (iDDL==3) { | |
1082 | ||
1083 | if (nTRM==3) { | |
1084 | if (nTDC<3) iPlate = 4; | |
1085 | } else if (nTRM>=4 && nTRM<7) { | |
1086 | iPlate = 4; | |
1087 | } else if (nTRM==7) { | |
1088 | if (nTDC<6) iPlate = 3; | |
1089 | else iPlate = 4; | |
1090 | } else if (nTRM>=8 && nTRM<11) { | |
1091 | iPlate = 3; | |
1092 | } else if (nTRM==11) { | |
1093 | if (nTDC<9) iPlate = 2; | |
1094 | else iPlate = 3; | |
1095 | } else if (nTRM==12) { | |
1096 | iPlate = 2; | |
1097 | } | |
571dda3d | 1098 | |
d0eb8f39 | 1099 | } |
571dda3d | 1100 | |
d0eb8f39 | 1101 | return iPlate; |
571dda3d | 1102 | |
d0eb8f39 | 1103 | } |
571dda3d | 1104 | |
d0eb8f39 | 1105 | //---------------------------------------------------------------------------- |
1106 | Int_t AliTOFRawStream::Equip2VolNstrip(Int_t iDDL, Int_t nTRM, Int_t nTDC) const | |
1107 | { | |
1108 | // | |
1109 | // Returns the TOF strip number per module: | |
1110 | // [0;14], in the central plates, | |
1111 | // [0;18], in the intermediate and external plates | |
1112 | // corresponding to the TOF equipment ID numbers: | |
1113 | // iDDL -> DDL number per sector [0;3] | |
1114 | // nTRM -> TRM number [3;12] | |
1115 | // nTDC -> TDC number [0;14] | |
1116 | // | |
571dda3d | 1117 | |
d0eb8f39 | 1118 | Int_t iStrip = -1; |
571dda3d | 1119 | |
d0eb8f39 | 1120 | if (iDDL==0) { |
1121 | ||
1122 | if (nTRM== 4) iStrip = (Int_t)(nTDC/3.); | |
1123 | else if (nTRM== 5) iStrip = 5 + (Int_t)(nTDC/3.); | |
1124 | else if (nTRM== 6) iStrip = 10 + (Int_t)(nTDC/3.); | |
1125 | else if (nTRM== 7) { | |
1126 | if (nTDC<12) iStrip = 15 + (Int_t)(nTDC/3.); | |
1127 | else iStrip = (Int_t)(nTDC/3.) - 4; | |
1128 | } | |
1129 | else if (nTRM== 8) iStrip = 1 + (Int_t)(nTDC/3.); | |
1130 | else if (nTRM== 9) iStrip = 6 + (Int_t)(nTDC/3.); | |
1131 | else if (nTRM==10) iStrip = 11 + (Int_t)(nTDC/3.); | |
1132 | else if (nTRM==11) { | |
1133 | if (nTDC<9) iStrip = 16 + (Int_t)(nTDC/3.); | |
1134 | else iStrip = (Int_t)(nTDC/3.) - 3; | |
1135 | } | |
1136 | else if (nTRM==12) iStrip = 2 + (Int_t)(nTDC/3.); | |
1137 | ||
1138 | } else if (iDDL==1) { | |
1139 | ||
1140 | if (nTRM==3 && nTDC<3) iStrip = (Int_t)(nTDC/3.); | |
1141 | else if (nTRM== 4) iStrip = 5 - (Int_t)(nTDC/3.); | |
1142 | else if (nTRM== 5) iStrip = 10 - (Int_t)(nTDC/3.); | |
1143 | else if (nTRM== 6) iStrip = 15 - (Int_t)(nTDC/3.); | |
1144 | else if (nTRM== 7) { | |
1145 | if (nTDC<6) iStrip = 1 - (Int_t)(nTDC/3.); | |
1146 | else iStrip = 20 - (Int_t)(nTDC/3.); | |
1147 | } | |
1148 | else if (nTRM== 8) iStrip = 6 - (Int_t)(nTDC/3.); | |
1149 | else if (nTRM== 9) iStrip = 11 - (Int_t)(nTDC/3.); | |
1150 | else if (nTRM==10) iStrip = 16 - (Int_t)(nTDC/3.); | |
1151 | else if (nTRM==11) { | |
1152 | if (nTDC<9) iStrip = 2 - (Int_t)(nTDC/3.); | |
1153 | else iStrip = 21 - (Int_t)(nTDC/3.); | |
1154 | } | |
1155 | else if (nTRM==12) iStrip = 7 - (Int_t)(nTDC/3.); | |
1156 | ||
1157 | } else if (iDDL==2) { | |
1158 | ||
1159 | if (nTRM== 4) iStrip = 18 - (Int_t)(nTDC/3.); | |
1160 | else if (nTRM== 5) iStrip = 18 - ( 5 + (Int_t)(nTDC/3.)); | |
1161 | else if (nTRM== 6) iStrip = 18 - (10 + (Int_t)(nTDC/3.)); | |
1162 | else if (nTRM== 7) { | |
1163 | if (nTDC<12) iStrip = 18 - (15 + (Int_t)(nTDC/3.)); | |
1164 | else iStrip = 18 - ((Int_t)(nTDC/3.) - 4); | |
1165 | } | |
1166 | else if (nTRM== 8) iStrip = 18 - ( 1 + (Int_t)(nTDC/3.)); | |
1167 | else if (nTRM== 9) iStrip = 18 - ( 6 + (Int_t)(nTDC/3.)); | |
1168 | else if (nTRM==10) iStrip = 18 - (11 + (Int_t)(nTDC/3.)); | |
1169 | else if (nTRM==11) { | |
1170 | if (nTDC<9) iStrip = 18 - (16 + (Int_t)(nTDC/3.)); | |
1171 | else iStrip = 14 - ((Int_t)(nTDC/3.) - 3); | |
1172 | } | |
1173 | else if (nTRM==12) iStrip = 14 - ( 2 + (Int_t)(nTDC/3.)); | |
1174 | ||
1175 | } else if (iDDL==3) { | |
1176 | ||
1177 | if (nTRM==3 && nTDC<3) iStrip = 18 - (Int_t)(nTDC/3.); | |
1178 | else if (nTRM== 4) iStrip = 18 - ( 5 - (Int_t)(nTDC/3.)); | |
1179 | else if (nTRM== 5) iStrip = 18 - (10 - (Int_t)(nTDC/3.)); | |
1180 | else if (nTRM== 6) iStrip = 18 - (15 - (Int_t)(nTDC/3.)); | |
1181 | else if (nTRM== 7) { | |
1182 | if (nTDC<6) iStrip = 18 - (1 - (Int_t)(nTDC/3.)); | |
1183 | else iStrip = 18 - (20 - (Int_t)(nTDC/3.)); | |
1184 | } | |
1185 | else if (nTRM== 8) iStrip = 18 - ( 6 - (Int_t)(nTDC/3.)); | |
1186 | else if (nTRM== 9) iStrip = 18 - (11 - (Int_t)(nTDC/3.)); | |
1187 | else if (nTRM==10) iStrip = 18 - (16 - (Int_t)(nTDC/3.)); | |
1188 | else if (nTRM==11) { | |
1189 | if (nTDC<9) iStrip = 14 - ( 2 - (Int_t)(nTDC/3.)); | |
1190 | else iStrip = 18 - (21 - (Int_t)(nTDC/3.)); | |
1191 | } | |
1192 | else if (nTRM==12) iStrip = 14 - ( 7 - (Int_t)(nTDC/3.)); | |
1193 | ||
1194 | } | |
1195 | ||
1196 | return iStrip; | |
1197 | ||
1198 | } | |
1199 | ||
1200 | //---------------------------------------------------------------------------- | |
1201 | Int_t AliTOFRawStream::Equip2VolNpad(Int_t iDDL, Int_t iChain, Int_t nTDC, | |
1202 | Int_t iCH) const | |
1203 | { | |
1204 | // | |
1205 | // Returns the TOF pad number per strip [0;95] | |
1206 | // corresponding to the TOF equipment ID numbers: | |
1207 | // iDDL -> DDL number per sector [0;3] | |
1208 | // iChain -> TRM chain number [0;1] | |
1209 | // nTDC -> TDC number [0;14] | |
1210 | // iCH -> TDC channel number [0;7] | |
1211 | // | |
1212 | ||
1213 | Int_t iPadAlongTheStrip = -1; | |
1214 | ||
1215 | Int_t iTDClocal = nTDC%3 + (1-iChain)*3; | |
1216 | ||
1217 | if (iDDL==0 || iDDL==3) iTDClocal = 5 - iTDClocal; | |
1218 | else if (iDDL==1 || iDDL==2) iTDClocal = 6 + (5 - iTDClocal); | |
1219 | ||
1220 | Int_t iCHlocal = iCH; | |
1221 | if (iDDL==0 || iDDL==3) iCHlocal = 7 - iCH; | |
1222 | ||
1223 | iPadAlongTheStrip = iTDClocal*AliTOFGeometry::NCh() + iCHlocal; | |
1224 | ||
1225 | if (((iDDL==1 || iDDL==2) && iPadAlongTheStrip< AliTOFGeometry::NpadX()) || | |
1226 | ((iDDL==0 || iDDL==3) && iPadAlongTheStrip>=AliTOFGeometry::NpadX())) | |
1227 | AliError("Problems with the padX number!"); | |
1228 | ||
1229 | return iPadAlongTheStrip; | |
1230 | ||
1231 | } | |
1232 | ||
1233 | //---------------------------------------------------------------------------- | |
1234 | Int_t AliTOFRawStream::GetSectorNumber(Int_t nDDL) const | |
1235 | { | |
1236 | // | |
1237 | // Returns the sector number [0;17] | |
1238 | // corresponing to the assigned DRM/DDL number [0;71] | |
1239 | // | |
1240 | ||
1241 | Int_t iSector = Int_t((Float_t)(nDDL)/AliTOFGeometry::NDDL()); | |
1242 | ||
1243 | return iSector; | |
1244 | ||
1245 | } | |
1246 | //---------------------------------------------------------------------------- | |
1247 | Int_t AliTOFRawStream::GetDDLnumberPerSector(Int_t nDDL) const | |
1248 | { | |
1249 | // | |
1250 | // Return the DRM/DDL number per sector [0;3] | |
1251 | // corresponing to the assigned DRM/DDL number [0;71] | |
1252 | // | |
1253 | ||
1254 | Int_t iDDL = nDDL%AliTOFGeometry::NDDL(); | |
1255 | ||
1256 | return iDDL; | |
1257 | ||
1258 | } | |
1259 | ||
1260 | //---------------------------------------------------------------------------- | |
1261 | void AliTOFRawStream::EquipmentId2VolumeId(Int_t nDDL, Int_t nTRM, Int_t iChain, | |
1262 | Int_t nTDC, Int_t iCH, | |
1263 | Int_t *volume) const | |
1264 | { | |
1265 | // | |
1266 | // To convert: | |
1267 | // nDDL (variable in [0;71]) -> number of the DDL file | |
1268 | // nTRM (variable in [3;12]) -> number of the TRM slot | |
1269 | // iChain (variable in [0; 1]) -> number of the TRM chain | |
1270 | // nTDC (variable in [0;14]) -> number of the TDC | |
1271 | // iCH (variable in [0; 7]) -> number of the TDC channel | |
1272 | // | |
1273 | // in: | |
1274 | // sector number, i.e. volume[0] (variable in [0,17]) | |
1275 | // plate number, i.e. volume[1] (variable in [0, 5]) | |
1276 | // strip number, i.e. volume[2] (variable in [0,14/18]) | |
1277 | // padX number, i.e. volume[3] (variable in [0,47]) | |
1278 | // padZ number, i.e. volume[4] (variable in [0, 1]) | |
1279 | // | |
1280 | ||
1281 | Int_t iDDL = GetDDLnumberPerSector(nDDL); | |
1282 | ||
1283 | Int_t iSector = GetSectorNumber(nDDL); | |
1284 | ||
1285 | Int_t iPlate = Equip2VolNplate(iDDL, nTRM, nTDC); | |
1286 | if (iPlate==-1) AliError("Problems with the plate number!"); | |
1287 | ||
1288 | Int_t iStrip = Equip2VolNstrip(iDDL, nTRM, nTDC); | |
1289 | if (iStrip==-1) AliError("Problems with the strip number!"); | |
1290 | ||
1291 | Int_t iPadAlongTheStrip = Equip2VolNpad(iDDL, iChain, nTDC, iCH); | |
1292 | if (iPadAlongTheStrip==-1) | |
1293 | AliError("Problems with the pad number along the strip!"); | |
1294 | ||
1295 | Int_t iPadX = (Int_t)(iPadAlongTheStrip/(Float_t(AliTOFGeometry::NpadZ()))); | |
1296 | Int_t iPadZ = iPadAlongTheStrip%AliTOFGeometry::NpadZ(); | |
1297 | ||
1298 | volume[0] = iSector; | |
1299 | volume[1] = iPlate; | |
1300 | volume[2] = iStrip; | |
1301 | volume[3] = iPadX; | |
1302 | volume[4] = iPadZ; | |
571dda3d | 1303 | |
1304 | } |