ATLAS Offline Software
Loading...
Searching...
No Matches
VKalVrtBMag.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Create object vkalMagFld which containg magnetic field.
6// It accepts external handlers with magnetic field ( function or object)
7// and takes data from them. If they are absent - default constants
8// ATLAS magnetic field (1.996 tesla) is used
9//
10// Single object myMagFld of vkalMagFld type is created in CFit.cxx
11//-------------------------------------------------------------------------
13
14#include <iostream>
15
17
18namespace {
19constexpr double s_cnstBMAG = 1.997; // Tesla
20}
21
22namespace Trk {
23
24void vkalMagFld::getMagFld(const double X, const double Y, const double Z,
25 double& bx, double& by, double& bz,
26 const VKalVrtControlBase* FitControl = nullptr) {
27 bx = by = 0.;
28 if (FitControl == nullptr || (FitControl->vk_funcMagFld == nullptr &&
29 FitControl->vk_objMagFld == nullptr)) {
30 bz = s_cnstBMAG;
31 return;
32 }
33 if (FitControl->vk_funcMagFld) {
34 FitControl->vk_funcMagFld(X, Y, Z, bx, by, bz);
35 } else if (FitControl->vk_objMagFld) {
36 FitControl->vk_objMagFld->getMagFld(X, Y, Z, bx, by, bz);
37 }
38}
39
41 const double xyz[3], const VKalVrtControlBase* FitControl = nullptr) {
42 double bx = 0., by = 0., bz = 0.;
43 if (FitControl == nullptr || (FitControl->vk_funcMagFld == nullptr &&
44 FitControl->vk_objMagFld == nullptr)) {
45 bz = s_cnstBMAG;
46 return bz;
47 }
48 if (FitControl->vk_funcMagFld) {
49 FitControl->vk_funcMagFld(xyz[0], xyz[1], xyz[2], bx, by, bz);
50 } else if (FitControl->vk_objMagFld) {
51 FitControl->vk_objMagFld->getMagFld(xyz[0], xyz[1], xyz[2], bx, by, bz);
52 }
53 return bz;
54}
55
56} // namespace Trk
57
#define xyz
static void getMagFld(const double, const double, const double, double &, double &, double &, const VKalVrtControlBase *)
Ensure that the ATLAS eigen extensions are properly loaded.