]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliVTrack.cxx
Restoring the generation of HTML documentation (Natalia) + related changes (PH)
[u/mrichter/AliRoot.git] / STEER / AliVTrack.cxx
index f92e2b230c61b1c021b8e7377194157bebec6daf..a4a2617171f6552693ed5bdf08fdfd12f4b178d8 100644 (file)
@@ -19,6 +19,9 @@
 //     Author: A. Dainese
 //-------------------------------------------------------------------------
 
+#include <TGeoGlobalMagField.h>
+
+#include "AliMagF.h"
 #include "AliVTrack.h"
 
 ClassImp(AliVTrack)
@@ -34,3 +37,39 @@ AliVTrack& AliVTrack::operator=(const AliVTrack& vTrack)
   return *this; 
 }
 
+Double_t AliVTrack::GetBz() const 
+{
+  // returns Bz component of the magnetic field (kG)
+  AliMagF* fld = (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
+  if (!fld) return 0.5*kAlmost0Field;
+  double bz;
+  if (fld->IsUniform()) bz = fld->SolenoidField();
+  else {
+    Double_t r[3]; 
+    GetXYZ(r); 
+    bz = fld->GetBz(r);
+  }
+  return TMath::Sign(0.5*kAlmost0Field,bz) + bz;
+}
+
+void AliVTrack::GetBxByBz(Double_t b[3]) const 
+{
+  // returns the Bx, By and Bz components of the magnetic field (kG)
+  AliMagF* fld = (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
+  if (!fld) {
+     b[0] = b[1] = 0.;
+     b[2] = 0.5*kAlmost0Field;
+     return;
+  }
+
+  if (fld->IsUniform()) {
+     b[0] = b[1] = 0.;
+     b[2] = fld->SolenoidField();
+  }  else {
+     Double_t r[3]; GetXYZ(r);
+     fld->Field(r,b);
+  }
+  b[2] = (TMath::Sign(0.5*kAlmost0Field,b[2]) + b[2]);
+  return;
+}
+