]>
Commit | Line | Data |
---|---|---|
7e6dce66 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2003, 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$ |
a403781d | 18 | Revision 1.15 2007/04/23 16:51:39 decaro |
19 | Digits-to-raw_data conversion: correction for a more real description (A.De Caro, R.Preghenella) | |
20 | ||
515faf5d | 21 | Revision 1.14 2007/03/28 10:50:33 decaro |
22 | Rounding off problem in rawData coding/decoding: solved | |
23 | ||
d11fc181 | 24 | Revision 1.13 2007/02/20 15:57:00 decaro |
25 | Raw data update: to read the TOF raw data defined in UNPACKED mode | |
26 | ||
15ec34b9 | 27 | Revision 1.12 2006/08/22 13:29:42 arcelli |
28 | removal of effective c++ warnings (C.Zampolli) | |
29 | ||
655e379f | 30 | Revision 1.11 2006/08/10 14:46:54 decaro |
31 | TOF raw data format: updated version | |
32 | ||
d0eb8f39 | 33 | Revision 1.10.1 2006/06/28 A.De Caro |
34 | Update TOF raw data format | |
35 | according to the final version | |
36 | (see ALICE internal note in preparation | |
37 | 'ALICE TOF raw data format') | |
38 | ||
571dda3d | 39 | Revision 0.02 2005/7/25 A.De Caro |
40 | Update number of bits allocated for time-of-flight | |
41 | and 'charge' measurements | |
42 | ||
7e6dce66 | 43 | Revision 0.01 2004/6/11 A.De Caro, S.B.Sellitto, R.Silvestri |
44 | First implementation: global methods RawDataTOF | |
45 | GetDigits | |
7e6dce66 | 46 | */ |
571dda3d | 47 | |
d0eb8f39 | 48 | //////////////////////////////////////////////////////////////////// |
49 | // // | |
50 | // This class contains the methods to create the Raw Data files // | |
51 | // for the TOF detector starting from the Digits. // | |
52 | // In this implementation, we defined the structure // | |
53 | // of the ALICE-TOF raw data (according to the // | |
54 | // ALICE technical note, in preparation) // | |
55 | // starting from the TOF digit format. // | |
56 | // // | |
57 | //////////////////////////////////////////////////////////////////// | |
7e6dce66 | 58 | |
0e46b9ae | 59 | #include "Riostream.h" |
60 | ||
61 | #include "TBranch.h" | |
62 | #include "TClonesArray.h" | |
63 | #include "TMath.h" | |
d0eb8f39 | 64 | #include "TRandom.h" |
43f77f2d | 65 | |
571dda3d | 66 | #include "AliBitPacking.h" |
d0eb8f39 | 67 | #include "AliDAQ.h" |
0e46b9ae | 68 | #include "AliLog.h" |
d0eb8f39 | 69 | //#include "AliRawDataHeader.h" |
70 | #include "AliRawDataHeaderSim.h" | |
571dda3d | 71 | |
0e46b9ae | 72 | #include "AliTOFDDLRawData.h" |
d0eb8f39 | 73 | #include "AliTOFDigitMap.h" |
7e6dce66 | 74 | #include "AliTOFdigit.h" |
0e46b9ae | 75 | #include "AliTOFGeometry.h" |
571dda3d | 76 | #include "AliTOFRawStream.h" |
d0eb8f39 | 77 | |
78 | extern TRandom *gRandom; | |
7e6dce66 | 79 | |
80 | ClassImp(AliTOFDDLRawData) | |
81 | ||
d0eb8f39 | 82 | //--------------------------------------------------------------------------- |
655e379f | 83 | AliTOFDDLRawData::AliTOFDDLRawData(): |
84 | fVerbose(0), | |
85 | fIndex(-1), | |
15ec34b9 | 86 | fPackedAcquisition(kTRUE), |
515faf5d | 87 | fFakeOrphaneProduction(kFALSE), |
88 | fMatchingWindow(8192), | |
655e379f | 89 | fTOFgeometry(0), |
90 | fTOFdigitMap(new AliTOFDigitMap()), | |
91 | fTOFdigitArray(0x0), | |
92 | fTOFrawStream(new AliTOFRawStream()) | |
7e6dce66 | 93 | { |
94 | //Default constructor | |
d3c7bfac | 95 | } |
96 | ||
d0eb8f39 | 97 | //---------------------------------------------------------------------------- |
655e379f | 98 | AliTOFDDLRawData::AliTOFDDLRawData(AliTOFGeometry *tofGeom): |
99 | fVerbose(0), | |
100 | fIndex(-1), | |
15ec34b9 | 101 | fPackedAcquisition(kTRUE), |
515faf5d | 102 | fFakeOrphaneProduction(kFALSE), |
103 | fMatchingWindow(8192), | |
655e379f | 104 | fTOFgeometry(tofGeom), |
105 | fTOFdigitMap(new AliTOFDigitMap()), | |
106 | fTOFdigitArray(0x0), | |
107 | fTOFrawStream(new AliTOFRawStream()) | |
d3c7bfac | 108 | { |
109 | //Constructor | |
7e6dce66 | 110 | |
d0eb8f39 | 111 | } |
7e6dce66 | 112 | |
d0eb8f39 | 113 | //---------------------------------------------------------------------------- |
114 | AliTOFDDLRawData::AliTOFDDLRawData(const AliTOFDDLRawData &source) : | |
655e379f | 115 | TObject(source), |
116 | fVerbose(0), | |
117 | fIndex(-1), | |
15ec34b9 | 118 | fPackedAcquisition(kTRUE), |
515faf5d | 119 | fFakeOrphaneProduction(kFALSE), |
120 | fMatchingWindow(8192), | |
655e379f | 121 | fTOFgeometry(0), |
122 | fTOFdigitMap(new AliTOFDigitMap()), | |
123 | fTOFdigitArray(0x0), | |
124 | fTOFrawStream(new AliTOFRawStream()) | |
125 | { | |
7e6dce66 | 126 | //Copy Constructor |
127 | this->fIndex=source.fIndex; | |
128 | this->fVerbose=source.fVerbose; | |
15ec34b9 | 129 | this->fPackedAcquisition=source.fPackedAcquisition; |
515faf5d | 130 | this->fFakeOrphaneProduction=source.fFakeOrphaneProduction; |
131 | this->fMatchingWindow=source.fMatchingWindow; | |
d3c7bfac | 132 | this->fTOFgeometry=source.fTOFgeometry; |
d0eb8f39 | 133 | this->fTOFdigitMap=source.fTOFdigitMap; |
134 | this->fTOFdigitArray=source.fTOFdigitArray; | |
135 | this->fTOFrawStream=source.fTOFrawStream; | |
7e6dce66 | 136 | return; |
137 | } | |
138 | ||
d0eb8f39 | 139 | //---------------------------------------------------------------------------- |
140 | AliTOFDDLRawData& AliTOFDDLRawData::operator=(const AliTOFDDLRawData &source) { | |
7e6dce66 | 141 | //Assigment operator |
142 | this->fIndex=source.fIndex; | |
143 | this->fVerbose=source.fVerbose; | |
15ec34b9 | 144 | this->fPackedAcquisition=source.fPackedAcquisition; |
515faf5d | 145 | this->fFakeOrphaneProduction=source.fFakeOrphaneProduction; |
146 | this->fMatchingWindow=source.fMatchingWindow; | |
d3c7bfac | 147 | this->fTOFgeometry=source.fTOFgeometry; |
d0eb8f39 | 148 | this->fTOFdigitMap=source.fTOFdigitMap; |
149 | this->fTOFdigitArray=source.fTOFdigitArray; | |
150 | this->fTOFrawStream=source.fTOFrawStream; | |
7e6dce66 | 151 | return *this; |
152 | } | |
153 | ||
d0eb8f39 | 154 | //---------------------------------------------------------------------------- |
155 | Int_t AliTOFDDLRawData::RawDataTOF(TBranch* branch) | |
7e6dce66 | 156 | { |
571dda3d | 157 | // |
158 | // This method creates the Raw data files for TOF detector | |
159 | // | |
160 | ||
161 | const Int_t kSize = 5000; //max number of digits per DDL file times 2 | |
162 | ||
7e6dce66 | 163 | UInt_t buf[kSize]; |
7e6dce66 | 164 | |
d0eb8f39 | 165 | fIndex = -1; |
166 | ||
167 | fTOFdigitArray = * (TClonesArray**) branch->GetAddress(); | |
7e6dce66 | 168 | |
7e6dce66 | 169 | char fileName[15]; |
170 | ofstream outfile; // logical name of the output file | |
d0eb8f39 | 171 | |
172 | //AliRawDataHeader header; | |
173 | AliRawDataHeaderSim header; | |
174 | ||
571dda3d | 175 | UInt_t sizeRawData = 0; |
7e6dce66 | 176 | |
d0eb8f39 | 177 | branch->GetEvent(); |
178 | ||
179 | GetDigits(); | |
180 | ||
181 | Int_t jj = -1; | |
182 | Int_t iDDL = -1; | |
183 | Int_t nDDL = -1; | |
184 | Int_t nTRM = 0; | |
185 | Int_t iChain = -1; | |
186 | ||
187 | UInt_t nWordsPerTRM = 0; | |
188 | ||
7e6dce66 | 189 | //loop over TOF DDL files |
d0eb8f39 | 190 | for (nDDL=0; nDDL<AliDAQ::NumberOfDdls("TOF"); nDDL++) { |
571dda3d | 191 | |
d0eb8f39 | 192 | strcpy(fileName,AliDAQ::DdlFileName("TOF",nDDL)); //The name of the output file |
7e6dce66 | 193 | #ifndef __DECCXX |
194 | outfile.open(fileName,ios::binary); | |
195 | #else | |
196 | outfile.open(fileName); | |
197 | #endif | |
571dda3d | 198 | |
d0eb8f39 | 199 | iDDL = fTOFrawStream->GetDDLnumberPerSector(nDDL); |
200 | ||
201 | // write Dummy DATA HEADER | |
202 | UInt_t dataHeaderPosition = outfile.tellp(); | |
7e6dce66 | 203 | outfile.write((char*)(&header),sizeof(header)); |
204 | ||
d0eb8f39 | 205 | // DRM section: trailer |
206 | MakeDRMtrailer(buf); | |
7e6dce66 | 207 | |
d0eb8f39 | 208 | // LTM section |
7e6dce66 | 209 | fIndex++; |
d0eb8f39 | 210 | buf[fIndex] = MakeFiller(); |
211 | MakeLTMtrailer(buf); | |
212 | MakeLTMdata(buf); | |
213 | MakeLTMheader(buf); | |
214 | ||
215 | // loop on TRM number per DRM | |
216 | for (nTRM=AliTOFGeometry::NTRM(); nTRM>=3; nTRM--) { | |
217 | ||
218 | nWordsPerTRM = 0; | |
219 | ||
220 | // the slot number 3 of the even DRM (i.e. right) doesn't contain TDC digit data | |
221 | if (iDDL%2==0 && nTRM==3) continue; | |
222 | ||
223 | // TRM global trailer | |
224 | MakeTRMtrailer(buf); | |
225 | ||
226 | // loop on TRM chain number per TRM | |
227 | for (iChain=AliTOFGeometry::NChain()-1; iChain>=0; iChain--) { | |
228 | ||
229 | // TRM chain trailer | |
230 | MakeTRMchainTrailer(iChain, buf); | |
231 | nWordsPerTRM++; | |
232 | ||
233 | // TRM TDC digits | |
234 | MakeTDCdigits(nDDL, nTRM, iChain, buf, nWordsPerTRM); | |
235 | ||
236 | // TRM chain header | |
237 | MakeTRMchainHeader(nTRM, iChain, buf); | |
238 | nWordsPerTRM++; | |
239 | ||
240 | } // end loop on iChain | |
7e6dce66 | 241 | |
d0eb8f39 | 242 | // TRM global header |
243 | MakeTRMheader(nTRM, buf); | |
244 | ||
245 | // TRM filler in case where TRM data number is odd | |
246 | if (nWordsPerTRM%2!=0) MakeTRMfiller(buf, nWordsPerTRM); | |
247 | ||
248 | } // end loop on nTRM | |
249 | ||
250 | // DRM section: in | |
251 | MakeDRMheader(nDDL, buf); | |
252 | ||
253 | ReverseArray(buf, fIndex+1); | |
7e6dce66 | 254 | |
7e6dce66 | 255 | outfile.write((char *)buf,((fIndex+1)*sizeof(UInt_t))); |
256 | ||
d0eb8f39 | 257 | for (jj=0; jj<(fIndex+1); jj++) buf[jj]=0; |
258 | fIndex = -1; | |
7e6dce66 | 259 | |
260 | //Write REAL DATA HEADER | |
d0eb8f39 | 261 | UInt_t currentFilePosition = outfile.tellp(); |
571dda3d | 262 | sizeRawData = currentFilePosition - dataHeaderPosition - sizeof(header); |
d0eb8f39 | 263 | header.fSize = currentFilePosition - dataHeaderPosition; |
7e6dce66 | 264 | header.SetAttribute(0); // valid data |
571dda3d | 265 | outfile.seekp(dataHeaderPosition); |
7e6dce66 | 266 | outfile.write((char*)(&header),sizeof(header)); |
571dda3d | 267 | outfile.seekp(currentFilePosition); |
268 | ||
7e6dce66 | 269 | outfile.close(); |
270 | ||
d0eb8f39 | 271 | } //end loop on DDL file number |
272 | ||
273 | return 0; | |
274 | ||
275 | } | |
276 | ||
277 | //---------------------------------------------------------------------------- | |
278 | void AliTOFDDLRawData::GetDigits() | |
279 | { | |
280 | // | |
281 | // Fill the TOF volumes' map with the TOF digit indices | |
282 | // | |
283 | ||
284 | Int_t vol[5] = {-1,-1,-1,-1,-1}; | |
285 | ||
286 | Int_t digit = -1; | |
287 | Int_t ndigits = fTOFdigitArray->GetEntries(); | |
288 | ||
289 | AliTOFdigit *digs; | |
290 | ||
291 | // loop on TOF digits | |
292 | for (digit=0; digit<ndigits; digit++) { | |
293 | digs = (AliTOFdigit*)fTOFdigitArray->UncheckedAt(digit); | |
294 | ||
295 | vol[0] = digs->GetSector(); // Sector Number (0-17) | |
296 | vol[1] = digs->GetPlate(); // Plate Number (0-4) | |
297 | vol[2] = digs->GetStrip(); // Strip Number (0-14/18) | |
298 | vol[3] = digs->GetPadx(); // Pad Number in x direction (0-47) | |
299 | vol[4] = digs->GetPadz(); // Pad Number in z direction (0-1) | |
300 | ||
301 | fTOFdigitMap->AddDigit(vol, digit); | |
302 | ||
303 | } // close loop on digit del TOF | |
304 | ||
305 | } | |
306 | ||
307 | //---------------------------------------------------------------------------- | |
308 | void AliTOFDDLRawData::MakeDRMheader(Int_t nDDL, UInt_t *buf) | |
309 | { | |
310 | // | |
311 | // DRM global header | |
312 | // | |
313 | ||
314 | Int_t iDDL = fTOFrawStream->GetDDLnumberPerSector(nDDL); | |
315 | ||
316 | Int_t iSector = fTOFrawStream->GetSectorNumber(nDDL); | |
317 | ||
318 | UInt_t baseWord=0; | |
319 | UInt_t word; | |
320 | ||
321 | // DRM event CRC | |
322 | baseWord=0; | |
323 | word = 1; // 0001 -> DRM data are coming from the VME slot number 1 | |
324 | AliBitPacking::PackWord(word,baseWord, 0, 3); | |
325 | word = 0; // event CRC | |
326 | AliBitPacking::PackWord(word,baseWord, 4,19); | |
327 | word = 0; // reserved for future use | |
328 | AliBitPacking::PackWord(word,baseWord,20,27); | |
329 | word = 4; // 0100 -> DRM header ID | |
330 | AliBitPacking::PackWord(word,baseWord,28,31); | |
331 | fIndex++; | |
332 | buf[fIndex]=baseWord; | |
333 | ||
334 | // DRM status header 3 | |
335 | baseWord=0; | |
336 | word = 1; // 0001 -> DRM data are coming from the VME slot number 1 | |
337 | AliBitPacking::PackWord(word,baseWord, 0, 3); | |
338 | word = 0; // TTC event counter | |
339 | AliBitPacking::PackWord(word,baseWord, 4,27); | |
340 | word = 4; // 0100 -> DRM header ID | |
341 | AliBitPacking::PackWord(word,baseWord,28,31); | |
342 | fIndex++; | |
343 | buf[fIndex]=baseWord; | |
344 | ||
345 | // DRM status header 2 | |
346 | baseWord=0; | |
347 | word = 1; // 0001 -> DRM data are coming from the VME slot number 1 | |
348 | AliBitPacking::PackWord(word,baseWord, 0, 3); | |
349 | ||
350 | if (iDDL%2==1) { | |
351 | word = 2047; // enable ID: [00000000000;11111111111] for odd | |
352 | // (i.e. right) crates | |
353 | AliBitPacking::PackWord(word,baseWord, 4,14); | |
354 | } else { | |
355 | word = 2045; // enable ID: [00000000000;11111111101] for even | |
356 | // (i.e. left) crates | |
357 | AliBitPacking::PackWord(word,baseWord, 4,14); | |
358 | } | |
359 | ||
360 | word = 0; // | |
361 | AliBitPacking::PackWord(word,baseWord,15,15); | |
362 | word = 0; // fault ID | |
363 | AliBitPacking::PackWord(word,baseWord,16,27); | |
364 | word = 4; // 0100 -> DRM header ID | |
365 | AliBitPacking::PackWord(word,baseWord,28,31); | |
366 | fIndex++; | |
367 | buf[fIndex]=baseWord; | |
7e6dce66 | 368 | |
d0eb8f39 | 369 | // DRM status header 1 |
370 | baseWord=0; | |
371 | word = 1; // 0001 -> DRM data are coming from the VME slot number 1 | |
372 | AliBitPacking::PackWord(word,baseWord, 0, 3); | |
373 | ||
374 | if (iDDL%2==1) { | |
375 | word = 2047; // slot ID: [00000000000;11111111111] for odd | |
376 | // (i.e. right) crates | |
377 | AliBitPacking::PackWord(word,baseWord, 4,14); | |
378 | } else { | |
379 | word = 2045; // slot ID: [00000000000;11111111101] for even | |
380 | // (i.e. left) crates | |
381 | AliBitPacking::PackWord(word,baseWord, 4,14); | |
382 | } | |
383 | ||
384 | word = 1; // LHC clock status: 1/0 | |
385 | AliBitPacking::PackWord(word,baseWord,15,15); | |
386 | word = 0; // reserved for future use | |
387 | AliBitPacking::PackWord(word,baseWord,16,27); | |
388 | word = 4; // 0100 -> DRM header ID | |
389 | AliBitPacking::PackWord(word,baseWord,28,31); | |
390 | fIndex++; | |
391 | buf[fIndex]=baseWord; | |
392 | ||
393 | // DRM global header | |
394 | baseWord=0; | |
395 | word = 1; // 0001 -> DRM data are coming from the VME slot number 1 | |
396 | AliBitPacking::PackWord(word,baseWord, 0, 3); | |
397 | word = fIndex+1 + 1; // event words | |
398 | AliBitPacking::PackWord(word,baseWord, 4,20); | |
399 | word = iDDL; // crate ID [0;3] | |
400 | AliBitPacking::PackWord(word,baseWord,21,22); | |
401 | word = iSector; // sector ID [0;17] | |
402 | AliBitPacking::PackWord(word,baseWord,23,27); | |
403 | word = 4; // 0100 -> DRM header ID | |
404 | AliBitPacking::PackWord(word,baseWord,28,31); | |
405 | fIndex++; | |
406 | buf[fIndex]=baseWord; | |
407 | ||
7e6dce66 | 408 | } |
409 | ||
d0eb8f39 | 410 | //---------------------------------------------------------------------------- |
411 | void AliTOFDDLRawData::MakeDRMtrailer(UInt_t *buf) | |
412 | { | |
413 | // | |
414 | // DRM global trailer | |
415 | // | |
416 | ||
417 | UInt_t baseWord; | |
418 | UInt_t word; | |
419 | ||
420 | baseWord=0; | |
421 | word = 1; // 0001 -> DRM data are coming from the VME slot number 1 | |
422 | AliBitPacking::PackWord(word,baseWord, 0, 3); | |
423 | word = 0; // local event counter | |
424 | AliBitPacking::PackWord(word,baseWord, 4,15); | |
425 | word = 0; // reserved for future use | |
426 | AliBitPacking::PackWord(word,baseWord,16,27); | |
427 | word = 5; // 0101 -> DRM trailer ID | |
428 | AliBitPacking::PackWord(word,baseWord,28,31); | |
429 | fIndex++; | |
430 | buf[fIndex]=baseWord; | |
431 | ||
432 | } | |
433 | ||
434 | //---------------------------------------------------------------------------- | |
435 | void AliTOFDDLRawData::MakeLTMheader(UInt_t *buf) | |
436 | { | |
437 | // | |
438 | // LTM header | |
439 | // | |
440 | ||
441 | UInt_t baseWord; | |
442 | UInt_t word; | |
443 | ||
444 | baseWord=0; | |
445 | word = 2; // 0010 -> LTM data are coming from the VME slot number 2 | |
446 | AliBitPacking::PackWord(word,baseWord, 0, 3); | |
447 | word = 35; // event words | |
448 | AliBitPacking::PackWord(word,baseWord, 4,16); | |
449 | word = 0; // crc error | |
450 | AliBitPacking::PackWord(word,baseWord,17,17); | |
451 | word = 0; // fault | |
452 | AliBitPacking::PackWord(word,baseWord,18,23); | |
453 | word = 0; | |
454 | AliBitPacking::PackWord(word,baseWord,24,27); | |
455 | word = 4; // 0100 -> LTM header ID | |
456 | AliBitPacking::PackWord(word,baseWord,28,31); | |
457 | fIndex++; | |
458 | buf[fIndex]=baseWord; | |
459 | ||
460 | } | |
461 | ||
462 | //---------------------------------------------------------------------------- | |
463 | void AliTOFDDLRawData::MakeLTMdata(UInt_t *buf) | |
464 | { | |
465 | // | |
466 | // LTM data | |
467 | // | |
468 | ||
469 | UInt_t baseWord; | |
470 | UInt_t word; | |
471 | ||
472 | baseWord=0; | |
473 | word = 100; // Local temperature in LTM5 -> 4 X 25 degree (environment temperature) | |
474 | AliBitPacking::PackWord(word,baseWord, 0, 9); | |
475 | word = 100; // Local temperature in LTM6 -> 4 X 25 degree (environment temperature) | |
476 | AliBitPacking::PackWord(word,baseWord,10,19); | |
477 | word = 100; // Local temperature in LTM7 -> 4 X 25 degree (environment temperature) | |
478 | AliBitPacking::PackWord(word,baseWord,20,29); | |
479 | word = 0; | |
480 | AliBitPacking::PackWord(word,baseWord,30,31); | |
481 | ||
482 | fIndex++; | |
483 | buf[fIndex]=baseWord; | |
484 | ||
485 | // Local temperature in LTM2, LMT3, LTM4 -> 4 X 25 degree (environment temperature) | |
486 | fIndex++; | |
487 | buf[fIndex]=baseWord; | |
488 | ||
489 | // Local temperature in FEAC7, FEAC8, LTM1 -> 4 X 25 degree (environment temperature) | |
490 | fIndex++; | |
491 | buf[fIndex]=baseWord; | |
492 | ||
493 | // Local temperature in FEAC4, FEAC5, FEAC6 -> 4 X 25 degree (environment temperature) | |
494 | fIndex++; | |
495 | buf[fIndex]=baseWord; | |
496 | ||
497 | // Local temperature in FEAC1, FEAC2, FEAC3 -> 4 X 25 degree (environment temperature) | |
498 | fIndex++; | |
499 | buf[fIndex]=baseWord; | |
500 | ||
501 | baseWord=0; | |
502 | word = 0; // GND-FEAC15 -> Voltage drop between GND and FEAC15 | |
503 | AliBitPacking::PackWord(word,baseWord, 0, 9); | |
504 | word = 0; // VTH16 -> Thereshould voltage for FEAC16 | |
505 | AliBitPacking::PackWord(word,baseWord,10,19); | |
506 | word = 0; // GND-FEAC16 -> Voltage drop between GND and FEAC16 | |
507 | AliBitPacking::PackWord(word,baseWord,20,29); | |
508 | word = 0; | |
509 | AliBitPacking::PackWord(word,baseWord,30,31); | |
510 | ||
511 | fIndex++; | |
512 | buf[fIndex]=baseWord; | |
513 | ||
514 | // VTH14 -> Thereshould voltage for FEAC14 | |
515 | // GND-FEAC14 -> Voltage drop between GND and FEAC14 | |
516 | // VTH15 -> Thereshould voltage for FEAC15 | |
517 | fIndex++; | |
518 | buf[fIndex]=baseWord; | |
519 | ||
520 | // GND-FEAC12 -> Voltage drop between GND and FEAC12 | |
521 | // VTH13 -> Thereshould voltage for FEAC13 | |
522 | // GND-FEAC13 -> Voltage drop between GND and FEAC13 | |
523 | fIndex++; | |
524 | buf[fIndex]=baseWord; | |
525 | ||
526 | // VTH11 -> Thereshould voltage for FEAC11 | |
527 | // GND-FEAC11 -> Voltage drop between GND and FEAC11 | |
528 | // VTH12 -> Thereshould voltage for FEAC12 | |
529 | fIndex++; | |
530 | buf[fIndex]=baseWord; | |
531 | ||
532 | // GND-FEAC9 -> Voltage drop between GND and FEAC9 | |
533 | // VTH10 -> Thereshould voltage for FEAC10 | |
534 | // GND-FEAC10 -> Voltage drop between GND and FEAC10 | |
535 | fIndex++; | |
536 | buf[fIndex]=baseWord; | |
537 | ||
538 | // VTH8 -> Thereshould voltage for FEAC8 | |
539 | // GND-FEAC8 -> Voltage drop between GND and FEAC8 | |
540 | // VTH9 -> Thereshould voltage for FEAC9 | |
541 | fIndex++; | |
542 | buf[fIndex]=baseWord; | |
543 | ||
544 | // GND-FEAC6 -> Voltage drop between GND and FEAC6 | |
545 | // VTH7 -> Thereshould voltage for FEAC7 | |
546 | // GND-FEAC7 -> Voltage drop between GND and FEAC7 | |
547 | fIndex++; | |
548 | buf[fIndex]=baseWord; | |
549 | ||
550 | // VTH5 -> Thereshould voltage for FEAC5 | |
551 | // GND-FEAC5 -> Voltage drop between GND and FEAC5 | |
552 | // VTH6 -> Thereshould voltage for FEAC6 | |
553 | fIndex++; | |
554 | buf[fIndex]=baseWord; | |
555 | ||
556 | // GND-FEAC3 -> Voltage drop between GND and FEAC3 | |
557 | // VTH4 -> Thereshould voltage for FEAC4 | |
558 | // GND-FEAC4 -> Voltage drop between GND and FEAC4 | |
559 | fIndex++; | |
560 | buf[fIndex]=baseWord; | |
561 | ||
562 | // VTH2 -> Thereshould voltage for FEAC2 | |
563 | // GND-FEAC2 -> Voltage drop between GND and FEAC2 | |
564 | // VTH3 -> Thereshould voltage for FEAC3 | |
565 | fIndex++; | |
566 | buf[fIndex]=baseWord; | |
567 | ||
568 | // LV16 -> Low Voltage measured by FEAC16 | |
569 | // GND-FEAC1 -> Voltage drop between GND and FEAC1 | |
570 | // VTH1 -> Thereshould voltage for FEAC1 | |
571 | fIndex++; | |
572 | buf[fIndex]=baseWord; | |
573 | ||
574 | // Low Voltage measured by FEAC13, FEAC14, FEAC15 | |
575 | fIndex++; | |
576 | buf[fIndex]=baseWord; | |
577 | ||
578 | // Low Voltage measured by FEAC10, FEAC11, FEAC12 | |
579 | fIndex++; | |
580 | buf[fIndex]=baseWord; | |
581 | ||
582 | // Low Voltage measured by FEAC7, FEAC8, FEAC9 | |
583 | fIndex++; | |
584 | buf[fIndex]=baseWord; | |
585 | ||
586 | // Low Voltage measured by FEAC4, FEAC5, FEAC6 | |
587 | fIndex++; | |
588 | buf[fIndex]=baseWord; | |
589 | ||
590 | // Low Voltage measured by FEAC1, FEAC2, FEAC3 | |
591 | fIndex++; | |
592 | buf[fIndex]=baseWord; | |
593 | ||
594 | ||
595 | baseWord=0; | |
596 | word = 0; // PDL45 -> Delay Line setting for PDL45 | |
597 | AliBitPacking::PackWord(word,baseWord, 0, 7); | |
598 | word = 0; // PDL46 -> Delay Line setting for PDL46 | |
599 | AliBitPacking::PackWord(word,baseWord, 8,15); | |
600 | word = 0; // PDL47 -> Delay Line setting for PDL47 | |
601 | AliBitPacking::PackWord(word,baseWord,16,23); | |
602 | word = 0; // PDL48 -> Delay Line setting for PDL48 | |
603 | AliBitPacking::PackWord(word,baseWord,24,31); | |
604 | fIndex++; | |
605 | buf[fIndex]=baseWord; | |
606 | ||
607 | // Delay Line setting for PDL41, PDL42, PDL43, PDL44 | |
608 | fIndex++; | |
609 | buf[fIndex]=baseWord; | |
610 | ||
611 | // Delay Line setting for PDL37, PDL38, PDL39, PDL40 | |
612 | fIndex++; | |
613 | buf[fIndex]=baseWord; | |
614 | ||
615 | // Delay Line setting for PDL33, PDL34, PDL35, PDL36 | |
616 | fIndex++; | |
617 | buf[fIndex]=baseWord; | |
618 | ||
619 | // Delay Line setting for PDL29, PDL30, PDL31, PDL32 | |
620 | fIndex++; | |
621 | buf[fIndex]=baseWord; | |
622 | ||
623 | // Delay Line setting for PDL25, PDL26, PDL27, PDL28 | |
624 | fIndex++; | |
625 | buf[fIndex]=baseWord; | |
626 | ||
627 | // Delay Line setting for PDL21, PDL22, PDL23, PDL24 | |
628 | fIndex++; | |
629 | buf[fIndex]=baseWord; | |
630 | ||
631 | // Delay Line setting for PDL17, PDL18, PDL19, PDL20 | |
632 | fIndex++; | |
633 | buf[fIndex]=baseWord; | |
634 | ||
635 | // Delay Line setting for PDL13, PDL14, PDL15, PDL16 | |
636 | fIndex++; | |
637 | buf[fIndex]=baseWord; | |
638 | ||
639 | // Delay Line setting for PDL9, PDL10, PDL11, PDL12 | |
640 | fIndex++; | |
641 | buf[fIndex]=baseWord; | |
642 | ||
643 | // Delay Line setting for PDL5, PDL6, PDL7, PDL8 | |
644 | fIndex++; | |
645 | buf[fIndex]=baseWord; | |
646 | ||
647 | // Delay Line setting for PDL1, PDL2, PDL3, PDL4 | |
648 | fIndex++; | |
649 | buf[fIndex]=baseWord; | |
650 | ||
651 | } | |
652 | ||
653 | //---------------------------------------------------------------------------- | |
654 | void AliTOFDDLRawData::MakeLTMtrailer(UInt_t *buf) | |
655 | { | |
656 | // | |
657 | // LTM trailer | |
658 | // | |
659 | ||
660 | UInt_t baseWord; | |
661 | UInt_t word; | |
662 | ||
663 | baseWord=0; | |
664 | word = 2; // 0010 -> LTM data are coming from the VME slot number 2 | |
665 | AliBitPacking::PackWord(word,baseWord, 0, 3); | |
666 | word = 0; // event crc | |
667 | AliBitPacking::PackWord(word,baseWord, 4,15); | |
668 | word = 0; // event number | |
669 | AliBitPacking::PackWord(word,baseWord,16,27); | |
670 | word = 5; // 0101 -> LTM trailer ID | |
671 | AliBitPacking::PackWord(word,baseWord,28,31); | |
672 | fIndex++; | |
673 | buf[fIndex]=baseWord; | |
674 | ||
675 | } | |
676 | ||
677 | //---------------------------------------------------------------------------- | |
678 | void AliTOFDDLRawData::MakeTRMheader(Int_t nTRM, UInt_t *buf) | |
679 | { | |
680 | // | |
681 | // TRM header for the TRM number nTRM [ 3;12] | |
682 | // | |
683 | ||
684 | if (nTRM<3 || nTRM>12) { | |
685 | AliWarning(Form(" TRM number is out of the right range [3;12] (nTRM = %3i",nTRM)); | |
686 | return; | |
687 | } | |
688 | ||
689 | UInt_t baseWord; | |
690 | UInt_t word; | |
691 | ||
692 | baseWord = 0; | |
693 | word = nTRM; // TRM data coming from the VME slot number nTRM | |
694 | AliBitPacking::PackWord(word,baseWord, 0, 3); | |
695 | word = 0; // event words | |
696 | AliBitPacking::PackWord(word,baseWord, 4,16); | |
15ec34b9 | 697 | |
698 | if (fPackedAcquisition) | |
699 | word = 0; // ACQuisition mode: [0;3] see document | |
700 | else | |
701 | word = 3; // ACQuisition mode: [0;3] see document | |
d0eb8f39 | 702 | AliBitPacking::PackWord(word,baseWord,17,18); |
703 | word = 0; // description of a SEU inside LUT tables for INL compensation; | |
704 | // the data are unaffected | |
705 | AliBitPacking::PackWord(word,baseWord,19,19); | |
706 | word = 0; // Must Be Zero (MBZ) | |
707 | AliBitPacking::PackWord(word,baseWord,20,27); | |
708 | word = 4; // 0100 -> TRM header ID | |
709 | AliBitPacking::PackWord(word,baseWord,28,31); | |
710 | fIndex++; | |
711 | buf[fIndex]=baseWord; | |
712 | ||
713 | } | |
714 | ||
715 | //---------------------------------------------------------------------------- | |
716 | void AliTOFDDLRawData::MakeTRMtrailer(UInt_t *buf) | |
717 | { | |
718 | // | |
719 | // TRM trailer | |
720 | // | |
721 | ||
722 | UInt_t baseWord; | |
723 | UInt_t word; | |
724 | ||
725 | baseWord=0; | |
726 | word = 15; // 1111 -> TRM trailer ID 1 | |
727 | AliBitPacking::PackWord(word,baseWord, 0, 3); | |
728 | word = 0; // event CRC | |
729 | AliBitPacking::PackWord(word,baseWord, 4,15); | |
730 | word = 0; // local event counter == DRM local event counter | |
731 | AliBitPacking::PackWord(word,baseWord,16,27); | |
732 | word = 5; // 0101 -> TRM trailer ID 2 | |
733 | AliBitPacking::PackWord(word,baseWord,28,31); | |
734 | fIndex++; | |
735 | buf[fIndex]=baseWord; | |
736 | ||
737 | } | |
738 | ||
739 | //---------------------------------------------------------------------------- | |
740 | void AliTOFDDLRawData::MakeTRMchainHeader(Int_t nTRM, Int_t iChain, | |
741 | UInt_t *buf) | |
742 | { | |
743 | // | |
744 | // TRM chain header | |
745 | // | |
746 | ||
747 | UInt_t baseWord; | |
748 | UInt_t word; | |
749 | ||
750 | if (nTRM<3 || nTRM>12) { | |
751 | AliWarning(Form(" TRM number is out of the right range [3;12] (nTRM = %3i", nTRM)); | |
752 | return; | |
753 | } | |
754 | ||
755 | if (iChain<0 || iChain>1) { | |
756 | AliWarning(Form(" Chain number is out of the right range [0;1] (iChain = %3i", iChain)); | |
757 | return; | |
758 | } | |
759 | ||
760 | baseWord=0; | |
761 | word = nTRM; // TRM data coming from the VME slot ID nTRM | |
762 | AliBitPacking::PackWord(word,baseWord, 0, 3); | |
763 | word = 0; // bunch ID | |
764 | AliBitPacking::PackWord(word,baseWord, 4,15); | |
765 | word = 100; // PB24 temperature -> 4 X 25 degree (environment temperature) | |
766 | AliBitPacking::PackWord(word,baseWord,16,23); | |
767 | word = (Int_t)(5 * gRandom->Rndm()); // PB24 ID [0;4] | |
768 | AliBitPacking::PackWord(word,baseWord,24,26); | |
769 | word = 0; // TS | |
770 | AliBitPacking::PackWord(word,baseWord,27,27); | |
771 | switch (iChain) { | |
772 | case 0: | |
773 | word = 0; // 0000 -> TRM chain 0 ID | |
774 | break; | |
775 | case 1: | |
776 | word = 2; // 0010 -> TRM chain 1 ID | |
777 | break; | |
778 | } | |
779 | AliBitPacking::PackWord(word,baseWord,28,31); | |
780 | fIndex++; | |
781 | buf[fIndex]=baseWord; | |
782 | ||
783 | } | |
784 | ||
785 | //---------------------------------------------------------------------------- | |
786 | void AliTOFDDLRawData::MakeTRMfiller(UInt_t *buf, UInt_t nWordsPerTRM) | |
787 | { | |
788 | // | |
789 | // TRM filler | |
790 | // | |
791 | ||
792 | Int_t jj = -1; | |
793 | ||
794 | fIndex++; | |
795 | for (jj=fIndex; jj>fIndex-(Int_t)nWordsPerTRM; jj--) { | |
796 | buf[jj] = buf[jj-1]; | |
797 | } | |
798 | ||
799 | buf[fIndex-nWordsPerTRM] = MakeFiller(); | |
800 | ||
801 | } | |
802 | ||
803 | //---------------------------------------------------------------------------- | |
804 | UInt_t AliTOFDDLRawData::MakeFiller() | |
805 | { | |
806 | // | |
807 | // Filler word definition: to make even the number of words per TRM/LTM | |
808 | // | |
809 | ||
810 | UInt_t baseWord; | |
811 | UInt_t word; | |
812 | ||
813 | baseWord=0; | |
814 | word = 0; // 0000 -> filler ID 1 | |
815 | AliBitPacking::PackWord(word,baseWord, 0, 3); | |
816 | word = 0; // MBZ | |
817 | AliBitPacking::PackWord(word,baseWord, 4,27); | |
818 | word = 7; // 0111 -> filler ID 2 | |
819 | AliBitPacking::PackWord(word,baseWord, 28,31); | |
820 | ||
821 | return baseWord; | |
822 | ||
823 | } | |
824 | ||
825 | //---------------------------------------------------------------------------- | |
826 | void AliTOFDDLRawData::MakeTRMchainTrailer(Int_t iChain, UInt_t *buf) | |
827 | { | |
828 | // | |
829 | // TRM chain trailer | |
830 | // | |
831 | ||
832 | if (iChain<0 || iChain>1) { | |
833 | AliWarning(Form(" Chain number is out of the right range [0;1] (iChain = %3i", iChain)); | |
834 | return; | |
835 | } | |
836 | ||
837 | UInt_t baseWord; | |
838 | UInt_t word; | |
839 | ||
840 | baseWord=0; | |
841 | word = 0; // status | |
842 | AliBitPacking::PackWord(word,baseWord, 0, 3); | |
843 | word = 0; // MBZ | |
844 | AliBitPacking::PackWord(word,baseWord, 4,15); | |
845 | word = 0; // event counter | |
846 | AliBitPacking::PackWord(word,baseWord,16,27); | |
847 | switch (iChain) { | |
848 | case 0: | |
849 | word = 1; // 0001 -> TRM chain 0 trailer ID | |
850 | break; | |
851 | case 1: | |
852 | word = 3; // 0011 -> TRM chain 1 trailer ID | |
853 | break; | |
854 | } | |
855 | AliBitPacking::PackWord(word,baseWord,28,31); | |
856 | fIndex++; | |
857 | buf[fIndex]=baseWord; | |
858 | ||
859 | } | |
860 | ||
861 | //---------------------------------------------------------------------------- | |
862 | void AliTOFDDLRawData::MakeTDCdigits(Int_t nDDL, Int_t nTRM, Int_t iChain, | |
863 | UInt_t *buf, UInt_t &nWordsPerTRM) | |
864 | { | |
865 | // | |
866 | // TRM TDC digit | |
867 | // | |
868 | ||
15ec34b9 | 869 | const Double_t kOneMoreFilledCell = 1./(fTOFgeometry->NPadXSector()*fTOFgeometry->NSectors()); |
870 | Double_t percentFilledCells = Double_t(fTOFdigitMap->GetFilledCellNumber())/(fTOFgeometry->NPadXSector()*fTOFgeometry->NSectors()); | |
871 | ||
d0eb8f39 | 872 | if (nDDL<0 || nDDL>71) { |
873 | AliWarning(Form(" DDL number is out of the right range [0;71] (nDDL = %3i", nDDL)); | |
874 | return; | |
875 | } | |
876 | ||
877 | if (nTRM<3 || nTRM>12) { | |
878 | AliWarning(Form(" TRM number is out of the right range [3;12] (nTRM = %3i", nTRM)); | |
879 | return; | |
880 | } | |
881 | ||
882 | if (iChain<0 || iChain>1) { | |
883 | AliWarning(Form(" Chain number is out of the right range [0;1] (iChain = %3i", iChain)); | |
884 | return; | |
885 | } | |
886 | ||
15ec34b9 | 887 | Int_t psArray[1000]; |
888 | UInt_t localBuffer[1000]; | |
889 | Int_t localIndex = -1; | |
890 | ||
d0eb8f39 | 891 | Int_t iDDL = nDDL%AliTOFGeometry::NDDL(); |
892 | ||
893 | Int_t volume[5] = {-1, -1, -1, -1, -1}; | |
894 | Int_t indexDigit[3] = {-1, -1, -1}; | |
895 | ||
896 | Int_t totCharge = -1; | |
897 | Int_t timeOfFlight = -1; | |
898 | ||
15ec34b9 | 899 | Int_t trailingSpurious = -1; |
900 | Int_t leadingSpurious = -1; | |
901 | ||
d0eb8f39 | 902 | AliTOFdigit *digs; |
903 | ||
904 | UInt_t baseWord=0; | |
905 | UInt_t word=0; | |
906 | ||
907 | Int_t jj = -1; | |
908 | Int_t nTDC = -1; | |
909 | Int_t iCH = -1; | |
910 | ||
a403781d | 911 | //Int_t numberOfMeasuresPerChannel = 0; |
912 | //Int_t maxMeasuresPerChannelInTDC = 0; | |
515faf5d | 913 | |
914 | Bool_t outOut = HeadOrTail(); | |
915 | ||
d0eb8f39 | 916 | ofstream ftxt; |
917 | ||
918 | if (fVerbose==2) ftxt.open("TOFdigits.txt",ios::app); | |
919 | ||
920 | for (jj=0; jj<5; jj++) volume[jj] = -1; | |
921 | ||
922 | // loop on TDC number | |
923 | for (nTDC=AliTOFGeometry::NTdc()-1; nTDC>=0; nTDC--) { | |
924 | ||
925 | // the DRM odd (i.e. left) slot number 3 doesn't contain TDC digit data | |
926 | // for TDC numbers 3-14 | |
927 | if (iDDL%2==1 && nTRM==3 && (Int_t)(nTDC/3.)!=0) continue; | |
928 | ||
929 | // loop on TDC channel number | |
930 | for (iCH=AliTOFGeometry::NCh()-1; iCH>=0; iCH--) { | |
931 | ||
a403781d | 932 | //numberOfMeasuresPerChannel = 0; |
515faf5d | 933 | |
d0eb8f39 | 934 | fTOFrawStream->EquipmentId2VolumeId(nDDL, nTRM, iChain, nTDC, iCH, volume); |
935 | ||
936 | if (volume[0]==-1 || volume[1]==-1 || volume[2]==-1 || | |
937 | volume[3]==-1 || volume[4]==-1) continue; | |
d0eb8f39 | 938 | |
939 | for (jj=0; jj<3; jj++) indexDigit[jj] = -1; | |
940 | ||
941 | fTOFdigitMap->GetDigitIndex(volume, indexDigit); | |
942 | ||
15ec34b9 | 943 | if (indexDigit[0]<0) { |
944 | ||
515faf5d | 945 | trailingSpurious = Int_t(2097152*gRandom->Rndm()); |
946 | leadingSpurious = Int_t(2097152*gRandom->Rndm()); | |
15ec34b9 | 947 | |
515faf5d | 948 | if ( fFakeOrphaneProduction && |
949 | ( ( fPackedAcquisition && percentFilledCells<0.12 && gRandom->Rndm()<(0.12-percentFilledCells) ) || | |
950 | (!fPackedAcquisition && percentFilledCells<0.24 && gRandom->Rndm()<(0.24-percentFilledCells) ) ) ) { | |
15ec34b9 | 951 | |
952 | percentFilledCells+=kOneMoreFilledCell; | |
953 | ||
954 | Int_t dummyPS = 0; | |
955 | ||
515faf5d | 956 | if (outOut) { |
15ec34b9 | 957 | word = trailingSpurious; // trailing edge measurement |
958 | dummyPS = 2; | |
959 | } | |
960 | else { | |
961 | word = leadingSpurious; // leading edge measurement | |
962 | dummyPS = 1; | |
963 | } | |
964 | ||
965 | if (fVerbose==2) { | |
966 | if (nDDL<10) ftxt << " " << nDDL; | |
967 | else ftxt << " " << nDDL; | |
968 | if (nTRM<10) ftxt << " " << nTRM; | |
969 | else ftxt << " " << nTRM; | |
970 | ftxt << " " << iChain; | |
971 | if (nTDC<10) ftxt << " " << nTDC; | |
972 | else ftxt << " " << nTDC; | |
973 | ftxt << " " << iCH; | |
974 | if (volume[0]<10) ftxt << " -> " << volume[0]; | |
975 | else ftxt << " -> " << volume[0]; | |
976 | ftxt << " " << volume[1]; | |
977 | if (volume[2]<10) ftxt << " " << volume[2]; | |
978 | else ftxt << " " << volume[2]; | |
979 | ftxt << " " << volume[4]; | |
980 | if (volume[3]<10) ftxt << " " << volume[3]; | |
981 | else ftxt << " " << volume[3]; | |
515faf5d | 982 | ftxt << " " << -1; |
983 | if (word<10) ftxt << " " << word; | |
984 | else if (word>=10 && word<100) ftxt << " " << word; | |
985 | else if (word>=100 && word<1000) ftxt << " " << word; | |
986 | else if (word>=1000 && word<10000) ftxt << " " << word; | |
987 | else if (word>=10000 && word<100000) ftxt << " " << word; | |
988 | else if (word>=100000 && word<1000000) ftxt << " " << word; | |
989 | else ftxt << " " << word; | |
990 | ftxt << " " << dummyPS << endl; | |
15ec34b9 | 991 | } |
992 | ||
993 | AliBitPacking::PackWord(word,baseWord, 0,20); | |
994 | word = iCH; // TDC channel ID [0;7] | |
995 | AliBitPacking::PackWord(word,baseWord,21,23); | |
996 | word = nTDC; // TDC ID [0;14] | |
997 | AliBitPacking::PackWord(word,baseWord,24,27); | |
998 | word = 0; // error flag | |
999 | AliBitPacking::PackWord(word,baseWord,28,28); | |
1000 | word = dummyPS; // Packing Status [0;3] | |
1001 | AliBitPacking::PackWord(word,baseWord,29,30); | |
1002 | word = 1; // TRM TDC digit ID | |
1003 | AliBitPacking::PackWord(word,baseWord,31,31); | |
1004 | ||
1005 | localIndex++; | |
1006 | localBuffer[localIndex]=baseWord; | |
1007 | psArray[localIndex]=dummyPS; | |
1008 | ||
1009 | nWordsPerTRM++; | |
1010 | baseWord=0; | |
1011 | ||
515faf5d | 1012 | } // if ( fFakeOrphaneProduction && ( ( fPackedAcquisition && percentFilledCells<0.12 && gRandom->Rndm()<(0.12-percentFilledCells) ) or ... ) ) |
15ec34b9 | 1013 | } // if (indexDigit[0]<0) |
1014 | ||
d0eb8f39 | 1015 | for (jj=0; jj<3;jj++) { |
1016 | ||
1017 | if (indexDigit[jj]<0) continue; | |
a403781d | 1018 | |
d0eb8f39 | 1019 | digs = (AliTOFdigit*)fTOFdigitArray->UncheckedAt(indexDigit[jj]); |
1020 | ||
1021 | if (digs->GetSector()!=volume[0] || | |
1022 | digs->GetPlate() !=volume[1] || | |
1023 | digs->GetStrip() !=volume[2] || | |
1024 | digs->GetPadx() !=volume[3] || | |
1025 | digs->GetPadz() !=volume[4]) AliWarning(" --- ERROR --- "); | |
1026 | ||
515faf5d | 1027 | timeOfFlight = (Int_t)(digs->GetTdc())%8192; |
d11fc181 | 1028 | |
515faf5d | 1029 | if (timeOfFlight>fMatchingWindow) continue; |
1030 | ||
a403781d | 1031 | //numberOfMeasuresPerChannel++; |
1032 | ||
515faf5d | 1033 | // totCharge = (Int_t)digs->GetAdc(); //Use realistic ToT, for Standard production with no miscalibration/Slewing it == fAdC in digit (see AliTOFDigitizer) |
1034 | totCharge = (Int_t)(digs->GetToT()); | |
d0eb8f39 | 1035 | // temporary control |
d11fc181 | 1036 | if (totCharge<0) totCharge = 0;//TMath::Abs(totCharge); |
d0eb8f39 | 1037 | |
15ec34b9 | 1038 | if (fPackedAcquisition) { |
1039 | ||
d0eb8f39 | 1040 | if (fVerbose==2) { |
1041 | if (nDDL<10) ftxt << " " << nDDL; | |
1042 | else ftxt << " " << nDDL; | |
1043 | if (nTRM<10) ftxt << " " << nTRM; | |
1044 | else ftxt << " " << nTRM; | |
1045 | ftxt << " " << iChain; | |
1046 | if (nTDC<10) ftxt << " " << nTDC; | |
1047 | else ftxt << " " << nTDC; | |
1048 | ftxt << " " << iCH; | |
1049 | if (volume[0]<10) ftxt << " -> " << volume[0]; | |
1050 | else ftxt << " -> " << volume[0]; | |
1051 | ftxt << " " << volume[1]; | |
1052 | if (volume[2]<10) ftxt << " " << volume[2]; | |
1053 | else ftxt << " " << volume[2]; | |
1054 | ftxt << " " << volume[4]; | |
1055 | if (volume[3]<10) ftxt << " " << volume[3]; | |
1056 | else ftxt << " " << volume[3]; | |
515faf5d | 1057 | if (totCharge<10) ftxt << " " << totCharge; |
1058 | else if (totCharge>=10 && totCharge<100) ftxt << " " << totCharge; | |
1059 | else ftxt << " " << totCharge; | |
1060 | if (timeOfFlight<10) ftxt << " " << timeOfFlight << endl; | |
1061 | else if (timeOfFlight>=10 && timeOfFlight<100) ftxt << " " << timeOfFlight << endl; | |
1062 | else if (timeOfFlight>=100 && timeOfFlight<1000) ftxt << " " << timeOfFlight << endl; | |
1063 | else ftxt << " " << timeOfFlight << endl; | |
d0eb8f39 | 1064 | } |
1065 | ||
515faf5d | 1066 | word = timeOfFlight%8192; // time-of-fligth measurement |
d0eb8f39 | 1067 | AliBitPacking::PackWord(word,baseWord, 0,12); |
1068 | ||
515faf5d | 1069 | if (totCharge>=256) totCharge = 255; |
d0eb8f39 | 1070 | word = totCharge; // time-over-threshould measurement |
1071 | AliBitPacking::PackWord(word,baseWord,13,20); | |
1072 | ||
1073 | word = iCH; // TDC channel ID [0;7] | |
1074 | AliBitPacking::PackWord(word,baseWord,21,23); | |
1075 | word = nTDC; // TDC ID [0;14] | |
1076 | AliBitPacking::PackWord(word,baseWord,24,27); | |
1077 | word = 0; // error flag | |
1078 | AliBitPacking::PackWord(word,baseWord,28,28); | |
15ec34b9 | 1079 | word = 0; // Packing Status [0;3] |
1080 | AliBitPacking::PackWord(word,baseWord,29,30); | |
1081 | word = 1; // TRM TDC digit ID | |
1082 | AliBitPacking::PackWord(word,baseWord,31,31); | |
1083 | ||
1084 | localIndex++; | |
1085 | localBuffer[localIndex]=baseWord; | |
1086 | ||
1087 | nWordsPerTRM++; | |
1088 | baseWord=0; | |
1089 | ||
515faf5d | 1090 | if ( fFakeOrphaneProduction && |
1091 | percentFilledCells<0.12 && gRandom->Rndm()<(0.12-percentFilledCells) ) { | |
15ec34b9 | 1092 | |
1093 | percentFilledCells+=kOneMoreFilledCell; | |
1094 | ||
515faf5d | 1095 | trailingSpurious = Int_t(2097152*gRandom->Rndm()); |
1096 | leadingSpurious = Int_t(2097152*gRandom->Rndm()); | |
15ec34b9 | 1097 | |
1098 | Int_t dummyPS = 0; | |
1099 | ||
515faf5d | 1100 | if (outOut) { |
15ec34b9 | 1101 | word = trailingSpurious; // trailing edge measurement |
1102 | dummyPS = 2; | |
1103 | } | |
1104 | else { | |
1105 | word = leadingSpurious; // leading edge measurement | |
1106 | dummyPS = 1; | |
1107 | } | |
1108 | ||
1109 | if (fVerbose==2) { | |
1110 | if (nDDL<10) ftxt << " " << nDDL; | |
1111 | else ftxt << " " << nDDL; | |
1112 | if (nTRM<10) ftxt << " " << nTRM; | |
1113 | else ftxt << " " << nTRM; | |
1114 | ftxt << " " << iChain; | |
1115 | if (nTDC<10) ftxt << " " << nTDC; | |
1116 | else ftxt << " " << nTDC; | |
1117 | ftxt << " " << iCH; | |
1118 | if (volume[0]<10) ftxt << " -> " << volume[0]; | |
1119 | else ftxt << " -> " << volume[0]; | |
1120 | ftxt << " " << volume[1]; | |
1121 | if (volume[2]<10) ftxt << " " << volume[2]; | |
1122 | else ftxt << " " << volume[2]; | |
1123 | ftxt << " " << volume[4]; | |
1124 | if (volume[3]<10) ftxt << " " << volume[3]; | |
1125 | else ftxt << " " << volume[3]; | |
515faf5d | 1126 | ftxt << " " << -1; |
1127 | if (word<10) ftxt << " " << word; | |
1128 | else if (word>=10 && word<100) ftxt << " " << word; | |
1129 | else if (word>=100 && word<1000) ftxt << " " << word; | |
1130 | else if (word>=1000 && word<10000) ftxt << " " << word; | |
1131 | else if (word>=10000 && word<100000) ftxt << " " << word; | |
1132 | else if (word>=100000 && word<1000000) ftxt << " " << word; | |
1133 | else ftxt << " " << word; | |
1134 | ftxt << " " << dummyPS << endl; | |
15ec34b9 | 1135 | } |
1136 | ||
1137 | AliBitPacking::PackWord(word,baseWord, 0,20); | |
1138 | word = iCH; // TDC channel ID [0;7] | |
1139 | AliBitPacking::PackWord(word,baseWord,21,23); | |
1140 | word = nTDC; // TDC ID [0;14] | |
1141 | AliBitPacking::PackWord(word,baseWord,24,27); | |
1142 | word = 0; // error flag | |
1143 | AliBitPacking::PackWord(word,baseWord,28,28); | |
1144 | word = dummyPS; // Packing Status [0;3] | |
1145 | AliBitPacking::PackWord(word,baseWord,29,30); | |
1146 | word = 1; // TRM TDC digit ID | |
1147 | AliBitPacking::PackWord(word,baseWord,31,31); | |
1148 | ||
1149 | localIndex++; | |
1150 | localBuffer[localIndex]=baseWord; | |
1151 | psArray[localIndex]=dummyPS; | |
1152 | ||
1153 | nWordsPerTRM++; | |
1154 | baseWord=0; | |
1155 | ||
515faf5d | 1156 | } // if ( fFakeOrphaneProduction && percentFilledCells<0.12 && gRandom->Rndm()<(0.12-percentFilledCells) ) |
15ec34b9 | 1157 | |
1158 | ||
1159 | } // if (fPackedAcquisition) | |
1160 | else { // if (!fPackedAcquisition) | |
1161 | ||
515faf5d | 1162 | if ( fFakeOrphaneProduction && |
1163 | percentFilledCells<0.24 && gRandom->Rndm()<(0.24-percentFilledCells) && outOut ) { | |
15ec34b9 | 1164 | |
1165 | percentFilledCells+=kOneMoreFilledCell; | |
1166 | ||
515faf5d | 1167 | trailingSpurious = Int_t(2097152*gRandom->Rndm()); |
15ec34b9 | 1168 | word = trailingSpurious; |
1169 | Int_t dummyPS = 2; | |
1170 | ||
1171 | if (fVerbose==2) { | |
1172 | if (nDDL<10) ftxt << " " << nDDL; | |
1173 | else ftxt << " " << nDDL; | |
1174 | if (nTRM<10) ftxt << " " << nTRM; | |
1175 | else ftxt << " " << nTRM; | |
1176 | ftxt << " " << iChain; | |
1177 | if (nTDC<10) ftxt << " " << nTDC; | |
1178 | else ftxt << " " << nTDC; | |
1179 | ftxt << " " << iCH; | |
1180 | if (volume[0]<10) ftxt << " -> " << volume[0]; | |
1181 | else ftxt << " -> " << volume[0]; | |
1182 | ftxt << " " << volume[1]; | |
1183 | if (volume[2]<10) ftxt << " " << volume[2]; | |
1184 | else ftxt << " " << volume[2]; | |
1185 | ftxt << " " << volume[4]; | |
1186 | if (volume[3]<10) ftxt << " " << volume[3]; | |
1187 | else ftxt << " " << volume[3]; | |
515faf5d | 1188 | ftxt << " " << -1; |
1189 | if (word<10) ftxt << " " << word; | |
1190 | else if (word>=10 && word<100) ftxt << " " << word; | |
1191 | else if (word>=100 && word<1000) ftxt << " " << word; | |
1192 | else if (word>=1000 && word<10000) ftxt << " " << word; | |
1193 | else if (word>=10000 && word<100000) ftxt << " " << word; | |
1194 | else if (word>=100000 && word<1000000) ftxt << " " << word; | |
1195 | else ftxt << " " << word; | |
1196 | ftxt << " " << dummyPS << endl; | |
15ec34b9 | 1197 | } |
1198 | ||
1199 | AliBitPacking::PackWord(word,baseWord, 0,20); | |
1200 | word = iCH; // TDC channel ID [0;7] | |
1201 | AliBitPacking::PackWord(word,baseWord,21,23); | |
1202 | word = nTDC; // TDC ID [0;14] | |
1203 | AliBitPacking::PackWord(word,baseWord,24,27); | |
1204 | word = 0; // error flag | |
1205 | AliBitPacking::PackWord(word,baseWord,28,28); | |
1206 | word = dummyPS; // Packing Status [0;3] | |
1207 | AliBitPacking::PackWord(word,baseWord,29,30); | |
1208 | word = 1; // TRM TDC digit ID | |
1209 | AliBitPacking::PackWord(word,baseWord,31,31); | |
1210 | ||
1211 | localIndex++; | |
1212 | localBuffer[localIndex]=baseWord; | |
1213 | psArray[localIndex]=dummyPS; | |
1214 | ||
1215 | nWordsPerTRM++; | |
1216 | baseWord=0; | |
1217 | ||
515faf5d | 1218 | } // if ( fFakeOrphaneProduction && percentFilledCells<0.24 && gRandom->Rndm()<(0.24-percentFilledCells) && outOut ) |
15ec34b9 | 1219 | |
1220 | ||
515faf5d | 1221 | word = (timeOfFlight + Int_t(totCharge*AliTOFGeometry::ToTBinWidth()/AliTOFGeometry::TdcBinWidth()))%2097152; // trailing edge measurement |
15ec34b9 | 1222 | |
1223 | if (fVerbose==2) { | |
1224 | if (nDDL<10) ftxt << " " << nDDL; | |
1225 | else ftxt << " " << nDDL; | |
1226 | if (nTRM<10) ftxt << " " << nTRM; | |
1227 | else ftxt << " " << nTRM; | |
1228 | ftxt << " " << iChain; | |
1229 | if (nTDC<10) ftxt << " " << nTDC; | |
1230 | else ftxt << " " << nTDC; | |
1231 | ftxt << " " << iCH; | |
1232 | if (volume[0]<10) ftxt << " -> " << volume[0]; | |
1233 | else ftxt << " -> " << volume[0]; | |
1234 | ftxt << " " << volume[1]; | |
1235 | if (volume[2]<10) ftxt << " " << volume[2]; | |
1236 | else ftxt << " " << volume[2]; | |
1237 | ftxt << " " << volume[4]; | |
1238 | if (volume[3]<10) ftxt << " " << volume[3]; | |
1239 | else ftxt << " " << volume[3]; | |
515faf5d | 1240 | ftxt << " " << -1; |
1241 | if (word<10) ftxt << " " << word; | |
1242 | else if (word>=10 && word<100) ftxt << " " << word; | |
1243 | else if (word>=100 && word<1000) ftxt << " " << word; | |
1244 | else if (word>=1000 && word<10000) ftxt << " " << word; | |
1245 | else if (word>=10000 && word<100000) ftxt << " " << word; | |
1246 | else if (word>=100000 && word<1000000) ftxt << " " << word; | |
1247 | else ftxt << " " << word; | |
1248 | ftxt << " " << 2 << endl; | |
15ec34b9 | 1249 | } |
1250 | ||
1251 | AliBitPacking::PackWord(word,baseWord, 0,20); | |
1252 | ||
1253 | word = iCH; // TDC channel ID [0;7] | |
1254 | AliBitPacking::PackWord(word,baseWord,21,23); | |
1255 | word = nTDC; // TDC ID [0;14] | |
1256 | AliBitPacking::PackWord(word,baseWord,24,27); | |
1257 | word = 0; // error flag | |
1258 | AliBitPacking::PackWord(word,baseWord,28,28); | |
1259 | word = 2; // Packing Status [0;3] | |
d0eb8f39 | 1260 | AliBitPacking::PackWord(word,baseWord,29,30); |
1261 | word = 1; // TRM TDC digit ID | |
1262 | AliBitPacking::PackWord(word,baseWord,31,31); | |
15ec34b9 | 1263 | |
1264 | localIndex++; | |
1265 | localBuffer[localIndex]=baseWord; | |
1266 | psArray[localIndex]=2; | |
d0eb8f39 | 1267 | |
1268 | nWordsPerTRM++; | |
1269 | baseWord=0; | |
1270 | ||
515faf5d | 1271 | word = timeOfFlight%2097152; // leading edge measurement |
15ec34b9 | 1272 | |
1273 | if (fVerbose==2) { | |
1274 | if (nDDL<10) ftxt << " " << nDDL; | |
1275 | else ftxt << " " << nDDL; | |
1276 | if (nTRM<10) ftxt << " " << nTRM; | |
1277 | else ftxt << " " << nTRM; | |
1278 | ftxt << " " << iChain; | |
1279 | if (nTDC<10) ftxt << " " << nTDC; | |
1280 | else ftxt << " " << nTDC; | |
1281 | ftxt << " " << iCH; | |
1282 | if (volume[0]<10) ftxt << " -> " << volume[0]; | |
1283 | else ftxt << " -> " << volume[0]; | |
1284 | ftxt << " " << volume[1]; | |
1285 | if (volume[2]<10) ftxt << " " << volume[2]; | |
1286 | else ftxt << " " << volume[2]; | |
1287 | ftxt << " " << volume[4]; | |
1288 | if (volume[3]<10) ftxt << " " << volume[3]; | |
1289 | else ftxt << " " << volume[3]; | |
515faf5d | 1290 | ftxt << " " << -1; |
1291 | if (word<10) ftxt << " " << word; | |
1292 | else if (word>=10 && word<100) ftxt << " " << word; | |
1293 | else if (word>=100 && word<1000) ftxt << " " << word; | |
1294 | else if (word>=1000 && word<10000) ftxt << " " << word; | |
1295 | else if (word>=10000 && word<100000) ftxt << " " << word; | |
1296 | else if (word>=100000 && word<1000000) ftxt << " " << word; | |
1297 | else ftxt << " " << word; | |
1298 | ftxt << " " << 1 << endl; | |
15ec34b9 | 1299 | } |
1300 | ||
1301 | AliBitPacking::PackWord(word,baseWord, 0,20); | |
1302 | ||
1303 | word = iCH; // TDC channel ID [0;7] | |
1304 | AliBitPacking::PackWord(word,baseWord,21,23); | |
1305 | word = nTDC; // TDC ID [0;14] | |
1306 | AliBitPacking::PackWord(word,baseWord,24,27); | |
1307 | word = 0; // error flag | |
1308 | AliBitPacking::PackWord(word,baseWord,28,28); | |
1309 | word = 1; // Packing Status [0;3] | |
1310 | AliBitPacking::PackWord(word,baseWord,29,30); | |
1311 | word = 1; // TRM TDC digit ID | |
1312 | AliBitPacking::PackWord(word,baseWord,31,31); | |
1313 | ||
1314 | localIndex++; | |
1315 | localBuffer[localIndex]=baseWord; | |
1316 | psArray[localIndex]=1; | |
1317 | ||
1318 | nWordsPerTRM++; | |
1319 | baseWord=0; | |
1320 | ||
1321 | ||
515faf5d | 1322 | if ( fFakeOrphaneProduction && |
1323 | percentFilledCells<0.24 && gRandom->Rndm()<(0.24-percentFilledCells) && !outOut ) { | |
15ec34b9 | 1324 | |
1325 | percentFilledCells+=kOneMoreFilledCell; | |
1326 | ||
515faf5d | 1327 | leadingSpurious = Int_t(2097152*gRandom->Rndm()); |
15ec34b9 | 1328 | word = leadingSpurious; |
1329 | Int_t dummyPS = 1; | |
1330 | ||
1331 | if (fVerbose==2) { | |
1332 | if (nDDL<10) ftxt << " " << nDDL; | |
1333 | else ftxt << " " << nDDL; | |
1334 | if (nTRM<10) ftxt << " " << nTRM; | |
1335 | else ftxt << " " << nTRM; | |
1336 | ftxt << " " << iChain; | |
1337 | if (nTDC<10) ftxt << " " << nTDC; | |
1338 | else ftxt << " " << nTDC; | |
1339 | ftxt << " " << iCH; | |
1340 | if (volume[0]<10) ftxt << " -> " << volume[0]; | |
1341 | else ftxt << " -> " << volume[0]; | |
1342 | ftxt << " " << volume[1]; | |
1343 | if (volume[2]<10) ftxt << " " << volume[2]; | |
1344 | else ftxt << " " << volume[2]; | |
1345 | ftxt << " " << volume[4]; | |
1346 | if (volume[3]<10) ftxt << " " << volume[3]; | |
1347 | else ftxt << " " << volume[3]; | |
515faf5d | 1348 | ftxt << " " << -1; |
1349 | if (word<10) ftxt << " " << word; | |
1350 | else if (word>=10 && word<100) ftxt << " " << word; | |
1351 | else if (word>=100 && word<1000) ftxt << " " << word; | |
1352 | else if (word>=1000 && word<10000) ftxt << " " << word; | |
1353 | else if (word>=10000 && word<100000) ftxt << " " << word; | |
1354 | else if (word>=100000 && word<1000000) ftxt << " " << word; | |
1355 | else ftxt << " " << word; | |
1356 | ftxt << " " << dummyPS << endl; | |
15ec34b9 | 1357 | } |
1358 | ||
1359 | AliBitPacking::PackWord(word,baseWord, 0,20); | |
1360 | word = iCH; // TDC channel ID [0;7] | |
1361 | AliBitPacking::PackWord(word,baseWord,21,23); | |
1362 | word = nTDC; // TDC ID [0;14] | |
1363 | AliBitPacking::PackWord(word,baseWord,24,27); | |
1364 | word = 0; // error flag | |
1365 | AliBitPacking::PackWord(word,baseWord,28,28); | |
1366 | word = dummyPS; // Packing Status [0;3] | |
1367 | AliBitPacking::PackWord(word,baseWord,29,30); | |
1368 | word = 1; // TRM TDC digit ID | |
1369 | AliBitPacking::PackWord(word,baseWord,31,31); | |
1370 | ||
1371 | localIndex++; | |
1372 | localBuffer[localIndex]=baseWord; | |
1373 | psArray[localIndex]=dummyPS; | |
1374 | ||
1375 | nWordsPerTRM++; | |
1376 | baseWord=0; | |
1377 | ||
515faf5d | 1378 | } // if ( fFakeOrphaneProduction && percentFilledCells<0.24 && gRandom->Rndm()<(0.24-percentFilledCells) && !outOut ) |
15ec34b9 | 1379 | |
1380 | ||
1381 | } // if (!fPackedAcquisition) | |
1382 | ||
d0eb8f39 | 1383 | } //end loop on digits in the same volume |
1384 | ||
a403781d | 1385 | //if (numberOfMeasuresPerChannel>maxMeasuresPerChannelInTDC) |
1386 | //maxMeasuresPerChannelInTDC = numberOfMeasuresPerChannel; | |
1387 | ||
d0eb8f39 | 1388 | } // end loop on TDC channel number |
1389 | ||
a403781d | 1390 | //AliInfo(Form(" TDC number %2i: numberOfMeasuresPerChannel = %2i --- maxMeasuresPerChannelInTDC = %2i ", nTDC, numberOfMeasuresPerChannel, maxMeasuresPerChannelInTDC)); |
1391 | ||
515faf5d | 1392 | if (localIndex==-1) continue; |
15ec34b9 | 1393 | |
515faf5d | 1394 | if (fPackedAcquisition) { |
15ec34b9 | 1395 | |
515faf5d | 1396 | for (Int_t jj=0; jj<=localIndex; jj++) { |
15ec34b9 | 1397 | fIndex++; |
1398 | buf[fIndex] = localBuffer[jj]; | |
515faf5d | 1399 | localBuffer[jj] = 0; |
1400 | psArray[jj] = -1; | |
15ec34b9 | 1401 | } |
515faf5d | 1402 | |
15ec34b9 | 1403 | } |
515faf5d | 1404 | else { |
a403781d | 1405 | /* |
515faf5d | 1406 | if (maxMeasuresPerChannelInTDC = 1) { |
1407 | ||
1408 | for (Int_t jj=0; jj<=localIndex; jj++) { | |
1409 | if (psArray[jj]==2) { | |
1410 | fIndex++; | |
1411 | buf[fIndex] = localBuffer[jj]; | |
1412 | localBuffer[jj] = 0; | |
1413 | psArray[jj] = -1; | |
1414 | } | |
1415 | } | |
1416 | for (Int_t jj=0; jj<=localIndex; jj++) { | |
1417 | if (psArray[jj]==1) { | |
1418 | fIndex++; | |
1419 | buf[fIndex] = localBuffer[jj]; | |
1420 | localBuffer[jj] = 0; | |
1421 | psArray[jj] = -1; | |
1422 | } | |
1423 | } | |
1424 | ||
1425 | } // if (maxMeasuresPerChannelInTDC = 1) | |
1426 | else if (maxMeasuresPerChannelInTDC>1) { | |
1427 | ||
a403781d | 1428 | AliInfo(Form(" In the TOF DDL %2i, TRM %2i, TDC %2i, chain %1i, the maximum number of t.o.f. good measurements per channel is %2i", |
515faf5d | 1429 | nDDL, nTRM, iChain, nTDC, iCH, maxMeasuresPerChannelInTDC)); |
a403781d | 1430 | */ |
515faf5d | 1431 | for (Int_t jj=0; jj<=localIndex; jj++) { |
1432 | fIndex++; | |
1433 | buf[fIndex] = localBuffer[jj]; | |
1434 | localBuffer[jj] = 0; | |
1435 | psArray[jj] = -1; | |
1436 | } | |
1437 | ||
a403781d | 1438 | //} // else if (maxMeasuresPerChannelInTDC>1) |
515faf5d | 1439 | |
1440 | } // else (!fPackedAcquisition) | |
1441 | ||
1442 | localIndex = -1; | |
1443 | ||
a403781d | 1444 | //maxMeasuresPerChannelInTDC = 0; |
1445 | ||
515faf5d | 1446 | } // end loop on TDC number |
15ec34b9 | 1447 | |
d0eb8f39 | 1448 | |
1449 | if (fVerbose==2) ftxt.close(); | |
1450 | ||
1451 | } | |
1452 | ||
1453 | //---------------------------------------------------------------------------- | |
1454 | void AliTOFDDLRawData::ReverseArray(UInt_t a[], Int_t n) const | |
1455 | { | |
1456 | // | |
1457 | // Reverses the n elements of array a | |
1458 | // | |
1459 | ||
1460 | Int_t ii, temp; | |
1461 | ||
1462 | for (ii=0; ii<n/2; ii++) { | |
1463 | temp = a[ii]; | |
1464 | a[ii] = a[n-ii-1]; | |
1465 | a[n-ii-1] = temp; | |
1466 | } | |
1467 | ||
1468 | return; | |
1469 | ||
1470 | } | |
15ec34b9 | 1471 | |
1472 | //---------------------------------------------------------------------------- | |
1473 | Bool_t AliTOFDDLRawData::HeadOrTail() const | |
1474 | { | |
1475 | // | |
1476 | // Returns the result of a 'pitch and toss' | |
1477 | // | |
1478 | ||
1479 | Double_t dummy = gRandom->Rndm(); | |
1480 | ||
1481 | if (dummy<0.5) return kFALSE; | |
1482 | else return kTRUE; | |
1483 | ||
1484 | } |