Introduction of the Copyright and cvs Log
[u/mrichter/AliRoot.git] / RALICE / Ali4Vector.h
CommitLineData
d88f97cc 1#ifndef ALI4VECTOR_H
2#define ALI4VECTOR_H
3///////////////////////////////////////////////////////////////////////////
4// Class Ali4Vector
5// Handling of Lorentz 4-vectors in various reference frames.
6//
7// This class is meant to serve as a base class for ALICE objects
8// that have Lorentz 4-vector characteristics.
9//
10// All 4-vectors are treated in the contravariant form and the convention
11// for the metric and the 4-vector components is according to the one
12// used in the book "Classical Electrodynamics" by J.D. Jackson.
13//
14// The dotproduct is defined such that p.Dot(p) yields the Lorentz invariant
15// scalar of the 4-vector p (i.e. m**2 in case p is a 4-momentum).
16//
17// Note :
18// ------
19// Vectors (v) and reference frames (f) are specified via
20// SetVector(Float_t* v,TString f) under the following conventions :
21//
22// f="car" ==> 3-vector part of v in Cartesian coordinates (x,y,z)
23// f="sph" ==> 3-vector part of v in Spherical coordinates (r,theta,phi)
24// f="cyl" ==> 3-vector part of v in Cylindrical coordinates (rho,phi,z)
25//
26// All angles are in radians.
27//
28// Example :
29// ---------
30//
31// Ali4Vector a;
32//
33// Float_t v[4]={25,-1,3,7};
34// a.SetVector(v,"car");
35//
36// Float_t vec[4];
37// a.GetVector(vec,"sph");
38//
39// Ali4Vector b;
40// Float_t v2[4]={33,6,-18,2};
41// b.SetVector(v2,"car");
42//
43// Float_t dotpro=a.Dot(b);
44//
45// Float_t x0=16;
46// Ali3Vector x;
47// Float_t vec2[3]={1,2,3};
48// x.SetVector(vec2,"car");
49//
50// Ali4Vector c;
51// c.SetVector(x0,x);
52// c.GetVector(vec,"car");
53// c.Info("cyl");
54// c=a+b;
55// c=a-b;
56// c=a*5;
57//
58//--- NvE 01-apr-1999 UU-SAP Utrecht
59///////////////////////////////////////////////////////////////////////////
60
61#include <iostream.h>
62#include <math.h>
63
64#include "Ali3Vector.h"
65
66class Ali4Vector
67{
68 public:
69 Ali4Vector(); // Default constructor for contravariant vector
70 virtual ~Ali4Vector(); // Destructor
71 virtual void SetVector(Double_t v0,Ali3Vector v); // Store contravariant vector
72 virtual void SetVector(Double_t* v,TString f); // Store contravariant vector v^i in frame f
73 virtual void GetVector(Double_t* v,TString f); // Provide contravariant vector v^i in frame f
74 virtual void SetVector(Float_t* v,TString f); // Store contravariant vector v^i in frame f
75 virtual void GetVector(Float_t* v,TString f); // Provide contravariant vector v^i in frame f
76 Double_t GetScalar(); // Provide the scalar part of v
77 Ali3Vector Get3Vector(); // Provide the 3-vector part of v
78 virtual void Info(TString f="car"); // Print contravariant components in frame f
79 Double_t Dot(Ali4Vector& q); // Provide dot product v^i*q_i
80 Ali4Vector operator+(Ali4Vector& q); // Add contravariant vector q
81 Ali4Vector operator-(Ali4Vector& q); // Subtract contravariant vector q
82 Ali4Vector operator*(Double_t s); // Multiply contravariant vector with scalar s
83 Ali4Vector operator/(Double_t s); // Divide contravariant vector by scalar s
84 Ali4Vector& operator+=(Ali4Vector& q); // Add contravariant vector q
85 Ali4Vector& operator-=(Ali4Vector& q); // Subtract contravariant vector q
86 Ali4Vector& operator*=(Double_t s); // Multiply with scalar s
87 Ali4Vector& operator/=(Double_t s); // Divide by scalar s
88
89 protected:
90 Double_t fV0; // The scalar part
91 Ali3Vector fV; // The 3-vector part
92
93 ClassDef(Ali4Vector,1) // Class definition to enable ROOT I/O
94};
95#endif