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 #include "CLHEP/Vector/ThreeVector.h"
00021 using CLHEP::Hep3Vector;
00022
00023 #ifndef CLHEP_POINT3D_H
00024 #include "CLHEP/Geometry/Point3D.h"
00025 #endif
00026 #ifndef ENABLE_BACKWARDS_COMPATIBILITY
00027 typedef HepGeom::Point3D<double> HepPoint3D;
00028 #endif
00029 using HepGeom::Point3D;
00030
00031
00032
00033
00034
00035 class Bfield {
00036
00037 public:
00039 static Bfield * getBfield(int);
00040
00041 protected:
00043 Bfield(int);
00044
00045
00046 public:
00047
00049 int fieldID(void) const {return _fieldID;}
00050
00052 const Hep3Vector & fieldMap(float x, float y, float z) const;
00053 const Hep3Vector & fieldMap(const HepPoint3D &xyz) const;
00054 void fieldMap(float *position, float *bfield);
00055
00057 float bx(float x, float y, float z) const;
00058 float by(float x, float y, float z) const;
00059 float bz(float x, float y, float z) const;
00060 float bx(const HepPoint3D &xyz) const;
00061 float by(const HepPoint3D &xyz) const;
00062 float bz(const HepPoint3D &xyz) const;
00063
00064 private:
00065 static Bfield *_field[200];
00066 float _Bz[175][399];
00067 float _Br[175][399];
00068 float _Bphi[175][399];
00069 float _BzQR[101][163];
00070 float _BrQR[101][163];
00071 float _BphiQR[101][163];
00072 float _BzQL[17][51][52];
00073 float _BrQL[17][51][52];
00074 float _BphiQL[17][51][52];
00075 int _fieldID;
00076 mutable float m_Bx;
00077 mutable float m_By;
00078 mutable float m_Bz;
00079 mutable float m_x;
00080 mutable float m_y;
00081 mutable float m_z;
00082 mutable Hep3Vector m_Bfld;
00083
00084 private:
00085 void updateCache(float, float, float) const;
00086 };
00087
00088 #endif