Belle II Software light-2406-ragdoll
BFieldComponentQuad.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <geometry/bfieldmap/BFieldComponentAbs.h>
12
13#include <string>
14#include <vector>
15
16namespace Belle2 {
36
37 public:
39 struct range_t {
40 double r0;
41 double r1;
42 };
44 typedef std::vector<range_t> ranges_t;
45
47 struct ApertPoint {
48 double s{0};
49 double r{0};
50 };
51
54 struct ParamPoint3 {
55 double s{0};
56 double L{0};
57 double mxx{0};
58 double mxy{0};
59 double mx0{0};
60 double myx{0};
61 double myy{0};
62 double my0{0};
71 inline double getBx(double x, double y) const {return x * mxx + y * mxy + mx0;}
80 inline double getBy(double x, double y) const {return x * myx + y * myy + my0;}
81
89 {
90 mxx += t.mxx;
91 mxy += t.mxy;
92 mx0 += t.mx0;
93 myx += t.myx;
94 myy += t.myy;
95 my0 += t.my0;
96 return *this;
97 }
98 };
99
101 struct irange_t {
102 short int i0{0};
103 short int i1{0};
104 };
105
108
110 virtual ~BFieldComponentQuad() = default;
111
116 virtual void initialize() override;
117
124 virtual ROOT::Math::XYZVector calculate(const ROOT::Math::XYZVector& point) const override;
125
131 double getApertureHER(double s) const;
132
138 double getApertureLER(double s) const;
139
146 void setMapFilename(const std::string& filenameHER, const std::string& filenameLER, const std::string& filenameHERleak) { m_mapFilenameHER = filenameHER; m_mapFilenameLER = filenameLER; m_mapFilenameHERleak = filenameHERleak; }
147
153 void setApertFilename(const std::string& filenameHER, const std::string& filenameLER) { m_apertFilenameHER = filenameHER; m_apertFilenameLER = filenameLER; }
154
161 void setMapSize(int sizeHER, int sizeLER, int sizeHERleak) { m_mapSizeHER = sizeHER; m_mapSizeLER = sizeLER; m_mapSizeHERleak = sizeHERleak;}
162
168 void setApertSize(int sizeHER, int sizeLER) { m_apertSizeHER = sizeHER; m_apertSizeLER = sizeLER; }
169
170 private:
177 inline int getRange(double a, const ranges_t& b) const;
178
185 inline double getAperture(double s, std::vector<ApertPoint>::const_iterator hint) const;
186
188 std::string m_mapFilenameHER{""};
190 std::string m_mapFilenameLER{""};
192 std::string m_mapFilenameHERleak{""};
194 std::string m_apertFilenameHER{""};
196 std::string m_apertFilenameLER{""};
208 double m_maxr2{0};
209
214 std::vector<ApertPoint> m_ah;
216 std::vector<ApertPoint> m_al;
217
219 std::vector<ParamPoint3> m_h3;
221 std::vector<ParamPoint3 >m_l3;
222
224 std::vector<std::vector<ParamPoint3>::const_iterator> m_offset_pp_her;
226 std::vector<std::vector<ParamPoint3>::const_iterator> m_offset_pp_ler;
228 std::vector<std::vector<ApertPoint>::const_iterator> m_offset_ap_her;
230 std::vector<std::vector<ApertPoint>::const_iterator> m_offset_ap_ler;
231 };
232
234} //end of namespace Belle2
The BFieldComponentAbs class.
The BFieldComponentQuad class.
void setApertFilename(const std::string &filenameHER, const std::string &filenameLER)
Sets the filename of aperture definition file.
int getRange(double a, const ranges_t &b) const
Search for range occupied by optics since now only for ranges are present use linear search.
int m_mapSizeHER
The size of the map for HER.
double getApertureLER(double s) const
Returns the LER beam pipe aperture at given position.
int m_mapSizeHERleak
The size of the map.
double m_maxr2
The square of maximal aperture for fast rejection.
virtual void initialize() override
Initializes the magnetic field component.
std::vector< ApertPoint > m_al
The the aperture parameters for LER.
std::vector< ApertPoint > m_ah
The the aperture parameters for HER.
void setMapFilename(const std::string &filenameHER, const std::string &filenameLER, const std::string &filenameHERleak)
Sets the filename of the magnetic field map.
int m_mapSizeLER
The size of the map for LER.
std::vector< std::vector< ApertPoint >::const_iterator > m_offset_ap_ler
The vector of pointer to accelerate search in aperture for ler.
std::string m_mapFilenameLER
Magnetic field map of LER
void setApertSize(int sizeHER, int sizeLER)
Sets the size of the aperture map.
std::string m_mapFilenameHERleak
The filename of the magnetic field map.
void setMapSize(int sizeHER, int sizeLER, int sizeHERleak)
Sets the size of the magnetic field map.
virtual ROOT::Math::XYZVector calculate(const ROOT::Math::XYZVector &point) const override
Calculates the magnetic field vector at the specified space point.
std::vector< std::vector< ParamPoint3 >::const_iterator > m_offset_pp_her
The vector of pointer to accelerate search in maps for her.
ranges_t m_ranges_her
ranges vector for HER
virtual ~BFieldComponentQuad()=default
The BFieldComponentQuad destructor.
std::vector< ParamPoint3 > m_h3
The map for HER.
double getAperture(double s, std::vector< ApertPoint >::const_iterator hint) const
Returns the beam pipe aperture at given position.
std::vector< std::vector< ApertPoint >::const_iterator > m_offset_ap_her
The vector of pointer to accelerate search in aperture for her.
std::vector< ParamPoint3 > m_l3
The map for LER.
std::string m_mapFilenameHER
Magnetic field map of HER
double getApertureHER(double s) const
Returns the HER beam pipe aperture at given position.
std::vector< std::vector< ParamPoint3 >::const_iterator > m_offset_pp_ler
The vector of pointer to accelerate search in maps for ler.
int m_apertSizeHER
The size of the aperture for HER.
std::vector< range_t > ranges_t
vector of Range data structure.
ranges_t m_ranges_ler
ranges vector for LER
BFieldComponentQuad()=default
The BFieldComponentQuad constructor.
std::string m_apertFilenameHER
Filename of the aperture for HER.
int m_apertSizeLER
The size of the aperture for LER.
std::string m_apertFilenameLER
The filename of the aperture for LER.
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24
double s
length along beamline in [cm]
Quadrupole lense data structure.
double myx
yx coefficents to calculate By
double mxx
xx coefficents to calculate Bx
double getBx(double x, double y) const
Calculates the X component of the magnetic field vector at the specified space point from a quadrupol...
ParamPoint3 & operator+=(const ParamPoint3 &t)
Sum up the matrix components of quadrupole lenses.
double mx0
x0 coefficents to calculate Bx
double getBy(double x, double y) const
Calculates the Y component of the magnetic field vector at the specified space point from a quadrupol...
double mxy
xy coefficents to calculate Bx
double my0
y0 coefficents to calculate By
double myy
yy coefficents to calculate By
start and stop indicies to narrow search in array