+
+ if( fMakeFriends ){ // create friend track
+
+ AliHLTGlobalBarrelTrack gb(*element);
+ AliTPCseed tTPC;
+ tTPC.Set( gb.GetX(), gb.GetAlpha(), gb.GetParameter(), gb.GetCovariance() );
+ tTPC.SetLabel(mcLabel);
+
+ // set the clusters
+ UInt_t nClusters = element->GetNumberOfPoints();
+ const UInt_t*clusterIDs = element->GetPoints();
+
+ tTPC.SetNumberOfClusters(nClusters);
+
+ for(UInt_t ic=0; ic<nClusters; ic++){
+
+ UInt_t id = clusterIDs[ic];
+ int iSlice = AliHLTTPCSpacePointData::GetSlice(id);
+ int iPartition = AliHLTTPCSpacePointData::GetPatch(id);
+ int iCluster = AliHLTTPCSpacePointData::GetNumber(id);
+
+ if(iSlice<0 || iSlice>36 || iPartition<0 || iPartition>5){
+ HLTError("Corrupted TPC cluster Id: slice %d, partition %d, cluster %d", iSlice, iPartition, iCluster);
+ continue;
+ }
+
+ AliTPCclusterMI *patchClusters = fPartitionClusters[iSlice*6 + iPartition];
+ if(!patchClusters){
+ HLTError("Clusters are missed for slice %d, partition %d", iSlice, iPartition );
+ continue;
+ }
+
+ if(iCluster >= fNPartitionClusters[iSlice*6 + iPartition]){
+ HLTError("TPC slice %d, partition %d: ClusterID==%d >= N Cluaters==%d ", iSlice, iPartition,iCluster, fNPartitionClusters[iSlice*6 + iPartition] );
+ continue;
+ }
+
+ AliTPCclusterMI *c = &(patchClusters[iCluster]);
+ int sec = c->GetDetector();
+ int row = c->GetRow();
+ if(sec >= 36) row = row + AliHLTTPCTransform::GetNRowLow();
+
+ tTPC.SetClusterPointer(row, c);
+
+ AliTPCTrackerPoint &point = *( tTPC.GetTrackPoint( row ) );
+ //tTPC.Propagate( TMath::DegToRad()*(sec%18*20.+10.), c->GetX(), fSolenoidBz );
+ Double_t angle2 = tTPC.GetSnp()*tTPC.GetSnp();
+ angle2 = (angle2<1) ?TMath::Sqrt(angle2/(1-angle2)) :10.;
+ point.SetAngleY( angle2 );
+ point.SetAngleZ( tTPC.GetTgl() );
+ } // end of associated cluster loop
+
+ // Cook dEdx
+
+ AliTPCseed *seed = &(tTPC);
+ //fSeedArray->AddAt( seed, TMath::Abs(seed->GetLabel()) );
+ //fdEdx->Fill( seed->P()*seed->Charge(), seed->CookdEdx(0.02, 0.6) );
+
+ AliESDfriendTrack friendTrack;
+ friendTrack.AddCalibObject(&tTPC);
+ esdFriend->AddTrack(&friendTrack);
+ }