/************************************************************************** * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ #include "TObjArray.h" #include "Riostream.h" #include #include #include "AliTPCCompression.h" #include "AliTPCBuffer160.h" #include "AliTPCDDLRawData.h" ClassImp(AliTPCDDLRawData) //////////////////////////////////////////////////////////////////////////////////////// AliTPCDDLRawData::AliTPCDDLRawData(const AliTPCDDLRawData &source){ // Copy Constructor return; } AliTPCDDLRawData& AliTPCDDLRawData::operator=(const AliTPCDDLRawData &source){ //Assigment operator return *this; } //////////////////////////////////////////////////////////////////////////// void AliTPCDDLRawData::RawData(Int_t LDCsNumber){ //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; BunchLength=1; Buffer->FillBuffer(data.Dig-offset); nwords++; }//end if else{ if ( (data.Time==(PTimeBin+1)) && (PPadNumber==data.Pad) && (PRowNumber==data.Row) && (PSecNumber==data.Sec)){ BunchLength++; }//end if else{ Buffer->FillBuffer(PTimeBin); Buffer->FillBuffer(BunchLength+2); nwords+=2; if ((PPadNumber!=data.Pad)||(PRowNumber!=data.Row)||(PSecNumber!=data.Sec)){ //Trailer is formatted and inserted!! Buffer->WriteTrailer(nwords,PPadNumber,PRowNumber,PSecNumber); numPackets++; 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; } PSubSector=data.SubSec; }//end if }//end if BunchLength=1; PPadNumber=data.Pad; PRowNumber=data.Row; PSecNumber=data.Sec; }//end else PTimeBin=data.Time; Buffer->FillBuffer(data.Dig-offset); 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:"<CompressDataOptTables(NumTable,temp,"TempCompDecomp"); else util->DecompressDataOptTables(NumTable,temp,"TempCompDecomp"); delete util; //the temp compressed file is open and copied to the final file fdest ifstream fi; fi.open("TempCompDecomp",ios::binary); fi.seekg(0,ios::end); Size=fi.tellg(); fi.seekg(0); //The Mini 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); //The compressem temp file is copied into the output file fdest for(ULong_t j=0;jFillBuffer(data.Dig-offset); nwords++; }//end if else{ if ( (data.Time==(PTimeBin+1)) && (PPadNumber==data.Pad) && (PRowNumber==data.Row) && (PSecNumber==data.Sec)){ BunchLength++; }//end if else{ Buffer->FillBuffer(PTimeBin); Buffer->FillBuffer(BunchLength+2); nwords+=2; if ((PPadNumber!=data.Pad)||(PRowNumber!=data.Row)||(PSecNumber!=data.Sec)){ //Trailer is formatted and inserted!! Buffer->WriteTrailer(nwords,PPadNumber,PRowNumber,PSecNumber); numPackets++; nwords=0; }//end if BunchLength=1; PPadNumber=data.Pad; PRowNumber=data.Row; PSecNumber=data.Sec; }//end else PTimeBin=data.Time; Buffer->FillBuffer(data.Dig-offset); nwords++; }//end else }//end while Buffer->FillBuffer(PTimeBin); Buffer->FillBuffer(BunchLength+2); nwords+=2; Buffer->WriteTrailer(nwords,PPadNumber,PRowNumber,PSecNumber); delete Buffer; cout<<"Number of digits: "<