ATLAS Offline Software
Loading...
Searching...
No Matches
AtlasBComponent.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "CLHEP/Units/SystemOfUnits.h"
6#include "AtlasBComponent.h"
7
8
9using CLHEP::kilogauss;
10
11
12namespace Genfun {
13 FUNCTION_OBJECT_IMP(AtlasBComponent)
14 // This class is an adaptor:
15
16 // Constructor:
17 AtlasBComponent::AtlasBComponent(unsigned int index, MagField::AtlasFieldCache* fieldCache)
18 : AbsFunction()
19 , m_index(index)
20 , m_fieldCache(fieldCache) {}
21
22 // Destructor:
24
25 // Copy Constructor:
27 : AbsFunction()
28 , m_index(right.m_index)
29 , m_fieldCache(right.m_fieldCache) {}
30
31 // Dimensionality:
32 unsigned int AtlasBComponent::dimensionality() const { return 3;}
33
34 double AtlasBComponent::operator () (double) const { throw "Invalid parameter!"; }
35
36 double AtlasBComponent::operator () (const Argument & a) const {
37 // Changes from doubles to floats and back
38 double XYZ_in_mm[3] , BXYZ_in_kgmm[3];
39 for (int i=0;i<3;++i) *(XYZ_in_mm+i) = a[i];
40 m_fieldCache->getField( XYZ_in_mm , BXYZ_in_kgmm ); // const-violation, see comment in header file
41 return BXYZ_in_kgmm[m_index]*kilogauss;
42 }
43
44}
45
static Double_t a
virtual unsigned int dimensionality() const override
virtual double operator()(double argument) const override
AtlasBComponent(unsigned int index, MagField::AtlasFieldCache *fieldCache)
Local cache for magnetic field (based on MagFieldServices/AtlasFieldSvcTLS.h)
Definition index.py:1