, fpDataInflaterPartition(NULL)
, fpDataInflaterTrack(NULL)
, fpClusterMerger(NULL)
+ , fRemainingClusterIds()
+ , fTrackModelClusterIds()
+ , fCurrentClusterIds(NULL)
+ , fClusterMCData()
{
/// constructor
}
}
return NULL;
}
+
+int AliHLTTPCDataCompressionDecoder::InitPartitionClusterDecoding(AliHLTUInt32_t specification)
+{
+ /// init the decoding of partition cluster block
+ AliHLTUInt8_t slice=AliHLTTPCDefinitions::GetMinSliceNr(specification);
+ AliHLTUInt8_t partition=AliHLTTPCDefinitions::GetMinPatchNr(specification);
+ unsigned index=slice*AliHLTTPCTransform::GetNumberOfPatches()+partition;
+ if (index<fRemainingClusterIds.size())
+ fCurrentClusterIds=&fRemainingClusterIds[index];
+ else
+ fCurrentClusterIds=NULL;
+ return 0;
+}
+
+int AliHLTTPCDataCompressionDecoder::InitTrackModelClusterClusterDecoding()
+{
+ /// init the decoding of track model cluster block
+ if (fTrackModelClusterIds.fIds && fTrackModelClusterIds.fSize>0)
+ fCurrentClusterIds=&fTrackModelClusterIds;
+ else
+ fCurrentClusterIds=NULL;
+ return 0;
+}
+
+int AliHLTTPCDataCompressionDecoder::AddClusterMCData(const AliHLTComponentBlockData* pDesc)
+{
+ /// add cluster mc data block
+ if (!pDesc) return -EINVAL;
+ if (pDesc->fDataType==AliHLTTPCDefinitions::AliHLTDataTypeClusterMCInfo()) {
+ AliHLTUInt8_t slice=AliHLTTPCDefinitions::GetMinSliceNr(pDesc->fSpecification);
+ AliHLTUInt8_t partition=AliHLTTPCDefinitions::GetMinPatchNr(pDesc->fSpecification);
+ unsigned index=slice*AliHLTTPCTransform::GetNumberOfPatches()+partition;
+ if (fClusterMCData.size()<=index) {
+ if ((int)fClusterMCData.size()<AliHLTTPCTransform::GetNSlice()*AliHLTTPCTransform::GetNumberOfPatches()) {
+ fClusterMCData.resize(AliHLTTPCTransform::GetNSlice()*AliHLTTPCTransform::GetNumberOfPatches(), NULL);
+ } else {
+ fClusterMCData.resize(index+1, NULL);
+ }
+ }
+ if (pDesc->fSize<sizeof(AliHLTTPCClusterMCData)) return -EINVAL;
+ const AliHLTTPCClusterMCData* pData=reinterpret_cast<const AliHLTTPCClusterMCData*>(pDesc->fPtr);
+ unsigned nLabels = pData->fCount;
+ if (nLabels*sizeof(AliHLTTPCClusterMCLabel) + sizeof(AliHLTTPCClusterMCData) != pDesc->fSize) {
+ return -EINVAL;
+ }
+ fClusterMCData[index]=pData;
+ return 0;
+ }
+ return -ENODATA;
+}
+
+int AliHLTTPCDataCompressionDecoder::AddClusterIds(const AliHLTComponentBlockData* pDesc)
+{
+ /// add cluster id block for remaining or track model clusters
+ if (!pDesc) return -EINVAL;
+ if (pDesc->fDataType==AliHLTTPCDefinitions::ClusterIdTracksDataType()) {
+ fTrackModelClusterIds.fIds=reinterpret_cast<AliHLTUInt32_t*>(pDesc->fPtr);
+ fTrackModelClusterIds.fSize=pDesc->fSize/sizeof(AliHLTUInt32_t);
+ return 0;
+ }
+ if (pDesc->fDataType==AliHLTTPCDefinitions::RemainingClusterIdsDataType()) {
+ AliHLTUInt8_t slice=AliHLTTPCDefinitions::GetMinSliceNr(pDesc->fSpecification);
+ AliHLTUInt8_t partition=AliHLTTPCDefinitions::GetMinPatchNr(pDesc->fSpecification);
+ unsigned index=slice*AliHLTTPCTransform::GetNumberOfPatches()+partition;
+ if (fRemainingClusterIds.size()<=index) {
+ if ((int)fRemainingClusterIds.size()<AliHLTTPCTransform::GetNSlice()*AliHLTTPCTransform::GetNumberOfPatches()) {
+ fRemainingClusterIds.resize(AliHLTTPCTransform::GetNSlice()*AliHLTTPCTransform::GetNumberOfPatches());
+ } else {
+ fRemainingClusterIds.resize(index+1);
+ }
+ }
+ fRemainingClusterIds[index].fIds=reinterpret_cast<AliHLTUInt32_t*>(pDesc->fPtr);
+ fRemainingClusterIds[index].fSize=pDesc->fSize/sizeof(AliHLTUInt32_t);
+ return 0;
+ }
+ return -ENODATA;
+}
+
+AliHLTUInt32_t AliHLTTPCDataCompressionDecoder::GetClusterId(int clusterNo) const
+{
+ /// get the cluster id from the current cluster id block
+ if (!fCurrentClusterIds ||
+ (int)fCurrentClusterIds->fSize<=clusterNo ||
+ clusterNo<0)
+ return kAliHLTVoidDataSpec;
+ return fCurrentClusterIds->fIds[clusterNo];
+}
+
+const AliHLTTPCClusterMCLabel* AliHLTTPCDataCompressionDecoder::GetMCLabel(AliHLTUInt32_t clusterId) const
+{
+ /// get MC data for a cluster Id
+ if (clusterId==kAliHLTVoidDataSpec) return NULL;
+
+ unsigned slice=AliHLTTPCSpacePointData::GetSlice(clusterId);
+ unsigned partition=AliHLTTPCSpacePointData::GetPatch(clusterId);
+ unsigned number=AliHLTTPCSpacePointData::GetNumber(clusterId);
+ if ((int)slice>=AliHLTTPCTransform::GetNSlice() ||
+ (int)partition>=AliHLTTPCTransform::GetNumberOfPatches()) return NULL;
+ unsigned index=slice*AliHLTTPCTransform::GetNumberOfPatches()+partition;
+ if (fClusterMCData.size()<=index ||
+ fClusterMCData[index]==NULL ||
+ fClusterMCData[index]->fCount<=number) return NULL;
+
+ return &(fClusterMCData[index]->fLabels[number]);
+}
+
+void AliHLTTPCDataCompressionDecoder::Clear(const char* /*option*/)
+{
+ // cleanup
+}
#include "AliHLTTPCTrackGeometry.h"
#include "AliHLTDataInflater.h"
#include "AliHLTTPCHWClusterMerger.h"
+#include <vector>
/**
* @class AliHLTTPCDataCompressionDecoder
void SetVerbosity(int verbosity) {fVerbosity=verbosity;}
void EnableClusterMerger() {if (!fpClusterMerger) fpClusterMerger=new AliHLTTPCHWClusterMerger;}
+ int InitPartitionClusterDecoding(AliHLTUInt32_t specification);
+ int InitTrackModelClusterClusterDecoding();
+ int AddClusterMCData(const AliHLTComponentBlockData* pDesc);
+ int AddClusterIds(const AliHLTComponentBlockData* pDesc);
+ AliHLTUInt32_t GetClusterId(int clusterNo) const;
+ const AliHLTTPCClusterMCLabel* GetMCLabel(AliHLTUInt32_t clusterId) const;
+
+ void Clear(const char* option);
+
+ struct AliClusterIdBlock {
+ AliClusterIdBlock() : fIds(NULL), fSize(0) {}
+ AliHLTUInt32_t* fIds; //!
+ AliHLTUInt32_t fSize; //!
+ };
+
protected:
private:
AliHLTTPCDataCompressionDecoder(const AliHLTTPCDataCompressionDecoder&);
AliHLTDataInflater* fpDataInflaterTrack; //! instance of inflater for track clusters
AliHLTTPCHWClusterMerger* fpClusterMerger; //! merger instance
+ vector<AliClusterIdBlock> fRemainingClusterIds; //! clusters ids for remaining cluster ids
+ AliClusterIdBlock fTrackModelClusterIds; //! cluster ids for track model clusters
+ AliClusterIdBlock* fCurrentClusterIds; //! id block currently active in the iteration
+ vector<const AliHLTTPCClusterMCData*> fClusterMCData; //! references to MC data blocks
+
ClassDef(AliHLTTPCDataCompressionDecoder, 0)
};
int iResult=0;
if (!pInflater) return -EINVAL;
+ if ((iResult= InitPartitionClusterDecoding(specification))<0)
+ return iResult;
+
AliHLTUInt8_t slice = AliHLTTPCDefinitions::GetMinSliceNr(specification);
AliHLTUInt8_t partition = AliHLTTPCDefinitions::GetMinPatchNr(specification);
// the compressed format stores the difference of the local row number in
{rawCluster.SetQMax(value); break;}
}
if (parameterId>=AliHLTTPCDefinitions::kLast) {
+ AliHLTUInt32_t id=GetClusterId(decodedClusterCnt);
+ const AliHLTTPCClusterMCLabel* pMC=GetMCLabel(id);
if (fpClusterMerger && fpClusterMerger->CheckCandidate(slice, partition, rawCluster)) {
- fpClusterMerger->AddCandidate(slice, partition, ~AliHLTUInt32_t(0), rawCluster);
- } else {
- // FIXME: afetr introcucing the temporary rawCluster, the
- // interface can be changed to set all properties in one
- // call
+ fpClusterMerger->AddCandidate(slice, partition, id, rawCluster, pMC);
+ } else {
c.Next(slice, partition);
c.SetPadRow(rawCluster.GetPadRow()+rowOffset);
c.SetPad(rawCluster.GetPad());
c.SetSigmaZ2(rawCluster.GetSigmaZ2());
c.SetCharge(rawCluster.GetCharge());
c.SetQMax(rawCluster.GetQMax());
+ if (pMC) c.SetMC(pMC);
outClusterCnt++;
}
bNextCluster=true;
i!=fpClusterMerger->end(); i++) {
c.Next((*i).GetSlice(), (*i).GetPartition());
const AliHLTTPCRawCluster& mergedCluster=(*i).GetCluster();
- // FIXME: afetr introcucing the temporary rawCluster, the
- // interface can be changed to set all properties in one
- // call
+ const AliHLTTPCClusterMCLabel& mc=(*i).MCLabel();
c.SetPadRow(mergedCluster.GetPadRow()+rowOffset);
c.SetPad(mergedCluster.GetPad());
c.SetTime(mergedCluster.GetTime());
c.SetSigmaZ2(mergedCluster.GetSigmaZ2());
c.SetCharge(mergedCluster.GetCharge());
c.SetQMax(mergedCluster.GetQMax());
+ c.SetMC(&mc);
outClusterCnt++;
remainingCnt++;
}
int iResult=0;
if (!pInflater || !pTrackPoints) return -EINVAL;
+ if ((iResult= InitTrackModelClusterClusterDecoding())<0)
+ return iResult;
+
const vector<AliHLTTrackGeometry::AliHLTTrackPoint>& rawTrackPoints=pTrackPoints->GetRawPoints();
vector<AliHLTTrackGeometry::AliHLTTrackPoint>::const_iterator currentTrackPoint=rawTrackPoints.begin();