]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/tracking-ca/AliHLTTPCCATracker.h
Total amount of used memory has been optimised
[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 //*************************************************************************
9
10 #ifndef ALIHLTTPCCATRACKER_H
11 #define ALIHLTTPCCATRACKER_H
12
13
14 #include "AliHLTTPCCADef.h"
15 #include "AliHLTTPCCAParam.h"
16 #include "AliHLTTPCCARow.h"
17 #include "AliHLTTPCCAHit.h"
18 #include <iostream>
19
20 class AliHLTTPCCATrack;
21 class AliHLTTPCCAOutTrack;
22 class AliHLTTPCCATrackParam;
23 class AliHLTTPCCATracklet;
24
25
26 /**
27  * @class AliHLTTPCCATracker
28  * 
29  * Slice tracker for ALICE HLT. 
30  * The class reconstructs tracks in one slice of TPC.
31  * The reconstruction algorithm is based on the Cellular Automaton method
32  *
33  * The CA tracker is designed stand-alone. 
34  * It is integrated to the HLT framework via AliHLTTPCCATrackerComponent interface.
35  * The class is under construction.
36  *
37  */
38 class AliHLTTPCCATracker
39 {
40  public:
41
42 #if !defined(HLTCA_GPUCODE)  
43   AliHLTTPCCATracker();
44   AliHLTTPCCATracker( const AliHLTTPCCATracker& );
45   AliHLTTPCCATracker &operator=( const AliHLTTPCCATracker& );
46
47   GPUd() ~AliHLTTPCCATracker();
48 #endif
49
50   GPUd() void Initialize( const AliHLTTPCCAParam &param );
51
52   GPUd() void StartEvent();
53
54   GPUd() void ReadEvent( const Int_t *RowFirstHit, const Int_t *RowNHits, const Float_t *Y, const Float_t *Z, Int_t NHits );
55
56   GPUd() void SetupRowData();
57
58   void Reconstruct();
59   void WriteOutput();
60
61   GPUd() void GetErrors2( Int_t iRow,  const AliHLTTPCCATrackParam &t, Float_t &Err2Y, Float_t &Err2Z ) const;
62   GPUd() void GetErrors2( Int_t iRow, Float_t z, Float_t sinPhi, Float_t cosPhi, Float_t DzDs, Float_t &Err2Y, Float_t &Err2Z ) const;
63
64   GPUhd() static Int_t IRowIHit2ID( Int_t iRow, Int_t iHit ){ 
65     return (iHit<<8)+iRow; 
66   }
67   GPUhd() static Int_t ID2IRow( Int_t HitID ){ 
68     return ( HitID%256 ); 
69   }
70   GPUhd() static Int_t ID2IHit( Int_t HitID ){ 
71     return ( HitID>>8 ); 
72   }  
73
74   //GPUhd() AliHLTTPCCAHit &ID2Hit( Int_t HitID ) {
75   //return fHits[fRows[HitID%256].FirstHit() + (HitID>>8)];
76   //}
77   GPUhd() const AliHLTTPCCARow &ID2Row( Int_t HitID ) const {
78     return fRows[HitID%256];
79   }
80   
81   void FitTrack( AliHLTTPCCATrack &track, Float_t *t0 = 0 ) const;
82   void FitTrackFull( AliHLTTPCCATrack &track, Float_t *t0 = 0 ) const;
83   GPUhd() void SetPointersCommon();
84   GPUhd() void SetPointersHits( Int_t MaxNHits );
85   GPUhd() void SetPointersTracks( Int_t MaxNTracks );
86
87 #if !defined(HLTCA_GPUCODE)  
88   GPUh() void WriteEvent( std::ostream &out );
89   GPUh() void ReadEvent( std::istream &in );
90   GPUh() void WriteTracks( std::ostream &out ) ;
91   GPUh() void ReadTracks( std::istream &in );
92 #endif
93
94   GPUhd() const AliHLTTPCCAParam &Param() const { return fParam; }
95   GPUhd() void SetParam( const AliHLTTPCCAParam &v ){ fParam = v; }
96
97   GPUhd() const AliHLTTPCCARow &Row(Int_t i) const { return fRows[i]; }
98   GPUhd() Double_t Timer(Int_t i) const { return fTimers[i]; }
99   GPUhd() void SetTimer(Int_t i, Double_t v ){ fTimers[i] = v; }
100
101   GPUhd() Int_t NHitsTotal() const { return fNHitsTotal;}
102
103   GPUhd() const Char_t *InputEvent()    const { return fInputEvent; }
104   GPUhd() Int_t  InputEventSize() const { return fInputEventSize; }
105
106   GPUhd() const uint4  *RowData()    const   { return fRowData; }
107   GPUhd() Int_t  RowDataSize()  const { return fRowDataSize; }
108  
109   GPUhd() Int_t *HitInputIDs() const { return fHitInputIDs; }
110   GPUhd() Int_t  *HitWeights() const { return fHitWeights; }  
111   
112   GPUhd() Int_t  *NTracklets() const { return fNTracklets; }
113   GPUhd() Int_t  *TrackletStartHits() const { return fTrackletStartHits; }
114   GPUhd() AliHLTTPCCATracklet  *Tracklets() const { return fTracklets;}
115   
116   GPUhd() Int_t *NTracks()  const { return fNTracks; }
117   GPUhd() AliHLTTPCCATrack *Tracks() const { return  fTracks; }
118   GPUhd() Int_t *NTrackHits()  const { return fNTrackHits; }
119   GPUhd() Int_t *TrackHits() const { return fTrackHits; }
120
121   GPUhd()  Int_t *NOutTracks() const { return  fNOutTracks; }
122   GPUhd()  AliHLTTPCCAOutTrack *OutTracks() const { return  fOutTracks; }
123   GPUhd()  Int_t *NOutTrackHits() const { return  fNOutTrackHits; }
124   GPUhd()  Int_t *OutTrackHits() const { return  fOutTrackHits; }
125  
126   GPUh() void SetCommonMemory( Char_t * const mem ){ fCommonMemory = mem; }
127
128   private:  
129
130   AliHLTTPCCAParam fParam; // parameters
131   AliHLTTPCCARow fRows[200];// array of hit rows
132   Double_t fTimers[10]; // running CPU time for different parts of the algorithm
133   
134   // event
135
136   Int_t fNHitsTotal;// total number of hits in event
137  
138   Char_t *fCommonMemory; // common event memory
139   Int_t   fCommonMemorySize; // size of the event memory [bytes]
140
141   Char_t *fHitMemory; // event memory for hits
142   Int_t   fHitMemorySize; // size of the event memory [bytes]
143
144   Char_t *fTrackMemory; // event memory for tracks
145   Int_t   fTrackMemorySize; // size of the event memory [bytes]
146
147   Char_t *fInputEvent;     // input event
148   Int_t   fInputEventSize; // size of the input event [bytes]
149
150   uint4  *fRowData;     // TPC rows: clusters, grid, links to neighbours
151   Int_t   fRowDataSize; // size of the row data
152  
153   Int_t *fHitInputIDs; // cluster index in InputEvent  
154   Int_t *fHitWeights;  // the weight of the longest tracklet crossed the cluster
155   
156   Int_t *fNTracklets;     // number of tracklets 
157   Int_t *fTrackletStartHits;   // start hits for the tracklets
158   AliHLTTPCCATracklet *fTracklets; // tracklets
159
160   // 
161   Int_t *fNTracks;            // number of reconstructed tracks
162   AliHLTTPCCATrack *fTracks;  // reconstructed tracks
163   Int_t *fNTrackHits;           // number of track hits
164   Int_t *fTrackHits;          // array of track hit numbers
165
166   // output
167
168   Int_t *fNOutTracks; // number of tracks in fOutTracks array
169   AliHLTTPCCAOutTrack *fOutTracks; // output array of the reconstructed tracks
170   Int_t *fNOutTrackHits;  // number of hits in fOutTrackHits array
171   Int_t *fOutTrackHits;  // output array of ID's of the reconstructed hits
172   
173   //temporary
174   
175   Int_t *fTmpHitInputIDs; // temporary step
176
177 };
178
179
180 #endif