]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/AliHLTTPCTrackArray.h
first steps to set the covariance matrix from the errors calculated in conformal...
[u/mrichter/AliRoot.git] / HLT / TPCLib / AliHLTTPCTrackArray.h
1 // -*- Mode: C++ -*-
2 // @(#) $Id$
3 // Original: AliHLTTrackArray.h,v 1.7 2004/06/11 16:06:33 loizides 
4 #ifndef ALIHLTTPCTRACKARRAY_H
5 #define ALIHLTTPCTRACKARRAY_H
6
7 //* This file is property of and copyright by the ALICE HLT Project        * 
8 //* ALICE Experiment at CERN, All rights reserved.                         *
9 //* See cxx source for full Copyright notice                               *
10
11 /** @file   AliHLTTPCTrackArray.h
12     @author Uli Frankenfeld, maintained by Matthias Richter
13     @date   
14     @brief  Array of AliHLTTPCTracks
15 */
16
17 #include "AliHLTTPCRootTypes.h"
18
19 class AliHLTTPCConfMapTrack;
20 class AliHLTTPCTrack;
21 class AliHLTTPCTrackSegmentData;
22
23 /**
24  * @class AliHLTTPCTrackArray
25  * Array of AliHLTTrack objects.
26  * The class implements a dynamic array and handler methods.
27  *
28  * @ingroup alihlt_tpc
29  */
30 class AliHLTTPCTrackArray {
31  public:
32   /** default constructor */
33   AliHLTTPCTrackArray();
34   /**
35    * constructor 
36    * @param ntrack     initial size
37    */
38   AliHLTTPCTrackArray(Int_t ntrack);
39   /**
40    * constructor 
41    * @param tracktype  string describing type, one of
42    *   - AliHLTTPCTrack        -> 't'
43    *   - AliHLTTPCConfMapTrack -> 'c'
44    *   - AliHLTTPCHoughTrack   -> 'h'
45    *   - AliHLTTPCModelTrack   -> 'm'
46    * @param ntrack     initial size
47    */
48   AliHLTTPCTrackArray(char* tracktype,Int_t ntrack);
49   /**
50    * constructor 
51    * @param tracktype  string describing type, one of
52    *   - AliHLTTPCTrack        -> 't'
53    *   - AliHLTTPCConfMapTrack -> 'c'
54    *   - AliHLTTPCHoughTrack   -> 'h'
55    *   - AliHLTTPCModelTrack   -> 'm'
56    */
57   AliHLTTPCTrackArray(char* tracktype);
58   /** destructor */
59   virtual ~AliHLTTPCTrackArray();
60
61   /**
62    * Get type of track.
63    * @return one of
64    *   - 't' -> AliHLTTPCTrack        
65    *   - 'c' -> AliHLTTPCConfMapTrack 
66    *   - 'h' -> AliHLTTPCHoughTrack   
67    *   - 'm' -> AliHLTTPCModelTrack   
68    */
69   Int_t GetTrackType(){return fTrackType;}
70
71   /**
72    * Get size of the array.
73    * @return size of the array
74    */
75   Int_t GetSize() const {return fSize;}
76
77   /**
78    * Set size.
79    * If the current size is smaller, the array is grown to the new size.
80    * @return kTRUE if the array was grown, kFALSE otherwise
81    */
82   Bool_t SetSize(Int_t newsize=0);
83
84   Int_t GetNPresent() const {return (fNTracks- fNAbsent);}
85   Int_t GetNTracks() const {return fNTracks;}
86
87   /**
88    * Return pointer to next free track object.
89    * The array is grown if necessary.
90    */
91   AliHLTTPCTrack *NextTrack();
92   AliHLTTPCTrack *GetCheckedTrack(Int_t t){if(fIsPresent[t]) return fTrack[t]; return 0;}
93   AliHLTTPCTrack *GetTrack(Int_t t){return fTrack[t];}
94
95   void Remove(Int_t track); 
96   void RemoveLast() {fNTracks--;}
97   void Compress();
98   void Reset();
99   void QSort();
100   void QSort( AliHLTTPCTrack **a, Int_t first, Int_t last);
101   Int_t TrackCompare(AliHLTTPCTrack *a, AliHLTTPCTrack *b) const;
102
103   /**
104    * Fill track array from track segment array.
105    * Reads the track from an array of AliHLTTrackSegmentData. The coordinates
106    * are transformed to global coordinates if the slice parameter is specified.
107    * In that case to internal slice variable is set to zero.
108    * @param ntracks      size of the input array
109    * @param tr           array of AliHLTTrackSegmentData
110    * @param slice        slice no to transform the tracks to
111    * @param bTransform   transform to global coordinates if 1
112    */
113   void FillTracks(Int_t ntracks, AliHLTTPCTrackSegmentData* tr,Int_t slice=-1, Int_t bTransform=1);
114
115   UInt_t WriteTracks(AliHLTTPCTrackSegmentData* tr); //Write tracks
116   UInt_t WriteTracks(UInt_t & ntracks,AliHLTTPCTrackSegmentData* tr); //Write tracks
117   UInt_t GetOutSize();
118   UInt_t GetOutCount(){return (UInt_t) GetNPresent();}
119   void AddTracks(AliHLTTPCTrackArray *newtrack,Bool_t remove_old=kTRUE,Int_t slice=-1);//add all Tracks to this 
120   void AddLast(AliHLTTPCTrack *track);
121
122   AliHLTTPCTrack* operator[](int index);
123
124  private:
125   /** copy constructor prohibited */
126   AliHLTTPCTrackArray(const AliHLTTPCTrackArray&);
127   /** assignment operator prohibited */
128   AliHLTTPCTrackArray& operator=(const AliHLTTPCTrackArray&);
129
130   Char_t fTrackType; //track type
131   Int_t fSize; //size of array
132   Bool_t *fIsPresent;//!
133   Int_t fNAbsent; //ntracks absent
134
135   AliHLTTPCTrack **fTrack;//!
136   Int_t fNTracks; //ntracks in
137
138   UInt_t WriteConfMapTracks(AliHLTTPCTrackSegmentData* tr); 
139   void DeleteArray();
140
141   ClassDef(AliHLTTPCTrackArray,2) //Track array class
142 };
143
144 #endif