]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliStrLine.h
From Cesar: make selection and two-selection working with the new
[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(Double_t *point, Double_t *cd, Bool_t twopoints=kFALSE, UShort_t id1=65535, UShort_t id2=65535);  // standard constructor
20     AliStrLine(Float_t *pointf, Float_t *cdf, Bool_t twopoints=kFALSE, UShort_t id1=65535, UShort_t id2=65535); 
21     AliStrLine(Double_t *point, Double_t *sig2point, Double_t *cd, Bool_t twopoints=kFALSE, UShort_t id1=65535, UShort_t id2=65535);
22     AliStrLine(Float_t *pointf, Float_t *sig2point, Float_t *cdf, Bool_t twopoints=kFALSE, UShort_t id1=65535, UShort_t id2=65535); 
23     AliStrLine(Double_t *point, Double_t *sig2point, Double_t *wmat, Double_t *cd, Bool_t twopoints=kFALSE, UShort_t id1=65535, UShort_t id2=65535);
24     AliStrLine(Float_t *pointf, Float_t *sig2point, Float_t *wmat, Float_t *cdf, Bool_t twopoints=kFALSE, UShort_t id1=65535, UShort_t id2=65535); 
25     AliStrLine(const AliStrLine& source);
26     AliStrLine& operator=(const AliStrLine& source);
27     virtual ~AliStrLine(); // destructor
28     virtual void Clear(Option_t*){if(fWMatrix)delete[] fWMatrix; fWMatrix = 0;}
29     void PrintStatus() const;
30     void SetP0(const Double_t *point) {for(Int_t i=0;i<3;i++)fP0[i]=point[i];}
31     void SetSigma2P0(const Double_t *sigsq) {for(Int_t i=0;i<3;i++)fSigma2P0[i]=sigsq[i];}
32     void SetWMatrix(const Double_t *wmat);
33     void SetCd(const Double_t *cd) {for(Int_t i=0;i<3;i++)fCd[i]=cd[i];}
34     void SetIdPoints(UShort_t id1, UShort_t id2){
35       fIdPoint[0]=id1;
36       fIdPoint[1]=id2;
37     } 
38
39     void GetP0(Double_t *point) const {for(Int_t i=0;i<3;i++)point[i]=fP0[i];}
40     void GetSigma2P0(Double_t *sigsq) const {for(Int_t i=0;i<3;i++)sigsq[i]=fSigma2P0[i];}
41     void GetWMatrix(Double_t *wmat) const;
42     void GetCd(Double_t *cd) const {for(Int_t i=0;i<3;i++)cd[i]=fCd[i];}
43     void GetCurrentPoint(Double_t *point) const;
44     UShort_t GetIdPoint(Int_t i) const {
45       if(i<2) return fIdPoint[i];
46       AliError("Wrong element: only 2 points are stored in AliStrLine");
47       return 65535;
48     }
49     Int_t IsParallelTo(AliStrLine *line) const;
50     Int_t Crossrphi(AliStrLine *line);
51     Int_t CrossPoints(AliStrLine *line, Double_t *point1, Double_t *point2);
52     Int_t Cross(AliStrLine *line, Double_t *point);
53     Double_t GetDCA(AliStrLine *line) const;
54     Double_t GetDistFromPoint(Double_t *point) const;
55  protected:
56     void InitDirection(Double_t *point, Double_t *cd);
57     void InitTwoPoints(Double_t *pA, Double_t *pB);
58     Double_t fP0[3];           // given point
59     Double_t fSigma2P0[3];           // errors on coordinates of given point
60     Double_t *fWMatrix;           //[6] weighting matrix
61     /* fWMatrix is a symmetric matrix internally stored as
62        0 --> row = 0, col = 0
63        1 --> 0,1
64        2 --> 0,2
65        3 --> 1,1
66        4 --> 1,2
67        5 --> 2,2
68        The external interface (constructor, getter and setter) is:
69        0 --> row = 0, col = 0
70        1 --> 0,1
71        2 --> 0,2
72        3 --> 1,0
73        4 --> 1,1
74        5 --> 1,2
75        6 --> 2,0
76        7 --> 2,1
77        8 --> 2,2                                                 */
78     Double_t fCd[3];         // direction cosines
79     Double_t fTpar;          //! parameter 
80     UShort_t fIdPoint[2];    // Identifiers of RecPoints defining the line
81     
82  private:
83     void SetPar(const Double_t par){fTpar = par;}
84
85   ClassDef(AliStrLine,5);
86 };
87
88 #endif