//to be provided.
#include <TObjArray.h>
+#include <TString.h>
+#include <TSystem.h>
#include <Riostream.h>
#include <stdio.h>
#include <stdlib.h>
#include "AliTPCCompression.h"
#include "AliAltroBuffer.h"
+#include "AliTPCAltroMapping.h"
#include "AliTPCDDLRawData.h"
#include "AliRawDataHeader.h"
Int_t nwords=0;
UInt_t numPackets=0;
+ TString path = gSystem->Getenv("ALICE_ROOT");
+ path += "/TPC/mapping/Patch";
+ TString path2;
+ AliTPCAltroMapping *mapping[6];
+ for(Int_t i = 0; i < 6; i++) {
+ path2 = path;
+ path2 += i;
+ path2 += ".data";
+ mapping[i] = new AliTPCAltroMapping(path2.Data());
+ }
+
+
while (f.read((char*)(&data),sizeof(data))){
if (pPadNumber==-1){
pSecNumber=data.Sec;
else
ddlNumber=72+(data.Sec-36)*4+data.SubSec;
sprintf(filename,"TPC_%d.ddl",ddlNumber+kDDLOffset);
- buffer=new AliAltroBuffer(filename,1);
+ Int_t patchIndex = data.SubSec;
+ if(data.Sec>=36) patchIndex += 2;
+ buffer=new AliAltroBuffer(filename,1,mapping[patchIndex]);
//size magic word sector number sub-sector number 0 for TPC 0 for uncompressed
buffer->WriteDataHeader(kTRUE,kFALSE);//Dummy;
bunchLength=1;
else
ddlNumber=72+(data.Sec-36)*4+data.SubSec;
sprintf(filename,"TPC_%d.ddl",ddlNumber+kDDLOffset);
- buffer=new AliAltroBuffer(filename,1);
+ Int_t patchIndex = data.SubSec;
+ if(data.Sec>=36) patchIndex += 2;
+ buffer=new AliAltroBuffer(filename,1,mapping[patchIndex]);
buffer->WriteDataHeader(kTRUE,kFALSE);//Dummy;
pSubSector=data.SubSec;
}//end if
//cout<<"Data header for D D L:"<<pSecNumber<<" Sub-sec:"<<pSubSector<<endl;
delete buffer;
}
+
+ for(Int_t i = 0; i < 6; i++) delete mapping[i];
+
f.close();
return;
}
};
DataPad data;
+ TString path = gSystem->Getenv("ALICE_ROOT");
+ path += "/TPC/mapping/Patch";
+ TString path2;
+ AliTPCAltroMapping *mapping[6];
+ for(Int_t i = 0; i < 6; i++) {
+ path2 = path;
+ path2 += i;
+ path2 += ".data";
+ mapping[i] = new AliTPCAltroMapping(path2.Data());
+ }
+
//AliAltroBuffer is used in write mode to generate AltroFormat.dat file
Info("RawDataAltro", "Creating &s", outputFileName);
AliAltroBuffer *buffer=new AliAltroBuffer(outputFileName,1);
UInt_t count=0;
Int_t pSecNumber=-1; //Previous Sector number
+ Int_t pSubSec=-1; //Previous sub Sector
Int_t pRowNumber=-1; //Previous Row number
Int_t pPadNumber=-1; //Previous Pad number
Int_t pTimeBin=-1; //Previous Time-Bin
while (f.read((char*)(&data),sizeof(data))){
count++;
if (pPadNumber==-1){
+ pSubSec=data.SubSec;
pSecNumber=data.Sec;
pRowNumber=data.Row;
pPadNumber=data.Pad;
nwords+=2;
if ((pPadNumber!=data.Pad)||(pRowNumber!=data.Row)||(pSecNumber!=data.Sec)){
//Trailer is formatted and inserted!!
+ Int_t patchIndex = pSubSec;
+ if(pSecNumber >= 36) patchIndex += 2;
+ buffer->SetMapping(mapping[patchIndex]);
buffer->WriteTrailer(nwords,pPadNumber,pRowNumber,pSecNumber);
numPackets++;
nwords=0;
buffer->FillBuffer(pTimeBin);
buffer->FillBuffer(bunchLength+2);
nwords+=2;
+ Int_t patchIndex = pSubSec;
+ if(pSecNumber >= 36) patchIndex += 2;
+ buffer->SetMapping(mapping[patchIndex]);
buffer->WriteTrailer(nwords,pPadNumber,pRowNumber,pSecNumber);
delete buffer;
Info("RawDataAltro", "Number of digits: %d", count);
+
+ for(Int_t i = 0; i < 6; i++) delete mapping[i];
+
f.close();
return;
}