]>
Commit | Line | Data |
---|---|---|
00d07bcd | 1 | // @(#) $Id: AliHLTTPCCATrackletSelector.cxx 27042 2008-07-02 12:06:02Z richterm $ |
ce565086 | 2 | // ************************************************************************** |
fbb9b71b | 3 | // This file is property of and copyright by the ALICE HLT Project * |
00d07bcd | 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. * | |
ce565086 | 17 | // * |
00d07bcd | 18 | //*************************************************************************** |
19 | ||
ce565086 | 20 | |
00d07bcd | 21 | #include "AliHLTTPCCATrackletSelector.h" |
22 | #include "AliHLTTPCCATrack.h" | |
23 | #include "AliHLTTPCCATracker.h" | |
24 | #include "AliHLTTPCCATrackParam.h" | |
ce565086 | 25 | #include "AliHLTTPCCATracklet.h" |
00d07bcd | 26 | #include "AliHLTTPCCAMath.h" |
27 | ||
28 | GPUd() void AliHLTTPCCATrackletSelector::Thread | |
fbb9b71b | 29 | ( int nBlocks, int nThreads, int iBlock, int iThread, int iSync, |
00d07bcd | 30 | AliHLTTPCCASharedMemory &s, AliHLTTPCCATracker &tracker ) |
31 | { | |
32 | // select best tracklets and kill clones | |
33 | ||
fbb9b71b | 34 | if ( iSync == 0 ) { |
35 | if ( iThread == 0 ) { | |
36 | if ( iBlock == 0 ) { | |
37 | CAMath::AtomicExch( tracker.NTracks(), 0 ); | |
38 | CAMath::AtomicExch( tracker.NTrackHits(), 0 ); | |
00d07bcd | 39 | } |
fbb9b71b | 40 | s.fNTracklets = *tracker.NTracklets(); |
41 | s.fNThreadsTotal = nThreads * nBlocks; | |
42 | s.fItr0 = nThreads * iBlock; | |
00d07bcd | 43 | } |
fbb9b71b | 44 | } else if ( iSync == 1 ) { |
45 | AliHLTTPCCATrack tout; | |
46 | int trackHits[160]; | |
ce565086 | 47 | |
fbb9b71b | 48 | for ( int itr = s.fItr0 + iThread; itr < s.fNTracklets; itr += s.fNThreadsTotal ) { |
ce565086 | 49 | |
fbb9b71b | 50 | AliHLTTPCCATracklet &tracklet = tracker.Tracklets()[itr]; |
693d2443 | 51 | |
fbb9b71b | 52 | int tNHits = tracklet.NHits(); |
53 | if ( tNHits <= 0 ) continue; | |
ce565086 | 54 | |
fbb9b71b | 55 | const int kMaxRowGap = 4; |
56 | const float kMaxShared = .1; | |
693d2443 | 57 | |
fbb9b71b | 58 | int firstRow = tracklet.FirstRow(); |
59 | int lastRow = tracklet.LastRow(); | |
ce565086 | 60 | |
fbb9b71b | 61 | tout.SetNHits( 0 ); |
62 | int kind = 0; | |
63 | if ( 0 ) { | |
64 | if ( tNHits >= 10 && 1. / .5 >= CAMath::Abs( tracklet.Param().QPt() ) ) { //SG!!! | |
65 | kind = 1; | |
66 | } | |
67 | } | |
68 | ||
69 | int w = ( kind << 29 ) + ( tNHits << 16 ) + itr; | |
70 | ||
71 | //int w = (tNHits<<16)+itr; | |
72 | //int nRows = tracker.Param().NRows(); | |
73 | int gap = 0; | |
74 | int nShared = 0; | |
75 | //std::cout<<" store tracklet: "<<firstRow<<" "<<lastRow<<std::endl; | |
76 | for ( int irow = firstRow; irow <= lastRow; irow++ ) { | |
77 | gap++; | |
78 | int ih = tracklet.RowHit( irow ); | |
79 | if ( ih >= 0 ) { | |
80 | int ihTot = tracker.Row( irow ).FirstHit() + ih; | |
81 | bool own = ( tracker.HitWeights()[ihTot] <= w ); | |
82 | bool sharedOK = ( ( tout.NHits() < 0 ) || ( nShared < tout.NHits() * kMaxShared ) ); | |
83 | if ( own || sharedOK ) {//SG!!! | |
84 | gap = 0; | |
85 | int th = AliHLTTPCCATracker::IRowIHit2ID( irow, ih ); | |
86 | trackHits[tout.NHits()] = th; | |
87 | tout.SetNHits( tout.NHits() + 1 ); | |
88 | if ( !own ) nShared++; | |
89 | } | |
90 | } | |
ce565086 | 91 | |
fbb9b71b | 92 | if ( gap > kMaxRowGap || irow == lastRow ) { // store |
93 | if ( tout.NHits() >= 10 ) { //SG!!! | |
94 | int itrout = CAMath::AtomicAdd( tracker.NTracks(), 1 ); | |
95 | tout.SetFirstHitID( CAMath::AtomicAdd( tracker.NTrackHits(), tout.NHits() ) ); | |
96 | tout.SetParam( tracklet.Param() ); | |
97 | tout.SetAlive( 1 ); | |
98 | tracker.Tracks()[itrout] = tout; | |
99 | for ( int jh = 0; jh < tout.NHits(); jh++ ) { | |
100 | tracker.TrackHits()[tout.FirstHitID() + jh] = trackHits[jh]; | |
101 | } | |
102 | } | |
103 | tout.SetNHits( 0 ); | |
104 | gap = 0; | |
105 | nShared = 0; | |
106 | } | |
00d07bcd | 107 | } |
108 | } | |
fbb9b71b | 109 | } |
00d07bcd | 110 | } |