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