00001
00002
00003
00004
00005 #include "G4ElectroMagneticField.hh"
00006 #include "globals.hh"
00007 #include "G4RotationMatrix.hh"
00008 #include "BDSField.hh"
00009 #include <vector>
00010
00011 #ifndef BDSXYMagField_h
00012 #define BDSXYMagField_h
00013
00014
00015
00016 struct XYFieldRecord {
00017 G4double x;
00018 G4double y;
00019 G4double Bx;
00020 G4double By;
00021 G4double Bz;
00022 };
00023
00024 class BDSXYMagField : public BDSField
00025 {
00026 public:
00027
00028
00029
00030 BDSXYMagField(G4String fname);
00031
00032 ~BDSXYMagField();
00033
00034 G4bool DoesFieldChangeEnergy() const;
00035
00036 void GetFieldValue(const G4double Point[4],G4double *Bfield ) const;
00037
00038
00039
00040
00041
00042 G4int AllocateMesh(G4int nX, G4int nY);
00043
00044 G4int ReadFile(G4String fname);
00045
00046 void Prepare(G4VPhysicalVolume *referenceVolume);
00047
00048 void SetBx(G4int i,G4int j,G4double val);
00049 void SetBy(G4int i,G4int j,G4double val);
00050 void SetBz(G4int i,G4int j,G4double val);
00051
00052 G4double GetBx(G4int i,G4int j);
00053 G4double GetBy(G4int i,G4int j);
00054 G4double GetBz(G4int i,G4int j);
00055
00056 private:
00057
00058 G4double **Bx, **By, **Bz;
00059
00060 std::vector<struct XYFieldRecord> itsFieldValues;
00061
00062 public:
00063 G4double xHalf, yHalf;
00064
00065 G4int nX, nY;
00066
00067 G4String itsFileName;
00068
00069 };
00070
00071
00072 #endif