LDMX Software
MagneticFieldMap3D.h
Go to the documentation of this file.
1
8#ifndef SIMCORE_MAGNETICFIELDMAP3D_H_
9#define SIMCORE_MAGNETICFIELDMAP3D_H_
10
11// Geant4
12#include "G4MagneticField.hh"
13
14// STL
15#include <vector>
16using std::vector;
17
18namespace simcore {
19
62class MagneticFieldMap3D : public G4MagneticField {
63 public:
70 MagneticFieldMap3D(const char* filename, double xOffset, double yOffset,
71 double zOffset);
72
78 void GetFieldValue(const double point[4], double* bfield) const;
79
80 private:
81 /*
82 * Storage space for the table.
83 */
84 vector<vector<vector<double>>> xField_;
85 vector<vector<vector<double>>> yField_;
86 vector<vector<vector<double>>> zField_;
87
88 /*
89 * The dimensions of the table.
90 */
91 int nx_, ny_, nz_;
92
93 /*
94 * The physical limits of the defined region.
95 */
96 double minx_, maxx_, miny_, maxy_, minz_, maxz_;
97
98 /*
99 * The physical extent of the defined region.
100 */
101 double dx_, dy_, dz_;
102
103 /*
104 * Offsets if field map is not in global coordinates
105 */
106 double xOffset_;
107 double yOffset_;
108 double zOffset_;
109
110 /*
111 * Flags for inverting dimensions.
112 */
113 bool invertX_, invertY_, invertZ_;
114};
115
116} // namespace simcore
117// namespace
118
119#endif
A 3D B-field map defined as a grid of points with associated B-field values.
void GetFieldValue(const double point[4], double *bfield) const
Implementation of primary virtual method from G4MagneticField interface.