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