Line data Source code
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 :
10 : #ifndef ALIHLTTPCGMBORDERTRACK_H
11 : #define ALIHLTTPCGMBORDERTRACK_H
12 :
13 : #include "AliHLTTPCCAMath.h"
14 :
15 : /**
16 : * @class AliHLTTPCGMBorderTrack
17 : *
18 : * The class describes TPC slice tracks at sector borders.
19 : * Used in AliHLTTPCGMMerger
20 : *
21 : */
22 : class AliHLTTPCGMBorderTrack
23 : {
24 :
25 : public:
26 :
27 : struct Range{
28 : int fId;
29 : float fMin, fMax;
30 0 : static bool CompMin(const Range &a, const Range &b) { return a.fMin<b.fMin; }
31 0 : static bool CompMax(const Range &a, const Range &b) { return a.fMax<b.fMax; }
32 : };
33 :
34 :
35 0 : int TrackID() const { return fTrackID; }
36 0 : int NClusters() const { return fNClusters; }
37 0 : const float *Par() const { return fP; }
38 0 : const float *Cov() const { return fC; }
39 : const float *CovD() const { return fD; }
40 :
41 0 : void SetTrackID ( int v ) { fTrackID = v; }
42 0 : void SetNClusters ( int v ) { fNClusters = v; }
43 0 : void SetPar( int i, float x ) { fP[i] = x; }
44 0 : void SetCov( int i, float x ) { fC[i] = x; }
45 0 : void SetCovD( int i, float x ) { fD[i] = x; }
46 :
47 : static bool CheckChi2( float x1, float y1, float cx1, float cxy1, float cy1,
48 : float x2, float y2, float cx2, float cxy2, float cy2, float chi2cut )
49 : {
50 : //* Calculate Chi2/ndf deviation
51 0 : float dx = x1 - x2;
52 0 : float dy = y1 - y2;
53 0 : float cx = cx1 + cx2;
54 0 : float cxy = cxy1 + cxy2;
55 0 : float cy = cy1 + cy2;
56 0 : float det = cx*cy - cxy*cxy ;
57 0 : return ( ( cy*dx - (cxy+cxy)*dy )*dx + cx*dy*dy < (det+det)*chi2cut );
58 : }
59 :
60 : bool CheckChi2Y( const AliHLTTPCGMBorderTrack &t, float chi2cut ) const {
61 0 : float d = fP[0]-t.fP[0];
62 0 : return ( d*d < chi2cut*(fC[0] + t.fC[0]) );
63 : }
64 :
65 : bool CheckChi2Z( const AliHLTTPCGMBorderTrack &t, float chi2cut ) const {
66 : float d = fP[1]-t.fP[1];
67 : return ( d*d < chi2cut *(fC[1] + t.fC[1]) );
68 : }
69 :
70 : bool CheckChi2QPt( const AliHLTTPCGMBorderTrack &t, float chi2cut ) const {
71 0 : float d = fP[4]-t.fP[4];
72 0 : return ( d*d < chi2cut*(fC[4] + t.fC[4]) );
73 : }
74 :
75 : bool CheckChi2YS( const AliHLTTPCGMBorderTrack &t, float chi2cut ) const {
76 0 : return CheckChi2( fP[0], fP[2], fC[0], fD[0], fC[2],
77 0 : t.fP[0], t.fP[2], t.fC[0], t.fD[0], t.fC[2], chi2cut );
78 : }
79 :
80 : bool CheckChi2ZT( const AliHLTTPCGMBorderTrack &t, float chi2cut ) const {
81 0 : return CheckChi2( fP[1], fP[3], fC[1], fD[1], fC[3],
82 0 : t.fP[1], t.fP[3], t.fC[1], t.fD[1], t.fC[3], chi2cut );
83 :
84 : }
85 :
86 : private:
87 :
88 : int fTrackID; // track index
89 : int fNClusters; // n clusters
90 : float fP[5];
91 : float fC[5];
92 : float fD[2];
93 : };
94 :
95 : #endif
|