]>
Commit | Line | Data |
---|---|---|
571dda3d | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* | |
d0eb8f39 | 17 | $Log$ |
08d6922f | 18 | |
19 | Added lookup tables for | |
20 | TRM number 3 in the left crates (TOF OR signals) | |
21 | and detector elements (A.Silenzi) | |
22 | ||
dd824655 | 23 | Revision 1.19.1 2008/09/19 preghenella |
24 | Decode method updated: | |
25 | it reads the CDH from the rawReader and sends it to the decoder; | |
26 | LoadRawDataBuffers modified: | |
27 | it corrects tof hit infos per ddlBC and deltaBC offsets | |
28 | (in case of the static member fgApplyBCCorrections | |
29 | has been setted to kTRUE); | |
30 | Added static member fgApplyBCCorrections (kTRUE by default) | |
31 | and the related static method ApplyBCCorrections; | |
32 | ||
96f01799 | 33 | Revision 1.19 2007/05/18 13:07:53 decaro |
34 | Error messages stored in the global raw-reader error log (Cvetan, Chiara) | |
35 | ||
019f6101 | 36 | Revision 1.18 2007/05/08 11:53:29 arcelli |
37 | Improved class flexibility for further use (R.Preghenella) | |
38 | ||
2fd622fa | 39 | Revision 1.17 2007/05/03 08:53:50 decaro |
40 | Coding convention: RS3 violation -> suppression | |
41 | ||
19eefa2b | 42 | Revision 1.16 2007/05/03 08:22:22 decaro |
43 | Coding convention: RN17 violation -> suppression | |
44 | ||
dfcee998 | 45 | Revision 1.15 2007/04/30 15:22:06 arcelli |
46 | Change TOF digit Time, Tot etc to int type | |
47 | ||
bf33f8f0 | 48 | Revision 1.14 2007/04/27 11:11:53 arcelli |
49 | updates for the new decoder | |
50 | ||
dfcee998 | 51 | Revision 1.13 2007/03/16 11:46:35 decaro |
52 | Coding convention: RN17 rule violation -> suppression | |
53 | ||
8994284f | 54 | Revision 1.12 2007/02/22 09:43:45 decaro |
55 | Added AliTOFRawStream::GetIndex method for online calibration (C.Zampolli) | |
56 | ||
740f0695 | 57 | Revision 1.11 2007/02/20 15:57:00 decaro |
58 | Raw data update: to read the TOF raw data defined in UNPACKED mode | |
59 | ||
15ec34b9 | 60 | Revision 1.10 2006/12/15 14:01:38 cvetan |
61 | Memory leak fixed | |
62 | ||
f1aa96cc | 63 | Revision 1.9 2006/10/13 11:22:27 arcelli |
64 | remove warnings due to uninitialized AliTOFtdcDigit data members | |
65 | ||
36f66fad | 66 | Revision 1.8 2006/08/22 13:30:17 arcelli |
67 | removal of effective c++ warnings (C.Zampolli) | |
68 | ||
655e379f | 69 | Revision 1.7 2006/08/10 14:46:54 decaro |
70 | TOF raw data format: updated version | |
71 | ||
d0eb8f39 | 72 | Revision 1.6.1 2006/06/28 A. De Caro, R. Preghenella: |
73 | Update TOF raw data format | |
74 | according to the final version | |
75 | (see the ALICE internal note in preparation | |
76 | 'ALICE TOF raw data format') | |
77 | Added the methods for the correspoonding numbering | |
78 | between the equipment IDs and the volume IDs: | |
79 | Equip2VolNPlate(...) | |
80 | Equip2VolNStrip(...) | |
81 | Equip2VolNPad(...) | |
82 | ||
571dda3d | 83 | Revision 0.02 2005/07/28 A. De Caro: |
84 | Update format TOF raw data | |
85 | (temporary solution) | |
86 | Correction of few wrong corrispondences | |
87 | between 'software' and 'hardware' numberings | |
88 | ||
89 | Revision 0.01 2005/07/22 A. De Caro | |
90 | Implement methods Next() | |
91 | GetSector(), | |
92 | GetPlate(), | |
93 | GetStrip(), | |
94 | GetPadZ(), | |
95 | GetPadX() | |
96 | */ | |
97 | ||
0e46b9ae | 98 | //////////////////////////////////////////////////////////////////////// |
99 | // // | |
100 | // This class provides access to TOF raw data in DDL files. // | |
101 | // // | |
102 | // It loops over all TOF raw data given by the AliRawReader. // | |
103 | // // | |
104 | //////////////////////////////////////////////////////////////////////// | |
571dda3d | 105 | |
15ec34b9 | 106 | |
13d6bff9 | 107 | #include "Riostream.h" |
108 | ||
15ec34b9 | 109 | #include "TClonesArray.h" |
f472295e | 110 | #include "TStopwatch.h" |
15ec34b9 | 111 | |
112 | #include "AliDAQ.h" | |
d0eb8f39 | 113 | #include "AliLog.h" |
571dda3d | 114 | #include "AliRawReader.h" |
115 | ||
116 | #include "AliTOFGeometry.h" | |
15ec34b9 | 117 | #include "AliTOFrawData.h" |
118 | #include "AliTOFRawMap.h" | |
571dda3d | 119 | #include "AliTOFRawStream.h" |
f472295e | 120 | #include "AliTOFdigit.h" |
121 | #include "AliTOFSDigit.h" | |
32ead898 | 122 | //#include "AliTOFCableLengthMap.h" |
571dda3d | 123 | |
5c7c93fa | 124 | #include "AliTOFHitData.h" |
d0eb8f39 | 125 | |
32ead898 | 126 | #include "AliRawEventHeaderBase.h" |
143cfc81 | 127 | #include "AliRawDataHeader.h" |
32ead898 | 128 | |
5b4ed716 | 129 | #include "AliTOFDecoderV2.h" |
130 | ||
571dda3d | 131 | ClassImp(AliTOFRawStream) |
132 | ||
32ead898 | 133 | const Int_t AliTOFRawStream::fgkddlBCshift[72] = |
134 | { | |
e7f49164 | 135 | 0, 0, 0, 0, |
136 | 0, 0, 0, 0, | |
137 | 0, 0, 0, 0, | |
138 | 0, 0, 0, 0, | |
139 | 0, 0, 0, 0, | |
140 | 0, 0, 0, 0, | |
141 | 0, 0, 0, 0, | |
142 | 0, 0, 0, 0, | |
143 | 0, 0, 0, 0, | |
144 | 0, 0, 0, 0, | |
145 | 0, 0, 0, 0, | |
146 | 0, 0, 0, 0, | |
147 | 0, 0, 0, 0, | |
148 | 0, 0, 0, 0, | |
149 | 0, 0, 0, 0, | |
150 | 0, 0, 0, 0, | |
151 | 0, 0, 0, 0, | |
152 | 0, 0, 0, 0 | |
32ead898 | 153 | }; |
154 | ||
08d6922f | 155 | const Int_t AliTOFRawStream::fgkStrip0MapCrate0[]= |
4306fa22 | 156 | {1,3,5,7,9,11,13,15,17,0,2,4,6,8,10,12,14,16,18,1,3,5,7,-1}; |
08d6922f | 157 | const Int_t AliTOFRawStream::fgkStrip1MapCrate0[]= |
4306fa22 | 158 | {0,2,4,6,8,10,12,14,16,18,1,3,5,7,9,11,13,15,17,0,2,4,6,-1}; |
08d6922f | 159 | const Int_t AliTOFRawStream::fgkStrip0MapCrate1[]= |
4306fa22 | 160 | {1,3,5,7,9,11,13,15,17,0,2,4,6,8,10,12,14,16,18,1,3,5,7,-1}; |
08d6922f | 161 | const Int_t AliTOFRawStream::fgkStrip1MapCrate1[]= |
4306fa22 | 162 | {0,2,4,6,8,10,12,14,16,18,1,3,5,7,9,11,13,15,17,0,2,4,6,-1}; |
08d6922f | 163 | const Int_t AliTOFRawStream::fgkStrip0MapCrate2[]= |
4306fa22 | 164 | {17,15,13,11, 9,7,5,3,1,18,16,14,12,10,8,6,4,2, 0,13,11, 9,7,-1}; |
08d6922f | 165 | const Int_t AliTOFRawStream::fgkStrip1MapCrate2[]= |
4306fa22 | 166 | {18,16,14,12,10,8,6,4,2, 0,17,15,13,11,9,7,5,3, 1,14,12,10,8,-1}; |
08d6922f | 167 | const Int_t AliTOFRawStream::fgkStrip0MapCrate3[]= |
4306fa22 | 168 | {17,15,13,11, 9,7,5,3,1,18,16,14,12,10,8,6,4,2, 0,13,11, 9,7,-1}; |
08d6922f | 169 | const Int_t AliTOFRawStream::fgkStrip1MapCrate3[]= |
4306fa22 | 170 | {18,16,14,12,10,8,6,4,2, 0,17,15,13,11,9,7,5,3, 1,14,12,10,8,-1}; |
08d6922f | 171 | |
172 | ||
173 | const Int_t AliTOFRawStream::fgkModule0MapCrate0[]= | |
4306fa22 | 174 | {0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,2,2,2,2,-1}; |
08d6922f | 175 | const Int_t AliTOFRawStream::fgkModule1MapCrate0[]= |
4306fa22 | 176 | {0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,2,2,2,2,-1}; |
08d6922f | 177 | const Int_t AliTOFRawStream::fgkModule0MapCrate1[]= |
4306fa22 | 178 | {0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,2,2,2,2,-1}; |
08d6922f | 179 | const Int_t AliTOFRawStream::fgkModule1MapCrate1[]= |
4306fa22 | 180 | {0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,2,2,2,2,-1}; |
181 | ||
08d6922f | 182 | const Int_t AliTOFRawStream::fgkModule0MapCrate2[]= |
4306fa22 | 183 | {4,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,2,2,2,2,-1}; |
08d6922f | 184 | const Int_t AliTOFRawStream::fgkModule1MapCrate2[]= |
4306fa22 | 185 | {4,4,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,2,2,2,2,-1}; |
08d6922f | 186 | const Int_t AliTOFRawStream::fgkModule0MapCrate3[]= |
4306fa22 | 187 | {4,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,2,2,2,2,-1}; |
08d6922f | 188 | const Int_t AliTOFRawStream::fgkModule1MapCrate3[]= |
4306fa22 | 189 | {4,4,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,2,2,2,2,-1}; |
08d6922f | 190 | |
191 | const Int_t AliTOFRawStream::fgkChannelMap0[5][19]= | |
4306fa22 | 192 | {{0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9}, |
193 | {9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18}, | |
194 | {19,19,20,20,21,21,22,22,22,21,21,20,20,19,19,-1,-1,-1,-1}, | |
195 | {18,18,17,17,16,16,15,15,14,14,13,13,12,12,11,11,10,10,9}, | |
08d6922f | 196 | {9,8,8,7,7,6,6,5,5,4,4,3,3,2,2,1,1,0,0} |
197 | }; | |
198 | ||
199 | const Int_t AliTOFRawStream::fgkChainMap0[5][19]= | |
4306fa22 | 200 | {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, |
201 | {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, | |
202 | {0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,-1,-1,-1,-1}, | |
203 | {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, | |
204 | {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1} | |
205 | }; | |
08d6922f | 206 | |
207 | const Int_t AliTOFRawStream::fgkChannelMap24[5][19]= | |
4306fa22 | 208 | {{0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9}, |
209 | {9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18}, | |
210 | {19,19,20,20,21,21,22,22,22,21,21,20,20,19,19,-1,-1,-1,-1}, | |
211 | {18,18,17,17,16,16,15,15,14,14,13,13,12,12,11,11,10,10,9}, | |
212 | {9,8,8,7,7,6,6,5,5,4,4,3,3,2,2,1,1,0,0} | |
213 | }; | |
08d6922f | 214 | |
215 | const Int_t AliTOFRawStream::fgkChainMap24[5][19]= | |
4306fa22 | 216 | {{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, |
217 | {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}, | |
218 | {1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,-1,-1,-1,-1}, | |
219 | {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, | |
220 | {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} | |
221 | }; | |
08d6922f | 222 | |
dd824655 | 223 | Bool_t AliTOFRawStream::fgApplyBCCorrections = kTRUE; |
571dda3d | 224 | //_____________________________________________________________________________ |
655e379f | 225 | AliTOFRawStream::AliTOFRawStream(AliRawReader* rawReader): |
15ec34b9 | 226 | fRawReader(rawReader), |
2bf66a2d | 227 | fTOFrawData(new TClonesArray("AliTOFrawData",1000)), |
7813bb1a | 228 | fDecoder(new AliTOFDecoder()), |
5b4ed716 | 229 | fDecoderV2(new AliTOFDecoderV2()), |
655e379f | 230 | fDDL(-1), |
231 | fTRM(-1), | |
655e379f | 232 | fTRMchain(-1), |
15ec34b9 | 233 | fTDC(-1), |
655e379f | 234 | fTDCchannel(-1), |
15ec34b9 | 235 | fTime(-1), |
655e379f | 236 | fToT(-1), |
15ec34b9 | 237 | fLeadingEdge(-1), |
238 | fTrailingEdge(-1), | |
655e379f | 239 | fErrorFlag(-1), |
655e379f | 240 | fSector(-1), |
241 | fPlate(-1), | |
242 | fStrip(-1), | |
243 | fPadX(-1), | |
244 | fPadZ(-1), | |
15ec34b9 | 245 | fPackedDigits(0), |
655e379f | 246 | fWordType(-1), |
247 | fSlotID(-1), | |
248 | fACQ(-1), | |
249 | fPSbit(-1), | |
655e379f | 250 | fTDCerrorFlag(-1), |
251 | fInsideDRM(kFALSE), | |
252 | fInsideTRM(kFALSE), | |
253 | fInsideLTM(kFALSE), | |
254 | fInsideTRMchain0(kFALSE), | |
38f24f3f | 255 | fInsideTRMchain1(kFALSE), |
5042b04a | 256 | //fDataBuffer(), |
257 | //fPackedDataBuffer(), | |
38f24f3f | 258 | fLocalEventCounterDRM(-1), |
259 | fLocalEventCounterLTM(-1), | |
5042b04a | 260 | //fLocalEventCounterTRM(), |
261 | //fLocalEventCounterChain(), | |
262 | //fChainBunchID(), | |
04bacbd9 | 263 | //fCableLengthMap(new AliTOFCableLengthMap()), |
f472295e | 264 | fEventID(0), |
265 | fNewDecoderVersion(0) | |
571dda3d | 266 | { |
267 | // | |
268 | // create an object to read TOF raw digits | |
269 | // | |
270 | ||
7813bb1a | 271 | for (Int_t i=0;i<AliDAQ::NumberOfDdls("TOF");i++){ |
d35d0ea0 | 272 | ResetDataBuffer(i); |
273 | ResetPackedDataBuffer(i); | |
7813bb1a | 274 | } |
275 | ||
2bf66a2d | 276 | //fTOFrawData = new TClonesArray("AliTOFrawData",1000); |
7813bb1a | 277 | fTOFrawData->SetOwner(); |
278 | ||
15ec34b9 | 279 | fRawReader->Reset(); |
362c9d61 | 280 | fRawReader->Select("TOF"); |
38f24f3f | 281 | |
e1d95075 | 282 | for (Int_t jj=0;jj<13;jj++) { |
283 | fLocalEventCounterTRM[jj] = -1; | |
284 | for (Int_t ii=0;ii<2;ii++) { | |
285 | fLocalEventCounterChain[jj][ii] = -1; | |
286 | fChainBunchID[jj][ii] = -1; | |
ca6d7f17 | 287 | } |
288 | } | |
38f24f3f | 289 | |
571dda3d | 290 | } |
291 | ||
292 | //_____________________________________________________________________________ | |
655e379f | 293 | AliTOFRawStream::AliTOFRawStream(): |
2bf66a2d | 294 | fRawReader(0x0), |
295 | fTOFrawData(new TClonesArray("AliTOFrawData",1000)), | |
7813bb1a | 296 | fDecoder(new AliTOFDecoder()), |
5b4ed716 | 297 | fDecoderV2(new AliTOFDecoderV2()), |
655e379f | 298 | fDDL(-1), |
299 | fTRM(-1), | |
655e379f | 300 | fTRMchain(-1), |
15ec34b9 | 301 | fTDC(-1), |
655e379f | 302 | fTDCchannel(-1), |
15ec34b9 | 303 | fTime(-1), |
655e379f | 304 | fToT(-1), |
15ec34b9 | 305 | fLeadingEdge(-1), |
306 | fTrailingEdge(-1), | |
655e379f | 307 | fErrorFlag(-1), |
655e379f | 308 | fSector(-1), |
309 | fPlate(-1), | |
310 | fStrip(-1), | |
311 | fPadX(-1), | |
312 | fPadZ(-1), | |
15ec34b9 | 313 | fPackedDigits(0), |
655e379f | 314 | fWordType(-1), |
315 | fSlotID(-1), | |
316 | fACQ(-1), | |
317 | fPSbit(-1), | |
655e379f | 318 | fTDCerrorFlag(-1), |
319 | fInsideDRM(kFALSE), | |
320 | fInsideTRM(kFALSE), | |
321 | fInsideLTM(kFALSE), | |
322 | fInsideTRMchain0(kFALSE), | |
38f24f3f | 323 | fInsideTRMchain1(kFALSE), |
5042b04a | 324 | //fDataBuffer(), |
325 | //fPackedDataBuffer(), | |
38f24f3f | 326 | fLocalEventCounterDRM(-1), |
327 | fLocalEventCounterLTM(-1), | |
5042b04a | 328 | //fLocalEventCounterTRM(), |
329 | //fLocalEventCounterChain(), | |
330 | //fChainBunchID(), | |
04bacbd9 | 331 | //fCableLengthMap(new AliTOFCableLengthMap()), |
f472295e | 332 | fEventID(0), |
333 | fNewDecoderVersion(0) | |
571dda3d | 334 | { |
335 | // | |
d0eb8f39 | 336 | // default ctr |
571dda3d | 337 | // |
7813bb1a | 338 | for (Int_t i=0;i<AliDAQ::NumberOfDdls("TOF");i++){ |
d35d0ea0 | 339 | ResetDataBuffer(i); |
340 | ResetPackedDataBuffer(i); | |
7813bb1a | 341 | } |
15ec34b9 | 342 | |
2bf66a2d | 343 | //fTOFrawData = new TClonesArray("AliTOFrawData",1000); |
7813bb1a | 344 | fTOFrawData->SetOwner(); |
38f24f3f | 345 | |
ca6d7f17 | 346 | for (Int_t j=0;j<13;j++){ |
347 | fLocalEventCounterTRM[j] = -1; | |
ca6d7f17 | 348 | for (Int_t k=0;k<2;k++){ |
349 | fLocalEventCounterChain[j][k] = -1; | |
350 | fChainBunchID[j][k] = -1; | |
351 | } | |
352 | } | |
38f24f3f | 353 | |
d0eb8f39 | 354 | } |
355 | ||
356 | //_____________________________________________________________________________ | |
357 | AliTOFRawStream::AliTOFRawStream(const AliTOFRawStream& stream) : | |
655e379f | 358 | TObject(stream), |
8a190ba2 | 359 | fRawReader(stream.fRawReader), |
360 | fTOFrawData(stream.fTOFrawData), | |
7813bb1a | 361 | fDecoder(new AliTOFDecoder()), |
5b4ed716 | 362 | fDecoderV2(new AliTOFDecoderV2()), |
8a190ba2 | 363 | fDDL(stream.fDDL), |
364 | fTRM(stream.fTRM), | |
365 | fTRMchain(stream.fTRMchain), | |
366 | fTDC(stream.fTDC), | |
367 | fTDCchannel(stream.fTDCchannel), | |
368 | fTime(stream.fTime), | |
369 | fToT(-stream.fToT), | |
370 | fLeadingEdge(stream.fLeadingEdge), | |
371 | fTrailingEdge(stream.fTrailingEdge), | |
372 | fErrorFlag(stream.fErrorFlag), | |
373 | fSector(stream.fSector), | |
374 | fPlate(stream.fPlate), | |
375 | fStrip(stream.fStrip), | |
376 | fPadX(stream.fPadX), | |
377 | fPadZ(stream.fPadZ), | |
378 | fPackedDigits(stream.fPackedDigits), | |
379 | fWordType(stream.fWordType), | |
380 | fSlotID(stream.fSlotID), | |
381 | fACQ(stream.fACQ), | |
382 | fPSbit(stream.fPSbit), | |
383 | fTDCerrorFlag(stream.fTDCerrorFlag), | |
384 | fInsideDRM(stream.fInsideDRM), | |
385 | fInsideTRM(stream.fInsideTRM), | |
386 | fInsideLTM(stream.fInsideLTM), | |
387 | fInsideTRMchain0(stream.fInsideTRMchain0), | |
388 | fInsideTRMchain1(stream.fInsideTRMchain1), | |
5042b04a | 389 | //fDataBuffer(), |
390 | //fPackedDataBuffer(), | |
8a190ba2 | 391 | fLocalEventCounterDRM(stream.fLocalEventCounterDRM), |
392 | fLocalEventCounterLTM(stream.fLocalEventCounterLTM), | |
5042b04a | 393 | //fLocalEventCounterTRM(), |
394 | //fLocalEventCounterChain(), | |
395 | //fChainBunchID(), | |
04bacbd9 | 396 | //fCableLengthMap(stream.fCableLengthMap), |
f472295e | 397 | fEventID(stream.fEventID), |
398 | fNewDecoderVersion(stream.fNewDecoderVersion) | |
d0eb8f39 | 399 | { |
400 | // | |
401 | // copy constructor | |
402 | // | |
403 | ||
7813bb1a | 404 | for (Int_t i=0;i<AliDAQ::NumberOfDdls("TOF");i++){ |
d35d0ea0 | 405 | fDataBuffer[i] = stream.fDataBuffer[i]; |
406 | fPackedDataBuffer[i] = stream.fPackedDataBuffer[i]; | |
7813bb1a | 407 | } |
408 | ||
409 | fTOFrawData = new TClonesArray(*stream.fTOFrawData); | |
38f24f3f | 410 | |
ca6d7f17 | 411 | for (Int_t j=0;j<13;j++){ |
412 | fLocalEventCounterTRM[j] = stream.fLocalEventCounterTRM[j]; | |
413 | for (Int_t k=0;k<2;k++){ | |
414 | fLocalEventCounterChain[j][k] = stream.fLocalEventCounterChain[j][k]; | |
415 | fChainBunchID[j][k] = stream.fChainBunchID[j][k]; | |
416 | } | |
417 | } | |
38f24f3f | 418 | |
571dda3d | 419 | } |
420 | ||
421 | //_____________________________________________________________________________ | |
422 | AliTOFRawStream& AliTOFRawStream::operator = (const AliTOFRawStream& stream) | |
423 | { | |
424 | // | |
425 | // assignment operator | |
426 | // | |
427 | ||
8a190ba2 | 428 | if (this == &stream) |
429 | return *this; | |
430 | ||
431 | TObject::operator=(stream); | |
432 | ||
571dda3d | 433 | fRawReader = stream.fRawReader; |
15ec34b9 | 434 | |
435 | fTOFrawData = stream.fTOFrawData; | |
436 | ||
571dda3d | 437 | fDDL = stream.fDDL; |
438 | fTRM = stream.fTRM; | |
d0eb8f39 | 439 | fTRMchain = stream.fTRMchain; |
15ec34b9 | 440 | fTDC = stream.fTDC; |
d0eb8f39 | 441 | fTDCchannel = stream.fTDCchannel; |
15ec34b9 | 442 | fTime = stream.fTime; |
d0eb8f39 | 443 | fToT = stream.fToT; |
15ec34b9 | 444 | fLeadingEdge = stream.fLeadingEdge; |
445 | fTrailingEdge = stream.fTrailingEdge; | |
571dda3d | 446 | fErrorFlag = stream.fErrorFlag; |
d0eb8f39 | 447 | |
448 | fSector = stream.fSector; | |
449 | fPlate = stream.fPlate; | |
450 | fStrip = stream.fStrip; | |
451 | fPadX = stream.fPadX; | |
452 | fPadZ = stream.fPadZ; | |
571dda3d | 453 | |
15ec34b9 | 454 | fPackedDigits = stream.fPackedDigits; |
455 | ||
d0eb8f39 | 456 | fWordType = stream.fWordType; |
457 | fSlotID = stream.fSlotID; | |
458 | fACQ = stream.fACQ; | |
459 | fPSbit = stream.fPSbit; | |
d0eb8f39 | 460 | fTDCerrorFlag = stream.fTDCerrorFlag; |
461 | fInsideDRM = stream.fInsideDRM; | |
462 | fInsideTRM = stream.fInsideTRM; | |
463 | fInsideLTM = stream.fInsideLTM; | |
464 | fInsideTRMchain0 = stream.fInsideTRMchain0; | |
465 | fInsideTRMchain1 = stream.fInsideTRMchain1; | |
4306fa22 | 466 | |
7813bb1a | 467 | for (Int_t i=0;i<AliDAQ::NumberOfDdls("TOF");i++){ |
468 | fDataBuffer[i] = stream.fDataBuffer[i]; | |
469 | fPackedDataBuffer[i] = stream.fPackedDataBuffer[i]; | |
470 | } | |
471 | ||
472 | fTOFrawData = stream.fTOFrawData; | |
38f24f3f | 473 | |
ca6d7f17 | 474 | fLocalEventCounterDRM = stream.fLocalEventCounterDRM; |
475 | fLocalEventCounterLTM = stream.fLocalEventCounterLTM; | |
476 | for (Int_t j=0;j<13;j++){ | |
477 | fLocalEventCounterTRM[j] = stream.fLocalEventCounterTRM[j]; | |
478 | for (Int_t k=0;k<2;k++){ | |
479 | fLocalEventCounterChain[j][k] = stream.fLocalEventCounterChain[j][k]; | |
480 | fChainBunchID[j][k] = stream.fChainBunchID[j][k]; | |
481 | } | |
482 | } | |
38f24f3f | 483 | |
04bacbd9 | 484 | //fCableLengthMap = stream.fCableLengthMap; |
32ead898 | 485 | |
486 | fEventID = stream.fEventID; | |
f472295e | 487 | fNewDecoderVersion = stream.fNewDecoderVersion; |
32ead898 | 488 | |
571dda3d | 489 | return *this; |
490 | ||
491 | } | |
492 | ||
493 | //_____________________________________________________________________________ | |
494 | AliTOFRawStream::~AliTOFRawStream() | |
495 | { | |
4306fa22 | 496 | // destructor |
571dda3d | 497 | |
15ec34b9 | 498 | fPackedDigits = 0; |
499 | ||
7813bb1a | 500 | delete fDecoder; |
5b4ed716 | 501 | delete fDecoderV2; |
502 | ||
7813bb1a | 503 | fTOFrawData->Clear(); |
504 | delete fTOFrawData; | |
38f24f3f | 505 | |
04bacbd9 | 506 | //delete fCableLengthMap; |
38f24f3f | 507 | |
571dda3d | 508 | } |
509 | ||
510 | ||
15ec34b9 | 511 | //_____________________________________________________________________________ |
512 | ||
513 | void AliTOFRawStream::LoadRawData(Int_t indexDDL) | |
514 | { | |
0192b95f | 515 | // |
516 | // To load raw data | |
517 | // | |
15ec34b9 | 518 | |
e7f49164 | 519 | fEventID = (Int_t)fRawReader->GetBCID(); //bunch crossing |
520 | ||
74cd22f8 | 521 | fTOFrawData->Clear(); |
0192b95f | 522 | |
74cd22f8 | 523 | TClonesArray &arrayTofRawData = *fTOFrawData; |
524 | ||
15ec34b9 | 525 | fPackedDigits = 0; |
526 | ||
527 | // create raw data map | |
66eae3f0 | 528 | AliTOFRawMap rawMap(fTOFrawData); |
529 | rawMap.Clear(); | |
15ec34b9 | 530 | |
531 | Int_t slot[4] = {-1, -1, -1, -1}; | |
532 | ||
415c84fa | 533 | fLocalEventCounterDRM = -1; |
534 | fLocalEventCounterLTM = -1; | |
535 | for (Int_t ii=0; ii<13; ii++) | |
536 | fLocalEventCounterTRM[ii] = -1; | |
537 | for (Int_t ii=0; ii<13; ii++) | |
5042b04a | 538 | for (Int_t jj=0; jj<2; jj++) { |
415c84fa | 539 | fLocalEventCounterChain[ii][jj] = -1; |
5042b04a | 540 | fChainBunchID[ii][jj] = -1; |
541 | } | |
415c84fa | 542 | |
15ec34b9 | 543 | fRawReader->Reset(); |
544 | fRawReader->Select("TOF", indexDDL, indexDDL); | |
545 | ||
546 | Bool_t signal = kFALSE; | |
547 | ||
74cd22f8 | 548 | AliTOFrawData *rawDigit = NULL; |
7813bb1a | 549 | |
15ec34b9 | 550 | while(Next()) { |
551 | ||
552 | signal = (fSector!=-1 && fPlate!=-1 && fStrip!=-1 && fPadZ!=-1 && fPadX!=-1); | |
553 | if (signal) { | |
38f24f3f | 554 | AliDebug(2,Form(" %2i %1i %2i %1i %2i", fSector, fPlate, fStrip, fPadZ, fPadX)); |
15ec34b9 | 555 | |
556 | slot[0] = fTRM; | |
557 | slot[1] = fTRMchain; | |
558 | slot[2] = fTDC; | |
559 | slot[3] = fTDCchannel; | |
560 | ||
66eae3f0 | 561 | if (rawMap.TestHit(slot) != kEmpty) { |
15ec34b9 | 562 | |
66eae3f0 | 563 | rawDigit = static_cast<AliTOFrawData*>(rawMap.GetHit(slot)); |
15ec34b9 | 564 | |
565 | if (rawDigit->GetLeading()!=-1 && rawDigit->GetTrailing()==-1 && | |
566 | fLeadingEdge==-1 && fTrailingEdge!=-1) { | |
567 | ||
568 | rawDigit->Update(fTime, fToT, fLeadingEdge, fTrailingEdge, fPSbit, fACQ, fErrorFlag); | |
569 | } | |
570 | else if ( ((rawDigit->GetTOF()!=-1 || rawDigit->GetLeading()!=-1 || rawDigit->GetTrailing()!=-1) && | |
571 | (fLeadingEdge!=-1 || fTrailingEdge!=-1 || fTime!=-1) ) | |
572 | ||
0192b95f | 573 | ) |
15ec34b9 | 574 | { |
575 | ||
74cd22f8 | 576 | new (arrayTofRawData[fPackedDigits++]) AliTOFrawData(fTRM, fTRMchain, fTDC, fTDCchannel, fTime, fToT, fLeadingEdge, fTrailingEdge, fPSbit, fACQ, fErrorFlag); |
15ec34b9 | 577 | |
66eae3f0 | 578 | rawMap.SetHit(slot); |
15ec34b9 | 579 | |
74cd22f8 | 580 | } |
15ec34b9 | 581 | |
582 | ||
583 | } | |
584 | else { | |
585 | ||
15ec34b9 | 586 | new (arrayTofRawData[fPackedDigits++]) AliTOFrawData(fTRM, fTRMchain, fTDC, fTDCchannel, fTime, fToT, fLeadingEdge, fTrailingEdge, fPSbit, fACQ, fErrorFlag); |
587 | ||
66eae3f0 | 588 | rawMap.SetHit(slot); |
15ec34b9 | 589 | |
66eae3f0 | 590 | } // else if (rawMap.TestHit(slot) == kEmpty) |
15ec34b9 | 591 | |
592 | } // if (signal) | |
593 | ||
594 | } // closed -> while (Next()) | |
595 | ||
15ec34b9 | 596 | } |
597 | ||
571dda3d | 598 | //_____________________________________________________________________________ |
599 | Bool_t AliTOFRawStream::Next() | |
600 | { | |
d0eb8f39 | 601 | // |
602 | // Read next 32-bit word in TOF raw data files | |
603 | // returns kFALSE if there is no word left | |
604 | // | |
571dda3d | 605 | |
606 | UInt_t data; | |
607 | ||
38f24f3f | 608 | Int_t dummy = 0; |
609 | ||
571dda3d | 610 | if (!fRawReader->ReadNextInt(data)) return kFALSE; |
611 | ||
d0eb8f39 | 612 | if (fSector!=-1 && fPlate!=-1 && fStrip!=-1 && fPadZ!=-1 && fPadX!=-1) { |
613 | fSector = -1; | |
15ec34b9 | 614 | fPlate = -1; |
615 | fStrip = -1; | |
616 | fPadZ = -1; | |
617 | fPadX = -1; | |
618 | fTime = -1; | |
619 | fToT = -1; | |
620 | fLeadingEdge = -1; | |
621 | fTrailingEdge = -1; | |
d0eb8f39 | 622 | } |
571dda3d | 623 | |
571dda3d | 624 | fDDL = fRawReader->GetDDLID(); |
625 | ||
d0eb8f39 | 626 | fWordType = GetField(data,WORD_TYPE_MASK,WORD_TYPE_POSITION); |
627 | ||
628 | switch (fWordType) { // switch word type | |
629 | ||
630 | case GLOBAL_HEADER_TYPE: // global header | |
631 | fSlotID = GetField(data, HEADER_SLOT_ID_MASK, HEADER_SLOT_ID_POSITION); | |
632 | fTRM = fSlotID; | |
633 | ||
634 | ||
635 | switch (fSlotID) { // switch global header slot ID | |
636 | ||
637 | case DRM_ID_NUMBER: //DRM global header | |
638 | if (fInsideDRM) { // unexpected DRM global headers -> exit | |
639 | break; | |
640 | } | |
641 | fInsideDRM = kTRUE; // DRM global header accepted | |
642 | break; | |
643 | ||
644 | case LTM_ID_NUMBER: // LTM global header | |
645 | if (fInsideLTM) { // unexpected LTM global headers -> exit | |
646 | break; | |
647 | } | |
648 | fInsideLTM = kTRUE; // LTM global header accepted | |
649 | break; | |
650 | ||
651 | case 3: //TRM header | |
652 | case 4: //TRM header | |
653 | case 5: //TRM header | |
654 | case 6: //TRM header | |
655 | case 7: //TRM header | |
656 | case 8: //TRM header | |
657 | case 9: //TRM header | |
658 | case 10: //TRM header | |
659 | case 11: //TRM header | |
660 | case 12: //TRM header | |
661 | if (fInsideTRM) { // unexpected TRM global headers -> exit | |
662 | break; | |
663 | } | |
664 | fInsideTRM = kTRUE; // TRM global header accepted | |
665 | fACQ = GetField(data,TRM_ACQ_BITS_MASK,TRM_ACQ_BITS_POSITION); | |
666 | break; | |
667 | ||
668 | default: // unexpected global header slot ID | |
669 | break; | |
670 | ||
671 | } //end switch global header slot id | |
672 | ||
673 | break; | |
674 | ||
675 | ||
676 | case GLOBAL_TRAILER_TYPE: // global trailer | |
677 | fSlotID = GetField(data,HEADER_SLOT_ID_MASK,HEADER_SLOT_ID_POSITION); | |
d0eb8f39 | 678 | |
679 | switch (fSlotID) { // switch global trailer slot ID | |
680 | ||
681 | case DRM_ID_NUMBER: // DRM global trailer | |
682 | if (!fInsideDRM) { // unexpected DRM global trailers -> exit | |
683 | break; | |
684 | } | |
38f24f3f | 685 | dummy = 0x0000fff0; |
686 | //AliInfo(Form(" DRM local event counter = %i", GetField(data,dummy,4))); | |
ca6d7f17 | 687 | fLocalEventCounterDRM = GetField(data,dummy,4); |
d0eb8f39 | 688 | fInsideDRM = kFALSE; // DRM global trailer accepted |
689 | fInsideTRM = kFALSE; | |
690 | fInsideLTM = kFALSE; | |
691 | fInsideTRMchain0 = kFALSE; | |
692 | fInsideTRMchain1 = kFALSE; | |
d0eb8f39 | 693 | fSector = -1; |
15ec34b9 | 694 | fPlate = -1; |
695 | fStrip = -1; | |
696 | fPadZ = -1; | |
697 | fPadX = -1; | |
698 | fDDL = -1; | |
699 | fTRM = -1; | |
700 | fTDC = -1; | |
701 | fTRMchain = -1; | |
d0eb8f39 | 702 | fTDCchannel = -1; |
15ec34b9 | 703 | fTime = -1; |
704 | fToT = -1; | |
705 | fLeadingEdge = -1; | |
706 | fTrailingEdge = -1; | |
d0eb8f39 | 707 | fErrorFlag = -1; |
15ec34b9 | 708 | fACQ = -1; |
d0eb8f39 | 709 | fPSbit = -1; |
d0eb8f39 | 710 | fTDCerrorFlag = -1; |
711 | break; | |
712 | case LTM_ID_NUMBER: // LTM global trailer | |
713 | if (!fInsideLTM) { // unexpected LTM global trailer -> exit | |
714 | break; | |
715 | } | |
38f24f3f | 716 | dummy = 0x0fff0000; |
717 | //AliInfo(Form(" LTM local event counter = %i", GetField(data,dummy,16))); | |
ca6d7f17 | 718 | fLocalEventCounterLTM = GetField(data,dummy,16); |
d0eb8f39 | 719 | fInsideLTM = kFALSE; // LTM global trailer accepted |
720 | break; | |
721 | case 15: //TRM global trailer | |
722 | if (!fInsideTRM) { // unexpected TRM global trailers -> exit | |
723 | break; | |
724 | } | |
38f24f3f | 725 | dummy = 0x0fff0000; |
726 | //AliInfo(Form(" TRM local event counter = %i", GetField(data,dummy,16))); | |
ca6d7f17 | 727 | fLocalEventCounterTRM[fTRM] = GetField(data,dummy,16); |
d0eb8f39 | 728 | fInsideTRM = kFALSE; // TRM global trailer accepted |
729 | break; | |
730 | default: // unexpected global trailer slot ID | |
731 | break; | |
732 | } //end switch global trailer slot id | |
733 | ||
734 | ||
735 | break; | |
736 | ||
737 | ||
738 | case ERROR_TYPE: // TDC error | |
15ec34b9 | 739 | fTDC = GetField(data,TRM_TDC_ERROR_TDC_ID_MASK,TRM_TDC_ERROR_TDC_ID_POSITION); |
d0eb8f39 | 740 | fTDCerrorFlag = GetField(data,TRM_TDC_ERROR_FLAGS_MASK,TRM_TDC_ERROR_FLAGS_POSITION); |
741 | break; | |
742 | ||
743 | ||
744 | case FILLER_TYPE: // filler | |
745 | break; | |
746 | ||
747 | ||
748 | default: // other word types | |
749 | ||
750 | if (fInsideTRM) { // inside TRM | |
751 | ||
752 | switch (fWordType) { // switch word type inside TRM | |
753 | case TRM_CHAIN0_HEADER_TYPE: // TRM chain0 header | |
754 | if (fInsideTRMchain0) { // unexpected TRM chain0 header | |
755 | break; | |
756 | } | |
757 | fInsideTRMchain0 = kTRUE; | |
758 | fTRMchain = 0; | |
ca6d7f17 | 759 | dummy = 0x0000fff0; |
760 | //AliInfo(Form(" chain bunch ID = %i", GetField(data,dummy,4))); | |
761 | fChainBunchID[fTRM][fTRMchain] = GetField(data,dummy,4); | |
d0eb8f39 | 762 | break; |
763 | case TRM_CHAIN0_TRAILER_TYPE: // TRM chain0 trailer | |
764 | if (!fInsideTRMchain0) { // unexpected TRM chain0 trailer | |
765 | break; | |
766 | } | |
38f24f3f | 767 | dummy = 0x0fff0000; |
768 | //AliInfo(Form(" chain local event counter = %i", GetField(data,dummy,16))); | |
ca6d7f17 | 769 | fLocalEventCounterChain[fTRM][fTRMchain] = GetField(data,dummy,16); |
d0eb8f39 | 770 | fInsideTRMchain0 = kFALSE; |
771 | fTRMchain = -1; | |
772 | break; | |
773 | case TRM_CHAIN1_HEADER_TYPE: // TRM chain1 header | |
774 | if (fInsideTRMchain1) { // unexpected TRM chain1 header | |
775 | break; | |
776 | } | |
777 | fInsideTRMchain1 = kTRUE; | |
778 | fTRMchain = 1; | |
ca6d7f17 | 779 | dummy = 0x0000fff0; |
780 | //AliInfo(Form(" chain bunch ID = %i", GetField(data,dummy,4))); | |
781 | fChainBunchID[fTRM][fTRMchain] = GetField(data,dummy,4); | |
d0eb8f39 | 782 | break; |
783 | case TRM_CHAIN1_TRAILER_TYPE: // TRM chain1 trailer | |
784 | if (!fInsideTRMchain1) { // unexpected TRM chain1 trailer | |
785 | break; | |
786 | } | |
38f24f3f | 787 | dummy = 0x0fff0000; |
788 | //AliInfo(Form(" chain local event counter = %i", GetField(data,dummy,16))); | |
ca6d7f17 | 789 | fLocalEventCounterChain[fTRM][fTRMchain] = GetField(data,dummy,16); |
d0eb8f39 | 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 | |
15ec34b9 | 803 | |
804 | fPSbit = GetField(data,TRM_PS_BITS_MASK,TRM_PS_BITS_POSITION); | |
805 | fTDC = GetField(data,TRM_TDC_ID_MASK,TRM_TDC_ID_POSITION); | |
d0eb8f39 | 806 | fTDCchannel = GetField(data,TRM_CHAN_MASK,TRM_CHAN_POSITION); |
15ec34b9 | 807 | fErrorFlag = GetField(data,TRM_E_BIT_MASK,TRM_E_BIT_POSITION); |
808 | ||
809 | SetSector(); | |
810 | SetPlate(); | |
811 | SetStrip(); | |
812 | SetPadZ(); | |
813 | SetPadX(); | |
814 | ||
d0eb8f39 | 815 | |
816 | switch (fPSbit) { // switch fPSbit bits inside TRM chains | |
15ec34b9 | 817 | |
818 | case 0: // packing ok, digit time and TOT | |
819 | fToT = GetField(data,TRM_TOT_WIDTH_MASK, TRM_TOT_WIDTH_POSITION); | |
32ead898 | 820 | fTime = GetField(data,TRM_DIGIT_TIME_MASK,TRM_DIGIT_TIME_POSITION) |
cfceaf15 | 821 | /*- |
822 | fCableLengthMap->GetCableTimeShiftBin(fDDL, fTRM, fTRMchain, fTDC)*/ | |
32ead898 | 823 | ; |
143cfc81 | 824 | if (fgApplyBCCorrections) { |
ca6d7f17 | 825 | AliDebug(2,"Apply nominal DDL BC time-shift correction"); |
826 | AliDebug(2,"Apply deltaBC time-shift correction"); | |
827 | AliDebug(2,Form(" fChainBunchID[%d][%d] = %d ,fEventID = %d",fTRM,fTRMchain,fChainBunchID[fTRM][fTRMchain],fEventID)); | |
e7f49164 | 828 | fTime += fgkddlBCshift[fDDL] * 1024 + (fChainBunchID[fTRM][fTRMchain] - fEventID) * 1024; |
143cfc81 | 829 | } |
d0eb8f39 | 830 | break; |
831 | ||
832 | case 1: // leading edge digit, long digit time, no TOT | |
15ec34b9 | 833 | //fToT = -1; |
834 | //fTime = -1; | |
32ead898 | 835 | fLeadingEdge = GetField(data,TRM_LONG_DIGIT_TIME_MASK,TRM_LONG_DIGIT_TIME_POSITION) |
cfceaf15 | 836 | /*- |
837 | fCableLengthMap->GetCableTimeShiftBin(fDDL, fTRM, fTRMchain, fTDC)*/ | |
32ead898 | 838 | ; |
143cfc81 | 839 | if (fgApplyBCCorrections) { |
ca6d7f17 | 840 | AliDebug(2,"Apply nominal DDL BC time-shift correction"); |
841 | AliDebug(2,"Apply deltaBC time-shift correction"); | |
842 | AliDebug(2,Form(" fChainBunchID[%d][%d] = %d ,fEventID = %d",fTRM,fTRMchain,fChainBunchID[fTRM][fTRMchain],fEventID)); | |
e7f49164 | 843 | fLeadingEdge += fgkddlBCshift[fDDL] * 1024 + (fChainBunchID[fTRM][fTRMchain] - fEventID) * 1024; |
143cfc81 | 844 | } |
d0eb8f39 | 845 | break; |
846 | ||
847 | case 2: // trailing edge digit, long digit time, no TOT | |
15ec34b9 | 848 | //fToT = -1; |
849 | //fTime = -1; | |
32ead898 | 850 | fTrailingEdge = GetField(data,TRM_LONG_DIGIT_TIME_MASK,TRM_LONG_DIGIT_TIME_POSITION) |
cfceaf15 | 851 | /*- |
852 | fCableLengthMap->GetCableTimeShiftBin(fDDL, fTRM, fTRMchain, fTDC)*/ | |
32ead898 | 853 | ; |
143cfc81 | 854 | if (fgApplyBCCorrections) { |
ca6d7f17 | 855 | AliDebug(2,"Apply nominal DDL BC time-shift correction"); |
856 | AliDebug(2,"Apply deltaBC time-shift correction"); | |
857 | AliDebug(2,Form(" fChainBunchID[%d][%d] = %d ,fEventID = %d",fTRM,fTRMchain,fChainBunchID[fTRM][fTRMchain],fEventID)); | |
e7f49164 | 858 | fTrailingEdge += fgkddlBCshift[fDDL] * 1024 + (fChainBunchID[fTRM][fTRMchain] - fEventID) * 1024; |
143cfc81 | 859 | } |
d0eb8f39 | 860 | break; |
15ec34b9 | 861 | |
d0eb8f39 | 862 | case 3: // TOT overflow |
15ec34b9 | 863 | fToT = GetField(data,TRM_TOT_WIDTH_MASK, TRM_TOT_WIDTH_POSITION); |
32ead898 | 864 | fTime = GetField(data,TRM_DIGIT_TIME_MASK,TRM_DIGIT_TIME_POSITION) |
cfceaf15 | 865 | /*- |
866 | fCableLengthMap->GetCableTimeShiftBin(fDDL, fTRM, fTRMchain, fTDC)*/ | |
32ead898 | 867 | ; |
143cfc81 | 868 | if (fgApplyBCCorrections) { |
ca6d7f17 | 869 | AliDebug(2,"Apply nominal DDL BC time-shift correction"); |
870 | AliDebug(2,"Apply deltaBC time-shift correction"); | |
871 | AliDebug(2,Form(" fChainBunchID[%d][%d] = %d ,fEventID = %d",fTRM,fTRMchain,fChainBunchID[fTRM][fTRMchain],fEventID)); | |
e7f49164 | 872 | fTime += fgkddlBCshift[fDDL] * 1024 + (fChainBunchID[fTRM][fTRMchain] - fEventID) * 1024; |
143cfc81 | 873 | } |
d0eb8f39 | 874 | break; |
d0eb8f39 | 875 | |
15ec34b9 | 876 | } // end switch PS bits inside TRM chains |
d0eb8f39 | 877 | |
878 | } // end if is inside TRM chains | |
879 | ||
880 | } // end switch on fWordType | |
571dda3d | 881 | |
15ec34b9 | 882 | |
571dda3d | 883 | return kTRUE; |
7813bb1a | 884 | |
571dda3d | 885 | } |
886 | //_____________________________________________________________________________ | |
887 | ||
d0eb8f39 | 888 | void AliTOFRawStream::SetSector() |
571dda3d | 889 | { |
890 | // | |
d0eb8f39 | 891 | // Evaluate the TOF sector number -> [ 0;17] |
892 | // corresponding to the TOF equipment IDs: | |
893 | // fDDL -> [ 0;71] | |
894 | // fTRM -> [ 3;12] | |
15ec34b9 | 895 | // fTRMchain -> [ 0; 1] |
d0eb8f39 | 896 | // fTDC -> [ 0;14] |
897 | // fTDCchannel -> [ 0; 7] | |
571dda3d | 898 | // |
899 | ||
900 | Int_t iSector = -1; | |
571dda3d | 901 | |
d0eb8f39 | 902 | if (!(fDDL==-1)) iSector = Int_t((Float_t)(fDDL)/AliTOFGeometry::NDDL()); |
903 | ||
904 | fSector = iSector; | |
571dda3d | 905 | |
906 | } | |
907 | //_____________________________________________________________________________ | |
908 | ||
d0eb8f39 | 909 | |
910 | void AliTOFRawStream::SetPlate() | |
571dda3d | 911 | { |
912 | // | |
d0eb8f39 | 913 | // Evaluate the TOF plate number ->[ 0; 4] |
914 | // corresponding to the TOF equipment IDs: | |
915 | // fDDL -> [ 0;71] | |
916 | // fTRM -> [ 3;12] | |
15ec34b9 | 917 | // fTRMchain -> [ 0; 1] |
d0eb8f39 | 918 | // fTDC -> [ 0;14] |
919 | // fTDCchannel -> [ 0; 7] | |
571dda3d | 920 | // |
921 | ||
922 | Int_t iPlate = -1; | |
d0eb8f39 | 923 | if (!(fDDL==-1 || fTRM==-1 || fTDC==-1 |
924 | || fSector==-1)) | |
925 | iPlate = Equip2VolNplate(GetDDLnumberPerSector(fDDL), fTRM, fTDC); | |
571dda3d | 926 | |
d0eb8f39 | 927 | fPlate = iPlate; |
571dda3d | 928 | |
929 | } | |
930 | //_____________________________________________________________________________ | |
931 | ||
d0eb8f39 | 932 | void AliTOFRawStream::SetStrip() |
571dda3d | 933 | { |
934 | // | |
d0eb8f39 | 935 | // Evaluate the TOF strip number per module -> [ 0; 14/18] |
936 | // corresponding to the TOF equipment IDs: | |
937 | // fDDL -> [ 0;71] | |
938 | // fTRM -> [ 3;12] | |
15ec34b9 | 939 | // fTRMchain -> [ 0; 1] |
d0eb8f39 | 940 | // fTDC -> [ 0;14] |
941 | // fTDCchannel -> [ 0; 7] | |
571dda3d | 942 | // |
943 | ||
944 | Int_t iStrip = -1; | |
945 | ||
d0eb8f39 | 946 | if (!(fDDL==-1 || fTRM==-1 || fTDC==-1 |
947 | || fSector==-1 || fPlate==-1)) | |
948 | iStrip = Equip2VolNstrip(GetDDLnumberPerSector(fDDL), fTRM, fTDC); | |
571dda3d | 949 | |
d0eb8f39 | 950 | fStrip = iStrip; |
571dda3d | 951 | |
952 | } | |
953 | //_____________________________________________________________________________ | |
954 | ||
d0eb8f39 | 955 | void AliTOFRawStream::SetPadZ() |
571dda3d | 956 | { |
957 | // | |
d0eb8f39 | 958 | // Evaluate the TOF padRow number per strip -> [ 0; 1] |
959 | // corresponding to the TOF equipment IDs: | |
960 | // fDDL -> [ 0;71] | |
961 | // fTRM -> [ 3;12] | |
15ec34b9 | 962 | // fTRMchain -> [ 0; 1] |
d0eb8f39 | 963 | // fTDC -> [ 0;14] |
964 | // fTDCchannel -> [ 0; 7] | |
571dda3d | 965 | // |
966 | ||
967 | Int_t iPadZ = -1; | |
968 | ||
d0eb8f39 | 969 | if (!(fDDL==-1 || fTRM==-1 || fTRMchain==-1 || fTDC==-1 || fTDCchannel==-1 |
970 | || fSector==-1 || fPlate==-1 || fStrip==-1)) | |
971 | { | |
972 | Int_t iPadAlongTheStrip = Equip2VolNpad(GetDDLnumberPerSector(fDDL), fTRMchain, fTDC, fTDCchannel); | |
973 | if (iPadAlongTheStrip!=-1) | |
974 | iPadZ = iPadAlongTheStrip%AliTOFGeometry::NpadZ(); | |
975 | } | |
571dda3d | 976 | |
38f24f3f | 977 | //iPadZ = Equip2VolNpad(GetDDLnumberPerSector(fDDL), fTRMchain, fTDC, fTDCchannel)%AliTOFGeometry::NpadZ(); |
978 | //iPadZ = Equip2VolNpadZ(GetDDLnumberPerSector(fDDL), fTRMchain, fTDC, fTDCchannel); | |
979 | ||
d0eb8f39 | 980 | fPadZ = iPadZ; |
571dda3d | 981 | |
d0eb8f39 | 982 | } |
983 | //_____________________________________________________________________________ | |
984 | ||
985 | void AliTOFRawStream::SetPadX() | |
986 | { | |
987 | // | |
988 | // Evaluate the TOF pad number per strip padRow -> [ 0;47] | |
989 | // corresponding to the TOF equipment IDs: | |
990 | // fDDL -> [ 0;71] | |
991 | // fTRM -> [ 3;12] | |
15ec34b9 | 992 | // fTRMchain -> [ 0; 1] |
d0eb8f39 | 993 | // fTDC -> [ 0;14] |
994 | // fTDCchannel -> [ 0; 7] | |
995 | // | |
571dda3d | 996 | |
d0eb8f39 | 997 | Int_t iPadX = -1; |
571dda3d | 998 | |
d0eb8f39 | 999 | if (!(fDDL==-1 || fTRM==-1 || fTRMchain==-1 || fTDC==-1 || fTDCchannel==-1 |
1000 | || fSector==-1 || fPlate==-1 || fStrip==-1)) | |
1001 | { | |
1002 | Int_t iPadAlongTheStrip = Equip2VolNpad(GetDDLnumberPerSector(fDDL), fTRMchain, fTDC, fTDCchannel); | |
1003 | if (iPadAlongTheStrip!=-1) | |
1004 | iPadX = (Int_t)(iPadAlongTheStrip/(Float_t(AliTOFGeometry::NpadZ()))); | |
1005 | } | |
1006 | ||
38f24f3f | 1007 | //iPadX = (Int_t)(Equip2VolNpad(GetDDLnumberPerSector(fDDL), fTRMchain, fTDC, fTDCchannel)/(Float_t(AliTOFGeometry::NpadZ()))); |
1008 | //iPadX = Equip2VolNpadX(GetDDLnumberPerSector(fDDL), fTRMchain, fTDC, fTDCchannel); | |
1009 | ||
d0eb8f39 | 1010 | fPadX = iPadX; |
571dda3d | 1011 | |
1012 | } | |
571dda3d | 1013 | |
d0eb8f39 | 1014 | //---------------------------------------------------------------------------- |
1015 | Int_t AliTOFRawStream::GetField(UInt_t word, Int_t fieldMask, Int_t fieldPosition) const | |
1016 | { | |
1017 | // | |
a3ed3947 | 1018 | // Returns 'word' masked by 'fieldMask' and shifted by 'fieldPosition' |
d0eb8f39 | 1019 | // |
1020 | ||
1021 | return ((word & fieldMask) >> fieldPosition); | |
1022 | } | |
1023 | ||
1024 | //---------------------------------------------------------------------------- | |
13d6bff9 | 1025 | Int_t AliTOFRawStream::Equip2VolNplate(Int_t iDDL, Int_t nTRM, Int_t nTDC) |
571dda3d | 1026 | { |
1027 | // | |
d0eb8f39 | 1028 | // Returns the TOF plate number [0;4] |
1029 | // corresponding to the TOF equipment ID numbers: | |
1030 | // iDDL -> DDL number per sector [0;3] | |
1031 | // nTRM -> TRM number [3;12] | |
1032 | // nTDC -> TDC number [0;14] | |
571dda3d | 1033 | // |
1034 | ||
d0eb8f39 | 1035 | Int_t iPlate = -1; |
5f72a2bf | 1036 | |
d0eb8f39 | 1037 | if (iDDL==0) { |
1038 | ||
1039 | if (nTRM>=4 && nTRM<7) { | |
1040 | iPlate = 0; | |
1041 | } else if (nTRM==7) { | |
1042 | if (nTDC<12) iPlate = 0; | |
1043 | else iPlate = 1; | |
1044 | } else if (nTRM>=8 && nTRM<11) { | |
1045 | iPlate = 1; | |
1046 | } else if (nTRM==11) { | |
1047 | if (nTDC<9) iPlate = 1; | |
1048 | else iPlate = 2; | |
1049 | }else if (nTRM==12) { | |
1050 | iPlate = 2; | |
1051 | } | |
1052 | ||
1053 | } else if (iDDL==1) { | |
1054 | ||
1055 | if (nTRM==3) { | |
1056 | if (nTDC<3) iPlate = 0; | |
1057 | } else if (nTRM>=4 && nTRM<7) { | |
1058 | iPlate = 0; | |
1059 | } else if (nTRM==7) { | |
1060 | if (nTDC<6) iPlate = 1; | |
1061 | else iPlate = 0; | |
1062 | } else if (nTRM>=8 && nTRM<11) { | |
1063 | iPlate = 1; | |
1064 | } else if (nTRM==11) { | |
1065 | if (nTDC<9) iPlate = 2; | |
1066 | else iPlate = 1; | |
1067 | } else if (nTRM==12) { | |
1068 | iPlate = 2; | |
1069 | } | |
1070 | ||
1071 | } else if (iDDL==2) { | |
1072 | ||
1073 | if (nTRM>=4 && nTRM<7) { | |
1074 | iPlate = 4; | |
1075 | } else if (nTRM==7) { | |
1076 | if (nTDC<12) iPlate = 4; | |
1077 | else iPlate = 3; | |
1078 | } else if (nTRM>=8 && nTRM<11) { | |
1079 | iPlate = 3; | |
1080 | } else if (nTRM==11) { | |
1081 | if (nTDC<9) iPlate = 3; | |
1082 | else iPlate = 2; | |
1083 | }else if (nTRM==12) { | |
1084 | iPlate = 2; | |
1085 | } | |
1086 | ||
1087 | } else if (iDDL==3) { | |
1088 | ||
1089 | if (nTRM==3) { | |
1090 | if (nTDC<3) iPlate = 4; | |
1091 | } else if (nTRM>=4 && nTRM<7) { | |
1092 | iPlate = 4; | |
1093 | } else if (nTRM==7) { | |
1094 | if (nTDC<6) iPlate = 3; | |
1095 | else iPlate = 4; | |
1096 | } else if (nTRM>=8 && nTRM<11) { | |
1097 | iPlate = 3; | |
1098 | } else if (nTRM==11) { | |
1099 | if (nTDC<9) iPlate = 2; | |
1100 | else iPlate = 3; | |
1101 | } else if (nTRM==12) { | |
1102 | iPlate = 2; | |
1103 | } | |
571dda3d | 1104 | |
d0eb8f39 | 1105 | } |
571dda3d | 1106 | |
d0eb8f39 | 1107 | return iPlate; |
571dda3d | 1108 | |
d0eb8f39 | 1109 | } |
571dda3d | 1110 | |
d0eb8f39 | 1111 | //---------------------------------------------------------------------------- |
13d6bff9 | 1112 | Int_t AliTOFRawStream::Equip2VolNstrip(Int_t iDDL, Int_t nTRM, Int_t nTDC) |
d0eb8f39 | 1113 | { |
1114 | // | |
1115 | // Returns the TOF strip number per module: | |
1116 | // [0;14], in the central plates, | |
1117 | // [0;18], in the intermediate and external plates | |
1118 | // corresponding to the TOF equipment ID numbers: | |
1119 | // iDDL -> DDL number per sector [0;3] | |
1120 | // nTRM -> TRM number [3;12] | |
1121 | // nTDC -> TDC number [0;14] | |
1122 | // | |
571dda3d | 1123 | |
d0eb8f39 | 1124 | Int_t iStrip = -1; |
571dda3d | 1125 | |
d0eb8f39 | 1126 | if (iDDL==0) { |
1127 | ||
1128 | if (nTRM== 4) iStrip = (Int_t)(nTDC/3.); | |
1129 | else if (nTRM== 5) iStrip = 5 + (Int_t)(nTDC/3.); | |
1130 | else if (nTRM== 6) iStrip = 10 + (Int_t)(nTDC/3.); | |
1131 | else if (nTRM== 7) { | |
1132 | if (nTDC<12) iStrip = 15 + (Int_t)(nTDC/3.); | |
1133 | else iStrip = (Int_t)(nTDC/3.) - 4; | |
1134 | } | |
1135 | else if (nTRM== 8) iStrip = 1 + (Int_t)(nTDC/3.); | |
1136 | else if (nTRM== 9) iStrip = 6 + (Int_t)(nTDC/3.); | |
1137 | else if (nTRM==10) iStrip = 11 + (Int_t)(nTDC/3.); | |
1138 | else if (nTRM==11) { | |
1139 | if (nTDC<9) iStrip = 16 + (Int_t)(nTDC/3.); | |
1140 | else iStrip = (Int_t)(nTDC/3.) - 3; | |
1141 | } | |
1142 | else if (nTRM==12) iStrip = 2 + (Int_t)(nTDC/3.); | |
1143 | ||
1144 | } else if (iDDL==1) { | |
1145 | ||
1146 | if (nTRM==3 && nTDC<3) iStrip = (Int_t)(nTDC/3.); | |
1147 | else if (nTRM== 4) iStrip = 5 - (Int_t)(nTDC/3.); | |
1148 | else if (nTRM== 5) iStrip = 10 - (Int_t)(nTDC/3.); | |
1149 | else if (nTRM== 6) iStrip = 15 - (Int_t)(nTDC/3.); | |
1150 | else if (nTRM== 7) { | |
1151 | if (nTDC<6) iStrip = 1 - (Int_t)(nTDC/3.); | |
1152 | else iStrip = 20 - (Int_t)(nTDC/3.); | |
1153 | } | |
1154 | else if (nTRM== 8) iStrip = 6 - (Int_t)(nTDC/3.); | |
1155 | else if (nTRM== 9) iStrip = 11 - (Int_t)(nTDC/3.); | |
1156 | else if (nTRM==10) iStrip = 16 - (Int_t)(nTDC/3.); | |
1157 | else if (nTRM==11) { | |
1158 | if (nTDC<9) iStrip = 2 - (Int_t)(nTDC/3.); | |
1159 | else iStrip = 21 - (Int_t)(nTDC/3.); | |
1160 | } | |
1161 | else if (nTRM==12) iStrip = 7 - (Int_t)(nTDC/3.); | |
1162 | ||
1163 | } else if (iDDL==2) { | |
1164 | ||
1165 | if (nTRM== 4) iStrip = 18 - (Int_t)(nTDC/3.); | |
1166 | else if (nTRM== 5) iStrip = 18 - ( 5 + (Int_t)(nTDC/3.)); | |
1167 | else if (nTRM== 6) iStrip = 18 - (10 + (Int_t)(nTDC/3.)); | |
1168 | else if (nTRM== 7) { | |
1169 | if (nTDC<12) iStrip = 18 - (15 + (Int_t)(nTDC/3.)); | |
1170 | else iStrip = 18 - ((Int_t)(nTDC/3.) - 4); | |
1171 | } | |
1172 | else if (nTRM== 8) iStrip = 18 - ( 1 + (Int_t)(nTDC/3.)); | |
1173 | else if (nTRM== 9) iStrip = 18 - ( 6 + (Int_t)(nTDC/3.)); | |
1174 | else if (nTRM==10) iStrip = 18 - (11 + (Int_t)(nTDC/3.)); | |
1175 | else if (nTRM==11) { | |
1176 | if (nTDC<9) iStrip = 18 - (16 + (Int_t)(nTDC/3.)); | |
1177 | else iStrip = 14 - ((Int_t)(nTDC/3.) - 3); | |
1178 | } | |
1179 | else if (nTRM==12) iStrip = 14 - ( 2 + (Int_t)(nTDC/3.)); | |
1180 | ||
1181 | } else if (iDDL==3) { | |
1182 | ||
1183 | if (nTRM==3 && nTDC<3) iStrip = 18 - (Int_t)(nTDC/3.); | |
1184 | else if (nTRM== 4) iStrip = 18 - ( 5 - (Int_t)(nTDC/3.)); | |
1185 | else if (nTRM== 5) iStrip = 18 - (10 - (Int_t)(nTDC/3.)); | |
1186 | else if (nTRM== 6) iStrip = 18 - (15 - (Int_t)(nTDC/3.)); | |
1187 | else if (nTRM== 7) { | |
1188 | if (nTDC<6) iStrip = 18 - (1 - (Int_t)(nTDC/3.)); | |
1189 | else iStrip = 18 - (20 - (Int_t)(nTDC/3.)); | |
1190 | } | |
1191 | else if (nTRM== 8) iStrip = 18 - ( 6 - (Int_t)(nTDC/3.)); | |
1192 | else if (nTRM== 9) iStrip = 18 - (11 - (Int_t)(nTDC/3.)); | |
1193 | else if (nTRM==10) iStrip = 18 - (16 - (Int_t)(nTDC/3.)); | |
1194 | else if (nTRM==11) { | |
1195 | if (nTDC<9) iStrip = 14 - ( 2 - (Int_t)(nTDC/3.)); | |
1196 | else iStrip = 18 - (21 - (Int_t)(nTDC/3.)); | |
1197 | } | |
1198 | else if (nTRM==12) iStrip = 14 - ( 7 - (Int_t)(nTDC/3.)); | |
1199 | ||
1200 | } | |
1201 | ||
1202 | return iStrip; | |
1203 | ||
1204 | } | |
1205 | ||
1206 | //---------------------------------------------------------------------------- | |
1207 | Int_t AliTOFRawStream::Equip2VolNpad(Int_t iDDL, Int_t iChain, Int_t nTDC, | |
13d6bff9 | 1208 | Int_t iCH) |
d0eb8f39 | 1209 | { |
1210 | // | |
1211 | // Returns the TOF pad number per strip [0;95] | |
1212 | // corresponding to the TOF equipment ID numbers: | |
1213 | // iDDL -> DDL number per sector [0;3] | |
1214 | // iChain -> TRM chain number [0;1] | |
1215 | // nTDC -> TDC number [0;14] | |
1216 | // iCH -> TDC channel number [0;7] | |
1217 | // | |
1218 | ||
1219 | Int_t iPadAlongTheStrip = -1; | |
1220 | ||
38f24f3f | 1221 | // wrong |
1222 | //Int_t iTDClocal = nTDC%3 + (1-iChain)*3; | |
1223 | //if (iDDL==0 || iDDL==3) iTDClocal = 5 - iTDClocal; | |
1224 | //else if (iDDL==1 || iDDL==2) iTDClocal = 6 + (5 - iTDClocal); | |
d0eb8f39 | 1225 | |
38f24f3f | 1226 | // right |
1227 | Int_t iTDClocal = -1; | |
1228 | Int_t iTDClocal03 = nTDC%3 + (1-iChain)*3; | |
1229 | Int_t iTDClocal12 = 2-nTDC%3 + iChain*3; | |
1230 | if (iDDL==0 || iDDL==3) iTDClocal = 5 - iTDClocal03; | |
1231 | else if (iDDL==1 || iDDL==2) iTDClocal = 6 + (5 - iTDClocal12); | |
d0eb8f39 | 1232 | |
1233 | Int_t iCHlocal = iCH; | |
1234 | if (iDDL==0 || iDDL==3) iCHlocal = 7 - iCH; | |
1235 | ||
1236 | iPadAlongTheStrip = iTDClocal*AliTOFGeometry::NCh() + iCHlocal; | |
1237 | ||
1238 | if (((iDDL==1 || iDDL==2) && iPadAlongTheStrip< AliTOFGeometry::NpadX()) || | |
019f6101 | 1239 | ((iDDL==0 || iDDL==3) && iPadAlongTheStrip>=AliTOFGeometry::NpadX())) { |
a3ed3947 | 1240 | std::cerr << "Warning -> AliTOFRawStream::Equip2VolNpad: Problems with the padX number!\n"; |
13d6bff9 | 1241 | //AliWarning("Problems with the padX number!"); |
019f6101 | 1242 | } |
d0eb8f39 | 1243 | return iPadAlongTheStrip; |
1244 | ||
1245 | } | |
1246 | ||
38f24f3f | 1247 | //---------------------------------------------------------------------------- |
1248 | Int_t AliTOFRawStream::Equip2VolNpadX(Int_t iDDL, Int_t iChain, Int_t nTDC, | |
1249 | Int_t iCH) | |
1250 | { | |
1251 | // | |
1252 | // Returns the TOF padX number [0;47] | |
1253 | // corresponding to the TOF equipment ID numbers: | |
1254 | // iDDL -> DDL number per sector [0;3] | |
1255 | // iChain -> TRM chain number [0;1] | |
1256 | // nTDC -> TDC number [0;14] | |
1257 | // iCH -> TDC channel number [0;7] | |
1258 | // | |
1259 | ||
1260 | Int_t iPadX = (Int_t)(AliTOFRawStream::Equip2VolNpad(iDDL, iChain, nTDC, iCH)/ | |
1261 | (Float_t(AliTOFGeometry::NpadZ()))); | |
1262 | ||
1263 | return iPadX; | |
1264 | ||
1265 | } | |
1266 | ||
1267 | //---------------------------------------------------------------------------- | |
1268 | Int_t AliTOFRawStream::Equip2VolNpadZ(Int_t iDDL, Int_t iChain, Int_t nTDC, | |
1269 | Int_t iCH) | |
1270 | { | |
1271 | // | |
1272 | // Returns the TOF padZ number [0;1] | |
1273 | // corresponding to the TOF equipment ID numbers: | |
1274 | // iDDL -> DDL number per sector [0;3] | |
1275 | // iChain -> TRM chain number [0;1] | |
1276 | // nTDC -> TDC number [0;14] | |
1277 | // iCH -> TDC channel number [0;7] | |
1278 | // | |
1279 | ||
1280 | Int_t iPadZ = AliTOFRawStream::Equip2VolNpad(iDDL, iChain, nTDC, iCH)%AliTOFGeometry::NpadZ(); | |
1281 | ||
1282 | return iPadZ; | |
1283 | ||
1284 | } | |
1285 | ||
d0eb8f39 | 1286 | //---------------------------------------------------------------------------- |
5f72a2bf | 1287 | Int_t AliTOFRawStream::GetSectorNumber(Int_t nDDL) |
d0eb8f39 | 1288 | { |
1289 | // | |
1290 | // Returns the sector number [0;17] | |
1291 | // corresponing to the assigned DRM/DDL number [0;71] | |
1292 | // | |
1293 | ||
1294 | Int_t iSector = Int_t((Float_t)(nDDL)/AliTOFGeometry::NDDL()); | |
1295 | ||
1296 | return iSector; | |
1297 | ||
1298 | } | |
1299 | //---------------------------------------------------------------------------- | |
5f72a2bf | 1300 | Int_t AliTOFRawStream::GetDDLnumberPerSector(Int_t nDDL) |
d0eb8f39 | 1301 | { |
1302 | // | |
1303 | // Return the DRM/DDL number per sector [0;3] | |
1304 | // corresponing to the assigned DRM/DDL number [0;71] | |
1305 | // | |
1306 | ||
1307 | Int_t iDDL = nDDL%AliTOFGeometry::NDDL(); | |
1308 | ||
1309 | return iDDL; | |
1310 | ||
1311 | } | |
1312 | ||
7813bb1a | 1313 | //---------------------------------------------------------------------------- |
1314 | void AliTOFRawStream::EquipmentId2VolumeId(AliTOFHitData *hitData, Int_t *volume) const | |
1315 | { | |
1316 | EquipmentId2VolumeId(hitData->GetDDLID(),hitData->GetSlotID(),hitData->GetChain(),hitData->GetTDC(),hitData->GetChan(),volume); | |
1317 | } | |
d0eb8f39 | 1318 | //---------------------------------------------------------------------------- |
1319 | void AliTOFRawStream::EquipmentId2VolumeId(Int_t nDDL, Int_t nTRM, Int_t iChain, | |
a3ed3947 | 1320 | Int_t nTDC, Int_t iCH, |
1321 | Int_t *volume) | |
d0eb8f39 | 1322 | { |
1323 | // | |
1324 | // To convert: | |
1325 | // nDDL (variable in [0;71]) -> number of the DDL file | |
1326 | // nTRM (variable in [3;12]) -> number of the TRM slot | |
1327 | // iChain (variable in [0; 1]) -> number of the TRM chain | |
1328 | // nTDC (variable in [0;14]) -> number of the TDC | |
1329 | // iCH (variable in [0; 7]) -> number of the TDC channel | |
1330 | // | |
1331 | // in: | |
1332 | // sector number, i.e. volume[0] (variable in [0,17]) | |
1333 | // plate number, i.e. volume[1] (variable in [0, 5]) | |
1334 | // strip number, i.e. volume[2] (variable in [0,14/18]) | |
1335 | // padX number, i.e. volume[3] (variable in [0,47]) | |
1336 | // padZ number, i.e. volume[4] (variable in [0, 1]) | |
1337 | // | |
1338 | ||
125f7e0b | 1339 | for (Int_t ii=0; ii<5; ii++) volume[ii] = -1; |
1340 | ||
d0eb8f39 | 1341 | Int_t iDDL = GetDDLnumberPerSector(nDDL); |
1342 | ||
125f7e0b | 1343 | if (iDDL%2==1 && nTRM==3 && nTDC/3>0) { // Signal not coming from a TOF pad but -probably- from a TOF OR signal |
1344 | //printf("Info -> AliTOFRawStream::EquipmentId2VolumeId: Signal not coming from a TOF pad but -probably- from a TOF OR signal (%2d %2d %2d)\n", nDDL, nTRM, nTDC); | |
1345 | return; | |
1346 | } | |
1347 | ||
d0eb8f39 | 1348 | Int_t iSector = GetSectorNumber(nDDL); |
1349 | ||
1350 | Int_t iPlate = Equip2VolNplate(iDDL, nTRM, nTDC); | |
019f6101 | 1351 | if (iPlate==-1) { |
a9137e31 | 1352 | /*if (fRawReader) |
1353 | fRawReader->AddMajorErrorLog(kPlateError,"plate = -1");*/ | |
5b4ed716 | 1354 | AliWarningGeneral("AliTOFRawStream", Form("Warning -> AliTOFRawStream::EquipmentId2VolumeId: Problems with the plate number (%2d %2d %2d)!\n", |
1355 | nDDL, nTRM, nTDC)); | |
019f6101 | 1356 | } |
d0eb8f39 | 1357 | |
1358 | Int_t iStrip = Equip2VolNstrip(iDDL, nTRM, nTDC); | |
019f6101 | 1359 | if (iStrip==-1) { |
a9137e31 | 1360 | /*if (fRawReader) |
1361 | fRawReader->AddMajorErrorLog(kStripError,"strip = -1");*/ | |
5b4ed716 | 1362 | AliWarningGeneral("AliTOFRawStream", Form("Warning -> AliTOFRawStream::EquipmentId2VolumeId: Problems with the strip number (%2d %2d %2d)!\n", |
1363 | nDDL, nTRM, nTDC)); | |
019f6101 | 1364 | } |
d0eb8f39 | 1365 | |
1366 | Int_t iPadAlongTheStrip = Equip2VolNpad(iDDL, iChain, nTDC, iCH); | |
a9137e31 | 1367 | if (iPadAlongTheStrip==-1) { |
1368 | /*if (fRawReader) | |
1369 | fRawReader->AddMajorErrorLog(kPadAlongStripError,"pad = -1");*/ | |
5b4ed716 | 1370 | AliWarningGeneral("AliTOFRawStream", Form("Warning -> AliTOFRawStream::EquipmentId2VolumeId: Problems with the pad number along the strip (%2d %1d %2d %1d)!\n", |
1371 | nDDL, iChain, nTDC, iCH)); | |
019f6101 | 1372 | } |
13d6bff9 | 1373 | |
d0eb8f39 | 1374 | Int_t iPadX = (Int_t)(iPadAlongTheStrip/(Float_t(AliTOFGeometry::NpadZ()))); |
1375 | Int_t iPadZ = iPadAlongTheStrip%AliTOFGeometry::NpadZ(); | |
38f24f3f | 1376 | |
1377 | //Int_t iPadX = (Int_t)(Equip2VolNpad(iDDL, iChain, nTDC, iCH)/(Float_t(AliTOFGeometry::NpadZ()))); | |
1378 | //Int_t iPadZ = Equip2VolNpad(iDDL, iChain, nTDC, iCH)%AliTOFGeometry::NpadZ(); | |
1379 | ||
1380 | //Int_t iPadX = Equip2VolNpadX(iDDL, iChain, nTDC, iCH); | |
1381 | //Int_t iPadZ = Equip2VolNpadZ(iDDL, iChain, nTDC, iCH); | |
1382 | ||
d0eb8f39 | 1383 | volume[0] = iSector; |
1384 | volume[1] = iPlate; | |
1385 | volume[2] = iStrip; | |
1386 | volume[3] = iPadX; | |
1387 | volume[4] = iPadZ; | |
571dda3d | 1388 | |
1389 | } | |
7813bb1a | 1390 | //----------------------------------------------------------------------------- |
019f6101 | 1391 | Bool_t AliTOFRawStream::DecodeDDL(Int_t nDDLMin, Int_t nDDLMax, Int_t verbose = 0) { |
1392 | // | |
1393 | // To decode raw data for DDL number in [nDDLmin; nDDLmax] | |
1394 | // | |
1395 | ||
7813bb1a | 1396 | //check and fix valid DDL range |
019f6101 | 1397 | if (nDDLMin < 0){ |
1398 | nDDLMin = 0; | |
1399 | fRawReader->AddMinorErrorLog(kDDLMinError); | |
1400 | AliWarning("Wrong DDL range: setting first DDL ID to 0"); | |
7813bb1a | 1401 | } |
019f6101 | 1402 | if (nDDLMax > 71){ |
1403 | nDDLMax = 71; | |
1404 | fRawReader->AddMinorErrorLog(kDDLMaxError); | |
1405 | AliWarning("Wrong DDL range: setting last DDL ID to 71"); | |
7813bb1a | 1406 | } |
1407 | ||
1408 | //select required DDLs | |
5b4ed716 | 1409 | fRawReader->Reset(); |
019f6101 | 1410 | fRawReader->Select("TOF", nDDLMin, nDDLMax); |
7813bb1a | 1411 | |
1412 | if (verbose) | |
019f6101 | 1413 | AliInfo(Form("Selected TOF DDL range: %d-%d", nDDLMin, nDDLMax)); |
7813bb1a | 1414 | |
2fd622fa | 1415 | return(Decode(verbose)); |
1416 | } | |
1417 | //----------------------------------------------------------------------------- | |
019f6101 | 1418 | Bool_t AliTOFRawStream::Decode(Int_t verbose = 0) { |
1419 | // | |
1420 | // New decoder method | |
1421 | // | |
1422 | ||
2fd622fa | 1423 | Int_t currentEquipment; |
1424 | Int_t currentDDL; | |
dd824655 | 1425 | const AliRawDataHeader *currentCDH; |
2fd622fa | 1426 | |
1427 | //pointers | |
1428 | UChar_t *data = 0x0; | |
1429 | ||
7813bb1a | 1430 | //loop and read DDL headers |
1431 | while(fRawReader->ReadHeader()){ | |
1432 | ||
1433 | //memory leak prevention (actually data should be always 0x0 here) | |
1434 | if (data != 0x0) | |
1435 | delete [] data; | |
1436 | ||
1437 | //get equipment infos | |
1438 | currentEquipment = fRawReader->GetEquipmentId(); | |
1439 | currentDDL = fRawReader->GetDDLID(); | |
dd824655 | 1440 | currentCDH = fRawReader->GetDataHeader(); |
7813bb1a | 1441 | const Int_t kDataSize = fRawReader->GetDataSize(); |
1442 | const Int_t kDataWords = kDataSize / 4; | |
1443 | data = new UChar_t[kDataSize]; | |
1444 | ||
1445 | if (verbose) | |
1446 | AliInfo(Form("Found equipment # %d header (DDL # %d): %d bytes (%d words)", currentEquipment, currentDDL, kDataSize, kDataWords)); | |
1447 | ||
1448 | if (verbose) | |
1449 | AliInfo(Form("Reading equipment #%d (DDL # %d) data...", currentEquipment, currentDDL)); | |
1450 | ||
1451 | //read equipment payload | |
1452 | if (!fRawReader->ReadNext(data, kDataSize)) | |
1453 | { | |
019f6101 | 1454 | fRawReader->AddMajorErrorLog(kDDLdataReading); |
7813bb1a | 1455 | if (verbose) |
019f6101 | 1456 | AliWarning("Error while reading DDL data. Go to next equipment"); |
7813bb1a | 1457 | delete [] data; |
1458 | data = 0x0; | |
1459 | continue; | |
1460 | } | |
1461 | ||
1462 | if (verbose) | |
1463 | AliInfo(Form("Equipment # %d (DDL # %d) data has been readed", currentEquipment, currentDDL)); | |
1464 | ||
1465 | ||
1466 | //set up the decoder | |
1467 | fDecoder->SetVerbose(verbose); | |
d35d0ea0 | 1468 | fDecoder->SetDataBuffer(&fDataBuffer[currentDDL]); |
1469 | fDecoder->SetPackedDataBuffer(&fPackedDataBuffer[currentDDL]); | |
7813bb1a | 1470 | |
1471 | //start decoding | |
dd824655 | 1472 | if (fDecoder->Decode((UInt_t *)data, kDataWords, currentCDH) == kTRUE) { |
019f6101 | 1473 | fRawReader->AddMajorErrorLog(kDDLDecoder,Form("DDL # = %d",currentDDL)); |
1474 | AliWarning(Form("Error while decoding DDL # %d: decoder returned with errors", currentDDL)); | |
f02e90a6 | 1475 | ResetDataBuffer(currentDDL); |
1476 | ResetPackedDataBuffer(currentDDL); | |
019f6101 | 1477 | } |
7813bb1a | 1478 | |
1479 | delete [] data; | |
1480 | data = 0x0; | |
1481 | } | |
1482 | ||
1483 | //reset reader | |
1484 | fRawReader->Reset(); | |
1485 | ||
1486 | if (verbose) | |
1487 | AliInfo("All done"); | |
1488 | ||
1489 | return kFALSE; | |
1490 | ||
5b4ed716 | 1491 | } |
1492 | //----------------------------------------------------------------------------- | |
1493 | Bool_t AliTOFRawStream::DecodeV2(Int_t verbose = 0) { | |
1494 | // | |
1495 | // Enhanced decoder method | |
1496 | // | |
1497 | ||
1498 | Int_t currentEquipment; | |
1499 | Int_t currentDDL; | |
1500 | const AliRawDataHeader *currentCDH; | |
1501 | ||
1502 | //pointers | |
1503 | UChar_t *data = 0x0; | |
1504 | ||
1505 | // read header | |
1506 | if (!fRawReader->ReadHeader()) return kTRUE; | |
1507 | ||
1508 | //get equipment infos | |
1509 | currentEquipment = fRawReader->GetEquipmentId(); | |
1510 | currentDDL = fRawReader->GetDDLID(); | |
1511 | currentCDH = fRawReader->GetDataHeader(); | |
1512 | const Int_t kDataSize = fRawReader->GetDataSize(); | |
1513 | const Int_t kDataWords = kDataSize / 4; | |
1514 | data = new UChar_t[kDataSize]; | |
1515 | ||
1516 | if (verbose) | |
1517 | AliInfo(Form("Found equipment # %d header (DDL # %d): %d bytes (%d words)", currentEquipment, currentDDL, kDataSize, kDataWords)); | |
1518 | ||
1519 | if (verbose) | |
1520 | AliInfo(Form("Reading equipment #%d (DDL # %d) data...", currentEquipment, currentDDL)); | |
1521 | ||
1522 | //read equipment payload | |
1523 | if (!fRawReader->ReadNext(data, kDataSize)) | |
1524 | { | |
1525 | fRawReader->AddMajorErrorLog(kDDLdataReading); | |
1526 | if (verbose) | |
1527 | AliWarning("Error while reading DDL data. Go to next equipment"); | |
1528 | delete [] data; | |
1529 | data = 0x0; | |
1530 | return kTRUE; | |
1531 | } | |
1532 | ||
1533 | if (verbose) | |
1534 | AliInfo(Form("Equipment # %d (DDL # %d) data has been read", currentEquipment, currentDDL)); | |
1535 | ||
1536 | ||
1537 | //set up the decoder | |
1538 | fDecoderV2->SetVerbose(verbose); | |
1539 | ||
1540 | //start decoding | |
1541 | if (fDecoderV2->Decode((UInt_t *)data, kDataWords) == kTRUE) { | |
1542 | fRawReader->AddMajorErrorLog(kDDLDecoder,Form("DDL # = %d",currentDDL)); | |
1543 | AliWarning(Form("Error while decoding DDL # %d: decoder returned with errors", currentDDL)); | |
1544 | } | |
1545 | ||
1546 | delete [] data; | |
1547 | ||
1548 | if (verbose) | |
1549 | AliInfo("All done"); | |
1550 | ||
1551 | return kFALSE; | |
1552 | ||
7813bb1a | 1553 | } |
1554 | //--------------------------------------------------------------------------- | |
1555 | void | |
1556 | AliTOFRawStream::ResetBuffers() | |
1557 | { | |
19eefa2b | 1558 | // |
1559 | // To reset the buffers | |
1560 | // | |
1561 | ||
7813bb1a | 1562 | for (Int_t iDDL = 0; iDDL < AliDAQ::NumberOfDdls("TOF"); iDDL++){ |
1563 | ResetDataBuffer(iDDL); | |
1564 | ResetPackedDataBuffer(iDDL); | |
1565 | } | |
1566 | } | |
1567 | ||
1568 | //--------------------------------------------------------------------------- | |
1569 | Bool_t | |
1570 | AliTOFRawStream::LoadRawDataBuffers(Int_t indexDDL, Int_t verbose) | |
1571 | { | |
19eefa2b | 1572 | // |
1573 | // To load the buffers | |
1574 | // | |
1575 | ||
7813bb1a | 1576 | fTOFrawData->Clear(); |
1577 | fPackedDigits = 0; | |
1578 | ||
1579 | if (verbose > 0) | |
1580 | AliInfo(Form("Decoding raw data for DDL # %d ...", indexDDL)); | |
1581 | ||
1582 | if (DecodeDDL(indexDDL, indexDDL, verbose) != 0){ //decode DDL | |
019f6101 | 1583 | fRawReader->AddMajorErrorLog(kDDLDecoder,Form("DDL # = %d",indexDDL)); |
1584 | AliWarning(Form("Error while decoding DDL # %d", indexDDL)); | |
7813bb1a | 1585 | return kTRUE; |
1586 | } | |
1587 | ||
1588 | if (verbose > 0) | |
d35d0ea0 | 1589 | AliInfo(Form("Done. %d packed %s been found.", fPackedDataBuffer[indexDDL].GetEntries(), fPackedDataBuffer[indexDDL].GetEntries() > 1 ? "hits have" : "hit has")); |
7813bb1a | 1590 | |
1591 | AliTOFHitData *hitData; //hit data pointer | |
1592 | ||
1593 | if (verbose > 0) | |
1594 | AliInfo("Filling TClonesArray ..."); | |
1595 | ||
dd824655 | 1596 | if (verbose > 0) |
1597 | if (fgApplyBCCorrections) { | |
1598 | AliInfo("Apply nominal DDL BC time-shift correction"); | |
1599 | AliInfo("Apply deltaBC time-shift correction"); | |
1600 | } | |
1601 | ||
7813bb1a | 1602 | //loop over DDL packed hits |
d35d0ea0 | 1603 | for (Int_t iHit = 0; iHit < fPackedDataBuffer[indexDDL].GetEntries(); iHit++){ |
1604 | hitData = fPackedDataBuffer[indexDDL].GetHit(iHit); //get hit data | |
7813bb1a | 1605 | Int_t hitACQ = hitData->GetACQ(); |
1606 | Int_t hitPS = hitData->GetPS(); | |
1607 | Int_t hitSlotID = hitData->GetSlotID(); | |
1608 | Int_t hitChain = hitData->GetChain(); | |
1609 | Int_t hitTDC = hitData->GetTDC(); | |
1610 | Int_t hitChan = hitData->GetChan(); | |
7813bb1a | 1611 | Int_t hitTimeBin = hitData->GetTimeBin(); |
7813bb1a | 1612 | Int_t hitTOTBin = hitData->GetTOTBin(); |
2bf4d9d6 | 1613 | Int_t hitDeltaBC = hitData->GetDeltaBunchID(); |
1614 | Int_t hitL0L1Latency = hitData->GetL0L1Latency(); | |
dd824655 | 1615 | |
1616 | Int_t hitLeading = hitData->GetTimeBin(); | |
bf33f8f0 | 1617 | Int_t hitTrailing = -1; |
1618 | Int_t hitError = -1; | |
7813bb1a | 1619 | |
1620 | TClonesArray &arrayTofRawData = *fTOFrawData; | |
2bf4d9d6 | 1621 | new (arrayTofRawData[fPackedDigits++]) AliTOFrawData(hitSlotID, hitChain, hitTDC, hitChan, hitTimeBin, hitTOTBin, hitLeading, hitTrailing, hitPS, hitACQ, hitError, hitDeltaBC, hitL0L1Latency); |
7813bb1a | 1622 | } |
1623 | ||
1624 | if (verbose > 0) | |
1625 | AliInfo("Done."); | |
1626 | ||
1627 | if (verbose > 0) | |
1628 | AliInfo("Resetting buffers ..."); | |
1629 | ||
d35d0ea0 | 1630 | fDataBuffer[indexDDL].Reset(); |
1631 | fPackedDataBuffer[indexDDL].Reset(); | |
7813bb1a | 1632 | |
1633 | if (verbose > 0) | |
1634 | AliInfo("Done."); | |
1635 | ||
1636 | return kFALSE; | |
1637 | } | |
1638 | ||
5f72a2bf | 1639 | //--------------------------------------------------------------------------- |
5b4ed716 | 1640 | Bool_t |
1641 | AliTOFRawStream::LoadRawDataBuffersV2(Int_t indexDDL, Int_t verbose) | |
1642 | { | |
1643 | // | |
1644 | // To load the buffers | |
1645 | // | |
1646 | ||
1647 | /* | |
1648 | * decode raw data and fill output array with TOF hits. | |
1649 | * decode algorithm may return with errors due to inconsistent | |
1650 | * raw data format detected during decoding process. | |
1651 | * decoder algorithm has internal recover procedure to deal with | |
1652 | * errors in a safe condition. | |
1653 | * | |
1654 | * the following conditions will cause total hit rejection from | |
1655 | * specific boards where the condition is detected: | |
1656 | * | |
1657 | * --- within DRM payload (full DRM skipped) --- | |
1658 | * - no header/trailer detected | |
1659 | * | |
1660 | * --- within TRM payload (full TRM skippped) --- | |
1661 | * - no header/trailer detected | |
1662 | * - empty event inserted | |
1663 | * - bad event counter | |
1664 | * - bad CRC | |
1665 | * - ACQ mode off | |
1666 | * | |
1667 | * --- within chain payload (full chain skipped) --- | |
1668 | * - no header/trailer detected | |
1669 | * - bad status | |
1670 | * - bad event counter | |
1671 | * | |
1672 | * --- HPTDC (ful TDC skipped) --- | |
1673 | * - error detected | |
1674 | * | |
1675 | */ | |
1676 | ||
1677 | fTOFrawData->Clear(); | |
1678 | fPackedDigits = 0; | |
1679 | ||
1680 | if (verbose > 0) | |
1681 | AliInfo(Form("Decoding raw data for DDL # %d ...", indexDDL)); | |
1682 | ||
1683 | //check and fix valid DDL range | |
1684 | if (indexDDL < 0){ | |
1685 | indexDDL = 0; | |
1686 | fRawReader->AddMinorErrorLog(kDDLMinError); | |
1687 | AliWarning("Wrong DDL range: setting first DDL ID to 0"); | |
1688 | } | |
1689 | if (indexDDL > 71){ | |
1690 | indexDDL = 71; | |
1691 | fRawReader->AddMinorErrorLog(kDDLMaxError); | |
1692 | AliWarning("Wrong DDL range: setting last DDL ID to 71"); | |
1693 | } | |
1694 | ||
1695 | //select required DDLs | |
1696 | fRawReader->Reset(); | |
1697 | fRawReader->Select("TOF", indexDDL, indexDDL); | |
1698 | ||
1699 | /* decode */ | |
1700 | if (DecodeV2(verbose)) return kTRUE; | |
1701 | ||
1702 | /* read and check CDH info */ | |
1703 | const AliRawDataHeader *currentCDH = fRawReader->GetDataHeader(); | |
1704 | Int_t currentMiniEventID = currentCDH->GetMiniEventID(); | |
1705 | Int_t currentEventID1 = currentCDH->GetEventID1(); | |
1706 | ||
1707 | /* read decoder summary data */ | |
1708 | AliTOFDecoderSummaryData *decodersd; | |
1709 | AliTOFDRMSummaryData *drmsd; | |
1710 | // AliTOFLTMSummaryData *ltmsd; | |
1711 | AliTOFTRMSummaryData *trmsd; | |
1712 | AliTOFChainSummaryData *chainsd; | |
1713 | AliTOFTDCHitBuffer *hitBuffer; | |
1714 | AliTOFTDCHit *hit; | |
1715 | AliTOFTDCErrorBuffer *errorBuffer; | |
1716 | AliTOFTDCError *error; | |
1717 | Bool_t tdcErrorFlag[15]; | |
1718 | decodersd = fDecoderV2->GetDecoderSummaryData(); | |
1719 | ||
1720 | /* check error detected/recovered */ | |
1721 | if (decodersd->GetErrorDetected()) { | |
1722 | AliWarning(Form("Error detected while decoding DDL %d (errorSlotID mask = %04x)", indexDDL, decodersd->GetErrorSlotID())); | |
1723 | if (decodersd->GetRecoveringError()) { | |
1724 | AliWarning("Couldn't recover from error"); | |
1725 | } | |
1726 | else { | |
1727 | AliWarning("Error recovered, anyway something is probably lost"); | |
1728 | } | |
1729 | } | |
1730 | /* check DRM header/trailer */ | |
1731 | drmsd = decodersd->GetDRMSummaryData(); | |
1732 | if (!drmsd->GetHeader() || !drmsd->GetTrailer()) { | |
1733 | AliWarning("DRM header/trailer missing, skip DDL"); | |
1734 | return kTRUE; | |
1735 | } | |
1736 | /* check partecipating mask */ | |
1737 | if (drmsd->GetPartecipatingSlotID() != drmsd->GetDecoderSlotEnableMask()) { | |
1738 | AliWarning(Form("DRM slot enable mask differs from decoder slot enable mask (%08x != %08x) in DDL %d", drmsd->GetSlotEnableMask(), drmsd->GetDecoderSlotEnableMask(), indexDDL)); | |
1739 | for (Int_t ibit = 0; ibit < 11; ibit++) | |
1740 | if ((drmsd->GetPartecipatingSlotID() & (0x1 << ibit)) && !(drmsd->GetDecoderSlotEnableMask() & (0x1 << ibit))) | |
1741 | AliWarning(Form("readout slot %d data is missing in decoder", ibit + 2)); | |
1742 | } | |
1743 | ||
1744 | /* get DRM data */ | |
1745 | Int_t currentL0BCID = drmsd->GetL0BCID(); | |
1746 | ||
1747 | /* loop over TRM to get hits */ | |
1748 | Int_t hitACQ, hitPS, hitSlotID, hitChain, hitTDC, hitChan, hitTimeBin, hitTOTBin, hitDeltaBC, hitL0L1Latency, hitLeading, hitTrailing, hitError; | |
1749 | Int_t currentBunchID; | |
1750 | ||
1751 | /* loop over TRMs */ | |
1752 | for (Int_t itrm = 0; itrm < 10; itrm++) { | |
1753 | trmsd = drmsd->GetTRMSummaryData(itrm); | |
1754 | /* check header/trailer */ | |
1755 | if (!trmsd->GetHeader() || !trmsd->GetTrailer()) continue; | |
1756 | /* skip if TRM empty event detected */ | |
1757 | if (trmsd->GetEBit() != 0) continue; | |
1758 | /* skip if bad TRM event counter detected */ | |
1759 | if (trmsd->GetEventCounter() != drmsd->GetLocalEventCounter()) continue; | |
1760 | /* skip if bad TRM CRC detected */ | |
1761 | if (trmsd->GetEventCRC() != trmsd->GetDecoderCRC()) continue; | |
1762 | ||
1763 | /* loop over chains */ | |
1764 | for (Int_t ichain = 0; ichain < 2; ichain++) { | |
1765 | chainsd = trmsd->GetChainSummaryData(ichain); | |
1766 | /* check header/trailer */ | |
1767 | if (!chainsd->GetHeader() || !chainsd->GetTrailer()) continue; | |
1768 | /* skip if chain bad status detected */ | |
1769 | if (chainsd->GetStatus() != 0) continue; | |
1770 | /* skip if bad chain event counter detected */ | |
1771 | if (chainsd->GetEventCounter() != drmsd->GetLocalEventCounter()) continue; | |
1772 | ||
1773 | currentBunchID = chainsd->GetBunchID(); | |
1774 | hitBuffer = chainsd->GetTDCPackedHitBuffer(); | |
1775 | errorBuffer = chainsd->GetTDCErrorBuffer(); | |
1776 | ||
1777 | /* check TDC errors and set TDC error flag */ | |
1778 | for (Int_t itdc = 0; itdc < 15; itdc++) tdcErrorFlag[itdc] = kFALSE; | |
1779 | for (Int_t ierr = 0; ierr < errorBuffer->GetEntries(); ierr++) { | |
1780 | error = errorBuffer->GetError(ierr); | |
1781 | tdcErrorFlag[error->GetTDCID()] = kTRUE; | |
1782 | } | |
1783 | ||
1784 | /* loop over hits */ | |
1785 | for (Int_t ihit = 0; ihit < hitBuffer->GetEntries(); ihit++) { | |
1786 | ||
1787 | /* get hit */ | |
1788 | hit = hitBuffer->GetHit(ihit); | |
1789 | /* skip hit if coming from a TDC with error detected */ | |
1790 | if (tdcErrorFlag[hit->GetTDCID()]) continue; | |
1791 | ||
1792 | /* set info */ | |
1793 | hitACQ = trmsd->GetACQBits(); | |
1794 | hitPS = hit->GetPSBits(); | |
1795 | hitSlotID = trmsd->GetSlotID(); | |
1796 | hitChain = chainsd->GetChain(); | |
1797 | hitTDC = hit->GetTDCID(); | |
1798 | hitChan = hit->GetChan(); | |
1799 | hitTimeBin = hit->GetHitTime(); | |
1800 | hitTOTBin = hit->GetTOTWidth(); | |
1801 | hitDeltaBC = currentBunchID - currentEventID1; | |
1802 | hitL0L1Latency = currentMiniEventID - currentL0BCID; | |
1803 | ||
1804 | hitLeading = hitTimeBin; | |
1805 | hitTrailing = -1; | |
1806 | hitError = -1; | |
1807 | ||
1808 | /* add hit */ | |
1809 | TClonesArray &arrayTofRawData = *fTOFrawData; | |
1810 | new (arrayTofRawData[fPackedDigits++]) AliTOFrawData(hitSlotID, hitChain, hitTDC, hitChan, hitTimeBin, hitTOTBin, hitLeading, hitTrailing, hitPS, hitACQ, hitError, hitDeltaBC, hitL0L1Latency); | |
1811 | } | |
1812 | } | |
1813 | } | |
1814 | ||
1815 | return kFALSE; | |
1816 | } | |
1817 | ||
1818 | //--------------------------------------------------------------------------- | |
5f72a2bf | 1819 | void AliTOFRawStream::Geant2EquipmentId(Int_t vol[], Int_t eqId[]) |
1820 | { | |
1821 | // | |
1822 | // To convert: | |
1823 | // nSector number -vol[0]- (variable in [0,17]) | |
1824 | // nPlate number -vol[1]- (variable in [0, 5]) | |
1825 | // nStrip number -vol[2]- (variable in [0,14/18]) | |
1826 | // nPadZ number -vol[3]- (variable in [0, 1]) | |
1827 | // nPadX number -vol[4]- (variable in [0,47]) | |
1828 | // in: | |
e1d95075 | 1829 | // nDDL -eqId[0]- (variable in [0;71]) -> number of the DDL |
1830 | // nTRM -eqId[1]- (variable in [3;12]) -> number of the TRM | |
1831 | // nTDC -eqId[2]- (variable in [0;14]) -> number of the TDC | |
1832 | // nChain -eqId[3]- (variable in [0; 1]) -> number of the chain | |
1833 | // nChannel -eqId[4]- (variable in [0; 8]) -> number of the channel | |
5f72a2bf | 1834 | // |
1835 | ||
1836 | eqId[0] = Geant2DDL(vol); | |
1837 | eqId[1] = Geant2TRM(vol); | |
1838 | eqId[2] = Geant2TDC(vol); | |
1839 | eqId[3] = Geant2Chain(vol); | |
1840 | eqId[4] = Geant2Channel(vol); | |
1841 | ||
1842 | } | |
1843 | ||
1844 | //--------------------------------------------------------------------------- | |
1845 | Int_t AliTOFRawStream::Geant2DDL(Int_t vol[]) | |
1846 | { | |
1847 | // | |
1848 | // To convert: | |
1849 | // nSector number -vol[0]- (variable in [0,17]) | |
1850 | // nPlate number -vol[1]- (variable in [0, 5]) | |
1851 | // nStrip number -vol[2]- (variable in [0,14/18]) | |
1852 | // nPadZ number -vol[3]- (variable in [0, 1]) | |
1853 | // nPadX number -vol[4]- (variable in [0,47]) | |
1854 | // in: | |
e1d95075 | 1855 | // nDDL (variable in [0;71]) -> number of the DDL |
5f72a2bf | 1856 | // |
1857 | ||
1858 | ||
1859 | Int_t iDDL = -1; | |
1860 | ||
1861 | if (vol[0]<0 || vol[0]>=AliTOFGeometry::NSectors()) { | |
1862 | printf(" AliTOFRawStream - Error: the sector number (%i) is out of the range: [0,17]\n", vol[0]); | |
1863 | return iDDL; | |
1864 | } | |
1865 | if (vol[1]<0 || vol[1]>=AliTOFGeometry::NPlates()) { | |
1866 | printf(" AliTOFRawStream - Error: the module number (%i) is out of the range: [0,4]\n", vol[1]); | |
1867 | return iDDL; | |
1868 | } | |
1869 | if (vol[2]<0 || vol[2]>=AliTOFGeometry::NStrip(vol[1])) { | |
1870 | printf(" AliTOFRawStream - Error: the strip number (%i) is out of the range: [0,%i]\n", vol[2], AliTOFGeometry::NStrip(vol[1])); | |
1871 | return iDDL; | |
1872 | } | |
1873 | if (vol[3]<0 || vol[3]>=AliTOFGeometry::NpadZ()) | |
1874 | printf(" AliTOFRawStream - Error: the padz number (%i) is out of the range: [0,1]\n", vol[3]); | |
1875 | if (vol[4]<0 || vol[4]>=AliTOFGeometry::NpadX()) | |
1876 | printf(" AliTOFRawStream - Error: the padx number (%i) is out of the range: [0,47]\n", vol[4]); | |
1877 | if ( vol[3]>=AliTOFGeometry::NpadZ() ) { | |
1878 | printf("Maybe you have to invert the order between vol[3](=%i) and vol[4](=%i)\n", vol[3], vol[4]); | |
1879 | return iDDL; | |
1880 | } | |
1881 | ||
1882 | Int_t nSector = vol[0]; | |
1883 | Int_t nPlate = vol[1]; | |
1884 | Int_t nStrip = vol[2]; | |
1885 | Int_t nPadX = vol[4]; | |
1886 | ||
1887 | if ( nPadX<24 && ( nPlate==0 || nPlate==1 || (nPlate==2 && nStrip<7) ) ) | |
1888 | iDDL = 0; | |
1889 | else if ( nPadX>=24 && ( nPlate==0 || nPlate==1 || (nPlate==2 && nStrip<8) ) ) | |
1890 | iDDL = 1; | |
1891 | else if ( nPadX>=24 && ( nPlate==3 || nPlate==4 || (nPlate==2 && nStrip>7) ) ) | |
1892 | iDDL = 2; | |
1893 | else if ( nPadX<24 && ( nPlate==3 || nPlate==4 || (nPlate==2 && nStrip>6) ) ) | |
1894 | iDDL = 3; | |
1895 | ||
1896 | return 4*nSector+iDDL; | |
1897 | ||
1898 | } | |
1899 | ||
1900 | //--------------------------------------------------------------------------- | |
1901 | Int_t AliTOFRawStream::Geant2TRM(Int_t vol[]) | |
1902 | { | |
1903 | // | |
1904 | // To convert: | |
1905 | // nSector number -vol[0]- (variable in [0,17]) | |
1906 | // nPlate number -vol[1]- (variable in [0, 5]) | |
1907 | // nStrip number -vol[2]- (variable in [0,14/18]) | |
1908 | // nPadZ number -vol[3]- (variable in [0, 1]) | |
1909 | // nPadX number -vol[4]- (variable in [0,47]) | |
1910 | // in: | |
1911 | // nTRM (variable in [3;12]) -> number of the TRM slot | |
1912 | // | |
1913 | ||
1914 | Int_t nTRM = -1; | |
1915 | ||
1916 | if (vol[0]<0 || vol[0]>=AliTOFGeometry::NSectors()) { | |
1917 | printf(" AliTOFRawStream - Error: the sector number (%i) is out of the range: [0,17]\n", vol[0]); | |
1918 | return nTRM; | |
1919 | } | |
1920 | if (vol[1]<0 || vol[1]>=AliTOFGeometry::NPlates()) { | |
1921 | printf(" AliTOFRawStream - Error: the module number (%i) is out of the range: [0,4]\n", vol[1]); | |
1922 | return nTRM; | |
1923 | } | |
1924 | if (vol[2]<0 || vol[2]>=AliTOFGeometry::NStrip(vol[1])) { | |
1925 | printf(" AliTOFRawStream - Error: the strip number (%i) is out of the range: [0,%i]\n", vol[2], AliTOFGeometry::NStrip(vol[1])); | |
1926 | return nTRM; | |
1927 | } | |
1928 | if (vol[3]<0 || vol[3]>=AliTOFGeometry::NpadZ()) { | |
1929 | printf(" AliTOFRawStream - Error: the padz number (%i) is out of the range: [0,1]\n", vol[3]); | |
1930 | return nTRM; | |
1931 | } | |
1932 | if (vol[4]<0 || vol[4]>=AliTOFGeometry::NpadX()) { | |
1933 | printf(" AliTOFRawStream - Error: the padx number (%i) is out of the range: [0,47]\n", vol[4]); | |
1934 | return nTRM; | |
1935 | } | |
1936 | ||
1937 | if ( vol[3]>=AliTOFGeometry::NpadZ() ) | |
1938 | { | |
1939 | printf("Maybe you have to invert the order between vol[3](=%i) and vol[4](=%i)\n", vol[3], vol[4]); | |
1940 | return nTRM; | |
1941 | } | |
1942 | ||
1943 | Int_t nPlate = vol[1]; | |
1944 | Int_t nStrip = vol[2]; | |
1945 | ||
1946 | Int_t iDDL = Geant2DDL(vol)%4; | |
1947 | ||
1948 | switch (iDDL) { | |
1949 | ||
1950 | case 0: | |
1951 | ||
1952 | if (nPlate==0) { | |
1953 | if (nStrip<= 4) nTRM = 4; | |
1954 | else if (nStrip> 4 && nStrip<= 9) nTRM = 5; | |
1955 | else if (nStrip> 9 && nStrip<=14) nTRM = 6; | |
1956 | else if (nStrip>14) nTRM = 7; | |
1957 | } | |
1958 | else if (nPlate==1) { | |
1959 | if (nStrip== 0) nTRM = 7; | |
1960 | else if (nStrip> 0 && nStrip<= 5) nTRM = 8; | |
1961 | else if (nStrip> 5 && nStrip<=10) nTRM = 9; | |
1962 | else if (nStrip>10 && nStrip<=15) nTRM = 10; | |
1963 | else if (nStrip>15) nTRM = 11; | |
1964 | } | |
1965 | else if (nPlate==2) { | |
1966 | if (nStrip<= 1) nTRM = 11; | |
1967 | else if (nStrip> 1 && nStrip< 7) nTRM = 12; | |
1968 | } | |
1969 | ||
1970 | break; | |
1971 | case 1: | |
1972 | ||
1973 | if (nPlate==0) { | |
1974 | if (nStrip== 0) nTRM = 3; | |
1975 | else if (nStrip> 0 && nStrip<= 5) nTRM = 4; | |
1976 | else if (nStrip> 5 && nStrip<=10) nTRM = 5; | |
1977 | else if (nStrip>10 && nStrip<=15) nTRM = 6; | |
1978 | else if (nStrip>15) nTRM = 7; | |
1979 | } | |
1980 | else if (nPlate==1) { | |
1981 | if (nStrip<=1) nTRM = 7; | |
1982 | else if (nStrip> 1 && nStrip<= 6) nTRM = 8; | |
1983 | else if (nStrip> 6 && nStrip<=11) nTRM = 9; | |
1984 | else if (nStrip>11 && nStrip<=16) nTRM = 10; | |
1985 | else if (nStrip>16) nTRM = 11; | |
1986 | } | |
1987 | else if (nPlate==2) { | |
1988 | if (nStrip<= 2) nTRM = 11; | |
1989 | else if (nStrip> 2 && nStrip<= 7) nTRM = 12; | |
1990 | } | |
1991 | ||
1992 | break; | |
1993 | case 2: | |
1994 | ||
1995 | if (nPlate==4) { | |
1996 | if (nStrip>=14) nTRM = 4; | |
1997 | else if (nStrip<14 && nStrip>= 9) nTRM = 5; | |
1998 | else if (nStrip< 9 && nStrip>= 4) nTRM = 6; | |
1999 | else if (nStrip< 4) nTRM = 7; | |
2000 | } | |
2001 | else if (nPlate==3) { | |
2002 | if (nStrip==18) nTRM = 7; | |
2003 | else if (nStrip<18 && nStrip>=13) nTRM = 8; | |
2004 | else if (nStrip<13 && nStrip>= 8) nTRM = 9; | |
2005 | else if (nStrip< 8 && nStrip>= 3) nTRM = 10; | |
2006 | else if (nStrip< 3) nTRM = 11; | |
2007 | } | |
2008 | else if (nPlate==2) { | |
2009 | if (nStrip>=13) nTRM = 11; | |
2010 | else if (nStrip<13 && nStrip>= 8) nTRM = 12; | |
2011 | } | |
2012 | ||
2013 | break; | |
2014 | case 3: | |
2015 | ||
2016 | if (nPlate==4) { | |
2017 | if (nStrip==18) nTRM = 3; | |
2018 | else if (nStrip<18 && nStrip>=13) nTRM = 4; | |
2019 | else if (nStrip<13 && nStrip>= 8) nTRM = 5; | |
2020 | else if (nStrip< 8 && nStrip>= 3) nTRM = 6; | |
2021 | else if (nStrip< 3) nTRM = 7; | |
2022 | } | |
2023 | else if (nPlate==3) { | |
2024 | if (nStrip>=17) nTRM = 7; | |
2025 | else if (nStrip<17 && nStrip>=12) nTRM = 8; | |
2026 | else if (nStrip<12 && nStrip>= 7) nTRM = 9; | |
2027 | else if (nStrip< 7 && nStrip>= 2) nTRM = 10; | |
2028 | else if (nStrip< 2) nTRM = 11; | |
2029 | } | |
2030 | else if (nPlate==2) { | |
2031 | if (nStrip>=12) nTRM = 11; | |
2032 | else if (nStrip <12 && nStrip>= 7) nTRM = 12; | |
2033 | } | |
2034 | ||
2035 | break; | |
2036 | ||
2037 | } | |
2038 | ||
2039 | return nTRM; | |
2040 | ||
2041 | } | |
2042 | ||
2043 | //--------------------------------------------------------------------------- | |
2044 | Int_t AliTOFRawStream::Geant2TDC(Int_t vol[]) | |
2045 | { | |
2046 | // | |
2047 | // To convert: | |
2048 | // nSector number -vol[0]- (variable in [0,17]) | |
2049 | // nPlate number -vol[1]- (variable in [0, 5]) | |
2050 | // nStrip number -vol[2]- (variable in [0,14/18]) | |
2051 | // nPadZ number -vol[3]- (variable in [0, 1]) | |
2052 | // nPadX number -vol[4]- (variable in [0,47]) | |
2053 | // in: | |
2054 | // nTDC (variable in [0;14]) -> number of the TDC | |
2055 | // | |
2056 | ||
2057 | Int_t nTDC = -1; | |
2058 | ||
2059 | if (vol[0]<0 || vol[0]>=AliTOFGeometry::NSectors()) { | |
2060 | printf(" AliTOFRawStream - Error: the sector number (%i) is out of the range: [0,17]\n", vol[0]); | |
2061 | return nTDC; | |
2062 | } | |
2063 | if (vol[1]<0 || vol[1]>=AliTOFGeometry::NPlates()) { | |
2064 | printf(" AliTOFRawStream - Error: the module number (%i) is out of the range: [0,4]\n", vol[1]); | |
2065 | return nTDC; | |
2066 | } | |
2067 | if (vol[2]<0 || vol[2]>=AliTOFGeometry::NStrip(vol[1])) { | |
2068 | printf(" AliTOFRawStream - Error: the strip number (%i) is out of the range: [0,%i]\n", vol[2], AliTOFGeometry::NStrip(vol[1])); | |
2069 | return nTDC; | |
2070 | } | |
2071 | if (vol[3]<0 || vol[3]>=AliTOFGeometry::NpadZ()) | |
2072 | printf(" AliTOFRawStream - Error: the padz number (%i) is out of the range: [0,1]\n", vol[3]); | |
2073 | if (vol[4]<0 || vol[4]>=AliTOFGeometry::NpadX()) | |
2074 | printf(" AliTOFRawStream - Error: the padx number (%i) is out of the range: [0,47]\n", vol[4]); | |
2075 | if ( vol[3]>=AliTOFGeometry::NpadZ() ) { | |
2076 | printf("Maybe you have to invert the order between vol[3](=%i) and vol[4](=%i)\n", vol[3], vol[4]); | |
2077 | return nTDC; | |
2078 | } | |
2079 | ||
2080 | Int_t nPlate = vol[1]; | |
2081 | Int_t nStrip = vol[2]; | |
2082 | Int_t iPadX = vol[4]; | |
2083 | ||
2084 | Int_t iDDL = Geant2DDL(vol)%4; | |
2085 | ||
2086 | switch (iDDL) { | |
2087 | ||
2088 | case 0: | |
2089 | ||
2090 | if (nPlate==0) { | |
2091 | if (nStrip<= 4) nTDC = (3*(nStrip)+2-(iPadX/4)%3); | |
2092 | else if (nStrip> 4 && nStrip<= 9) nTDC = (3*(nStrip- 5)+2-(iPadX/4)%3); | |
2093 | else if (nStrip> 9 && nStrip<=14) nTDC = (3*(nStrip-10)+2-(iPadX/4)%3); | |
2094 | else if (nStrip>14) nTDC = (3*(nStrip-15)+2-(iPadX/4)%3); | |
2095 | } | |
2096 | else if (nPlate==1) { | |
2097 | if (nStrip== 0) nTDC = (3*(nStrip+ 4)+2-(iPadX/4)%3); | |
2098 | else if (nStrip> 0 && nStrip<= 5) nTDC = (3*(nStrip- 1)+2-(iPadX/4)%3); | |
2099 | else if (nStrip> 5 && nStrip<=10) nTDC = (3*(nStrip- 6)+2-(iPadX/4)%3); | |
2100 | else if (nStrip>10 && nStrip<=15) nTDC = (3*(nStrip-11)+2-(iPadX/4)%3); | |
2101 | else if (nStrip>15) nTDC = (3*(nStrip-16)+2-(iPadX/4)%3); | |
2102 | } | |
2103 | else if (nPlate==2) { | |
2104 | if (nStrip<= 1) nTDC = (3*(nStrip+ 3)+2-(iPadX/4)%3); | |
2105 | else if (nStrip> 1 && nStrip< 7) nTDC = (3*(nStrip- 2)+2-(iPadX/4)%3); | |
2106 | } | |
2107 | ||
2108 | break; | |
2109 | case 1: | |
2110 | ||
2111 | if (nPlate==0) { | |
2112 | if (nStrip== 0) nTDC = (3*(nStrip)+(iPadX/4)%3); | |
2113 | else if (nStrip> 0 && nStrip<= 5) nTDC = (3*( 5-nStrip)+(iPadX/4)%3); | |
2114 | else if (nStrip> 5 && nStrip<=10) nTDC = (3*(10-nStrip)+(iPadX/4)%3); | |
2115 | else if (nStrip>10 && nStrip<=15) nTDC = (3*(15-nStrip)+(iPadX/4)%3); | |
2116 | else if (nStrip>15) nTDC = (3*(20-nStrip)+(iPadX/4)%3); | |
2117 | } | |
2118 | else if (nPlate==1) { | |
2119 | if (nStrip<= 1) nTDC = (3*( 1-nStrip)+(iPadX/4)%3); | |
2120 | else if (nStrip> 1 && nStrip<= 6) nTDC = (3*( 6-nStrip)+(iPadX/4)%3); | |
2121 | else if (nStrip> 6 && nStrip<=11) nTDC = (3*(11-nStrip)+(iPadX/4)%3); | |
2122 | else if (nStrip>11 && nStrip<=16) nTDC = (3*(16-nStrip)+(iPadX/4)%3); | |
2123 | else if (nStrip>16) nTDC = (3*(21-nStrip)+(iPadX/4)%3); | |
2124 | } | |
2125 | else if (nPlate==2) { | |
2126 | if (nStrip<= 2) nTDC = (3*( 2-nStrip)+(iPadX/4)%3); | |
2127 | else if (nStrip> 2 && nStrip<= 7) nTDC = (3*( 7-nStrip)+(iPadX/4)%3); | |
2128 | } | |
2129 | ||
2130 | break; | |
2131 | case 2: | |
2132 | ||
2133 | if (nPlate==4) { | |
2134 | if (nStrip>=14) nTDC = (3*(18-nStrip)+((iPadX/4)%3)); | |
2135 | else if (nStrip<14 && nStrip>= 9) nTDC = (3*(13-nStrip)+((iPadX/4)%3)); | |
2136 | else if (nStrip< 9 && nStrip>= 4) nTDC = (3*( 8-nStrip)+((iPadX/4)%3)); | |
2137 | else if (nStrip< 4) nTDC = (3*( 3-nStrip)+((iPadX/4)%3)); | |
2138 | } | |
2139 | else if (nPlate==3) { | |
2140 | if (nStrip==18) nTDC = (3*(22-nStrip)+((iPadX/4)%3)); | |
2141 | else if (nStrip<18 && nStrip>=13) nTDC = (3*(17-nStrip)+((iPadX/4)%3)); | |
2142 | else if (nStrip<13 && nStrip>= 8) nTDC = (3*(12-nStrip)+((iPadX/4)%3)); | |
2143 | else if (nStrip< 8 && nStrip>= 3) nTDC = (3*( 7-nStrip)+((iPadX/4)%3)); | |
2144 | else if (nStrip< 3) nTDC = (3*( 2-nStrip)+((iPadX/4)%3)); | |
2145 | } | |
2146 | else if (nPlate==2) { | |
2147 | if (nStrip>=13) nTDC = (3*(17-nStrip)+((iPadX/4)%3)); | |
2148 | else if (nStrip<13 && nStrip>= 8) nTDC = (3*(12-nStrip)+((iPadX/4)%3)); | |
2149 | } | |
2150 | ||
2151 | break; | |
2152 | case 3: | |
2153 | ||
2154 | if (nPlate==4) { | |
2155 | if (nStrip==18) nTDC = (3*(nStrip-18)+2-(iPadX/4)%3); | |
2156 | else if (nStrip<18 && nStrip>=13) nTDC = (3*(nStrip-13)+2-(iPadX/4)%3); | |
2157 | else if (nStrip<13 && nStrip>= 8) nTDC = (3*(nStrip- 8)+2-(iPadX/4)%3); | |
2158 | else if (nStrip< 8 && nStrip>= 3) nTDC = (3*(nStrip- 3)+2-(iPadX/4)%3); | |
2159 | else if (nStrip< 3) nTDC = (3*(nStrip+ 2)+2-(iPadX/4)%3); | |
2160 | } | |
2161 | else if (nPlate==3) { | |
2162 | if (nStrip>=17) nTDC = (3*(nStrip-17)+2-(iPadX/4)%3); | |
2163 | else if (nStrip<17 && nStrip>=12) nTDC = (3*(nStrip-12)+2-(iPadX/4)%3); | |
2164 | else if (nStrip<12 && nStrip>= 7) nTDC = (3*(nStrip- 7)+2-(iPadX/4)%3); | |
2165 | else if (nStrip< 7 && nStrip>= 2) nTDC = (3*(nStrip- 2)+2-(iPadX/4)%3); | |
2166 | else if (nStrip< 2) nTDC = (3*(nStrip+ 3)+2-(iPadX/4)%3); | |
2167 | } | |
2168 | else if (nPlate==2) { | |
2169 | if (nStrip>=12) nTDC = (3*(nStrip-12)+2-(iPadX/4)%3); | |
2170 | else if (nStrip <12 && nStrip>= 7) nTDC = (3*(nStrip- 7)+2-(iPadX/4)%3); | |
2171 | } | |
2172 | ||
2173 | break; | |
2174 | ||
2175 | } | |
2176 | ||
2177 | return nTDC; | |
2178 | ||
2179 | } | |
2180 | ||
2181 | //--------------------------------------------------------------------------- | |
2182 | Int_t AliTOFRawStream::Geant2Chain(Int_t vol[]) | |
2183 | { | |
2184 | // | |
2185 | // To convert: | |
2186 | // nSector number -vol[0]- (variable in [0,17]) | |
2187 | // nPlate number -vol[1]- (variable in [0, 5]) | |
2188 | // nStrip number -vol[2]- (variable in [0,14/18]) | |
2189 | // nPadZ number -vol[3]- (variable in [0, 1]) | |
2190 | // nPadX number -vol[4]- variable in [0,47]) | |
2191 | // in: | |
2192 | // nChain (variable in [0; 1]) -> number of the TRM chain | |
2193 | // | |
2194 | ||
2195 | Int_t nChain = -1; | |
2196 | ||
2197 | if (vol[0]<0 || vol[0]>=AliTOFGeometry::NSectors()) { | |
2198 | printf(" AliTOFRawStream - Error: the sector number (%i) is out of the range: [0,17]\n", vol[0]); | |
2199 | return nChain; | |
2200 | } | |
2201 | if (vol[1]<0 || vol[1]>=AliTOFGeometry::NPlates()) { | |
2202 | printf(" AliTOFRawStream - Error: the module number (%i) is out of the range: [0,4]\n", vol[1]); | |
2203 | return nChain; | |
2204 | } | |
2205 | if (vol[2]<0 || vol[2]>=AliTOFGeometry::NStrip(vol[1])) { | |
2206 | printf(" AliTOFRawStream - Error: the strip number (%i) is out of the range: [0,%i]\n", vol[2], AliTOFGeometry::NStrip(vol[1])); | |
2207 | return nChain; | |
2208 | } | |
2209 | if (vol[3]<0 || vol[3]>=AliTOFGeometry::NpadZ()) | |
2210 | printf(" AliTOFRawStream - Error: the padz number (%i) is out of the range: [0,1]\n", vol[3]); | |
2211 | if (vol[4]<0 || vol[4]>=AliTOFGeometry::NpadX()) | |
2212 | printf(" AliTOFRawStream - Error: the padx number (%i) is out of the range: [0,47]\n", vol[4]); | |
2213 | if ( vol[3]>=AliTOFGeometry::NpadZ() ) { | |
2214 | printf("Maybe you have to invert the order between vol[3](=%i) and vol[4](=%i)\n", vol[3], vol[4]); | |
2215 | return nChain; | |
2216 | } | |
2217 | ||
2218 | Int_t iPadX = vol[4]; | |
2219 | ||
2220 | if (iPadX<12 || iPadX>=36) nChain = 0; | |
2221 | else nChain = 1; | |
2222 | ||
2223 | return nChain; | |
2224 | ||
2225 | } | |
2226 | ||
2227 | //--------------------------------------------------------------------------- | |
2228 | Int_t AliTOFRawStream::Geant2Channel(Int_t vol[]) | |
2229 | { | |
2230 | // | |
2231 | // To convert: | |
2232 | // nSector number -vol[0]- (variable in [0,17]) | |
2233 | // nPlate number -vol[1]- (variable in [0, 5]) | |
2234 | // nStrip number -vol[2]- (variable in [0,14/18]) | |
2235 | // nPadZ number -vol[3]- (variable in [0, 1]) | |
2236 | // nPadX number -vol[4]- (variable in [0,47]) | |
2237 | // in: | |
2238 | // nChannel (variable in [0; 7]) -> number of the TDC channel | |
2239 | // | |
2240 | ||
2241 | Int_t nChannel = -1; | |
2242 | ||
2243 | if (vol[0]<0 || vol[0]>=AliTOFGeometry::NSectors()) { | |
2244 | printf(" AliTOFRawStream - Error: the sector number (%i) is out of the range: [0,17]\n", vol[0]); | |
2245 | return nChannel; | |
2246 | } | |
2247 | if (vol[1]<0 || vol[1]>=AliTOFGeometry::NPlates()) { | |
2248 | printf(" AliTOFRawStream - Error: the module number (%i) is out of the range: [0,4]\n", vol[1]); | |
2249 | return nChannel; | |
2250 | } | |
2251 | if (vol[2]<0 || vol[2]>=AliTOFGeometry::NStrip(vol[1])) { | |
2252 | printf(" AliTOFRawStream - Error: the strip number (%i) is out of the range: [0,%i]\n", vol[2], AliTOFGeometry::NStrip(vol[1])); | |
2253 | return nChannel; | |
2254 | } | |
2255 | if (vol[3]<0 || vol[3]>=AliTOFGeometry::NpadZ()) | |
2256 | printf(" AliTOFRawStream - Error: the padz number (%i) is out of the range: [0,1]\n", vol[3]); | |
2257 | if (vol[4]<0 || vol[4]>=AliTOFGeometry::NpadX()) | |
2258 | printf(" AliTOFRawStream - Error: the padx number (%i) is out of the range: [0,47]\n", vol[4]); | |
2259 | if ( vol[3]>=AliTOFGeometry::NpadZ() ) { | |
2260 | printf("Maybe you have to invert the order between vol[3](=%i) and vol[4](=%i)\n", vol[3], vol[4]); | |
2261 | return nChannel; | |
2262 | } | |
2263 | ||
2264 | Int_t iPadZ = vol[3]; | |
2265 | Int_t iPadX = vol[4]; | |
2266 | ||
2267 | Int_t iDDL = Geant2DDL(vol)%4; | |
2268 | ||
2269 | switch (iDDL) { | |
2270 | ||
2271 | case 0: | |
2272 | nChannel = ((2*(23-iPadX) + (1-iPadZ)))%8; | |
2273 | break; | |
2274 | case 1: | |
2275 | nChannel = ((2*(iPadX-24) + (iPadZ)))%8; | |
2276 | break; | |
2277 | case 2: | |
2278 | nChannel = ((2*(iPadX-24) + (iPadZ)))%8; | |
2279 | break; | |
2280 | case 3: | |
2281 | nChannel = ((2*(23-iPadX) + (1-iPadZ)))%8; | |
2282 | break; | |
2283 | } | |
2284 | ||
2285 | return nChannel; | |
2286 | ||
2287 | } | |
f472295e | 2288 | |
2289 | //____________________________________________________________________________ | |
a3ed3947 | 2290 | void AliTOFRawStream::Raw2Digits(AliRawReader* rawReader, TClonesArray * const digitsArray) |
f472295e | 2291 | { |
2292 | // | |
2293 | // Converts raw data to digits for TOF | |
2294 | // | |
2295 | ||
2296 | TStopwatch stopwatch; | |
2297 | stopwatch.Start(); | |
2298 | ||
2299 | //TClonesArray *fDigits = new TClonesArray("AliTOFdigit", 4000); | |
2300 | //digitsTree->Branch("TOF", &fDigits); | |
2301 | TClonesArray &aDigits = *digitsArray; | |
2302 | ||
2303 | Int_t inholes = 0; | |
2304 | ||
2305 | Clear(); | |
2306 | SetRawReader(rawReader); | |
2307 | ||
2308 | //ofstream ftxt; | |
2309 | //if (fVerbose==2) ftxt.open("TOFdigitsRead.txt",ios::app); | |
2310 | ||
2311 | TClonesArray staticRawData("AliTOFrawData",10000); | |
2312 | staticRawData.Clear(); | |
2313 | TClonesArray * clonesRawData = &staticRawData; | |
2314 | ||
2315 | Int_t dummy = -1; | |
2316 | Int_t detectorIndex[5] = {-1, -1, -1, -1, -1}; | |
2317 | Int_t digit[4]; | |
2318 | ||
2319 | const Int_t kMaxNumberOfTracksPerDigit = 3; | |
2320 | Int_t tracks[kMaxNumberOfTracksPerDigit]; | |
2321 | for (Int_t ii=0; ii<kMaxNumberOfTracksPerDigit; ii++) | |
2322 | tracks[ii] = -1; | |
2323 | Int_t last = -1; | |
2324 | ||
2325 | Int_t indexDDL = 0; | |
2326 | Int_t iRawData = 0; | |
2327 | AliTOFrawData *tofRawDatum = 0; | |
2328 | for (indexDDL=0; indexDDL<AliDAQ::NumberOfDdls("TOF"); indexDDL++) { | |
2329 | ||
2330 | rawReader->Reset(); | |
2331 | if (fNewDecoderVersion) { | |
2332 | AliInfo("Using New Decoder \n"); | |
2333 | LoadRawDataBuffers(indexDDL, 0); | |
2334 | } | |
2335 | else | |
2336 | LoadRawData(indexDDL); | |
2337 | ||
2338 | clonesRawData = GetRawData(); | |
2339 | if (clonesRawData->GetEntriesFast()!=0) AliInfo(Form(" TOF raw data number = %3d", clonesRawData->GetEntriesFast())); | |
2340 | for (iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) { | |
2341 | ||
2342 | tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData); | |
2343 | ||
2344 | //if (tofRawDatum->GetTOT()==-1 || tofRawDatum->GetTOF()==-1) continue; | |
2345 | if (tofRawDatum->GetTOF()==-1) continue; | |
2346 | ||
2347 | EquipmentId2VolumeId(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(), | |
2348 | tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel(), detectorIndex); | |
2349 | ||
2350 | dummy = detectorIndex[3]; | |
2351 | detectorIndex[3] = detectorIndex[4];//padz | |
2352 | detectorIndex[4] = dummy;//padx | |
2353 | ||
2354 | digit[0] = tofRawDatum->GetTOF(); | |
2355 | digit[1] = tofRawDatum->GetTOT(); | |
2356 | digit[2] = tofRawDatum->GetTOT(); | |
2357 | digit[3] = -1;//tofRawDatum->GetTOF(); //tofND | |
2358 | ||
2359 | dummy = detectorIndex[3]; | |
2360 | detectorIndex[3] = detectorIndex[4];//padx | |
2361 | detectorIndex[4] = dummy;//padz | |
2362 | ||
2363 | // Do not reconstruct anything in the holes | |
2364 | if (detectorIndex[0]==13 || detectorIndex[0]==14 || detectorIndex[0]==15 ) { // sectors with holes | |
2365 | if (detectorIndex[1]==2) { // plate with holes | |
2366 | inholes++; | |
2367 | continue; | |
2368 | } | |
2369 | } | |
2370 | ||
2371 | last = digitsArray->GetEntriesFast(); | |
2372 | new (aDigits[last]) AliTOFdigit(tracks, detectorIndex, digit); | |
2373 | /* | |
2374 | if (fVerbose==2) { | |
2375 | if (indexDDL<10) ftxt << " " << indexDDL; | |
2376 | else ftxt << " " << indexDDL; | |
2377 | if (tofRawDatum->GetTRM()<10) ftxt << " " << tofRawDatum->GetTRM(); | |
2378 | else ftxt << " " << tofRawDatum->GetTRM(); | |
2379 | ftxt << " " << tofRawDatum->GetTRMchain(); | |
2380 | if (tofRawDatum->GetTDC()<10) ftxt << " " << tofRawDatum->GetTDC(); | |
2381 | else ftxt << " " << tofRawDatum->GetTDC(); | |
2382 | ftxt << " " << tofRawDatum->GetTDCchannel(); | |
2383 | ||
2384 | if (detectorIndex[0]<10) ftxt << " -> " << detectorIndex[0]; | |
2385 | else ftxt << " -> " << detectorIndex[0]; | |
2386 | ftxt << " " << detectorIndex[1]; | |
2387 | if (detectorIndex[2]<10) ftxt << " " << detectorIndex[2]; | |
2388 | else ftxt << " " << detectorIndex[2]; | |
2389 | ftxt << " " << detectorIndex[4]; | |
2390 | if (detectorIndex[4]<10) ftxt << " " << detectorIndex[3]; | |
2391 | else ftxt << " " << detectorIndex[3]; | |
2392 | ||
2393 | if (digit[1]<10)ftxt << " " << digit[1]; | |
2394 | else if (digit[1]>=10 && digit[1]<100) ftxt << " " << digit[1]; | |
2395 | else ftxt << " " << digit[1]; | |
2396 | if (digit[0]<10) ftxt << " " << digit[0] << endl; | |
2397 | else if (digit[0]>=10 && digit[0]<100) ftxt << " " << digit[0] << endl; | |
2398 | else if (digit[0]>=100 && digit[0]<1000) ftxt << " " << digit[0] << endl; | |
2399 | else ftxt << " " << digit[3] << endl; | |
2400 | } | |
2401 | */ | |
2402 | AliDebug(2, Form(" Raw data reading %2d -> %2d %1d %2d %1d %2d (%d, %d, %d)", | |
2403 | last, | |
2404 | detectorIndex[0], detectorIndex[1], detectorIndex[2], detectorIndex[4], detectorIndex[3], | |
2405 | digit[0], digit[1], digit[3])); | |
2406 | ||
2407 | tofRawDatum = 0; | |
2408 | } // loop on tofRawData array | |
2409 | ||
2410 | clonesRawData->Clear(); | |
2411 | ||
2412 | } // DDL Loop | |
2413 | ||
2414 | //if (fVerbose==2) ftxt.close(); | |
2415 | ||
2416 | ||
2417 | if (inholes) AliWarning(Form("Raw data in the TOF holes: %d",inholes)); | |
2418 | ||
2419 | Int_t nDigits = digitsArray->GetEntries(); | |
2420 | AliDebug(1, Form("Got %d TOF digits", nDigits)); | |
2421 | AliDebug(1, Form("Execution time to read TOF raw data and fill TOF digit tree : R:%.2fs C:%.2fs", | |
2422 | stopwatch.RealTime(),stopwatch.CpuTime())); | |
2423 | ||
2424 | } | |
2425 | ||
2426 | //____________________________________________________________________________ | |
a3ed3947 | 2427 | void AliTOFRawStream::Raw2SDigits(AliRawReader* rawReader, TClonesArray * const sdigitsArray) |
f472295e | 2428 | { |
2429 | // | |
2430 | // Converts raw data to sdigits for TOF | |
2431 | // | |
2432 | ||
2433 | TStopwatch stopwatch; | |
2434 | stopwatch.Start(); | |
2435 | ||
2436 | Int_t inholes = 0; | |
2437 | ||
2438 | //if(!GetLoader()->TreeS()) {MakeTree("S"); MakeBranch("S");} | |
2439 | TClonesArray &aSDigits = *sdigitsArray; | |
2440 | ||
2441 | Clear(); | |
2442 | SetRawReader(rawReader); | |
2443 | ||
2444 | //ofstream ftxt; | |
2445 | //if (fVerbose==2) ftxt.open("TOFsdigitsRead.txt",ios::app); | |
2446 | ||
2447 | TClonesArray staticRawData("AliTOFrawData",10000); | |
2448 | staticRawData.Clear(); | |
2449 | TClonesArray * clonesRawData = &staticRawData; | |
2450 | ||
2451 | Int_t dummy = -1; | |
2452 | Int_t detectorIndex[5] = {-1, -1, -1, -1, -1}; | |
2453 | Int_t digit[2]; | |
2454 | Int_t track = -1; | |
2455 | Int_t last = -1; | |
2456 | ||
2457 | Int_t indexDDL = 0; | |
2458 | Int_t iRawData = 0; | |
2459 | AliTOFrawData *tofRawDatum = 0; | |
2460 | for (indexDDL=0; indexDDL<AliDAQ::NumberOfDdls("TOF"); indexDDL++) { | |
2461 | ||
2462 | rawReader->Reset(); | |
2463 | if (fNewDecoderVersion) { | |
2464 | AliInfo("Using New Decoder \n"); | |
2465 | LoadRawDataBuffers(indexDDL, 0); | |
2466 | } | |
2467 | else | |
2468 | LoadRawData(indexDDL); | |
2469 | ||
2470 | clonesRawData = GetRawData(); | |
2471 | if (clonesRawData->GetEntriesFast()!=0) AliInfo(Form(" TOF raw data number = %3d", clonesRawData->GetEntriesFast())); | |
2472 | for (iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) { | |
2473 | ||
2474 | tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData); | |
2475 | ||
2476 | //if (tofRawDatum->GetTOT()==-1 || tofRawDatum->GetTOF()==-1) continue; | |
2477 | if (tofRawDatum->GetTOF()==-1) continue; | |
2478 | ||
2479 | EquipmentId2VolumeId(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(), | |
2480 | tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel(), detectorIndex); | |
2481 | ||
2482 | dummy = detectorIndex[3]; | |
2483 | detectorIndex[3] = detectorIndex[4];//padz | |
2484 | detectorIndex[4] = dummy;//padx | |
2485 | ||
2486 | digit[0] = tofRawDatum->GetTOF(); | |
2487 | digit[1] = tofRawDatum->GetTOT(); | |
2488 | ||
2489 | dummy = detectorIndex[3]; | |
2490 | detectorIndex[3] = detectorIndex[4];//padx | |
2491 | detectorIndex[4] = dummy;//padz | |
2492 | ||
2493 | // Do not reconstruct anything in the holes | |
2494 | if (detectorIndex[0]==13 || detectorIndex[0]==14 || detectorIndex[0]==15 ) { // sectors with holes | |
2495 | if (detectorIndex[1]==2) { // plate with holes | |
2496 | inholes++; | |
2497 | continue; | |
2498 | } | |
2499 | } | |
2500 | ||
2501 | last = sdigitsArray->GetEntriesFast(); | |
2502 | new (aSDigits[last]) AliTOFSDigit(track, detectorIndex, digit); | |
2503 | /* | |
2504 | if (fVerbose==2) { | |
2505 | if (indexDDL<10) ftxt << " " << indexDDL; | |
2506 | else ftxt << " " << indexDDL; | |
2507 | if (tofRawDatum->GetTRM()<10) ftxt << " " << tofRawDatum->GetTRM(); | |
2508 | else ftxt << " " << tofRawDatum->GetTRM(); | |
2509 | ftxt << " " << tofRawDatum->GetTRMchain(); | |
2510 | if (tofRawDatum->GetTDC()<10) ftxt << " " << tofRawDatum->GetTDC(); | |
2511 | else ftxt << " " << tofRawDatum->GetTDC(); | |
2512 | ftxt << " " << tofRawDatum->GetTDCchannel(); | |
2513 | ||
2514 | if (detectorIndex[0]<10) ftxt << " -> " << detectorIndex[0]; | |
2515 | else ftxt << " -> " << detectorIndex[0]; | |
2516 | ftxt << " " << detectorIndex[1]; | |
2517 | if (detectorIndex[2]<10) ftxt << " " << detectorIndex[2]; | |
2518 | else ftxt << " " << detectorIndex[2]; | |
2519 | ftxt << " " << detectorIndex[4]; | |
2520 | if (detectorIndex[4]<10) ftxt << " " << detectorIndex[3]; | |
2521 | else ftxt << " " << detectorIndex[3]; | |
2522 | ||
2523 | if (digit[1]<10)ftxt << " " << digit[1]; | |
2524 | else if (digit[1]>=10 && digit[1]<100) ftxt << " " << digit[1]; | |
2525 | else ftxt << " " << digit[1]; | |
2526 | if (digit[0]<10) ftxt << " " << digit[0] << endl; | |
2527 | else if (digit[0]>=10 && digit[0]<100) ftxt << " " << digit[0] << endl; | |
2528 | else if (digit[0]>=100 && digit[0]<1000) ftxt << " " << digit[0] << endl; | |
2529 | else ftxt << " " << digit[3] << endl; | |
2530 | } | |
2531 | */ | |
2532 | AliDebug(2, Form(" Raw data reading %2d -> %2d %1d %2d %1d %2d (%d, %d, %d)", | |
2533 | last, | |
2534 | detectorIndex[0], detectorIndex[1], detectorIndex[2], detectorIndex[4], detectorIndex[3], | |
2535 | digit[0], digit[1], digit[3])); | |
2536 | ||
2537 | tofRawDatum = 0; | |
2538 | } // while loop | |
2539 | ||
2540 | clonesRawData->Clear(); | |
2541 | ||
2542 | } // DDL Loop | |
2543 | ||
2544 | //if (fVerbose==2) ftxt.close(); | |
2545 | ||
2546 | if (inholes) AliWarning(Form("Clusters in the TOF holes: %d",inholes)); | |
2547 | ||
2548 | Int_t nSDigits = sdigitsArray->GetEntries(); | |
2549 | AliDebug(1, Form("Got %d TOF sdigits", nSDigits)); | |
2550 | AliDebug(1, Form("Execution time to read TOF raw data and fill TOF sdigit tree : R:%.2fs C:%.2fs", | |
2551 | stopwatch.RealTime(),stopwatch.CpuTime())); | |
2552 | ||
2553 | } | |
08d6922f | 2554 | |
a3ed3947 | 2555 | void AliTOFRawStream::VolumeID2LTM(Int_t detind[], |
2556 | Int_t iDDL, | |
2557 | Int_t iTRM, | |
2558 | Int_t iChain, | |
2559 | Int_t iTDC, | |
2560 | Int_t iChannel) const { | |
08d6922f | 2561 | // |
2562 | // To convert the TOF trigger macropad ID (i.e. detind) | |
2563 | // into TOF OR signals equipment ID (i.e. iDDL, iTRM, iChain, iTDC, iChannel) | |
2564 | // | |
2565 | ||
a3ed3947 | 2566 | const Int_t kFirstTDCnumber = 12; |
08d6922f | 2567 | |
a3ed3947 | 2568 | iDDL=-1, iTRM = 3 , iChain=-1, iTDC=-1, iChannel=-1; |
08d6922f | 2569 | if (detind[1]==0 || detind[1]==1 || (detind[1]==2 && detind[2]<=7)) { |
a3ed3947 | 2570 | if (detind[4]<24) |
2571 | iDDL = detind[0]*4; | |
2572 | else | |
2573 | iDDL = detind[0]*4; | |
08d6922f | 2574 | } |
2575 | else { | |
a3ed3947 | 2576 | if (detind[4]<24) |
2577 | iDDL = detind[0]*4+2; | |
2578 | else | |
2579 | iDDL = detind[0]*4+2; | |
08d6922f | 2580 | } |
a3ed3947 | 2581 | |
2582 | iChain=fgkChainMap24[detind[1]][detind[2]]; | |
2583 | iTDC=(Int_t)(fgkChannelMap24[detind[1]][detind[2]]/8)+kFirstTDCnumber; | |
2584 | iChannel=fgkChannelMap24[detind[1]][detind[2]]%8; | |
08d6922f | 2585 | |
2586 | } | |
2587 | ||
a3ed3947 | 2588 | void AliTOFRawStream::LTM2VolumeID(Int_t iDDL, |
2589 | Int_t iTRM, | |
2590 | Int_t iChain, | |
2591 | Int_t iTDC, | |
08d6922f | 2592 | Int_t iChannel, |
a3ed3947 | 2593 | Int_t detind0[], Int_t detind1[]) const { |
08d6922f | 2594 | // |
2595 | // To convert the TOF OR signals equipment ID (i.e. iDDL, iTRM, iChain, iTDC, iChannel) | |
2596 | // into TOF trigger macropad IDs (i.e. detind0 and detind1). | |
2597 | // In general, a couple of neighbouring TOF semi-strip represents a TOF trigger macropad. | |
2598 | // | |
2599 | ||
a3ed3947 | 2600 | const Int_t kFirstTDCnumber = 12; |
2601 | ||
08d6922f | 2602 | Int_t iSector0=-1, iModule0=-1, iStrip0=-1, iPadX0=-1; // Le variabili del Volume ID |
2603 | Int_t iSector1=-1, iModule1=-1, iStrip1=-1, iPadX1=-1; // Le variabili del Volume ID | |
2604 | ||
a3ed3947 | 2605 | if( iDDL%2==1 && iTRM==3 && iTDC-kFirstTDCnumber>=0 && iTDC-kFirstTDCnumber<3 ) { |
08d6922f | 2606 | iSector0 = (Int_t)(iDDL/4); |
2607 | iSector1 = (Int_t)(iDDL/4); | |
a3ed3947 | 2608 | Int_t iChan= iChannel+(iTDC-kFirstTDCnumber)*8; |
4306fa22 | 2609 | if( iDDL%4 == 1 ){ |
08d6922f | 2610 | if(iChain==0){ //CRATE 0 |
2611 | iPadX0=0; | |
2612 | iPadX1=0; | |
2613 | iStrip0=fgkStrip0MapCrate0[iChan]; | |
2614 | iStrip1=fgkStrip1MapCrate0[iChan]; | |
2615 | iModule0=fgkModule0MapCrate0[iChan]; | |
2616 | iModule1=fgkModule1MapCrate0[iChan]; | |
2617 | } | |
2618 | if(iChain==1){// CRATE 1 | |
2619 | iPadX0=24; | |
2620 | iPadX1=24; | |
2621 | iStrip0=fgkStrip0MapCrate1[iChan]; | |
2622 | iStrip1=fgkStrip1MapCrate1[iChan]; | |
2623 | iModule0=fgkModule0MapCrate1[iChan]; | |
2624 | iModule1=fgkModule1MapCrate1[iChan]; | |
2625 | } | |
2626 | ||
2627 | } | |
4306fa22 | 2628 | if( iDDL%4 == 3 ){ |
08d6922f | 2629 | if(iChain==1){// CRATE 3 |
2630 | iPadX0=0; | |
2631 | iPadX1=0; | |
2632 | iStrip0=fgkStrip0MapCrate3[iChan]; | |
2633 | iStrip1=fgkStrip1MapCrate3[iChan]; | |
2634 | iModule0=fgkModule0MapCrate3[iChan]; | |
2635 | iModule1=fgkModule1MapCrate3[iChan]; | |
2636 | } | |
2637 | if(iChain==0){// CRATE 2 | |
2638 | iPadX0=24; | |
2639 | iPadX1=24; | |
2640 | iStrip0=fgkStrip0MapCrate2[iChan]; | |
2641 | iStrip1=fgkStrip1MapCrate2[iChan]; | |
2642 | iModule0=fgkModule0MapCrate2[iChan]; | |
2643 | iModule1=fgkModule1MapCrate2[iChan]; | |
2644 | } | |
2645 | } | |
2646 | } | |
4306fa22 | 2647 | |
2648 | if(iStrip1==-1 || iModule1==-1){ | |
2649 | detind1[0]=-1; | |
2650 | detind1[1]=-1; | |
2651 | detind1[2]=-1; | |
2652 | detind1[3]=-1; | |
2653 | detind1[4]=-1; | |
2654 | } | |
2655 | else{ | |
2656 | detind1[0]=iSector1; | |
2657 | detind1[1]=iModule1; | |
2658 | detind1[2]=iStrip1; | |
2659 | detind1[3]=iPadX1; | |
2660 | detind1[4]=0; | |
2661 | } | |
2662 | ||
2663 | if(iStrip0==-1 || iModule0==-1){ | |
2664 | detind0[0]=-1; | |
2665 | detind0[1]=-1; | |
2666 | detind0[2]=-1; | |
2667 | detind0[3]=-1; | |
2668 | detind0[4]=-1; | |
2669 | } | |
2670 | else{ | |
2671 | detind0[0]=iSector0; | |
2672 | detind0[1]=iModule0; | |
2673 | detind0[2]=iStrip0; | |
2674 | detind0[3]=iPadX0; | |
2675 | detind0[4]=0; | |
2676 | } | |
08d6922f | 2677 | } |