X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=blobdiff_plain;f=TPC%2FAliTPCDDLRawData.cxx;h=bbdbd5137788de405e9669fd72582b87450ddc49;hp=5c16b16dec78c32bd3b52c71fb7a72db9fa49ca6;hb=f65ac70b2727fe424661028e7c2ac0d0cbfef1c7;hpb=30c1018ed2b0e5ba76bf85a7a2d6695a50bf0f4a diff --git a/TPC/AliTPCDDLRawData.cxx b/TPC/AliTPCDDLRawData.cxx index 5c16b16dec7..bbdbd513778 100644 --- a/TPC/AliTPCDDLRawData.cxx +++ b/TPC/AliTPCDDLRawData.cxx @@ -14,52 +14,54 @@ **************************************************************************/ /* $Id$ */ + //This class conteins all the methods to create raw data //as par a given DDL. //It produces DDL with both compressed and uncompressed format. //For compression we use the optimized table wich needs //to be provided. - -#include "TObjArray.h" -#include "Riostream.h" +#include +#include #include #include #include "AliTPCCompression.h" #include "AliTPCBuffer160.h" #include "AliTPCDDLRawData.h" +#include "AliRawDataHeader.h" ClassImp(AliTPCDDLRawData) //////////////////////////////////////////////////////////////////////////////////////// -AliTPCDDLRawData::AliTPCDDLRawData(const AliTPCDDLRawData &source){ +AliTPCDDLRawData::AliTPCDDLRawData(const AliTPCDDLRawData &source): + TObject(source) +{ // Copy Constructor + fVerbose=source.fVerbose; return; } AliTPCDDLRawData& AliTPCDDLRawData::operator=(const AliTPCDDLRawData &source){ //Assigment operator + fVerbose=source.fVerbose; return *this; } //////////////////////////////////////////////////////////////////////////// -void AliTPCDDLRawData::RawData(Int_t LDCsNumber){ - //Raw data slides generation +void AliTPCDDLRawData::RawData(const char* inputFileName){ + //Raw data generation //Number of DDL=2*36+4*36=216 //2 DDL for each inner sector //4 DDL for each outer sector - Int_t ddlPerFile=216/LDCsNumber; Int_t offset=1; - if (216%LDCsNumber) ddlPerFile++; - cout<<"Number of DDL per slide: "<WriteMiniHeader(0,pSecNumber,pSubSector,0,0);//Dummy; + buffer->WriteDataHeader(kTRUE,kFALSE);//Dummy; bunchLength=1; buffer->FillBuffer(data.Dig-offset); nwords++; @@ -119,25 +123,19 @@ void AliTPCDDLRawData::RawData(Int_t LDCsNumber){ nwords=0; if(pSubSector!=data.SubSec){ - countDDL++; - if(countDDL==ddlPerFile){ - //size magic word sector number sub-sector number 0 for TPC 0 for uncompressed - buffer->Flush(); - buffer->WriteMiniHeader(1,pSecNumber,pSubSector,0,0); - //cout<<"Mini header for DDL:"<WriteMiniHeader(0,data.Sec,data.SubSec,0,0);//Dummy; - countDDL=0; - }//end if - else{ - buffer->Flush(); - buffer->WriteMiniHeader(1,pSecNumber,pSubSector,0,0); - buffer->WriteMiniHeader(0,data.Sec,data.SubSec,0,0);//Dummy; - } + //size magic word sector number sub-sector number 0 for TPC 0 for uncompressed + buffer->Flush(); + buffer->WriteDataHeader(kFALSE,kFALSE); + //cout<<"Data header for DDL:"<WriteDataHeader(kTRUE,kFALSE);//Dummy; pSubSector=data.SubSec; }//end if }//end if @@ -152,16 +150,17 @@ void AliTPCDDLRawData::RawData(Int_t LDCsNumber){ nwords++; }//end else }//end while - buffer->FillBuffer(pTimeBin); - buffer->FillBuffer(bunchLength+2); - nwords+=2; - buffer->WriteTrailer(nwords,pPadNumber,pRowNumber,pSecNumber); - //write the M.H. - buffer->Flush(); - buffer->WriteMiniHeader(1,pSecNumber,pSubSector,0,0); - //cout<<"Mini header for D D L:"<FillBuffer(pTimeBin); + buffer->FillBuffer(bunchLength+2); + nwords+=2; + buffer->WriteTrailer(nwords,pPadNumber,pRowNumber,pSecNumber); + //write the D.H. + buffer->Flush(); + buffer->WriteDataHeader(kFALSE,kFALSE); + //cout<<"Data header for D D L:"<is_open()){f.clear(); continue;} +#else + if(!f.is_open()){f.clear(); continue;} +#endif + if (fVerbose) + Info("RawDataCompDecompress", "&s -> dest.ddl", filename); ofstream fdest; #ifndef __DECCXX - fdest.open(dest,ios::binary); + fdest.open("dest.ddl",ios::binary); #else - fdest.open(dest); + fdest.open("dest.ddl"); #endif //loop over the DDL block - //Each block contains a Mini Header followed by raw data (ALTRO FORMAT) + //Each block contains a Data Header followed by raw data (ALTRO FORMAT) //The number of block is ceil(216/LDCsNumber) - ULong_t miniHeader[3]; - //here the Mini Header is read - while( (f.read((char*)(miniHeader),sizeof(ULong_t)*3)) ){ - size=miniHeader[0]; - //Int_t dim=sizeof(ULong_t)+sizeof(Int_t)*5; + AliRawDataHeader header; + //here the Data Header is read + while( f.read((char*)(&header),sizeof(header)) ){ + size=header.fSize-sizeof(header); + // cout<<"Data size:"<CompressDataOptTables(kNumTables,temp,"TempCompDecomp"); + Int_t result=0; + if(compress){ + result=util.CompressDataOptTables(kNumTables,temp,"TempCompDecomp"); + } else - util->DecompressDataOptTables(kNumTables,temp,"TempCompDecomp"); - delete util; + result=util.DecompressDataOptTables(kNumTables,temp,"TempCompDecomp"); + if (result != 0) break; //the temp compressed file is open and copied to the final file fdest ifstream fi; #ifndef __DECCXX @@ -240,21 +242,14 @@ Int_t AliTPCDDLRawData::RawDataCompDecompress(Int_t LDCsNumber,Int_t Comp){ fi.seekg(0,ios::end); size=fi.tellg(); fi.seekg(0); - //The Mini Header is updated (size and Compressed flag) + //The Data Header is updated (size and Compressed flag) //and written into the output file - miniHeader[0]=size; - if(!Comp) - flag=1; - else - flag=0; - ULong_t aux=0xFFFF; - aux<<=16; - aux|=flag; - aux|=0xFF; - miniHeader[2]=miniHeader[2]&aux; - fdest.write((char*)(miniHeader),sizeof(ULong_t)*3); + header.fSize=size+sizeof(header); + if (compress) header.SetAttribute(1); + else header.ResetAttribute(1); + fdest.write((char*)(&header),sizeof(header)); //The compressem temp file is copied into the output file fdest - for(ULong_t j=0;jWriteTrailer(nwords,pPadNumber,pRowNumber,pSecNumber); delete buffer; - cout<<"Number of digits: "<