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