23 #include "AliHLTTPCCAStartHitsFinder.h"
24 #include "AliHLTTPCCATracker.h"
26 #include "AliHLTTPCCAMath.h"
29 #include <tbb/parallel_sort.h>
86 const int rowStep = AliHLTTPCCAParameters::RowStep;
87 const int lastRow = tracker.Param().NRows() - rowStep*2;
88 for (
int rowIndex = 0; rowIndex <= lastRow; ++rowIndex ) {
91 int hitsStartOffset = CAMath::AtomicAdd( tracker.NTracklets(), 0 );
93 const int hitsStartOffset = *tracker.NTracklets();
98 int startHitsCount = 0;
102 const int numberOfHits = row.NHits();
103 for (
int hitIndex = 0; hitIndex < numberOfHits; hitIndex += short_v::Size ) {
104 const short_v hitIndexes = short_v( Vc::IndexesFromZero ) + hitIndex;
105 short_m validHitsMask = hitIndexes < numberOfHits;
106 validHitsMask &= ( short_v(data.HitDataIsUsed( row ),
static_cast<ushort_v
>(hitIndexes) ) == short_v( Vc::Zero ) );
109 const short_v &middleHitIndexes = data.HitLinkUpData( row, hitIndex );
110 validHitsMask &= ( data.HitLinkDownData( row, hitIndex ) < short_v( Vc::Zero ) ) && ( middleHitIndexes >= short_v( Vc::Zero ) );
111 if ( !validHitsMask.isEmpty() ) {
114 int iRow = rowIndex + 1*rowStep;
116 short_v upperHitIndexes = middleHitIndexes;
117 for (;!validHitsMask.isEmpty() && nRows < AliHLTTPCCAParameters::NeighboursChainMinLength[iter];) {
118 upperHitIndexes = short_v( data.HitLinkUpData( data.
Row( iRow ) ), static_cast<ushort_v>( upperHitIndexes ), validHitsMask );
119 validHitsMask &= upperHitIndexes >= short_v( Vc::Zero );
124 short_m goodChains = validHitsMask;
125 if ( !goodChains.isEmpty() ) {
127 data.SetHitAsUsed( row, static_cast<ushort_v>( hitIndexes ), goodChains );
129 int iRow2 = rowIndex + 1*rowStep;
130 ushort_v nHits(Vc::Zero);
131 nHits(goodChains) = 2;
133 short_v upperHitIndexes2 = middleHitIndexes;
134 for (;!goodChains.isEmpty();) {
135 curRow2 = data.
Row( iRow2 );
137 data.SetHitAsUsed( curRow2, static_cast<ushort_v>( upperHitIndexes2 ), goodChains );
138 upperHitIndexes2 = short_v( data.HitLinkUpData( curRow2 ),
static_cast<ushort_v
>( upperHitIndexes2 ), goodChains );
139 goodChains &= upperHitIndexes2 >= short_v( Vc::Zero );
144 foreach_bit(
int i, validHitsMask ) {
145 startHits[hitsStartOffset + startHitsCount++].Set( rowIndex, hitIndex + i, nHits[i] );
158 hitsStartOffset = CAMath::AtomicAdd( tracker.NTracklets(), startHitsCount );
160 *tracker.NTracklets() += startHitsCount;
166 tbb::parallel_sort( startHits, startHits + *tracker.NTracklets() );
168 std::sort( startHits, startHits + *tracker.NTracklets() );
const AliHLTTPCCARow & Row(int rowIndex) const