]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliVTrack.cxx
Cleanup of collisions geometries and headers.
[u/mrichter/AliRoot.git] / STEER / AliVTrack.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2008, 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 //-------------------------------------------------------------------------
18 //     base class for ESD and AOD tracks
19 //     Author: A. Dainese
20 //-------------------------------------------------------------------------
21
22 #include <TGeoGlobalMagField.h>
23
24 #include "AliMagF.h"
25 #include "AliVTrack.h"
26
27 ClassImp(AliVTrack)
28
29 AliVTrack::AliVTrack(const AliVTrack& vTrack) :
30   AliVParticle(vTrack) { } // Copy constructor
31
32 AliVTrack& AliVTrack::operator=(const AliVTrack& vTrack)
33 { if (this!=&vTrack) { 
34     AliVParticle::operator=(vTrack); 
35   }
36   
37   return *this; 
38 }
39
40 Double_t AliVTrack::GetBz() const 
41 {
42   // returns Bz component of the magnetic field (kG)
43   AliMagF* fld = (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
44   if (!fld) return 0.5*kAlmost0Field;
45   double bz;
46   if (fld->IsUniform()) bz = fld->SolenoidField();
47   else {
48     Double_t r[3]; 
49     GetXYZ(r); 
50     bz = fld->GetBz(r);
51   }
52   return TMath::Sign(0.5*kAlmost0Field,bz) + bz;
53 }
54
55 void AliVTrack::GetBxByBz(Double_t b[3]) const 
56 {
57   // returns the Bx, By and Bz components of the magnetic field (kG)
58   AliMagF* fld = (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
59   if (!fld) {
60      b[0] = b[1] = 0.;
61      b[2] = 0.5*kAlmost0Field;
62      return;
63   }
64
65   if (fld->IsUniform()) {
66      b[0] = b[1] = 0.;
67      b[2] = fld->SolenoidField();
68   }  else {
69      Double_t r[3]; GetXYZ(r);
70      fld->Field(r,b);
71   }
72   b[2] = (TMath::Sign(0.5*kAlmost0Field,b[2]) + b[2]);
73   return;
74 }
75