/************************************************************************** * This file is property of and copyright by the ALICE HLT Project * * All rights reserved. * * * * Primary Authors: * * Copyright 2009 Matthias Kretz * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ #ifndef ALIHLTTPCCATRACKLETVECTOR_H #define ALIHLTTPCCATRACKLETVECTOR_H #include "AliHLTArray.h" #include "AliHLTTPCCAParameters.h" #include "AliHLTTPCCATrackParamVector.h" #include "debug.h" #ifndef NVALGRIND #include #endif class AliHLTTPCCATrackletVector { public: AliHLTTPCCATrackletVector(); ushort_m IsValid() const { return fNHits > ushort_v( Vc::Zero ); } ushort_v NHits() const { return fNHits; } ushort_v FirstRow() const { return fFirstRow; } ushort_v LastRow() const { return fLastRow; } const AliHLTTPCCATrackParamVector &Param() const { return fParam; } unsigned short HitIndexAtRow( int rowIndex, int trackIndex ) const { return fRowHits[rowIndex][trackIndex]; } ushort_v HitIndexAtRow( int rowIndex ) const { return ushort_v( fRowHits[rowIndex] ); } /* ushort_v HitIndexAtRows( const ushort_v &rowIndex ) const { return ushort_v( &fRowHits[0], rowIndex * ushort_v::Size + ushort_v( Vc::IndexesFromZero ) ); } ushort_v HitIndexAtRows( const ushort_v &rowIndex, const ushort_m &mask ) const { return ushort_v( &fRowHits[0], rowIndex * ushort_v::Size + ushort_v( Vc::IndexesFromZero ), mask ); } */ void SetNHits ( const ushort_v &x ) { fNHits = x; } void SetFirstRow( const ushort_v &x ) { fFirstRow = x; } void SetLastRow ( const ushort_v &x ) { fLastRow = x; } void SetParam ( const TrackParamVector &x ) { fParam = x; } void SetRowHits( int rowIndex, const ushort_v &trackIndex, const ushort_v &hitIndex ); void SetRowHits( const ushort_v &rowIndex, const ushort_v &trackIndex, const ushort_v &hitIndex ); void SetRowHits( int rowIndex, const ushort_v &trackIndex, const ushort_v &hitIndex, const short_m &mask ); void SetRowHits( const ushort_v &rowIndex, const ushort_v &trackIndex, const ushort_v &hitIndex, const short_m &mask ); void AddHitIds( const ushort_v &rowIndexes, const ushort_v &hitIndexes, const ushort_m &mask ); private: ushort_v fNHits; // N hits ushort_v fFirstRow; // first TPC row ushort_v fLastRow; // last TPC row TrackParamVector fParam; // tracklet parameters AliHLTFixedArray > fRowHits; // hit index for each TPC row }; inline void AliHLTTPCCATrackletVector::SetRowHits( int rowIndex, const ushort_v &trackIndex, const ushort_v &hitIndex ) { assert( trackIndex[0] + ushort_v( Vc::IndexesFromZero ) == trackIndex ); assert( ( trackIndex[0] % ushort_v::Size ) == 0 ); UNUSED_PARAM1( trackIndex ); VALGRIND_CHECK_VALUE_IS_DEFINED( hitIndex ); VALGRIND_CHECK_MEM_IS_DEFINED( &fRowHits[rowIndex], sizeof( ushort_v ) ); hitIndex.store( fRowHits[rowIndex] ); VALGRIND_CHECK_MEM_IS_DEFINED( &fRowHits[rowIndex], sizeof( ushort_v ) ); } inline void AliHLTTPCCATrackletVector::SetRowHits( const ushort_v &rowIndexes, const ushort_v &trackIndex, const ushort_v &hitIndex ) { assert( trackIndex[0] + ushort_v( Vc::IndexesFromZero ) == trackIndex ); assert( ( trackIndex[0] % ushort_v::Size ) == 0 ); UNUSED_PARAM1( trackIndex ); VALGRIND_CHECK_VALUE_IS_DEFINED( hitIndex ); hitIndex.scatter( fRowHits[0], rowIndexes * ushort_v::Size + ushort_v( Vc::IndexesFromZero ) ); } inline void AliHLTTPCCATrackletVector::SetRowHits( int rowIndex, const ushort_v &trackIndex, const ushort_v &hitIndex, const short_m &mask ) { VALGRIND_CHECK_VALUE_IS_DEFINED( rowIndex ); VALGRIND_CHECK_VALUE_IS_DEFINED( trackIndex ); VALGRIND_CHECK_VALUE_IS_DEFINED( hitIndex ); VALGRIND_CHECK_VALUE_IS_DEFINED( mask ); assert( trackIndex[0] + ushort_v( Vc::IndexesFromZero ) == trackIndex ); assert( ( trackIndex[0] % ushort_v::Size ) == 0 ); UNUSED_PARAM1( trackIndex ); assert( &fRowHits[0] != 0 ); VALGRIND_CHECK_MEM_IS_DEFINED( &fRowHits[rowIndex], sizeof( ushort_v ) ); debugF() << "TrackletVector::SetRowHits " << rowIndex << " old: "; debugF() << ushort_v( fRowHits[rowIndex] ); debugF() << " new: " << hitIndex << mask; hitIndex.store( fRowHits[rowIndex], mask ); debugF() << " done: " << ushort_v( fRowHits[rowIndex] ) << std::endl; VALGRIND_CHECK_MEM_IS_DEFINED( &fRowHits[rowIndex], sizeof( ushort_v ) ); } inline void AliHLTTPCCATrackletVector::SetRowHits( const ushort_v &rowIndexes, const ushort_v &trackIndex, const ushort_v &hitIndex, const short_m &mask ) { assert( trackIndex[0] + ushort_v( Vc::IndexesFromZero ) == trackIndex ); assert( ( trackIndex[0] % ushort_v::Size ) == 0 ); UNUSED_PARAM1( trackIndex ); VALGRIND_CHECK_VALUE_IS_DEFINED( hitIndex ); hitIndex.scatter( fRowHits[0], rowIndexes * ushort_v::Size + ushort_v( Vc::IndexesFromZero ), mask ); } typedef AliHLTTPCCATrackletVector TrackletVector; // -- ArBB TODO find right place #include "AliHLTTPCCATrackParamArBB.h" #include using arbb::dense; using arbb::array; using arbb::f32; using arbb::i16; using arbb::u16; //using arbb::boolean; using arbb::fill; using arbb::select; class AliHLTTPCCATrackletVector_ArBB { public: AliHLTTPCCATrackletVector_ArBB( u16 nTracklets ){ _if ( nTracklets > 0 ) { fRowHits = repeat_row( fill(-1, nTracklets), AliHLTTPCCAParameters::NumberOfRows ); } _end_if; }; const dense& NHits() const { return fNHits; } const dense& FirstRow() const { return fFirstRow; } const dense& LastRow() const { return fLastRow; } const AliHLTTPCCATrackParamArBB &Param() const { return fParam; } dense< THitI_ArBB > HitIndexAtRow( TRowI_ArBB rowIndex ) const { return fRowHits.row(rowIndex); } void SetNHits ( const dense& x ) { fNHits = x; } void SetFirstRow( const dense& x ) { fFirstRow = x; } void SetLastRow ( const dense& x ) { fLastRow = x; } void SetParam ( const AliHLTTPCCATrackParamArBB &x ) { fParam = x; } void SetRowHits( TRowI_ArBB rowIndex, const dense &hitIndex ) { fRowHits = replace_row( fRowHits, rowIndex, hitIndex ); }; void SetRowHits( TRowI_ArBB rowIndex, const dense &hitIndex, const dense &mask ) { const dense hitIndexSelected = select( mask, hitIndex, HitIndexAtRow(rowIndex) ); SetRowHits( rowIndex, hitIndexSelected ); }; private: dense fNHits; // N hits dense fFirstRow; // first TPC row dense fLastRow; // last TPC row AliHLTTPCCATrackParamArBB fParam; // tracklet parameters dense< THitI_ArBB, 2 > fRowHits; // hit index for each TPC row. each row in array = row in TPC, each column in array = track }; #endif // ALIHLTTPCCATRACKLETVECTOR_H