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