File indexing completed on 2024-04-06 12:22:32
0001 #ifndef MagneticFieldGrid_H
0002 #define MagneticFieldGrid_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include "FWCore/Utilities/interface/Visibility.h"
0021 #include "VectorFieldInterpolation.h"
0022
0023
0024 #include <vector>
0025 #include <algorithm>
0026 #include <cmath>
0027 #include <string>
0028 #include <iostream>
0029 #include <fstream>
0030
0031 class dso_internal MagneticFieldGrid {
0032 public:
0033
0034 MagneticFieldGrid() {
0035 GridType = 0;
0036 for (int i = 0; i < 3; ++i) {
0037 NumberOfPoints[i] = 0;
0038 };
0039 for (int i = 0; i < 3; ++i) {
0040 ReferencePoint[i] = 0.;
0041 };
0042 for (int i = 0; i < 3; ++i) {
0043 BasicDistance0[i] = 0.;
0044 };
0045 for (int i = 0; i < 3; ++i) {
0046 for (int j = 0; j < 3; ++j) {
0047 BasicDistance1[i][j] = 0.;
0048 };
0049 };
0050 for (int i = 0; i < 3; ++i) {
0051 for (int j = 0; j < 3; ++j) {
0052 BasicDistance2[i][j] = 0.;
0053 };
0054 };
0055 for (int i = 0; i < 4; ++i) {
0056 RParAsFunOfPhi[i] = 0.;
0057 };
0058 for (int i = 0; i < 3; ++i) {
0059 EasyCoordinate[i] = false;
0060 };
0061 }
0062
0063 ~MagneticFieldGrid() {}
0064
0065 private:
0066
0067 class dso_internal HeaderType3 {
0068 public:
0069
0070 HeaderType3() {}
0071
0072 ~HeaderType3() {}
0073
0074 private:
0075 public:
0076 void printInfo();
0077 };
0078
0079 class dso_internal BVector {
0080 public:
0081
0082 BVector() {}
0083
0084 ~BVector() {}
0085
0086 private:
0087
0088 float B3[3];
0089
0090 public:
0091
0092 void putB3(float Bx, float By, float Bz);
0093 float bx();
0094 float by();
0095 float bz();
0096 };
0097
0098
0099
0100 int GridType;
0101
0102 int NumberOfPoints[3];
0103 double ReferencePoint[3];
0104 double BasicDistance0[3];
0105 double BasicDistance1[3][3];
0106 double BasicDistance2[3][3];
0107 double RParAsFunOfPhi[4];
0108 bool EasyCoordinate[3];
0109
0110 std::vector<BVector> FieldValues;
0111
0112 public:
0113
0114 void load(const std::string &name);
0115
0116 int gridType();
0117
0118
0119 void interpolateAtPoint(double X1, double X2, double X3, float &Bx, float &By, float &Bz);
0120
0121
0122 void putCoordGetInd(double X1, double X2, double X3, int &Index1, int &Index2, int &Index3);
0123
0124 void putIndicesGetB(int Index1, int Index2, int Index3, float &Bx, float &By, float &Bz);
0125
0126 void putIndGetCoord(int Index1, int Index2, int Index3, double &X1, double &X2, double &X3);
0127
0128 int lineNumber(int Index1, int Index2, int Index3);
0129 };
0130
0131 #endif