]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
- overload function FillTracksChecked in AliHLTTPCTrackArray.* to make it work with...
authorkkanaki <kkanaki@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 29 Jul 2009 16:24:42 +0000 (16:24 +0000)
committerkkanaki <kkanaki@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 29 Jul 2009 16:24:42 +0000 (16:24 +0000)
- modify the loops over clusters and tracks in AliHLTTPCTrackHistoComponent to have easier access to the used clusters
- update to the new track structure to enable the ntuple filling

HLT/TPCLib/AliHLTTPCTrackArray.cxx
HLT/TPCLib/AliHLTTPCTrackArray.h
HLT/TPCLib/AliHLTTPCTrackHistoComponent.cxx
HLT/TPCLib/AliHLTTPCTrackHistoComponent.h

index 05f2cddc4fdb5f31a7cd2ad20a5eb7f799e629b9..634ef5459a70af54fc4b19ddd40179e0525a1fc4 100644 (file)
@@ -37,6 +37,7 @@
 #include "AliHLTTPCTrackSegmentData.h"
 #include "AliHLTTPCTransform.h"
 #include "AliHLTTPCConfMapPoint.h"
+#include "AliHLTExternalTrackParam.h"
 
 #if __GNUC__ >= 3
 using namespace std;
@@ -248,6 +249,117 @@ int AliHLTTPCTrackArray::FillTracks(Int_t ntracks, AliHLTTPCTrackSegmentData* tr
   return FillTracksChecked(tr, ntracks, 0, slice, bTransform);
 }
 
+int AliHLTTPCTrackArray::FillTracksChecked(AliHLTExternalTrackParam* tr, Int_t ntracks, unsigned int sizeInByte, Int_t slice, Int_t bTransform)
+{
+  int iResult=0;
+  AliHLTExternalTrackParam *trs = tr;
+  
+  for(Int_t i=0; i<ntracks; i++){
+    if (sizeInByte>0 && 
+       (((AliHLTUInt8_t*)trs)+sizeof(AliHLTExternalTrackParam)>((AliHLTUInt8_t*)tr)+sizeInByte ||
+        ((AliHLTUInt8_t*)trs)+sizeof(AliHLTExternalTrackParam)+trs->fNPoints*sizeof(UInt_t)>((AliHLTUInt8_t*)tr)+sizeInByte)) {
+      iResult=-EDOM;
+      break;
+    }
+    AliHLTTPCTrack *track = NextTrack(); 
+    track->SetId( i );
+    track->SetPt(trs->fq1Pt);
+    track->SetPterr(trs->fC[14]);
+    Float_t psi[1];
+    psi[0]=trs->fSinPsi;
+    if (slice>=0 && bTransform!=0)  {
+      AliHLTTPCTransform::Local2GlobalAngle(psi,slice);
+    }
+    //cout << "psi " << psi[0] << endl;
+    track->SetPsi(psi[0]);
+    track->SetTgl(trs->fTgl);
+    track->SetPsierr(trs->fC[5]);
+    track->SetTglerr(trs->fC[9]);
+    track->SetY0err(trs->fC[0]);
+    track->SetZ0err(trs->fC[2]);
+    track->SetNHits(trs->fNPoints);
+    //track->SetCharge(trs->fCharge);
+    Float_t first[3];
+    first[0]=trs->fX;first[1]=trs->fY;first[2]=trs->fZ;
+    if (slice>=0 && bTransform!=0)  {
+      AliHLTTPCTransform::Local2Global(first,slice);
+    }
+    //cout << "first point: " << first[0] << " " << first[1] << " " << first[3] << endl;
+    track->SetFirstPoint(first[0],first[1],first[2]);
+    Float_t last[3];
+    last[0]=trs->fLastX;last[1]=trs->fLastY;last[2]=trs->fLastZ;
+    if (slice>=0 && bTransform!=0)  {
+      AliHLTTPCTransform::Local2Global(last,slice);
+    }
+    //cout << "last point: " << last[0] << " " << last[1] << " " << last[3] << endl;
+    track->SetLastPoint(last[0],last[1],last[2]);
+    track->SetHits( trs->fNPoints, trs->fPointIDs );
+
+    //if (slice>=0 && bTransform!=0)  {
+      // Matthias Feb07: as everything is now in global coordinates, sector should
+      // be set to 0. But as the display does a check on the sector, we have to set
+      // it to the slice no. I suspect, that the transformation is done twice.
+      //track->SetSector(0);
+    
+      track->SetSector(slice);
+    
+    //} else {
+      // the parameters are in local coordinates, set the sector no
+      //#ifndef INCLUDE_TPC_HOUGH
+      //if (slice<0) track->SetSector(0);
+      //else track->SetSector(slice);
+      //#else 
+      // Matthias Feb 2007: this is some kind of legacy ...
+      // the INCLUDE_TPC_HOUGH has never been switched on in the new TPCLib
+      // and this line was below in the corresponding block. As the slice
+      // parameter is very useful but not available if the define is off
+      // we distinguish the two cases here. Should be cleaned up.
+      // Matthias April 2007: update, try to integrate Cvetans Hough tracker
+      // so we need the support for the AliHLTTPCHoughTrack. I dont have the
+      // full control of this code (should we use slice or trs->fSector?)
+      // But the FillTracks method is never called from the hough code, so we
+      // take 'slice'
+      if (GetTrackType()=='h') {
+       AliErrorClassStream() << "FillTracks was never used with AliHLTTPCHoughTrack:" 
+                          << " CHECK THIS CODE!!!" << endl;
+      }
+      //track->SetSector(trs->fSector);
+      //#endif // INCLUDE_TPC_HOUGH
+      //}
+
+    // this is currently a quick hack for straight lines of the first version 
+    // of the CA tracker.
+    // we have to think about a more general way of treating straight and curved
+    // tracks
+    if ( trs->fq1Pt == -9876.0 ||  trs->fq1Pt == -1.0) {
+      track->SetPhi0(atan2(first[1],first[0]));
+      track->SetKappa(1.0);
+      track->SetRadius(999999.0);
+    } else {
+      // Matthias Feb07: just tried to take this away, but this causes the tracks
+      // in the display not to be drawn. But we still have to tink about this.
+      track->CalculateHelix();
+    }
+
+#ifdef INCLUDE_TPC_HOUGH
+#ifdef ROWHOUGHPARAMS
+    if(GetTrackType()=='h') {
+      ((AliHLTTPCHoughTrack *)track)->SetWeight(trs->fWeight);
+      ((AliHLTTPCHoughTrack *)track)->SetBinXY(trs->fBinX,trs->fBinY,trs->fBinXSize,trs->fBinYSize);
+    }
+    track->SetMCid(trs->fTrackID);
+    track->SetRowRange(trs->fRowRange1,trs->fRowRange2);
+    track->SetPID(trs->fPID);
+#endif
+#endif // INCLUDE_TPC_HOUGH
+    track->CheckConsistency();
+
+    UChar_t *tmpP = (UChar_t*)trs;
+    tmpP += sizeof(AliHLTExternalTrackParam)+trs->fNPoints*sizeof(UInt_t);
+    trs = (AliHLTExternalTrackParam*)tmpP;
+  }
+}
+
 int AliHLTTPCTrackArray::FillTracksChecked(AliHLTTPCTrackSegmentData* tr, Int_t ntracks, unsigned int sizeInByte, Int_t slice, Int_t bTransform)
 {
   //Read tracks from shared memory (or memory)
index 77a91b0d084a43f4ddf1480cacd830391e384a58..0029f49b132c85cab51fe7e132cffeac0ad9a05a 100644 (file)
@@ -20,7 +20,7 @@ class AliHLTTPCConfMapTrack;
 class AliHLTTPCTrack;
 class AliHLTTPCTrackSegmentData;
 class AliHLTTPCTrackSegmentDataV1;
-
+class AliHLTExternalTrackParam;
 /**
  * @class AliHLTTPCTrackArray
  * Array of AliHLTTrack objects.
@@ -129,6 +129,7 @@ class AliHLTTPCTrackArray {
    * @param bTransform   transform to global coordinates if 1
    */
   int FillTracksChecked(AliHLTTPCTrackSegmentData* tr, Int_t ntracks, unsigned int sizeInByte, Int_t slice=-1, Int_t bTransform=1);
+  int FillTracksChecked(AliHLTExternalTrackParam* tr, Int_t ntracks, unsigned int sizeInByte, Int_t slice=-1, Int_t bTransform=1);
 
   /**
    * Fill array from version1 structure.
index 6b24309c284c548c4bf03999faf31c6388e044ae..41b544689a7988ab8b3be4a51bce6004980c562a 100644 (file)
@@ -33,17 +33,18 @@ using namespace std;
 #include "AliHLTTPCTrackletDataFormat.h"
 #include "AliHLTTPCMemHandler.h"
 #include "AliHLTTPCDefinitions.h"
+#include "AliHLTTPCTrackArray.h"
+#include "AliHLTTPCTrack.h"
+//#include "AliHLTGlobalBarrelTrack.h"
+#include "AliHLTExternalTrackParam.h"
+#include "AliHLTDataTypes.h"
+
 #include <TFile.h>
 #include <TString.h>
 #include "TNtuple.h"
 #include "TObjString.h"
 #include "TObjArray.h"
-#include "AliHLTTPCTrackArray.h"
-#include "AliHLTTPCTrack.h"
 
-//#include "AliHLTTPC.h"
-//#include <stdlib.h>
-//#include <cerrno>
 
 AliHLTTPCTrackHistoComponent gAliHLTTPCTrackHistoComponent;
 
@@ -51,90 +52,88 @@ AliHLTTPCTrackHistoComponent gAliHLTTPCTrackHistoComponent;
 ClassImp(AliHLTTPCTrackHistoComponent)
 
 AliHLTTPCTrackHistoComponent::AliHLTTPCTrackHistoComponent()
-:
-fClusters(NULL),
+  :
+  fMinSlice(35),
+  fMaxSlice(0),
+  fMinPartition(5),
+  fMaxPartition(0),
+  fClusters(NULL),
   fTracks(NULL),
   fTracksArray(NULL)
+  //fClustersArray(NULL),
+  //fNSpacePoints(NULL)
 {
-  
   // see header file for class documentation
   // or
   // refer to README to build package
   // or
   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
-
 }
 
-AliHLTTPCTrackHistoComponent::~AliHLTTPCTrackHistoComponent()
-{
-  // see header file for class documentation
+AliHLTTPCTrackHistoComponent::~AliHLTTPCTrackHistoComponent(){
+// see header file for class documentation
 }
 
 // Public functions to implement AliHLTComponent's interface.
 // These functions are required for the registration process
 
-const char* AliHLTTPCTrackHistoComponent::GetComponentID()
-{
-  // see header file for class documentation
+const char* AliHLTTPCTrackHistoComponent::GetComponentID(){
+// see header file for class documentation
   
   return "TPCTrackHisto";
 }
 
-void AliHLTTPCTrackHistoComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list)
-{
-  // see header file for class documentation
+void AliHLTTPCTrackHistoComponent::GetInputDataTypes(AliHLTComponentDataTypeList& list){
+// see header file for class documentation
   list.clear();
-  list.push_back( AliHLTTPCDefinitions::fgkClustersDataType );
-  list.push_back( AliHLTTPCDefinitions::fgkTrackSegmentsDataType );
-  list.push_back( AliHLTTPCDefinitions::fgkTracksDataType );
+  list.push_back(AliHLTTPCDefinitions::fgkClustersDataType);
+  list.push_back(AliHLTTPCDefinitions::fgkTrackSegmentsDataType);
+  //list.push_back(AliHLTTPCDefinitions::fgkTracksDataType);
+  list.push_back(kAliHLTDataTypeTrack|kAliHLTDataOriginTPC);
+  list.push_back(kAliHLTDataTypeTObjArray|kAliHLTDataOriginTPC);
 }
 
-AliHLTComponentDataType AliHLTTPCTrackHistoComponent::GetOutputDataType()
-{
-  // see header file for class documentation
+AliHLTComponentDataType AliHLTTPCTrackHistoComponent::GetOutputDataType(){
+// see header file for class documentation
   return kAliHLTDataTypeTNtuple;
-
 }
 
-void AliHLTTPCTrackHistoComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
-{
-  // see header file for class documentation
-  // XXX TODO: Find more realistic values.
+void AliHLTTPCTrackHistoComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ){
+// see header file for class documentation
+  
   constBase = 0;
-  inputMultiplier = 1;
+  inputMultiplier = 1;// XXX TODO: Find more realistic value
 }
 
-AliHLTComponent* AliHLTTPCTrackHistoComponent::Spawn()
-{
-  // see header file for class documentation
+AliHLTComponent* AliHLTTPCTrackHistoComponent::Spawn(){
+// see header file for class documentation
   return new AliHLTTPCTrackHistoComponent;
 }
 
-int AliHLTTPCTrackHistoComponent::DoInit( int argc, const char** argv )
-{
+int AliHLTTPCTrackHistoComponent::DoInit( int argc, const char** argv ){
+// see header file for class documentation
  
-  fClusters = new TNtuple("fCluster", "fCluster", "charge:qmax:residualY:residualZ:used:event"); 
-  fTracks = new TNtuple("fTracks", "fTracks", "pt:eta:psi:nclusters:event"); 
-  fTracksArray=new AliHLTTPCTrackArray();
-
-  int iResult=0;
-  TString configuration="";
-  TString argument="";
-  for (int i=0; i<argc && iResult>=0; i++) {
-    argument=argv[i];
-    if (!configuration.IsNull()) configuration+=" ";
-    configuration+=argument;
+  fClusters = new TNtuple("fClusters", "fClusters", "charge:qmax:residualY:residualZ:event"); 
+  fTracks   = new TNtuple("fTracks",  "fTracks",  "pt:eta:psi:nclusters:event"); 
+  fTracksArray = new AliHLTTPCTrackArray();
+
+  int iResult = 0;
+  TString configuration = "";
+  TString argument = "";
+  for(int i=0; i<argc && iResult>=0; i++){
+      argument = argv[i];
+      if(!configuration.IsNull()) configuration += " ";
+      configuration += argument;
   }
   
-  if (!configuration.IsNull()) {
-    iResult=Configure(configuration.Data());
+  if(!configuration.IsNull()){
+     iResult = Configure(configuration.Data());
   }  
   return iResult; 
 }
   
-int AliHLTTPCTrackHistoComponent::DoDeinit()
-{
-  // see header file for class documentation
+int AliHLTTPCTrackHistoComponent::DoDeinit(){
+// see header file for class documentation
   
   delete fClusters;
   delete fTracks;
@@ -143,103 +142,82 @@ int AliHLTTPCTrackHistoComponent::DoDeinit()
   return 0;
 }
 
-int AliHLTTPCTrackHistoComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/)
-{
-  if(!fTracksArray){fTracksArray=new AliHLTTPCTrackArray();}
-
-  const AliHLTComponentBlockData* iter = NULL;
-
-  if ( GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR ) )
-    return 0;
+int AliHLTTPCTrackHistoComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/){
+// see header file for class documentation
 
-  Int_t TotalTrack = 0;
+  if(GetFirstInputBlock(kAliHLTDataTypeSOR) || GetFirstInputBlock(kAliHLTDataTypeEOR)) return 0;  
+  if(!fTracksArray) fTracksArray = new AliHLTTPCTrackArray();
 
-  //Reading Merged Tracks
-  for ( iter = GetFirstInputBlock(AliHLTTPCDefinitions::fgkTracksDataType); iter != NULL; iter = GetNextInputBlock() ) {
-    if(iter->fDataType!=AliHLTTPCDefinitions::fgkTracksDataType){continue;}
-    ReadTracks(iter,TotalTrack);  
-  }
-
-  //Reading Tracks form slice
-  for ( iter = GetFirstInputBlock(AliHLTTPCDefinitions::fgkTrackSegmentsDataType); iter != NULL; iter = GetNextInputBlock() ) {
-    if(iter->fDataType!=AliHLTTPCDefinitions::fgkTrackSegmentsDataType){continue;}
-    ReadTracks(iter,TotalTrack);
-  }
+  const AliHLTComponentBlockData *iter = NULL;
 
-  int TotalSpacePoint = 0;
-  int nClustersUsed=0;
+//   //----------------- loop over slice tracks ----------------------//
+//  
+//   for(iter = GetFirstInputBlock(AliHLTTPCDefinitions::fgkTrackSegmentsDataType); iter != NULL; iter = GetNextInputBlock()){
+//       if(iter->fDataType!=AliHLTTPCDefinitions::fgkTrackSegmentsDataType)continue;
+//       ReadTracks(iter,totalTracks);
+//   }
+  
  
-  for ( iter = GetFirstInputBlock(AliHLTTPCDefinitions::fgkClustersDataType); iter != NULL; iter = GetNextInputBlock() ) {
-    
-    if(iter->fDataType!=AliHLTTPCDefinitions::fgkClustersDataType){continue;}
-
-    AliHLTUInt8_t slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
-    AliHLTUInt8_t patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
-
-    //HLTDebug ( "Input Data - TPC cluster - Slice/Patch: %d/%d.", slice, patch );
-    const AliHLTTPCClusterData* clusterData = (const AliHLTTPCClusterData*) iter->fPtr;
-    Int_t nSpacepoint = (Int_t) clusterData->fSpacePointCnt;    
-    TotalSpacePoint += nSpacepoint;
-    //HLTInfo("TrackHisto found %d Spacepoints in slice %d patch %d", nSpacepoint, slice, patch);
-    AliHLTTPCSpacePointData *clusters = (AliHLTTPCSpacePointData*) clusterData->fSpacePoints;
-    
-    if (fClustersArray[slice][patch]!=NULL) {
-      delete(fClustersArray[slice][patch]);
-      fClustersArray[slice][patch]=NULL;
-    }
-    Int_t arraysize=nSpacepoint*sizeof(AliHLTTPCSpacePointData);
-    fClustersArray[slice][patch] = (AliHLTTPCSpacePointData*)new Byte_t[arraysize];
-    if (fClustersArray[slice][patch]) {
-      memcpy(fClustersArray[slice][patch], clusters, arraysize);
-      fNcl[slice][patch]=nSpacepoint;
-    } else {
-      fNcl[slice][patch]=nSpacepoint;
-      HLTError ( "Memory allocation failed!" );
-    }
+  //----------------- loop over cluster blocks ---------------------//
+  
+  Int_t totalSpacePoints = 0;
+  
+  for(iter = GetFirstInputBlock(AliHLTTPCDefinitions::fgkClustersDataType); iter != NULL; iter = GetNextInputBlock()){
+            
+      if(iter->fDataType!=AliHLTTPCDefinitions::fgkClustersDataType) continue;
+
+      AliHLTUInt8_t minSlice     = AliHLTTPCDefinitions::GetMinSliceNr(*iter);
+      AliHLTUInt8_t minPartition = AliHLTTPCDefinitions::GetMinPatchNr(*iter);
+      //HLTDebug("Input Data - TPC cluster - slice/partition: %d/%d.", minSlice, minPartition);
+
+      const AliHLTTPCClusterData* clusterData = (const AliHLTTPCClusterData*)iter->fPtr;
+      Int_t nSpacepoint = (Int_t)clusterData->fSpacePointCnt;    
+      totalSpacePoints += nSpacepoint;
+      HLTDebug("TrackHisto component found %d spacepoints in slice %d partition %d", nSpacepoint, minSlice, minPartition);
+      
+      AliHLTTPCSpacePointData *clusters = (AliHLTTPCSpacePointData*)clusterData->fSpacePoints;
+      
+      if(fClustersArray[minSlice][minPartition] != NULL){
+         //delete(fClustersArray[minSlice][minPartition]);
+         fClustersArray[minSlice][minPartition] = NULL;
+      }      
+
+      // fill the array with AliHLTTPCSpacePointData pointers
+      // it will be used in the track loop to access information
+      // for the used clusters only
+      fClustersArray[minSlice][minPartition] = clusters;
+      fNSpacePoints[minSlice][minPartition]  = nSpacepoint;
+      
+      if(nSpacepoint==0) fClustersArray[minSlice][minPartition] = NULL;
+
+  } // end of loop over cluster data blocks
+  
+  HLTInfo("TrackHisto found %d spacepoints",totalSpacePoints);
+  
+  
+  
+  
+  //----------------- loop over merged tracks -------------------//
 
-    for(int i=0;i<nSpacepoint;i++){
-      UInt_t idCluster = clusters[i].fID;
-      Int_t sliceCl = (idCluster>>25) & 0x7f;
-      Int_t patchCl = (idCluster>>22) & 0x7;
-      UInt_t pos = idCluster&0x3fffff;
-      Int_t used = 0;
-      Float_t resy = 0, resz = 0;
-      for(UInt_t id=0;id<fTrackClusterID[sliceCl][patchCl].size();id++){
-       if(fTrackClusterID[sliceCl][patchCl][id]==pos){
-         clusters[i].fUsed=kTRUE;
-         nClustersUsed++;
-         used=1;
-         FillResidual(pos,sliceCl,patchCl,resy,resz);
-       }
-      }
-      if(used==1){
-       fClusters->Fill(clusters[i].fCharge,clusters[i].fQMax,resy,resz,used,GetEventId()); 
-      }
-      else{
-       fClusters->Fill(clusters[i].fCharge,clusters[i].fQMax,-100,-100,used,GetEventId()); 
-      }
-    }
-  } 
+  Int_t totalTracks = 0;
   
-  HLTInfo("TrackHisto found %d Spacepoints",TotalSpacePoint);
-  HLTInfo("TrackHisto found %d Tracks",TotalTrack);
+  for(iter = GetFirstInputBlock(kAliHLTDataTypeTrack|kAliHLTDataOriginTPC); iter != NULL; iter = GetNextInputBlock()){    
+      if(iter->fDataType != (kAliHLTDataTypeTrack|kAliHLTDataOriginTPC)) continue; 
+      ReadTracks(iter,totalTracks);
+  }
   
+  HLTInfo("TrackHisto found %d tracks",     totalTracks);  
   PushHisto();
 
   delete fTracksArray;
-  fTracksArray=NULL;
-
-  for(UInt_t i=0;i<36;i++){
-    for(UInt_t j=0;j<6;j++){ 
-      fTrackClusterID[i][j].clear();
-    }
-  }
+  fTracksArray = NULL;
 
   return 0;
 }
  
- int AliHLTTPCTrackHistoComponent::Configure(const char* arguments)
- {
+int AliHLTTPCTrackHistoComponent::Configure(const char* arguments){
+// see header file for class documentation
    
    int iResult=0;
    if (!arguments) return iResult;
@@ -258,22 +236,68 @@ int AliHLTTPCTrackHistoComponent::DoEvent(const AliHLTComponentEventData& /*evtD
        break;
      }
      delete pTokens;
-   }
-   
+   }   
    return iResult;
  }
  
 void AliHLTTPCTrackHistoComponent::ReadTracks(const AliHLTComponentBlockData* iter,Int_t &tt){
+// see header file for class documentation
 
-  AliHLTUInt8_t slice = AliHLTTPCDefinitions::GetMinSliceNr( *iter );
-  //AliHLTUInt8_t patch = AliHLTTPCDefinitions::GetMinPatchNr( *iter );
+  AliHLTUInt8_t slice    = AliHLTTPCDefinitions::GetMinSliceNr(*iter);
+  AliHLTUInt8_t partition = AliHLTTPCDefinitions::GetMinPatchNr(*iter);
+  if( slice     < fMinSlice )    fMinSlice     = slice;
+  if( slice     > fMaxSlice )    fMaxSlice     = slice;
+  if( partition < fMinPartition ) fMinPartition = partition;
+  if( partition > fMaxPartition ) fMaxPartition = partition;
+   
+  AliHLTTracksData *trackData = (AliHLTTracksData*)(iter->fPtr);
+  AliHLTUInt32_t nTracks = trackData->fCount;
+
+  AliHLTExternalTrackParam *track = (AliHLTExternalTrackParam*)trackData->fTracklets;
+  tt+= nTracks;
+
+  fTracksArray->FillTracksChecked(trackData->fTracklets,trackData->fCount,iter->fSize,slice,true);
+  
+  Int_t usedSpacePoints = 0;
   
-  //HLTDebug ( "Input Data - TPC cluster - Slice/Patch: %d/%d.", slice, patch );
+  for(AliHLTUInt32_t i=0;i<nTracks;i++){
+   
+    UInt_t nHits = track->fNPoints;
+    fTracks->Fill( track->fq1Pt, track->fSinPsi, track->fTgl, nHits, GetEventId() ); 
+    
+    const UInt_t *hitnum = track->fPointIDs;
+    for(UInt_t h=0; h<nHits; h++){
+       
+        UInt_t idTrack = hitnum[h];
+        Int_t sliceTrack = (idTrack>>25) & 0x7f;
+        Int_t patchTrack = (idTrack>>22) & 0x7;
+        UInt_t pos = idTrack&0x3fffff;
+          
+        // use the fClustersArray that was filled in the cluster loop
+        if( !fClustersArray[sliceTrack][patchTrack]  ) continue;
+        if( fNSpacePoints[sliceTrack][patchTrack]<pos ) HLTError("Space point array out of boundaries!");
+       
+       Float_t resy = 0., resz = 0.;
+     
+        FillResidual(pos,sliceTrack,patchTrack,resy,resz);
+        fClusters->Fill( (fClustersArray[sliceTrack][patchTrack])[pos].fCharge, (fClustersArray[sliceTrack][patchTrack])[pos].fQMax, resy, resz, GetEventId() );
+
+        usedSpacePoints++;
+    }
+    UChar_t *tmpP = (UChar_t*)track;
+    tmpP += sizeof(AliHLTExternalTrackParam)+track->fNPoints*sizeof(UInt_t);
+    track = (AliHLTExternalTrackParam*)tmpP;
+  }
+
+
+/*  //HLTDebug ( "Input Data - TPC cluster - Slice/Patch: %d/%d.", slice, partition );
   AliHLTTPCTrackletData* trackData = (AliHLTTPCTrackletData*) iter->fPtr;
   AliHLTUInt32_t nTracks = trackData->fTrackletCnt;
   fTracksArray->FillTracksChecked(trackData->fTracklets,trackData->fTrackletCnt,iter->fSize,slice,true);
-  tt += nTracks;
-  //HLTInfo("TrackHisto found %d Tracks in slice %d patch %d", nTracks, slice, patch);
+  
+  //HLTInfo("TrackHisto found %d Tracks in slice %d partition %d", nTracks, slice, partition);
   AliHLTTPCTrackSegmentData *tracks = (AliHLTTPCTrackSegmentData*) trackData->fTracklets;
   
   for(AliHLTUInt32_t i=0;i<nTracks;i++){
@@ -292,40 +316,44 @@ void AliHLTTPCTrackHistoComponent::ReadTracks(const AliHLTComponentBlockData* it
     UChar_t *tmpP = (UChar_t*)tracks;
     tmpP += sizeof(AliHLTTPCTrackSegmentData)+tracks->fNPoints*sizeof(UInt_t);
     tracks = (AliHLTTPCTrackSegmentData*)tmpP;
-  } 
+  } */
 }
 
 void AliHLTTPCTrackHistoComponent::PushHisto(){
+// see header file for class documentation
 
-    AliHLTUInt32_t fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification(0,35,0,5);
-    PushBack( (TObject*) fTracks,kAliHLTDataTypeTNtuple, fSpecification);   
-    PushBack( (TObject*) fClusters,kAliHLTDataTypeTNtuple, fSpecification);   
-  
+    AliHLTUInt32_t fSpecification = AliHLTTPCDefinitions::EncodeDataSpecification(fMinSlice,fMaxSlice,fMinPartition,fMaxPartition);
+    PushBack( (TObject*)fTracks,  kAliHLTDataTypeTNtuple, fSpecification);   
+    PushBack( (TObject*)fClusters,kAliHLTDataTypeTNtuple, fSpecification);     
 }
-void AliHLTTPCTrackHistoComponent::FillResidual( UInt_t pos,AliHLTUInt8_t slice,AliHLTUInt8_t patch,Float_t& resy,Float_t& resz){
 
-  AliHLTTPCSpacePointData *cl =  &fClustersArray[slice][patch][pos];
-  if(!cl){return;}
+void AliHLTTPCTrackHistoComponent::FillResidual(UInt_t pos,AliHLTUInt8_t slice,AliHLTUInt8_t partition,Float_t& resy,Float_t& resz){
+// see header file for class documentation
+
+  AliHLTTPCSpacePointData *cl =  &fClustersArray[slice][partition][pos];
+  if(!cl) return;
 
   AliHLTTPCTrack *gtrack = NULL;
 
-  for(int i=0;i<fTracksArray->GetNTracks();i++){
-    AliHLTTPCTrack *tt = fTracksArray->GetCheckedTrack(i); 
-    UInt_t *hitnum =tt->GetHitNumbers();
-    Int_t nHits = tt->GetNHits();
-    for(Int_t h=0; h<nHits; h++){
-      UInt_t id=hitnum[h];
-      Int_t Tslice = (id>>25) & 0x7f;
-      Int_t Tpatch = (id>>22) & 0x7;
-      UInt_t Tpos = id&0x3fffff; 
-      if(Tslice==slice && Tpatch==patch && Tpos==pos) {
-       gtrack = tt; 
-       break;
-      }
-    }
-  }
-  
-  if(!gtrack){return;}
+   for(int i=0;i<fTracksArray->GetNTracks();i++){
+       
+       AliHLTTPCTrack *tt = fTracksArray->GetCheckedTrack(i); 
+       UInt_t *hitnum =tt->GetHitNumbers();
+       Int_t nHits = tt->GetNHits();
+         
+       for(Int_t h=0; h<nHits; h++){
+           UInt_t id=hitnum[h];
+             Int_t Tslice = (id>>25) & 0x7f;
+             Int_t Tpatch = (id>>22) & 0x7;
+             UInt_t Tpos = id&0x3fffff; 
+             if(Tslice==slice && Tpatch==partition && Tpos==pos){
+              gtrack = tt; 
+              break;
+             }
+         }
+   }
+   
+  if(!gtrack) return;
 
   Int_t tslice = gtrack->GetSector();
   Double_t radius = gtrack->GetRadius();      // radius
@@ -389,8 +417,7 @@ void AliHLTTPCTrackHistoComponent::FillResidual( UInt_t pos,AliHLTUInt8_t slice,
        
        resy = deltaY;
        resz = deltaZ;
-  }
-  else{
+  } else {
     resy = -1000;
     resz = -1000;
   }
index 2debf85957856708315dfcc09b263a01e344d3a9..0f7de20f84e3c0d93b924b768c7802e6c8ea6a2e 100644 (file)
@@ -113,15 +113,20 @@ private:
   void PushHisto();
   void FillResidual( UInt_t pos,AliHLTUInt8_t slice,AliHLTUInt8_t patch,Float_t& resy,Float_t& resz);
  
-  TNtuple *fClusters;                                              //! transient  
-  TNtuple *fTracks;                                                //! transient
+  AliHLTUInt8_t fMinSlice;     //! transient
+  AliHLTUInt8_t fMaxSlice;     //! transient
+  AliHLTUInt8_t fMinPartition; //! transient
+  AliHLTUInt8_t fMaxPartition; //! transient
+  TNtuple *fClusters;                             //! transient  
+  TNtuple *fTracks;                               //! transient
 
-  vector<UInt_t> fTrackClusterID[36][6];                           //! transient
+  vector<UInt_t> fTrackClusterID[36][6];          //! transient
+  AliHLTTPCTrackArray     *fTracksArray;          //! transient
+  AliHLTTPCSpacePointData *fClustersArray[36][6]; //! transient
+  UInt_t                   fNSpacePoints[36][6];  //! transient
 
-  AliHLTTPCTrackArray *fTracksArray;                               //! transient
-  AliHLTTPCSpacePointData *fClustersArray[36][6];                  //! transient
-  UInt_t fNcl[36][6];                                              //! transient
-  
   ClassDef(AliHLTTPCTrackHistoComponent, 1);
 
 };