Belle II Software  release-08-01-10
EveVisBField.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 
11 #include <TEveTrackPropagator.h>
12 
13 namespace Belle2 {
19  class EveVisBField : public TEveMagField {
20  public:
21  EveVisBField(): TEveMagField() { }
22  virtual ~EveVisBField() { }
23 
25  virtual TEveVector GetField(Float_t x, Float_t y, Float_t z) const override
26  {
27  TEveVector v;
28  ROOT::Math::XYZVector bfield = BFieldManager::getField(x, y, z) / Unit::T;
29  v.Set(bfield.X(), bfield.Y(), bfield.Z());
30  v.fZ *= -1; //Eve has inverted B field convention
31  v.fZ -= 1e-6; //field must not be zero!
32 
33  return v;
34  }
36  virtual Float_t GetMaxFieldMag() const override { return 1.5; }
37  };
39 }
Provide magnetic field values for TEveTrackPropagator.
Definition: EveVisBField.h:19
virtual Float_t GetMaxFieldMag() const override
maximal field strength (is this correct?)
Definition: EveVisBField.h:36
virtual TEveVector GetField(Float_t x, Float_t y, Float_t z) const override
return field strength at given coordinates, using Eve conventions.
Definition: EveVisBField.h:25
static const double T
[tesla]
Definition: Unit.h:120
static void getField(const double *pos, double *field)
return the magnetic field at a given position.
Definition: BFieldManager.h:91
Abstract base class for different kinds of events.