]>
Commit | Line | Data |
---|---|---|
d88f97cc | 1 | #ifndef ALI3VECTOR_H |
2 | #define ALI3VECTOR_H | |
3 | /////////////////////////////////////////////////////////////////////////// | |
4 | // Class Ali3Vector | |
5 | // Handling of 3-vectors in various reference frames. | |
6 | // | |
7 | // This class is meant to serve as a base class for ALICE objects | |
8 | // that have 3-dimensional vector characteristics. | |
9 | // | |
10 | // Note : | |
11 | // ------ | |
12 | // Vectors (v) and reference frames (f) are specified via | |
13 | // SetVector(Float_t* v,TString f) under the following conventions : | |
14 | // | |
15 | // f="car" ==> v in Cartesian coordinates (x,y,z) | |
16 | // f="sph" ==> v in Spherical coordinates (r,theta,phi) | |
17 | // f="cyl" ==> v in Cylindrical coordinates (rho,phi,z) | |
18 | // | |
19 | // All angles are in radians. | |
20 | // | |
21 | // Example : | |
22 | // --------- | |
23 | // | |
24 | // Ali3Vector a; | |
25 | // Float_t v[3]={-1,25,7}; | |
26 | // a.SetVector(v,"car"); | |
27 | // a.Info(); | |
28 | // | |
29 | // Float_t vec[3]; | |
30 | // a.GetVector(vec,"sph"); | |
31 | // | |
32 | // Ali3Vector b; | |
33 | // Float_t v2[3]={6,-18,33}; | |
34 | // b.SetVector(v2,"car"); | |
35 | // | |
36 | // Float_t dotpro=a.Dot(b); | |
37 | // | |
38 | // Ali3Vector c=a.Cross(b); | |
39 | // c.Info("sph"); | |
40 | // c.GetVector(vec,"cyl"); | |
41 | // Float_t norm=c.GetNorm(); | |
42 | // c=a+b; | |
43 | // c=a-b; | |
44 | // c=a*5; | |
45 | // | |
46 | //--- NvE 30-mar-1999 UU-SAP Utrecht | |
47 | /////////////////////////////////////////////////////////////////////////// | |
48 | ||
49 | #include <iostream.h> | |
50 | #include <math.h> | |
51 | ||
52 | #include "TObject.h" | |
53 | #include "TString.h" | |
54 | ||
55 | class Ali3Vector | |
56 | { | |
57 | public: | |
58 | Ali3Vector(); // Default constructor | |
59 | virtual ~Ali3Vector(); // Destructor | |
60 | virtual void SetVector(Double_t* v,TString f); // Store vector v in frame f | |
61 | virtual void GetVector(Double_t* v,TString f); // Provide vector v in frame f | |
62 | virtual void SetVector(Float_t* v,TString f); // Store vector v in frame f | |
63 | virtual void GetVector(Float_t* v,TString f); // Provide vector v in frame f | |
64 | virtual void Info(TString f="car"); // Print vector components in frame f | |
65 | Double_t GetNorm(); // Provide norm of the vector | |
66 | Double_t Dot(Ali3Vector& q); // Provide dot product with q | |
67 | Ali3Vector Cross(Ali3Vector& q); // Provide cross product with q | |
68 | Ali3Vector operator+(Ali3Vector& q); // Add vector q | |
69 | Ali3Vector operator-(Ali3Vector& q); // Subtract vector q | |
70 | Ali3Vector operator*(Double_t s); // Multiply vector with scalar s | |
71 | Ali3Vector operator/(Double_t s); // Divide vector by scalar s | |
72 | Ali3Vector& operator+=(Ali3Vector& q); // Add vector q | |
73 | Ali3Vector& operator-=(Ali3Vector& q); // Subtract vector q | |
74 | Ali3Vector& operator*=(Double_t s); // Multiply with scalar s | |
75 | Ali3Vector& operator/=(Double_t s); // Divide by scalar s | |
76 | ||
77 | protected: | |
78 | Double_t fV,fTheta,fPhi; // Vector in spherical coordinates | |
79 | ||
80 | ClassDef(Ali3Vector,1) // Class definition to enable ROOT I/O | |
81 | }; | |
82 | #endif |