]>
Commit | Line | Data |
---|---|---|
4fdaad1e | 1 | // -*- Mode: C++ -*- |
a6c02c85 | 2 | // @(#) $Id$ |
4aa41877 | 3 | // Original: AliHLTTrackArray.h,v 1.7 2004/06/11 16:06:33 loizides |
a6c02c85 | 4 | #ifndef ALIHLTTPCTRACKARRAY_H |
5 | #define ALIHLTTPCTRACKARRAY_H | |
6 | ||
297174de | 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 * | |
4fdaad1e | 10 | |
11 | /** @file AliHLTTPCTrackArray.h | |
12 | @author Uli Frankenfeld, maintained by Matthias Richter | |
13 | @date | |
14 | @brief Array of AliHLTTPCTracks | |
15 | */ | |
16 | ||
a6c02c85 | 17 | #include "AliHLTTPCRootTypes.h" |
18 | ||
19 | class AliHLTTPCConfMapTrack; | |
20 | class AliHLTTPCTrack; | |
21 | class AliHLTTPCTrackSegmentData; | |
febeb705 | 22 | class AliHLTTPCTrackSegmentDataV1; |
e2a9091e | 23 | class AliHLTExternalTrackParam; |
4fdaad1e | 24 | /** |
25 | * @class AliHLTTPCTrackArray | |
26 | * Array of AliHLTTrack objects. | |
27 | * The class implements a dynamic array and handler methods. | |
297174de | 28 | * |
29 | * @ingroup alihlt_tpc | |
4fdaad1e | 30 | */ |
a6c02c85 | 31 | class AliHLTTPCTrackArray { |
a6c02c85 | 32 | public: |
4fdaad1e | 33 | /** default constructor */ |
a6c02c85 | 34 | AliHLTTPCTrackArray(); |
4fdaad1e | 35 | /** |
36 | * constructor | |
37 | * @param ntrack initial size | |
38 | */ | |
a6c02c85 | 39 | AliHLTTPCTrackArray(Int_t ntrack); |
4fdaad1e | 40 | /** |
41 | * constructor | |
42 | * @param tracktype string describing type, one of | |
43 | * - AliHLTTPCTrack -> 't' | |
44 | * - AliHLTTPCConfMapTrack -> 'c' | |
45 | * - AliHLTTPCHoughTrack -> 'h' | |
46 | * - AliHLTTPCModelTrack -> 'm' | |
47 | * @param ntrack initial size | |
48 | */ | |
a6e0ebfe | 49 | AliHLTTPCTrackArray(const char* tracktype,Int_t ntrack); |
4fdaad1e | 50 | /** |
51 | * constructor | |
52 | * @param tracktype string describing type, one of | |
53 | * - AliHLTTPCTrack -> 't' | |
54 | * - AliHLTTPCConfMapTrack -> 'c' | |
55 | * - AliHLTTPCHoughTrack -> 'h' | |
56 | * - AliHLTTPCModelTrack -> 'm' | |
57 | */ | |
a6e0ebfe | 58 | AliHLTTPCTrackArray(const char* tracktype); |
4fdaad1e | 59 | /** destructor */ |
a6c02c85 | 60 | virtual ~AliHLTTPCTrackArray(); |
4fdaad1e | 61 | |
62 | /** | |
63 | * Get type of track. | |
64 | * @return one of | |
65 | * - 't' -> AliHLTTPCTrack | |
66 | * - 'c' -> AliHLTTPCConfMapTrack | |
67 | * - 'h' -> AliHLTTPCHoughTrack | |
68 | * - 'm' -> AliHLTTPCModelTrack | |
69 | */ | |
a6c02c85 | 70 | Int_t GetTrackType(){return fTrackType;} |
4fdaad1e | 71 | |
72 | /** | |
73 | * Get size of the array. | |
74 | * @return size of the array | |
75 | */ | |
a6c02c85 | 76 | Int_t GetSize() const {return fSize;} |
4fdaad1e | 77 | |
78 | /** | |
79 | * Set size. | |
80 | * If the current size is smaller, the array is grown to the new size. | |
81 | * @return kTRUE if the array was grown, kFALSE otherwise | |
82 | */ | |
ee18a059 | 83 | Bool_t SetSize(Int_t newsize=0); |
a6c02c85 | 84 | |
85 | Int_t GetNPresent() const {return (fNTracks- fNAbsent);} | |
86 | Int_t GetNTracks() const {return fNTracks;} | |
055fed30 | 87 | |
88 | /** | |
89 | * Return pointer to next free track object. | |
90 | * The array is grown if necessary. | |
91 | */ | |
a6c02c85 | 92 | AliHLTTPCTrack *NextTrack(); |
93 | AliHLTTPCTrack *GetCheckedTrack(Int_t t){if(fIsPresent[t]) return fTrack[t]; return 0;} | |
94 | AliHLTTPCTrack *GetTrack(Int_t t){return fTrack[t];} | |
95 | ||
96 | void Remove(Int_t track); | |
97 | void RemoveLast() {fNTracks--;} | |
98 | void Compress(); | |
99 | void Reset(); | |
100 | void QSort(); | |
101 | void QSort( AliHLTTPCTrack **a, Int_t first, Int_t last); | |
102 | Int_t TrackCompare(AliHLTTPCTrack *a, AliHLTTPCTrack *b) const; | |
103 | ||
febeb705 | 104 | /** |
105 | * Fill track array from track segment array. | |
106 | * Old method excluding buffer protection kept for backward compatibility. | |
107 | * Forwarded to FillTracksChecked(). | |
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 | int FillTracks(Int_t ntracks, AliHLTTPCTrackSegmentData* tr, Int_t slice=-1, Int_t bTransform=1); | |
114 | ||
4fdaad1e | 115 | /** |
116 | * Fill track array from track segment array. | |
117 | * Reads the track from an array of AliHLTTrackSegmentData. The coordinates | |
118 | * are transformed to global coordinates if the slice parameter is specified. | |
119 | * In that case to internal slice variable is set to zero. | |
febeb705 | 120 | * |
121 | * The sizeInByte parameter allows an additional buffer protection if | |
122 | * non-zero. The size of the AliHLTTPCTrackSegmentData is not fixed due to | |
123 | * variable array at the end of the structure. The pointer to the next | |
124 | * entry must be set according to the variable array. | |
4fdaad1e | 125 | * @param ntracks size of the input array |
126 | * @param tr array of AliHLTTrackSegmentData | |
febeb705 | 127 | * @param sizeInByte additional size protection |
4fdaad1e | 128 | * @param slice slice no to transform the tracks to |
129 | * @param bTransform transform to global coordinates if 1 | |
130 | */ | |
febeb705 | 131 | int FillTracksChecked(AliHLTTPCTrackSegmentData* tr, Int_t ntracks, unsigned int sizeInByte, Int_t slice=-1, Int_t bTransform=1); |
e2a9091e | 132 | int FillTracksChecked(AliHLTExternalTrackParam* tr, Int_t ntracks, unsigned int sizeInByte, Int_t slice=-1, Int_t bTransform=1); |
febeb705 | 133 | |
134 | /** | |
135 | * Fill array from version1 structure. | |
136 | * The version 1 of ALiHLTTPCTrackSegmentData was valid until July 2008 | |
137 | * revision 27415. | |
138 | * | |
139 | * Similar behavior like FillTracksChecked. | |
140 | */ | |
141 | int FillTracksVersion1(AliHLTTPCTrackSegmentDataV1* tr, Int_t ntracks, unsigned int sizeInByte, Int_t slice=-1, Int_t bTransform=1); | |
4fdaad1e | 142 | |
a6c02c85 | 143 | UInt_t WriteTracks(AliHLTTPCTrackSegmentData* tr); //Write tracks |
144 | UInt_t WriteTracks(UInt_t & ntracks,AliHLTTPCTrackSegmentData* tr); //Write tracks | |
145 | UInt_t GetOutSize(); | |
146 | UInt_t GetOutCount(){return (UInt_t) GetNPresent();} | |
147 | void AddTracks(AliHLTTPCTrackArray *newtrack,Bool_t remove_old=kTRUE,Int_t slice=-1);//add all Tracks to this | |
148 | void AddLast(AliHLTTPCTrack *track); | |
149 | ||
3cde846d | 150 | AliHLTTPCTrack* operator[](int index); |
151 | ||
4fdaad1e | 152 | private: |
8f8bf0af | 153 | /** copy constructor prohibited */ |
154 | AliHLTTPCTrackArray(const AliHLTTPCTrackArray&); | |
155 | /** assignment operator prohibited */ | |
156 | AliHLTTPCTrackArray& operator=(const AliHLTTPCTrackArray&); | |
4fdaad1e | 157 | |
158 | Char_t fTrackType; //track type | |
055fed30 | 159 | Int_t fSize; //size of array |
4fdaad1e | 160 | Bool_t *fIsPresent;//! |
161 | Int_t fNAbsent; //ntracks absent | |
162 | ||
163 | AliHLTTPCTrack **fTrack;//! | |
164 | Int_t fNTracks; //ntracks in | |
165 | ||
166 | UInt_t WriteConfMapTracks(AliHLTTPCTrackSegmentData* tr); | |
167 | void DeleteArray(); | |
168 | ||
3cde846d | 169 | ClassDef(AliHLTTPCTrackArray,2) //Track array class |
a6c02c85 | 170 | }; |
171 | ||
172 | #endif |