]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/TPCLib/tracking-ca/AliHLTTPCCAMerger.h
bug fix: reconstruction crash when the output buffer size exceed
[u/mrichter/AliRoot.git] / HLT / TPCLib / tracking-ca / AliHLTTPCCAMerger.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 ALIHLTTPCCAMERGER_H
10 #define ALIHLTTPCCAMERGER_H
11
12 #include "AliHLTTPCCADef.h"
13 #include "AliHLTTPCCAParam.h"
14 #include "AliHLTTPCCATrackParam.h"
15
16 #if !defined(HLTCA_GPUCODE)
17 #include <iostream>
18 #endif //HLTCA_GPUCODE
19
20 class AliHLTTPCCASliceTrack;
21 class AliHLTTPCCASliceOutput;
22 class AliHLTTPCCAMergedTrack;
23 class AliHLTTPCCAMergerOutput;
24
25 /**
26  * @class AliHLTTPCCAMerger
27  *
28  */
29 class AliHLTTPCCAMerger
30 {
31
32   public:
33
34     class AliHLTTPCCAClusterInfo
35     {
36
37       public:
38
39         unsigned char  ISlice()    const { return fISlice;    }
40         unsigned char  IRow()    const { return fIRow;    }
41         int  Id()      const { return fId;      }
42         UChar_t PackedAmp() const { return fPackedAmp; }
43         float X()         const { return fX;         }
44         float Y()         const { return fY;         }
45         float Z()         const { return fZ;         }
46         float Err2Y()     const { return fErr2Y;     }
47         float Err2Z()     const { return fErr2Z;     }
48
49         void SetISlice    ( unsigned char v  ) { fISlice    = v; }
50         void SetIRow    ( unsigned char v  ) { fIRow    = v; }
51         void SetId      (  int v  ) { fId      = v; }
52         void SetPackedAmp ( UChar_t v ) { fPackedAmp = v; }
53         void SetX         ( float v ) { fX         = v; }
54         void SetY         ( float v ) { fY         = v; }
55         void SetZ         ( float v ) { fZ         = v; }
56         void SetErr2Y     ( float v ) { fErr2Y     = v; }
57         void SetErr2Z     ( float v ) { fErr2Z     = v; }
58
59       private:
60
61         unsigned char fISlice;            // slice number
62         unsigned char fIRow;            // row number
63         int fId;                 // cluster hlt number
64         UChar_t fPackedAmp; // packed cluster amplitude
65         float fX;                // x position (slice coord.system)
66         float fY;                // y position (slice coord.system)
67         float fZ;                // z position (slice coord.system)
68         float fErr2Y;            // Squared measurement error of y position
69         float fErr2Z;            // Squared measurement error of z position
70     };
71
72     AliHLTTPCCAMerger();
73     ~AliHLTTPCCAMerger();
74
75     void SetSliceParam( const AliHLTTPCCAParam &v ) { fSliceParam = v; }
76
77     void Clear();
78     void SetSliceData( int index, const AliHLTTPCCASliceOutput *SliceData );
79     void Reconstruct();
80
81     const AliHLTTPCCAMergerOutput * Output() const { return fOutput; }
82
83     bool FitTrack( AliHLTTPCCATrackParam &T, float &Alpha,
84                    AliHLTTPCCATrackParam t0, float Alpha0, int hits[], int &NHits,  bool dir,
85                    bool final = 0, 
86                    AliHLTTPCCAClusterInfo *infoArray = 0 );
87
88     const AliHLTTPCCAParam &SliceParam() const { return fSliceParam; }
89
90     static float GetChi2( float x1, float y1, float a00, float a10, float a11,
91                           float x2, float y2, float b00, float b10, float b11  );
92
93   private:
94
95     AliHLTTPCCAMerger( const AliHLTTPCCAMerger& );
96     const AliHLTTPCCAMerger &operator=( const AliHLTTPCCAMerger& ) const;
97
98     class AliHLTTPCCASliceTrackInfo;
99     class AliHLTTPCCABorderTrack;
100
101     void MakeBorderTracks( int iSlice, int iBorder, AliHLTTPCCABorderTrack B[], int &nB );
102     void MergeBorderTracks( int iSlice1, AliHLTTPCCABorderTrack B1[], int N1,
103                             int iSlice2, AliHLTTPCCABorderTrack B2[], int N2 );
104
105
106     void UnpackSlices();
107     void Merging();
108
109
110
111     static const int fgkNSlices = 36;       //* N slices
112     AliHLTTPCCAParam fSliceParam;           //* slice parameters (geometry, calibr, etc.)
113     const AliHLTTPCCASliceOutput *fkSlices[fgkNSlices]; //* array of input slice tracks
114     AliHLTTPCCAMergerOutput *fOutput;       //* array of output merged tracks
115     AliHLTTPCCASliceTrackInfo *fTrackInfos; //* additional information for slice tracks
116     int fMaxTrackInfos;                   //* booked size of fTrackInfos array
117     AliHLTTPCCAClusterInfo *fClusterInfos;  //* information about track clusters
118     int fMaxClusterInfos;                 //* booked size of fClusterInfos array
119     int fSliceTrackInfoStart[fgkNSlices];   //* slice starting index in fTrackInfos array;
120     int fSliceNTrackInfos[fgkNSlices];                //* N of slice track infos in fTrackInfos array;
121 };
122
123 #endif //ALIHLTTPCCAMERGER_H