22 #include "AliHLTTPCCAHitArea.h"
23 #include "AliHLTTPCCASliceDataVector.h"
24 #include "AliHLTTPCCAGrid.h"
25 #include "AliHLTTPCCARow.h"
29 const sfloat_v &y,
const sfloat_v &z,
float dy,
float dz, short_m mask )
30 : fRow( row ), fSlice( slice ),
33 fNy( fRow.Grid().Ny() )
37 const sfloat_v minZ = z - dz;
38 const sfloat_v maxZ = z + dz;
39 const sfloat_v minY = y - dy;
40 const sfloat_v maxY = y + dy;
42 ushort_v bYmin, bZmin, bYmax;
46 fBDY = ( bYmax - bYmin + 1 );
48 fIndYmin = ( bZmin * fNy + bYmin );
53 const short_m invalidMask = !mask;
54 if ( !invalidMask.isEmpty() ) {
55 debugS() <<
"not all parts of the HitArea are valid: " << mask << std::endl;
57 fBZmax.setZero( invalidMask );
58 fBDY.setZero( invalidMask );
59 fIndYmin.setZero( invalidMask );
60 fIz.setZero( invalidMask );
63 fIh.gather( fSlice.FirstHitInBin( fRow ), fIndYmin, mask );
64 fHitYlst.gather( fSlice.FirstHitInBin( fRow ), fIndYmin + fBDY, mask );
66 fIh = fSlice.FirstHitInBin( fRow, fIndYmin );
67 fHitYlst = fSlice.FirstHitInBin( fRow, fIndYmin + fBDY );
69 assert( fHitYlst <= fRow.NHits() || invalidMask );
71 debugS() <<
"HitArea created:\n"
72 <<
"bYmin: " << bYmin <<
"\n"
73 <<
"bZmin: " << bZmin <<
"\n"
74 <<
"bYmax: " << bYmax <<
"\n"
75 <<
"fBZmax: " << fBZmax <<
"\n"
76 <<
"fBDY: " << fBDY <<
"\n"
77 <<
"fIndYmin: " << fIndYmin <<
"\n"
78 <<
"fIz: " << fIz <<
"\n"
79 <<
"fHitYlst: " << fHitYlst <<
"\n"
80 <<
"fIh: " << fIh <<
"\n"
81 <<
"fNy: " << fNy << std::endl;
87 ushort_m yIndexOutOfRange = fIh >= fHitYlst;
88 ushort_m nextZIndexOutOfRange = fIz >= fBZmax;
89 if ( yIndexOutOfRange && nextZIndexOutOfRange ) {
90 return ushort_m(
false);
93 ushort_m isUsed =
static_cast<ushort_m
>( short_v(fSlice.HitDataIsUsed( fRow ), fIh) != short_v( Vc::Zero ) );
97 ushort_m needNextZ = yIndexOutOfRange && !nextZIndexOutOfRange;
98 ushort_m needNextHit = (isUsed || yIndexOutOfRange) && !nextZIndexOutOfRange;
100 debugS() <<
"fIh >= fHitYlst: " << yIndexOutOfRange <<
" fIz >= fBZmax: " << nextZIndexOutOfRange <<
" -> " << needNextZ << std::endl;
103 while ( !needNextHit.isEmpty() ) {
105 ++fIh( needNextHit );
108 nextZIndexOutOfRange = fIz >= fBZmax;
111 fIndYmin( needNextZ ) += fNy;
112 fIh.gather( fSlice.
FirstHitInBin( fRow ), fIndYmin, needNextZ );
113 fHitYlst.gather( fSlice.
FirstHitInBin( fRow ), fIndYmin + fBDY, needNextZ );
115 isUsed =
static_cast<ushort_m
>( short_v(fSlice.HitDataIsUsed( fRow ), fIh) != short_v( Vc::Zero ) );
117 assert( fHitYlst <= fRow.NHits() || !needNextZ );
118 yIndexOutOfRange = fIh >= fHitYlst;
120 needNextZ = yIndexOutOfRange && !nextZIndexOutOfRange;
122 needNextHit = (isUsed || yIndexOutOfRange) && !nextZIndexOutOfRange;
123 debugS() <<
"fIh >= fHitYlst: " << yIndexOutOfRange <<
" fIz >= fBZmax: " << nextZIndexOutOfRange <<
" -> " << needNextZ << std::endl;
126 data->fValid = !yIndexOutOfRange && !isUsed;
127 const sfloat_m valid( data->fValid );
130 data->fY.gather( fSlice.HitDataY( fRow ), fIh, valid );
132 data->fZ.gather( fSlice.HitDataZ( fRow ), fIh, valid );
134 data->fLinks = fIh.staticCast<short_v>();
138 debugS() <<
"HitArea found next. New state:\n"
139 <<
"fIndYmin: " << fIndYmin <<
"\n"
140 <<
"fIz: " << fIz <<
"\n"
141 <<
"fHitYlst: " << fHitYlst <<
"\n"
142 <<
"fIh: " << fIh << std::endl;
ushort_v FirstHitInBin(const AliHLTTPCCARow &row, ushort_v binIndexes) const
ushort_m GetNext(NeighbourData *data)
ushort_v GetBinBounded(const sfloat_v &Y, const sfloat_v &Z) const