EIC Software
Reference for
EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
EicMagneticFieldFromGradients.h
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file EicMagneticFieldFromGradients.h
1
//
2
// RMP (rpetti@bnl.gov), 2016/02/22
3
//
4
// EIC magnetic field map handler;
5
// alternate class to import fields just as gradients
6
//
7
8
//#include <map>
9
10
#include <
FairField.h
>
11
12
#include <
PndSolenoidMap.h
>
13
14
//#include <EicDetector.h>
15
#include <
EicBeamLineElementGrad.h
>
16
#include <
EicConstantField.h
>
17
#include <
EicMagneticFieldGrad.h
>
18
19
#ifndef _EIC_MAGNETIC_FIELD_FROM_GRADIENTS_
20
// It looks I can not alwyas use EicMagneticField::ClassName(); NB: never change this,
21
// since magnetic field object will be encoded with this name in simulation.root file;
22
#define _EIC_MAGNETIC_FIELD_FROM_GRADIENTS_ ("EicMagneticFieldFomGradients")
23
24
25
class
EicMagneticFieldFromGradients
:
public
FairField
26
{
27
public
:
28
EicMagneticFieldFromGradients
(
const
char
*fileName = 0);
29
~EicMagneticFieldFromGradients
() {};
30
31
void
AddFieldGradient
(
EicMagneticFieldGrad
*grad) {
32
mMaps
.push_back(grad);
33
};
34
int
AddBeamLineElementGrads
(
const
char
*directory,
float
fieldScaler = 1.,
int
color
=
_DEFAULT_YOKE_COLOR_
);
35
36
enum
XYZ
{
eX
,
eY
,
eZ
};
37
38
//
39
// FairRoot methods follow;
40
//
41
42
void
Init
() {
InitializeFieldGradients
(); };
43
44
// FIXME: perhaps arrange a look-up table?;
45
Double_t
GetBx
(Double_t
x
, Double_t
y
, Double_t
z
) {
return
GetBxyzCore
(x, y, z,
eX
); };
46
Double_t
GetBy
(Double_t
x
, Double_t
y
, Double_t
z
) {
return
GetBxyzCore
(x, y, z,
eY
); };
47
Double_t
GetBz
(Double_t
x
, Double_t
y
, Double_t
z
) {
return
GetBxyzCore
(x, y, z,
eZ
); };
48
49
void
GetBxyz
(
const
Double_t
point
[3], Double_t*
bField
) {
50
GetFieldSumValue
(point, bField);
51
};
52
53
// NB: this call should be *after* all the AddFieldMap(new EicBeamLineElementMap()) calls;
54
int
CreateYokeVolumes
(Bool_t Active = kFALSE);
55
56
int
Export
(
const
char
*fileName)
const
{
return
0; };
57
58
private
:
59
Bool_t
mInitialized
;
60
61
//Bool_t mCreateYokeVolumes; //! indicates whether yoke volumes should be created for beam line maps
62
63
std::vector<EicMagneticFieldGrad*>
mMaps
;
// magnetic field gradients
64
65
int
InitializeFieldGradients
();
66
67
// A single point of access for field quering routines;
68
int
GetFieldSumValue
(
const
double
xx[],
double
B[]);
69
70
Double_t
GetBxyzCore
(Double_t
x
, Double_t
y
, Double_t
z
,
XYZ
coord) {
71
double
xx[3] = {
x
,
y
, z}, B[3];
72
73
int
ret =
GetFieldSumValue
(xx, B);
74
75
// In fact gets reset to 0.0 in GetFieldSumValue() anyway; ok, shoot twice;
76
return
(ret ? 0.0 : B[coord]);
77
};
78
79
ClassDef(
EicMagneticFieldFromGradients
,1)
80
};
81
82
#endif
EicRoot
blob
master
eic
field
EicMagneticFieldFromGradients.h
Built by
Jin Huang
. updated:
Mon Jan 22 2024 12:43:35
using
1.8.2 with
EIC GitHub integration