00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #if !defined(BFIELD_H)
00018 #define BFIELD_H
00019
00020
00021
00022 #include "CLHEP/Matrix/Vector.h"
00023 #include "CLHEP/Matrix/Matrix.h"
00024 #include "CLHEP/Matrix/SymMatrix.h"
00025 #include "CLHEP/Vector/ThreeVector.h"
00026 #include "CLHEP/Geometry/Point3D.h"
00027 #ifndef ENABLE_BACKWARDS_COMPATIBILITY
00028 typedef HepGeom::Point3D<double> HepPoint3D;
00029 #endif
00030
00031 using CLHEP::HepVector;
00032 using CLHEP::Hep3Vector;
00033 using CLHEP::HepMatrix;
00034 using CLHEP::HepSymMatrix;
00035
00036 using namespace CLHEP;
00037
00038
00039
00040
00041
00042
00043 class Bfield {
00044
00045 public:
00047 static Bfield * getBfield(int);
00048
00049 protected:
00051 Bfield(int);
00052 virtual ~Bfield(void) {};
00053
00054 public:
00055
00057 int fieldID(void) const {return _fieldID;}
00058
00060 const Hep3Vector & fieldMap(double x, double y, double z) const;
00061 const Hep3Vector & fieldMap(const HepPoint3D &xyz) const;
00062 void fieldMap(double *position, double *bfield);
00063
00065 double bx(double x, double y, double z) const;
00066 double by(double x, double y, double z) const;
00067 double bz(double x, double y, double z) const;
00068 double bx(const HepPoint3D &xyz) const;
00069 double by(const HepPoint3D &xyz) const;
00070 double bz(const HepPoint3D &xyz) const;
00071
00072 private:
00073 static Bfield *_field[200];
00074 double _Bz[175][399];
00075 double _Br[175][399];
00076 double _Bphi[175][399];
00077 double _BzQR[101][163];
00078 double _BrQR[101][163];
00079 double _BphiQR[101][163];
00080 double _BzQL[17][51][52];
00081 double _BrQL[17][51][52];
00082 double _BphiQL[17][51][52];
00083 int _fieldID;
00084 mutable double m_Bx;
00085 mutable double m_By;
00086 mutable double m_Bz;
00087 mutable double m_x;
00088 mutable double m_y;
00089 mutable double m_z;
00090 mutable Hep3Vector m_Bfld;
00091
00092 private:
00093 void updateCache(double, double, double) const;
00094 };
00095
00096 #endif