]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
HWClusterDecoder produces a descriptor block. It shows whether the clusters have...
authorsgorbuno <sgorbuno@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 21 Oct 2013 00:32:17 +0000 (00:32 +0000)
committersgorbuno <sgorbuno@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 21 Oct 2013 00:32:17 +0000 (00:32 +0000)
The block is then read by DataCompressionComponent which sets corresponding "merged clusters" flag for the compressed clusters.

HLT/TPCLib/AliHLTTPCClusterAccessHLTOUT.cxx
HLT/TPCLib/AliHLTTPCDataPublisherComponent.cxx
HLT/TPCLib/AliHLTTPCDefinitions.cxx
HLT/TPCLib/AliHLTTPCDefinitions.h
HLT/TPCLib/AliHLTTPCHWClusterDecoderComponent.cxx
HLT/TPCLib/AliHLTTPCRawClustersDescriptor.h [new file with mode: 0644]
HLT/TPCLib/comp/AliHLTTPCDataCompressionComponent.cxx
HLT/TPCLib/comp/AliHLTTPCDataCompressionDecoder.cxx
HLT/TPCLib/comp/AliHLTTPCDataCompressionDecoder.h

index 446cd8270bee2a5a1341a2601b02a860af45dd95..f0e2e163297c850e82d7c8388b6ead14ac35c8d3 100644 (file)
@@ -238,6 +238,9 @@ int AliHLTTPCClusterAccessHLTOUT::ProcessClusters(const char* params)
   decoder.Clear();
   decoder.SetVerbosity(fVerbosity);
 
+  bool bHavePartitionRawData=false;
+  bool bHavePartitionCompressedData=false;
+
   bool bNextBlock=false;
   // add cluster id and mc information data blocks
   for (bNextBlock=(pHLTOUT->SelectFirstDataBlock()>=0);
@@ -257,6 +260,14 @@ int AliHLTTPCClusterAccessHLTOUT::ProcessClusters(const char* params)
       if ((iResult=decoder.AddCompressionDescriptor(&desc))<0) {
        return iResult;
       }
+      bHavePartitionCompressedData = kTRUE;
+    }
+    if (desc.fDataType==AliHLTTPCDefinitions::RawClustersDescriptorDataType()) {
+      // header      
+      if ((iResult=decoder.AddRawClustersDescriptor(&desc))<0) {
+       return iResult;
+      }
+      bHavePartitionRawData = kTRUE;
     }
     if (desc.fDataType==AliHLTTPCDefinitions::AliHLTDataTypeClusterMCInfo()) {
       // add mc information
@@ -273,8 +284,6 @@ int AliHLTTPCClusterAccessHLTOUT::ProcessClusters(const char* params)
     }
   }
 
-  bool bHavePartitionRawData=false;
-  bool bHavePartitionCompressedData=false;
   vector<bool> bHavePartitionData(216, false);
 
   // read data
index f62522f4f50ea9e393246d7633b054ba724bd6d2..38bbe35a5d71db4b1274440274361b0f6b379b47 100644 (file)
@@ -192,6 +192,9 @@ int AliHLTTPCDataPublisherComponent::ReadClusterFromHLTOUT(AliHLTTPCDataPublishe
   decoder.Clear();
   decoder.SetVerbosity(GetVerbosity());  
 
+  bool bHavePartitionRawData=false;
+  bool bHavePartitionCompressedData=false;
+
   bool bNextBlock=false;
   // add cluster id and mc information data blocks
   for (bNextBlock=(pHLTOUT->SelectFirstDataBlock()>=0);
@@ -201,10 +204,18 @@ int AliHLTTPCDataPublisherComponent::ReadClusterFromHLTOUT(AliHLTTPCDataPublishe
       continue;
     }
     if (desc.fDataType==AliHLTTPCDefinitions::DataCompressionDescriptorDataType()) {
-      // header      
+      // compression header      
       if ((iResult=decoder.AddCompressionDescriptor(&desc))<0) {
        return iResult;
       }
+      bHavePartitionCompressedData = true;
+    }
+    if (desc.fDataType==AliHLTTPCDefinitions::RawClustersDescriptorDataType()) {
+      // raw clusters header      
+      if ((iResult=decoder.AddRawClustersDescriptor(&desc))<0) {
+       return iResult;
+      }
+      bHavePartitionRawData = true;
     }
     if (desc.fDataType==AliHLTTPCDefinitions::AliHLTDataTypeClusterMCInfo()) {
       // add mc information
@@ -221,8 +232,6 @@ int AliHLTTPCDataPublisherComponent::ReadClusterFromHLTOUT(AliHLTTPCDataPublishe
     }
   }
 
-  bool bHavePartitionRawData=false;
-  bool bHavePartitionCompressedData=false;
   vector<bool> bHavePartitionData(216, false);
 
   // read data
index b54a3488687971ddd352780b54d6f437e2282522..c6b9ed257f656ff3a1538cf6b1b491658acdcdf9 100644 (file)
@@ -36,6 +36,7 @@ const AliHLTComponentDataType AliHLTTPCDefinitions::fgkPackedRawDataType = AliHL
 const AliHLTComponentDataType AliHLTTPCDefinitions::fgkUnpackedRawDataType = AliHLTComponentDataTypeInitializer("RAWUNPAK", kAliHLTDataOriginTPC);
 const AliHLTComponentDataType AliHLTTPCDefinitions::fgkClustersDataType = AliHLTComponentDataTypeInitializer("CLUSTERS", kAliHLTDataOriginTPC);
 const AliHLTComponentDataType AliHLTTPCDefinitions::fgkRawClustersDataType = AliHLTComponentDataTypeInitializer("CLUSTRAW", kAliHLTDataOriginTPC);
+const AliHLTComponentDataType AliHLTTPCDefinitions::fgkRawClustersDescriptorDataType = AliHLTComponentDataTypeInitializer("CLRAWDSC", kAliHLTDataOriginTPC);
 const AliHLTComponentDataType AliHLTTPCDefinitions::fgkHWClustersDataType = AliHLTComponentDataTypeInitializer("HWCLUST1", kAliHLTDataOriginTPC);
 const AliHLTComponentDataType AliHLTTPCDefinitions::fgkAlterClustersDataType = AliHLTComponentDataTypeInitializer("HWCL_ALT", kAliHLTDataOriginTPC);
 const AliHLTComponentDataType AliHLTTPCDefinitions::fgkVertexDataType = AliHLTComponentDataTypeInitializer("VERTEX  ", kAliHLTDataOriginTPC);
@@ -68,6 +69,10 @@ const AliHLTComponentDataType& AliHLTTPCDefinitions::RawClustersDataType() {
   static AliHLTComponentDataType dt = AliHLTComponentDataTypeInitializer("CLUSTRAW", kAliHLTDataOriginTPC);
   return dt;
 }
+const AliHLTComponentDataType& AliHLTTPCDefinitions::RawClustersDescriptorDataType() {
+  static AliHLTComponentDataType dt = AliHLTComponentDataTypeInitializer("CLRAWDSC", kAliHLTDataOriginTPC);
+  return dt;
+}
 const AliHLTComponentDataType& AliHLTTPCDefinitions::HWClustersDataType() {
   static AliHLTComponentDataType dt = AliHLTComponentDataTypeInitializer("HWCLUST1", kAliHLTDataOriginTPC);
   return dt;
index 98f94f93a75b15d6ce8270fb5f2afe5fe4ae54c1..885e78b08fd4c2ba3c2869801bda4e1d5a05361d 100644 (file)
@@ -109,6 +109,9 @@ public:
   /** raw cluster data (not transformed) */
   static const AliHLTComponentDataType fgkRawClustersDataType;          // see above
   static const AliHLTComponentDataType& RawClustersDataType();
+  /** raw cluster data descriptor*/
+  static const AliHLTComponentDataType fgkRawClustersDescriptorDataType;          // see above
+  static const AliHLTComponentDataType& RawClustersDescriptorDataType();
   /** HW cluster data */
   static const AliHLTComponentDataType fgkHWClustersDataType;           // see above
   static const AliHLTComponentDataType& HWClustersDataType();
index 149583e6a9f9a3f70be25efdc1dc79747ae64116..4ffc7c5072c7a5f29f8e8fde61574fdc36d01c2c 100644 (file)
@@ -34,6 +34,7 @@
 #include "AliHLTTPCHWCFEmulator.h"
 #include "AliHLTTPCHWCFData.h"
 #include "AliHLTErrorGuard.h"
+#include "AliHLTTPCRawClustersDescriptor.h"
 
 #include "AliCDBManager.h"
 #include "AliCDBEntry.h"
@@ -102,6 +103,7 @@ int AliHLTTPCHWClusterDecoderComponent::GetOutputDataTypes(AliHLTComponentDataTy
 
   tgtList.clear();
   tgtList.push_back( AliHLTTPCDefinitions::fgkRawClustersDataType  | kAliHLTDataOriginTPC );
+  tgtList.push_back( AliHLTTPCDefinitions::RawClustersDescriptorDataType() );
   tgtList.push_back( AliHLTTPCDefinitions::fgkAliHLTDataTypeClusterMCInfo | kAliHLTDataOriginTPC );
   return tgtList.size();
 }
@@ -229,6 +231,8 @@ int AliHLTTPCHWClusterDecoderComponent::DoEvent(const AliHLTComponentEventData&
   AliHLTUInt8_t* origOutputPtr = outputPtr;
   UInt_t origOutputBlocksSize = outputBlocks.size();
 
+  bool isInputPresent = kFALSE;
+
   for( unsigned long ndx=0; ndx<evtData.fBlockCnt; ndx++ ){
      
     const AliHLTComponentBlockData *iter   = blocks+ndx;
@@ -265,12 +269,10 @@ int AliHLTTPCHWClusterDecoderComponent::DoEvent(const AliHLTComponentEventData&
     }
 
     if( iter->fDataType == (AliHLTTPCDefinitions::fgkHWClustersDataType | kAliHLTDataOriginTPC) ){
-        
-      UInt_t minSlice     = AliHLTTPCDefinitions::GetMinSliceNr(*iter); 
-      UInt_t minPartition = AliHLTTPCDefinitions::GetMinPatchNr(*iter);
-      
-      fBenchmark.SetName(Form("HWClusterTransform slice %d patch %d",minSlice,minPartition));
-      HLTDebug("minSlice: %d, minPartition: %d", minSlice, minPartition);     
+
+      isInputPresent = 1;
+
+      HLTDebug("minSlice: %d, minPartition: %d", AliHLTTPCDefinitions::GetMinSliceNr(*iter), AliHLTTPCDefinitions::GetMinPatchNr(*iter));     
       
       long maxRawClusters = ((long)maxOutSize-size-sizeof(AliHLTTPCRawClusterData))/sizeof(AliHLTTPCRawCluster);
        
@@ -330,6 +332,9 @@ int AliHLTTPCHWClusterDecoderComponent::DoEvent(const AliHLTComponentEventData&
 
   } // end of loop over data blocks  
 
+  AliHLTTPCRawClustersDescriptor desc; 
+  desc.SetMergedClustersFlag(0);
+
   if( fDoMerge && fpClusterMerger ){
     fpClusterMerger->Clear();
     fpClusterMerger->SetDataPointer(origOutputPtr);
@@ -338,9 +343,29 @@ int AliHLTTPCHWClusterDecoderComponent::DoEvent(const AliHLTComponentEventData&
     }
     int nMerged = fpClusterMerger->Merge();
     fpClusterMerger->Clear();
+    desc.SetMergedClustersFlag(1);
     HLTInfo("Merged %d clusters",nMerged);   
   }
+
+  // Write header block 
+  if( isInputPresent ){
+    AliHLTComponent_BlockData bd;
+    FillBlockData(bd);
+    bd.fOffset        = size;
+    bd.fSize          = sizeof(AliHLTTPCRawClustersDescriptor);
+    bd.fDataType      = AliHLTTPCDefinitions::RawClustersDescriptorDataType();
+    if( maxOutSize < size + bd.fSize ){
+       HLTWarning( "Output buffer (%db) is too small, required %db", maxOutSize, size+bd.fSize);
+       iResult  = -ENOSPC;
+       return iResult;
+    }    
+    *(AliHLTTPCRawClustersDescriptor*)(outputPtr ) = desc;
+    outputBlocks.push_back(bd);
+    size += bd.fSize;
+    outputPtr += bd.fSize;
+    fBenchmark.AddOutput(bd.fSize);    
+    HLTBenchmark("header data block of size %d", bd.fSize);
+  }
   fBenchmark.Stop(0);
   HLTInfo(fBenchmark.GetStatistics());
   
diff --git a/HLT/TPCLib/AliHLTTPCRawClustersDescriptor.h b/HLT/TPCLib/AliHLTTPCRawClustersDescriptor.h
new file mode 100644 (file)
index 0000000..5ad2f6b
--- /dev/null
@@ -0,0 +1,46 @@
+#ifndef ALIHLTTPCRAWCLUSTERSDESCRIPTOR_H
+#define ALIHLTTPCRAWCLUSTERSDESCRIPTOR_H
+
+#include "Rtypes.h"
+
+/**
+ * @struct AliHLTTPCRawClustersDescriptor
+ * The class describes properties of the raw clusters
+ * @ingroup alihlt_tpc_datastructs
+ */
+class AliHLTTPCRawClustersDescriptor
+{
+ public:
+
+  AliHLTTPCRawClustersDescriptor(): fVersion(0), fMergedClustersFlag(1){}
+  ~AliHLTTPCRawClustersDescriptor(){}
+  AliHLTTPCRawClustersDescriptor(const AliHLTTPCRawClustersDescriptor& other)
+    : fVersion(other.fVersion)
+    , fMergedClustersFlag(other.fMergedClustersFlag)
+  {}
+
+  AliHLTTPCRawClustersDescriptor& operator=(const AliHLTTPCRawClustersDescriptor& other){ 
+    if( &other == this ) return *this;
+    fVersion = other.fVersion;
+    fMergedClustersFlag = other.fMergedClustersFlag;
+    return *this;
+  }
+
+  Bool_t CheckSize( UInt_t size ) const {
+    if( size<sizeof(UInt_t) ) return 0;
+    if( fVersion==0 ) return ( size==sizeof(AliHLTTPCRawClustersDescriptor));
+    return 0;
+  }
+  
+  UInt_t GetVersion() const { return fVersion; }
+  Int_t GetMergedClustersFlag() const { return fMergedClustersFlag; }
+  
+  void SetMergedClustersFlag( Int_t flag ){ fMergedClustersFlag=flag; }
+
+ private:
+
+  UInt_t fVersion; // version number
+  Int_t fMergedClustersFlag; // flag tells if the clusters were merged at the branch borders
+};
+
+#endif
index b91224a95adf09df360acc92551d3f1091d3dfa4..b868a7547dbb9495444d5e83594af9d9f75ba12a 100644 (file)
@@ -24,6 +24,7 @@
 #include "AliHLTTPCDataCompressionComponent.h"
 #include "AliHLTTPCDefinitions.h"
 #include "AliHLTTPCDataCompressionDescriptor.h"
+#include "AliHLTTPCRawClustersDescriptor.h"
 #include "AliHLTTPCTrackGeometry.h"
 #include "AliHLTTPCSpacePointContainer.h"
 #include "AliHLTTPCRawSpacePointContainer.h"
@@ -96,6 +97,7 @@ void AliHLTTPCDataCompressionComponent::GetInputDataTypes( AliHLTComponentDataTy
   /// inherited from AliHLTComponent: list of data types in the vector reference
   tgtList.clear();
   tgtList.push_back(AliHLTTPCDefinitions::RawClustersDataType());
+  tgtList.push_back(AliHLTTPCDefinitions::RawClustersDescriptorDataType());
   tgtList.push_back(AliHLTTPCDefinitions::ClustersDataType());
   tgtList.push_back(kAliHLTDataTypeTrack|kAliHLTDataOriginTPC);
 }
@@ -492,23 +494,33 @@ int AliHLTTPCDataCompressionComponent::DoEvent( const AliHLTComponentEventData&
   fRawInputClusters->Clear();
 
   // Write header block 
+  
   if( isInputPresent ){
-    AliHLTComponent_BlockData bd;
-    FillBlockData(bd);
-    bd.fOffset        = size;
-    bd.fSize          = sizeof(AliHLTTPCDataCompressionDescriptor);
-    bd.fDataType      = AliHLTTPCDefinitions::DataCompressionDescriptorDataType();
-    if( capacity < size + bd.fSize ){
-      iResult = -ENOMEM;
-      return iResult;
-    }    
-    AliHLTTPCDataCompressionDescriptor desc; 
-    desc.SetMergedClustersFlag(1);
-    *(AliHLTTPCDataCompressionDescriptor*)(outputPtr + bd.fOffset ) = desc;
-    outputBlocks.push_back(bd);
-    size += bd.fSize;
-    outputDataSize+=bd.fSize;
-    HLTBenchmark("header data block of size %d", bd.fSize);
+    pDesc=GetFirstInputBlock(AliHLTTPCDefinitions::RawClustersDescriptorDataType() );
+    if( pDesc ){
+      const AliHLTTPCRawClustersDescriptor &clDesc = *reinterpret_cast<const AliHLTTPCRawClustersDescriptor*>(pDesc->fPtr);
+      if( !clDesc.CheckSize( pDesc->fSize ) ){
+       HLTError("Corrupted cluster descriptor");
+      }
+     
+      AliHLTComponent_BlockData bd;
+      FillBlockData(bd);
+      bd.fOffset        = size;
+      bd.fSize          = sizeof(AliHLTTPCDataCompressionDescriptor);
+      bd.fDataType      = AliHLTTPCDefinitions::DataCompressionDescriptorDataType();
+      if( capacity < size + bd.fSize ){
+       iResult = -ENOSPC;
+       return iResult;
+      }
+
+      AliHLTTPCDataCompressionDescriptor &compDesc = *(AliHLTTPCDataCompressionDescriptor*)(outputPtr + bd.fOffset ); 
+      compDesc.SetMergedClustersFlag( clDesc.GetMergedClustersFlag() );
+
+      outputBlocks.push_back(bd);
+      size += bd.fSize;
+      outputDataSize+=bd.fSize;
+      //HLTBenchmark("header data block of size %d", bd.fSize);
+    }
   }
 
   float compressionFactor=(float)inputRawClusterSize;
index 7205659bd5b83f65da51d1e6ed08258832369268..0bae64652237d31aa8fa4936467887e392ff7ba8 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "AliHLTTPCDataCompressionDecoder.h"
 #include "AliHLTTPCDataCompressionDescriptor.h"
+#include "AliHLTTPCRawClustersDescriptor.h"
 #include "AliHLTDataInflaterSimple.h"
 #include "AliHLTDataInflaterHuffman.h"
 #include "TList.h"
@@ -170,6 +171,21 @@ int AliHLTTPCDataCompressionDecoder::AddCompressionDescriptor(const AliHLTCompon
   return 0;
 }
 
+int AliHLTTPCDataCompressionDecoder::AddRawClustersDescriptor(const AliHLTComponentBlockData* pDesc)
+{
+  /// read descriptor
+  if (!pDesc) return -EINVAL;
+  if (pDesc->fDataType!=AliHLTTPCDefinitions::RawClustersDescriptorDataType()) return -ENODATA;
+  const AliHLTTPCRawClustersDescriptor* pHeader=reinterpret_cast<const AliHLTTPCRawClustersDescriptor*>(pDesc->fPtr);
+  if (! pHeader->CheckSize( pDesc->fSize ) ) return -EINVAL;
+  if( pHeader->GetMergedClustersFlag() == 0 ){
+    fUseClusterMerger = kTRUE;
+  } else if( pHeader->GetMergedClustersFlag() == 1 ){
+    fUseClusterMerger = kFALSE;
+  } else return -EINVAL;
+  return 0;
+}
+
 int AliHLTTPCDataCompressionDecoder::AddClusterMCData(const AliHLTComponentBlockData* pDesc)
 {
   /// add cluster mc data block
index e4d01438e3a38b7e133d4000f8ce04472074403d..d766bd51f84c70018d232c13ffc298bcfbf64b94 100644 (file)
@@ -58,6 +58,7 @@ class AliHLTTPCDataCompressionDecoder : public AliHLTLogging {
   int InitPartitionClusterDecoding(AliHLTUInt32_t specification);
   int InitTrackModelClusterClusterDecoding();
   int AddCompressionDescriptor(const AliHLTComponentBlockData* pDesc);
+  int AddRawClustersDescriptor(const AliHLTComponentBlockData* pDesc);
   int AddClusterMCData(const AliHLTComponentBlockData* pDesc);
   int AddClusterIds(const AliHLTComponentBlockData* pDesc);
   AliHLTUInt32_t GetClusterId(int clusterNo) const;