]>
Commit | Line | Data |
---|---|---|
326c2d4b | 1 | //-*- Mode: C++ -*- |
2 | // @(#) $Id$ | |
ce565086 | 3 | // ************************************************************************ |
fbb9b71b | 4 | // This file is property of and copyright by the ALICE HLT Project * |
ce565086 | 5 | // ALICE Experiment at CERN, All rights reserved. * |
6 | // See cxx source for full Copyright notice * | |
7 | // * | |
8 | //************************************************************************* | |
326c2d4b | 9 | |
10 | #ifndef ALIHLTTPCCATRACKER_H | |
11 | #define ALIHLTTPCCATRACKER_H | |
12 | ||
13 | ||
00d07bcd | 14 | #include "AliHLTTPCCADef.h" |
326c2d4b | 15 | #include "AliHLTTPCCAParam.h" |
16 | #include "AliHLTTPCCARow.h" | |
00d07bcd | 17 | #include "AliHLTTPCCAHit.h" |
4687b8fc | 18 | #include <iostream> |
4acc2401 | 19 | #include "AliHLTArray.h" |
20 | #include "AliHLTTPCCAHitId.h" | |
21 | #include "AliHLTTPCCASliceData.h" | |
22 | #include "AliHLTTPCCATracklet.h" | |
23 | #include "AliHLTTPCCAOutTrack.h" | |
326c2d4b | 24 | |
d54804bf | 25 | class AliHLTTPCCATrack; |
d54804bf | 26 | class AliHLTTPCCATrackParam; |
4acc2401 | 27 | class AliHLTTPCCAClusterData; |
63d8b79d | 28 | class AliHLTTPCCASliceOutput; |
326c2d4b | 29 | |
30 | /** | |
31 | * @class AliHLTTPCCATracker | |
fbb9b71b | 32 | * |
33 | * Slice tracker for ALICE HLT. | |
dc4788ec | 34 | * The class reconstructs tracks in one slice of TPC. |
35 | * The reconstruction algorithm is based on the Cellular Automaton method | |
36 | * | |
fbb9b71b | 37 | * The CA tracker is designed stand-alone. |
dc4788ec | 38 | * It is integrated to the HLT framework via AliHLTTPCCATrackerComponent interface. |
39 | * The class is under construction. | |
40 | * | |
326c2d4b | 41 | */ |
42 | class AliHLTTPCCATracker | |
43 | { | |
fbb9b71b | 44 | public: |
326c2d4b | 45 | |
fbb9b71b | 46 | #if !defined(HLTCA_GPUCODE) |
47 | AliHLTTPCCATracker(); | |
dc4788ec | 48 | |
fbb9b71b | 49 | GPUd() ~AliHLTTPCCATracker(); |
00d07bcd | 50 | #endif |
326c2d4b | 51 | |
fbb9b71b | 52 | GPUd() void Initialize( const AliHLTTPCCAParam ¶m ); |
53 | ||
54 | GPUd() void StartEvent(); | |
55 | ||
4acc2401 | 56 | void ReadEvent( AliHLTTPCCAClusterData *clusterData ); |
fbb9b71b | 57 | |
58 | void Reconstruct(); | |
59 | void WriteOutput(); | |
60 | ||
61 | GPUd() void GetErrors2( int iRow, const AliHLTTPCCATrackParam &t, float &Err2Y, float &Err2Z ) const; | |
62 | GPUd() void GetErrors2( int iRow, float z, float sinPhi, float cosPhi, float DzDs, float &Err2Y, float &Err2Z ) const; | |
63 | ||
4acc2401 | 64 | void FitTrack( const AliHLTTPCCATrack &track, float *t0 = 0 ) const; |
65 | void FitTrackFull( const AliHLTTPCCATrack &track, float *t0 = 0 ) const; | |
fbb9b71b | 66 | |
fbb9b71b | 67 | GPUhd() void SetPointersCommon(); |
68 | GPUhd() void SetPointersHits( int MaxNHits ); | |
69 | GPUhd() void SetPointersTracks( int MaxNTracks, int MaxNHits ); | |
70 | ||
71 | #if !defined(HLTCA_GPUCODE) | |
72 | GPUh() void WriteEvent( std::ostream &out ); | |
fbb9b71b | 73 | GPUh() void WriteTracks( std::ostream &out ) ; |
74 | GPUh() void ReadTracks( std::istream &in ); | |
4687b8fc | 75 | #endif |
76 | ||
fbb9b71b | 77 | GPUhd() const AliHLTTPCCAParam &Param() const { return fParam; } |
78 | GPUhd() void SetParam( const AliHLTTPCCAParam &v ) { fParam = v; } | |
79 | ||
6de2bc40 | 80 | GPUhd() const AliHLTTPCCAClusterData *ClusterData() const { return fClusterData; } |
81 | GPUhd() const AliHLTTPCCASliceData &Data() const { return fData; } | |
4acc2401 | 82 | GPUhd() const AliHLTTPCCARow &Row( int rowIndex ) const { return fData.Row( rowIndex ); } |
83 | GPUhd() const AliHLTTPCCARow &Row( const AliHLTTPCCAHitId &HitId ) const { return fData.Row( HitId.RowIndex() ); } | |
84 | ||
fbb9b71b | 85 | GPUhd() double Timer( int i ) const { return fTimers[i]; } |
86 | GPUhd() void SetTimer( int i, double v ) { fTimers[i] = v; } | |
87 | ||
4acc2401 | 88 | GPUhd() int NHitsTotal() const { return fData.NumberOfHits(); } |
fbb9b71b | 89 | |
b8139972 | 90 | void SetHitLinkUpData( const AliHLTTPCCARow &row, int hitIndex, short v ) { fData.SetHitLinkUpData( row, hitIndex, v ); } |
91 | void SetHitLinkDownData( const AliHLTTPCCARow &row, int hitIndex, short v ) { fData.SetHitLinkDownData( row, hitIndex, v ); } | |
92 | short HitLinkUpData( const AliHLTTPCCARow &row, int hitIndex ) const { return fData.HitLinkUpData( row, hitIndex ); } | |
6de2bc40 | 93 | short HitLinkDownData( const AliHLTTPCCARow &row, int hitIndex ) const { return fData.HitLinkDownData( row, hitIndex ); } |
4acc2401 | 94 | |
b8139972 | 95 | int FirstHitInBin( const AliHLTTPCCARow &row, int binIndex ) const { return fData.FirstHitInBin( row, binIndex ); } |
4acc2401 | 96 | |
b8139972 | 97 | unsigned short HitDataY( const AliHLTTPCCARow &row, int hitIndex ) const { |
4acc2401 | 98 | return fData.HitDataY( row, hitIndex ); |
99 | } | |
b8139972 | 100 | unsigned short HitDataZ( const AliHLTTPCCARow &row, int hitIndex ) const { |
4acc2401 | 101 | return fData.HitDataZ( row, hitIndex ); |
102 | } | |
fbb9b71b | 103 | |
4acc2401 | 104 | int HitInputID( const AliHLTTPCCARow &row, int hitIndex ) const { return fData.ClusterDataIndex( row, hitIndex ); } |
105 | ||
106 | /** | |
107 | * The hit weight is used to determine whether a hit belongs to a certain tracklet or another one | |
108 | * competing for the same hit. The tracklet that has a higher weight wins. Comparison is done | |
109 | * using the the number of hits in the tracklet (the more hits it has the more it keeps). If | |
110 | * tracklets have the same number of hits then it doesn't matter who gets it, but it should be | |
111 | * only one. So a unique number (row index is good) is added in the least significant part of | |
112 | * the weight | |
113 | */ | |
6de2bc40 | 114 | static int CalculateHitWeight( int NHits, int unique ) { |
4acc2401 | 115 | return ( NHits << 16 ) + unique; |
116 | } | |
b8139972 | 117 | void MaximizeHitWeight( const AliHLTTPCCARow &row, int hitIndex, int weight ) { |
4acc2401 | 118 | fData.MaximizeHitWeight( row, hitIndex, weight ); |
119 | } | |
6de2bc40 | 120 | int HitWeight( const AliHLTTPCCARow &row, int hitIndex ) const { |
4acc2401 | 121 | return fData.HitWeight( row, hitIndex ); |
122 | } | |
fbb9b71b | 123 | |
b8139972 | 124 | GPUhd() int NTracklets() const { return *fNTracklets; } |
4acc2401 | 125 | GPUhd() int *NTracklets() { return fNTracklets; } |
fbb9b71b | 126 | |
4acc2401 | 127 | GPUhd() const AliHLTTPCCAHitId &TrackletStartHit( int i ) const { return fTrackletStartHits[i]; } |
128 | GPUhd() AliHLTTPCCAHitId *TrackletStartHits() const { return fTrackletStartHits; } | |
129 | GPUhd() const AliHLTTPCCATracklet &Tracklet( int i ) const { return fTracklets[i]; } | |
fbb9b71b | 130 | GPUhd() AliHLTTPCCATracklet *Tracklets() const { return fTracklets;} |
131 | ||
132 | GPUhd() int *NTracks() const { return fNTracks; } | |
133 | GPUhd() AliHLTTPCCATrack *Tracks() const { return fTracks; } | |
134 | GPUhd() int *NTrackHits() const { return fNTrackHits; } | |
4acc2401 | 135 | GPUhd() AliHLTTPCCAHitId *TrackHits() const { return fTrackHits; } |
fbb9b71b | 136 | |
137 | GPUhd() const AliHLTTPCCASliceOutput * Output() const { return fOutput; } | |
138 | ||
139 | GPUhd() int *NOutTracks() const { return fNOutTracks; } | |
140 | GPUhd() AliHLTTPCCAOutTrack *OutTracks() const { return fOutTracks; } | |
4acc2401 | 141 | GPUhd() const AliHLTTPCCAOutTrack &OutTrack( int index ) const { return fOutTracks[index]; } |
fbb9b71b | 142 | GPUhd() int *NOutTrackHits() const { return fNOutTrackHits; } |
143 | GPUhd() int *OutTrackHits() const { return fOutTrackHits; } | |
4acc2401 | 144 | GPUhd() int OutTrackHit( int i ) const { return fOutTrackHits[i]; } |
fbb9b71b | 145 | |
fbb9b71b | 146 | |
147 | private: | |
4acc2401 | 148 | void SetupCommonMemory(); |
fbb9b71b | 149 | |
150 | AliHLTTPCCAParam fParam; // parameters | |
fbb9b71b | 151 | double fTimers[10]; // running CPU time for different parts of the algorithm |
152 | ||
4acc2401 | 153 | /** A pointer to the ClusterData object that the SliceData was created from. This can be used to |
154 | * merge clusters from inside the SliceTracker code and recreate the SliceData. */ | |
155 | AliHLTTPCCAClusterData *fClusterData; // ^ | |
156 | AliHLTTPCCASliceData fData; // The SliceData object. It is used to encapsulate the storage in memory from the access | |
fbb9b71b | 157 | |
4acc2401 | 158 | // event |
fbb9b71b | 159 | |
160 | char *fCommonMemory; // common event memory | |
161 | int fCommonMemorySize; // size of the event memory [bytes] | |
162 | ||
163 | char *fHitMemory; // event memory for hits | |
164 | int fHitMemorySize; // size of the event memory [bytes] | |
165 | ||
166 | char *fTrackMemory; // event memory for tracks | |
167 | int fTrackMemorySize; // size of the event memory [bytes] | |
168 | ||
fbb9b71b | 169 | |
170 | int *fNTracklets; // number of tracklets | |
4acc2401 | 171 | AliHLTTPCCAHitId *fTrackletStartHits; // start hits for the tracklets |
fbb9b71b | 172 | AliHLTTPCCATracklet *fTracklets; // tracklets |
173 | ||
174 | // | |
175 | int *fNTracks; // number of reconstructed tracks | |
176 | AliHLTTPCCATrack *fTracks; // reconstructed tracks | |
177 | int *fNTrackHits; // number of track hits | |
4acc2401 | 178 | AliHLTTPCCAHitId *fTrackHits; // array of track hit numbers |
fbb9b71b | 179 | |
180 | // output | |
181 | ||
182 | AliHLTTPCCASliceOutput *fOutput; | |
183 | ||
184 | // obsolete output | |
185 | ||
186 | int *fNOutTracks; // number of tracks in fOutTracks array | |
187 | AliHLTTPCCAOutTrack *fOutTracks; // output array of the reconstructed tracks | |
188 | int *fNOutTrackHits; // number of hits in fOutTrackHits array | |
189 | int *fOutTrackHits; // output array of ID's of the reconstructed hits | |
190 | ||
4acc2401 | 191 | // disable copy |
192 | AliHLTTPCCATracker( const AliHLTTPCCATracker& ); | |
193 | AliHLTTPCCATracker &operator=( const AliHLTTPCCATracker& ); | |
326c2d4b | 194 | }; |
195 | ||
00d07bcd | 196 | |
326c2d4b | 197 | #endif |