CbmRoot
LitFieldRegion.h
Go to the documentation of this file.
1
8
#ifndef LITFIELDREGION_H_
9
#define LITFIELDREGION_H_
10
11
#include "
LitMath.h
"
12
13
namespace
lit
{
14
namespace
parallel {
15
25
template
<
class
T>
26
class
LitFieldRegion
{
27
public
:
40
void
Set
(
const
LitFieldValue<T>
& B0,
41
const
T B0z,
42
const
LitFieldValue<T>
& B1,
43
const
T B1z,
44
const
LitFieldValue<T>
& B2,
45
const
T B2z) {
46
z0
= B0z;
47
T dz1 = B1z - B0z, dz2 = B2z - B0z;
48
T det =
rcp
(T(dz1 * dz2 * (dz2 - dz1)));
49
T w21 = -dz2 * det;
50
T w22 = dz1 * det;
51
T w11 = -dz2 * w21;
52
T w12 = -dz1 * w22;
53
54
T dB1 = B1.
Bx
- B0.
Bx
;
55
T dB2 = B2.
Bx
- B0.
Bx
;
56
cx0
= B0.
Bx
;
57
cx1
= dB1 * w11 + dB2 * w12;
58
cx2
= dB1 * w21 + dB2 * w22;
59
60
dB1 = B1.
By
- B0.
By
;
61
dB2 = B2.
By
- B0.
By
;
62
cy0
= B0.
By
;
63
cy1
= dB1 * w11 + dB2 * w12;
64
cy2
= dB1 * w21 + dB2 * w22;
65
66
dB1 = B1.
Bz
- B0.
Bz
;
67
dB2 = B2.
Bz
- B0.
Bz
;
68
cz0
= B0.
Bz
;
69
cz1
= dB1 * w11 + dB2 * w12;
70
cz2
= dB1 * w21 + dB2 * w22;
71
}
72
83
void
Set
(
const
LitFieldValue<T>
& B0,
84
const
T B0z,
85
const
LitFieldValue<T>
& B1,
86
const
T B1z) {
87
z0
= B0z;
88
T dzi =
rcp
(T(B1z - B0z));
89
cx0
= B0.
Bx
;
90
cy0
= B0.
By
;
91
cz0
= B0.
Bz
;
92
cx1
= (B1.
Bx
- B0.
Bx
) * dzi;
93
cy1
= (B1.
By
- B0.
By
) * dzi;
94
cz1
= (B1.
Bz
- B0.
Bz
) * dzi;
95
cx2
=
cy2
=
cz2
= 0;
96
}
97
101
void
Shift
(T z) {
102
T dz = z -
z0
;
103
T cx2dz =
cx2
* dz;
104
T cy2dz =
cy2
* dz;
105
T cz2dz =
cz2
* dz;
106
z0
= z[0];
107
cx0
+= (
cx1
+ cx2dz) * dz;
108
cy0
+= (
cy1
+ cy2dz) * dz;
109
cz0
+= (
cz1
+ cz2dz) * dz;
110
cx1
+= cx2dz + cx2dz;
111
cy1
+= cy2dz + cy2dz;
112
cz1
+= cz2dz + cz2dz;
113
}
114
121
void
GetFieldValue
(
const
T& z,
LitFieldValue<T>
& B)
const
{
122
T dz = z -
z0
;
123
T dzdz = dz * dz;
124
B.
Bx
=
cx0
+
cx1
* dz +
cx2
* dzdz;
125
B.
By
=
cy0
+
cy1
* dz +
cy2
* dzdz;
126
B.
Bz
=
cz0
+
cz1
* dz +
cz2
* dzdz;
127
}
128
129
private
:
130
T
cx0
,
cx1
,
cx2
;
// Bx(z) = cx0 + cx1*(z-z0) + cx2*(z-z0)^2
131
T
cy0
,
cy1
,
cy2
;
// By(z) = cy0 + cy1*(z-z0) + cy2*(z-z0)^2
132
T
cz0
,
cz1
,
cz2
;
// Bz(z) = cz0 + cz1*(z-z0) + cz2*(z-z0)^2
133
T
z0
;
134
}
_fvecalignment
;
135
136
}
// namespace parallel
137
}
// namespace lit
138
139
#endif
/* LITFIELDREGION_H_ */
LitMath.h
Useful math functions.
lit::parallel::LitFieldRegion::cz2
T cz2
Definition:
LitFieldRegion.h:132
lit::parallel::LitFieldRegion::cx2
T cx2
Definition:
LitFieldRegion.h:130
lit::parallel::LitFieldRegion::Shift
void Shift(T z)
Definition:
LitFieldRegion.h:101
lit::parallel::_fvecalignment
class lit::parallel::LitDetectorLayout _fvecalignment
lit::parallel::LitFieldRegion::cy2
T cy2
Definition:
LitFieldRegion.h:131
lit::parallel::LitFieldValue::Bx
T Bx
Definition:
LitFieldValue.h:57
lit::parallel::LitFieldRegion::cx1
T cx1
Definition:
LitFieldRegion.h:130
lit::parallel::LitFieldRegion
Storage for field approximation along Z.
Definition:
LitFieldRegion.h:26
lit::parallel::LitFieldValue
Magnetic field value at a certain point in the space.
Definition:
LitFieldValue.h:29
lit::parallel::LitFieldRegion::z0
T z0
Definition:
LitFieldRegion.h:133
lit::parallel::LitFieldRegion::cy0
T cy0
Definition:
LitFieldRegion.h:131
lit::parallel::LitFieldRegion::cz1
T cz1
Definition:
LitFieldRegion.h:132
lit::parallel::LitFieldRegion::Set
void Set(const LitFieldValue< T > &B0, const T B0z, const LitFieldValue< T > &B1, const T B1z, const LitFieldValue< T > &B2, const T B2z)
Sets field region using three field values.
Definition:
LitFieldRegion.h:40
lit::parallel::LitFieldValue::By
T By
Definition:
LitFieldValue.h:57
lit::parallel::LitFieldRegion::cx0
T cx0
Definition:
LitFieldRegion.h:130
lit::parallel::LitFieldRegion::Set
void Set(const LitFieldValue< T > &B0, const T B0z, const LitFieldValue< T > &B1, const T B1z)
Sets field region using two field values.
Definition:
LitFieldRegion.h:83
lit::parallel::rcp
fscal rcp(const fscal &a)
Returns reciprocal.
Definition:
LitMath.h:26
lit::parallel::LitFieldRegion::cz0
T cz0
Definition:
LitFieldRegion.h:132
lit::parallel::LitFieldRegion::GetFieldValue
void GetFieldValue(const T &z, LitFieldValue< T > &B) const
Returns field value at a certain Z position.
Definition:
LitFieldRegion.h:121
lit::parallel::LitFieldValue::Bz
T Bz
Definition:
LitFieldValue.h:57
lit::parallel::LitFieldRegion::cy1
T cy1
Definition:
LitFieldRegion.h:131
lit
Definition:
LitTrackFinderNNVecElectron.h:19
reco
littrack
parallel
LitFieldRegion.h
Generated on Wed Oct 28 2020 15:11:49 for CbmRoot by
1.8.18