]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSDDLRawData.cxx
Remove dependence to RAW module in MUONraw library for online purpose (Christian)
[u/mrichter/AliRoot.git] / ITS / AliITSDDLRawData.cxx
CommitLineData
2e9f335b 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 **************************************************************************/
9f992f70 15
30c1018e 16/* $Id$ */
a79660fb 17
9f992f70 18
a79660fb 19//This class contains all the necessary methods to create the Raw Data
20//files (slides) for the ITS data challenges for:
21//SPD
22//SDD
23//SSD
2e9f335b 24
25#include <stdlib.h>
2e9f335b 26#include <TClonesArray.h>
27#include <TTree.h>
7d62fb64 28#include "AliITSdigit.h"
2e9f335b 29#include "AliITSDDLRawData.h"
0421c3d1 30#include "AliRawDataHeader.h"
31#include "AliITSRawStreamSPD.h"
32#include "AliITSRawStreamSDD.h"
33#include "AliITSRawStreamSSD.h"
113c12f1 34#include "AliBitPacking.h"
362c9d61 35#include "AliDAQ.h"
2e9f335b 36
37ClassImp(AliITSDDLRawData)
38
39////////////////////////////////////////////////////////////////////////////////////////
40AliITSDDLRawData::AliITSDDLRawData(){
a79660fb 41 //Default constructor
2e9f335b 42 fIndex=-1;
43 fHalfStaveModule=-1;
9f992f70 44 fVerbose=0;
2e9f335b 45}
46
47////////////////////////////////////////////////////////////////////////////////////////
48
ac74f489 49AliITSDDLRawData::AliITSDDLRawData(const AliITSDDLRawData &source) :
50 TObject(source){
a79660fb 51 //Copy Constructor
2e9f335b 52 this->fIndex=source.fIndex;
53 this->fHalfStaveModule=source.fHalfStaveModule;
9f992f70 54 this->fVerbose=source.fVerbose;
2e9f335b 55 return;
56}
57
58////////////////////////////////////////////////////////////////////////////////////////
59
60AliITSDDLRawData& AliITSDDLRawData::operator=(const AliITSDDLRawData &source){
61 //Assigment operator
62 this->fIndex=source.fIndex;
63 this->fHalfStaveModule=source.fHalfStaveModule;
9f992f70 64 this->fVerbose=source.fVerbose;
2e9f335b 65 return *this;
66}
67
68////////////////////////////////////////////////////////////////////////////////////////
69//STRIP
70//
71
0b3c7dfc 72void AliITSDDLRawData::GetDigitsSSD(TClonesArray *ITSdigits,Int_t mod,Int_t modR,Int_t ddl,UInt_t *buf){
a79660fb 73 //This method packs the SSD digits in a proper 32 bits structure
2e9f335b 74 Int_t ix;
75 Int_t iz;
76 Int_t is;
0b3c7dfc 77 UInt_t word;
78 UInt_t baseWord;
2e9f335b 79 Int_t ndigits = ITSdigits->GetEntries();
80 AliITSdigit *digs;
9f992f70 81 ofstream ftxt;
2e9f335b 82 if(ndigits){
9f992f70 83 if (fVerbose==2){
84 ftxt.open("SSDdigits.txt",ios::app);
85 }
2e9f335b 86 for (Int_t digit=0;digit<ndigits;digit++) {
87 digs = (AliITSdigit*)ITSdigits->UncheckedAt(digit);
ecee53fc 88 iz=digs->GetCoord1(); // If iz==0, N side and if iz=1 P side
89 ix=digs->GetCoord2(); // Strip Numbar
7f1a504b 90 is=digs->GetCompressedSignal(); // ADC Signal
2e9f335b 91 // cout<<" Module:"<<mod-500<<" N/P side:"<<iz<<" Strip Number:"<<ix<<" Amplidute:"<<is-1<<endl;
9f992f70 92 if (fVerbose==2)
93 ftxt<<"DDL:"<<ddl<<" Mod: "<<modR<<" N/P: "<<iz<<" Strip: "<<ix<<" Value: "<<is-1<<endl;
a79660fb 94 baseWord=0;
95 word=is-1;
113c12f1 96 AliBitPacking::PackWord(word,baseWord,0,9);//ADC data
a79660fb 97 word=ix;
113c12f1 98 AliBitPacking::PackWord(word,baseWord,10,19);//Strip Number
a79660fb 99 word=iz;
113c12f1 100 AliBitPacking::PackWord(word,baseWord,20,20);//ADC Channel ID (N or P side)
a79660fb 101 word=mod;
113c12f1 102 AliBitPacking::PackWord(word,baseWord,21,31);//ADC module ID
2e9f335b 103 fIndex++;
a79660fb 104 buf[fIndex]=baseWord;
2e9f335b 105 }//end for
106 }//end if
9f992f70 107 if (fVerbose==2)
108 ftxt.close();
2e9f335b 109 return;
110}//end GetDigitsSSD
111
112////////////////////////////////////////////////////////////////////////////////////////
113//Silicon Drift Detector
114//
115
0b3c7dfc 116void AliITSDDLRawData::GetDigitsSDD(TClonesArray *ITSdigits,Int_t mod,Int_t modR,Int_t ddl,UInt_t *buf){
a79660fb 117 //This method packs the SSD digits in a proper 32 bits structure
2e9f335b 118 Int_t ix;
119 Int_t iz;
120 Int_t is;
0b3c7dfc 121 UInt_t word;
122 UInt_t baseWord;
2e9f335b 123 Int_t ndigits = ITSdigits->GetEntries();
124 AliITSdigit *digs;
9f992f70 125 ofstream ftxt;
2e9f335b 126 if(ndigits){
127 //cout<<"Mudule "<<mod<<" number of digits "<<ndigits<<endl;
9f992f70 128 if (fVerbose==2)
129 ftxt.open("SDDdigits.txt",ios::app);
2e9f335b 130 for (Int_t digit=0;digit<ndigits;digit++) {
131 digs = (AliITSdigit*)ITSdigits->UncheckedAt(digit);
ecee53fc 132 iz=digs->GetCoord1(); // Anode
133 ix=digs->GetCoord2(); // Time
7f1a504b 134 is=digs->GetCompressedSignal(); // ADC Signal
9f992f70 135 if (fVerbose==2)
136 ftxt<<"DDL:"<<ddl<<" MID:"<<modR<<" An:"<<iz<<" T:"<<ix<<" A:"<<is<<endl;
2e9f335b 137 // cout<<"Amplitude value:"<<is<<" Time Bucket:"<<ix<<" Anode:"<<iz<<endl;
0421c3d1 138 if (is>255){Error("GetDigitsSDD", "bits words is needed)!!!");}
a79660fb 139 baseWord=0;
2e9f335b 140 /*
141 //10 bits words for amplitude value
a79660fb 142 word=is;
113c12f1 143 AliBitPacking::PackWord(word,baseWord,0,9);//ADC data
a79660fb 144 word=ix;
113c12f1 145 AliBitPacking::PackWord(word,baseWord,10,17);//Time bucket
a79660fb 146 word=iz;
113c12f1 147 AliBitPacking::PackWord(word,baseWord,18,26);//Anode Number
a79660fb 148 word=mod;
113c12f1 149 AliBitPacking::PackWord(word,baseWord,27,31);//Module number
2e9f335b 150 */
151
152 //8bits words for amplitude value
a79660fb 153 word=is;
113c12f1 154 AliBitPacking::PackWord(word,baseWord,0,7);//ADC data
a79660fb 155 word=ix;
113c12f1 156 AliBitPacking::PackWord(word,baseWord,8,15);//Time bucket
a79660fb 157 word=iz;
113c12f1 158 AliBitPacking::PackWord(word,baseWord,16,24);//Anode Number
a79660fb 159 word=mod;
113c12f1 160 AliBitPacking::PackWord(word,baseWord,25,31);//Module number
2e9f335b 161
162 fIndex++;
a79660fb 163 buf[fIndex]=baseWord;
2e9f335b 164 }//end for
165 }//end if
9f992f70 166 if(fVerbose==2)
167 ftxt.close();
2e9f335b 168 return;
169}//end GetDigitsSDD
170
171////////////////////////////////////////////////////////////////////////////////////////
172//PIXEL
173//
174
0b3c7dfc 175void AliITSDDLRawData::GetDigitsSPD(TClonesArray *ITSdigits,Int_t mod,Int_t ddl, UInt_t *buf){
9f992f70 176 //This method packs the SPD digits in a proper 32 structure
177 //Since data is zero suppressed,the coordinates for the chip having zero digits
178 //doesn't get listed in the galice.root file. However the SPD format requires
179 //the empty chip to be written with chip header and chip trailer.
2e9f335b 180 Int_t ix;
181 Int_t iz;
a79660fb 182 Int_t chipNo=0;
0b3c7dfc 183 UInt_t baseWord=0;
184 UInt_t hitRow=0;
a79660fb 185 Int_t chipHitCount=0; //Number of Hit in the current chip
186 Int_t previousChip=-1; //Previuos chip respect to the actual aone
2e9f335b 187 Int_t ndigits = ITSdigits->GetEntries(); //number of digits in the current module
188 //cout<<" Number of digits in the current module:"<<ndigits<<" module:"<<mod<<endl;
189 AliITSdigit *digs;
190 fHalfStaveModule++; //It's a private variable used to distinguish between the firs
191 //and the second module of an Half Stave Module
9f992f70 192 ofstream ftxt;
2e9f335b 193 if(ndigits){
194 //loop over digits
9f992f70 195 if (fVerbose==2)
196 ftxt.open("SPDdigits.txt",ios::app);
2e9f335b 197 for (Int_t digit=0;digit<ndigits;digit++){
198 digs = (AliITSdigit*)ITSdigits->UncheckedAt(digit);
199 /*---------------------------------------------------------------------------
200 * Each module contains 5 read out chips of 256 rows and 32 columns.
9f992f70 201 * So, the cell number in Z direction varies from 0 to 159. Therefore,
2e9f335b 202 * to get the chip address (0 to 4), we need to divide column number by 32.
203 * ---------------------------------------------------------------------*/
ecee53fc 204 iz=digs->GetCoord1(); // Cell number in Z direction
205 ix=digs->GetCoord2(); // Cell number in X direction
a79660fb 206 chipNo=iz/32;
9f992f70 207 if(fVerbose==2)
208 ftxt<<"DDL:"<<ddl<<" Mod:"<<mod<<" Row:"<<ix<<" Col:"<<iz<<endl;
a79660fb 209 hitRow=iz-chipNo*32;
2e9f335b 210 if(fHalfStaveModule){
a79660fb 211 chipNo+=5;
2e9f335b 212 fHalfStaveModule=-1;
213 }//end if
a79660fb 214 if(previousChip==-1){
2e9f335b 215 //loop over chip without digits
216 //Even if there aren't digits for a given chip
217 //the chip header and the chip trailer are stored
218 for(Int_t i=0;i<(iz/32);i++){
a79660fb 219 if(chipNo>4)
220 WriteChipHeader(i+5,(mod/2),baseWord);
2e9f335b 221 else
a79660fb 222 WriteChipHeader(i,(mod/2),baseWord);
223 WriteChipTrailer(buf,chipHitCount,baseWord);
9f992f70 224 chipHitCount=0;
2e9f335b 225 }//end for
a79660fb 226 WriteChipHeader(chipNo,(mod/2),baseWord);
227 chipHitCount++;
228 WriteHit(buf,ix,hitRow,baseWord);
9f992f70 229 previousChip=chipNo;
2e9f335b 230 }//end if
231 else{
a79660fb 232 if(previousChip!=chipNo){
9f992f70 233 WriteChipTrailer(buf,chipHitCount,baseWord);
234 chipHitCount=0;
a79660fb 235 for(Int_t i=previousChip+1;i<chipNo;i++){
236 WriteChipHeader(i,(mod/2),baseWord);
237 WriteChipTrailer(buf,0,baseWord);
9f992f70 238 chipHitCount=0;
2e9f335b 239 }//end for
a79660fb 240 WriteChipHeader(chipNo,(mod/2),baseWord);
241 previousChip=chipNo;
2e9f335b 242 }//end if
9f992f70 243 chipHitCount++;
a79660fb 244 WriteHit(buf,ix,hitRow,baseWord);
2e9f335b 245 }//end else
246 }//end for
247 //Even if there aren't digits for a given chip
248 //the chip header and the chip trailer are stored
a79660fb 249 Int_t end=4;
250 if(chipNo>4)end+=5;
251 WriteChipTrailer(buf,chipHitCount,baseWord);
9f992f70 252 chipHitCount=0;
a79660fb 253 for(Int_t i=chipNo+1;i<=end;i++){
254 WriteChipHeader(i,(mod/2),baseWord);
255 WriteChipTrailer(buf,0,baseWord);
9f992f70 256 chipHitCount=0;
2e9f335b 257 }//end for
258 }//end if
259 else{
260 //In this module there aren't digits but
261 //the chip header and chip trailer are store anyway
262 if(fHalfStaveModule){
a79660fb 263 chipNo=5;
2e9f335b 264 fHalfStaveModule=-1;
265 }//end if
266 for(Int_t i=0;i<5;i++){
a79660fb 267 WriteChipHeader(chipNo+i,(mod/2),baseWord);
268 WriteChipTrailer(buf,chipHitCount,baseWord);
9f992f70 269 chipHitCount=0;
2e9f335b 270 }//end for
271 }//end else
9f992f70 272 if(fVerbose==2)
273 ftxt.close();
2e9f335b 274 return;
275}//end GetDigitsSPD
276
2e9f335b 277/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
278
0421c3d1 279Int_t AliITSDDLRawData::RawDataSPD(TBranch* branch){
a79660fb 280 //This method creates the Raw data files for SPD detectors
a79660fb 281 const Int_t kSize=21000; //256*32*5=40960 max number of digits per module
0b3c7dfc 282 UInt_t buf[kSize]; //One buffer cell can contain 2 digits
2e9f335b 283 fIndex=-1;
2e9f335b 284
0421c3d1 285 TClonesArray*& digits = * (TClonesArray**) branch->GetAddress();
2e9f335b 286 char fileName[15];
2e9f335b 287 ofstream outfile; // logical name of the output file
0421c3d1 288 AliRawDataHeader header;
289
290 //loop over DDLs
362c9d61 291 for(Int_t i=0;i<AliDAQ::NumberOfDdls("ITSSPD");i++){
292 strcpy(fileName,AliDAQ::DdlFileName("ITSSPD",i)); //The name of the output file.
30c1018e 293#ifndef __DECCXX
0421c3d1 294 outfile.open(fileName,ios::binary);
30c1018e 295#else
0421c3d1 296 outfile.open(fileName);
30c1018e 297#endif
0421c3d1 298 //write Dummy DATA HEADER
299 UInt_t dataHeaderPosition=outfile.tellp();
300 outfile.write((char*)(&header),sizeof(header));
2e9f335b 301 //Loops over Modules of a particular DDL
0421c3d1 302 for (Int_t mod=0; mod<AliITSRawStreamSPD::kModulesPerDDL; mod++){
303 Int_t moduleNumber = AliITSRawStreamSPD::GetModuleNumber(i, mod);
304 digits->Clear();
305 branch->GetEvent(moduleNumber);
2e9f335b 306 //For each Module, buf contains the array of data words in Binary format
307 //fIndex gives the number of 32 bits words in the buffer for each module
0421c3d1 308 GetDigitsSPD(digits,moduleNumber,i,buf);
0b3c7dfc 309 outfile.write((char *)buf,((fIndex+1)*sizeof(UInt_t)));
2e9f335b 310 for(Int_t i=0;i<(fIndex+1);i++){
311 buf[i]=0;
312 }//end for
313 fIndex=-1;
314 }//end for
315
0421c3d1 316 //Write REAL DATA HEADER
0b3c7dfc 317 UInt_t currentFilePosition=outfile.tellp();
0421c3d1 318 outfile.seekp(dataHeaderPosition);
319 header.fSize=currentFilePosition-dataHeaderPosition;
0421c3d1 320 outfile.write((char*)(&header),sizeof(header));
321 outfile.close();
2e9f335b 322 }//end for
0421c3d1 323
2e9f335b 324 return 0;
325}
326
327/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
328
0421c3d1 329Int_t AliITSDDLRawData::RawDataSSD(TBranch* branch){
a79660fb 330 //This method creates the Raw data files for SSD detectors
a79660fb 331 const Int_t kSize=1536;//768*2 Number of stripe * number of sides(N and P)
0b3c7dfc 332 UInt_t buf[kSize];
2e9f335b 333 fIndex=-1;
0421c3d1 334
335 TClonesArray*& digits = * (TClonesArray**) branch->GetAddress();
2e9f335b 336 char fileName[15];
0421c3d1 337 ofstream outfile; // logical name of the output file
338 AliRawDataHeader header;
2e9f335b 339
0421c3d1 340 //loop over DDLs
362c9d61 341 for(Int_t i=0;i<AliDAQ::NumberOfDdls("ITSSSD");i++){
342 strcpy(fileName,AliDAQ::DdlFileName("ITSSSD",i)); //The name of the output file.
30c1018e 343#ifndef __DECCXX
0421c3d1 344 outfile.open(fileName,ios::binary);
30c1018e 345#else
0421c3d1 346 outfile.open(fileName);
30c1018e 347#endif
0421c3d1 348 //write Dummy DATA HEADER
349 UInt_t dataHeaderPosition=outfile.tellp();
350 outfile.write((char*)(&header),sizeof(header));
2e9f335b 351
352 //Loops over Modules of a particular DDL
0421c3d1 353 for (Int_t mod=0; mod<AliITSRawStreamSSD::kModulesPerDDL; mod++){
354 Int_t moduleNumber = AliITSRawStreamSSD::GetModuleNumber(i, mod);
355 if(moduleNumber!=-1){
356 digits->Clear();
357 branch->GetEvent(moduleNumber);
2e9f335b 358 //For each Module, buf contains the array of data words in Binary format
359 //fIndex gives the number of 32 bits words in the buffer for each module
0421c3d1 360 GetDigitsSSD(digits,mod,moduleNumber,i,buf);
0b3c7dfc 361 outfile.write((char *)buf,((fIndex+1)*sizeof(UInt_t)));
2e9f335b 362 fIndex=-1;
363 }//end if
364 }//end for
0421c3d1 365
366 //Write REAL DATA HEADER
0b3c7dfc 367 UInt_t currentFilePosition=outfile.tellp();
0421c3d1 368 outfile.seekp(dataHeaderPosition);
369 header.fSize=currentFilePosition-dataHeaderPosition;
370 header.SetAttribute(0); // valid data
371 outfile.write((char*)(&header),sizeof(header));
372 outfile.close();
2e9f335b 373 }//end for
0421c3d1 374
2e9f335b 375 return 0;
376}
377
378/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
379
0421c3d1 380Int_t AliITSDDLRawData::RawDataSDD(TBranch* branch){
a79660fb 381 //This method creates the Raw data files for SDD detectors
a79660fb 382 const Int_t kSize=131072; //256*512
0b3c7dfc 383 UInt_t buf[kSize];
2e9f335b 384 fIndex=-1;
2e9f335b 385
0421c3d1 386 TClonesArray*& digits = * (TClonesArray**) branch->GetAddress();
387 char fileName[15];
2e9f335b 388 ofstream outfile; // logical name of the output file
0421c3d1 389 AliRawDataHeader header;
390
391 //loop over DDLs
362c9d61 392 for(Int_t i=0;i<AliDAQ::NumberOfDdls("ITSSDD");i++){
393 strcpy(fileName,AliDAQ::DdlFileName("ITSSDD",i)); //The name of the output file.
30c1018e 394#ifndef __DECCXX
0421c3d1 395 outfile.open(fileName,ios::binary);
30c1018e 396#else
0421c3d1 397 outfile.open(fileName);
30c1018e 398#endif
0421c3d1 399 //write Dummy DATA HEADER
400 UInt_t dataHeaderPosition=outfile.tellp();
401 outfile.write((char*)(&header),sizeof(header));
402
2e9f335b 403 //Loops over Modules of a particular DDL
0421c3d1 404 for (Int_t mod=0; mod<AliITSRawStreamSDD::kModulesPerDDL; mod++){
405 Int_t moduleNumber = AliITSRawStreamSDD::GetModuleNumber(i, mod);
406 if(moduleNumber!=-1){
407 digits->Clear();
408 branch->GetEvent(moduleNumber);
2e9f335b 409 //For each Module, buf contains the array of data words in Binary format
410 //fIndex gives the number of 32 bits words in the buffer for each module
a79660fb 411 // cout<<"MODULE NUMBER:"<<mapSDD[i][mod]<<endl;
0421c3d1 412 GetDigitsSDD(digits,mod,moduleNumber,i,buf);
0b3c7dfc 413 outfile.write((char *)buf,((fIndex+1)*sizeof(UInt_t)));
2e9f335b 414 fIndex=-1;
415 }//end if
416 }//end for
417
0421c3d1 418 //Write REAL DATA HEADER
0b3c7dfc 419 UInt_t currentFilePosition=outfile.tellp();
0421c3d1 420 outfile.seekp(dataHeaderPosition);
421 header.fSize=currentFilePosition-dataHeaderPosition;
422 header.SetAttribute(0); // valid data
423 outfile.write((char*)(&header),sizeof(header));
424 outfile.close();
2e9f335b 425 }//end for
0421c3d1 426
2e9f335b 427 return 0;
428}
429
430/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
431
7193a823 432void AliITSDDLRawData::WriteChipHeader(Int_t ChipAddr,Int_t /*EventCnt*/,UInt_t &BaseWord){
a79660fb 433 //This method writes a chip header
2e9f335b 434 //cout<<"Chip: "<<ChipAddr<<" Half Stave module:"<<EventCnt<<endl;
435 BaseWord=0;
113c12f1 436 AliBitPacking::PackWord(ChipAddr,BaseWord,0,3);
7193a823 437// AliBitPacking::PackWord(EventCnt,BaseWord,4,10);
438 AliBitPacking::PackWord(0,BaseWord,4,10);
113c12f1 439 AliBitPacking::PackWord(0x7,BaseWord,11,13);
440 AliBitPacking::PackWord(0x1,BaseWord,14,15);
2e9f335b 441 return;
442}//end WriteChipHeader
443
444/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
445
0b3c7dfc 446void AliITSDDLRawData::ReadChipHeader(Int_t &ChipAddr,Int_t &EventCnt,UInt_t BaseWord){
a79660fb 447 //This method reads a chip header
113c12f1 448 UInt_t temp=AliBitPacking::UnpackWord(BaseWord,0,3);
2e9f335b 449 ChipAddr=(Int_t)temp;
113c12f1 450 temp=AliBitPacking::UnpackWord(BaseWord,4,10);
2e9f335b 451 EventCnt=(Int_t)temp;
9f992f70 452 if(fVerbose)
0421c3d1 453 Info("ReadChipHeader", "Chip:&d Half Stave module:%d",ChipAddr,EventCnt);
2e9f335b 454 return;
455}//end ReadChipHeader
456
457/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
458
0b3c7dfc 459void AliITSDDLRawData::WriteChipTrailer(UInt_t *buf,Int_t ChipHitCount,UInt_t &BaseWord){
a79660fb 460 //This method writes a chip trailer
2e9f335b 461 //pixel fill word
462 if((ChipHitCount%2)!=0){
7193a823 463 AliBitPacking::PackWord(0xC000,BaseWord,0,15);
2e9f335b 464 }
7193a823 465 AliBitPacking::PackWord(ChipHitCount,BaseWord,16,29);
113c12f1 466 AliBitPacking::PackWord(0x0,BaseWord,30,31);
2e9f335b 467 fIndex++;
468 buf[fIndex]=BaseWord;
469 BaseWord=0;
470 return;
471}//end WriteChipTrailer
472
473/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
474
0b3c7dfc 475void AliITSDDLRawData::ReadChipTrailer(Int_t &ChipHitCount,UInt_t BaseWord){
a79660fb 476 //This method reads a chip trailer
7193a823 477 UInt_t temp=AliBitPacking::UnpackWord(BaseWord,16,29);
2e9f335b 478 ChipHitCount=(Int_t)temp;
479 return;
480}//end ReadChipTrailer
481
482/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
483
0b3c7dfc 484void AliITSDDLRawData::WriteHit(UInt_t *buf,Int_t RowAddr,Int_t HitAddr,UInt_t &BaseWord){
a79660fb 485 //This method writs an hit
2e9f335b 486 if(!BaseWord){
113c12f1 487 AliBitPacking::PackWord(HitAddr,BaseWord,0,4);
488 AliBitPacking::PackWord(RowAddr,BaseWord,5,12);
489 AliBitPacking::PackWord(2,BaseWord,14,15);
2e9f335b 490 }//end if
491 else{
113c12f1 492 AliBitPacking::PackWord(HitAddr,BaseWord,16,20);
493 AliBitPacking::PackWord(RowAddr,BaseWord,21,28);
494 AliBitPacking::PackWord(2,BaseWord,30,31);
2e9f335b 495 fIndex++;
496 buf[fIndex]=BaseWord;
497 BaseWord=0;
498 }//end else
499 return;
500}//end WriteHit
501