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