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