00001 //-------------------------------------------------------------------------- 00002 // File and Version Information: 00003 // $Id: BField.cxx,v 1.2 2008/09/17 08:30:39 zhangy Exp $ 00004 // 00005 // Description: 00006 // Class BField; encapsulates the magnetic field. 00007 // 00008 // See header for more info. 00009 // 00010 // Environment: 00011 // Software developed for the BESIII Detector at BEPCII 00012 // 00013 // Author List: 00014 // Bob Jacobsen Original Author 00015 // Zhang Yao Only keep nominal field 00016 // 00017 // Copyright Information: 00018 // Copyright (C) 1995 Lawrence Berkeley Laboratory 00019 // 00020 //------------------------------------------------------------------------ 00021 00022 //----------------------- 00023 // This Class's Header -- 00024 //----------------------- 00025 #include <iostream> 00026 #include "BField/BField.h" 00027 #include "MdcGeom/Constants.h" 00028 00029 const double BField::cmTeslaToGeVc = Constants::c/1.0E13; 00030 const double BField::gaussToTesla = 1000.; 00031 00032 //constructor 00033 BField::BField(IMagneticFieldSvc* magSvc) 00034 00035 { m_pIMF = magSvc;} 00036 00037 // destroy 00038 BField::~BField() {} 00039 00040 // field z of nominal field 00041 double 00042 BField::bFieldZ() const 00043 { 00044 return m_pIMF->getReferField()*gaussToTesla; 00045 } 00046 00047 void BField::print()const 00048 { 00049 std::cout << "Default constant field" << std::endl; 00050 std::cout << "nominal Field: " << bFieldNominal() << std::endl; 00051 } 00052 00053 double 00054 BField::bFieldNominal()const 00055 { 00056 return bFieldZ(); 00057 }