]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliStrLine.h
Fixes for bug #52499: Field polarities inconsistiency
[u/mrichter/AliRoot.git] / STEER / AliStrLine.h
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     virtual void Clear(Option_t*){if(fWMatrix)delete[] fWMatrix; fWMatrix = 0;}
27     void PrintStatus() const;
28     void SetP0(const Double_t *point) {for(Int_t i=0;i<3;i++)fP0[i]=point[i];}
29     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     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       fIdPoint[0]=id1;
34       fIdPoint[1]=id2;
35     } 
36
37     void GetP0(Double_t *point) const {for(Int_t i=0;i<3;i++)point[i]=fP0[i];}
38     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     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       if(i<2) return fIdPoint[i];
44       AliError("Wrong element: only 2 points are stored in AliStrLine");
45       return 65535;
46     }
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  protected:
54     void InitDirection(const Double_t *const point, const Double_t *const cd);
55     void InitTwoPoints(const Double_t *const pA, const Double_t *const pB);
56     Double_t fP0[3];           // given point
57     Double_t fSigma2P0[3];           // errors on coordinates of given point
58     Double_t *fWMatrix;           //[6] weighting matrix
59     /* fWMatrix is a symmetric matrix internally stored as
60        0 --> row = 0, col = 0
61        1 --> 0,1
62        2 --> 0,2
63        3 --> 1,1
64        4 --> 1,2
65        5 --> 2,2
66        The external interface (constructor, getter and setter) is:
67        0 --> row = 0, col = 0
68        1 --> 0,1
69        2 --> 0,2
70        3 --> 1,0
71        4 --> 1,1
72        5 --> 1,2
73        6 --> 2,0
74        7 --> 2,1
75        8 --> 2,2                                                 */
76     Double_t fCd[3];         // direction cosines
77     Double_t fTpar;          //! parameter 
78     UShort_t fIdPoint[2];    // Identifiers of RecPoints defining the line
79     
80  private:
81     void SetPar(const Double_t par){fTpar = par;}
82
83   ClassDef(AliStrLine,5);
84 };
85
86 #endif