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