//STRIP
//
-void AliITSDDLRawData::GetDigitsSSD(TClonesArray *ITSdigits,Int_t mod,Int_t modR,Int_t ddl,ULong_t *buf){
+void AliITSDDLRawData::GetDigitsSSD(TClonesArray *ITSdigits,Int_t mod,Int_t modR,Int_t ddl,UInt_t *buf){
//This method packs the SSD digits in a proper 32 bits structure
Int_t ix;
Int_t iz;
Int_t is;
- ULong_t word;
- ULong_t baseWord;
+ UInt_t word;
+ UInt_t baseWord;
Int_t ndigits = ITSdigits->GetEntries();
AliITSdigit *digs;
ofstream ftxt;
//Silicon Drift Detector
//
-void AliITSDDLRawData::GetDigitsSDD(TClonesArray *ITSdigits,Int_t mod,Int_t modR,Int_t ddl,ULong_t *buf){
+void AliITSDDLRawData::GetDigitsSDD(TClonesArray *ITSdigits,Int_t mod,Int_t modR,Int_t ddl,UInt_t *buf){
//This method packs the SSD digits in a proper 32 bits structure
Int_t ix;
Int_t iz;
Int_t is;
- ULong_t word;
- ULong_t baseWord;
+ UInt_t word;
+ UInt_t baseWord;
Int_t ndigits = ITSdigits->GetEntries();
AliITSdigit *digs;
ofstream ftxt;
//PIXEL
//
-void AliITSDDLRawData::GetDigitsSPD(TClonesArray *ITSdigits,Int_t mod,Int_t ddl, ULong_t *buf){
+void AliITSDDLRawData::GetDigitsSPD(TClonesArray *ITSdigits,Int_t mod,Int_t ddl, UInt_t *buf){
//This method packs the SPD digits in a proper 32 structure
//Since data is zero suppressed,the coordinates for the chip having zero digits
//doesn't get listed in the galice.root file. However the SPD format requires
Int_t ix;
Int_t iz;
Int_t chipNo=0;
- ULong_t baseWord=0;
- ULong_t hitRow=0;
+ UInt_t baseWord=0;
+ UInt_t hitRow=0;
Int_t chipHitCount=0; //Number of Hit in the current chip
Int_t previousChip=-1; //Previuos chip respect to the actual aone
Int_t ndigits = ITSdigits->GetEntries(); //number of digits in the current module
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-void AliITSDDLRawData::PackWord(ULong_t &BaseWord, ULong_t Word, Int_t StartBit, Int_t StopBit){
+void AliITSDDLRawData::PackWord(UInt_t &BaseWord, UInt_t Word, Int_t StartBit, Int_t StopBit){
//This method packs a word into the Baseword buffer starting form the "StartBit"
//and tacking StopBit-StertBit+1 bits
- ULong_t dummyWord,offSet;
+ UInt_t dummyWord,offSet;
Int_t length;
- ULong_t sum;
+ UInt_t sum;
//The BaseWord is being filled with 1 from StartBit to StopBit
length=StopBit-StartBit+1;
- sum=(ULong_t)TMath::Power(2,length)-1;
+ sum=(UInt_t)TMath::Power(2,length)-1;
if(Word > sum){
cout<<"WARNING::Word to be filled is not within desired length"<<endl;
cout<<"Word:"<<Word<<" Start bit:"<<StartBit<<" Stop Bit:"<<StopBit<<endl;
BaseWord=BaseWord|offSet;
//The Word to be filled is shifted to the position StartBit
//and the remaining Left and Right bits are filled with 1
- sum=(ULong_t)TMath::Power(2,StartBit)-1;
+ sum=(UInt_t)TMath::Power(2,StartBit)-1;
dummyWord=0xFFFFFFFF<<length;
dummyWord +=Word;
dummyWord<<=StartBit;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-void AliITSDDLRawData::UnpackWord(ULong_t PackedWord, Int_t StartBit, Int_t StopBit, ULong_t &Word){
+void AliITSDDLRawData::UnpackWord(UInt_t PackedWord, Int_t StartBit, Int_t StopBit, UInt_t &Word){
//This method unpacks a words of StopBit-StertBit+1 bits starting from "StopBits"
- ULong_t offSet;
+ UInt_t offSet;
Int_t length;
length=StopBit-StartBit+1;
- offSet=(ULong_t)TMath::Power(2,length)-1;
+ offSet=(UInt_t)TMath::Power(2,length)-1;
offSet<<=StartBit;
Word=PackedWord&offSet;
Word>>=StartBit;
Int_t countDDL=0;
Int_t sliceNumber=1;
const Int_t kSize=21000; //256*32*5=40960 max number of digits per module
- ULong_t buf[kSize]; //One buffer cell can contain 2 digits
+ UInt_t buf[kSize]; //One buffer cell can contain 2 digits
fIndex=-1;
TClonesArray *digitsInITS = ITS->DigitsAddress(subd);
Int_t nbytes = 0;
char fileName[15];
- ULong_t miniHeaderPosition=0; //variable used to store the position of the Mini Header inside a file
+ UInt_t miniHeaderPosition=0; //variable used to store the position of the Mini Header inside a file
ofstream outfile; // logical name of the output file
Int_t flag=0; // 0==> Uncompressed data 1==>Compressed Data
Int_t detector=1; // 1==>ITS (Pixel) 2==>ITS (Drift) 3==>ITS (Strip) 0==>TPC ......
- ULong_t size=0; // size of the data block that follows the mini header
+ UInt_t size=0; // size of the data block that follows the mini header
Int_t magicWord=0x123456; // Magic word used to distinguish between data and garbage
sprintf(fileName,"Ev%dSPDslice%d",eventNumber,sliceNumber); //The name of the output file. There are as many slides as the number of LDC
#ifndef __DECCXX
#else
outfile.open(fileName);
#endif
- ULong_t miniHeader[3];
- Int_t miniHeaderSize=sizeof(ULong_t)*3;
+ UInt_t miniHeader[3];
+ Int_t miniHeaderSize=sizeof(UInt_t)*3;
Int_t version=1; //version of the mini header
//loop over DDLs
for(Int_t i=0;i<kDDLsNumber;i++){
//For each Module, buf contains the array of data words in Binary format
//fIndex gives the number of 32 bits words in the buffer for each module
GetDigitsSPD(digitsInITS,mapSPD[i][mod],i,buf);
- outfile.write((char *)buf,((fIndex+1)*sizeof(ULong_t)));
+ outfile.write((char *)buf,((fIndex+1)*sizeof(UInt_t)));
for(Int_t i=0;i<(fIndex+1);i++){
buf[i]=0;
}//end for
}//end for
//Write REAL MINI HEADER
- ULong_t currentFilePosition=outfile.tellp();
+ UInt_t currentFilePosition=outfile.tellp();
outfile.seekp(miniHeaderPosition);
size=currentFilePosition-miniHeaderPosition-miniHeaderSize;
- outfile.write((char*)(&size),sizeof(ULong_t));
+ outfile.write((char*)(&size),sizeof(UInt_t));
outfile.seekp(currentFilePosition);
if(countDDL==ddlsPerFile){
outfile.close();
Int_t countDDL=0;
Int_t sliceNumber=1;
const Int_t kSize=1536;//768*2 Number of stripe * number of sides(N and P)
- ULong_t buf[kSize];
+ UInt_t buf[kSize];
fIndex=-1;
Int_t nbytes = 0;
TClonesArray *digitsInITS = ITS->DigitsAddress(subd);
char fileName[15];
- ULong_t miniHeaderPosition=0; //variable used to store the position of the Mini Header inside the file
+ UInt_t miniHeaderPosition=0; //variable used to store the position of the Mini Header inside the file
ofstream outfile; // logical name of the output file
Int_t flag=0; // 0==> Uncompressed data 1==>Compressed Data
Int_t detector=3; // 1==>ITS (Pixel) 2==>ITS (Drift) 3==>ITS (Strip) 0==>TPC ......
- ULong_t size=0; // size of the data block that follows the mini header
+ UInt_t size=0; // size of the data block that follows the mini header
Int_t magicWord=0x123456; // Magic word used to distinguish between data and garbage
sprintf(fileName,"Ev%dSSDslice%d",eventNumber,sliceNumber); //The name of the output file. There are as many slides as the number of LDC
#ifndef __DECCXX
#else
outfile.open(fileName);
#endif
- ULong_t miniHeader[3];
- Int_t miniHeaderSize=sizeof(ULong_t)*3;
+ UInt_t miniHeader[3];
+ Int_t miniHeaderSize=sizeof(UInt_t)*3;
Int_t version=1; //version of the mini header
//loop over DDLs
//For each Module, buf contains the array of data words in Binary format
//fIndex gives the number of 32 bits words in the buffer for each module
GetDigitsSSD(digitsInITS,mod,mapSSD[i][mod],i,buf);
- outfile.write((char *)buf,((fIndex+1)*sizeof(ULong_t)));
+ outfile.write((char *)buf,((fIndex+1)*sizeof(UInt_t)));
for(Int_t i=0;i<(fIndex+1);i++){
buf[i]=0;
}//end for
}//end if
}//end for
//Write REAL MINI HEADER
- ULong_t currentFilePosition=outfile.tellp();
+ UInt_t currentFilePosition=outfile.tellp();
outfile.seekp(miniHeaderPosition);
size=currentFilePosition-miniHeaderPosition-miniHeaderSize;
- outfile.write((char*)(&size),sizeof(ULong_t));
+ outfile.write((char*)(&size),sizeof(UInt_t));
outfile.seekp(currentFilePosition);
if(countDDL==ddlsPerFile){
outfile.close();
Int_t countDDL=0;
Int_t sliceNumber=1;
const Int_t kSize=131072; //256*512
- ULong_t buf[kSize];
+ UInt_t buf[kSize];
fIndex=-1;
Int_t nbytes = 0;
TClonesArray *digitsInITS = ITS->DigitsAddress(subd);
char fileName[15];
- ULong_t miniHeaderPosition=0; // variable used to store the position of the Mini Header inside a file
+ UInt_t miniHeaderPosition=0; // variable used to store the position of the Mini Header inside a file
ofstream outfile; // logical name of the output file
Int_t flag=0; // 0==> Uncompressed data 1==>Compressed Data
Int_t detector=2; // 1==>ITS (Pixel) 2==>ITS (Drift) 3==>ITS (Strip) 0==>TPC ......
- ULong_t size=0; // size of the data block that follows the mini header
+ UInt_t size=0; // size of the data block that follows the mini header
Int_t magicWord=0x123456; // Magic word used to distinguish between data and garbage
sprintf(fileName,"Ev%dSDDslice%d",eventNumber,sliceNumber); //The name of the output file. There are as many slides as the number of LDC
#ifndef __DECCXX
#else
outfile.open(fileName);
#endif
- ULong_t miniHeader[3];
- Int_t miniHeaderSize=sizeof(ULong_t)*3;
+ UInt_t miniHeader[3];
+ Int_t miniHeaderSize=sizeof(UInt_t)*3;
Int_t version=1; //version of the mini header
//loop over DDLs
for(Int_t i=0;i<kDDLsNumber;i++){
//fIndex gives the number of 32 bits words in the buffer for each module
// cout<<"MODULE NUMBER:"<<mapSDD[i][mod]<<endl;
GetDigitsSDD(digitsInITS,mod,mapSDD[i][mod],i,buf);
- outfile.write((char *)buf,((fIndex+1)*sizeof(ULong_t)));
+ outfile.write((char *)buf,((fIndex+1)*sizeof(UInt_t)));
for(Int_t i=0;i<(fIndex+1);i++){
buf[i]=0;
}//end for
}//end for
//Write REAL MINI HEADER
- ULong_t currentFilePosition=outfile.tellp();
+ UInt_t currentFilePosition=outfile.tellp();
outfile.seekp(miniHeaderPosition);
size=currentFilePosition-miniHeaderPosition-miniHeaderSize;
- outfile.write((char*)(&size),sizeof(ULong_t));
+ outfile.write((char*)(&size),sizeof(UInt_t));
outfile.seekp(currentFilePosition);
if(countDDL==ddlsPerFile){
outfile.close();
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-void AliITSDDLRawData::WriteChipHeader(Int_t ChipAddr,Int_t EventCnt,ULong_t &BaseWord){
+void AliITSDDLRawData::WriteChipHeader(Int_t ChipAddr,Int_t EventCnt,UInt_t &BaseWord){
//This method writes a chip header
//cout<<"Chip: "<<ChipAddr<<" Half Stave module:"<<EventCnt<<endl;
BaseWord=0;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-void AliITSDDLRawData::ReadChipHeader(Int_t &ChipAddr,Int_t &EventCnt,ULong_t BaseWord){
+void AliITSDDLRawData::ReadChipHeader(Int_t &ChipAddr,Int_t &EventCnt,UInt_t BaseWord){
//This method reads a chip header
- ULong_t temp=0;
+ UInt_t temp=0;
UnpackWord(BaseWord,0,3,temp);
ChipAddr=(Int_t)temp;
UnpackWord(BaseWord,4,10,temp);
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-void AliITSDDLRawData::WriteChipTrailer(ULong_t *buf,Int_t ChipHitCount,ULong_t &BaseWord){
+void AliITSDDLRawData::WriteChipTrailer(UInt_t *buf,Int_t ChipHitCount,UInt_t &BaseWord){
//This method writes a chip trailer
//pixel fill word
if((ChipHitCount%2)!=0){
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-void AliITSDDLRawData::ReadChipTrailer(Int_t &ChipHitCount,ULong_t BaseWord){
+void AliITSDDLRawData::ReadChipTrailer(Int_t &ChipHitCount,UInt_t BaseWord){
//This method reads a chip trailer
- ULong_t temp=0;
+ UInt_t temp=0;
UnpackWord(BaseWord,16,28,temp);
ChipHitCount=(Int_t)temp;
return;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-void AliITSDDLRawData::WriteHit(ULong_t *buf,Int_t RowAddr,Int_t HitAddr,ULong_t &BaseWord){
+void AliITSDDLRawData::WriteHit(UInt_t *buf,Int_t RowAddr,Int_t HitAddr,UInt_t &BaseWord){
//This method writs an hit
if(!BaseWord){
PackWord(BaseWord,HitAddr,0,4);
ifstream f;
Int_t ldcsNumber=2;
ofstream ftxt("File2.txt");
- ULong_t size=0;
+ UInt_t size=0;
char filename[15];
- ULong_t ddlsNumber=0;
- ULong_t miniHeader[3];
- Int_t miniHeaderSize=sizeof(ULong_t)*3;
+ UInt_t ddlsNumber=0;
+ UInt_t miniHeader[3];
+ Int_t miniHeaderSize=sizeof(UInt_t)*3;
for(Int_t i=1;i<=ldcsNumber;i++){
sprintf(filename,"Ev%dSPDslice%d",eventNumber,i);
#ifndef __DECCXX
size=miniHeader[0];
UnpackWord(miniHeader[2],16,31,ddlsNumber);
//ftxt<<"DDL NUMBER:"<<ddlsNumber<<endl;
- ULong_t word=0;
- ULong_t codeH,codeL=0;
- ULong_t chip=0;
- ULong_t half=0;
- ULong_t col=0;
- ULong_t row=0;
+ UInt_t word=0;
+ UInt_t codeH,codeL=0;
+ UInt_t chip=0;
+ UInt_t half=0;
+ UInt_t col=0;
+ UInt_t row=0;
Int_t moduleID=0;
- ULong_t hitscount=0;
+ UInt_t hitscount=0;
Int_t previous=-1;
- for(ULong_t j=0;j<(size/4);j++){
+ for(UInt_t j=0;j<(size/4);j++){
f.read((char*)(&word),sizeof(word)); //32 bits word
UnpackWord(word,30,31,codeH);
UnpackWord(word,14,15,codeL);
void SetVerbose(Int_t Verbose){fVerbose=Verbose;}
// To set the verbose level
private:
- void GetDigitsSPD(TClonesArray *ITSdigits, Int_t mod,Int_t ddl,ULong_t *buf);
+ void GetDigitsSPD(TClonesArray *ITSdigits, Int_t mod,Int_t ddl,UInt_t *buf);
//This method formats and stores in buf all the digits of a SPD module
- void GetDigitsSDD(TClonesArray *ITSdigits, Int_t mod,Int_t modR,Int_t ddl,ULong_t *buf);
+ void GetDigitsSDD(TClonesArray *ITSdigits, Int_t mod,Int_t modR,Int_t ddl,UInt_t *buf);
//This method formats and stores in buf all the digits of a SDD module
- void GetDigitsSSD(TClonesArray *ITSdigits, Int_t mod,Int_t modR,Int_t ddl,ULong_t *buf);
+ void GetDigitsSSD(TClonesArray *ITSdigits, Int_t mod,Int_t modR,Int_t ddl,UInt_t *buf);
//This method formats and stores in buf all the digits of a SSD module
- void PackWord(ULong_t &BaseWord, ULong_t Word, Int_t StartBit, Int_t StopBit);
+ void PackWord(UInt_t &BaseWord, UInt_t Word, Int_t StartBit, Int_t StopBit);
//This method stores the value of the variable Word of StopBit-StartBit+1 bits
//in BaseWord, starting from the bit StartBit
- void UnpackWord(ULong_t PackedWord, Int_t StartBit, Int_t StopBit, ULong_t &Word);
+ void UnpackWord(UInt_t PackedWord, Int_t StartBit, Int_t StopBit, UInt_t &Word);
//This method extracts a group of adjacent bits, specified by StartBit and StopBit,
//from the word PackedWord. The resulting word is saved in the Word variable
- void WriteChipHeader(Int_t ChipAddr,Int_t EventCnt,ULong_t &BaseWord);
- void WriteChipTrailer(ULong_t *buf,Int_t ChipHitCount,ULong_t &BaseWord);
- void WriteHit(ULong_t *buf,Int_t RowAddr,Int_t HitAddr,ULong_t &BaseWord);
+ void WriteChipHeader(Int_t ChipAddr,Int_t EventCnt,UInt_t &BaseWord);
+ void WriteChipTrailer(UInt_t *buf,Int_t ChipHitCount,UInt_t &BaseWord);
+ void WriteHit(UInt_t *buf,Int_t RowAddr,Int_t HitAddr,UInt_t &BaseWord);
//The three previous methods are used to store the data according to the
//Silicon pixel detector data format
- void ReadChipHeader(Int_t &ChipAddr,Int_t &EventCnt,ULong_t BaseWord);
- void ReadChipTrailer(Int_t &ChipHitCount,ULong_t BaseWord);
+ void ReadChipHeader(Int_t &ChipAddr,Int_t &EventCnt,UInt_t BaseWord);
+ void ReadChipTrailer(Int_t &ChipHitCount,UInt_t BaseWord);
//Methods used for reading and dubugging SPD data files
Int_t fVerbose; //Verbose level (0:no msg, 1:msg, 2:digits in txt files)
- Long_t fIndex; //number of 32 words to be stored into the output file
+ Int_t fIndex; //number of 32 words to be stored into the output file
Int_t fHalfStaveModule; //first or second half of an Half Stave module
ClassDef(AliITSDDLRawData,1)
};
//A new Buffer is read from the file only when Buffer is empty.
//If there aren't elements anymore -1 is returned otherwise
//the next element is returned
- ULong_t mask=0xFFC00000;
- ULong_t temp;
- ULong_t value;
+ UInt_t mask=0xFFC00000;
+ UInt_t temp;
+ UInt_t value;
if (!fShift){
if (f->tellg()>=(Int_t)fFileEnd) return -1;
- if ( f->read((char*)fBuffer,sizeof(ULong_t)*5) ){
+ if ( f->read((char*)fBuffer,sizeof(UInt_t)*5) ){
fCurrentCell=0;
fShift=22;
value=fBuffer[fCurrentCell]&mask;
//A new Buffer is read from the file only when Buffer is empty.
//If there aren't elements anymore -1 is returned otherwise
//the next element is returned
- ULong_t mask=0x3FF;
- ULong_t temp;
- ULong_t value;
+ UInt_t mask=0x3FF;
+ UInt_t temp;
+ UInt_t value;
if (!fShift){
if (fFilePosition>fMiniHeaderPos){
- fFilePosition-=sizeof(ULong_t)*5;
+ fFilePosition-=sizeof(UInt_t)*5;
f->seekg(fFilePosition);
- f->read((char*)fBuffer,sizeof(ULong_t)*5);
+ f->read((char*)fBuffer,sizeof(UInt_t)*5);
//cout<<"Buffer letto"<<endl;
/*
cout<<2<<" --- "<<hex<<fBuffer[2]<<dec<<endl;
cout<<3<<" --- "<<hex<<fBuffer[3]<<dec<<endl;
cout<<4<<" --- "<<hex<<fBuffer[4]<<dec<<endl;
- cout<<"Fine ULong_t"<<endl;
+ cout<<"Fine UInt_t"<<endl;
*/
fCurrentCell=4;
fShift=22;
fBuffer[fCurrentCell]|=Val;
if(!fShift){
//Buffer is written into a file
- f->write((char*)fBuffer,sizeof(ULong_t)*5);
+ f->write((char*)fBuffer,sizeof(UInt_t)*5);
//Buffer is empty
for(Int_t j=0;j<5;j++)fBuffer[j]=0;
fShift=32;
return 0;
}
-void AliTPCBuffer160::WriteMiniHeader(ULong_t Size,Int_t SecNumber,Int_t SubSector,Int_t Detector,Int_t Flag ){
+void AliTPCBuffer160::WriteMiniHeader(UInt_t Size,Int_t SecNumber,Int_t SubSector,Int_t Detector,Int_t Flag ){
//Size msg errore sector number sub-sector number 0 for TPC 0 for uncompressed
Int_t ddlNumber;
- ULong_t miniHeader[3];
+ UInt_t miniHeader[3];
Int_t version=1;
if(SecNumber<36)
ddlNumber=SecNumber*2+SubSector;
ddlNumber=72+(SecNumber-36)*4+SubSector;
// cout<<"DDL number "<<ddlNumber<<endl;
for(Int_t i=0;i<3;i++)miniHeader[i]=0;
- Int_t miniHeaderSize=(sizeof(ULong_t))*3;
+ Int_t miniHeaderSize=(sizeof(UInt_t))*3;
PackWord(miniHeader[1],Detector,0,7);
PackWord(miniHeader[1],0x123456,8,31);
PackWord(miniHeader[2],version,0,7);
f->write((char*)(miniHeader),miniHeaderSize);
}//end if
else{
- ULong_t currentFilePos=f->tellp();
+ UInt_t currentFilePos=f->tellp();
f->seekp(fMiniHeaderPos);
Size=currentFilePos-fMiniHeaderPos-miniHeaderSize;
//cout<<"Current Position (Next MH) "<<currentFilePos<<" Position of the MH:"<<fMiniHeaderPos<<" Size:"<<Size<<endl;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-void AliTPCBuffer160::PackWord(ULong_t &BaseWord, ULong_t Word, Int_t StartBit, Int_t StopBit){
+void AliTPCBuffer160::PackWord(UInt_t &BaseWord, UInt_t Word, Int_t StartBit, Int_t StopBit){
//Packs a word into the BaseWord buffer from StartBit bit up to StopBit bit
- ULong_t dummyWord,offSet;
+ UInt_t dummyWord,offSet;
Int_t length;
- ULong_t sum;
+ UInt_t sum;
//The BaseWord is being filled with 1 from StartBit to StopBit
length=StopBit-StartBit+1;
- sum=(ULong_t)TMath::Power(2,length)-1;
+ sum=(UInt_t)TMath::Power(2,length)-1;
if(Word > sum){
cout<<"WARNING::Word to be filled is not within desired length"<<endl;
exit(-1);
BaseWord=BaseWord|offSet;
//The Word to be filled is shifted to the position StartBit
//and the remaining Left and Right bits are filled with 1
- sum=(ULong_t)TMath::Power(2,StartBit)-1;
+ sum=(UInt_t)TMath::Power(2,StartBit)-1;
dummyWord=0xFFFFFFFF<<length;
dummyWord +=Word;
dummyWord<<=StartBit;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-void AliTPCBuffer160::UnpackWord(ULong_t PackedWord, Int_t StartBit, Int_t StopBit, ULong_t &Word){
+void AliTPCBuffer160::UnpackWord(UInt_t PackedWord, Int_t StartBit, Int_t StopBit, UInt_t &Word){
//Unpacks a word of StopBit-StartBit+1 bits from PackedWord buffer starting from the position
//indicated by StartBit
- ULong_t offSet;
+ UInt_t offSet;
Int_t length;
length=StopBit-StartBit+1;
- offSet=(ULong_t)TMath::Power(2,length)-1;
+ offSet=(UInt_t)TMath::Power(2,length)-1;
offSet<<=StartBit;
Word=PackedWord&offSet;
Word>>=StartBit;
//this method is used to read the trailer when the file is read forward
Int_t ReadTrailerBackward(Int_t &WordsNumber,Int_t &PadNumber,Int_t &RowNumber,Int_t &SecNumber);
//this method is used to read the trailer when the file is read backward
- void WriteMiniHeader(ULong_t Size,Int_t SecNumber,Int_t SubSector,Int_t Detector,Int_t Flag );
+ void WriteMiniHeader(UInt_t Size,Int_t SecNumber,Int_t SubSector,Int_t Detector,Int_t Flag );
//this method is used to write the Mini header
void SetVerbose(Int_t val){fVerbose=val;}
//this method is used to set the verbose level
//this method is used to fill the buffer with 2AA hexadecimal value and save it into the output file
Int_t GetFillWordsNum()const{return fEndingFillWords;}
private:
- void PackWord(ULong_t &BaseWord, ULong_t Word, Int_t StartBit, Int_t StopBit);
+ void PackWord(UInt_t &BaseWord, UInt_t Word, Int_t StartBit, Int_t StopBit);
//this method is used to pack bits into a word of 32 bits
- void UnpackWord(ULong_t PackedWord, Int_t StartBit, Int_t StopBit, ULong_t &Word);
+ void UnpackWord(UInt_t PackedWord, Int_t StartBit, Int_t StopBit, UInt_t &Word);
//this method is used to read a precise number of bits from a word of 32 bits
- ULong_t fBuffer[5]; //Buffer dimension is 32*5=160 bits and it contains 16 values
+ UInt_t fBuffer[5]; //Buffer dimension is 32*5=160 bits and it contains 16 values
//A value is never splitted in two Buffer
fstream* f; //logical name of the I/O file
Bool_t fCreated; //true if f was created by the buffer
Int_t fMaskBackward; //bit mask for backward reading of a file
- ULong_t fFilePosition;//'pointer' to the actual position in the file
- ULong_t fFileEnd; //position of the last element of the file (File dimension)
- ULong_t fMiniHeaderPos;//Mini header position
+ UInt_t fFilePosition;//'pointer' to the actual position in the file
+ UInt_t fFileEnd; //position of the last element of the file (File dimension)
+ UInt_t fMiniHeaderPos;//Mini header position
Int_t fEndingFillWords;//Few words at the end of the stream
ClassDef(AliTPCBuffer160,1)
};
//////////////////////////////////////////////////////////////////////////////////////////////////
AliTPCCompression::AliTPCCompression(){
//Defaul constructor
- fDimBuffer=sizeof(ULong_t)*8;
+ fDimBuffer=sizeof(UInt_t)*8;
fFreeBitsBuffer=fDimBuffer;
fReadBits=0;
fPos=0;
Int_t AliTPCCompression::FillTables(const char* fSource,AliTPCHTable* table[],const Int_t /*NumTables*/){
//This method is used to compute the frequencies of the symbols in the source file
AliTPCBuffer160 buff(fSource,0);
- ULong_t countWords=0;
- ULong_t countTrailer=0;
+ UInt_t countWords=0;
+ UInt_t countTrailer=0;
Int_t numWords,padNum,rowNum,secNum=0;
Int_t value=0;
- ULong_t stat[5]={0,0,0,0,0};
+ UInt_t stat[5]={0,0,0,0,0};
Int_t endFill=0;
Int_t end=1;
while(buff.ReadTrailerBackward(numWords,padNum,rowNum,secNum) !=-1 ){
fStat<<"Number of Central Samples....."<<stat[3]<<endl;
fStat<<"Number of Border Samples......"<<stat[4]<<endl;
fStat<<"-----------------------------------------"<<endl;
- ULong_t fileDimension=(ULong_t)TMath::Ceil(double((countTrailer*4+countWords+fFillWords+endFill)*10/8));
+ UInt_t fileDimension=(UInt_t)TMath::Ceil(double((countTrailer*4+countWords+fFillWords+endFill)*10/8));
fStat<<"Total file Size in bytes.."<<fileDimension<<endl;
Double_t percentage=TMath::Ceil((fFillWords+endFill)*125)/fileDimension;
- fStat<<"Fill Words................"<<(ULong_t)TMath::Ceil((fFillWords+endFill)*10/8)<<" bytes "<<percentage<<"%"<<endl;
+ fStat<<"Fill Words................"<<(UInt_t)TMath::Ceil((fFillWords+endFill)*10/8)<<" bytes "<<percentage<<"%"<<endl;
percentage=(Double_t)countTrailer*500/fileDimension;
fStat<<"Trailer..................."<<countTrailer*5<<" bytes "<<percentage<<"%"<<endl;
percentage=(Double_t)((stat[0]+stat[1]+stat[2]+stat[3]+stat[4])) *125/fileDimension;
- fStat<<"Data......................"<<(ULong_t)TMath::Ceil((stat[0]+stat[1]+stat[2]+stat[3]+stat[4])*10/8)<<" bytes "<<percentage<<"%"<<endl;
+ fStat<<"Data......................"<<(UInt_t)TMath::Ceil((stat[0]+stat[1]+stat[2]+stat[3]+stat[4])*10/8)<<" bytes "<<percentage<<"%"<<endl;
percentage=(Double_t)(stat[0]*125)/fileDimension;
- fStat<<"Bunch....................."<<(ULong_t)TMath::Ceil(stat[0]*10/8)<<" bytes "<<percentage<<"%"<<endl; //
+ fStat<<"Bunch....................."<<(UInt_t)TMath::Ceil(stat[0]*10/8)<<" bytes "<<percentage<<"%"<<endl; //
percentage=(Double_t)(stat[1]*125)/fileDimension;
- fStat<<"Time......................"<<(ULong_t)TMath::Ceil(stat[1]*10/8)<<" bytes "<<percentage<<"%"<<endl; //
+ fStat<<"Time......................"<<(UInt_t)TMath::Ceil(stat[1]*10/8)<<" bytes "<<percentage<<"%"<<endl; //
percentage=(Double_t)((stat[2]+stat[3]+stat[4])) *125/fileDimension;
- fStat<<"Amplitude values.........."<<(ULong_t)TMath::Ceil((stat[2]+stat[3]+stat[4])*10/8)<<" bytes "<<percentage<<"%"<<endl;
+ fStat<<"Amplitude values.........."<<(UInt_t)TMath::Ceil((stat[2]+stat[3]+stat[4])*10/8)<<" bytes "<<percentage<<"%"<<endl;
percentage=(Double_t)(stat[2]*125)/fileDimension;
- fStat<<" One Samples..............."<<(ULong_t)TMath::Ceil(stat[2]*10/8)<<" bytes "<<percentage<<"%"<<endl; //
+ fStat<<" One Samples..............."<<(UInt_t)TMath::Ceil(stat[2]*10/8)<<" bytes "<<percentage<<"%"<<endl; //
percentage=(Double_t)(stat[3]*125)/fileDimension;
- fStat<<" Central Samples..........."<<(ULong_t)TMath::Ceil(stat[3]*10/8)<<" bytes "<<percentage<<"%"<<endl; //
+ fStat<<" Central Samples..........."<<(UInt_t)TMath::Ceil(stat[3]*10/8)<<" bytes "<<percentage<<"%"<<endl; //
percentage=(Double_t)(stat[4]*125)/fileDimension;
- fStat<<" Border Samples............"<<(ULong_t)TMath::Ceil(stat[4]*10/8)<<" bytes "<<percentage<<"%"<<endl; //
+ fStat<<" Border Samples............"<<(UInt_t)TMath::Ceil(stat[4]*10/8)<<" bytes "<<percentage<<"%"<<endl; //
fStat.close();
return 0;
}
//One table is written into a file
for(Int_t i=0;i<dim;i++){
UChar_t codeLen=table[k]->CodeLen()[i];
- // ULong_t code=(ULong_t)table[k]->Code()[i];
+ // UInt_t code=(UInt_t)table[k]->Code()[i];
Double_t code=table[k]->Code()[i];
fTable.write((char*)(&codeLen),sizeof(UChar_t));
- //fTable.write((char*)(&code),sizeof(ULong_t));
+ //fTable.write((char*)(&code),sizeof(UInt_t));
fTable.write((char*)(&code),sizeof(Double_t));
} //end for
fTable.close();
return 0;
}
////////////////////////////////////////////////////////////////////////////////////////
-Int_t AliTPCCompression::CreateTableFormula(Double_t beta,ULong_t M,Int_t dim,Int_t Type){
+Int_t AliTPCCompression::CreateTableFormula(Double_t beta,UInt_t M,Int_t dim,Int_t Type){
// Type = 0 for Bunch length
// Type = 1 for Time Gap
- ULong_t freq;
+ UInt_t freq;
Double_t sum=0;
Double_t min=10;
Double_t alpha=0;
//This method retrieve the Huffman tables from a sequence of binary files
if (fVerbose)
cout<<"Retrieving tables from files \n";
- // ULong_t code;
+ // UInt_t code;
Double_t code;
UChar_t codeLen;
ifstream fTable;
for(Int_t i=0;i<dim;i++){
fTable.read((char*)(&codeLen),sizeof(UChar_t));
table[k]->SetCodeLen(codeLen,i);
- // fTable.read((char*)(&code),sizeof(ULong_t));
+ // fTable.read((char*)(&code),sizeof(UInt_t));
fTable.read((char*)(&code),sizeof(Double_t));
- table[k]->SetCode(Mirror((ULong_t)code,codeLen),i);
+ table[k]->SetCode(Mirror((UInt_t)code,codeLen),i);
}//end for
fTable.close();
}//end for
/* COMPRESSION */
////////////////////////////////////////////////////////////////////////////////////////
-void AliTPCCompression::StoreValue(ULong_t val,UChar_t len){
+void AliTPCCompression::StoreValue(UInt_t val,UChar_t len){
//This method stores the value "val" of "len" bits into the internal buffer "fBuffer"
if (len<=fFreeBitsBuffer){ // val is not splitted in two buffer
fFreeBitsBuffer-=len;
fBuffer=fBuffer<<len;
fBuffer=fBuffer|val;
if(!fFreeBitsBuffer){ // if the buffer is full it is written into a file
- f.write((char*)(&fBuffer),sizeof(ULong_t));
+ f.write((char*)(&fBuffer),sizeof(UInt_t));
fFreeBitsBuffer=fDimBuffer;
fBuffer=0;
}
}//end if
else{ //val has to be splitted in two buffers
fBuffer=fBuffer<<fFreeBitsBuffer;
- ULong_t temp;
+ UInt_t temp;
temp=val;
temp=temp>>(len-fFreeBitsBuffer);
fBuffer=fBuffer|temp;
- f.write((char*)(&fBuffer),sizeof(ULong_t));
+ f.write((char*)(&fBuffer),sizeof(UInt_t));
fFreeBitsBuffer=fDimBuffer-(len-fFreeBitsBuffer);
val=val<<fFreeBitsBuffer;
val=val>>fFreeBitsBuffer;
//into the output file it is first necessary to fill it with an hexadecimal pattern
if(fFreeBitsBuffer<fDimBuffer){
fBuffer=fBuffer<<fFreeBitsBuffer;
- f.write((char*)(&fBuffer),sizeof(ULong_t));
+ f.write((char*)(&fBuffer),sizeof(UInt_t));
}//end if
return;
}
//////////////////////////////////////////////////////////////////////////////////////////////////
-ULong_t AliTPCCompression::Mirror(ULong_t val,UChar_t len)const{
+UInt_t AliTPCCompression::Mirror(UInt_t val,UChar_t len)const{
//This method inverts the digits of the number "val" and length "len"
//indicates the number of digits of the number considered in binary notation
- ULong_t specular=0;
- ULong_t mask=0x1;
- ULong_t bit;
+ UInt_t specular=0;
+ UInt_t mask=0x1;
+ UInt_t bit;
for(Int_t i=0;i<len;i++){
bit=val&mask;
bit=bit>>i;
AliTPCBuffer160 buff(fSource,0);
//coded words are written into a file
Int_t numWords,padNum,rowNum,secNum=0;
- ULong_t storedWords=0;
+ UInt_t storedWords=0;
Int_t value=0;
- ULong_t numPackets=0;
+ UInt_t numPackets=0;
Double_t stat[5]={0.,0.,0.,0.,0.};
- ULong_t trailerNumbers=0;
+ UInt_t trailerNumbers=0;
Double_t numElem[5]={0,0,0,0,0};
Double_t fillWords=0.;
fStat.open("Statistics",ios::app);
value=packet[i];
if(nextTableType==1)timeBin=value;
if(nextTableType>1){
- //ULong_t val=(ULong_t)table[nextTableType]->Code()[value]; // val is the code
+ //UInt_t val=(UInt_t)table[nextTableType]->Code()[value]; // val is the code
Double_t val=table[nextTableType]->Code()[value]; // val is the code
UChar_t len=table[nextTableType]->CodeLen()[value]; // len is the length (number of bits)of val
stat[nextTableType]+=len;
numElem[nextTableType]++;
- StoreValue((ULong_t)val,len);
+ StoreValue((UInt_t)val,len);
storedWords++;
}//end if
NextTable(value,nextTableType,bunchLen,count);
if(nextTableType==0){
- // ULong_t val=(ULong_t)table[1]->Code()[timeBin]; // val is the code
+ // UInt_t val=(UInt_t)table[1]->Code()[timeBin]; // val is the code
Double_t val=table[1]->Code()[timeBin]; // val is the code
UChar_t len=table[1]->CodeLen()[timeBin]; // len is the length (number of bits)of val
stat[1]+=len;
numElem[1]++;
- StoreValue((ULong_t)val,len);
- // val=(ULong_t)table[nextTableType]->Code()[(bunchLen+2)]; // val is the code
+ StoreValue((UInt_t)val,len);
+ // val=(UInt_t)table[nextTableType]->Code()[(bunchLen+2)]; // val is the code
val=table[nextTableType]->Code()[(bunchLen+2)]; // val is the code
len=table[nextTableType]->CodeLen()[(bunchLen+2)]; // len is the length (number of bits)of val
- StoreValue((ULong_t)val,len);
+ StoreValue((UInt_t)val,len);
stat[nextTableType]+=len;
numElem[nextTableType]++;
storedWords+=2;
delete table[i];
}//end for
delete [] table;
- Double_t dimension=(ULong_t)TMath::Ceil((stat[0]+stat[1]+stat[2]+stat[3]+stat[4])/8)+trailerNumbers*5;
+ Double_t dimension=(UInt_t)TMath::Ceil((stat[0]+stat[1]+stat[2]+stat[3]+stat[4])/8)+trailerNumbers*5;
fStat<<"Trailer Dimension in bytes......"<<trailerNumbers*5<<endl;
- fStat<<"Data Dimension in bytes........."<<(ULong_t)TMath::Ceil((stat[0]+stat[1]+stat[2]+stat[3]+stat[4])/8)<<endl;
- fStat<<"Compressed file dimension......."<<(ULong_t)dimension<<endl;
+ fStat<<"Data Dimension in bytes........."<<(UInt_t)TMath::Ceil((stat[0]+stat[1]+stat[2]+stat[3]+stat[4])/8)<<endl;
+ fStat<<"Compressed file dimension......."<<(UInt_t)dimension<<endl;
/*
- fStat<<(ULong_t)trailerNumbers<<endl;
- fStat<<(ULong_t)fillWords<<endl;
- fStat<<(ULong_t)numElem[0]<<endl;
- fStat<<(ULong_t)numElem[1]<<endl;
- fStat<<(ULong_t)numElem[2]<<endl;
- fStat<<(ULong_t)numElem[3]<<endl;
- fStat<<(ULong_t)numElem[4]<<endl;
+ fStat<<(UInt_t)trailerNumbers<<endl;
+ fStat<<(UInt_t)fillWords<<endl;
+ fStat<<(UInt_t)numElem[0]<<endl;
+ fStat<<(UInt_t)numElem[1]<<endl;
+ fStat<<(UInt_t)numElem[2]<<endl;
+ fStat<<(UInt_t)numElem[3]<<endl;
+ fStat<<(UInt_t)numElem[4]<<endl;
*/
fillWords=(fillWords+numElem[0]+numElem[1]+numElem[2]+numElem[3]+numElem[4]+trailerNumbers*4)*10/8;
- fStat<<"Original file dimension........."<<(ULong_t)fillWords<<endl;
+ fStat<<"Original file dimension........."<<(UInt_t)fillWords<<endl;
Double_t ratio=(dimension/fillWords)*100;
fStat<<"Compression ratio (Compressed/Uncompressed)..."<<ratio<<"%"<<endl;
fStat<<endl;
if (numElem[0])
- fStat<<"Bunch length size in bytes......"<<(ULong_t)TMath::Ceil(stat[0]/8)<<" Comppression.."<<(stat[0]/numElem[0])*10<<"%"<<endl;
+ fStat<<"Bunch length size in bytes......"<<(UInt_t)TMath::Ceil(stat[0]/8)<<" Comppression.."<<(stat[0]/numElem[0])*10<<"%"<<endl;
if (numElem[1])
- fStat<<"Time gap size in bytes.........."<<(ULong_t)TMath::Ceil(stat[1]/8)<<" Comppression.."<<(stat[1]/numElem[1])*10<<"%"<<endl;
+ fStat<<"Time gap size in bytes.........."<<(UInt_t)TMath::Ceil(stat[1]/8)<<" Comppression.."<<(stat[1]/numElem[1])*10<<"%"<<endl;
if (numElem[2]+numElem[3]+numElem[4])
- fStat<<"Amplitude values in bytes......."<<(ULong_t)TMath::Ceil((stat[2]+stat[3]+stat[4])/8)<<" Comppression.."<<
+ fStat<<"Amplitude values in bytes......."<<(UInt_t)TMath::Ceil((stat[2]+stat[3]+stat[4])/8)<<" Comppression.."<<
((stat[2]+stat[3]+stat[4])/(numElem[2]+numElem[3]+numElem[4]))*10<<"%"<<endl;
if (numElem[2])
- fStat<<" One Samples in bytes............"<<(ULong_t)TMath::Ceil(stat[2]/8)<<" Comppression.."<<(stat[2]/numElem[2])*10<<"%"<<endl;
+ fStat<<" One Samples in bytes............"<<(UInt_t)TMath::Ceil(stat[2]/8)<<" Comppression.."<<(stat[2]/numElem[2])*10<<"%"<<endl;
if (numElem[3])
- fStat<<" Central Samples size in bytes..."<<(ULong_t)TMath::Ceil(stat[3]/8)<<" Comppression.."<<(stat[3]/numElem[3])*10<<"%"<<endl;
+ fStat<<" Central Samples size in bytes..."<<(UInt_t)TMath::Ceil(stat[3]/8)<<" Comppression.."<<(stat[3]/numElem[3])*10<<"%"<<endl;
if (numElem[4])
- fStat<<" Border Samples size in bytes...."<<(ULong_t)TMath::Ceil(stat[4]/8)<<" Comppression.."<<(stat[4]/numElem[4])*10<<"%"<<endl;
+ fStat<<" Border Samples size in bytes...."<<(UInt_t)TMath::Ceil(stat[4]/8)<<" Comppression.."<<(stat[4]/numElem[4])*10<<"%"<<endl;
fStat<<endl;
fStat<<"Average number of bits per word"<<endl;
if (numElem[0])
if(fVerbose)
cout<<"Creating the Huffman trees \n";
AliTPCHNode *node=0;
- // ULong_t code;
+ // UInt_t code;
Double_t code;
UChar_t codeLen;
ifstream fTable;
//loop over the words of one table
for(Int_t i=0;i<dim;i++){
fTable.read((char*)(&codeLen),sizeof(UChar_t));
- //fTable.read((char*)(&code),sizeof(ULong_t));
+ //fTable.read((char*)(&code),sizeof(UInt_t));
fTable.read((char*)(&code),sizeof(Double_t));
node=RootNode[k];
for(Int_t j=1;j<=codeLen;j++){
- ULong_t bit,val=0;
- val=(ULong_t)TMath::Power(2,codeLen-j);
- bit=(ULong_t)code&val;
+ UInt_t bit,val=0;
+ val=(UInt_t)TMath::Power(2,codeLen-j);
+ bit=(UInt_t)code&val;
AliTPCHNode *temp=node;
if(bit){
node=node->GetRight();
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////
-ULong_t AliTPCCompression::ReadWord(Int_t NumberOfBit){
+UInt_t AliTPCCompression::ReadWord(Int_t NumberOfBit){
//This method retrieves a word of a specific number of bits from the file through the internal buffer
- ULong_t result=0;
- ULong_t bit=0;
+ UInt_t result=0;
+ UInt_t bit=0;
for (Int_t i=0;i<NumberOfBit;i++){
if (fReadBits==32){
- fPos-=sizeof(ULong_t);
+ fPos-=sizeof(UInt_t);
f.seekg(fPos);
- f.read((char*)(&fBuffer),sizeof(ULong_t));
+ f.read((char*)(&fBuffer),sizeof(UInt_t));
fReadBits=0;
}//end if
- ULong_t mask=0;
- mask=(ULong_t)TMath::Power(2,fReadBits);
+ UInt_t mask=0;
+ mask=(UInt_t)TMath::Power(2,fReadBits);
bit=fBuffer&mask;
bit=bit>>fReadBits;
fReadBits++;
return result;
}
//////////////////////////////////////////////////////////////////////////////////////////////////
-ULong_t AliTPCCompression::ReadWordBuffer(Int_t NumberOfBit){
+UInt_t AliTPCCompression::ReadWordBuffer(Int_t NumberOfBit){
//This method retrieves a word of a specific number of bits from the file through the buffer
- ULong_t result=0;
- ULong_t bit=0;
+ UInt_t result=0;
+ UInt_t bit=0;
for (Int_t i=0;i<NumberOfBit;i++){
if (fReadBits==32){
fPointBuffer-=8;
fBuffer=0;
for(Int_t i=0;i<4;i++){
- ULong_t val=0;
+ UInt_t val=0;
val=*fPointBuffer;
val&=0xFF;
fPointBuffer++;
}//end for
fReadBits=0;
}//end if
- ULong_t mask=0;
- mask=(ULong_t)TMath::Power(2,fReadBits);
+ UInt_t mask=0;
+ mask=(UInt_t)TMath::Power(2,fReadBits);
bit=fBuffer&mask;
bit=bit>>fReadBits;
fReadBits++;
return;
}
//////////////////////////////////////////////////////////////////////////////////////////////////
-ULong_t AliTPCCompression::GetDecodedWord(AliTPCHNode* root,Bool_t Memory){
+UInt_t AliTPCCompression::GetDecodedWord(AliTPCHNode* root,Bool_t Memory){
//This method retrieves a decoded word.
AliTPCHNode *node=root;
- ULong_t symbol=0;
+ UInt_t symbol=0;
Bool_t decoded=0;
while(!decoded){
- ULong_t bit=0;
+ UInt_t bit=0;
if(Memory)
bit=ReadWordBuffer(1);
else
f.seekg(0,ios::end);
//to get the file dimension in byte
fPos=f.tellg();
- fPos-=sizeof(ULong_t);
+ fPos-=sizeof(UInt_t);
f.seekg(fPos);
fReadBits=0;
fBuffer=0;
- f.read((char*)(&fBuffer),sizeof(ULong_t));
+ f.read((char*)(&fBuffer),sizeof(UInt_t));
Int_t bit=0;
- ULong_t mask=0x1;
+ UInt_t mask=0x1;
while(!bit){
bit=fBuffer&mask;
mask=mask<<1;
fReadBits++;
}
- ULong_t packetNumber=ReadWord(sizeof(ULong_t)*8);
+ UInt_t packetNumber=ReadWord(sizeof(UInt_t)*8);
if(fVerbose){
cout<<"Number of Packect: "<<packetNumber<<endl;
}
AliTPCBuffer160 bufferFile(fDest,1);
- ULong_t k=0;
- ULong_t wordsRead=0; //number of read coded words
+ UInt_t k=0;
+ UInt_t wordsRead=0; //number of read coded words
while(k<packetNumber){
Int_t numWords,padNumber,rowNumber,secNumber=0;
ReadTrailer(numWords,padNumber,rowNumber,secNumber,kFALSE);
Int_t bunchLen=0;
Int_t count=0;
for(Int_t i=0;i<numWords;i++){
- ULong_t symbol=GetDecodedWord(rootNode[nextTableType],kFALSE);
+ UInt_t symbol=GetDecodedWord(rootNode[nextTableType],kFALSE);
wordsRead++;
//Time reconstruction
if (nextTableType==1){
}
//////////////////////////////////////////////////////////////////////////////////////////////////
-Int_t AliTPCCompression::Decompress(AliTPCHNode *RootNode[],const Int_t /*NumTables*/,char* PointBuffer,ULong_t BufferSize,UShort_t out[],ULong_t &dim){
+Int_t AliTPCCompression::Decompress(AliTPCHNode *RootNode[],const Int_t /*NumTables*/,char* PointBuffer,UInt_t BufferSize,UShort_t out[],UInt_t &dim){
//This method decompress a file using separate Huffman tables
fPointBuffer=PointBuffer+BufferSize-4;
fBuffer=0;
for(Int_t i=0;i<4;i++){
- ULong_t val=0;
+ UInt_t val=0;
val=*fPointBuffer;
val&=0xFF;
fPointBuffer++;
fBuffer=fBuffer|val;
}//end for
Int_t bit=0;
- ULong_t mask=0x1;
+ UInt_t mask=0x1;
while(!bit){
bit=fBuffer&mask;
mask=mask<<1;
fReadBits++;
}//end while
- ULong_t packetNumber=ReadWordBuffer(sizeof(ULong_t)*8); //32 bits
+ UInt_t packetNumber=ReadWordBuffer(sizeof(UInt_t)*8); //32 bits
if (fVerbose){
cout<<"First one has been found "<<endl;
cout<<"Number of packets:"<<packetNumber<<endl;
}//end if
- ULong_t k=0;
- ULong_t wordsRead=0; //number of read coded words
+ UInt_t k=0;
+ UInt_t wordsRead=0; //number of read coded words
while(k<packetNumber){
Int_t numWords,padNumber,rowNumber,secNumber=0;
ReadTrailer(numWords,padNumber,rowNumber,secNumber,kTRUE);
Int_t count=0;
Int_t timeDigit=0;
for(Int_t i=0;i<numWords;i++){
- ULong_t symbol=GetDecodedWord(RootNode[nextTableType],kTRUE);
+ UInt_t symbol=GetDecodedWord(RootNode[nextTableType],kTRUE);
wordsRead++;
//Time reconstruction
if (nextTableType==1){
Int_t DecompressDataOptTables(Int_t NumTables,const char* fname,char* fDest="SourceDecompressed.dat");
//This method is used to decompress a file compressed using the CompressDataOptTable method
//It expects a set of table used for compressing the file in the same directory of the compressed file
- Int_t Decompress(AliTPCHNode *RootNode[],const Int_t NumTables,char* PointBuffer,ULong_t BufferSize,UShort_t out[],ULong_t &dim);
+ Int_t Decompress(AliTPCHNode *RootNode[],const Int_t NumTables,char* PointBuffer,UInt_t BufferSize,UShort_t out[],UInt_t &dim);
//This method is used to decompress data stored in a char* buffer
Int_t FillTables(const char* fSource,AliTPCHTable* table[],const Int_t NumTables);
//This method is used to compute the frequencies of the symbols in the source file
Int_t CreateTables(const char* fSource,const Int_t NumTables);
//This method is used to create and store the tables
- Int_t CreateTableFormula(Double_t beta,ULong_t M,Int_t dim,Int_t Type);
+ Int_t CreateTableFormula(Double_t beta,UInt_t M,Int_t dim,Int_t Type);
//This method is used to create and store the Bunch length or Time Gap Table using a formula
void SetVerbose(Int_t val){fVerbose=val;}
//This method is used to set up the verbose level
void NextTable(Int_t Val,Int_t &NextTableType,Int_t &BunchLen,Int_t &Count)const;
//This method is used to deduce which is the next table that as to be used to interpret the next value
//reading the Altro format
- void StoreValue(ULong_t val,UChar_t len);
+ void StoreValue(UInt_t val,UChar_t len);
//This method is used to store a value in the compressed file
- ULong_t Mirror(ULong_t val,UChar_t len)const;
+ UInt_t Mirror(UInt_t val,UChar_t len)const;
//This method is used to get the specular value of a given value
//for instance the specular value of 12345 is 54321
void Flush();
//This method is used to complete and store the buffer in the output file when it isn't completely full
- ULong_t ReadWord(Int_t NumberOfBit);
+ UInt_t ReadWord(Int_t NumberOfBit);
//this method is used to read a specified number of bits from the compressed file
- ULong_t ReadWordBuffer(Int_t NumberOfBit);
+ UInt_t ReadWordBuffer(Int_t NumberOfBit);
//this method is used to read a specified number of bits from the compressed memory buffer
void ReadTrailer(Int_t &WordsNumber,Int_t &PadNumber,Int_t &RowNumber,Int_t &SecNumberr,Bool_t Memory);
//This method is used to read the trailer
- ULong_t GetDecodedWord(AliTPCHNode* root,Bool_t Memory);
+ UInt_t GetDecodedWord(AliTPCHNode* root,Bool_t Memory);
//This method is used to get a decoded word from the compressed file
fstream f; // f is the logical name for the compressed and uncompressed file
ofstream fStat; // Logical name for the Statistics file
- ULong_t fBuffer; // buffer
+ UInt_t fBuffer; // buffer
Int_t fDimBuffer; // buffer dimension (32 bit)
Int_t fFreeBitsBuffer; // number of free bits inside the buffer
Int_t fReadBits; // number of bit read
- ULong_t fPos; // current file position
+ UInt_t fPos; // current file position
Int_t fVerbose; // verbose level (0 silent, !=0 output messages)
- ULong_t fFillWords; // Number of hexadecimally words (2AA pattern) inside a pad data block
+ UInt_t fFillWords; // Number of hexadecimally words (2AA pattern) inside a pad data block
char* fPointBuffer; //pointer to the compressed raw data
ClassDef(AliTPCCompression,1)
};
if (fCodeLen[i]){
cout.width(6);cout<<fSym[i];
cout.width(3);cout<<"|";
- cout.width(6);cout<<hex<<(ULong_t)fCode[i]<<dec;
+ cout.width(6);cout<<hex<<(UInt_t)fCode[i]<<dec;
cout.width(5);cout<<"|";
- cout.width(6);cout<<(ULong_t)fCodeLen[i]<<endl;
+ cout.width(6);cout<<(UInt_t)fCodeLen[i]<<endl;
}//end if
}//end for
}
//////////////////////////////////////////////////////////////////////////////
-Bool_t AliTPCHTable::SpanTree(AliTPCHNode *start, ULong_t code, UChar_t len){
+Bool_t AliTPCHTable::SpanTree(AliTPCHNode *start, UInt_t code, UChar_t len){
//Hoffman codes are generated spanning the Huffman tree
//In an Huffman tree any internal node has always two children
AliTPCHNode * visited;
Int_t AliTPCHTable::GetFrequencies(const char *fname){
//It fills the "fCode" array with the frequencies of the symbols read from the file
AliTPCBuffer160 buff(fname,0);
- ULong_t numberOfWords=0;
+ UInt_t numberOfWords=0;
Int_t val;
while((val=buff.GetNext())!=-1){
fCode[val]++;
//According to the kind of table (0..4) it associates a dummy frequency (1) to
//every symbols whose real frequency is zero, in a given range 0..max
Int_t max;
- ULong_t val;
+ UInt_t val;
switch(k){
case 0:
max=fSize;
//strored temporary in fCode array
Int_t BuildHTable();
//This method returns the number of words stored in the fSym array
- ULong_t GetWordsNumber()const{return fNum;}
+ UInt_t GetWordsNumber()const{return fNum;}
//This method increase by one the frequency of each value that is present
//in the specified file
Int_t GetFrequencies(const char* fname);
private:
//This method executes the pre-order visit of an Huffman tree and calculates the
//codeword for each leaf
- Bool_t SpanTree(AliTPCHNode*start, ULong_t code, UChar_t len);
+ Bool_t SpanTree(AliTPCHNode*start, UInt_t code, UChar_t len);
void ResetHNodes(); //Reset the array fHNodes but not delete the removed objects
void ClearTable(); //Reset the table
Int_t fSize; //size of the arrays fCodelen and fCode
Short_t *fSym; //![fSize] array of input symbols
TObjArray *fHNodes; // array of nodes
Int_t fNnodes; // number of nodes
- ULong_t fNum; // number of words
+ UInt_t fNum; // number of words
Int_t fVerbose; // if fVerbose== 0 no output messages; fVerbose!=0 output messages are printed out
ClassDef(AliTPCHTable,1) //Huffman Table object for set:TPC
};
} while (fRawReader->GetDataSize() == 0);
if (fRawReader->IsCompressed()) { // compressed data
- ULong_t size = 0;
+ UInt_t size = 0;
fCompression.Decompress(fgRootNode, kNumTables,
(char*) data, fRawReader->GetDataSize(),
fData, size);
AliTPCBuffer& operator=(const AliTPCBuffer &source); // ass. op.
void WriteRowBinary(Int_t eth,AliSimDigits *digrow,Int_t minPad,Int_t maxPad,Int_t flag,Int_t sec,Int_t SubSec,Int_t row);
// void WriteRow(Int_t eth,AliSimDigits *digrow,Int_t minPad,Int_t maxPad,Int_t flag,Int_t sec,Int_t SubSec,Int_t row);
- ULong_t GetDigNumber()const{return fNumberOfDigits;}
+ UInt_t GetDigNumber()const{return fNumberOfDigits;}
void SetVerbose(Int_t val){fVerbose=val;}
private:
Int_t fVerbose; //Verbosity level: 0-silent, 1:cout msg, 2: txt files for checking
fstream f; //The IO file name
//TFile *fout;
//TTree *tree;
- ULong_t fNumberOfDigits; //Number of TPC digits
+ UInt_t fNumberOfDigits; //Number of TPC digits
ClassDef(AliTPCBuffer,1)
};
ClassImp(AliTPCDDLRawData)
////////////////////////////////////////////////////////////////////////////////////////
-AliTPCDDLRawData::AliTPCDDLRawData(const AliTPCDDLRawData &source){
+AliTPCDDLRawData::AliTPCDDLRawData(const AliTPCDDLRawData &source):
+ TObject(source)
+{
// Copy Constructor
fVerbose=source.fVerbose;
return;
cout<<" Creating "<<filename<<endl;
AliTPCBuffer160 *buffer=new AliTPCBuffer160(filename,1);
- ULong_t count=0;
+ UInt_t count=0;
Int_t pSecNumber=-1; //Previous Sector number
Int_t pRowNumber=-1; //Previous Row number
Int_t pPadNumber=-1; //Previous Pad number
Int_t bunchLength=0;
Int_t countDDL=0;
Int_t nwords=0;
- ULong_t numPackets=0;
+ UInt_t numPackets=0;
while (f.read((char*)(&data),sizeof(data))){
count++;
if (pPadNumber==-1){
char filename[20];
char dest[20];
fstream f;
- ULong_t size=0;
+ UInt_t size=0;
//Int_t MagicWord,DDLNumber,SecNumber,SubSector,Detector;
Int_t flag=0;
for(Int_t i=1;i<=LDCsNumber;i++){
//loop over the DDL block
//Each block contains a Mini Header followed by raw data (ALTRO FORMAT)
//The number of block is ceil(216/LDCsNumber)
- ULong_t miniHeader[3];
+ UInt_t miniHeader[3];
//here the Mini Header is read
- while( (f.read((char*)(miniHeader),sizeof(ULong_t)*3)) ){
+ while( (f.read((char*)(miniHeader),sizeof(UInt_t)*3)) ){
size=miniHeader[0];
// cout<<"Data size:"<<size<<endl;
- //Int_t dim=sizeof(ULong_t)+sizeof(Int_t)*5;
+ //Int_t dim=sizeof(UInt_t)+sizeof(Int_t)*5;
//cout<<" Sec "<<SecNumber<<" SubSector "<<SubSector<<" size "<<size<<endl;
//open the temporay File
ofstream fo;
fo.open(temp);
#endif
Int_t car=0;
- for(ULong_t j=0;j<size;j++){
+ for(UInt_t j=0;j<size;j++){
f.read((char*)(&car),1);
fo.write((char*)(&car),1);
}//end for
flag=1;
else
flag=0;
- ULong_t aux=0x0;
+ UInt_t aux=0x0;
flag<<=8;
aux|=flag;
miniHeader[2]=miniHeader[2]|aux;
- fdest.write((char*)(miniHeader),sizeof(ULong_t)*3);
+ fdest.write((char*)(miniHeader),sizeof(UInt_t)*3);
//The compressem temp file is copied into the output file fdest
- for(ULong_t j=0;j<size;j++){
+ for(UInt_t j=0;j<size;j++){
fi.read((char*)(&car),1);
fdest.write((char*)(&car),1);
}//end for
cout<<" Creating "<<filename<<endl;
AliTPCBuffer160 *buffer=new AliTPCBuffer160(filename,1);
- ULong_t count=0;
+ UInt_t count=0;
Int_t pSecNumber=-1; //Previous Sector number
Int_t pRowNumber=-1; //Previous Row number
Int_t pPadNumber=-1; //Previous Pad number
Int_t pTimeBin=-1; //Previous Time-Bin
Int_t bunchLength=0;
Int_t nwords=0;
- ULong_t numPackets=0;
+ UInt_t numPackets=0;
while (f.read((char*)(&data),sizeof(data))){
count++;
if (pPadNumber==-1){
#else
fdest.open(dest);
#endif
- ULong_t size=0;
+ UInt_t size=0;
//Int_t MagicWord,DDLNumber,SecNumber,SubSector,Detector,flag=0;
for(Int_t i=1;i<=LDCsNumber;i++){
if(!Comp){
//loop over the DDL block
//Each block contains a Mini Header followed by raw data (ALTRO FORMAT)
//The number of block is ceil(216/LDCsNumber)
- ULong_t miniHeader[3];
+ UInt_t miniHeader[3];
//here the Mini Header is read
//cout<<filename<<endl;
- while( (f.read((char*)(miniHeader),sizeof(ULong_t)*3)) ){
+ while( (f.read((char*)(miniHeader),sizeof(UInt_t)*3)) ){
Int_t car=0;
size=miniHeader[0];
- for(ULong_t j=0;j<size;j++){
+ for(UInt_t j=0;j<size;j++){
f.read((char*)(&car),1);
fdest.write((char*)(&car),1);
}//end for
VZERO/module.mk: VZERO/libVZERO.pkg
EPEMGEN/module.mk: EPEMGEN/libEPEMGEN.pkg
TEPEMGEN/module.mk: TEPEMGEN/libTEPEMGEN.pkg
+RAW/module.mk: RAW/libRAW.pkg
+MONITOR/module.mk: MONITOR/libMONITOR.pkg