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