]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/tracking-ca/AliHLTTPCCAGBTracker.h
TPC CA Global Merger component added
[u/mrichter/AliRoot.git] / HLT / TPCLib / tracking-ca / AliHLTTPCCAGBTracker.h
1 //-*- Mode: C++ -*-
2 // ************************************************************************
3 // This file is property of and copyright by the ALICE HLT Project        * 
4 // ALICE Experiment at CERN, All rights reserved.                         *
5 // See cxx source for full Copyright notice                               *
6 //                                                                        *
7 //*************************************************************************
8
9 #ifndef ALIHLTTPCCAGBTRACKER_H
10 #define ALIHLTTPCCAGBTRACKER_H
11
12 #include "AliHLTTPCCADef.h"
13 #include "AliHLTTPCCATrackParam.h"
14
15 #if !defined(HLTCA_GPUCODE)
16 #include <iostream>
17 #endif
18
19 class AliHLTTPCCATracker;
20 class AliHLTTPCCAGBTrack;
21 class AliHLTTPCCAGBHit;
22 class TParticle;
23 class TProfile;
24 class AliHLTTPCCATrackParam;
25
26 /**
27  * @class AliHLTTPCCAGBTracker
28  * 
29  * Global Cellular Automaton-based HLT tracker for TPC detector
30  * The class reconstructs tracks in the whole TPC
31  * It calls the AliHLTTPCCATracker slice tracker and constructs 
32  * the global TPC tracks by merging the slice tracks 
33  *
34  * The tracker is designed stand-alone. 
35  * It will be integrated to the HLT framework via AliHLTTPCCAGBTrackerComponent interface,
36  * and to off-line framework via TPC/AliTPCtrackerCA class
37  * The class is under construction.
38  *
39  */
40 class AliHLTTPCCAGBTracker
41 {
42
43 public:
44
45   AliHLTTPCCAGBTracker();
46   AliHLTTPCCAGBTracker(const AliHLTTPCCAGBTracker&);
47   const AliHLTTPCCAGBTracker &operator=(const AliHLTTPCCAGBTracker&) const;
48
49   ~AliHLTTPCCAGBTracker();
50
51   void StartEvent();
52   void SetNSlices( Int_t N );
53   void SetNHits( Int_t nHits );
54
55   void ReadHit( Float_t x, Float_t y, Float_t z, 
56                 Float_t ErrY, Float_t ErrZ, Float_t amp,
57                 Int_t ID, Int_t iSlice, Int_t iRow );
58
59   void FindTracks();
60
61
62   void Refit();
63
64   struct AliHLTTPCCABorderTrack{
65     AliHLTTPCCABorderTrack(): fParam(), fITrack(0), fIRow(0), fNHits(0), fX(0), fOK(0){};
66     AliHLTTPCCATrackParam fParam; // track parameters at the border
67     Int_t fITrack;               // track index
68     Int_t fIRow;                 // row number of the closest cluster
69     Int_t fNHits;                // n hits
70     Float_t fX;                  // X coordinate of the closest cluster
71     Bool_t fOK;                  // is the trak rotated and extrapolated correctly
72   };
73   
74   void MakeBorderTracks( Int_t iSlice, Int_t iBorder, AliHLTTPCCABorderTrack B[], Int_t &nB);
75   void SplitBorderTracks( Int_t iSlice1, AliHLTTPCCABorderTrack B1[], Int_t N1,
76                           Int_t iSlice2, AliHLTTPCCABorderTrack B2[], Int_t N2, 
77                           Float_t Alpha =-1 );
78
79   static Float_t GetChi2( Float_t x1, Float_t y1, Float_t a00, Float_t a10, Float_t a11, 
80                           Float_t x2, Float_t y2, Float_t b00, Float_t b10, Float_t b11  );
81
82   void Merging();
83   void Merging1();
84
85   AliHLTTPCCATracker *Slices() const { return fSlices; }
86   AliHLTTPCCAGBHit *Hits() const { return fHits; }
87   Int_t Ext2IntHitID( Int_t i ) const { return fExt2IntHitID[i]; }
88
89   Int_t NHits() const { return fNHits; }
90   Int_t NSlices() const { return fNSlices; }
91   Double_t Time() const { return fTime; }
92   Double_t StatTime( Int_t iTimer ) const { return fStatTime[iTimer]; }
93   Int_t StatNEvents() const { return fStatNEvents; }
94   Int_t NTracks() const { return fNTracks; }
95   AliHLTTPCCAGBTrack *Tracks() const { return fTracks; }
96   Int_t *TrackHits() const { return fTrackHits; }
97   void GetErrors2( AliHLTTPCCAGBHit &h, AliHLTTPCCATrackParam &t, Float_t &Err2Y, Float_t &Err2Z );
98   void GetErrors2( Int_t iSlice, Int_t iRow, AliHLTTPCCATrackParam &t, Float_t &Err2Y, Float_t &Err2Z );
99
100   void WriteSettings( std::ostream &out ) const;
101   void ReadSettings( std::istream &in );
102   void WriteEvent( std::ostream &out ) const;
103   void ReadEvent( std::istream &in );
104   void WriteTracks( std::ostream &out ) const;
105   void ReadTracks( std::istream &in );
106
107   Double_t SliceTrackerTime() const { return fSliceTrackerTime; }
108   void SetSliceTrackerTime( Double_t v ){ fSliceTrackerTime = v; }
109   const Int_t *FirstSliceHit() const { return fFirstSliceHit; }
110
111   Bool_t FitTrack( AliHLTTPCCATrackParam &T, AliHLTTPCCATrackParam t0, 
112                    Float_t &Alpha, Int_t hits[], Int_t &NHits, 
113                    Float_t &DeDx, Bool_t dir=0 );
114
115 protected:
116
117   AliHLTTPCCATracker *fSlices; //* array of slice trackers
118   Int_t fNSlices;              //* N slices
119   AliHLTTPCCAGBHit *fHits;     //* hit array
120   Int_t *fExt2IntHitID;        //* array of internal hit indices
121   Int_t fNHits;                //* N hits in event
122   Int_t *fTrackHits;           //* track->hits reference array
123   AliHLTTPCCAGBTrack *fTracks; //* array of tracks
124   Int_t fNTracks;              //* N tracks
125
126   struct AliHLTTPCCAGBSliceTrackInfo{
127     Int_t fPrevNeighbour; //* neighbour in the previous slide
128     Int_t fNextNeighbour; //* neighbour in the next slide
129     Bool_t fUsed;         //* is the slice track used by global tracks
130   };
131
132   AliHLTTPCCAGBSliceTrackInfo **fSliceTrackInfos; //* additional information for slice tracks
133   Double_t fTime; //* total time
134   Double_t fStatTime[20]; //* timers 
135   Int_t fStatNEvents;    //* n events proceed
136   Int_t fFirstSliceHit[100]; // hit array
137
138   Double_t fSliceTrackerTime; // reco time of the slice tracker;
139
140 };
141
142 #endif