]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/tracking-ca/AliHLTTPCCATracker.h
Completely reworked version of TPC CA tracker (Sergey)
[u/mrichter/AliRoot.git] / HLT / TPCLib / tracking-ca / AliHLTTPCCATracker.h
1 //-*- Mode: C++ -*-
2 // @(#) $Id$
3
4 //* This file is property of and copyright by the ALICE HLT Project        * 
5 //* ALICE Experiment at CERN, All rights reserved.                         *
6 //* See cxx source for full Copyright notice                               *
7
8 #ifndef ALIHLTTPCCATRACKER_H
9 #define ALIHLTTPCCATRACKER_H
10
11
12 #include "AliHLTTPCCADef.h"
13 #include "AliHLTTPCCAParam.h"
14 #include "AliHLTTPCCARow.h"
15 #include "AliHLTTPCCAHit.h"
16
17 class AliHLTTPCCATrack;
18 class AliHLTTPCCAOutTrack;
19 class AliHLTTPCCATrackParam;
20 class AliHLTTPCCATrackParam1;
21
22
23
24 /**
25  * @class AliHLTTPCCATracker
26  * 
27  * Slice tracker for ALICE HLT. 
28  * The class reconstructs tracks in one slice of TPC.
29  * The reconstruction algorithm is based on the Cellular Automaton method
30  *
31  * The CA tracker is designed stand-alone. 
32  * It is integrated to the HLT framework via AliHLTTPCCATrackerComponent interface.
33  * The class is under construction.
34  *
35  */
36 class AliHLTTPCCATracker
37 {
38  public:
39
40 #if !defined(HLTCA_GPUCODE)  
41   AliHLTTPCCATracker();
42   AliHLTTPCCATracker( const AliHLTTPCCATracker& );
43   AliHLTTPCCATracker &operator=( const AliHLTTPCCATracker& );
44
45   GPUd() ~AliHLTTPCCATracker();
46 #endif
47
48   GPUd() void Initialize( AliHLTTPCCAParam &param );
49
50   GPUd() void StartEvent();
51
52   GPUd() void ReadEvent( Int_t *RowFirstHit, Int_t *RowNHits, Float_t *Y, Float_t *Z, Int_t NHits );
53
54   void Reconstruct();
55
56   void WriteOutput();
57
58   GPUd() void GetErrors2( Int_t iRow,  const AliHLTTPCCATrackParam &t, Float_t &Err2Y, Float_t &Err2Z ) const;
59   GPUd() void GetErrors2( Int_t iRow,  const AliHLTTPCCATrackParam1 &t, Float_t &Err2Y, Float_t &Err2Z ) const;
60
61   GPUhd() AliHLTTPCCAParam &Param(){ return fParam; }
62   GPUhd() AliHLTTPCCARow *Rows(){ return fRows; }
63
64   Int_t * HitsID(){ return fHitsID; }
65
66   Int_t *OutTrackHits(){ return  fOutTrackHits; }
67   Int_t NOutTrackHits() const { return  fNOutTrackHits; }
68   GPUd() AliHLTTPCCAOutTrack *OutTracks(){ return  fOutTracks; }
69   GPUd() Int_t NOutTracks() const { return  fNOutTracks; }
70   GPUhd() Int_t *TrackHits(){ return fTrackHits; }
71
72   GPUhd() AliHLTTPCCATrack *Tracks(){ return  fTracks; }
73   GPUhd() Int_t &NTracks()  { return *fNTracks; }
74
75   Double_t *Timers(){ return fTimers; }
76
77   GPUhd() static Int_t IRowIHit2ID( Int_t iRow, Int_t iHit ){ 
78     return (iHit<<8)+iRow; 
79   }
80   GPUhd() static Int_t ID2IRow( Int_t HitID ){ 
81     return ( HitID%256 ); 
82   }
83   GPUhd() static Int_t ID2IHit( Int_t HitID ){ 
84     return ( HitID>>8 ); 
85   }  
86
87   GPUhd() AliHLTTPCCAHit &ID2Hit( Int_t HitID ) {
88     return fHits[fRows[HitID%256].FirstHit() + (HitID>>8)];
89   }
90   GPUhd() AliHLTTPCCARow &ID2Row( Int_t HitID ) {
91     return fRows[HitID%256];
92   }
93   
94   void FitTrack( AliHLTTPCCATrack &track, Float_t *t0 = 0 ) const;
95   void FitTrackFull( AliHLTTPCCATrack &track, Float_t *t0 = 0 ) const;
96   GPUhd() void SetPointers();
97
98   GPUhd() Short_t *HitLinkUp(){ return fHitLinkUp;}
99   GPUhd() Short_t *HitLinkDown(){ return fHitLinkDown;}
100   GPUhd() Int_t  *StartHits(){ return fStartHits;}
101   GPUhd() Int_t  *Tracklets(){ return fTracklets;}
102   GPUhd() Int_t  *HitIsUsed(){ return fHitIsUsed;}
103   GPUhd() AliHLTTPCCAHit *Hits(){ return fHits;}
104   GPUhd() Int_t &NHitsTotal(){ return fNHitsTotal;}
105   GPUhd() uint4 *&TexHitsFullData(){ return fTexHitsFullData;}
106   GPUhd() Int_t &TexHitsFullSize(){ return fTexHitsFullSize;}
107
108   GPUd() UChar_t GetGridContent( UInt_t i ) const; 
109   GPUd() AliHLTTPCCAHit GetHit( UInt_t i ) const;
110
111   private:
112  
113   //  
114
115   AliHLTTPCCAParam fParam; // parameters
116   AliHLTTPCCARow fRows[200];// array of hit rows
117   Double_t fTimers[10]; // running CPU time for different parts of the algorithm
118   
119   // event
120   Int_t fNHitsTotal;// total number of hits in event
121   Int_t fGridSizeTotal; // total grid size
122   Int_t fGrid1SizeTotal;// total grid1 size
123
124   AliHLTTPCCAHit *fHits; // hits
125   ushort2 *fHits1; // hits1
126   
127   UChar_t *fGridContents; // grid content
128   UInt_t *fGrid1Contents; // grid1 content
129   Int_t *fHitsID; // hit ID's
130  
131   // temporary information
132   
133   Short_t *fHitLinkUp; // array of up links
134   Short_t *fHitLinkDown;// array of down links
135   Int_t *fHitIsUsed; // array of used flags
136   Int_t  *fStartHits;   // array of start hits
137   Int_t *fTracklets; // array of tracklets
138
139   Int_t *fNTracks;// number of reconstructed tracks
140   AliHLTTPCCATrack *fTracks;   // reconstructed tracks
141   Int_t *fTrackHits; // array of track hit numbers
142
143   // output
144
145   Int_t fNOutTracks; // number of tracks in fOutTracks array
146   Int_t fNOutTrackHits;  // number of hits in fOutTrackHits array
147   AliHLTTPCCAOutTrack *fOutTracks; // output array of the reconstructed tracks
148   Int_t *fOutTrackHits;  // output array of ID's of the reconstructed hits
149
150   char *fEventMemory; // common event memory
151   UInt_t fEventMemSize; // size of the event memory
152
153   uint4 *fTexHitsFullData; // CUDA texture for hits
154   Int_t fTexHitsFullSize; // size of the CUDA texture
155 };
156
157
158 #endif