Geant4 VMC Version 6.6
Loading...
Searching...
No Matches
TG4MagneticField.cxx
Go to the documentation of this file.
1//------------------------------------------------
2// The Geant4 Virtual Monte Carlo package
3// Copyright (C) 2007 - 2014 Ivana Hrivnacova
4// All rights reserved.
5//
6// For the licensing terms see geant4_vmc/LICENSE.
7// Contact: root-vmc@cern.ch
8//-------------------------------------------------
9
14
15#include "TG4MagneticField.h"
16#include "TG4G3Units.h"
17
18#include <TVirtualMagField.h>
19
20//_____________________________________________________________________________
21TG4MagneticField::TG4MagneticField(TVirtualMagField* magField)
22 : G4MagneticField(), fVirtualMagField(magField)
23{
25}
26
27//_____________________________________________________________________________
32
33//
34// public methods
35//
36
37//_____________________________________________________________________________
39 const G4double point[3], G4double* bfield) const
40{
42
43 // Set units
44 const G4double g3point[3] = { point[0] * TG4G3Units::InverseLength(),
45 point[1] * TG4G3Units::InverseLength(), point[2] * TG4G3Units::InverseLength() };
46
47 // Call user field
48 fVirtualMagField->Field(g3point, bfield);
49
50 // Set units
51 for (G4int i = 0; i < 3; i++) bfield[i] = bfield[i] * TG4G3Units::Field();
52}
Definition of the TG4G3Units class.
Definition of the TG4MagneticField class.
static G4double Field()
Definition TG4G3Units.h:129
static G4double InverseLength()
Definition TG4G3Units.h:135
TVirtualMagField * fVirtualMagField
The associated TGeo magnetic field.
virtual void GetFieldValue(const G4double point[3], G4double *bfield) const
TG4MagneticField(TVirtualMagField *magField)