9#include <geometry/bfieldmap/BFieldComponentKlm1.h>
11#include <framework/utilities/FileSystem.h>
12#include <framework/logging/Logger.h>
14#include <boost/iostreams/filtering_stream.hpp>
15#include <boost/iostreams/device/file.hpp>
21namespace io = boost::iostreams;
26 B2ERROR(
"The filename for the magnetic field Component is empty !");
33 B2ERROR(
"The magnetic field map file '" <<
m_mapFilename <<
"' could not be found !");
38 io::filtering_istream fieldMapFile;
39 fieldMapFile.push(io::file_source(fullPath));
42 B2DEBUG(10,
"Loading the magnetic field from file '" <<
m_mapFilename <<
"' in to the memory...");
47 fieldMapFile.getline(dummy,
sizeof(dummy));
61 B2ERROR(
"Barrel Parameter file is something wrong ! " << layer <<
" " << l);
65 fieldMapFile.getline(dummy,
sizeof(dummy));
66 fieldMapFile.getline(dummy,
sizeof(dummy));
67 for (
int GapIron = 0; GapIron < 2; GapIron++) {
69 for (
int j = 0; j < 5; j++) {
71 fieldMapFile >> g >> l >> jj
77 if (GapIron != g || layer != l || jj != j)
78 B2ERROR(
"Endcap Parameter file is something wrong ! " << g <<
" " << l <<
" " << jj);
83 B2DEBUG(10,
"... loaded ");
90 double r = point.Rho();
94 double absZ = std::abs(z);
96 ROOT::Math::XYZVector bField(0., 0., 0.);
104 double cosphi = std::abs(x) / r;
106 : (std::abs(x) + std::abs(y)) *
m_cospi4)
110 int layer =
static_cast<int>(floor(d /
m_dLayer));
122 if (z < 0.0) { br = -br; }
123 bField.SetXYZ(br * x / r, br * y / r,
137 int layer =
static_cast<int>(floor(dz /
m_dLayer));
143 for (
int j = 0; j < 5; j++) {
146 if (z < 0.0) { br = -br; }
147 bField.SetX(br * x / r);
148 bField.SetY(br * y / r);
152 for (
int j = 0; j < 5; j++) {
double m_endcapFieldZSlope[2][15][5]
Slopes of the linear approximation of Bz in the endcap.
double m_endcapGapHeight
Gap height of BKLM layer1-14.
double m_barrelFieldRIntercept1[15]
Intercept of Br before the beackpoint in the barrel.
int m_nBarrelLayers
The number of layers per 1 sector for BKLM.
virtual void initialize() override
Initializes the magnetic field Component.
double m_barrelFieldZSlope1[15]
Slope of Bz before the breakpoint in the barrel.
double m_endcapFieldRIntercept[2][15][5]
Intercepts of the linear approximation of Br in the endcap.
double m_barrelZMax
The maximum boundaries of BKLM region in r.
double m_barrelIronThickness
Thickness of Barrel iron plate.
double m_barrelFieldZIntercept1[15]
Intercept of Bz before the beackpoint in the barrel.
std::string m_mapFilename
The filename of the magnetic field map.
virtual void terminate() override
Terminates the magnetic field Component.
double m_mapOffset
Offset required because the accelerator group defines the Belle center as zero.
double m_cos3pi8
cos(3pi/8)
double m_endcapRMin
The minimum boundaries of EKLM region in r.
virtual ROOT::Math::XYZVector calculate(const ROOT::Math::XYZVector &point) const override
Calculates the magnetic field vector at the specified space point.
double m_barrelFieldRSlope2[15]
Slope of Br after the breakpoint in the barrel.
double m_endcapRBreakpoint[2][15][5]
r position of breakpoints between linear functions in the endcap First index indicates whether or not...
double m_barrelRBreakpoint[15]
z position of breakpoints between the two linear approximations of Br in the barrel.
double m_barrelGapHeightLayer0
Gap height of BKLM layer0.
double m_barrelRMin
The minimum boundaries of BKLM region in r.
double m_endcapFieldRSlope[2][15][5]
Slopes of the linear approximation of Br in the endcap.
int m_nEndcapLayers
The number of layers per 1 sector for EKLM.
double m_barrelFieldZIntercept2[15]
Intercept of Bz after the breakpoint in the barrel.
double m_barrelZBreakpoint[15]
z position of breakpoints between the two linear approximations of Bz in the barrel.
double m_barrelFieldZSlope2[15]
Slope of Bz after the breakpoint in the barrel.
double m_barrelFieldRSlope1[15]
Slope of Br before the breakpoint in the barrel.
double m_endcapZBreakpoint[2][15][5]
z position of breakpoints between linear functions in the endcap.
double m_endcapFieldZIntercept[2][15][5]
Intercepts of the linear approximation of Bz in the endcap.
double m_endcapZMin
The minimum boundaries of EKLM region in z.
double m_barrelFieldRIntercept2[15]
Intercept of Br after the beackpoint in the barrel.
double m_dLayer
depth of BKLM module?
static std::string findFile(const std::string &path, bool silent=false)
Search for given file or directory in local or central release directory, and return absolute path if...
static bool fileExists(const std::string &filename)
Check if the file with given filename exists.
Abstract base class for different kinds of events.