CbmRoot
Loading...
Searching...
No Matches
CbmFieldMapSym2.cxx
Go to the documentation of this file.
1/* Copyright (C) 2005-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Elena Litvinenko, Denis Bertini [committer] */
4
5// -------------------------------------------------------------------------
6// ----- CbmFieldMapSym2 source file -----
7// ----- Created 09/06/05 by E. Litvinenko (CbmFieldMapLIT.cxx) -----
8// ----- Redesign 20/02/06 by V. Friese -----
9// -------------------------------------------------------------------------
10#include "CbmFieldMapSym2.h"
11
12#include <TArrayF.h> // for TArrayF
13
14// ------------- Default constructor ----------------------------------
16// ------------------------------------------------------------------------
17
18
19// ------------- Standard constructor ---------------------------------
20CbmFieldMapSym2::CbmFieldMapSym2(const char* mapName, const char* fileType) : CbmFieldMap(mapName, fileType)
21{
22 fType = 2;
23}
24// ------------------------------------------------------------------------
25
26
27// ------------ Constructor from CbmFieldPar --------------------------
28CbmFieldMapSym2::CbmFieldMapSym2(CbmFieldPar* fieldPar) : CbmFieldMap(fieldPar) { fType = 2; }
29// ------------------------------------------------------------------------
30
31
32// ------------ Destructor --------------------------------------------
34// ------------------------------------------------------------------------
35
36
37// ----------- Get x component of the field ---------------------------
38Double_t CbmFieldMapSym2::GetBx(Double_t x, Double_t y, Double_t z)
39{
40 auto local = Global2LocalReflected(x, y, z);
41 return Interpolate(fBx, Local2Grid(local)) * local.hemiX * local.hemiY;
42}
43// ------------------------------------------------------------------------
44
45
46// ----------- Get y component of the field ---------------------------
47Double_t CbmFieldMapSym2::GetBy(Double_t x, Double_t y, Double_t z)
48{
49 auto local = Global2LocalReflected(x, y, z);
50 return Interpolate(fBy, Local2Grid(local));
51}
52// ------------------------------------------------------------------------
53
54
55// ----------- Get z component of the field ---------------------------
56Double_t CbmFieldMapSym2::GetBz(Double_t x, Double_t y, Double_t z)
57{
58 auto local = Global2LocalReflected(x, y, z);
59 return Interpolate(fBz, Local2Grid(local)) * local.hemiY;
60}
61// ------------------------------------------------------------------------
62
63
64// ----------- Get the field value at a point ------------------------
65void CbmFieldMapSym2::GetFieldValue(const Double_t point[3], Double_t* bField)
66{
67 auto local = Global2LocalReflected(point[0], point[1], point[2]);
68 auto grid = Local2Grid(local);
69 bField[0] = Interpolate(fBx, grid) * local.hemiX * local.hemiY;
70 bField[1] = Interpolate(fBy, grid);
71 bField[2] = Interpolate(fBz, grid) * local.hemiY;
72}
73// ------------------------------------------------------------------------
LocalCoordinates Global2LocalReflected(Double_t x, Double_t y, Double_t z) const
Transform global coordinates into local coordinates.
virtual ~CbmFieldMapSym2()
virtual void GetFieldValue(const Double_t point[3], Double_t *bField) override
TArrayF * fBy
TArrayF * GetBz() const
GridCoordinates Local2Grid(const LocalCoordinates &local) const
Transform local coordinates into grid cell coordinates.
TArrayF * GetBx() const
TArrayF * fBx
TArrayF * fBz
Double_t Interpolate(const TArrayF *B, const GridCoordinates &point) const
Get field values by interpolation of the grid.
TArrayF * GetBy() const