3 // Original: AliHLTTrackArray.h,v 1.7 2004/06/11 16:06:33 loizides
4 #ifndef ALIHLTTPCTRACKARRAY_H
5 #define ALIHLTTPCTRACKARRAY_H
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 *
11 /** @file AliHLTTPCTrackArray.h
12 @author Uli Frankenfeld, maintained by Matthias Richter
14 @brief Array of AliHLTTPCTracks
17 #include "AliHLTTPCRootTypes.h"
19 class AliHLTTPCConfMapTrack;
21 class AliHLTTPCTrackSegmentData;
22 class AliHLTTPCTrackSegmentDataV1;
23 class AliHLTExternalTrackParam;
25 * @class AliHLTTPCTrackArray
26 * Array of AliHLTTrack objects.
27 * The class implements a dynamic array and handler methods.
31 class AliHLTTPCTrackArray {
33 /** default constructor */
34 AliHLTTPCTrackArray();
37 * @param ntrack initial size
39 AliHLTTPCTrackArray(Int_t ntrack);
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
49 AliHLTTPCTrackArray(const char* tracktype,Int_t ntrack);
52 * @param tracktype string describing type, one of
53 * - AliHLTTPCTrack -> 't'
54 * - AliHLTTPCConfMapTrack -> 'c'
55 * - AliHLTTPCHoughTrack -> 'h'
56 * - AliHLTTPCModelTrack -> 'm'
58 AliHLTTPCTrackArray(const char* tracktype);
60 virtual ~AliHLTTPCTrackArray();
65 * - 't' -> AliHLTTPCTrack
66 * - 'c' -> AliHLTTPCConfMapTrack
67 * - 'h' -> AliHLTTPCHoughTrack
68 * - 'm' -> AliHLTTPCModelTrack
70 Int_t GetTrackType(){return fTrackType;}
73 * Get size of the array.
74 * @return size of the array
76 Int_t GetSize() const {return fSize;}
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
83 Bool_t SetSize(Int_t newsize=0);
85 Int_t GetNPresent() const {return (fNTracks- fNAbsent);}
86 Int_t GetNTracks() const {return fNTracks;}
89 * Return pointer to next free track object.
90 * The array is grown if necessary.
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];}
96 void Remove(Int_t track);
97 void RemoveLast() {fNTracks--;}
101 void QSort( AliHLTTPCTrack **a, Int_t first, Int_t last);
102 Int_t TrackCompare(AliHLTTPCTrack *a, AliHLTTPCTrack *b) const;
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
113 int FillTracks(Int_t ntracks, AliHLTTPCTrackSegmentData* tr, Int_t slice=-1, Int_t bTransform=1);
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.
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.
125 * @param ntracks size of the input array
126 * @param tr array of AliHLTTrackSegmentData
127 * @param sizeInByte additional size protection
128 * @param slice slice no to transform the tracks to
129 * @param bTransform transform to global coordinates if 1
131 int FillTracksChecked(AliHLTTPCTrackSegmentData* tr, Int_t ntracks, unsigned int sizeInByte, Int_t slice=-1, Int_t bTransform=1);
132 int FillTracksChecked(AliHLTExternalTrackParam* tr, Int_t ntracks, unsigned int sizeInByte, Int_t slice=-1, Int_t bTransform=1);
135 * Fill array from version1 structure.
136 * The version 1 of ALiHLTTPCTrackSegmentData was valid until July 2008
139 * Similar behavior like FillTracksChecked.
141 int FillTracksVersion1(AliHLTTPCTrackSegmentDataV1* tr, Int_t ntracks, unsigned int sizeInByte, Int_t slice=-1, Int_t bTransform=1);
143 UInt_t WriteTracks(AliHLTTPCTrackSegmentData* tr); //Write tracks
144 UInt_t WriteTracks(UInt_t & ntracks,AliHLTTPCTrackSegmentData* tr); //Write tracks
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);
150 AliHLTTPCTrack* operator[](int index);
153 /** copy constructor prohibited */
154 AliHLTTPCTrackArray(const AliHLTTPCTrackArray&);
155 /** assignment operator prohibited */
156 AliHLTTPCTrackArray& operator=(const AliHLTTPCTrackArray&);
158 Char_t fTrackType; //track type
159 Int_t fSize; //size of array
160 Bool_t *fIsPresent;//!
161 Int_t fNAbsent; //ntracks absent
163 AliHLTTPCTrack **fTrack;//!
164 Int_t fNTracks; //ntracks in
166 UInt_t WriteConfMapTracks(AliHLTTPCTrackSegmentData* tr);
169 ClassDef(AliHLTTPCTrackArray,2) //Track array class