24 #include "AliHLTTPCCANeighboursCleaner.h"
25 #include "AliHLTTPCCAMath.h"
26 #include "AliHLTTPCCATracker.h"
34 sfloat_v X,Y,Z,Xup,Yup,Zup,Xdown,Ydown,Zdown, X4,Y4,Z4;
35 sfloat_v Yx1, Yx2, Yxx1, Yxx2, Yxxx, Zx1, Zx2, Zxx1, Zxx2, Zxxx, iX;
36 const short_v minusOne(-1);
38 const int rowStep = AliHLTTPCCAParameters::RowStep;
39 const int beginRowIndex = rowStep;
40 const int endRowIndex = numberOfRows - rowStep;
41 for (
int rowIndex = beginRowIndex; rowIndex < endRowIndex; ++rowIndex ) {
45 const int numberOfHits = row.NHits();
51 for (
int hitIndex = 0; hitIndex < numberOfHits; hitIndex += short_v::Size ) {
53 const ushort_v hitIndexes = ushort_v( Vc::IndexesFromZero ) + hitIndex;
54 short_m validHitsMask = hitIndexes < numberOfHits;
55 assert( ( validHitsMask && ((hitIndexes >= 0 ) && (hitIndexes < row.NHits() )) ) == validHitsMask );
56 validHitsMask &= ( short_v(data.HitDataIsUsed( row ), hitIndexes, validHitsMask ) == short_v( Vc::Zero ) );
60 assert( ( validHitsMask && ((hitIndexes >= 0 ) && (hitIndexes < row.NHits() )) ) == validHitsMask );
61 const short_v up = short_v(data.HitLinkUpData( row ), hitIndexes, validHitsMask );
62 const ushort_v upIndexes = up.staticCast<ushort_v>();
63 assert ( (validHitsMask && (up >= minusOne) ) == validHitsMask );
64 short_m upMask = validHitsMask && up >= short_v( Vc::Zero );
65 assert( ( upMask && ((upIndexes >= 0 ) && (upIndexes < rowUp.NHits() )) ) == upMask );
66 short_v downFromUp = short_v(data.HitLinkDownData( rowUp ), upIndexes, upMask );
68 const short_v dn = short_v(data.HitLinkDownData( row ), hitIndexes, validHitsMask );
69 assert ( ( validHitsMask && (dn >= minusOne) ) == validHitsMask );
70 const ushort_v downIndexes = dn.staticCast<ushort_v>();
71 short_m dnMask = validHitsMask && dn >= short_v( Vc::Zero );
72 assert( ( dnMask && ((downIndexes >= 0 ) && (downIndexes < rowDown.NHits() )) ) == dnMask );
73 short_v upFromDown = short_v(data.HitLinkUpData( rowDown ), downIndexes, dnMask );
78 #define USE_EDGE_HITS // use edge links, which are not reciprocall
81 upMask &= (downFromUp == -1) && (upFromDown == static_cast<short_v>(hitIndexes));
82 dnMask &= (upFromDown == -1) && (downFromUp == static_cast<short_v>(hitIndexes));
84 dnMask &= short_m(rowIndex + 2*rowStep < numberOfRows);
85 upMask &= short_m(rowIndex - 2*rowStep >= 0);
86 upMask &= dn >= short_v( Vc::Zero );
87 dnMask &= up >= short_v( Vc::Zero );
90 #ifdef SELECT_EDGE_HITS
91 const short_m upOrDnMask = upMask || dnMask;
92 if(!upOrDnMask.isEmpty())
94 X = data.RowX( rowIndex );
95 assert( ( upOrDnMask && ((hitIndexes >= 0 ) && (hitIndexes < row.NHits() )) ) == upOrDnMask );
96 Y.gather( data.HitDataY( row ), hitIndexes,
static_cast<sfloat_m
>(upOrDnMask) );
97 Z.gather( data.HitDataZ( row ), hitIndexes,
static_cast<sfloat_m
>(upOrDnMask) );
101 Xdown = data.RowX( rowIndex - rowStep );
102 assert( ( dnMask && ((downIndexes >= 0 ) && (downIndexes < rowDown.NHits() )) ) == dnMask );
103 Ydown.gather( data.HitDataY( rowDown ), downIndexes,
static_cast<sfloat_m
>(dnMask) );
104 Zdown.gather( data.HitDataZ( rowDown ), downIndexes,
static_cast<sfloat_m
>(dnMask) );
107 assert( ( dnMask && ((upIndexes >= 0 ) && (upIndexes < rowUp.NHits() )) ) == dnMask );
108 const short_v upup = short_v(data.HitLinkUpData( rowUp ), upIndexes, dnMask );
110 dnMask &= upup >= short_v( Vc::Zero );
114 X4 = data.RowX( rowIndex + 2*rowStep );
115 const ushort_v upupIndexes = upup.staticCast<ushort_v>();
116 ASSERT( ( dnMask && (upupIndexes < rowUpUp.NHits() ) ) == dnMask,
117 " dnMask= " << dnMask <<
" upupIndexes= " << upupIndexes <<
" rowUpUp.NHits()= "<< rowUpUp.NHits() );
118 Y4.gather( data.HitDataY( rowUpUp ), upupIndexes,
static_cast<sfloat_m
>(dnMask) );
119 Z4.gather( data.HitDataZ( rowUpUp ), upupIndexes,
static_cast<sfloat_m
>(dnMask) );
121 iX = Vc::One/(X - X4);
124 Yxx2 = Yx2 + Yx1*Xdown;
127 Zxx2 = Zx2 + Zx1*Xdown;
129 sfloat_v err2Y, err2Z;
134 dnMask &=
static_cast<short_m
>(CAMath::Abs((Yxx2 - Ydown)*CAMath::RSqrt(err2Y)) < 50.f);
138 if(!upMask.isEmpty())
140 Xup = data.RowX( rowIndex + rowStep );
141 assert( ( upMask && ((upIndexes >= 0 ) && (upIndexes < rowUp.NHits() )) ) == upMask );
142 Yup.gather( data.HitDataY( rowUp ), upIndexes,
static_cast<sfloat_m
>(upMask) );
143 Zup.gather( data.HitDataZ( rowUp ), upIndexes,
static_cast<sfloat_m
>(upMask) );
146 assert( ( upMask && ((downIndexes >= 0 ) && (downIndexes < rowDown.NHits() )) ) == upMask );
147 const short_v downdown = short_v(data.HitLinkDownData( rowDown ), downIndexes, upMask );
148 upMask &= downdown >= short_v( Vc::Zero );
152 ASSERT( ( upMask && (downdown >= 0 ) && (downdown < rowDownDown.NHits()) ) == upMask,
153 " upMask= " << upMask <<
" dn= " << dn <<
" downdown= " << downdown <<
" row= " << rowIndex <<
" rowDownDown.NHits= " << rowDownDown.NHits());
154 X4 = data.RowX( rowIndex - 2*rowStep );
155 const ushort_v downdownIndexes = downdown.staticCast<ushort_v>();
156 Y4.gather( data.HitDataY( rowDownDown ), downdownIndexes,
static_cast<sfloat_m
>(upMask) );
157 Z4.gather( data.HitDataZ( rowDownDown ), downdownIndexes,
static_cast<sfloat_m
>(upMask) );
159 iX = Vc::One/(X - X4);
162 Yxx2 = Yx2 + Yx1*Xup;
165 Zxx2 = Zx2 + Zx1*Xup;
167 sfloat_v err2Y, err2Z;
171 const sfloat_v ch = CAMath::Abs((Yxx2 - Yup)*CAMath::RSqrt(err2Y));
172 upMask &=
static_cast<short_m
>(ch < 50.f);
182 #else // SELECT_EDGE_HITS
183 UNUSED_PARAM1( param );
184 #endif // SELECT_EDGE_HITS
186 assert( ( upMask && ((upIndexes >= 0 ) && (upIndexes < rowUp.NHits() )) ) == upMask );
187 assert( ( dnMask && ((downIndexes >= 0 ) && (downIndexes < rowDown.NHits() )) ) == dnMask );
189 downFromUp( upMask ) =
static_cast<short_v
>(hitIndexes);
190 upFromDown( dnMask ) =
static_cast<short_v
>(hitIndexes);
191 data.SetHitLinkDownData( rowUp, upIndexes, downFromUp, upMask );
192 data.SetHitLinkUpData( rowDown, downIndexes, upFromDown, dnMask );
195 #endif // USE_EDGE_HITS
197 const short_m badUpMask = validHitsMask && (downFromUp !=
static_cast<short_v
>(hitIndexes));
199 assert( ( badUpMask && ((hitIndexes >= 0 ) && (hitIndexes < row.NHits() )) ) == badUpMask );
200 data.SetHitLinkUpData( row, hitIndexes, minusOne, badUpMask );
202 const short_m badDnMask = validHitsMask && (upFromDown !=
static_cast<short_v
>(hitIndexes));
203 assert( ( badDnMask && ((hitIndexes >= 0 ) && (hitIndexes < row.NHits() )) ) == badDnMask );
204 data.SetHitLinkDownData( row, hitIndexes, minusOne, badDnMask );
const AliHLTTPCCARow & Row(int rowIndex) const
void GetClusterErrors2(int iRow, const AliHLTTPCCATrackParam &t, float &Err2Y, float &Err2Z) const
mvz start 20.01.2010