CbmRoot
Loading...
Searching...
No Matches
CbmFieldMapSym3.cxx
Go to the documentation of this file.
1
/* Copyright (C) 2004-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2
SPDX-License-Identifier: GPL-3.0-only
3
Authors: Mohammad Al-Turany, Denis Bertini [committer] */
4
5
// -------------------------------------------------------------------------
6
// ----- CbmFieldMapSym3 source file -----
7
// ----- Created 12/01/04 by M. Al/Turany (CbmField.cxx) -----
8
// ----- Redesign 13/02/06 by V. Friese -----
9
// -------------------------------------------------------------------------
10
#include "
CbmFieldMapSym3.h
"
11
12
#include <TArrayF.h>
// for TArrayF
13
14
// ------------- Default constructor ----------------------------------
15
CbmFieldMapSym3::CbmFieldMapSym3
() :
CbmFieldMap
(), fHemiX(0.), fHemiY(0.), fHemiZ(0.) { fType = 3; }
16
// ------------------------------------------------------------------------
17
18
19
// ------------- Standard constructor ---------------------------------
20
CbmFieldMapSym3::CbmFieldMapSym3
(
const
char
* mapName,
const
char
* fileType)
21
:
CbmFieldMap
(mapName, fileType)
22
, fHemiX(0.)
23
, fHemiY(0.)
24
, fHemiZ(0.)
25
{
26
fType = 3;
27
}
28
// ------------------------------------------------------------------------
29
30
31
// ------------- Constructor from CbmFieldPar -------------------------
32
CbmFieldMapSym3::CbmFieldMapSym3
(
CbmFieldPar
* fieldPar) :
CbmFieldMap
(fieldPar), fHemiX(0.), fHemiY(0.), fHemiZ(0.)
33
{
34
fType = 3;
35
}
36
// ------------------------------------------------------------------------
37
38
39
// ------------ Destructor --------------------------------------------
40
CbmFieldMapSym3::~CbmFieldMapSym3
() {}
41
// ------------------------------------------------------------------------
42
43
44
// ----------- Get x component of the field ---------------------------
45
Double_t
CbmFieldMapSym3::GetBx
(Double_t
x
, Double_t
y
, Double_t z)
46
{
47
48
Int_t ix = 0;
49
Int_t iy = 0;
50
Int_t iz = 0;
51
Double_t dx = 0.;
52
Double_t dy = 0.;
53
Double_t dz = 0.;
54
55
if
(
IsInside
(
x
,
y
, z, ix, iy, iz, dx, dy, dz)) {
56
57
// Get Bx field values at grid cell corners
58
fHa
[0][0][0] =
fBx
->At(ix *
fNy
*
fNz
+ iy *
fNz
+ iz);
59
fHa
[1][0][0] =
fBx
->At((ix + 1) *
fNy
*
fNz
+ iy *
fNz
+ iz);
60
fHa
[0][1][0] =
fBx
->At(ix *
fNy
*
fNz
+ (iy + 1) *
fNz
+ iz);
61
fHa
[1][1][0] =
fBx
->At((ix + 1) *
fNy
*
fNz
+ (iy + 1) *
fNz
+ iz);
62
fHa
[0][0][1] =
fBx
->At(ix *
fNy
*
fNz
+ iy *
fNz
+ (iz + 1));
63
fHa
[1][0][1] =
fBx
->At((ix + 1) *
fNy
*
fNz
+ iy *
fNz
+ (iz + 1));
64
fHa
[0][1][1] =
fBx
->At(ix *
fNy
*
fNz
+ (iy + 1) *
fNz
+ (iz + 1));
65
fHa
[1][1][1] =
fBx
->At((ix + 1) *
fNy
*
fNz
+ (iy + 1) *
fNz
+ (iz + 1));
66
67
// Return interpolated field value
68
return
Interpolate
(dx, dy, dz) *
fHemiX
*
fHemiY
;
69
}
70
71
return
0.;
72
}
73
// ------------------------------------------------------------------------
74
75
76
// ----------- Get y component of the field ---------------------------
77
Double_t
CbmFieldMapSym3::GetBy
(Double_t
x
, Double_t
y
, Double_t z)
78
{
79
80
Int_t ix = 0;
81
Int_t iy = 0;
82
Int_t iz = 0;
83
Double_t dx = 0.;
84
Double_t dy = 0.;
85
Double_t dz = 0.;
86
87
if
(
IsInside
(
x
,
y
, z, ix, iy, iz, dx, dy, dz)) {
88
89
// Get By field values at grid cell corners
90
fHa
[0][0][0] =
fBy
->At(ix *
fNy
*
fNz
+ iy *
fNz
+ iz);
91
fHa
[1][0][0] =
fBy
->At((ix + 1) *
fNy
*
fNz
+ iy *
fNz
+ iz);
92
fHa
[0][1][0] =
fBy
->At(ix *
fNy
*
fNz
+ (iy + 1) *
fNz
+ iz);
93
fHa
[1][1][0] =
fBy
->At((ix + 1) *
fNy
*
fNz
+ (iy + 1) *
fNz
+ iz);
94
fHa
[0][0][1] =
fBy
->At(ix *
fNy
*
fNz
+ iy *
fNz
+ (iz + 1));
95
fHa
[1][0][1] =
fBy
->At((ix + 1) *
fNy
*
fNz
+ iy *
fNz
+ (iz + 1));
96
fHa
[0][1][1] =
fBy
->At(ix *
fNy
*
fNz
+ (iy + 1) *
fNz
+ (iz + 1));
97
fHa
[1][1][1] =
fBy
->At((ix + 1) *
fNy
*
fNz
+ (iy + 1) *
fNz
+ (iz + 1));
98
99
// Return interpolated field value
100
return
Interpolate
(dx, dy, dz);
101
}
102
103
return
0.;
104
}
105
// ------------------------------------------------------------------------
106
107
108
// ----------- Get z component of the field ---------------------------
109
Double_t
CbmFieldMapSym3::GetBz
(Double_t
x
, Double_t
y
, Double_t z)
110
{
111
112
Int_t ix = 0;
113
Int_t iy = 0;
114
Int_t iz = 0;
115
Double_t dx = 0.;
116
Double_t dy = 0.;
117
Double_t dz = 0.;
118
119
if
(
IsInside
(
x
,
y
, z, ix, iy, iz, dx, dy, dz)) {
120
121
// Get Bz field values at grid cell corners
122
fHa
[0][0][0] =
fBz
->At(ix *
fNy
*
fNz
+ iy *
fNz
+ iz);
123
fHa
[1][0][0] =
fBz
->At((ix + 1) *
fNy
*
fNz
+ iy *
fNz
+ iz);
124
fHa
[0][1][0] =
fBz
->At(ix *
fNy
*
fNz
+ (iy + 1) *
fNz
+ iz);
125
fHa
[1][1][0] =
fBz
->At((ix + 1) *
fNy
*
fNz
+ (iy + 1) *
fNz
+ iz);
126
fHa
[0][0][1] =
fBz
->At(ix *
fNy
*
fNz
+ iy *
fNz
+ (iz + 1));
127
fHa
[1][0][1] =
fBz
->At((ix + 1) *
fNy
*
fNz
+ iy *
fNz
+ (iz + 1));
128
fHa
[0][1][1] =
fBz
->At(ix *
fNy
*
fNz
+ (iy + 1) *
fNz
+ (iz + 1));
129
fHa
[1][1][1] =
fBz
->At((ix + 1) *
fNy
*
fNz
+ (iy + 1) *
fNz
+ (iz + 1));
130
131
// Return interpolated field value
132
return
Interpolate
(dx, dy, dz) *
fHemiY
*
fHemiZ
;
133
}
134
135
return
0.;
136
}
137
// ------------------------------------------------------------------------
138
139
140
// ----------- Check whether a point is inside the map ----------------
141
Bool_t
CbmFieldMapSym3::IsInside
(Double_t
x
, Double_t
y
, Double_t z, Int_t& ix, Int_t& iy, Int_t& iz, Double_t& dx,
142
Double_t& dy, Double_t& dz)
143
{
144
145
// --- Transform into local coordinate system
146
Double_t xl =
x
-
fPosX
;
147
Double_t yl =
y
-
fPosY
;
148
Double_t zl = z -
fPosZ
;
149
150
// --- Reflect w.r.t. symmetry axes
151
fHemiX
=
fHemiY
=
fHemiZ
= 1.;
152
if
(xl < 0.) {
153
fHemiX
= -1.;
154
xl = -1. * xl;
155
}
156
if
(yl < 0.) {
157
fHemiY
= -1.;
158
yl = -1. * yl;
159
}
160
if
(zl < 0.) {
161
fHemiZ
= -1.;
162
zl = -1. * zl;
163
}
164
165
// --- Check for being outside the map range
166
if
(!(xl >=
fXmin
&& xl < fXmax && yl >=
fYmin
&& yl < fYmax && zl >=
fZmin
&& zl <
fZmax
)) {
167
ix = iy = iz = 0;
168
dx = dy = dz = 0.;
169
return
kFALSE;
170
}
171
172
// --- Determine grid cell
173
ix = Int_t((xl -
fXmin
) /
fXstep
);
174
iy = Int_t((yl -
fYmin
) /
fYstep
);
175
iz = Int_t((zl -
fZmin
) /
fZstep
);
176
177
// Relative distance from grid point (in units of cell size)
178
dx = (xl -
fXmin
) /
fXstep
- Double_t(ix);
179
dy = (yl -
fYmin
) /
fYstep
- Double_t(iy);
180
dz = (zl -
fZmin
) /
fZstep
- Double_t(iz);
181
182
return
kTRUE;
183
}
184
// ------------------------------------------------------------------------
185
186
187
ClassImp
(
CbmFieldMapSym3
)
ClassImp
ClassImp(CbmConverterManager)
CbmFieldMapSym3.h
y
Double_t y
Definition
CbmMvdSensorDigiToHitTask.cxx:64
x
Double_t x
Definition
CbmMvdSensorDigiToHitTask.cxx:64
CbmFieldMapSym3
Definition
CbmFieldMapSym3.h:39
CbmFieldMapSym3::fHemiY
Double_t fHemiY
Definition
CbmFieldMapSym3.h:83
CbmFieldMapSym3::CbmFieldMapSym3
CbmFieldMapSym3()
Definition
CbmFieldMapSym3.cxx:15
CbmFieldMapSym3::fHemiZ
Double_t fHemiZ
Definition
CbmFieldMapSym3.h:83
CbmFieldMapSym3::fHemiX
Double_t fHemiX
Definition
CbmFieldMapSym3.h:83
CbmFieldMapSym3::IsInside
virtual Bool_t IsInside(Double_t x, Double_t y, Double_t z, Int_t &ix, Int_t &iy, Int_t &iz, Double_t &dx, Double_t &dy, Double_t &dz)
Definition
CbmFieldMapSym3.cxx:141
CbmFieldMapSym3::~CbmFieldMapSym3
virtual ~CbmFieldMapSym3()
Definition
CbmFieldMapSym3.cxx:40
CbmFieldMap
Definition
CbmFieldMap.h:38
CbmFieldMap::fPosZ
Double_t fPosZ
Definition
CbmFieldMap.h:192
CbmFieldMap::fBy
TArrayF * fBy
Definition
CbmFieldMap.h:207
CbmFieldMap::fPosY
Double_t fPosY
Definition
CbmFieldMap.h:192
CbmFieldMap::GetBz
TArrayF * GetBz() const
Definition
CbmFieldMap.h:147
CbmFieldMap::fPosX
Double_t fPosX
Definition
CbmFieldMap.h:192
CbmFieldMap::fZmin
Double_t fZmin
Definition
CbmFieldMap.h:198
CbmFieldMap::fZmax
Double_t fZmax
Definition
CbmFieldMap.h:198
CbmFieldMap::fYmin
Double_t fYmin
Definition
CbmFieldMap.h:197
CbmFieldMap::fHa
Double_t fHa[2][2][2]
Definition
CbmFieldMap.h:213
CbmFieldMap::fNz
Int_t fNz
Definition
CbmFieldMap.h:202
CbmFieldMap::GetBx
TArrayF * GetBx() const
Definition
CbmFieldMap.h:145
CbmFieldMap::fBx
TArrayF * fBx
Definition
CbmFieldMap.h:206
CbmFieldMap::fBz
TArrayF * fBz
Definition
CbmFieldMap.h:208
CbmFieldMap::fXmin
Double_t fXmin
Definition
CbmFieldMap.h:196
CbmFieldMap::fNy
Int_t fNy
Definition
CbmFieldMap.h:202
CbmFieldMap::fYstep
Double_t fYstep
Definition
CbmFieldMap.h:197
CbmFieldMap::fZstep
Double_t fZstep
Definition
CbmFieldMap.h:198
CbmFieldMap::Interpolate
Double_t Interpolate(Double_t dx, Double_t dy, Double_t dz)
Definition
CbmFieldMap.cxx:789
CbmFieldMap::fXstep
Double_t fXstep
Definition
CbmFieldMap.h:196
CbmFieldMap::GetBy
TArrayF * GetBy() const
Definition
CbmFieldMap.h:146
CbmFieldPar
Definition
CbmFieldPar.h:35
core
field
CbmFieldMapSym3.cxx
Generated on Sun Dec 22 2024 23:04:10 for CbmRoot by
1.12.0