1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.7 2006/08/10 14:46:54 decaro
19 TOF raw data format: updated version
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:
32 Revision 0.02 2005/07/28 A. De Caro:
33 Update format TOF raw data
35 Correction of few wrong corrispondences
36 between 'software' and 'hardware' numberings
38 Revision 0.01 2005/07/22 A. De Caro
39 Implement methods Next()
47 ////////////////////////////////////////////////////////////////////////
49 // This class provides access to TOF raw data in DDL files. //
51 // It loops over all TOF raw data given by the AliRawReader. //
53 ////////////////////////////////////////////////////////////////////////
56 #include "AliRawReader.h"
58 #include "AliTOFGeometry.h"
59 #include "AliTOFGeometryV5.h"
60 #include "AliTOFRawStream.h"
63 /******************************************
65 ******************************************/
68 #define FILLER 0x70000000
70 //word type mask/position
71 #define WORD_TYPE_MASK 0xf0000000
72 #define WORD_TYPE_POSITION 28
74 //global header word required bit pattern
75 #define GLOBAL_HEADER 0x40000000
77 //global trailer word required bit pattern
78 #define GLOBAL_TRAILER 0x50000000
80 //error word required bit pattern
81 #define ERROR 0x30000000
83 //header slot ID mask/position
84 #define HEADER_SLOT_ID_MASK 0x0000000f
85 #define HEADER_SLOT_ID_POSITION 0
88 #define GLOBAL_HEADER_TYPE 4
89 #define GLOBAL_TRAILER_TYPE 5
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
98 #define DRM_ID_NUMBER 1
99 #define LTM_ID_NUMBER 2
102 /******************************************
104 ******************************************/
106 //DRM global header word required bit pattern
107 #define DRM_GLOBAL_HEADER 0x40000001
109 //DRM event words mask/position
110 #define DRM_EVENT_WORDS_MASK 0x001ffff0
111 #define DRM_EVENT_WORDS_POSITION 4
113 //DRM DRM ID mask/position
114 #define DRM_DRM_ID_MASK 0x0fe00000
115 #define DRM_DRM_ID_POSITION 21
117 //DRM status header 1 word required bit pattern
118 #define DRM_STATUS_HEADER_1 0x40000001
120 //DRM slot ID mask/position
121 #define DRM_SLOT_ID_MASK 0x00007ff0
122 #define DRM_SLOT_ID_POSITION 4
124 //DRM C-bit mask/position
125 #define DRM_C_BIT_MASK 0x00008000
126 #define DRM_C_BIT_POSITION 15
128 //DRM status header 2 word required bit pattern
129 #define DRM_STATUS_HEADER_2 0x40000001
131 //DRM enable ID mask/position
132 #define DRM_ENABLE_ID_MASK 0x00007ff0
133 #define DRM_ENABLE_ID_POSITION 4
135 //DRM fault ID mask/position
136 #define DRM_FAULT_ID_MASK 0x07ff0000
137 #define DRM_FAULT_ID_POSITION 16
139 //DRM status header 3 word required bit pattern
140 #define DRM_STATUS_HEADER_3 0x40000001
142 //DRM TTC event counter mask/position
143 #define DRM_TTC_EVENT_COUNTER_MASK 0x0ffffff0
144 #define DRM_TTC_EVENT_COUNTER_POSITION 4
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
151 //DRM global trailer word required bit pattern
152 #define DRM_GLOBAL_TRAILER 0x50000001
154 //DRM local event counter mask/position
155 #define DRM_LOCAL_EVENT_COUNTER_MASK 0x0000fff0
156 #define DRM_LOCAL_EVENT_COUNTER_POSITION 4
159 /******************************************
161 ******************************************/
163 //TRM global header word required bit pattern
164 #define TRM_GLOBAL_HEADER 0x40000000
166 //TRM slot ID mask/position
167 #define TRM_SLOT_ID_MASK 0x0000000f
168 #define TRM_SLOT_ID_POSITION 0
170 //TRM event words mask/position
171 #define TRM_EVENT_WORDS_MASK 0x0001fff0
172 #define TRM_EVENT_WORDS_POSITION 4
174 //TRM ACQ-bits mask/position
175 #define TRM_ACQ_BITS_MASK 0x00060000
176 #define TRM_ACQ_BITS_POSITION 17
178 //TRM L-bit mask/position
179 #define TRM_L_BIT_MASK 0x00080000
180 #define TRM_L_BIT_POSITION 19
182 //TRM chain-0 header word required bit pattern
183 #define TRM_CHAIN_0_HEADER 0x00000000
185 //TRM chain-1 header word required bit pattern
186 #define TRM_CHAIN_1_HEADER 0x20000000
188 //TRM bunch ID mask/position
189 #define TRM_BUNCH_ID_MASK 0x0000fff0
190 #define TRM_BUNCH_ID_POSITION 4
192 //TRM PB24 temp mask/position
193 #define TRM_PB24_TEMP_MASK 0x00ff0000
194 #define TRM_PB24_TEMP_POSITION 16
196 //TRM PB24 ID mask/position
197 #define TRM_PB24_ID_MASK 0x07000000
198 #define TRM_PB24_ID_POSITION 24
200 //TRM TS-bit mask/position
201 #define TRM_TS_BIT_MASK 0x08000000
202 #define TRM_TS_BIT_POSITION 27
204 //TRM chain-0 trailer word required bit pattern
205 #define TRM_CHAIN_0_TRAILER 0x10000000
207 //TRM chain-1 trailer word required bit pattern
208 #define TRM_CHAIN_1_TRAILER 0x30000000
210 //TRM status mask/position
211 #define TRM_STATUS_MASK 0x0000000f
212 #define TRM_STATUS_POSITION 0
217 //TRM TDC digit word required bit pattern
218 #define TRM_TDC_DIGIT 0x8000000
220 //TRM digit time mask/position
221 #define TRM_DIGIT_TIME_MASK 0x00001fff
222 #define TRM_DIGIT_TIME_POSITION 0
224 //TRM long digit time mask/position
225 #define TRM_LONG_DIGIT_TIME_MASK 0x001fffff
226 #define TRM_LONG_DIGIT_TIME_POSITION 0
228 //TRM TOT width mask/position
229 #define TRM_TOT_WIDTH_MASK 0x001fe000
230 #define TRM_TOT_WIDTH_POSITION 13
232 //TRM chan mask/position
233 #define TRM_CHAN_MASK 0x00e00000
234 #define TRM_CHAN_POSITION 21
236 //TRM TDC ID mask/position
237 #define TRM_TDC_ID_MASK 0x0f000000
238 #define TRM_TDC_ID_POSITION 24
240 //TRM E-bit mask/position
241 #define TRM_E_BIT_MASK 0x10000000
242 #define TRM_E_BIT_POSITION 28
244 //TRM PS-bits mask/position
245 #define TRM_PS_BITS_MASK 0x60000000
246 #define TRM_PS_BITS_POSITION 29
251 //TRM TDC error word required bit pattern
252 #define TRM_TDC_ERROR 0x6000000
254 //TRM TDC diagnostic error word required bit pattern
255 #define TRM_TDC_DIAGNOSTIC_ERROR 0x6f00000
257 //TRM TDC error flags mask/position
258 #define TRM_TDC_ERROR_FLAGS_MASK 0x00007fff
259 #define TRM_TDC_ERROR_FLAGS_POSITION 0
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
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
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
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
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
281 //TRM global trailer word required bit pattern
282 //#define TRM_GLOBAL_TRAILER 0x50000000
283 #define TRM_GLOBAL_TRAILER 0x5000000f
285 //TRM event CRC mask/position
286 #define TRM_EVENT_CRC_MASK 0x0000fff0
287 #define TRM_EVENT_CRC_POSITION 4
289 //TRM event counter mask/position
290 #define TRM_EVENT_COUNTER_MASK 0x0fff0000
291 #define TRM_EVENT_COUNTER_POSITION 16
294 /******************************************
296 ******************************************/
298 //LTM global header word required bit pattern
299 #define LTM_GLOBAL_HEADER 0x40000002
301 //LTM event words mask/position
302 #define LTM_EVENT_WORDS_MASK 0x0001fff0
303 #define LTM_EVENT_WORDS_POSITION 4
305 //LTM C-bit mask/position
306 #define LTM_C_BIT_MASK 0x00020000
307 #define LTM_C_BIT_POSITION 17
309 //LTM fault mask/position
310 #define LTM_FAULT_MASK 0x00fc0000
311 #define LTM_FAULT_POSITION 18
315 //PDL value 1 mask/position
316 #define LTM_PDL_VALUE_1_MASK 0x000000ff
317 #define LTM_PDL_VALUE_1_POSITION 0
319 //PDL value 2 mask/position
320 #define LTM_PDL_VALUE_2_MASK 0x0000ff00
321 #define LTM_PDL_VALUE_2_POSITION 8
323 //PDL value 3 mask/position
324 #define LTM_PDL_VALUE_3_MASK 0x00ff0000
325 #define LTM_PDL_VALUE_3_POSITION 16
327 //PDL value 4 mask/position
328 #define LTM_PDL_VALUE_4_MASK 0xff000000
329 #define LTM_PDL_VALUE_4_POSITION 24
333 //ADC value 1 mask/position
334 #define LTM_ADC_VALUE_1_MASK 0x000003ff
335 #define LTM_ADC_VALUE_1_POSITION 0
337 //ADC value 2 mask/position
338 #define LTM_ADC_VALUE_2_MASK 0x000ffc00
339 #define LTM_ADC_VALUE_2_POSITION 10
341 //ADC value 3 mask/position
342 #define LTM_ADC_VALUE_3_MASK 0x3ff00000
343 #define LTM_ADC_VALUE_3_POSITION 20
345 //LTM global trailer word required bit pattern
346 #define LTM_GLOBAL_TRAILER 0x50000002
348 //LTM event CRC mask/position
349 #define LTM_EVENT_CRC_MASK 0x0000fff0
350 #define LTM_EVENT_CRC_POSITION 4
352 //LTM event number mask/position
353 #define LTM_EVENT_NUMBER_MASK 0x0fff0000
354 #define LTM_EVENT_NUMBER_POSITION 16
357 ClassImp(AliTOFRawStream)
360 //_____________________________________________________________________________
361 AliTOFRawStream::AliTOFRawStream(AliRawReader* rawReader):
377 fTOFGeometry(new AliTOFGeometryV5()),
387 fInsideTRMchain0(kFALSE),
388 fInsideTRMchain1(kFALSE),
389 fLeadingOrphane(kFALSE)
392 // create an object to read TOF raw digits
395 fRawReader = rawReader;
411 fTOFGeometry = new AliTOFGeometryV5();
413 fRawReader->Select("TOF");
424 fInsideTRMchain0 = kFALSE;
425 fInsideTRMchain1 = kFALSE;
426 fLeadingOrphane = kFALSE;
430 //_____________________________________________________________________________
431 AliTOFRawStream::AliTOFRawStream():
447 fTOFGeometry(new AliTOFGeometryV5()),
457 fInsideTRMchain0(kFALSE),
458 fInsideTRMchain1(kFALSE),
459 fLeadingOrphane(kFALSE)
480 fTOFGeometry = new AliTOFGeometryV5();
490 fInsideTRMchain0 = kFALSE;
491 fInsideTRMchain1 = kFALSE;
492 fLeadingOrphane = kFALSE;
496 //_____________________________________________________________________________
497 AliTOFRawStream::AliTOFRawStream(const AliTOFRawStream& stream) :
514 fTOFGeometry(new AliTOFGeometryV5()),
524 fInsideTRMchain0(kFALSE),
525 fInsideTRMchain1(kFALSE),
526 fLeadingOrphane(kFALSE)
532 fRawReader = stream.fRawReader;
536 fTRMchain = stream.fTRMchain;
537 fTDCchannel = stream.fTDCchannel;
540 fErrorFlag = stream.fErrorFlag;
542 fSector = stream.fSector;
543 fPlate = stream.fPlate;
544 fStrip = stream.fStrip;
545 fPadX = stream.fPadX;
546 fPadZ = stream.fPadZ;
548 fTOFGeometry = stream.fTOFGeometry;
550 fWordType = stream.fWordType;
551 fSlotID = stream.fSlotID;
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;
565 //_____________________________________________________________________________
566 AliTOFRawStream& AliTOFRawStream::operator = (const AliTOFRawStream& stream)
569 // assignment operator
572 fRawReader = stream.fRawReader;
576 fTRMchain = stream.fTRMchain;
577 fTDCchannel = stream.fTDCchannel;
580 fErrorFlag = stream.fErrorFlag;
582 fSector = stream.fSector;
583 fPlate = stream.fPlate;
584 fStrip = stream.fStrip;
585 fPadX = stream.fPadX;
586 fPadZ = stream.fPadZ;
588 fTOFGeometry = stream.fTOFGeometry;
590 fWordType = stream.fWordType;
591 fSlotID = stream.fSlotID;
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;
607 //_____________________________________________________________________________
608 AliTOFRawStream::~AliTOFRawStream()
617 //_____________________________________________________________________________
618 Bool_t AliTOFRawStream::Next()
621 // Read next 32-bit word in TOF raw data files
622 // returns kFALSE if there is no word left
627 if (!fRawReader->ReadNextInt(data)) return kFALSE;
629 if (fSector!=-1 && fPlate!=-1 && fStrip!=-1 && fPadZ!=-1 && fPadX!=-1) {
638 fDDL = fRawReader->GetDDLID();
641 AliTOFtdcDigit orphaneLeadingDigit;
643 fWordType = GetField(data,WORD_TYPE_MASK,WORD_TYPE_POSITION);
645 switch (fWordType) { // switch word type
647 case GLOBAL_HEADER_TYPE: // global header
648 fSlotID = GetField(data, HEADER_SLOT_ID_MASK, HEADER_SLOT_ID_POSITION);
652 switch (fSlotID) { // switch global header slot ID
654 case DRM_ID_NUMBER: //DRM global header
655 if (fInsideDRM) { // unexpected DRM global headers -> exit
658 fInsideDRM = kTRUE; // DRM global header accepted
661 case LTM_ID_NUMBER: // LTM global header
662 if (fInsideLTM) { // unexpected LTM global headers -> exit
665 fInsideLTM = kTRUE; // LTM global header accepted
675 case 10: //TRM header
676 case 11: //TRM header
677 case 12: //TRM header
678 if (fInsideTRM) { // unexpected TRM global headers -> exit
681 fInsideTRM = kTRUE; // TRM global header accepted
682 fACQ = GetField(data,TRM_ACQ_BITS_MASK,TRM_ACQ_BITS_POSITION);
685 default: // unexpected global header slot ID
688 } //end switch global header slot id
693 case GLOBAL_TRAILER_TYPE: // global trailer
694 fSlotID = GetField(data,HEADER_SLOT_ID_MASK,HEADER_SLOT_ID_POSITION);
697 switch (fSlotID) { // switch global trailer slot ID
699 case DRM_ID_NUMBER: // DRM global trailer
700 if (!fInsideDRM) { // unexpected DRM global trailers -> exit
703 fInsideDRM = kFALSE; // DRM global trailer accepted
706 fInsideTRMchain0 = kFALSE;
707 fInsideTRMchain1 = kFALSE;
708 fLeadingOrphane = kFALSE;
727 case LTM_ID_NUMBER: // LTM global trailer
728 if (!fInsideLTM) { // unexpected LTM global trailer -> exit
731 fInsideLTM = kFALSE; // LTM global trailer accepted
733 case 15: //TRM global trailer
734 if (!fInsideTRM) { // unexpected TRM global trailers -> exit
737 fInsideTRM = kFALSE; // TRM global trailer accepted
739 default: // unexpected global trailer slot ID
741 } //end switch global trailer slot id
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);
753 case FILLER_TYPE: // filler
757 default: // other word types
759 if (fInsideTRM) { // inside TRM
761 switch (fWordType) { // switch word type inside TRM
762 case TRM_CHAIN0_HEADER_TYPE: // TRM chain0 header
763 if (fInsideTRMchain0) { // unexpected TRM chain0 header
766 fInsideTRMchain0 = kTRUE;
769 case TRM_CHAIN0_TRAILER_TYPE: // TRM chain0 trailer
770 if (!fInsideTRMchain0) { // unexpected TRM chain0 trailer
773 fInsideTRMchain0 = kFALSE;
776 case TRM_CHAIN1_HEADER_TYPE: // TRM chain1 header
777 if (fInsideTRMchain1) { // unexpected TRM chain1 header
780 fInsideTRMchain1 = kTRUE;
783 case TRM_CHAIN1_TRAILER_TYPE: // TRM chain1 trailer
784 if (!fInsideTRMchain1) { // unexpected TRM chain1 trailer
787 fInsideTRMchain1 = kFALSE;
790 } // end switch word type inside TRM
792 } // end if (fInsideTRM)
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);
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);
816 case 1: // leading edge digit, long digit time, no TOT
818 fTime = GetField(data,TRM_LONG_DIGIT_TIME_MASK,TRM_LONG_DIGIT_TIME_POSITION);
825 // always set it as orphane leading
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;
836 case 2: // trailing edge digit, long digit time, no TOT
838 fTime = GetField(data,TRM_LONG_DIGIT_TIME_MASK,TRM_LONG_DIGIT_TIME_POSITION);
845 if (fACQ!=3) // check if packing is disabled
847 if (!fLeadingOrphane) // check for a orphane leading edge
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)
854 fLeadingOrphane = 0; // orphane leading is no longer orphane
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);
871 } // end switch fPSbit bits inside TRM chains
874 } // end if is inside TRM chains
876 } // end switch on fWordType
881 //_____________________________________________________________________________
883 void AliTOFRawStream::SetSector()
886 // Evaluate the TOF sector number -> [ 0;17]
887 // corresponding to the TOF equipment IDs:
890 // fTRMchain -> [0; 1]
892 // fTDCchannel -> [ 0; 7]
897 if (!(fDDL==-1)) iSector = Int_t((Float_t)(fDDL)/AliTOFGeometry::NDDL());
902 //_____________________________________________________________________________
905 void AliTOFRawStream::SetPlate()
908 // Evaluate the TOF plate number ->[ 0; 4]
909 // corresponding to the TOF equipment IDs:
912 // fTRMchain -> [0; 1]
914 // fTDCchannel -> [ 0; 7]
918 if (!(fDDL==-1 || fTRM==-1 || fTDC==-1
920 iPlate = Equip2VolNplate(GetDDLnumberPerSector(fDDL), fTRM, fTDC);
925 //_____________________________________________________________________________
927 void AliTOFRawStream::SetStrip()
930 // Evaluate the TOF strip number per module -> [ 0; 14/18]
931 // corresponding to the TOF equipment IDs:
934 // fTRMchain -> [0; 1]
936 // fTDCchannel -> [ 0; 7]
941 if (!(fDDL==-1 || fTRM==-1 || fTDC==-1
942 || fSector==-1 || fPlate==-1))
943 iStrip = Equip2VolNstrip(GetDDLnumberPerSector(fDDL), fTRM, fTDC);
948 //_____________________________________________________________________________
950 void AliTOFRawStream::SetPadZ()
953 // Evaluate the TOF padRow number per strip -> [ 0; 1]
954 // corresponding to the TOF equipment IDs:
957 // fTRMchain -> [0; 1]
959 // fTDCchannel -> [ 0; 7]
964 if (!(fDDL==-1 || fTRM==-1 || fTRMchain==-1 || fTDC==-1 || fTDCchannel==-1
965 || fSector==-1 || fPlate==-1 || fStrip==-1))
967 Int_t iPadAlongTheStrip = Equip2VolNpad(GetDDLnumberPerSector(fDDL), fTRMchain, fTDC, fTDCchannel);
968 if (iPadAlongTheStrip!=-1)
969 iPadZ = iPadAlongTheStrip%AliTOFGeometry::NpadZ();
975 //_____________________________________________________________________________
977 void AliTOFRawStream::SetPadX()
980 // Evaluate the TOF pad number per strip padRow -> [ 0;47]
981 // corresponding to the TOF equipment IDs:
984 // fTRMchain -> [0; 1]
986 // fTDCchannel -> [ 0; 7]
991 if (!(fDDL==-1 || fTRM==-1 || fTRMchain==-1 || fTDC==-1 || fTDCchannel==-1
992 || fSector==-1 || fPlate==-1 || fStrip==-1))
994 Int_t iPadAlongTheStrip = Equip2VolNpad(GetDDLnumberPerSector(fDDL), fTRMchain, fTDC, fTDCchannel);
995 if (iPadAlongTheStrip!=-1)
996 iPadX = (Int_t)(iPadAlongTheStrip/(Float_t(AliTOFGeometry::NpadZ())));
1003 //----------------------------------------------------------------------------
1004 Int_t AliTOFRawStream::GetField(UInt_t word, Int_t fieldMask, Int_t fieldPosition) const
1010 return ((word & fieldMask) >> fieldPosition);
1013 //----------------------------------------------------------------------------
1014 Int_t AliTOFRawStream::Equip2VolNplate(Int_t iDDL, Int_t nTRM, Int_t nTDC) const
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]
1027 if (nTRM>=4 && nTRM<7) {
1029 } else if (nTRM==7) {
1030 if (nTDC<12) iPlate = 0;
1032 } else if (nTRM>=8 && nTRM<11) {
1034 } else if (nTRM==11) {
1035 if (nTDC<9) iPlate = 1;
1037 }else if (nTRM==12) {
1041 } else if (iDDL==1) {
1044 if (nTDC<3) iPlate = 0;
1045 } else if (nTRM>=4 && nTRM<7) {
1047 } else if (nTRM==7) {
1048 if (nTDC<6) iPlate = 1;
1050 } else if (nTRM>=8 && nTRM<11) {
1052 } else if (nTRM==11) {
1053 if (nTDC<9) iPlate = 2;
1055 } else if (nTRM==12) {
1059 } else if (iDDL==2) {
1061 if (nTRM>=4 && nTRM<7) {
1063 } else if (nTRM==7) {
1064 if (nTDC<12) iPlate = 4;
1066 } else if (nTRM>=8 && nTRM<11) {
1068 } else if (nTRM==11) {
1069 if (nTDC<9) iPlate = 3;
1071 }else if (nTRM==12) {
1075 } else if (iDDL==3) {
1078 if (nTDC<3) iPlate = 4;
1079 } else if (nTRM>=4 && nTRM<7) {
1081 } else if (nTRM==7) {
1082 if (nTDC<6) iPlate = 3;
1084 } else if (nTRM>=8 && nTRM<11) {
1086 } else if (nTRM==11) {
1087 if (nTDC<9) iPlate = 2;
1089 } else if (nTRM==12) {
1099 //----------------------------------------------------------------------------
1100 Int_t AliTOFRawStream::Equip2VolNstrip(Int_t iDDL, Int_t nTRM, Int_t nTDC) const
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]
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;
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;
1130 else if (nTRM==12) iStrip = 2 + (Int_t)(nTDC/3.);
1132 } else if (iDDL==1) {
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.);
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.);
1149 else if (nTRM==12) iStrip = 7 - (Int_t)(nTDC/3.);
1151 } else if (iDDL==2) {
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);
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);
1167 else if (nTRM==12) iStrip = 14 - ( 2 + (Int_t)(nTDC/3.));
1169 } else if (iDDL==3) {
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.));
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.));
1186 else if (nTRM==12) iStrip = 14 - ( 7 - (Int_t)(nTDC/3.));
1194 //----------------------------------------------------------------------------
1195 Int_t AliTOFRawStream::Equip2VolNpad(Int_t iDDL, Int_t iChain, Int_t nTDC,
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]
1207 Int_t iPadAlongTheStrip = -1;
1209 Int_t iTDClocal = nTDC%3 + (1-iChain)*3;
1211 if (iDDL==0 || iDDL==3) iTDClocal = 5 - iTDClocal;
1212 else if (iDDL==1 || iDDL==2) iTDClocal = 6 + (5 - iTDClocal);
1214 Int_t iCHlocal = iCH;
1215 if (iDDL==0 || iDDL==3) iCHlocal = 7 - iCH;
1217 iPadAlongTheStrip = iTDClocal*AliTOFGeometry::NCh() + iCHlocal;
1219 if (((iDDL==1 || iDDL==2) && iPadAlongTheStrip< AliTOFGeometry::NpadX()) ||
1220 ((iDDL==0 || iDDL==3) && iPadAlongTheStrip>=AliTOFGeometry::NpadX()))
1221 AliError("Problems with the padX number!");
1223 return iPadAlongTheStrip;
1227 //----------------------------------------------------------------------------
1228 Int_t AliTOFRawStream::GetSectorNumber(Int_t nDDL) const
1231 // Returns the sector number [0;17]
1232 // corresponing to the assigned DRM/DDL number [0;71]
1235 Int_t iSector = Int_t((Float_t)(nDDL)/AliTOFGeometry::NDDL());
1240 //----------------------------------------------------------------------------
1241 Int_t AliTOFRawStream::GetDDLnumberPerSector(Int_t nDDL) const
1244 // Return the DRM/DDL number per sector [0;3]
1245 // corresponing to the assigned DRM/DDL number [0;71]
1248 Int_t iDDL = nDDL%AliTOFGeometry::NDDL();
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
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
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])
1275 Int_t iDDL = GetDDLnumberPerSector(nDDL);
1277 Int_t iSector = GetSectorNumber(nDDL);
1279 Int_t iPlate = Equip2VolNplate(iDDL, nTRM, nTDC);
1280 if (iPlate==-1) AliError("Problems with the plate number!");
1282 Int_t iStrip = Equip2VolNstrip(iDDL, nTRM, nTDC);
1283 if (iStrip==-1) AliError("Problems with the strip number!");
1285 Int_t iPadAlongTheStrip = Equip2VolNpad(iDDL, iChain, nTDC, iCH);
1286 if (iPadAlongTheStrip==-1)
1287 AliError("Problems with the pad number along the strip!");
1289 Int_t iPadX = (Int_t)(iPadAlongTheStrip/(Float_t(AliTOFGeometry::NpadZ())));
1290 Int_t iPadZ = iPadAlongTheStrip%AliTOFGeometry::NpadZ();
1292 volume[0] = iSector;