4#include "GaudiKernel/MsgStream.h"
5#include "GaudiKernel/ISvcLocator.h"
6#include "GaudiKernel/IDataProviderSvc.h"
7#include "GaudiKernel/Bootstrap.h"
11#include "CLHEP/Geometry/Vector3D.h"
12#ifndef ENABLE_BACKWARDS_COMPATIBILITY
18const double VertexFitBField::alpha = -0.00299792458;
22VertexFitBField::VertexFitBField() {
24 ISvcLocator* svcLocator = Gaudi::svcLocator();
26 StatusCode sc = svcLocator->service(
"MagneticFieldSvc",m_pIMF);
27 assert(m_pIMF != NULL);
28 if (sc != StatusCode::SUCCESS) {
29 std::cout <<
"ERROR : Unable to open Magnetic field service" << std::endl;
33 m_pIMF = MagneticFieldSvc::instance();
34 assert( m_pIMF != 0 );
35 if( (m_pIMF->GetPath()).empty() ) {
36 cout <<
" VertexFitBField::ERROR "
37 "You MUST set path to directory with magnetic fields tables" << endl;
40 if( !m_pIMF->initialize() ) {
41 cout <<
"ERROR : Can not initialize MagneticField. Stop." << endl;
50 double radius = sqrt(vtx.x()*vtx.x() + vtx.y()*vtx.y());
51 if (radius < 150 &&
abs(vtx.z()) < 150) {
53 return 1000 * vector.z();
65 HepPoint3D TrkPosition(trackPosition[0], trackPosition[1], trackPosition[2]);
69 double radius = sqrt(vtx[0]*vtx[0] + vtx[1]*vtx[1]);
70 if (radius < 150 &&
abs(vtx[2]) < 150) {
73 return 1000 * alpha * (vector_vtx.z() + vector_trk.z())/2;
HepGeom::Vector3D< double > HepVector3D
double abs(const EvtComplex &c)
virtual StatusCode fieldVector(const HepGeom::Point3D< double > &xyz, HepGeom::Vector3D< double > &fvec) const =0
virtual double getReferField()=0
double getCBz(const HepVector &vtx, const HepVector &trackPosition)
double getBFieldZ(const HepPoint3D &vtx)