]>
Commit | Line | Data |
---|---|---|
dc7ca31d | 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 | /* $Id$ */ | |
17 | ||
18 | /////////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // T0 raw data conversion class // | |
21 | // // | |
22 | /////////////////////////////////////////////////////////////////////////////// | |
23 | ||
94249139 | 24 | //#include <Riostream.h> |
25 | //#include <TTree.h> | |
29d3e0eb | 26 | #include <TMap.h> |
dc7ca31d | 27 | #include "AliT0.h" |
28 | #include "AliT0RawData.h" | |
29 | #include "AliT0digit.h" | |
30 | #include "AliBitPacking.h" | |
31 | #include "AliRawDataHeader.h" | |
32 | #include "AliRawDataHeaderSim.h" | |
33 | #include "AliBitPacking.h" | |
34 | #include "AliFstream.h" | |
35 | #include "AliRunLoader.h" | |
c41ceaac | 36 | #include "AliDAQ.h" |
29d3e0eb | 37 | #include "AliT0LookUpValue.h" |
94249139 | 38 | #include "AliT0LookUpKey.h" |
dc7ca31d | 39 | |
cdf48647 | 40 | using std::cout; |
41 | using std::endl; | |
dc7ca31d | 42 | ClassImp(AliT0RawData) |
43 | ||
44 | //_____________________________________________________________________________ | |
c41ceaac | 45 | AliT0RawData::AliT0RawData():TObject(), |
29d3e0eb | 46 | fVerbose(0), |
47 | fIndex(-1) , | |
48 | fEventNumber(0), | |
49 | fTimeCFD(new TArrayI(24)), | |
50 | fADC1( new TArrayI(24)), | |
51 | fTimeLED( new TArrayI(24)), | |
52 | fADC0( new TArrayI(24)), | |
53 | fFile(0x0), | |
54 | fDataHeaderPos(0), | |
55 | fDRMDataHeaderPos(0), | |
56 | fTRMDataHeaderPos(0), | |
29d3e0eb | 57 | fParam(0), |
58 | fLookUp(0) | |
59 | ||
c41ceaac | 60 | |
dc7ca31d | 61 | { |
62 | /* | |
63 | - 48 channels (2 words each as in TOF DDL) for : | |
64 | word 1 :0-5bit number of PMT; word 2: 0-7 error sign, 8-31 TDC | |
65 | and the same but for amplified signal. Now I wrote the same time because | |
66 | CDF are not ready and differences didn't measured yet. | |
67 | ||
68 | - 48 channel for amplitude: very preliminary, QTC features are not | |
69 | known now, preliminary i put as T1 time signal for this PMT in first | |
70 | channel and T1+A in second, where A=Log(Amplitude); | |
71 | and the same for amplified but A=Log(10*Amplitude). | |
72 | ||
73 | - T0-A and T0-C 2 channels | |
74 | - T0A-T0C vertex information | |
75 | - Time Meaner where T0C TOF increase to the T0A TOF distance | |
76 | - 6 multiplicity signals the same way as amplitude and with the same | |
77 | uncertances | |
78 | */ | |
79 | ||
dc7ca31d | 80 | //open the output file |
3611bfe6 | 81 | // char fileName[15]; |
82 | // strcpy(fileName,AliDAQ::DdlFileName("T0",0)); //The name of the output file | |
83 | TString fileName = Form("%s",AliDAQ::DdlFileName("T0",0)); | |
84 | fFile = new AliFstream(fileName.Data()); | |
c41ceaac | 85 | memset(fBuffer,0,512*sizeof(UInt_t)); |
86 | ||
dc7ca31d | 87 | //get event number |
33c3c91a | 88 | AliRunLoader *runloader = AliRunLoader::Instance(); |
dc7ca31d | 89 | if (runloader) { |
90 | fEventNumber = runloader->GetEventNumber(); | |
91 | } | |
29d3e0eb | 92 | |
93 | // Inverse lookup table for simulation | |
94 | ||
95 | fParam = AliT0Parameters::Instance(); | |
96 | fParam->Init(); | |
36cde487 | 97 | AliT0LookUpKey* lookkey;//= new AliT0LookUpKey(); |
98 | AliT0LookUpValue* lookvalue;//= new AliT0LookUpValue(); | |
29d3e0eb | 99 | TMap *lookup = fParam->GetMapLookup(); |
69776907 | 100 | TMapIter iter(lookup); |
29d3e0eb | 101 | |
102 | for( Int_t iline=0; iline<106; iline++) | |
103 | { | |
69776907 | 104 | lookvalue = ( AliT0LookUpValue*) iter.Next(); |
256d4943 | 105 | lookkey = (AliT0LookUpKey*) lookup->GetValue(lookvalue); |
106 | fLookUp.Add(lookkey, lookvalue); | |
36cde487 | 107 | //lookkey= new AliT0LookUpKey(); |
108 | //lookvalue= new AliT0LookUpValue(); | |
29d3e0eb | 109 | } |
256d4943 | 110 | |
dc7ca31d | 111 | } |
112 | ||
113 | //_____________________________________________________________________________ | |
c41ceaac | 114 | |
115 | AliT0RawData::AliT0RawData(const AliT0RawData &r):TObject(), | |
29d3e0eb | 116 | fVerbose(0), |
117 | fIndex(-1) , | |
118 | fEventNumber(0), | |
119 | fTimeCFD(new TArrayI(24)), | |
120 | fADC1( new TArrayI(24)), | |
121 | fTimeLED( new TArrayI(24)), | |
122 | fADC0( new TArrayI(24)), | |
123 | fFile(0x0), | |
124 | fDataHeaderPos(0), | |
125 | fDRMDataHeaderPos(0), | |
126 | fTRMDataHeaderPos(0), | |
29d3e0eb | 127 | fParam(0), |
128 | fLookUp(0) | |
c41ceaac | 129 | |
dc7ca31d | 130 | { |
131 | // | |
132 | // AliT0rawData copy constructor | |
133 | // | |
134 | ||
135 | ((AliT0RawData &) r).Copy(*this); | |
136 | ||
137 | } | |
138 | ||
139 | //_____________________________________________________________________________ | |
140 | AliT0RawData::~AliT0RawData() | |
141 | { | |
142 | // | |
143 | // Destructor | |
144 | // | |
dc7ca31d | 145 | delete fTimeCFD; |
146 | delete fADC1; | |
147 | delete fTimeLED; | |
148 | delete fADC0; | |
8ab584c1 | 149 | delete fFile; |
dc7ca31d | 150 | } |
151 | ||
152 | //_____________________________________________________________________________ | |
153 | AliT0RawData &AliT0RawData::operator=(const AliT0RawData &r) | |
154 | { | |
155 | // | |
156 | // Assignment operator | |
157 | // | |
158 | ||
159 | if (this != &r) ((AliT0RawData &) r).Copy(*this); | |
160 | return *this; | |
161 | ||
162 | } | |
163 | ||
164 | //_____________________________________________________________________________ | |
165 | void AliT0RawData::GetDigits(AliT0digit *fDigits) | |
5bf55199 | 166 | //void AliT0RawData::GetDigits(fDigits) |
dc7ca31d | 167 | { |
168 | ||
169 | //This method packs the T0 digits in a proper 32 bits structure | |
170 | ||
171 | //read T0 digits and fill TDC and ADC arrays | |
172 | ||
173 | ||
174 | // Int_t error=0; | |
175 | Int_t time, positionOfTRMHeader; | |
088c40b6 | 176 | |
177 | // Get the digits array | |
178 | ||
c41ceaac | 179 | fDigits->GetTimeCFD(*fTimeCFD); |
180 | fDigits->GetQT0(*fADC1); | |
181 | fDigits->GetTimeLED(*fTimeLED); | |
182 | fDigits->GetQT1(*fADC0); | |
dc7ca31d | 183 | Int_t meantime = fDigits->MeanTime(); |
184 | Int_t timediff = fDigits->TimeDiff(); | |
185 | Int_t mult0=fDigits->SumMult(); | |
186 | Int_t mult1=fDigits->SumMult(); | |
c41ceaac | 187 | Int_t timeA = fDigits->BestTimeC(); |
188 | Int_t timeC = fDigits->BestTimeA(); | |
088c40b6 | 189 | |
190 | ||
d0bcd1fb | 191 | // TArrayI *allData = new TArrayI(110); |
192 | Int_t allData[110][1]; | |
193 | for (Int_t i=0; i<110; i++) allData[i][0] = 0; | |
194 | ||
195 | allData[0][0]=0; | |
196 | for (Int_t i=1; i<13; i++) { | |
197 | allData[i][0] = fTimeCFD->At(i-1); | |
198 | allData[i+12][0] = fTimeLED->At(i-1); | |
199 | allData[i+56][0] = fTimeCFD->At(i-1+12); | |
200 | allData[i+68][0] = fTimeLED->At(i-1+12); | |
201 | } | |
202 | ||
203 | for (Int_t iii=0; iii<12; iii++) { | |
204 | allData[2*iii+25][0] = fADC1->At(iii); | |
205 | allData[2*iii+26][0] = fADC0->At(iii); | |
dc7ca31d | 206 | } |
d0bcd1fb | 207 | for (Int_t ii=12; ii<24; ii++) { |
208 | allData[2*ii+57][0] = fADC1->At(ii); | |
209 | allData[2*ii+58][0] = fADC0->At(ii); | |
210 | } | |
211 | ||
212 | allData[49][0] = meantime; | |
213 | allData[50][0] = timediff; | |
214 | allData[51][0] = timeA; | |
215 | allData[52][0] = timeC; | |
216 | allData[53][0] = mult0; | |
217 | allData[54][0] = mult1; | |
218 | allData[55][0] = mult0; | |
219 | allData[56][0] = mult1; | |
220 | ||
221 | // cout.setf( ios_base::hex, ios_base::basefield ); | |
dc7ca31d | 222 | //space for DRM header |
5325480c | 223 | fIndex += 6; |
dc7ca31d | 224 | |
29d3e0eb | 225 | |
5325480c | 226 | Int_t startTRM=fIndex; |
dc7ca31d | 227 | //space for 1st TRM header |
228 | fIndex ++; | |
229 | positionOfTRMHeader= fIndex; | |
dc7ca31d | 230 | //space for chain header |
231 | fIndex ++; | |
d8079a1a | 232 | WriteChainDataHeader(1, 1); // |
233 | ||
234 | // fIndex++; | |
dc7ca31d | 235 | // Loop through all PMT |
236 | Int_t chain=0; | |
237 | Int_t iTDC = 0; | |
238 | Int_t channel=0; | |
239 | Int_t trm1words=0; | |
d8079a1a | 240 | Int_t itrm=7; |
241 | Int_t inside =0; | |
53111f83 | 242 | Int_t isData = 0; |
256d4943 | 243 | AliT0LookUpKey * lookkey = new AliT0LookUpKey(); |
244 | AliT0LookUpValue * lookvalue ;//= new AliT0LookUpValue(trm,tdc,chain,channel); | |
29d3e0eb | 245 | for (Int_t det = 0; det < 105; det++) { |
d0bcd1fb | 246 | time = allData[det][0]; |
21bbda77 | 247 | if (time >0 && time !=99999) { |
29d3e0eb | 248 | lookkey->SetKey(det); |
249 | lookvalue = (AliT0LookUpValue*) fLookUp.GetValue((TObject*)lookkey); | |
250 | if (lookvalue ) | |
251 | { | |
53111f83 | 252 | isData++; |
29d3e0eb | 253 | itrm= lookvalue->GetTRM(); |
d0bcd1fb | 254 | if (det >56 &&inside == 0) { |
29d3e0eb | 255 | WriteChainDataTrailer(1); // 1st chain trailer |
256 | fIndex++; | |
d8079a1a | 257 | WriteChainDataHeader(2, 1); |
258 | // fIndex++; | |
259 | inside++; | |
29d3e0eb | 260 | } |
261 | chain = lookvalue->GetChain(); | |
262 | iTDC = lookvalue->GetTDC(); | |
263 | channel = lookvalue->GetChannel(); | |
29d3e0eb | 264 | FillTime(channel, iTDC, time); |
d0bcd1fb | 265 | AliDebug(1,Form("look %i itrm %i , chain %i , iTDC %i, channel %i time %i", det,itrm,chain,iTDC,channel, time)); |
29d3e0eb | 266 | } |
267 | else | |
268 | { | |
269 | cout<<" no lookup value for key "<<det<<endl; | |
270 | // break; | |
271 | } | |
dc7ca31d | 272 | } |
29d3e0eb | 273 | |
dc7ca31d | 274 | } |
53111f83 | 275 | if (inside==0) { |
276 | WriteChainDataTrailer(1); // 1st chain trailer | |
277 | fIndex++; | |
278 | WriteChainDataHeader(2, 1); | |
279 | } | |
d8079a1a | 280 | // WriteChainDataHeader(2, 1); // |
5325480c | 281 | WriteChainDataTrailer(3); // 2st chain trailer |
dc7ca31d | 282 | WriteTrailer(15,0,fEventNumber,5); // 1st TRM trailer |
29d3e0eb | 283 | |
284 | ||
256d4943 | 285 | trm1words = fIndex - startTRM; |
dc7ca31d | 286 | //space for 2st TRM header |
29d3e0eb | 287 | |
d8079a1a | 288 | WriteTRMDataHeader(itrm, trm1words , positionOfTRMHeader); |
29d3e0eb | 289 | |
290 | //DRM trailer | |
d8079a1a | 291 | WriteTrailer(1,0,fEventNumber,5); |
5325480c | 292 | |
293 | WriteDRMDataHeader(); | |
29d3e0eb | 294 | |
dc7ca31d | 295 | } |
dc7ca31d | 296 | |
297 | //_____________________________________________________________________________ | |
298 | ||
299 | void AliT0RawData::WriteDRMDataHeader() | |
300 | { | |
301 | //Write a (dummy or real) DDL DRM data header, | |
302 | //set the compression bit if compressed | |
303 | // UInt_t drmheader[4]; | |
304 | UInt_t word; | |
305 | UInt_t baseWord=0; | |
306 | //fill DRM headers | |
307 | //DRM Global Header | |
308 | word = 1; | |
62b80e9d | 309 | AliBitPacking::PackWord(word,baseWord,0, 3); // 0001 |
dc7ca31d | 310 | word = fIndex ; |
311 | ||
62b80e9d | 312 | AliBitPacking::PackWord(word,baseWord,4, 20); // event words |
dc7ca31d | 313 | word=124; |
62b80e9d | 314 | AliBitPacking::PackWord(word,baseWord, 21, 27); // event words |
dc7ca31d | 315 | word=4; |
62b80e9d | 316 | AliBitPacking::PackWord(word,baseWord,28, 31);// 0100 marks header |
dc7ca31d | 317 | fBuffer[0]= baseWord; |
318 | ||
5325480c | 319 | |
dc7ca31d | 320 | //DRM status header 1 |
321 | word = 1; | |
62b80e9d | 322 | AliBitPacking::PackWord(word,baseWord,0, 3); // 0001 |
dc7ca31d | 323 | word = 1; |
62b80e9d | 324 | AliBitPacking::PackWord(word,baseWord,4, 14); // slotID now 0000000001 |
dc7ca31d | 325 | word = 1; |
62b80e9d | 326 | AliBitPacking::PackWord(word,baseWord,15, 15); //if 1 LHC clock is coorectly recieved from CPDM |
dc7ca31d | 327 | word=0; |
62b80e9d | 328 | AliBitPacking::PackWord(word,baseWord,16,27); // reserve for future use |
dc7ca31d | 329 | word=4; |
62b80e9d | 330 | AliBitPacking::PackWord(word,baseWord,28,31); // 0100 marks header |
331 | fBuffer[1] = baseWord; | |
332 | ||
5325480c | 333 | word=0; |
334 | baseWord=0; | |
62b80e9d | 335 | |
336 | //DRM status header 2 | |
337 | word = 1; | |
338 | AliBitPacking::PackWord(word,baseWord, 0, 3); // 0001 | |
339 | word = 3; | |
340 | AliBitPacking::PackWord(word,baseWord, 4, 14); //enable slotID now 00000000011 | |
341 | word = 0; | |
342 | AliBitPacking::PackWord(word,baseWord, 15, 15); // something | |
343 | word=0; | |
344 | AliBitPacking::PackWord(word,baseWord, 16, 27); // fault ID for simulation 0 | |
345 | word=4; | |
346 | AliBitPacking::PackWord(word,baseWord,28,31); // 0100 marks header | |
347 | fBuffer[2]= baseWord; | |
348 | ||
349 | word=0; | |
350 | baseWord=0; | |
351 | //DRM status header 3 | |
352 | word = 1; | |
353 | AliBitPacking::PackWord(word,baseWord,0, 3); // 0001 | |
dc7ca31d | 354 | word = 0; |
62b80e9d | 355 | AliBitPacking::PackWord(word,baseWord,4, 27); // TTC event counter |
dc7ca31d | 356 | word=4; |
62b80e9d | 357 | AliBitPacking::PackWord(word,baseWord,28,31); // 0100 marks header |
dc7ca31d | 358 | fBuffer[3]= baseWord; |
359 | ||
5325480c | 360 | // new DRM format |
361 | fBuffer[4]= baseWord; | |
362 | fBuffer[5]= baseWord; | |
62b80e9d | 363 | |
dc7ca31d | 364 | word=0; |
365 | baseWord=0; | |
366 | ||
367 | } | |
368 | ||
369 | //_____________________________________________________________________________ | |
370 | ||
371 | void AliT0RawData::WriteTRMDataHeader(UInt_t slotID, Int_t nWordsInTRM, | |
372 | Int_t positionOfTRMHeader) | |
373 | { | |
374 | //Write a (dummy or real) DDL TRM data header, | |
375 | //set the compression bit if compressed | |
376 | // UInt_t trmheader; | |
377 | UInt_t word; | |
378 | UInt_t baseWord=0; | |
379 | //fill TRM headers | |
380 | //TRM Global Header | |
381 | word = slotID; | |
62b80e9d | 382 | AliBitPacking::PackWord(word,baseWord,0, 3); // slotID |
dc7ca31d | 383 | word = nWordsInTRM; |
384 | //+this word - DRM header | |
385 | ||
62b80e9d | 386 | AliBitPacking::PackWord(word,baseWord,4, 16); // event words |
dc7ca31d | 387 | word=0; |
62b80e9d | 388 | AliBitPacking::PackWord(word,baseWord,17,18); // ACQ |
dc7ca31d | 389 | word=0; |
62b80e9d | 390 | AliBitPacking::PackWord(word,baseWord,19,19); // L SEY inside LUT |
dc7ca31d | 391 | word=0; |
62b80e9d | 392 | AliBitPacking::PackWord(word,baseWord,20,27); // MBZ |
dc7ca31d | 393 | word=4; |
62b80e9d | 394 | AliBitPacking::PackWord(word,baseWord,28,31); // 0100 marks header |
dc7ca31d | 395 | fBuffer[positionOfTRMHeader] = baseWord; |
62b80e9d | 396 | |
dc7ca31d | 397 | word=0; |
398 | baseWord=0; | |
399 | ||
400 | } | |
401 | ||
402 | //_____________________________________________________________________________ | |
403 | ||
404 | void AliT0RawData::WriteChainDataHeader(UInt_t chainNumber,UInt_t slotID) | |
405 | { | |
406 | //Write a (dummy or real) DDL Chain data header, | |
407 | //set the compression bit if compressed | |
408 | // chainNumber 00 or 10 | |
409 | UInt_t word; | |
410 | UInt_t baseWord=0; | |
411 | //fill TRM headers | |
412 | //TRM Global Header | |
413 | word = slotID; // ask Tatiana 7 or 9 | |
62b80e9d | 414 | AliBitPacking::PackWord(word,baseWord,0, 3); // slotID |
dc7ca31d | 415 | word = 0; |
62b80e9d | 416 | AliBitPacking::PackWord(word,baseWord,4, 15); // bunchID |
dc7ca31d | 417 | word=0; |
62b80e9d | 418 | AliBitPacking::PackWord(word,baseWord,16,23); // PB24 temperature |
dc7ca31d | 419 | word=0; |
62b80e9d | 420 | AliBitPacking::PackWord(word,baseWord,24,26); // PB24 ID |
dc7ca31d | 421 | word=0; |
62b80e9d | 422 | AliBitPacking::PackWord(word,baseWord,27,27); // TS |
dc7ca31d | 423 | word=chainNumber; |
62b80e9d | 424 | AliBitPacking::PackWord(word,baseWord,28,31); // 0100 marks header |
5325480c | 425 | fBuffer[fIndex] = baseWord; |
d8079a1a | 426 | //cout<<" chain header "<<baseWord<<" number "<<chainNumber<<endl; |
5325480c | 427 | word=0; |
428 | baseWord=0; | |
429 | ||
430 | } | |
431 | //_____________________________________________________________________________ | |
432 | ||
433 | void AliT0RawData::WriteChainDataTrailer(UInt_t chainNumber ) | |
434 | { | |
435 | //Write a (dummy or real) DDL Chain data trailer | |
436 | //set the compression bit if compressed | |
437 | // chainNumber 00 or 10 | |
438 | UInt_t word; | |
439 | UInt_t baseWord=0; | |
440 | word = 0; // ask Tatiana 7 or 9 | |
62b80e9d | 441 | AliBitPacking::PackWord(word,baseWord,0, 3); // status |
5325480c | 442 | word = 0; |
62b80e9d | 443 | AliBitPacking::PackWord(word,baseWord,4, 15); // MBZ |
5325480c | 444 | word=fEventNumber; |
62b80e9d | 445 | AliBitPacking::PackWord(word,baseWord,16,27); // event counter |
5325480c | 446 | word=chainNumber; |
62b80e9d | 447 | AliBitPacking::PackWord(word,baseWord,28,31); // chain number |
5325480c | 448 | fIndex++; |
449 | fBuffer[fIndex] = baseWord; | |
62b80e9d | 450 | |
dc7ca31d | 451 | word=0; |
452 | baseWord=0; | |
453 | ||
454 | } | |
455 | //_____________________________________________________________________________ | |
456 | ||
457 | void AliT0RawData::WriteDataHeader(Bool_t dummy, Bool_t compressed) | |
458 | { | |
459 | //Write a (dummy or real) DDL data header, | |
460 | //set the compression bit if compressed | |
461 | ||
462 | AliRawDataHeaderSim header; | |
463 | ||
464 | if (dummy) { | |
465 | //if size=0 it means that this data header is a dummy data header | |
466 | fDataHeaderPos = fFile->Tellp(); | |
467 | fFile->WriteBuffer((char*)(&header), sizeof(header)); | |
468 | } else { | |
469 | UInt_t currentFilePos = fFile->Tellp(); | |
470 | fFile->Seekp(fDataHeaderPos); | |
471 | header.fSize = currentFilePos-fDataHeaderPos; | |
472 | header.SetAttribute(0); // valid data | |
473 | if (compressed) header.SetAttribute(1); | |
474 | fFile->WriteBuffer((char*)(&header), sizeof(header)); | |
475 | fFile->Seekp(currentFilePos); | |
476 | } | |
477 | ||
478 | } | |
479 | ||
480 | //___ __________________________________________________________________________ | |
481 | ||
482 | ||
483 | void AliT0RawData::WriteTrailer(UInt_t slot, Int_t word1, UInt_t word2, UInt_t word3) | |
484 | { | |
94249139 | 485 | //Write a (dummy or real) DDL Chain data trailer |
dc7ca31d | 486 | |
487 | UInt_t word; | |
488 | UInt_t baseWord=0; | |
489 | word = slot; | |
62b80e9d | 490 | AliBitPacking::PackWord(word,baseWord,0, 3); // 0001 |
dc7ca31d | 491 | word=word1; |
62b80e9d | 492 | AliBitPacking::PackWord(word,baseWord,4, 15); // CRC ? |
dc7ca31d | 493 | word = word2; |
62b80e9d | 494 | AliBitPacking::PackWord(word,baseWord,16,27); // event counter |
dc7ca31d | 495 | word=word3; |
62b80e9d | 496 | AliBitPacking::PackWord(word,baseWord,28,31); // marks trailer |
dc7ca31d | 497 | fIndex++; |
498 | fBuffer[fIndex] = baseWord; | |
62b80e9d | 499 | |
dc7ca31d | 500 | word=0; |
501 | baseWord=0; | |
502 | ||
503 | } | |
504 | ||
505 | //--------------------------------------------------------------------------------------- | |
506 | //--------------------------------------------------------------------------------------- | |
507 | void AliT0RawData::FillTime(Int_t ch, Int_t iTDC, Int_t time) | |
508 | { | |
94249139 | 509 | // put all time fields thother in 1 word |
510 | ||
dc7ca31d | 511 | UInt_t word; |
512 | UInt_t baseWord=0; | |
513 | ||
514 | word=time; | |
62b80e9d | 515 | AliBitPacking::PackWord(word,baseWord, 0, 20); // Time |
dc7ca31d | 516 | |
517 | word=ch; | |
62b80e9d | 518 | AliBitPacking::PackWord(word,baseWord, 21, 23); // number of channel |
dc7ca31d | 519 | word=iTDC; |
62b80e9d | 520 | AliBitPacking::PackWord(word,baseWord, 24, 27); // TDC ID |
dc7ca31d | 521 | |
522 | word=0; | |
62b80e9d | 523 | AliBitPacking::PackWord(word,baseWord, 28, 28); // E = 0 in simulation |
dc7ca31d | 524 | word=0; |
62b80e9d | 525 | AliBitPacking::PackWord(word,baseWord, 29, 30); // PS bit data 00 |
dc7ca31d | 526 | word=1; |
62b80e9d | 527 | AliBitPacking::PackWord(word,baseWord, 31, 31); // 1 |
dc7ca31d | 528 | fIndex++; |
529 | fBuffer[fIndex]=baseWord; | |
62b80e9d | 530 | |
531 | word=0; | |
dc7ca31d | 532 | baseWord=0; |
dc7ca31d | 533 | } |
534 | //--------------------------------------------------------------------------------------- | |
535 | ||
536 | Int_t AliT0RawData::RawDataT0(AliT0digit *fDigits) | |
5bf55199 | 537 | //Int_t AliT0RawData::RawDataT0(*fDigits) |
dc7ca31d | 538 | { |
539 | //This method creates the Raw data files for T0 detector | |
540 | ||
541 | ||
542 | // const Int_t kSize=512; //2*AliTOFGeometry::NpadXSector() | |
543 | //max number of digits per DDL file times 2 | |
544 | // UInt_t fBuffer[kSize]; | |
545 | // UInt_t baseWord; | |
546 | // UInt_t word; | |
547 | ||
548 | fIndex=-1; | |
549 | ||
94c27e4f | 550 | |
dc7ca31d | 551 | WriteDataHeader(kTRUE, kFALSE); |
552 | GetDigits(fDigits); | |
553 | //write packing digits | |
c41ceaac | 554 | |
555 | ||
dc7ca31d | 556 | fFile->WriteBuffer((char*) fBuffer,((fIndex+1)*sizeof(UInt_t))); |
557 | //write real data header on its place | |
558 | WriteDataHeader(kFALSE, kFALSE); | |
559 | ||
560 | ||
561 | //end for | |
562 | ||
563 | return 0; | |
564 | ||
565 | } |