Go to the documentation of this file.00001 #ifndef MagneticFieldGrid_H
00002 #define MagneticFieldGrid_H
00003
00020
00021 #include "FWCore/Utilities/interface/Visibility.h"
00022 #include "VectorFieldInterpolation.h"
00023 #include "binary_ifstream.h"
00024
00025
00026 #include <vector>
00027 #include <algorithm>
00028 #include <cmath>
00029 #include <string>
00030 #include <iostream>
00031 #include <fstream>
00032
00033 class dso_internal MagneticFieldGrid{
00034 public:
00035
00036 MagneticFieldGrid(){
00037 GridType = 0;
00038 for (int i=0;i<3; ++i) {NumberOfPoints[i] = 0;};
00039 for (int i=0;i<3; ++i) {ReferencePoint[i] = 0.;};
00040 for (int i=0;i<3; ++i) {BasicDistance0[i] = 0.;};
00041 for (int i=0;i<3; ++i) {for (int j=0;j<3; ++j) {BasicDistance1[i][j] = 0.;};};
00042 for (int i=0;i<3; ++i) {for (int j=0;j<3; ++j) {BasicDistance2[i][j] = 0.;};};
00043 for (int i=0;i<4; ++i) {RParAsFunOfPhi[i] = 0.;};
00044 for (int i=0;i<3; ++i) {EasyCoordinate[i] = false;};
00045 }
00046
00047 ~MagneticFieldGrid(){}
00048
00049 private:
00050
00051 class dso_internal HeaderType3{
00052 public:
00053
00054 HeaderType3(){}
00055
00056 ~HeaderType3(){}
00057 private:
00058 public:
00059 void printInfo();
00060 };
00061
00062 class dso_internal BVector{
00063 public:
00064
00065 BVector(){}
00066
00067 ~BVector(){}
00068 private:
00069
00070 float B3[3];
00071 public:
00072
00073 void putB3(float Bx, float By, float Bz);
00074 float bx();
00075 float by();
00076 float bz();
00077 };
00078
00079
00080
00081 int GridType;
00082
00083 int NumberOfPoints[3];
00084 double ReferencePoint[3];
00085 double BasicDistance0[3];
00086 double BasicDistance1[3][3];
00087 double BasicDistance2[3][3];
00088 double RParAsFunOfPhi[4];
00089 bool EasyCoordinate[3];
00090
00091 std::vector<BVector> FieldValues;
00092
00093 public:
00095 void load(const std::string& name);
00097 int gridType();
00098
00100 void interpolateAtPoint(double X1, double X2, double X3, float &Bx, float &By, float &Bz);
00101
00102
00103 void putCoordGetInd(double X1, double X2, double X3, int &Index1, int &Index2, int &Index3);
00104
00105 void putIndicesGetB(int Index1, int Index2, int Index3, float &Bx, float &By, float &Bz);
00106
00107 void putIndGetCoord(int Index1, int Index2, int Index3, double &X1, double &X2, double &X3);
00108
00109 int lineNumber(int Index1, int Index2, int Index3);
00110 };
00111
00112
00113 #endif