ATLAS Offline Software
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 
9 using CLHEP::kilogauss;
10 
11 
12 namespace 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 
Genfun::AtlasBComponent::~AtlasBComponent
virtual ~AtlasBComponent()
Definition: AtlasBComponent.cxx:23
index
Definition: index.py:1
Genfun::AtlasBComponent::AtlasBComponent
AtlasBComponent(unsigned int index, MagField::AtlasFieldCache *fieldCache)
Definition: AtlasBComponent.cxx:17
python.SystemOfUnits.kilogauss
int kilogauss
Definition: SystemOfUnits.py:231
Genfun::AtlasBComponent::dimensionality
virtual unsigned int dimensionality() const override
Definition: AtlasBComponent.cxx:32
lumiFormat.i
int i
Definition: lumiFormat.py:85
Genfun::AtlasBComponent
Definition: AtlasBComponent.h:14
MagField
Local cache for magnetic field (based on MagFieldServices/AtlasFieldSvcTLS.h)
Definition: ForwardRegionFieldSvc.h:27
a
TList * a
Definition: liststreamerinfos.cxx:10
Genfun::AtlasBComponent::operator()
virtual double operator()(double argument) const override
Definition: AtlasBComponent.cxx:34
AtlasBComponent.h
Genfun::AtlasBComponent::m_index
unsigned int m_index
Definition: AtlasBComponent.h:37
Genfun
Definition: AtlasBComponent.cxx:12