StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
AliHLTTPCCATrackletVector.h
1 /**************************************************************************
2  * This file is property of and copyright by the ALICE HLT Project *
3  * All rights reserved. *
4  * *
5  * Primary Authors: *
6  * Copyright 2009 Matthias Kretz <kretz@kde.org> *
7  * *
8  * Permission to use, copy, modify and distribute this software and its *
9  * documentation strictly for non-commercial purposes is hereby granted *
10  * without fee, provided that the above copyright notice appears in all *
11  * copies and that both the copyright notice and this permission notice *
12  * appear in the supporting documentation. The authors make no claims *
13  * about the suitability of this software for any purpose. It is *
14  * provided "as is" without express or implied warranty. *
15  **************************************************************************/
16 
17 #ifndef ALIHLTTPCCATRACKLETVECTOR_H
18 #define ALIHLTTPCCATRACKLETVECTOR_H
19 
20 #include "AliHLTArray.h"
21 #include "AliHLTTPCCAParameters.h"
22 #include "AliHLTTPCCATrackParamVector.h"
23 
24 #include "debug.h"
25 
27 {
28  public:
30 
31  ushort_m IsValid() const { return fNHits > ushort_v( Vc::Zero ); }
32 
33  ushort_v NHits() const { return fNHits; }
34  ushort_v FirstRow() const { return fFirstRow; }
35  ushort_v LastRow() const { return fLastRow; }
36  const AliHLTTPCCATrackParamVector &Param() const { return fParam; }
37 
38  unsigned short HitIndexAtRow( int rowIndex, int trackIndex ) const {
39  return fRowHits[rowIndex][trackIndex];
40  }
41  ushort_v HitIndexAtRow( int rowIndex ) const { return ushort_v( fRowHits[rowIndex] ); }
42  /*
43  ushort_v HitIndexAtRows( const ushort_v &rowIndex ) const {
44  return ushort_v( &fRowHits[0], rowIndex * ushort_v::Size + ushort_v( Vc::IndexesFromZero ) );
45  }
46  ushort_v HitIndexAtRows( const ushort_v &rowIndex, const ushort_m &mask ) const {
47  return ushort_v( &fRowHits[0], rowIndex * ushort_v::Size + ushort_v( Vc::IndexesFromZero ), mask );
48  }
49  */
50 
51  void SetNHits ( const ushort_v &x ) { fNHits = x; }
52  void SetFirstRow( const ushort_v &x ) { fFirstRow = x; }
53  void SetLastRow ( const ushort_v &x ) { fLastRow = x; }
54  void SetParam ( const TrackParamVector &x ) { fParam = x; }
55 
56  void SetRowHits( int rowIndex, const ushort_v &trackIndex, const ushort_v &hitIndex );
57  void SetRowHits( const ushort_v &rowIndex, const ushort_v &trackIndex, const ushort_v &hitIndex );
58  void SetRowHits( int rowIndex, const ushort_v &trackIndex, const ushort_v &hitIndex, const short_m &mask );
59  void SetRowHits( const ushort_v &rowIndex, const ushort_v &trackIndex, const ushort_v &hitIndex, const short_m &mask );
60 
61  void AddHitIds( const ushort_v &rowIndexes, const ushort_v &hitIndexes, const ushort_m &mask );
62 
63  int MaxNRows() const { return fRowHits.Size(); }
64  private:
65  ushort_v fNHits; // N hits
66  ushort_v fFirstRow; // first TPC row
67  ushort_v fLastRow; // last TPC row
68  TrackParamVector fParam; // tracklet parameters
70 };
71 
72 inline void AliHLTTPCCATrackletVector::SetRowHits( int rowIndex, const ushort_v &trackIndex,
73  const ushort_v &hitIndex )
74 {
75  assert( trackIndex[0] + ushort_v( Vc::IndexesFromZero ) == trackIndex );
76  assert( ( trackIndex[0] % ushort_v::Size ) == 0 );
77  UNUSED_PARAM1( trackIndex );
78  hitIndex.store( fRowHits[rowIndex] );
79 }
80 
81 inline void AliHLTTPCCATrackletVector::SetRowHits( const ushort_v &rowIndexes, const ushort_v &trackIndex,
82  const ushort_v &hitIndex )
83 {
84  assert( trackIndex[0] + ushort_v( Vc::IndexesFromZero ) == trackIndex );
85  assert( ( trackIndex[0] % ushort_v::Size ) == 0 );
86  UNUSED_PARAM1( trackIndex );
87  hitIndex.scatter( fRowHits[0], rowIndexes * ushort_v::Size + ushort_v( Vc::IndexesFromZero ) );
88 }
89 
90 inline void AliHLTTPCCATrackletVector::SetRowHits( int rowIndex, const ushort_v &trackIndex,
91  const ushort_v &hitIndex, const short_m &mask )
92 {
93  assert( trackIndex[0] + ushort_v( Vc::IndexesFromZero ) == trackIndex );
94  assert( ( trackIndex[0] % ushort_v::Size ) == 0 );
95  UNUSED_PARAM1( trackIndex );
96  assert( &fRowHits[0] != 0 );
97  debugF() << "TrackletVector::SetRowHits " << rowIndex << " old: ";
98  debugF() << ushort_v( fRowHits[rowIndex] );
99  debugF() << " new: " << hitIndex << mask;
100  hitIndex.store( fRowHits[rowIndex], mask );
101  debugF() << " done: " << ushort_v( fRowHits[rowIndex] ) << std::endl;
102 }
103 
104 inline void AliHLTTPCCATrackletVector::SetRowHits( const ushort_v &rowIndexes, const ushort_v &trackIndex,
105  const ushort_v &hitIndex, const short_m &mask )
106 {
107  assert( trackIndex[0] + ushort_v( Vc::IndexesFromZero ) == trackIndex );
108  assert( ( trackIndex[0] % ushort_v::Size ) == 0 );
109  UNUSED_PARAM1( trackIndex );
110  hitIndex.scatter( fRowHits[0], rowIndexes * ushort_v::Size + ushort_v( Vc::IndexesFromZero ), mask );
111 }
112 
114 
115 #endif // ALIHLTTPCCATRACKLETVECTOR_H
int Size() const
Definition: AliHLTArray.h:381