]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RALICE/AliBoost.cxx
Introduction of the Copyright and cvs Log
[u/mrichter/AliRoot.git] / RALICE / AliBoost.cxx
CommitLineData
4c039060 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/*
17$Log$
18*/
19
d88f97cc 20#include "AliBoost.h"
21
22ClassImp(AliBoost) // Class implementation to enable ROOT I/O
23
24AliBoost::AliBoost()
25{
26// Creation of a Lorentz boost object and initialisation of parameters
27 fGamma=1;
28 fBeta2=0;
29 Double_t a[3]={0,0,0};
30 fBeta.SetVector(a,"sph");
31}
32///////////////////////////////////////////////////////////////////////////
33AliBoost::~AliBoost()
34{
35// Default destructor
36}
37///////////////////////////////////////////////////////////////////////////
38void AliBoost::SetBeta(Ali3Vector b)
39{
40// Setting of boost parameters on basis of beta 3-vector
41 fBeta2=b.Dot(b);
42 fBeta=b;
43
44 if (fBeta2 > 1.)
45 {
46 cout << " *AliBoost::SetBeta* beta > 1." << endl;
47 }
48 Double_t test=1.-fBeta2;
49 fGamma=0;
50 if (test > 0.) fGamma=sqrt(1./test);
51}
52///////////////////////////////////////////////////////////////////////////
53void AliBoost::SetGamma(Double_t g,Ali3Vector v)
54{
55// Setting of boost parameters on basis of gamma and direction 3-vector
56 if (g >= 1.)
57 {
58 fGamma=g;
59 fBeta2=1.-(1./(fGamma*fGamma));
60 fBeta=v*sqrt(fBeta2);
61 }
62 else
63 {
64 cout << " *AliBoost::SetGamma* Invalid input gamma = " << g << endl;
65 }
66}
67///////////////////////////////////////////////////////////////////////////
68void AliBoost::Set4Momentum(Ali4Vector& p)
69{
70// Setting of boost parameters on basis of momentum 4-vector data
71 Double_t E=p.GetScalar();
72 if (E <= 0.)
73 {
74 cout << " *AliBoost::Set4Momentum* Unphysical situation." << endl;
75 p.Info();
76 }
77 else
78 {
79 Ali3Vector b=p.Get3Vector();
80 b=b/E;
81 SetBeta(b);
82 }
83}
84///////////////////////////////////////////////////////////////////////////
85Ali3Vector AliBoost::GetBetaVector()
86{
87// Provide the the beta 3-vector
88 return fBeta;
89}
90///////////////////////////////////////////////////////////////////////////
91Double_t AliBoost::GetBeta()
92{
93// Provide the norm of the beta 3-vector
94 return sqrt(fBeta2);
95}
96///////////////////////////////////////////////////////////////////////////
97Double_t AliBoost::GetGamma()
98{
99// Provide the gamma factor
100 return fGamma;
101}
102///////////////////////////////////////////////////////////////////////////
103void AliBoost::Info(TString f)
104{
105// Printing of the boost parameter info in coordinate frame f
106
107 cout << " *AliBoost::Info* beta = " << sqrt(fBeta2) << " gamma = " << fGamma << endl
108 << " Beta";
109 fBeta.Info(f);
110}
111///////////////////////////////////////////////////////////////////////////
112Ali4Vector AliBoost::Boost(Ali4Vector& v)
113{
114// Perform the Lorentz boost on the 4-vector v
115 if (fBeta2 > 1.e-20)
116 {
117 Double_t E=v.GetScalar();
118 Ali3Vector p=v.Get3Vector();
119 Double_t pdotbeta=p.Dot(fBeta);
120
121 Double_t Eprim;
122 Eprim=fGamma*(E-pdotbeta);
123
124 Ali3Vector term1,term2,pprim;
125 term1=fBeta*((fGamma-1.)*pdotbeta/fBeta2);
126 term2=fBeta*(fGamma*E);
127 pprim=p+term1-term2;
128
129 Ali4Vector w;
130 w.SetVector(Eprim,pprim);
131
132 return w;
133 }
134 else
135 {
136 return v;
137 }
138}
139///////////////////////////////////////////////////////////////////////////
140Ali4Vector AliBoost::Inverse(Ali4Vector& vprim)
141{
142// Perform the inverse Lorentz boost on the 4-vector vprim
143 if (fBeta2 > 1.e-20)
144 {
145 Double_t Eprim=vprim.GetScalar();
146 Ali3Vector pprim=vprim.Get3Vector();
147 Double_t pprimdotbeta=pprim.Dot(fBeta);
148
149 Double_t E;
150 E=fGamma*(Eprim+pprimdotbeta);
151
152 Ali3Vector term1,term2,p;
153 term1=fBeta*((fGamma-1.)*pprimdotbeta/fBeta2);
154 term2=fBeta*(fGamma*Eprim);
155 p=pprim+term1+term2;
156
157 Ali4Vector w;
158 w.SetVector(E,p);
159
160 return w;
161 }
162 else
163 {
164 return vprim;
165 }
166}
167///////////////////////////////////////////////////////////////////////////