// @(#) $Id$ //*************************************************************************** // This file is property of and copyright by the ALICE HLT Project * // ALICE Experiment at CERN, All rights reserved. * // * // Primary Authors: Sergey Gorbunov * // Ivan Kisel * // for The ALICE HLT Project. * // * // Permission to use, copy, modify and distribute this software and its * // documentation strictly for non-commercial purposes is hereby granted * // without fee, provided that the above copyright notice appears in all * // copies and that both the copyright notice and this permission notice * // appear in the supporting documentation. The authors make no claims * // about the suitability of this software for any purpose. It is * // provided "as is" without express or implied warranty. * //*************************************************************************** #include "AliHLTTPCCATracker.h" #include "AliHLTTPCCAOutTrack.h" #include "AliHLTTPCCAGrid.h" #include "AliHLTTPCCARow.h" #include "AliHLTTPCCATrack.h" #include "AliHLTTPCCAMath.h" #include "AliHLTTPCCAHit.h" #include "TStopwatch.h" #include "AliHLTTPCCAHitArea.h" #include "AliHLTTPCCANeighboursFinder.h" #include "AliHLTTPCCANeighboursCleaner.h" #include "AliHLTTPCCAStartHitsFinder.h" #include "AliHLTTPCCATrackletConstructor.h" #include "AliHLTTPCCATrackletSelector.h" #include "AliHLTTPCCAProcess.h" #include "AliHLTTPCCALinksWriter.h" #include "AliHLTTPCCAUsedHitsInitialiser.h" #include "AliHLTTPCCATrackParam.h" #include "AliHLTTPCCATrackParam1.h" #if !defined(HLTCA_GPUCODE) #if defined( HLTCA_STANDALONE ) #include #else #include "Riostream.h" #endif #endif //#define DRAW #ifdef DRAW #include "AliHLTTPCCADisplay.h" #include "TApplication.h" #endif //DRAW ClassImp(AliHLTTPCCATracker) #if !defined(HLTCA_GPUCODE) AliHLTTPCCATracker::AliHLTTPCCATracker() : fParam(), fNHitsTotal(0), fGridSizeTotal(0), fGrid1SizeTotal(0), fHits(0), fHits1(0), fGridContents(0), fGrid1Contents(0), fHitsID(0), fHitLinkUp(0), fHitLinkDown(0), fHitIsUsed(0), fStartHits(0), fTracklets(0), fNTracks(0), fTracks(0), fTrackHits(0), fNOutTracks(0), fNOutTrackHits(0), fOutTracks(0), fOutTrackHits(0), fEventMemory(0), fEventMemSize(0), fTexHitsFullData(0), fTexHitsFullSize(0) { // constructor //fRows = new AliHLTTPCCARow[fParam.NRows()]; //Initialize( fParam ); } AliHLTTPCCATracker::AliHLTTPCCATracker( const AliHLTTPCCATracker& ) : fParam(), fNHitsTotal(0), fGridSizeTotal(0), fGrid1SizeTotal(0), fHits(0), fHits1(0), fGridContents(0), fGrid1Contents(0), fHitsID(0), fHitLinkUp(0), fHitLinkDown(0), fHitIsUsed(0), fStartHits(0), fTracklets(0), fNTracks(0), fTracks(0), fTrackHits(0), fNOutTracks(0), fNOutTrackHits(0), fOutTracks(0), fOutTrackHits(0), fEventMemory(0), fEventMemSize(0), fTexHitsFullData(0), fTexHitsFullSize(0) { // dummy } AliHLTTPCCATracker &AliHLTTPCCATracker::operator=( const AliHLTTPCCATracker& ) { // dummy fOutTrackHits=0; fOutTracks=0; fNOutTracks=0; fTrackHits = 0; fEventMemory = 0; return *this; } GPUd() AliHLTTPCCATracker::~AliHLTTPCCATracker() { // destructor StartEvent(); } #endif GPUd() UChar_t AliHLTTPCCATracker::GetGridContent( UInt_t i ) const { //* get grid content #if defined(HLTCA_GPUSTEP) return (UChar_t) tex1Dfetch(texGrid,i).x; #else return fGridContents[i]; #endif } GPUd() AliHLTTPCCAHit AliHLTTPCCATracker::GetHit( UInt_t i ) const { //* get hit #if defined(HLTCA_USE_GPU) AliHLTTPCCAHit h; float2 f = tex1Dfetch(texHits,i); h.Y() = f.x; h.Z() = f.y; return h; #else return fHits[i]; #endif } // ---------------------------------------------------------------------------------- GPUd() void AliHLTTPCCATracker::Initialize( AliHLTTPCCAParam ¶m ) { // initialisation StartEvent(); fParam = param; fParam.Update(); for( Int_t irow=0; irow Y[j] ) yMin = Y[j]; if( zMax < Z[j] ) zMax = Z[j]; if( zMin > Z[j] ) zMin = Z[j]; } if( nGrid == 0 ){ yMin = yMax = zMin = zMax = 0; nGrid = 1; } row.Grid().Create( yMin, yMax, zMin, zMax, nGrid ); float sy = ( CAMath::Abs( row.Grid().StepYInv() ) >1.e-4 ) ?1./row.Grid().StepYInv() :1; float sz = ( CAMath::Abs( row.Grid().StepZInv() ) >1.e-4 ) ?1./row.Grid().StepZInv() :1; //cout<<"grid n = "<=256 ){ //cout<<" ERROR 1 !!! "< 63 ) g0n = 63; if( g1n > 63 ) g1n = 63; cnew1[i] = (g1n<<26) + (g1<<16) + (g0n<<10) + g0; } { float y0 = row.Grid().YMin(); float stepY = (row.Grid().YMax() - y0)*(1./65535.); float z0 = row.Grid().ZMin(); float stepZ = (row.Grid().ZMax() - z0)*(1./65535.); float stepYi = 1./stepY; float stepZi = 1./stepZ; row.Hy0() = y0; row.Hz0() = z0; row.HstepY() = stepY; row.HstepZ() = stepZ; row.HstepYi() = stepYi; row.HstepZi() = stepZi; for( Int_t ih=0; ih=65536 || yy>= 65536 ){ cout<<"!!!! hit packing error!!! "<( Param().NRows(), 1, *this ); AliHLTTPCCAProcess( Param().NRows()-2, 1, *this ); AliHLTTPCCAProcess( Param().NRows()-4, 1, *this ); Int_t nStartHits = *fStartHits; Int_t nThreads = 128; Int_t nBlocks = fNHitsTotal/nThreads + 1; if( nBlocks<12 ){ nBlocks = 12; nThreads = fNHitsTotal/12+1; if( nThreads%32 ) nThreads = (nThreads/32+1)*32; } nThreads = fNHitsTotal; nBlocks = 1; AliHLTTPCCAProcess(nBlocks, nThreads,*this); nThreads = 256; nBlocks = 30; nThreads = 1; nBlocks = 1; AliHLTTPCCAProcess(nBlocks, nThreads,*this); Int_t nMemThreads = 128; nThreads = 256;//96; nBlocks = nStartHits/nThreads + 1; if( nBlocks<30 ){ nBlocks = 30; nThreads = (nStartHits)/30+1; if( nThreads%32 ) nThreads = (nThreads/32+1)*32; } nThreads = nStartHits; nBlocks = 1; AliHLTTPCCAProcess1(nBlocks, nMemThreads+nThreads,*this); { nThreads = 128; nBlocks = nStartHits/nThreads + 1; if( nBlocks<12 ){ nBlocks = 12; nThreads = nStartHits/12+1; nThreads = (nThreads/32+1)*32; } *fStartHits = 0; *fTrackHits = 0; nThreads = nStartHits; nBlocks = 1; AliHLTTPCCAProcess(nBlocks, nThreads,*this); //cudaMemcpy(cpuTrackerCopy.fNTracks, gpuTrackerCopy.fNTracks, sizeof(int), cudaMemcpyDeviceToHost); //cudaMemcpy(cpuTrackerCopy.fTrackHits, gpuTrackerCopy.fTrackHits, sizeof(int), cudaMemcpyDeviceToHost); //Int_t size = sizeof(AliHLTTPCCATrack)*( *cpuTrackerCopy.fNTracks ); //cudaMemcpy(cpuTrackerCopy.fTracks, gpuTrackerCopy.fTracks, size, cudaMemcpyDeviceToHost); //cout<<"Tracks size = "<fNHitsTotal*10 ){ cout<<"fNOutTrackHits>fNHitsTotal"<=3 ){ p0.Param().ConstructXYZ3(sp0,sp1,sp2,p0.Param().CosPhi(), t0); p2.Param().ConstructXYZ3(sp2,sp1,sp0,p2.Param().CosPhi(), t0); //p2.Param() = p0.Param(); //p2.Param().TransportToX(row2.X()); //p2.Param().Par()[1] = -p2.Param().Par()[1]; //p2.Param().Par()[4] = -p2.Param().Par()[4]; } else { p0.Param().X() = row0.X(); p0.Param().Y() = c0.Y(); p0.Param().Z() = c0.Z(); p0.Param().Err2Y() = c0.ErrY()*c0.ErrY(); p0.Param().Err2Z() = c0.ErrZ()*c0.ErrZ(); p2.Param().X() = row2.X(); p2.Param().Y() = c2.Y(); p2.Param().Z() = c2.Z(); p2.Param().Err2Y() = c2.ErrY()*c2.ErrY(); p2.Param().Err2Z() = c2.ErrZ()*c2.ErrZ(); } #endif } GPUd() void AliHLTTPCCATracker::GetErrors2( Int_t iRow, const AliHLTTPCCATrackParam &t, Float_t &Err2Y, Float_t &Err2Z ) const { // // Use calibrated cluster error from OCDB // Float_t z = CAMath::Abs((250.-0.275)-CAMath::Abs(t.GetZ())); Int_t type = (iRow<63) ? 0: (iRow>126) ? 1:2; Float_t cosPhiInv = CAMath::Abs(t.GetCosPhi())>1.e-2 ?1./t.GetCosPhi() :0; Float_t angleY = t.GetSinPhi()*cosPhiInv ; Float_t angleZ = t.GetDzDs()*cosPhiInv ; Err2Y = fParam.GetClusterError2(0,type, z,angleY); Err2Z = fParam.GetClusterError2(1,type, z,angleZ); } GPUd() void AliHLTTPCCATracker::GetErrors2( Int_t iRow, const AliHLTTPCCATrackParam1 &t, Float_t &Err2Y, Float_t &Err2Z ) const { // // Use calibrated cluster error from OCDB // Float_t z = CAMath::Abs((250.-0.275)-CAMath::Abs(t.GetZ())); Int_t type = (iRow<63) ? 0: (iRow>126) ? 1:2; Float_t cosPhiInv = CAMath::Abs(t.GetCosPhi())>1.e-2 ?1./t.GetCosPhi() :0; Float_t angleY = t.GetSinPhi()*cosPhiInv ; Float_t angleZ = t.GetDzDs()*cosPhiInv ; Err2Y = fParam.GetClusterError2(0,type, z,angleY); Err2Z = fParam.GetClusterError2(1,type, z,angleZ); }