]>
Commit | Line | Data |
---|---|---|
00d07bcd | 1 | // @(#) $Id: AliHLTTPCCAStartHitsFinder.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 | ||
20 | #include "AliHLTTPCCAStartHitsFinder.h" | |
21 | #include "AliHLTTPCCATracker.h" | |
22 | #include "AliHLTTPCCAMath.h" | |
23 | ||
f0bada7f | 24 | GPUdi() void AliHLTTPCCAStartHitsFinder::Thread |
fbb9b71b | 25 | ( int /*nBlocks*/, int nThreads, int iBlock, int iThread, int iSync, |
00d07bcd | 26 | AliHLTTPCCASharedMemory &s, AliHLTTPCCATracker &tracker ) |
27 | { | |
28 | // find start hits for tracklets | |
29 | ||
fbb9b71b | 30 | if ( iSync == 0 ) { |
31 | if ( iThread == 0 ) { | |
fbb9b71b | 32 | s.fNRows = tracker.Param().NRows(); |
33 | s.fIRow = iBlock + 1; | |
34 | s.fNRowStartHits = 0; | |
35 | if ( s.fIRow <= s.fNRows - 4 ) { | |
36 | s.fNHits = tracker.Row( s.fIRow ).NHits(); | |
b22af1bf | 37 | if ( s.fNHits >= ALIHLTTPCCASTARTHITSFINDER_MAX_FROWSTARTHITS ) s.fNHits = ALIHLTTPCCASTARTHITSFINDER_MAX_FROWSTARTHITS - 1; |
fbb9b71b | 38 | } else s.fNHits = -1; |
00d07bcd | 39 | } |
fbb9b71b | 40 | } else if ( iSync == 1 ) { |
f0bada7f | 41 | #ifdef HLTCA_GPUCODE |
42 | volatile int *xxx = &(s.fIRow); | |
43 | const AliHLTTPCCARow &row = tracker.Row( *xxx ); | |
44 | const AliHLTTPCCARow &rowUp = tracker.Row( (*xxx) + 2 ); | |
45 | #else | |
4acc2401 | 46 | const AliHLTTPCCARow &row = tracker.Row( s.fIRow ); |
b22af1bf | 47 | const AliHLTTPCCARow &rowUp = tracker.Row( s.fIRow + 2 ); |
f0bada7f | 48 | #endif |
fbb9b71b | 49 | for ( int ih = iThread; ih < s.fNHits; ih += nThreads ) { |
b22af1bf | 50 | if (tracker.HitLinkDownData(row, ih) < 0 && tracker.HitLinkUpData(row, ih) >= 0 && tracker.HitLinkUpData(rowUp, tracker.HitLinkUpData(row, ih)) >= 0) { |
fbb9b71b | 51 | int oldNRowStartHits = CAMath::AtomicAdd( &s.fNRowStartHits, 1 ); |
f0bada7f | 52 | #ifdef HLTCA_GPUCODE |
53 | s.fRowStartHits[oldNRowStartHits].Set( *xxx, ih ); | |
54 | #else | |
4acc2401 | 55 | s.fRowStartHits[oldNRowStartHits].Set( s.fIRow, ih ); |
f0bada7f | 56 | #endif |
00d07bcd | 57 | } |
58 | } | |
fbb9b71b | 59 | } else if ( iSync == 2 ) { |
60 | if ( iThread == 0 ) { | |
b22af1bf | 61 | int nOffset = CAMath::AtomicAdd( tracker.NTracklets(), s.fNRowStartHits ); |
62 | #ifdef HLTCA_GPUCODE | |
f0bada7f | 63 | if (nOffset + s.fNRowStartHits >= HLTCA_GPU_MAX_TRACKLETS) |
64 | { | |
65 | tracker.GPUParameters()->fGPUError = HLTCA_GPU_ERROR_TRACKLET_OVERFLOW; | |
66 | CAMath::AtomicExch( tracker.NTracklets(), 0 ); | |
67 | nOffset = 0; | |
68 | } | |
b22af1bf | 69 | #endif |
70 | s.fNOldStartHits = nOffset; | |
71 | #ifdef HLTCA_GPU_SORT_STARTHITS | |
f0bada7f | 72 | volatile int *yyy = &(s.fIRow); |
73 | tracker.RowStartHitCountOffset()[*yyy].x = s.fNRowStartHits; | |
74 | tracker.RowStartHitCountOffset()[*yyy].y = nOffset; | |
b22af1bf | 75 | #endif |
fbb9b71b | 76 | } |
77 | } else if ( iSync == 3 ) { | |
b22af1bf | 78 | #ifdef HLTCA_GPU_SORT_STARTHITS |
79 | AliHLTTPCCAHitId *const startHits = tracker.TrackletTmpStartHits(); | |
80 | #else | |
4acc2401 | 81 | AliHLTTPCCAHitId *const startHits = tracker.TrackletStartHits(); |
b22af1bf | 82 | #endif |
fbb9b71b | 83 | for ( int ish = iThread; ish < s.fNRowStartHits; ish += nThreads ) { |
84 | startHits[s.fNOldStartHits+ish] = s.fRowStartHits[ish]; | |
00d07bcd | 85 | } |
fbb9b71b | 86 | } |
00d07bcd | 87 | } |
88 |