Belle II Software development
GFGeant4Field.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#pragma once
9#include <framework/geometry/BFieldManager.h>
10#include <framework/geometry/B2Vector3.h>
11#include <framework/gearbox/Unit.h>
12#include <genfit/AbsBField.h>
13
16class GFGeant4Field : public genfit::AbsBField {
17public:
24 GFGeant4Field(): genfit::AbsBField() {}
25
31 TVector3 get(const TVector3& position) const override
32 {
33 static double conversion{1. / Belle2::Unit::kGauss};
34 return Belle2::B2Vector3D(Belle2::BFieldManager::getField(ROOT::Math::XYZVector(position)) * conversion);
35 }
36};
37
static const double kGauss
[kilogauss]
Definition: Unit.h:123
Interface of the Belle II B-field with GenFit.
Definition: GFGeant4Field.h:16
TVector3 get(const TVector3 &position) const override
Getter for the magnetic field.
Definition: GFGeant4Field.h:31
GFGeant4Field()
Constructor.
Definition: GFGeant4Field.h:24
B2Vector3< double > B2Vector3D
typedef for common usage with double
Definition: B2Vector3.h:516
static void getField(const double *pos, double *field)
return the magnetic field at a given position.
Definition: BFieldManager.h:91