1 /**************************************************************************
2 * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
19 //This class contains all the necessary methods to create the Raw Data
20 //files (slides) for the ITS data challenges for:
26 //#include <Riostream.h>
27 #include <TClonesArray.h>
29 #include "AliITSdigit.h"
30 #include "AliITSDDLRawData.h"
31 #include "AliRawDataHeaderSim.h"
32 #include "AliITSRawStreamSPD.h"
33 #include "AliITSRawStreamSDD.h"
34 #include "AliITSDDLModuleMapSDD.h"
35 #include "AliITSRawStreamSSD.h"
36 #include "AliITSIntMap.h"
37 #include "AliBitPacking.h"
39 #include "AliFstream.h"
40 #include "AliITSFOSignalsSPD.h"
42 ClassImp(AliITSDDLRawData)
44 ////////////////////////////////////////////////////////////////////////////////////////
45 AliITSDDLRawData::AliITSDDLRawData():
54 ////////////////////////////////////////////////////////////////////////////////////////
56 AliITSDDLRawData::AliITSDDLRawData(const AliITSDDLRawData &source) :
58 fVerbose(source.fVerbose),
59 fIndex(source.fIndex),
60 fHalfStaveModule(source.fHalfStaveModule),
61 fSDDRawFormat(source.fSDDRawFormat){
65 ////////////////////////////////////////////////////////////////////////////////////////
67 AliITSDDLRawData& AliITSDDLRawData::operator=(const AliITSDDLRawData &source){
69 this->fIndex=source.fIndex;
70 this->fHalfStaveModule=source.fHalfStaveModule;
71 this->fVerbose=source.fVerbose;
72 this->fSDDRawFormat=source.fSDDRawFormat;
76 ////////////////////////////////////////////////////////////////////////////////////////
80 void AliITSDDLRawData::GetDigitsSSD(TClonesArray *ITSdigits,Int_t mod,Int_t modR,Int_t ddl,UInt_t *buf){
81 //This method packs the SSD digits in a proper 32 bits structure
82 // Revised by Enrico Fragiacomo
88 Int_t ndigits = ITSdigits->GetEntries();
93 ftxt.open("SSDdigits.txt",ios::app);
95 for (Int_t digit=0;digit<ndigits;digit++) {
96 digs = (AliITSdigit*)ITSdigits->UncheckedAt(digit);
97 iz=digs->GetCoord1(); // If iz==0, O side and if iz=1 N side
98 ix=digs->GetCoord2(); // Strip Number
99 is=digs->GetCompressedSignal(); // ADC Signal
100 // cout<<" Module:"<<mod-500<<" N/P side:"<<iz<<" Strip Number:"<<ix<<" Amplidute:"<<is-1<<endl;
102 if(is>4095) is = 4095;
104 ftxt<<"DDL:"<<ddl<<" Mod: "<<modR<<" N/P: "<<iz<<" Strip: "<<ix<<" Value: "<<is-1<<endl;
109 AliBitPacking::PackWord(word,baseWord,0,11);//ADC data
111 word = (iz==0) ? ix : 1535-ix ; // on N-side 1535-768 -> 0-767
112 AliBitPacking::PackWord(word,baseWord,12,22);//Strip Number
114 word = mod%12; // ADC-number (12 ADCs per AD module)
115 word += ( word<6 ) ? 0 : 2; // ADC range 0-5 and 8-13
116 AliBitPacking::PackWord(word,baseWord,24,27);//ADC Channel
118 word = mod/12+1; // AD-number (AD module index ranges 1-9)
119 AliBitPacking::PackWord(word,baseWord,28,31);//AD slot
121 buf[fIndex]=baseWord;
129 ////////////////////////////////////////////////////////////////////////////////////////
130 //Silicon Drift Detector
133 void AliITSDDLRawData::GetDigitsSDDCompressed(TClonesArray *ITSdigits, Int_t mod, UInt_t *buf){
134 //This method packs the SDD digits in the compressed format (32 bit per digit)
135 // see AliITSRawStreamSDDCompressed for details on the dta format
138 Int_t ndigits = ITSdigits->GetEntries();
141 for (Int_t digit=0;digit<ndigits;digit++) {
142 digs = (AliITSdigit*)ITSdigits->UncheckedAt(digit);
143 Int_t iz=digs->GetCoord1(); // Anode
144 Int_t ix=digs->GetCoord2(); // Time
145 Int_t is=digs->GetCompressedSignal(); // ADC Signal - 8 bit
158 else if(is<16) shift=3;
159 else if(is<32) shift=4;
160 else if(is<64) shift=5;
161 else if(is<128) shift=6;
163 adcEncoded=shift+((is-(1<<shift))<<3);
164 dataWord+=adcEncoded;
166 buf[fIndex]=dataWord;
169 UInt_t finalWord=UInt_t(15)<<28;
172 buf[fIndex]=finalWord;
175 //______________________________________________________________________
177 void AliITSDDLRawData::GetDigitsSDD(TClonesArray *ITSdigits,Int_t mod,Int_t modR,Int_t ddl,UInt_t *buf){
178 //This method packs the SDD digits in a proper 32 bits structure
184 Int_t ndigits = ITSdigits->GetEntries();
187 Int_t digarr[512][256];
188 for(Int_t i=0;i<512;i++){
189 for(Int_t j=0;j<256;j++){
193 //word to select the 12 carlos for the 12 modules
194 UInt_t carlosid=0x30000000+mod;
197 buf[fIndex]=carlosid;
203 Bool_t flag = kFALSE;
205 Int_t bitinfo1[4] = {3,8,3,7}; //vector with info on bit for timebin info
206 Int_t wordinfo1[4]= {0,0,0,0}; //vector with word info for timebin info
207 Int_t bitinfo2[2] = {3,18}; //vector with info on bit for EOR (end of row) info
208 Int_t wordinfo2[3]= {1,65593}; //vector with word info for anode info
210 /* for time bin info: word n bits meaning
211 0 3 next info is timebin
212 8 3 next word is 8 bit long
213 tb value 8 timebin value
214 n (2->7) 3 next info is n bit long
215 signal n signal value
217 for anode info: 1 3 next 18 bits are for EOR
218 increments the anode value
220 EOR 18 error codes + other info
225 ftxt.open("SDDdigits.txt",ios::app);
226 for (Int_t digit=0;digit<ndigits;digit++) {
227 digs = (AliITSdigit*)ITSdigits->UncheckedAt(digit);
228 iz=digs->GetCoord1(); // Anode
229 ix=digs->GetCoord2(); // Time
230 is=digs->GetCompressedSignal(); // ADC Signal
233 ftxt<<"DDL:"<<ddl<<" MID:"<<modR<<" An:"<<iz<<" T:"<<ix<<" A:"<<is<<endl;
234 if (is>255){Error("GetDigitsSDD", "bits words is needed)!!!");}
237 for(Int_t anode=0;anode<512;anode++){
240 AliBitPacking::PackWord(word2,baseWord,first,last);
253 for(Int_t tb=0;tb<256;tb++){
254 if(digarr[anode][tb]!=0){
257 AliBitPacking::PackWord(word2,baseWord,first,last);
263 //non lossy compression as it is done in Carlos
264 //(data are already 10to8bit compressed by AMBRA
266 /* if value < 8 value = value - (1 << 2) (word is 2 bit long)
267 if value < 16 value = value - (1 << 3) (word is 3 bit long)
268 if value < 32 value = value - (1 << 4) (word is 4 bit long)
269 if value < 64 value = value - (1 << 5) (word is 5 bit long)
270 if value <128 value = value - (1 << 6) (word is 6 bit long)
271 if value >=128value = value - (1 << 7) (word is 7 bit long)
274 //if(digarr[anode][tb]<4) continue; // not write <4 cnts above tL
275 if(digarr[anode][tb]<8){
278 wordinfo1[3] = digarr[anode][tb]-(1 << bitinfo1[3]);
280 if(digarr[anode][tb]>=8 && digarr[anode][tb]<16){
283 wordinfo1[3] = digarr[anode][tb]-(1 << bitinfo1[3]);
285 if(digarr[anode][tb]>=16 && digarr[anode][tb]<32){
288 wordinfo1[3] = digarr[anode][tb]-(1 << bitinfo1[3]);
290 if(digarr[anode][tb]>=32 && digarr[anode][tb]<64){
293 wordinfo1[3] = digarr[anode][tb]-(1 << bitinfo1[3]);
295 if(digarr[anode][tb]>=64 && digarr[anode][tb]<128){
298 wordinfo1[3] = digarr[anode][tb]-(1 << bitinfo1[3]);
300 if(digarr[anode][tb]>=128){
303 wordinfo1[3] = digarr[anode][tb]-(1 << bitinfo1[3]);
306 for(Int_t ie=0;ie<4;ie++){
310 AliBitPacking::PackWord(word2,baseWord,first,last);
315 last = first+bitinfo1[ie]-1;
316 if(first < 30 && last < 30){
317 AliBitPacking::PackWord(wordinfo1[ie],baseWord,first,last);
322 UInt_t w = AliBitPacking::UnpackWord(wordinfo1[ie],0,29-first);
323 AliBitPacking::PackWord(w,baseWord,first,29);
324 Int_t lb = 29-first+1;
325 diff = bitinfo1[ie]-lb;
326 word2 = AliBitPacking::UnpackWord(wordinfo1[ie],lb,lb+diff-1);
328 if(anode<256) word = 2;//channel 0 of carlos
329 else word = 3; //channel 1 of carlos
330 AliBitPacking::PackWord(word,baseWord,30,31);
332 buf[fIndex]=baseWord;
339 word2 = wordinfo1[ie];
342 if(anode<256) word = 2; //channel 0 of carlos
343 else word = 3; //channel 1 of carlos
344 AliBitPacking::PackWord(word,baseWord,30,31);
346 buf[fIndex]=baseWord;
359 for(Int_t i=0;i<2;i++){
362 AliBitPacking::PackWord(word2,baseWord,first,last);
371 if(first < 30 && last < 30){
372 AliBitPacking::PackWord(word,baseWord,first,last); //3 bit code =1 -> next 18 bits for EOR
378 UInt_t w = AliBitPacking::UnpackWord(word,0,29-first);
379 AliBitPacking::PackWord(w,baseWord,first,29);
380 Int_t lb = 29-first+1;
382 word2 = AliBitPacking::UnpackWord(word,lb,lb+diff-1);
384 if(anode<256) word = 2;
386 AliBitPacking::PackWord(word,baseWord,30,31);
388 buf[fIndex]=baseWord;
401 if(anode<256) word = 2;
403 AliBitPacking::PackWord(word,baseWord,30,31);
405 buf[fIndex]=baseWord;
424 ////////////////////////////////////////////////////////////////////////////////////////
428 void AliITSDDLRawData::GetDigitsSPD(TClonesArray *ITSdigits,Int_t mod,Int_t ddl, UInt_t *buf, AliITSFOSignalsSPD* foSignals){
429 //This method packs the SPD digits in a proper 32 structure
430 //Since data is zero suppressed,the coordinates for the chip having zero digits
431 //doesn't get listed in the galice.root file. However the SPD format requires
432 //the empty chip to be written with chip header and chip trailer.
434 Int_t chipLow = AliITSRawStreamSPD::GetOnlineChipFromOffline(mod,0);
435 Int_t chipHigh = AliITSRawStreamSPD::GetOnlineChipFromOffline(mod,159);
437 if (chipLow>chipHigh) {chipLow -= 4; chipHigh += 4;}
438 UInt_t eq = AliITSRawStreamSPD::GetOnlineEqIdFromOffline(mod);
439 UInt_t hs = AliITSRawStreamSPD::GetOnlineHSFromOffline(mod);
441 // create int map to later hold all digits sorted
442 AliITSIntMap* digMap = new AliITSIntMap();
446 Int_t ndigits = ITSdigits->GetEntries(); //number of digits in the current module
447 //cout<<" Number of digits in the current module:"<<ndigits<<" module:"<<mod<<endl;
449 // _______________________________________________________________________
450 // Preprocess the digits - sort them in integer map (Henrik Tydesjo)
451 // Needed to have exact same order as in real raw data
456 if (fVerbose==2) ftxt.open("SPDdigits.txt",ios::app);
457 for (Int_t digit=0; digit<ndigits; digit++) {
458 digs = (AliITSdigit*) ITSdigits->UncheckedAt(digit);
459 /*---------------------------------------------------------------------------
460 * Each module contains 5 read out chips of 256 rows and 32 columns.
461 * So, the cell number in Z direction varies from 0 to 159.
462 * ---------------------------------------------------------------------*/
463 Int_t iz=digs->GetCoord1(); // Cell number in Z direction
464 Int_t ix=digs->GetCoord2(); // Cell number in X direction
466 if(fVerbose==2) ftxt<<"DDL:"<<ddl<<" Mod:"<<mod<<" Row:"<<ix<<" Col:"<<iz<<endl;
467 UInt_t dummyDDL, dummyHS, chip, col, row;
468 AliITSRawStreamSPD::OfflineToOnline(mod,iz,ix,dummyDDL,dummyHS,chip,col,row);
470 // insert digit into map...
471 // (reverse order of cols and rows as in real raw data)
472 digMap->Insert(chip*256*32+(31-col)*256+(255-row),row);
476 // _______________________________________________________________________
477 // Procedure for writing raw data (Henrik Tydesjo)
478 // Reimplemented because of unreadability (5 Mar 2009)
479 // Now also with fast-or signals
480 Int_t previousChip = chipLow-1;
481 Int_t chip = chipLow-1;
482 UInt_t chipHitCount = 0;
485 UInt_t nrHits = digMap->GetNrEntries();
486 for (UInt_t nHit=0; nHit<nrHits; nHit++) {
488 Int_t key = digMap->GetKeyIndex(nHit);
490 Int_t col = 31 - (key%(256*32))/256;
491 Int_t row = digMap->GetValIndex(nHit);
493 // add trailer for previous chip (if there was one...)
494 if (chip>previousChip && previousChip>chipLow-1) {
495 WriteChipTrailer(buf, chipHitCount, foSignals->GetSignal(eq,hs,previousChip), baseWord);
498 // add headers/trailers for chips without hits (if any)
499 for (Int_t ch=previousChip+1; ch<chip; ch++) {
500 WriteChipHeader(ch, hs, baseWord);
501 WriteChipTrailer(buf, 0, foSignals->GetSignal(eq,hs,ch), baseWord);
504 // if new chip, add header
505 if (chip>previousChip) {
506 WriteChipHeader(chip, hs, baseWord);
514 WriteHit(buf,row,col,baseWord);
518 // add trailer for last chip (if there was one...)
519 if (chip>chipLow-1) {
520 WriteChipTrailer(buf, chipHitCount, foSignals->GetSignal(eq,hs,chip), baseWord);
523 // add REMAINING headers/trailers for chips without hits (if any)
524 for (Int_t ch=chip+1; ch<=chipHigh; ch++) {
525 WriteChipHeader(ch, hs, baseWord);
526 WriteChipTrailer(buf, 0, foSignals->GetSignal(eq,hs,ch), baseWord);
528 // _______________________________________________________________________
538 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
540 Int_t AliITSDDLRawData::RawDataSPD(TBranch* branch, AliITSFOSignalsSPD* foSignals){
541 //This method creates the Raw data files for SPD detectors
542 const Int_t kSize=21000; //256*32*5=40960 max number of digits per module
543 UInt_t buf[kSize]; //One buffer cell can contain 2 digits
546 TClonesArray*& digits = * (TClonesArray**) branch->GetAddress();
548 AliFstream* outfile; // logical name of the output file
549 AliRawDataHeaderSim header;
552 for(Int_t ddl=0;ddl<AliDAQ::NumberOfDdls("ITSSPD");ddl++){
553 fileName.Form("%s",AliDAQ::DdlFileName("ITSSPD",ddl)); //The name of the output file.
554 outfile = new AliFstream(fileName.Data());
555 //write Dummy DATA HEADER
556 UInt_t dataHeaderPosition=outfile->Tellp();
557 outfile->WriteBuffer((char*)(&header),sizeof(header));
558 //Loops over Modules of a particular DDL
559 for (Int_t mod=0; mod<AliITSRawStreamSPD::kModulesPerDDL; mod++){
560 Int_t moduleNumber = AliITSRawStreamSPD::GetModuleNumber(ddl, mod);
562 branch->GetEvent(moduleNumber);
563 //For each Module, buf contains the array of data words in Binary format
564 //fIndex gives the number of 32 bits words in the buffer for each module
565 GetDigitsSPD(digits, moduleNumber, ddl, buf, foSignals);
566 outfile->WriteBuffer((char *)buf,((fIndex+1)*sizeof(UInt_t)));
567 for(Int_t i=0;i<(fIndex+1);i++){
573 //Write REAL DATA HEADER
574 UInt_t currentFilePosition=outfile->Tellp();
575 outfile->Seekp(dataHeaderPosition);
576 header.fSize=currentFilePosition-dataHeaderPosition;
577 outfile->WriteBuffer((char*)(&header),sizeof(header));
584 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
586 Int_t AliITSDDLRawData::RawDataSSD(TBranch* branch){
588 //This method creates the Raw data files for SSD detectors
589 const Int_t kSize=1536;//768*2 Number of stripe * number of sides(N and P)
593 TClonesArray*& digits = * (TClonesArray**) branch->GetAddress();
595 AliFstream* outfile; // logical name of the output file
596 AliRawDataHeaderSim header;
599 for(Int_t i=0;i<AliDAQ::NumberOfDdls("ITSSSD");i++){
600 fileName.Form("%s",AliDAQ::DdlFileName("ITSSSD",i)); //The name of the output file.
601 outfile = new AliFstream(fileName.Data());
602 //write Dummy DATA HEADER
603 UInt_t dataHeaderPosition=outfile->Tellp();
604 outfile->WriteBuffer((char*)(&header),sizeof(header));
606 //Loops over Modules of a particular DDL
607 for (Int_t mod=0; mod<AliITSRawStreamSSD::kModulesPerDDL; mod++){
608 Int_t moduleNumber = AliITSRawStreamSSD::GetModuleNumber(i, mod);
609 if(moduleNumber!=-1){
611 branch->GetEvent(moduleNumber);
612 //For each Module, buf contains the array of data words in Binary format
613 //fIndex gives the number of 32 bits words in the buffer for each module
614 GetDigitsSSD(digits,mod,moduleNumber,i,buf);
615 outfile->WriteBuffer((char *)buf,((fIndex+1)*sizeof(UInt_t)));
620 //Write REAL DATA HEADER
621 UInt_t currentFilePosition=outfile->Tellp();
622 outfile->Seekp(dataHeaderPosition);
623 header.fSize=currentFilePosition-dataHeaderPosition;
624 header.SetAttribute(0); // valid data
625 outfile->WriteBuffer((char*)(&header),sizeof(header));
632 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
634 Int_t AliITSDDLRawData::RawDataSDD(TBranch* branch, AliITSDDLModuleMapSDD* ddlsdd){
635 //This method creates the Raw data files for SDD detectors
636 const Int_t kSize=131072; //256*512
640 TClonesArray*& digits = * (TClonesArray**) branch->GetAddress();
642 AliFstream* outfile; // logical name of the output file
643 AliRawDataHeaderSim header;
645 if(fSDDRawFormat!=0){
646 for(Int_t ibit=0; ibit<8; ibit++) header.SetAttribute(ibit);
648 for(Int_t ibit=0; ibit<5; ibit++) header.SetAttribute(ibit);
649 for(Int_t ibit=5; ibit<8; ibit++) header.ResetAttribute(ibit);
651 UInt_t skippedword, carlosFooterWord,fifoFooterWord,jitterWord;
653 retcode = AliBitPacking::PackWord(0x3FFFFFFF,carlosFooterWord,0,31);
654 retcode = AliBitPacking::PackWord(0x3F1F1F1F,fifoFooterWord,0,31);
655 if(fSDDRawFormat!=0) retcode = AliBitPacking::PackWord(0x7F000000,jitterWord,0,31);
656 else retcode = AliBitPacking::PackWord(0x80000000,jitterWord,0,31);
659 for(Int_t i=0;i<AliDAQ::NumberOfDdls("ITSSDD");i++){
660 fileName.Form("%s",AliDAQ::DdlFileName("ITSSDD",i)); //The name of the output file.
661 outfile = new AliFstream(fileName.Data());
662 //write Dummy DATA HEADER
663 UInt_t dataHeaderPosition=outfile->Tellp();
664 outfile->WriteBuffer((char*)(&header),sizeof(header));
667 //first 1 "dummy" word to be skipped
668 if(fSDDRawFormat!=0){
669 retcode = AliBitPacking::PackWord(0xFFFFFFFF,skippedword,0,31);
670 outfile->WriteBuffer((char*)(&skippedword),sizeof(skippedword));
673 //Loops over Modules of a particular DDL
674 for (Int_t mod=0; mod<AliITSRawStreamSDD::kModulesPerDDL; mod++){
675 Int_t moduleNumber = ddlsdd->GetModuleNumber(i, mod);
676 if(moduleNumber!=-1){
678 branch->GetEvent(moduleNumber);
680 //For each Module, buf contains the array of data words in Binary format
681 //fIndex gives the number of 32 bits words in the buffer for each module
682 // cout<<"MODULE NUMBER:"<<mapSDD[i][mod]<<endl;
683 if(fSDDRawFormat==0){
684 GetDigitsSDDCompressed(digits,mod,buf);
685 outfile->WriteBuffer((char *)buf,((fIndex+1)*sizeof(UInt_t)));
687 GetDigitsSDD(digits,mod,moduleNumber,i,buf);
688 outfile->WriteBuffer((char *)buf,((fIndex+1)*sizeof(UInt_t)));
689 for(Int_t iw=0;iw<3;iw++) outfile->WriteBuffer((char*)(&carlosFooterWord),sizeof(carlosFooterWord));
694 // 12 words with FIFO footers (=4 FIFO x 3 3F1F1F1F words per DDL)
695 if(fSDDRawFormat!=0){
696 for(Int_t iw=0;iw<12;iw++) outfile->WriteBuffer((char*)(&fifoFooterWord),sizeof(fifoFooterWord));
698 outfile->WriteBuffer((char*)(&jitterWord),sizeof(jitterWord));
699 //Write REAL DATA HEADER
700 UInt_t currentFilePosition=outfile->Tellp();
701 outfile->Seekp(dataHeaderPosition);
702 header.fSize=currentFilePosition-dataHeaderPosition;
703 header.SetAttribute(0); // valid data
704 outfile->WriteBuffer((char*)(&header),sizeof(header));
711 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
713 void AliITSDDLRawData::WriteChipHeader(Int_t ChipAddr,Int_t halfStave,UInt_t &BaseWord){
714 //This method writes a chip header
715 //cout<<"Chip: "<<ChipAddr<<" Half Stave module:"<<halfStave<<endl;
717 AliBitPacking::PackWord(ChipAddr,BaseWord,16,19);
718 // At the moment the event count is always 0 (bits 20-26)
719 AliBitPacking::PackWord(0,BaseWord,20,26);
720 AliBitPacking::PackWord(halfStave,BaseWord,27,29);
721 AliBitPacking::PackWord(0x1,BaseWord,30,31);
723 }//end WriteChipHeader
725 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
727 void AliITSDDLRawData::WriteChipTrailer(UInt_t *buf, Int_t ChipHitCount, Bool_t foBit, UInt_t &BaseWord){
728 //This method writes a chip trailer
730 if((ChipHitCount%2)!=0){
731 AliBitPacking::PackWord(0xC000,BaseWord,16,31);
733 AliBitPacking::PackWord(ChipHitCount,BaseWord,0,11);
734 AliBitPacking::PackWord(0x0,BaseWord,12,12);
735 AliBitPacking::PackWord(foBit,BaseWord,13,13);
736 AliBitPacking::PackWord(0x0,BaseWord,14,15);
738 buf[fIndex]=BaseWord;
741 }//end WriteChipTrailer
743 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
745 void AliITSDDLRawData::WriteHit(UInt_t *buf,Int_t RowAddr,Int_t HitAddr,UInt_t &BaseWord){
746 //This method writs an hit
748 AliBitPacking::PackWord(HitAddr,BaseWord,16,20);
749 AliBitPacking::PackWord(RowAddr,BaseWord,21,28);
750 AliBitPacking::PackWord(2,BaseWord,30,31);
753 AliBitPacking::PackWord(HitAddr,BaseWord,0,4);
754 AliBitPacking::PackWord(RowAddr,BaseWord,5,12);
755 AliBitPacking::PackWord(2,BaseWord,14,15);
757 buf[fIndex]=BaseWord;