]>
Commit | Line | Data |
---|---|---|
00d07bcd | 1 | // @(#) $Id: AliHLTTPCCATrackletSelector.cxx 27042 2008-07-02 12:06:02Z richterm $ |
2 | //*************************************************************************** | |
3 | // This file is property of and copyright by the ALICE HLT Project * | |
4 | // ALICE Experiment at CERN, All rights reserved. * | |
5 | // * | |
6 | // Primary Authors: Sergey Gorbunov <sergey.gorbunov@kip.uni-heidelberg.de> * | |
7 | // Ivan Kisel <kisel@kip.uni-heidelberg.de> * | |
8 | // for The ALICE HLT Project. * | |
9 | // * | |
10 | // Permission to use, copy, modify and distribute this software and its * | |
11 | // documentation strictly for non-commercial purposes is hereby granted * | |
12 | // without fee, provided that the above copyright notice appears in all * | |
13 | // copies and that both the copyright notice and this permission notice * | |
14 | // appear in the supporting documentation. The authors make no claims * | |
15 | // about the suitability of this software for any purpose. It is * | |
16 | // provided "as is" without express or implied warranty. * | |
17 | //*************************************************************************** | |
18 | ||
19 | #include "AliHLTTPCCATrackletSelector.h" | |
20 | #include "AliHLTTPCCATrack.h" | |
21 | #include "AliHLTTPCCATracker.h" | |
22 | #include "AliHLTTPCCATrackParam.h" | |
23 | #include "AliHLTTPCCAMath.h" | |
24 | ||
25 | GPUd() void AliHLTTPCCATrackletSelector::Thread | |
26 | ( Int_t nBlocks, Int_t nThreads, Int_t iBlock, Int_t iThread, Int_t iSync, | |
27 | AliHLTTPCCASharedMemory &s, AliHLTTPCCATracker &tracker ) | |
28 | { | |
29 | // select best tracklets and kill clones | |
30 | ||
31 | if( iSync==0 ) | |
32 | { | |
33 | if( iThread==0 ){ | |
34 | if(iBlock==0){ | |
4687b8fc | 35 | CAMath::atomicExch(tracker.NTracks(),0); |
36 | CAMath::atomicExch(tracker.NTrackHits(),0); | |
00d07bcd | 37 | } |
4687b8fc | 38 | s.fNTracklets = *tracker.NTracklets(); |
00d07bcd | 39 | s.fNThreadsTotal = nThreads*nBlocks; |
4687b8fc | 40 | s.fItr0 = nThreads*iBlock; |
00d07bcd | 41 | } |
42 | } | |
43 | else if( iSync==1 ) | |
44 | { | |
45 | AliHLTTPCCATrack tout; | |
46 | Int_t trackHits[160]; | |
47 | ||
48 | for( Int_t itr= s.fItr0 + iThread; itr<s.fNTracklets; itr+=s.fNThreadsTotal ){ | |
4687b8fc | 49 | Int_t *t = ((Int_t*)tracker.Tracklets()) + itr*(5+ sizeof(AliHLTTPCCATrackParam)/4 + 160 ); |
00d07bcd | 50 | Int_t tNHits = *t; |
51 | if( tNHits<=0 ) continue; | |
52 | ||
00d07bcd | 53 | tout.NHits() = 0; |
54 | Int_t *hitstore = t + 5+ sizeof(AliHLTTPCCATrackParam)/4 ; | |
55 | Int_t w = (tNHits<<16)+itr; | |
56 | Int_t nRows = tracker.Param().NRows(); | |
325a2bc4 | 57 | Int_t gap = 0; |
58 | for( Int_t irow=0; irow<nRows; irow++ ){ | |
00d07bcd | 59 | Int_t ih = hitstore[irow]; |
60 | if( ih<0 ) continue; | |
61 | AliHLTTPCCARow &row = tracker.Rows()[irow]; | |
62 | Int_t ihTot = row.FirstHit()+ih; | |
4687b8fc | 63 | if( tracker.HitWeights()[ihTot] > w ){ |
325a2bc4 | 64 | if( ++gap>6){ tout.NHits()=0; break; } |
65 | continue; | |
4687b8fc | 66 | } else gap = 0; |
00d07bcd | 67 | Int_t th = AliHLTTPCCATracker::IRowIHit2ID(irow,ih); |
68 | trackHits[tout.NHits()] = th; | |
69 | tout.NHits()++; | |
70 | } | |
71 | if( tout.NHits()<10 ) continue;//SG!!! | |
4687b8fc | 72 | Int_t itrout = CAMath::atomicAdd(tracker.NTracks(),1); |
73 | tout.FirstHitID() = CAMath::atomicAdd( tracker.NTrackHits(), tout.NHits() ); | |
00d07bcd | 74 | tout.Param() = *( (AliHLTTPCCATrackParam*)( t+5) ); |
75 | tout.Alive() = 1; | |
76 | tracker.Tracks()[itrout] = tout; | |
77 | for( Int_t ih=0; ih<tout.NHits(); ih++ ){//SG | |
78 | tracker.TrackHits()[tout.FirstHitID() + ih] = trackHits[ih]; | |
79 | } | |
80 | } | |
81 | } | |
82 | } |