BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
ExtBesMagneticField.cxx
Go to the documentation of this file.
2
3#include "GaudiKernel/Bootstrap.h"
4#include "GaudiKernel/ISvcLocator.h"
5#include "GaudiKernel/MsgStream.h"
6#include "GaudiKernel/SmartDataPtr.h"
7
8#include "G4FieldManager.hh"
9#include "G4MagneticField.hh"
10#include "globals.hh"
11
12#include "CLHEP/Geometry/Point3D.h"
13#include "CLHEP/Geometry/Vector3D.h"
14#include "CLHEP/Units/PhysicalConstants.h"
15
16#ifndef ENABLE_BACKWARDS_COMPATIBILITY
17typedef HepGeom::Point3D<double> HepPoint3D;
18#endif
19#ifndef ENABLE_BACKWARDS_COMPATIBILITY
20typedef HepGeom::Vector3D<double> HepVector3D;
21#endif
22
23using namespace CLHEP;
24
26 GetFieldManager()->SetDetectorField( this );
27 GetFieldManager()->CreateChordFinder( this );
28 // GetFieldManager()->SetDeltaOneStep(0.5*mm);
29 // GetFieldManager()->SetDeltaIntersection(0.5*mm);
30 ISvcLocator* svcLocator = Gaudi::svcLocator();
31 StatusCode sc = svcLocator->service( "MagneticFieldSvc", m_pIMF );
32 if ( sc != StatusCode::SUCCESS )
33 { G4cout << "Unable to open Magnetic field service" << G4endl; }
34}
35
37
38void ExtBesMagneticField::GetFieldValue( const double Point[3], double* Bfield ) const {
39 double x = Point[0];
40 double y = Point[1];
41 double z = Point[2];
42
43 HepPoint3D r( x, y, z );
45
46 if ( m_pIMF->ifRealField() == true ) m_pIMF->fieldVector( r, b );
47 else m_pIMF->uniFieldVector( r, b );
48
49 Bfield[0] = b.x();
50 Bfield[1] = b.y();
51 Bfield[2] = b.z();
52}
53
54#include "G4TransportationManager.hh"
55
57 return G4TransportationManager::GetTransportationManager()->GetFieldManager();
58}
HepGeom::Vector3D< double > HepVector3D
HepGeom::Point3D< double > HepPoint3D
void GetFieldValue(const double Point[3], double *Bfield) const
G4FieldManager * GetFieldManager()