Line data Source code
1 : #ifndef ALISTRLINE_H
2 : #define ALISTRLINE_H
3 : /* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
4 : * See cxx source for full Copyright notice */
5 :
6 : ///////////////////////////////////////////////////////////////////
7 : // //
8 : // A straight line is coded as a point (3 Double_t) and //
9 : // 3 direction cosines //
10 : // //
11 : ///////////////////////////////////////////////////////////////////
12 :
13 : #include "AliLog.h"
14 :
15 : class AliStrLine : public TObject {
16 :
17 : public:
18 : AliStrLine(); // default constructor
19 : AliStrLine(const Double_t *const point, const Double_t *const cd, Bool_t twopoints=kFALSE, UShort_t id1=65535, UShort_t id2=65535); // standard constructor
20 : AliStrLine(const Double_t *const point, const Double_t *const sig2point, const Double_t *const cd, Bool_t twopoints=kFALSE, UShort_t id1=65535, UShort_t id2=65535);
21 : AliStrLine(const Double_t *const point, const Double_t *const sig2point, const Double_t *const wmat, const Double_t *const cd, Bool_t twopoints=kFALSE, UShort_t id1=65535, UShort_t id2=65535);
22 :
23 : AliStrLine(const AliStrLine& source);
24 : AliStrLine& operator=(const AliStrLine& source);
25 : virtual ~AliStrLine(); // destructor
26 480 : virtual void Clear(Option_t*){if(fWMatrix)delete[] fWMatrix; fWMatrix = 0;}
27 : void PrintStatus() const;
28 0 : void SetP0(const Double_t *point) {for(Int_t i=0;i<3;i++)fP0[i]=point[i];}
29 0 : void SetSigma2P0(const Double_t *sigsq) {for(Int_t i=0;i<3;i++)fSigma2P0[i]=sigsq[i];}
30 : void SetWMatrix(const Double_t *wmat);
31 0 : void SetCd(const Double_t *cd) {for(Int_t i=0;i<3;i++)fCd[i]=cd[i];}
32 : void SetIdPoints(UShort_t id1, UShort_t id2){
33 2168 : fIdPoint[0]=id1;
34 1084 : fIdPoint[1]=id2;
35 1084 : }
36 :
37 38140 : void GetP0(Double_t *point) const {for(Int_t i=0;i<3;i++)point[i]=fP0[i];}
38 3720 : void GetSigma2P0(Double_t *sigsq) const {for(Int_t i=0;i<3;i++)sigsq[i]=fSigma2P0[i];}
39 : void GetWMatrix(Double_t *wmat) const;
40 65340 : void GetCd(Double_t *cd) const {for(Int_t i=0;i<3;i++)cd[i]=fCd[i];}
41 : void GetCurrentPoint(Double_t *point) const;
42 : UShort_t GetIdPoint(Int_t i) const {
43 288 : if(i<2) return fIdPoint[i];
44 0 : AliError("Wrong element: only 2 points are stored in AliStrLine");
45 0 : return 65535;
46 96 : }
47 : Int_t IsParallelTo(const AliStrLine *line) const;
48 : Int_t Crossrphi(const AliStrLine *line);
49 : Int_t CrossPoints(AliStrLine *line, Double_t *point1, Double_t *point2);
50 : Int_t Cross(AliStrLine *line, Double_t *point);
51 : Double_t GetDCA(const AliStrLine *line) const;
52 : Double_t GetDistFromPoint(const Double_t *point) const;
53 : Bool_t GetParamAtRadius(Double_t r,Double_t &t1,Double_t &t2) const;
54 : void ComputePointAtT(Double_t t,Double_t *p) const {
55 0 : for(Int_t i=0;i<3;i++)p[i]=fP0[i]+fCd[i]*t; }
56 : protected:
57 : void InitDirection(const Double_t *const point, const Double_t *const cd);
58 : void InitTwoPoints(const Double_t *const pA, const Double_t *const pB);
59 : Double_t fP0[3]; // given point
60 : Double_t fSigma2P0[3]; // errors on coordinates of given point
61 : Double_t *fWMatrix; //[6] weighting matrix
62 : /* fWMatrix is a symmetric matrix internally stored as
63 : 0 --> row = 0, col = 0
64 : 1 --> 0,1
65 : 2 --> 0,2
66 : 3 --> 1,1
67 : 4 --> 1,2
68 : 5 --> 2,2
69 : The external interface (constructor, getter and setter) is:
70 : 0 --> row = 0, col = 0
71 : 1 --> 0,1
72 : 2 --> 0,2
73 : 3 --> 1,0
74 : 4 --> 1,1
75 : 5 --> 1,2
76 : 6 --> 2,0
77 : 7 --> 2,1
78 : 8 --> 2,2 */
79 : Double_t fCd[3]; // direction cosines
80 : Double_t fTpar; //! parameter
81 : UShort_t fIdPoint[2]; // Identifiers of RecPoints defining the line
82 :
83 : private:
84 1444 : void SetPar(const Double_t par){fTpar = par;}
85 :
86 172 : ClassDef(AliStrLine,5);
87 : };
88 :
89 : #endif
|