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.9 2006/10/13 11:22:27 arcelli
19 remove warnings due to uninitialized AliTOFtdcDigit data members
21 Revision 1.8 2006/08/22 13:30:17 arcelli
22 removal of effective c++ warnings (C.Zampolli)
24 Revision 1.7 2006/08/10 14:46:54 decaro
25 TOF raw data format: updated version
27 Revision 1.6.1 2006/06/28 A. De Caro, R. Preghenella:
28 Update TOF raw data format
29 according to the final version
30 (see the ALICE internal note in preparation
31 'ALICE TOF raw data format')
32 Added the methods for the correspoonding numbering
33 between the equipment IDs and the volume IDs:
38 Revision 0.02 2005/07/28 A. De Caro:
39 Update format TOF raw data
41 Correction of few wrong corrispondences
42 between 'software' and 'hardware' numberings
44 Revision 0.01 2005/07/22 A. De Caro
45 Implement methods Next()
53 ////////////////////////////////////////////////////////////////////////
55 // This class provides access to TOF raw data in DDL files. //
57 // It loops over all TOF raw data given by the AliRawReader. //
59 ////////////////////////////////////////////////////////////////////////
62 #include "AliRawReader.h"
64 #include "AliTOFGeometry.h"
65 #include "AliTOFGeometryV5.h"
66 #include "AliTOFRawStream.h"
69 /******************************************
71 ******************************************/
74 #define FILLER 0x70000000
76 //word type mask/position
77 #define WORD_TYPE_MASK 0xf0000000
78 #define WORD_TYPE_POSITION 28
80 //global header word required bit pattern
81 #define GLOBAL_HEADER 0x40000000
83 //global trailer word required bit pattern
84 #define GLOBAL_TRAILER 0x50000000
86 //error word required bit pattern
87 #define ERROR 0x30000000
89 //header slot ID mask/position
90 #define HEADER_SLOT_ID_MASK 0x0000000f
91 #define HEADER_SLOT_ID_POSITION 0
94 #define GLOBAL_HEADER_TYPE 4
95 #define GLOBAL_TRAILER_TYPE 5
98 #define TRM_CHAIN0_HEADER_TYPE 0
99 #define TRM_CHAIN0_TRAILER_TYPE 1
100 #define TRM_CHAIN1_HEADER_TYPE 2
101 #define TRM_CHAIN1_TRAILER_TYPE 3
104 #define DRM_ID_NUMBER 1
105 #define LTM_ID_NUMBER 2
108 /******************************************
110 ******************************************/
112 //DRM global header word required bit pattern
113 #define DRM_GLOBAL_HEADER 0x40000001
115 //DRM event words mask/position
116 #define DRM_EVENT_WORDS_MASK 0x001ffff0
117 #define DRM_EVENT_WORDS_POSITION 4
119 //DRM DRM ID mask/position
120 #define DRM_DRM_ID_MASK 0x0fe00000
121 #define DRM_DRM_ID_POSITION 21
123 //DRM status header 1 word required bit pattern
124 #define DRM_STATUS_HEADER_1 0x40000001
126 //DRM slot ID mask/position
127 #define DRM_SLOT_ID_MASK 0x00007ff0
128 #define DRM_SLOT_ID_POSITION 4
130 //DRM C-bit mask/position
131 #define DRM_C_BIT_MASK 0x00008000
132 #define DRM_C_BIT_POSITION 15
134 //DRM status header 2 word required bit pattern
135 #define DRM_STATUS_HEADER_2 0x40000001
137 //DRM enable ID mask/position
138 #define DRM_ENABLE_ID_MASK 0x00007ff0
139 #define DRM_ENABLE_ID_POSITION 4
141 //DRM fault ID mask/position
142 #define DRM_FAULT_ID_MASK 0x07ff0000
143 #define DRM_FAULT_ID_POSITION 16
145 //DRM status header 3 word required bit pattern
146 #define DRM_STATUS_HEADER_3 0x40000001
148 //DRM TTC event counter mask/position
149 #define DRM_TTC_EVENT_COUNTER_MASK 0x0ffffff0
150 #define DRM_TTC_EVENT_COUNTER_POSITION 4
152 //DRM event CRC mask/position
153 //#define DRM_EVENT_CRC_MASK 0x001ffff0
154 #define DRM_EVENT_CRC_MASK 0x000ffff0
155 #define DRM_EVENT_CRC_POSITION 4
157 //DRM global trailer word required bit pattern
158 #define DRM_GLOBAL_TRAILER 0x50000001
160 //DRM local event counter mask/position
161 #define DRM_LOCAL_EVENT_COUNTER_MASK 0x0000fff0
162 #define DRM_LOCAL_EVENT_COUNTER_POSITION 4
165 /******************************************
167 ******************************************/
169 //TRM global header word required bit pattern
170 #define TRM_GLOBAL_HEADER 0x40000000
172 //TRM slot ID mask/position
173 #define TRM_SLOT_ID_MASK 0x0000000f
174 #define TRM_SLOT_ID_POSITION 0
176 //TRM event words mask/position
177 #define TRM_EVENT_WORDS_MASK 0x0001fff0
178 #define TRM_EVENT_WORDS_POSITION 4
180 //TRM ACQ-bits mask/position
181 #define TRM_ACQ_BITS_MASK 0x00060000
182 #define TRM_ACQ_BITS_POSITION 17
184 //TRM L-bit mask/position
185 #define TRM_L_BIT_MASK 0x00080000
186 #define TRM_L_BIT_POSITION 19
188 //TRM chain-0 header word required bit pattern
189 #define TRM_CHAIN_0_HEADER 0x00000000
191 //TRM chain-1 header word required bit pattern
192 #define TRM_CHAIN_1_HEADER 0x20000000
194 //TRM bunch ID mask/position
195 #define TRM_BUNCH_ID_MASK 0x0000fff0
196 #define TRM_BUNCH_ID_POSITION 4
198 //TRM PB24 temp mask/position
199 #define TRM_PB24_TEMP_MASK 0x00ff0000
200 #define TRM_PB24_TEMP_POSITION 16
202 //TRM PB24 ID mask/position
203 #define TRM_PB24_ID_MASK 0x07000000
204 #define TRM_PB24_ID_POSITION 24
206 //TRM TS-bit mask/position
207 #define TRM_TS_BIT_MASK 0x08000000
208 #define TRM_TS_BIT_POSITION 27
210 //TRM chain-0 trailer word required bit pattern
211 #define TRM_CHAIN_0_TRAILER 0x10000000
213 //TRM chain-1 trailer word required bit pattern
214 #define TRM_CHAIN_1_TRAILER 0x30000000
216 //TRM status mask/position
217 #define TRM_STATUS_MASK 0x0000000f
218 #define TRM_STATUS_POSITION 0
223 //TRM TDC digit word required bit pattern
224 #define TRM_TDC_DIGIT 0x8000000
226 //TRM digit time mask/position
227 #define TRM_DIGIT_TIME_MASK 0x00001fff
228 #define TRM_DIGIT_TIME_POSITION 0
230 //TRM long digit time mask/position
231 #define TRM_LONG_DIGIT_TIME_MASK 0x001fffff
232 #define TRM_LONG_DIGIT_TIME_POSITION 0
234 //TRM TOT width mask/position
235 #define TRM_TOT_WIDTH_MASK 0x001fe000
236 #define TRM_TOT_WIDTH_POSITION 13
238 //TRM chan mask/position
239 #define TRM_CHAN_MASK 0x00e00000
240 #define TRM_CHAN_POSITION 21
242 //TRM TDC ID mask/position
243 #define TRM_TDC_ID_MASK 0x0f000000
244 #define TRM_TDC_ID_POSITION 24
246 //TRM E-bit mask/position
247 #define TRM_E_BIT_MASK 0x10000000
248 #define TRM_E_BIT_POSITION 28
250 //TRM PS-bits mask/position
251 #define TRM_PS_BITS_MASK 0x60000000
252 #define TRM_PS_BITS_POSITION 29
257 //TRM TDC error word required bit pattern
258 #define TRM_TDC_ERROR 0x6000000
260 //TRM TDC diagnostic error word required bit pattern
261 #define TRM_TDC_DIAGNOSTIC_ERROR 0x6f00000
263 //TRM TDC error flags mask/position
264 #define TRM_TDC_ERROR_FLAGS_MASK 0x00007fff
265 #define TRM_TDC_ERROR_FLAGS_POSITION 0
267 //TRM TDC error TDC ID mask/position
268 #define TRM_TDC_ERROR_TDC_ID_MASK 0x0f00000
269 #define TRM_TDC_ERROR_TDC_ID_POSITION 24
271 //TRM TDC fault chip flag ID mask/position
272 #define TRM_TDC_ERROR_FAULT_CHIP_FLAG_ID_MASK 0x00007fff
273 #define TRM_TDC_ERROR_FAULT_CHIP_FLAG_ID_POSITION 0
275 //TRM TDC error C-bit mask/position
276 #define TRM_TDC_ERROR_C_BIT_MASK 0x00008000
277 #define TRM_TDC_ERROR_C_BIT_POSITION 15
279 //TRM TDC JTAG error code mask/position
280 #define TRM_TDC_ERROR_JTAG_ERROR_CODE_MASK 0x000007ff
281 #define TRM_TDC_ERROR_JTAG_ERROR_CODE_POSITION 0
283 //TRM TDC disgnostic error TDC ID mask/position
284 #define TRM_TDC_DIAGNOSTIC_ERROR_TDC_ID_MASK 0x00007800
285 #define TRM_TDC_DIAGNOSTIC_ERROR_TDC_ID_POSITION 11
287 //TRM global trailer word required bit pattern
288 //#define TRM_GLOBAL_TRAILER 0x50000000
289 #define TRM_GLOBAL_TRAILER 0x5000000f
291 //TRM event CRC mask/position
292 #define TRM_EVENT_CRC_MASK 0x0000fff0
293 #define TRM_EVENT_CRC_POSITION 4
295 //TRM event counter mask/position
296 #define TRM_EVENT_COUNTER_MASK 0x0fff0000
297 #define TRM_EVENT_COUNTER_POSITION 16
300 /******************************************
302 ******************************************/
304 //LTM global header word required bit pattern
305 #define LTM_GLOBAL_HEADER 0x40000002
307 //LTM event words mask/position
308 #define LTM_EVENT_WORDS_MASK 0x0001fff0
309 #define LTM_EVENT_WORDS_POSITION 4
311 //LTM C-bit mask/position
312 #define LTM_C_BIT_MASK 0x00020000
313 #define LTM_C_BIT_POSITION 17
315 //LTM fault mask/position
316 #define LTM_FAULT_MASK 0x00fc0000
317 #define LTM_FAULT_POSITION 18
321 //PDL value 1 mask/position
322 #define LTM_PDL_VALUE_1_MASK 0x000000ff
323 #define LTM_PDL_VALUE_1_POSITION 0
325 //PDL value 2 mask/position
326 #define LTM_PDL_VALUE_2_MASK 0x0000ff00
327 #define LTM_PDL_VALUE_2_POSITION 8
329 //PDL value 3 mask/position
330 #define LTM_PDL_VALUE_3_MASK 0x00ff0000
331 #define LTM_PDL_VALUE_3_POSITION 16
333 //PDL value 4 mask/position
334 #define LTM_PDL_VALUE_4_MASK 0xff000000
335 #define LTM_PDL_VALUE_4_POSITION 24
339 //ADC value 1 mask/position
340 #define LTM_ADC_VALUE_1_MASK 0x000003ff
341 #define LTM_ADC_VALUE_1_POSITION 0
343 //ADC value 2 mask/position
344 #define LTM_ADC_VALUE_2_MASK 0x000ffc00
345 #define LTM_ADC_VALUE_2_POSITION 10
347 //ADC value 3 mask/position
348 #define LTM_ADC_VALUE_3_MASK 0x3ff00000
349 #define LTM_ADC_VALUE_3_POSITION 20
351 //LTM global trailer word required bit pattern
352 #define LTM_GLOBAL_TRAILER 0x50000002
354 //LTM event CRC mask/position
355 #define LTM_EVENT_CRC_MASK 0x0000fff0
356 #define LTM_EVENT_CRC_POSITION 4
358 //LTM event number mask/position
359 #define LTM_EVENT_NUMBER_MASK 0x0fff0000
360 #define LTM_EVENT_NUMBER_POSITION 16
363 ClassImp(AliTOFRawStream)
366 //_____________________________________________________________________________
367 AliTOFRawStream::AliTOFRawStream(AliRawReader* rawReader):
383 fTOFGeometry(new AliTOFGeometryV5()),
393 fInsideTRMchain0(kFALSE),
394 fInsideTRMchain1(kFALSE),
395 fLeadingOrphane(kFALSE)
398 // create an object to read TOF raw digits
401 fRawReader = rawReader;
417 fTOFGeometry = new AliTOFGeometryV5();
419 fRawReader->Select("TOF");
430 fInsideTRMchain0 = kFALSE;
431 fInsideTRMchain1 = kFALSE;
432 fLeadingOrphane = kFALSE;
436 //_____________________________________________________________________________
437 AliTOFRawStream::AliTOFRawStream():
453 fTOFGeometry(new AliTOFGeometryV5()),
463 fInsideTRMchain0(kFALSE),
464 fInsideTRMchain1(kFALSE),
465 fLeadingOrphane(kFALSE)
486 fTOFGeometry = new AliTOFGeometryV5();
496 fInsideTRMchain0 = kFALSE;
497 fInsideTRMchain1 = kFALSE;
498 fLeadingOrphane = kFALSE;
502 //_____________________________________________________________________________
503 AliTOFRawStream::AliTOFRawStream(const AliTOFRawStream& stream) :
520 fTOFGeometry(new AliTOFGeometryV5()),
530 fInsideTRMchain0(kFALSE),
531 fInsideTRMchain1(kFALSE),
532 fLeadingOrphane(kFALSE)
538 fRawReader = stream.fRawReader;
542 fTRMchain = stream.fTRMchain;
543 fTDCchannel = stream.fTDCchannel;
546 fErrorFlag = stream.fErrorFlag;
548 fSector = stream.fSector;
549 fPlate = stream.fPlate;
550 fStrip = stream.fStrip;
551 fPadX = stream.fPadX;
552 fPadZ = stream.fPadZ;
554 fTOFGeometry = stream.fTOFGeometry;
556 fWordType = stream.fWordType;
557 fSlotID = stream.fSlotID;
559 fPSbit = stream.fPSbit;
560 fTime = stream.fTime;
561 fTDCerrorFlag = stream.fTDCerrorFlag;
562 fInsideDRM = stream.fInsideDRM;
563 fInsideTRM = stream.fInsideTRM;
564 fInsideLTM = stream.fInsideLTM;
565 fInsideTRMchain0 = stream.fInsideTRMchain0;
566 fInsideTRMchain1 = stream.fInsideTRMchain1;
567 fLeadingOrphane = stream.fLeadingOrphane;
571 //_____________________________________________________________________________
572 AliTOFRawStream& AliTOFRawStream::operator = (const AliTOFRawStream& stream)
575 // assignment operator
578 fRawReader = stream.fRawReader;
582 fTRMchain = stream.fTRMchain;
583 fTDCchannel = stream.fTDCchannel;
586 fErrorFlag = stream.fErrorFlag;
588 fSector = stream.fSector;
589 fPlate = stream.fPlate;
590 fStrip = stream.fStrip;
591 fPadX = stream.fPadX;
592 fPadZ = stream.fPadZ;
594 fTOFGeometry = stream.fTOFGeometry;
596 fWordType = stream.fWordType;
597 fSlotID = stream.fSlotID;
599 fPSbit = stream.fPSbit;
600 fTime = stream.fTime;
601 fTDCerrorFlag = stream.fTDCerrorFlag;
602 fInsideDRM = stream.fInsideDRM;
603 fInsideTRM = stream.fInsideTRM;
604 fInsideLTM = stream.fInsideLTM;
605 fInsideTRMchain0 = stream.fInsideTRMchain0;
606 fInsideTRMchain1 = stream.fInsideTRMchain1;
607 fLeadingOrphane = stream.fLeadingOrphane;
613 //_____________________________________________________________________________
614 AliTOFRawStream::~AliTOFRawStream()
623 //_____________________________________________________________________________
624 Bool_t AliTOFRawStream::Next()
627 // Read next 32-bit word in TOF raw data files
628 // returns kFALSE if there is no word left
633 if (!fRawReader->ReadNextInt(data)) return kFALSE;
635 if (fSector!=-1 && fPlate!=-1 && fStrip!=-1 && fPadZ!=-1 && fPadX!=-1) {
644 fDDL = fRawReader->GetDDLID();
647 AliTOFtdcDigit orphaneLeadingDigit={0,0,0,0,0,0,0};
649 fWordType = GetField(data,WORD_TYPE_MASK,WORD_TYPE_POSITION);
651 switch (fWordType) { // switch word type
653 case GLOBAL_HEADER_TYPE: // global header
654 fSlotID = GetField(data, HEADER_SLOT_ID_MASK, HEADER_SLOT_ID_POSITION);
658 switch (fSlotID) { // switch global header slot ID
660 case DRM_ID_NUMBER: //DRM global header
661 if (fInsideDRM) { // unexpected DRM global headers -> exit
664 fInsideDRM = kTRUE; // DRM global header accepted
667 case LTM_ID_NUMBER: // LTM global header
668 if (fInsideLTM) { // unexpected LTM global headers -> exit
671 fInsideLTM = kTRUE; // LTM global header accepted
681 case 10: //TRM header
682 case 11: //TRM header
683 case 12: //TRM header
684 if (fInsideTRM) { // unexpected TRM global headers -> exit
687 fInsideTRM = kTRUE; // TRM global header accepted
688 fACQ = GetField(data,TRM_ACQ_BITS_MASK,TRM_ACQ_BITS_POSITION);
691 default: // unexpected global header slot ID
694 } //end switch global header slot id
699 case GLOBAL_TRAILER_TYPE: // global trailer
700 fSlotID = GetField(data,HEADER_SLOT_ID_MASK,HEADER_SLOT_ID_POSITION);
703 switch (fSlotID) { // switch global trailer slot ID
705 case DRM_ID_NUMBER: // DRM global trailer
706 if (!fInsideDRM) { // unexpected DRM global trailers -> exit
709 fInsideDRM = kFALSE; // DRM global trailer accepted
712 fInsideTRMchain0 = kFALSE;
713 fInsideTRMchain1 = kFALSE;
714 fLeadingOrphane = kFALSE;
733 case LTM_ID_NUMBER: // LTM global trailer
734 if (!fInsideLTM) { // unexpected LTM global trailer -> exit
737 fInsideLTM = kFALSE; // LTM global trailer accepted
739 case 15: //TRM global trailer
740 if (!fInsideTRM) { // unexpected TRM global trailers -> exit
743 fInsideTRM = kFALSE; // TRM global trailer accepted
745 default: // unexpected global trailer slot ID
747 } //end switch global trailer slot id
753 case ERROR_TYPE: // TDC error
754 fTDC = GetField(data,TRM_TDC_ERROR_TDC_ID_MASK,TRM_TDC_ERROR_TDC_ID_POSITION);
755 fTDCerrorFlag = GetField(data,TRM_TDC_ERROR_FLAGS_MASK,TRM_TDC_ERROR_FLAGS_POSITION);
759 case FILLER_TYPE: // filler
763 default: // other word types
765 if (fInsideTRM) { // inside TRM
767 switch (fWordType) { // switch word type inside TRM
768 case TRM_CHAIN0_HEADER_TYPE: // TRM chain0 header
769 if (fInsideTRMchain0) { // unexpected TRM chain0 header
772 fInsideTRMchain0 = kTRUE;
775 case TRM_CHAIN0_TRAILER_TYPE: // TRM chain0 trailer
776 if (!fInsideTRMchain0) { // unexpected TRM chain0 trailer
779 fInsideTRMchain0 = kFALSE;
782 case TRM_CHAIN1_HEADER_TYPE: // TRM chain1 header
783 if (fInsideTRMchain1) { // unexpected TRM chain1 header
786 fInsideTRMchain1 = kTRUE;
789 case TRM_CHAIN1_TRAILER_TYPE: // TRM chain1 trailer
790 if (!fInsideTRMchain1) { // unexpected TRM chain1 trailer
793 fInsideTRMchain1 = kFALSE;
796 } // end switch word type inside TRM
798 } // end if (fInsideTRM)
802 ((fInsideTRMchain0&&!fInsideTRMchain1) || (!fInsideTRMchain0&&fInsideTRMchain1))
803 && fWordType!=TRM_CHAIN0_HEADER_TYPE && fWordType!=TRM_CHAIN0_TRAILER_TYPE
804 && fWordType!=TRM_CHAIN1_HEADER_TYPE && fWordType!=TRM_CHAIN1_TRAILER_TYPE
805 ){ // inside TRM chains
806 fPSbit = GetField(data,TRM_PS_BITS_MASK,TRM_PS_BITS_POSITION);
807 fTDC = GetField(data,TRM_TDC_ID_MASK,TRM_TDC_ID_POSITION);
808 fTDCchannel = GetField(data,TRM_CHAN_MASK,TRM_CHAN_POSITION);
810 switch (fPSbit) { // switch fPSbit bits inside TRM chains
811 case 0: // packing ok, digit time and tot
812 fToT = GetField(data,TRM_TOT_WIDTH_MASK,TRM_TOT_WIDTH_POSITION);
813 fTime = GetField(data,TRM_DIGIT_TIME_MASK,TRM_DIGIT_TIME_POSITION);
822 case 1: // leading edge digit, long digit time, no TOT
824 fTime = GetField(data,TRM_LONG_DIGIT_TIME_MASK,TRM_LONG_DIGIT_TIME_POSITION);
831 // always set it as orphane leading
833 orphaneLeadingDigit.fSlotID = fSlotID;
834 orphaneLeadingDigit.fChain = fTRMchain;
835 orphaneLeadingDigit.fPS = fPSbit;
836 orphaneLeadingDigit.fTDC = fTDC;
837 orphaneLeadingDigit.fChannel = fTDCchannel;
838 orphaneLeadingDigit.fTOT = fToT;
839 orphaneLeadingDigit.fTime = fTime;
842 case 2: // trailing edge digit, long digit time, no TOT
844 fTime = GetField(data,TRM_LONG_DIGIT_TIME_MASK,TRM_LONG_DIGIT_TIME_POSITION);
851 if (fACQ!=3) // check if packing is disabled
853 if (!fLeadingOrphane) // check for a orphane leading edge
855 if (orphaneLeadingDigit.fSlotID != fSlotID ||
856 orphaneLeadingDigit.fChain != fTRMchain ||
857 orphaneLeadingDigit.fTDC != fTDC ||
858 orphaneLeadingDigit.fChannel != fTDCchannel) // check leading edge compatibility (fSlotID, fTRMchain, fTDC, fTDCchannel)
860 fLeadingOrphane = 0; // orphane leading is no longer orphane
867 case 3: // TOT overflow
868 fToT = GetField(data,TRM_TOT_WIDTH_MASK,TRM_TOT_WIDTH_POSITION);
869 fTime = GetField(data,TRM_DIGIT_TIME_MASK,TRM_DIGIT_TIME_POSITION);
877 } // end switch fPSbit bits inside TRM chains
880 } // end if is inside TRM chains
882 } // end switch on fWordType
887 //_____________________________________________________________________________
889 void AliTOFRawStream::SetSector()
892 // Evaluate the TOF sector number -> [ 0;17]
893 // corresponding to the TOF equipment IDs:
896 // fTRMchain -> [0; 1]
898 // fTDCchannel -> [ 0; 7]
903 if (!(fDDL==-1)) iSector = Int_t((Float_t)(fDDL)/AliTOFGeometry::NDDL());
908 //_____________________________________________________________________________
911 void AliTOFRawStream::SetPlate()
914 // Evaluate the TOF plate number ->[ 0; 4]
915 // corresponding to the TOF equipment IDs:
918 // fTRMchain -> [0; 1]
920 // fTDCchannel -> [ 0; 7]
924 if (!(fDDL==-1 || fTRM==-1 || fTDC==-1
926 iPlate = Equip2VolNplate(GetDDLnumberPerSector(fDDL), fTRM, fTDC);
931 //_____________________________________________________________________________
933 void AliTOFRawStream::SetStrip()
936 // Evaluate the TOF strip number per module -> [ 0; 14/18]
937 // corresponding to the TOF equipment IDs:
940 // fTRMchain -> [0; 1]
942 // fTDCchannel -> [ 0; 7]
947 if (!(fDDL==-1 || fTRM==-1 || fTDC==-1
948 || fSector==-1 || fPlate==-1))
949 iStrip = Equip2VolNstrip(GetDDLnumberPerSector(fDDL), fTRM, fTDC);
954 //_____________________________________________________________________________
956 void AliTOFRawStream::SetPadZ()
959 // Evaluate the TOF padRow number per strip -> [ 0; 1]
960 // corresponding to the TOF equipment IDs:
963 // fTRMchain -> [0; 1]
965 // fTDCchannel -> [ 0; 7]
970 if (!(fDDL==-1 || fTRM==-1 || fTRMchain==-1 || fTDC==-1 || fTDCchannel==-1
971 || fSector==-1 || fPlate==-1 || fStrip==-1))
973 Int_t iPadAlongTheStrip = Equip2VolNpad(GetDDLnumberPerSector(fDDL), fTRMchain, fTDC, fTDCchannel);
974 if (iPadAlongTheStrip!=-1)
975 iPadZ = iPadAlongTheStrip%AliTOFGeometry::NpadZ();
981 //_____________________________________________________________________________
983 void AliTOFRawStream::SetPadX()
986 // Evaluate the TOF pad number per strip padRow -> [ 0;47]
987 // corresponding to the TOF equipment IDs:
990 // fTRMchain -> [0; 1]
992 // fTDCchannel -> [ 0; 7]
997 if (!(fDDL==-1 || fTRM==-1 || fTRMchain==-1 || fTDC==-1 || fTDCchannel==-1
998 || fSector==-1 || fPlate==-1 || fStrip==-1))
1000 Int_t iPadAlongTheStrip = Equip2VolNpad(GetDDLnumberPerSector(fDDL), fTRMchain, fTDC, fTDCchannel);
1001 if (iPadAlongTheStrip!=-1)
1002 iPadX = (Int_t)(iPadAlongTheStrip/(Float_t(AliTOFGeometry::NpadZ())));
1009 //----------------------------------------------------------------------------
1010 Int_t AliTOFRawStream::GetField(UInt_t word, Int_t fieldMask, Int_t fieldPosition) const
1016 return ((word & fieldMask) >> fieldPosition);
1019 //----------------------------------------------------------------------------
1020 Int_t AliTOFRawStream::Equip2VolNplate(Int_t iDDL, Int_t nTRM, Int_t nTDC) const
1023 // Returns the TOF plate number [0;4]
1024 // corresponding to the TOF equipment ID numbers:
1025 // iDDL -> DDL number per sector [0;3]
1026 // nTRM -> TRM number [3;12]
1027 // nTDC -> TDC number [0;14]
1033 if (nTRM>=4 && nTRM<7) {
1035 } else if (nTRM==7) {
1036 if (nTDC<12) iPlate = 0;
1038 } else if (nTRM>=8 && nTRM<11) {
1040 } else if (nTRM==11) {
1041 if (nTDC<9) iPlate = 1;
1043 }else if (nTRM==12) {
1047 } else if (iDDL==1) {
1050 if (nTDC<3) iPlate = 0;
1051 } else if (nTRM>=4 && nTRM<7) {
1053 } else if (nTRM==7) {
1054 if (nTDC<6) iPlate = 1;
1056 } else if (nTRM>=8 && nTRM<11) {
1058 } else if (nTRM==11) {
1059 if (nTDC<9) iPlate = 2;
1061 } else if (nTRM==12) {
1065 } else if (iDDL==2) {
1067 if (nTRM>=4 && nTRM<7) {
1069 } else if (nTRM==7) {
1070 if (nTDC<12) iPlate = 4;
1072 } else if (nTRM>=8 && nTRM<11) {
1074 } else if (nTRM==11) {
1075 if (nTDC<9) iPlate = 3;
1077 }else if (nTRM==12) {
1081 } else if (iDDL==3) {
1084 if (nTDC<3) iPlate = 4;
1085 } else if (nTRM>=4 && nTRM<7) {
1087 } else if (nTRM==7) {
1088 if (nTDC<6) iPlate = 3;
1090 } else if (nTRM>=8 && nTRM<11) {
1092 } else if (nTRM==11) {
1093 if (nTDC<9) iPlate = 2;
1095 } else if (nTRM==12) {
1105 //----------------------------------------------------------------------------
1106 Int_t AliTOFRawStream::Equip2VolNstrip(Int_t iDDL, Int_t nTRM, Int_t nTDC) const
1109 // Returns the TOF strip number per module:
1110 // [0;14], in the central plates,
1111 // [0;18], in the intermediate and external plates
1112 // corresponding to the TOF equipment ID numbers:
1113 // iDDL -> DDL number per sector [0;3]
1114 // nTRM -> TRM number [3;12]
1115 // nTDC -> TDC number [0;14]
1122 if (nTRM== 4) iStrip = (Int_t)(nTDC/3.);
1123 else if (nTRM== 5) iStrip = 5 + (Int_t)(nTDC/3.);
1124 else if (nTRM== 6) iStrip = 10 + (Int_t)(nTDC/3.);
1125 else if (nTRM== 7) {
1126 if (nTDC<12) iStrip = 15 + (Int_t)(nTDC/3.);
1127 else iStrip = (Int_t)(nTDC/3.) - 4;
1129 else if (nTRM== 8) iStrip = 1 + (Int_t)(nTDC/3.);
1130 else if (nTRM== 9) iStrip = 6 + (Int_t)(nTDC/3.);
1131 else if (nTRM==10) iStrip = 11 + (Int_t)(nTDC/3.);
1132 else if (nTRM==11) {
1133 if (nTDC<9) iStrip = 16 + (Int_t)(nTDC/3.);
1134 else iStrip = (Int_t)(nTDC/3.) - 3;
1136 else if (nTRM==12) iStrip = 2 + (Int_t)(nTDC/3.);
1138 } else if (iDDL==1) {
1140 if (nTRM==3 && nTDC<3) iStrip = (Int_t)(nTDC/3.);
1141 else if (nTRM== 4) iStrip = 5 - (Int_t)(nTDC/3.);
1142 else if (nTRM== 5) iStrip = 10 - (Int_t)(nTDC/3.);
1143 else if (nTRM== 6) iStrip = 15 - (Int_t)(nTDC/3.);
1144 else if (nTRM== 7) {
1145 if (nTDC<6) iStrip = 1 - (Int_t)(nTDC/3.);
1146 else iStrip = 20 - (Int_t)(nTDC/3.);
1148 else if (nTRM== 8) iStrip = 6 - (Int_t)(nTDC/3.);
1149 else if (nTRM== 9) iStrip = 11 - (Int_t)(nTDC/3.);
1150 else if (nTRM==10) iStrip = 16 - (Int_t)(nTDC/3.);
1151 else if (nTRM==11) {
1152 if (nTDC<9) iStrip = 2 - (Int_t)(nTDC/3.);
1153 else iStrip = 21 - (Int_t)(nTDC/3.);
1155 else if (nTRM==12) iStrip = 7 - (Int_t)(nTDC/3.);
1157 } else if (iDDL==2) {
1159 if (nTRM== 4) iStrip = 18 - (Int_t)(nTDC/3.);
1160 else if (nTRM== 5) iStrip = 18 - ( 5 + (Int_t)(nTDC/3.));
1161 else if (nTRM== 6) iStrip = 18 - (10 + (Int_t)(nTDC/3.));
1162 else if (nTRM== 7) {
1163 if (nTDC<12) iStrip = 18 - (15 + (Int_t)(nTDC/3.));
1164 else iStrip = 18 - ((Int_t)(nTDC/3.) - 4);
1166 else if (nTRM== 8) iStrip = 18 - ( 1 + (Int_t)(nTDC/3.));
1167 else if (nTRM== 9) iStrip = 18 - ( 6 + (Int_t)(nTDC/3.));
1168 else if (nTRM==10) iStrip = 18 - (11 + (Int_t)(nTDC/3.));
1169 else if (nTRM==11) {
1170 if (nTDC<9) iStrip = 18 - (16 + (Int_t)(nTDC/3.));
1171 else iStrip = 14 - ((Int_t)(nTDC/3.) - 3);
1173 else if (nTRM==12) iStrip = 14 - ( 2 + (Int_t)(nTDC/3.));
1175 } else if (iDDL==3) {
1177 if (nTRM==3 && nTDC<3) iStrip = 18 - (Int_t)(nTDC/3.);
1178 else if (nTRM== 4) iStrip = 18 - ( 5 - (Int_t)(nTDC/3.));
1179 else if (nTRM== 5) iStrip = 18 - (10 - (Int_t)(nTDC/3.));
1180 else if (nTRM== 6) iStrip = 18 - (15 - (Int_t)(nTDC/3.));
1181 else if (nTRM== 7) {
1182 if (nTDC<6) iStrip = 18 - (1 - (Int_t)(nTDC/3.));
1183 else iStrip = 18 - (20 - (Int_t)(nTDC/3.));
1185 else if (nTRM== 8) iStrip = 18 - ( 6 - (Int_t)(nTDC/3.));
1186 else if (nTRM== 9) iStrip = 18 - (11 - (Int_t)(nTDC/3.));
1187 else if (nTRM==10) iStrip = 18 - (16 - (Int_t)(nTDC/3.));
1188 else if (nTRM==11) {
1189 if (nTDC<9) iStrip = 14 - ( 2 - (Int_t)(nTDC/3.));
1190 else iStrip = 18 - (21 - (Int_t)(nTDC/3.));
1192 else if (nTRM==12) iStrip = 14 - ( 7 - (Int_t)(nTDC/3.));
1200 //----------------------------------------------------------------------------
1201 Int_t AliTOFRawStream::Equip2VolNpad(Int_t iDDL, Int_t iChain, Int_t nTDC,
1205 // Returns the TOF pad number per strip [0;95]
1206 // corresponding to the TOF equipment ID numbers:
1207 // iDDL -> DDL number per sector [0;3]
1208 // iChain -> TRM chain number [0;1]
1209 // nTDC -> TDC number [0;14]
1210 // iCH -> TDC channel number [0;7]
1213 Int_t iPadAlongTheStrip = -1;
1215 Int_t iTDClocal = nTDC%3 + (1-iChain)*3;
1217 if (iDDL==0 || iDDL==3) iTDClocal = 5 - iTDClocal;
1218 else if (iDDL==1 || iDDL==2) iTDClocal = 6 + (5 - iTDClocal);
1220 Int_t iCHlocal = iCH;
1221 if (iDDL==0 || iDDL==3) iCHlocal = 7 - iCH;
1223 iPadAlongTheStrip = iTDClocal*AliTOFGeometry::NCh() + iCHlocal;
1225 if (((iDDL==1 || iDDL==2) && iPadAlongTheStrip< AliTOFGeometry::NpadX()) ||
1226 ((iDDL==0 || iDDL==3) && iPadAlongTheStrip>=AliTOFGeometry::NpadX()))
1227 AliError("Problems with the padX number!");
1229 return iPadAlongTheStrip;
1233 //----------------------------------------------------------------------------
1234 Int_t AliTOFRawStream::GetSectorNumber(Int_t nDDL) const
1237 // Returns the sector number [0;17]
1238 // corresponing to the assigned DRM/DDL number [0;71]
1241 Int_t iSector = Int_t((Float_t)(nDDL)/AliTOFGeometry::NDDL());
1246 //----------------------------------------------------------------------------
1247 Int_t AliTOFRawStream::GetDDLnumberPerSector(Int_t nDDL) const
1250 // Return the DRM/DDL number per sector [0;3]
1251 // corresponing to the assigned DRM/DDL number [0;71]
1254 Int_t iDDL = nDDL%AliTOFGeometry::NDDL();
1260 //----------------------------------------------------------------------------
1261 void AliTOFRawStream::EquipmentId2VolumeId(Int_t nDDL, Int_t nTRM, Int_t iChain,
1262 Int_t nTDC, Int_t iCH,
1263 Int_t *volume) const
1267 // nDDL (variable in [0;71]) -> number of the DDL file
1268 // nTRM (variable in [3;12]) -> number of the TRM slot
1269 // iChain (variable in [0; 1]) -> number of the TRM chain
1270 // nTDC (variable in [0;14]) -> number of the TDC
1271 // iCH (variable in [0; 7]) -> number of the TDC channel
1274 // sector number, i.e. volume[0] (variable in [0,17])
1275 // plate number, i.e. volume[1] (variable in [0, 5])
1276 // strip number, i.e. volume[2] (variable in [0,14/18])
1277 // padX number, i.e. volume[3] (variable in [0,47])
1278 // padZ number, i.e. volume[4] (variable in [0, 1])
1281 Int_t iDDL = GetDDLnumberPerSector(nDDL);
1283 Int_t iSector = GetSectorNumber(nDDL);
1285 Int_t iPlate = Equip2VolNplate(iDDL, nTRM, nTDC);
1286 if (iPlate==-1) AliError("Problems with the plate number!");
1288 Int_t iStrip = Equip2VolNstrip(iDDL, nTRM, nTDC);
1289 if (iStrip==-1) AliError("Problems with the strip number!");
1291 Int_t iPadAlongTheStrip = Equip2VolNpad(iDDL, iChain, nTDC, iCH);
1292 if (iPadAlongTheStrip==-1)
1293 AliError("Problems with the pad number along the strip!");
1295 Int_t iPadX = (Int_t)(iPadAlongTheStrip/(Float_t(AliTOFGeometry::NpadZ())));
1296 Int_t iPadZ = iPadAlongTheStrip%AliTOFGeometry::NpadZ();
1298 volume[0] = iSector;