data structures for MC labels of TPC clusters are moved from AliHLTTPCClusterFinder...
authorsgorbuno <sgorbuno@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 19 May 2011 00:18:21 +0000 (00:18 +0000)
committersgorbuno <sgorbuno@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 19 May 2011 00:18:21 +0000 (00:18 +0000)
HLT/CMakelibAliHLTTPC.pkg
HLT/TPCLib/AliHLTTPCClusterFinder.cxx
HLT/TPCLib/AliHLTTPCClusterFinder.h
HLT/TPCLib/AliHLTTPCClusterFinderComponent.cxx
HLT/TPCLib/AliHLTTPCClusterMCData.h [new file with mode: 0644]
HLT/TPCLib/AliHLTTPCTrackMCMarkerComponent.cxx
HLT/TPCLib/AliHLTTPCTrackMCMarkerComponent.h

index 5f3007a..d8e5d13 100644 (file)
@@ -130,7 +130,7 @@ set ( CLASS_HDRS
 string ( REPLACE ".h" ".cxx" MODULE_SRCS "${CLASS_HDRS}")
 list(APPEND MODULE_SRCS AliHLTTPCLog.cxx)
 
-set ( MODULE_HDRS      ${CLASS_HDRS} AliHLTTPCLog.h AliHLTTPCLogging.h AliHLTTPCSpacePointData.h AliHLTTPCRootTypes.h AliHLTTPCDigitData.h AliHLTTPCTrackSegmentData.h AliHLTTPCVertexData.h AliHLTTPCTrackletDataFormat.h AliHLTTPCClusterDataFormat.h AliHLTTPCModels.h)
+set ( MODULE_HDRS      ${CLASS_HDRS} AliHLTTPCLog.h AliHLTTPCLogging.h AliHLTTPCSpacePointData.h AliHLTTPCRootTypes.h AliHLTTPCDigitData.h AliHLTTPCTrackSegmentData.h AliHLTTPCVertexData.h AliHLTTPCTrackletDataFormat.h AliHLTTPCClusterDataFormat.h AliHLTTPCModels.h AliHLTTPCClusterMCData.h )
 
 set ( MODULE_DHDR )
 
index 5d69212..27e837d 100644 (file)
@@ -541,7 +541,7 @@ Int_t AliHLTTPCClusterFinder::FillHWAddressList(AliHLTUInt16_t *hwaddlist, Int_t
 }
  
 
-Int_t AliHLTTPCClusterFinder::FillOutputMCInfo(AliHLTTPCClusterFinder::ClusterMCInfo * outputMCInfo, Int_t maxNumberOfClusterMCInfo){
+Int_t AliHLTTPCClusterFinder::FillOutputMCInfo(AliHLTTPCClusterMCLabel * outputMCInfo, Int_t maxNumberOfClusterMCInfo){
   // see header file for class documentation
   
   Int_t counter=0;
@@ -584,10 +584,10 @@ void AliHLTTPCClusterFinder::FindClusters(){
          fClusters.push_back(*tmpCandidate);
          if(fDoMC){
            //sort the vector (large->small) according to weight and remove elements above 2 (keep 0 1 and 2) 
-           sort(fClusterMCVector.begin(),fClusterMCVector.end(), MCWeight::CompareWeights );
-           ClusterMCInfo tmpClusterMCInfo;
+           sort(fClusterMCVector.begin(),fClusterMCVector.end(), CompareWeights );
+           AliHLTTPCClusterMCLabel tmpClusterMCInfo;
 
-           MCWeight zeroMC;
+           AliHLTTPCClusterMCWeight zeroMC;
            zeroMC.fMCID=-1;
            zeroMC.fWeight=0;
 
@@ -705,7 +705,7 @@ void AliHLTTPCClusterFinder::FillMCClusterVector(vector<AliHLTTPCDigitData> *dig
     for(Int_t id=0; id<3; id++){
       if(digitData->at(d).fTrackID[id]>=0){
        Bool_t matchFound = kFALSE;
-       MCWeight mc;
+       AliHLTTPCClusterMCWeight mc;
        mc.fMCID = digitData->at(d).fTrackID[id];
        mc.fWeight = ((Float_t)digitData->at(d).fCharge)/nIDsInDigit;
        for(UInt_t i=0;i<fClusterMCVector.size();i++){
index 0645785..84cfd7c 100644 (file)
@@ -19,6 +19,7 @@
 #include "AliHLTTPCDigitData.h"
 #include "AliHLTTPCDigitReader.h"
 #include "AliTPCRecoParam.h"
+#include "AliHLTTPCClusterMCData.h"
 
 class AliHLTTPCPad;
 class AliHLTTPCSpacePointData;
@@ -124,18 +125,8 @@ class AliHLTTPCClusterFinder : public AliHLTLogging {
   };
   typedef struct AliClusterData AliClusterData; //!
 
-  struct MCWeight{
-    Int_t fMCID; //!
-    Float_t fWeight; //!
-    static Bool_t CompareWeights( const MCWeight &mc1,  const MCWeight &mc2 ){ return mc1.fWeight > mc2.fWeight; }
-  };
-  typedef struct MCWeight MCWeight;
-
-  struct ClusterMCInfo{
-    MCWeight fClusterID[3]; //!
-  };
-  typedef struct ClusterMCInfo ClusterMCInfo;
-
+  static Bool_t CompareWeights( const AliHLTTPCClusterMCWeight &mc1,  const AliHLTTPCClusterMCWeight &mc2 ){ return mc1.fWeight > mc2.fWeight; }
+  
 
   /** standard constructor */
   AliHLTTPCClusterFinder();
@@ -168,7 +159,7 @@ class AliHLTTPCClusterFinder : public AliHLTLogging {
   Int_t FillHWAddressList(AliHLTUInt16_t *hwaddlist, Int_t maxHWAddress);
 
  /**  Fills the mc info */
-  Int_t FillOutputMCInfo(AliHLTTPCClusterFinder::ClusterMCInfo * outputMCInfo, Int_t maxNumberOfClusterMCInfo);
+  Int_t FillOutputMCInfo(AliHLTTPCClusterMCLabel * outputMCInfo, Int_t maxNumberOfClusterMCInfo);
 
   /** Set the pointer to the outputbuffer */
   void SetOutputArray(AliHLTTPCSpacePointData *pt);
@@ -219,7 +210,7 @@ class AliHLTTPCClusterFinder : public AliHLTLogging {
   
   void FillMCClusterVector(vector<AliHLTTPCDigitData> *digitData);
 
-  vector<AliHLTTPCClusterFinder::MCWeight> GetClusterMCInfo() const {return fClusterMCVector;}
+  vector<AliHLTTPCClusterMCWeight> GetClusterMCInfo() const {return fClusterMCVector;}
 
   Bool_t UpdateCalibDB();
 
@@ -260,7 +251,7 @@ class AliHLTTPCClusterFinder : public AliHLTLogging {
  
   vector<AliHLTTPCClusters> fClusters;                             //! transient
 
-  vector<ClusterMCInfo> fClustersMCInfo;                           //! transient
+  vector<AliHLTTPCClusterMCLabel> fClustersMCInfo;                           //! transient
 
   vector<AliHLTTPCDigitData> fMCDigits;                            //! transient
   
@@ -284,7 +275,7 @@ class AliHLTTPCClusterFinder : public AliHLTLogging {
 
   Bool_t fDoMC;                                                    //! transient
 
-  vector<MCWeight> fClusterMCVector;                               //! transient
+  vector<AliHLTTPCClusterMCWeight> fClusterMCVector;                               //! transient
 
   AliTPCTransform * fOfflineTransform;                             //! transient
 
index bb5e24b..8f3ef5f 100644 (file)
@@ -42,6 +42,7 @@ using namespace std;
 #include "AliTPCCalPad.h"
 #include "AliTPCParam.h"
 #include "AliTPCTransform.h"
+#include "AliHLTTPCClusterMCData.h"
 
 //#include "AliHLTTPCCAInputDataCompressorComponent.h"
 //#include "AliHLTTPCCADef.h"
@@ -553,21 +554,21 @@ int AliHLTTPCClusterFinderComponent::DoEvent( const AliHLTComponentEventData& ev
       */
 
       if(fDoMC){
-       Int_t maxNumberOfClusterMCInfo = (Int_t)((size-tSize)/sizeof(AliHLTTPCClusterFinder::ClusterMCInfo)-1);
-       AliHLTTPCClusterFinder::ClusterMCInfo* outputMCInfo= (AliHLTTPCClusterFinder::ClusterMCInfo*)(outputPtr+tSize);
-       Int_t nMCInfo = fClusterFinder->FillOutputMCInfo(outputMCInfo, maxNumberOfClusterMCInfo);
-       
-       AliHLTComponentBlockData bdMCInfo;
-       FillBlockData( bdMCInfo );
-       bdMCInfo.fOffset = tSize ;
-       bdMCInfo.fSize = nMCInfo*sizeof(AliHLTTPCClusterFinder::ClusterMCInfo);
-       bdMCInfo.fSpecification = iter->fSpecification;
-       bdMCInfo.fDataType = AliHLTTPCDefinitions::fgkAliHLTDataTypeClusterMCInfo;
-       outputBlocks.push_back( bdMCInfo );
-       fBenchmark.AddOutput(bdMCInfo.fSize);
-
-       tSize+=nMCInfo*sizeof(AliHLTTPCClusterFinder::ClusterMCInfo);
-
+       Int_t maxNumberOfClusterMCInfo = (Int_t)((size-tSize-sizeof(AliHLTTPCClusterMCData))/sizeof(AliHLTTPCClusterMCLabel)-1);
+       if( maxNumberOfClusterMCInfo>0 ){
+         AliHLTTPCClusterMCData* outputMCInfo= (AliHLTTPCClusterMCData*)(outputPtr+tSize);
+         outputMCInfo->fCount = fClusterFinder->FillOutputMCInfo(outputMCInfo->fLabels, maxNumberOfClusterMCInfo);
+         
+         AliHLTComponentBlockData bdMCInfo;
+         FillBlockData( bdMCInfo );
+         bdMCInfo.fOffset = tSize;
+         bdMCInfo.fSize = sizeof(AliHLTTPCClusterMCData)+outputMCInfo->fCount*sizeof(AliHLTTPCClusterMCLabel);
+         bdMCInfo.fSpecification = iter->fSpecification;
+         bdMCInfo.fDataType = AliHLTTPCDefinitions::fgkAliHLTDataTypeClusterMCInfo;
+         outputBlocks.push_back( bdMCInfo );
+         fBenchmark.AddOutput(bdMCInfo.fSize);
+         tSize+=bdMCInfo.fSize;
+       }
       }
     }
 
diff --git a/HLT/TPCLib/AliHLTTPCClusterMCData.h b/HLT/TPCLib/AliHLTTPCClusterMCData.h
new file mode 100644 (file)
index 0000000..72cfd15
--- /dev/null
@@ -0,0 +1,54 @@
+#ifndef _ALIHLTTPCCLUSTERMCDATA_H_
+#define _ALIHLTTPCCLUSTERMCDATA_H_
+
+//* This file is property of and copyright by the ALICE HLT Project        * 
+//* ALICE Experiment at CERN, All rights reserved.                         *
+//* See cxx source for full Copyright notice                               *
+
+#include "AliHLTDataTypes.h"
+
+
+/**
+ * @struct AliHLTTPCClusterMCWeight
+ * This in a struct for MC weights
+ * @ingroup alihlt_tpc
+ */
+struct AliHLTTPCClusterMCWeight
+{
+  AliHLTInt32_t  fMCID;     // MC track ID
+  AliHLTFloat32_t fWeight; // weight of the track ID
+};  
+
+typedef struct AliHLTTPCClusterMCWeight AliHLTTPCClusterMCWeight;
+
+/**
+ * @struct AliHLTTPCClusterMCLabel
+ * This in a struct for MC labels
+ * @ingroup alihlt_tpc
+ */
+struct AliHLTTPCClusterMCLabel
+{
+  AliHLTTPCClusterMCWeight fClusterID[3]; // three most relevant MC labels
+};
+
+typedef struct AliHLTTPCClusterMCLabel AliHLTTPCClusterMCLabel;
+
+
+/**
+ * @struct AliHLTTPCClusterMCData
+ * This in a container for MC labels
+ * @ingroup alihlt_tpc
+ */
+struct AliHLTTPCClusterMCData 
+{
+  AliHLTUInt32_t fCount;
+#if defined(__HP_aCC) || defined(__DECCXX) || defined(__SUNPRO_CC)
+  AliHLTTPCClusterMCLabel fLabels[1];
+#else
+  AliHLTTPCClusterMCLabel fLabels[];
+#endif
+};
+
+typedef struct AliHLTTPCClusterMCData AliHLTTPCClusterMCData;
+
+#endif
index 1167f8a..8eb48ed 100644 (file)
@@ -29,6 +29,7 @@ using namespace std;
 #include "AliHLTTPCCADef.h"
 #include "AliHLTTPCDefinitions.h"
 #include "AliHLTTPCSpacePointData.h"
+#include "AliHLTTPCClusterMCData.h"
 
 #include "AliCDBEntry.h"
 #include "AliCDBManager.h"
@@ -36,7 +37,6 @@ using namespace std;
 #include "TObjArray.h"
 #include "AliHLTExternalTrackParam.h"
 #include "AliHLTTrackMCLabel.h"
-#include "AliHLTTPCClusterFinder.h"
 #include <climits>
 #include <cstdlib>
 #include <cerrno>
@@ -50,8 +50,7 @@ AliHLTTPCTrackMCMarkerComponent::AliHLTTPCTrackMCMarkerComponent()
 {
   // see header file for class documentation
   for( int i=0; i<36*6; i++ ){
-    fClusterLabels[i] = 0;
-    fNClusterLabels[i] = 0; 
+    fClusterLabels[i] = 0;    
   }
 }
 
@@ -247,20 +246,20 @@ Int_t AliHLTTPCTrackMCMarkerComponent::GetTrackMCLabel( unsigned int *hits, int
     UInt_t id = hits[ih];
     int iSlice = AliHLTTPCSpacePointData::GetSlice(id);
     int iPatch = AliHLTTPCSpacePointData::GetPatch(id);
-    int iCluster = AliHLTTPCSpacePointData::GetNumber(id);
+    unsigned int iCluster = AliHLTTPCSpacePointData::GetNumber(id);
     if( iSlice<0 || iSlice>=36 || iPatch<0 || iPatch>5 ){
       HLTError("Corrupted TPC cluster Id: slice %d, patch %d, cluster %d",
               iSlice, iPatch,iCluster );
       continue;
     }
-    AliHLTTPCClusterFinder::ClusterMCInfo *patchLabels = fClusterLabels[iSlice*6 + iPatch];
+    AliHLTTPCClusterMCData *patchLabels = fClusterLabels[iSlice*6 + iPatch];
     if( !patchLabels ) continue;
-    if( iCluster >= fNClusterLabels[iSlice*6 + iPatch] ){
+    if( iCluster >= patchLabels->fCount ){
       HLTError("TPC slice %d, patch %d: ClusterID==%d >= N MC labels==%d ",
-              iSlice, iPatch,iCluster, fNClusterLabels[iSlice*6 + iPatch] );
+              iSlice, iPatch,iCluster, patchLabels->fCount);
       continue;
     }
-    AliHLTTPCClusterFinder::ClusterMCInfo &lab = patchLabels[iCluster];            
+    AliHLTTPCClusterMCLabel &lab = patchLabels->fLabels[iCluster];         
     if ( lab.fClusterID[0].fMCID >= 0 ) labels.push_back( lab.fClusterID[0].fMCID );
     if ( lab.fClusterID[1].fMCID >= 0 ) labels.push_back( lab.fClusterID[1].fMCID );
     if ( lab.fClusterID[2].fMCID >= 0 ) labels.push_back( lab.fClusterID[2].fMCID );
@@ -311,7 +310,6 @@ int AliHLTTPCTrackMCMarkerComponent::DoEvent( const AliHLTComponentEventData &ev
 
   for( int i=0; i<36*6; i++ ){
     fClusterLabels[i] = 0;
-    fNClusterLabels[i] = 0;
   }
 
   int nBlocks = (int)evtData.fBlockCnt;
@@ -325,9 +323,8 @@ int AliHLTTPCTrackMCMarkerComponent::DoEvent( const AliHLTComponentEventData &ev
     if(iter->fDataType == AliHLTTPCDefinitions::fgkAliHLTDataTypeClusterMCInfo ) {
       Int_t slice=AliHLTTPCDefinitions::GetMinSliceNr(iter->fSpecification);
       Int_t patch=AliHLTTPCDefinitions::GetMinPatchNr(iter->fSpecification);
-      fClusterLabels[ slice*6 + patch] = (AliHLTTPCClusterFinder::ClusterMCInfo *)iter->fPtr;
-      fNClusterLabels[ slice*6 + patch] = iter->fSize/sizeof(AliHLTTPCClusterFinder::ClusterMCInfo);
-      nInputMCLabels+=fNClusterLabels[ slice*6 + patch];
+      fClusterLabels[ slice*6 + patch] = (AliHLTTPCClusterMCData*)iter->fPtr;
+      nInputMCLabels+=fClusterLabels[ slice*6 + patch]->fCount;
     }
   }
       
index 9a4eff7..bbf3400 100644 (file)
@@ -16,7 +16,7 @@
 */
 
 #include "AliHLTProcessor.h"
-#include "AliHLTTPCClusterFinder.h"
+class AliHLTTPCClusterMCData;
 
 /**
  * @class AliHLTTPCTrackMCMarkerComponent
@@ -115,8 +115,7 @@ class AliHLTTPCTrackMCMarkerComponent : public AliHLTProcessor
 
     /** array of pointers to cluster MC labels **/
 
-    AliHLTTPCClusterFinder::ClusterMCInfo *fClusterLabels[36*6]; //! cluster MC labels for each TPC patch
-    Int_t fNClusterLabels[36*6]; //! Number of MC labels, for check of consistensy
+    AliHLTTPCClusterMCData *fClusterLabels[36*6]; //! cluster MC labels for each TPC patch
 
     ClassDef( AliHLTTPCTrackMCMarkerComponent, 0 )
 };