Fix for #87488 Commit + port request. New methods in AliStrLine
[u/mrichter/AliRoot.git] / STEER / ESD / AliStrLine.h
CommitLineData
edc97986 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
4e1be1bf 13#include "AliLog.h"
edc97986 14
15class AliStrLine : public TObject {
16
b26b5f2c 17public:
edc97986 18 AliStrLine(); // default constructor
b26b5f2c 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
c48f9ca2 23 AliStrLine(const AliStrLine& source);
24 AliStrLine& operator=(const AliStrLine& source);
edc97986 25 virtual ~AliStrLine(); // destructor
c48f9ca2 26 virtual void Clear(Option_t*){if(fWMatrix)delete[] fWMatrix; fWMatrix = 0;}
edc97986 27 void PrintStatus() const;
c48f9ca2 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];}
4e1be1bf 32 void SetIdPoints(UShort_t id1, UShort_t id2){
33 fIdPoint[0]=id1;
34 fIdPoint[1]=id2;
35 }
36
edc97986 37 void GetP0(Double_t *point) const {for(Int_t i=0;i<3;i++)point[i]=fP0[i];}
28dc94e2 38 void GetSigma2P0(Double_t *sigsq) const {for(Int_t i=0;i<3;i++)sigsq[i]=fSigma2P0[i];}
c48f9ca2 39 void GetWMatrix(Double_t *wmat) const;
edc97986 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;
4e1be1bf 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 }
b26b5f2c 47 Int_t IsParallelTo(const AliStrLine *line) const;
48 Int_t Crossrphi(const AliStrLine *line);
edc97986 49 Int_t CrossPoints(AliStrLine *line, Double_t *point1, Double_t *point2);
50 Int_t Cross(AliStrLine *line, Double_t *point);
b26b5f2c 51 Double_t GetDCA(const AliStrLine *line) const;
52 Double_t GetDistFromPoint(const Double_t *point) const;
46aed644 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 for(Int_t i=0;i<3;i++)p[i]=fP0[i]+fCd[i]*t; }
edc97986 56 protected:
b26b5f2c 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);
edc97986 59 Double_t fP0[3]; // given point
28dc94e2 60 Double_t fSigma2P0[3]; // errors on coordinates of given point
c48f9ca2 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 */
4e1be1bf 79 Double_t fCd[3]; // direction cosines
80 Double_t fTpar; //! parameter
81 UShort_t fIdPoint[2]; // Identifiers of RecPoints defining the line
82
edc97986 83 private:
c48f9ca2 84 void SetPar(const Double_t par){fTpar = par;}
edc97986 85
4e1be1bf 86 ClassDef(AliStrLine,5);
edc97986 87};
88
89#endif