BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
BmnFieldConst.cxx
Go to the documentation of this file.
1
/********************************************************************************
2
* Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3
* *
4
* This software is distributed under the terms of the *
5
* GNU Lesser General Public Licence (LGPL) version 3, *
6
* copied verbatim in the file "LICENSE" *
7
********************************************************************************/
8
// -------------------------------------------------------------------------
9
// ----- BmnFieldConst source file -----
10
// ----- Created 30/01/07 by M. Al/Turany -----
11
// -------------------------------------------------------------------------
12
#include "
BmnFieldConst.h
"
13
14
#include "
BmnFieldPar.h
"
15
#include "FairLogger.h"
// for logging
16
#include "FairRun.h"
// for FairRun
17
#include "FairRuntimeDb.h"
// for FairRuntimeDb
18
19
#include <
TString.h
>
// for operator<<, TString
20
#include <iomanip>
// for operator<<, setw
21
22
using
std::setprecision;
23
using
std::setw;
24
25
BmnFieldConst::BmnFieldConst
()
26
:
FairField
()
27
,
fXmin
(0)
28
,
fXmax
(0)
29
,
fYmin
(0)
30
,
fYmax
(0)
31
,
fZmin
(0)
32
,
fZmax
(0)
33
,
fBx
(0)
34
,
fBy
(0)
35
,
fBz
(0)
36
,
fIsOff
(
kFALSE
)
37
{
38
fType = 0;
39
}
40
41
BmnFieldConst::BmnFieldConst
(
const
char
* name,
42
Double_t
xMin,
43
Double_t
xMax,
44
Double_t
yMin,
45
Double_t
yMax,
46
Double_t
zMin,
47
Double_t
zMax,
48
Double_t
bX,
49
Double_t
bY,
50
Double_t
bZ)
51
:
FairField
(name)
52
,
fXmin
(xMin)
53
,
fXmax
(xMax)
54
,
fYmin
(yMin)
55
,
fYmax
(yMax)
56
,
fZmin
(zMin)
57
,
fZmax
(zMax)
58
,
fBx
(bX)
59
,
fBy
(bY)
60
,
fBz
(bZ)
61
,
fIsOff
(
kFALSE
)
62
63
{
64
fType = 0;
65
}
66
67
BmnFieldConst::BmnFieldConst
(
BmnFieldPar
* fieldPar)
68
:
FairField
()
69
,
fXmin
(0)
70
,
fXmax
(0)
71
,
fYmin
(0)
72
,
fYmax
(0)
73
,
fZmin
(0)
74
,
fZmax
(0)
75
,
fBx
(0)
76
,
fBy
(0)
77
,
fBz
(0)
78
,
fIsOff
(
kFALSE
)
79
{
80
if
(!fieldPar) {
81
LOG(warn) <<
"BmnFieldConst::BmnFieldConst: empty parameter container!"
;
82
fType = -1;
83
}
else
{
84
fXmin
= fieldPar->
GetXmin
();
85
fXmax
= fieldPar->
GetXmax
();
86
fYmin
= fieldPar->
GetYmin
();
87
fYmax
= fieldPar->
GetYmax
();
88
fZmin
= fieldPar->
GetZmin
();
89
fZmax
= fieldPar->
GetZmax
();
90
fBx
= fieldPar->
GetBx
();
91
fBy
= fieldPar->
GetBy
();
92
fBz
= fieldPar->
GetBz
();
93
fType = fieldPar->
GetType
();
94
fIsOff
= fieldPar->
IsFieldOff
();
95
}
96
}
97
98
BmnFieldConst::~BmnFieldConst
() {}
99
100
void
BmnFieldConst::SetFieldRegion
(
Double_t
xMin,
101
Double_t
xMax,
102
Double_t
yMin,
103
Double_t
yMax,
104
Double_t
zMin,
105
Double_t
zMax)
106
{
107
fXmin
= xMin;
108
fXmax
= xMax;
109
fYmin
= yMin;
110
fYmax
= yMax;
111
fZmin
= zMin;
112
fZmax
= zMax;
113
}
114
115
void
BmnFieldConst::SetField
(
Double_t
bX,
Double_t
bY,
Double_t
bZ)
116
{
117
fBx
= bX;
118
fBy
= bY;
119
fBz
= bZ;
120
if
((bX == 0) && (bY == 0) && (bZ == 0))
121
fIsOff
=
kTRUE
;
122
else
123
fIsOff
=
kFALSE
;
124
}
125
126
Double_t
BmnFieldConst::GetBx
(
Double_t
x,
Double_t
y,
Double_t
z)
127
{
128
if
(x < fXmin || x >
fXmax
|| y < fYmin || y >
fYmax
|| z < fZmin || z >
fZmax
) {
129
return
0.;
130
}
131
return
fBx
;
132
}
133
134
Double_t
BmnFieldConst::GetBy
(
Double_t
x,
Double_t
y,
Double_t
z)
135
{
136
if
(x < fXmin || x >
fXmax
|| y < fYmin || y >
fYmax
|| z < fZmin || z >
fZmax
) {
137
return
0.;
138
}
139
return
fBy
;
140
}
141
142
Double_t
BmnFieldConst::GetBz
(
Double_t
x,
Double_t
y,
Double_t
z)
143
{
144
if
(x < fXmin || x >
fXmax
|| y < fYmin || y >
fYmax
|| z < fZmin || z >
fZmax
) {
145
return
0.;
146
}
147
return
fBz
;
148
}
149
150
void
BmnFieldConst::Print
(
Option_t
*)
const
151
{
152
LOG(info) <<
"======================================================"
;
153
LOG(info) <<
"---- "
<< fTitle <<
" : "
<< fName;
154
LOG(info) <<
"----"
;
155
LOG(info) <<
"---- Field type : constant"
;
156
if
(
fIsOff
)
157
LOG(info) <<
"---- Field is off ----"
;
158
LOG(info) <<
"----"
;
159
LOG(info) <<
"---- Field regions : "
;
160
LOG(info) <<
"---- x = "
<< setw(4) <<
fXmin
<<
" to "
<< setw(4) <<
fXmax
<<
" cm"
;
161
LOG(info) <<
"---- y = "
<< setw(4) <<
fYmin
<<
" to "
<< setw(4) <<
fYmax
<<
" cm"
;
162
LOG(info) <<
"---- z = "
<< setw(4) <<
fZmin
<<
" to "
<< setw(4) <<
fZmax
<<
" cm"
;
163
LOG(info) <<
"---- B = ( "
<< setprecision(4) <<
fBx
<<
", "
<<
fBy
<<
", "
<<
fBz
<<
" ) kG"
;
164
LOG(info) <<
"======================================================"
;
165
}
166
167
void
BmnFieldConst::FillParContainer
()
168
{
169
TString
MapName = GetName();
170
// LOG(info) << "BmnFieldConst::FillParContainer() ";
171
FairRun* fRun = FairRun::Instance();
172
FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
173
// Bool_t kParameterMerged = kTRUE;
174
BmnFieldPar
* Par =
static_cast<
BmnFieldPar
*
>
(rtdb->getContainer(
"BmnFieldPar"
));
175
Par->
SetParameters
(
this
);
176
Par->setInputVersion(fRun->GetRunId(), 1);
177
Par->setChanged();
178
}
kFALSE
constexpr Bool_t kFALSE
Double_t
double Double_t
kTRUE
constexpr Bool_t kTRUE
Option_t
const char Option_t
TString.h
BmnFieldConst::fXmin
Double_t fXmin
Limits of the field region.
Definition
BmnFieldConst.h:93
BmnFieldConst::fZmin
Double_t fZmin
Definition
BmnFieldConst.h:97
BmnFieldConst::fBy
Double_t fBy
Definition
BmnFieldConst.h:102
BmnFieldConst::SetField
void SetField(Double_t bX, Double_t bY, Double_t bZ)
Set the field values.
Definition
BmnFieldConst.cxx:115
BmnFieldConst::fZmax
Double_t fZmax
Definition
BmnFieldConst.h:98
BmnFieldConst::fBz
Double_t fBz
Definition
BmnFieldConst.h:103
BmnFieldConst::~BmnFieldConst
virtual ~BmnFieldConst()
Destructor.
Definition
BmnFieldConst.cxx:98
BmnFieldConst::fIsOff
Bool_t fIsOff
Whether magnetic field is off.
Definition
BmnFieldConst.h:106
BmnFieldConst::Print
virtual void Print(Option_t *) const
Screen output.
Definition
BmnFieldConst.cxx:150
BmnFieldConst::SetFieldRegion
void SetFieldRegion(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax)
Set the field region.
Definition
BmnFieldConst.cxx:100
BmnFieldConst::GetBy
Double_t GetBy() const
Definition
BmnFieldConst.h:80
BmnFieldConst::GetBz
Double_t GetBz() const
Definition
BmnFieldConst.h:81
BmnFieldConst::fBx
Double_t fBx
Field components inside the field region.
Definition
BmnFieldConst.h:101
BmnFieldConst::GetBx
Double_t GetBx() const
Accessors to field values.
Definition
BmnFieldConst.h:79
BmnFieldConst::fYmin
Double_t fYmin
Definition
BmnFieldConst.h:95
BmnFieldConst::fYmax
Double_t fYmax
Definition
BmnFieldConst.h:96
BmnFieldConst::FillParContainer
void FillParContainer()
Definition
BmnFieldConst.cxx:167
BmnFieldConst::fXmax
Double_t fXmax
Definition
BmnFieldConst.h:94
BmnFieldConst::BmnFieldConst
BmnFieldConst()
Default constructor.
Definition
BmnFieldConst.cxx:25
BmnFieldPar
Definition
BmnFieldPar.h:26
BmnFieldPar::GetXmin
Double_t GetXmin() const
Definition
BmnFieldPar.h:49
BmnFieldPar::IsFieldOff
Bool_t IsFieldOff() const
Definition
BmnFieldPar.h:63
BmnFieldPar::GetYmax
Double_t GetYmax() const
Definition
BmnFieldPar.h:52
BmnFieldPar::GetBz
Double_t GetBz() const
Definition
BmnFieldPar.h:57
BmnFieldPar::GetZmin
Double_t GetZmin() const
Definition
BmnFieldPar.h:53
BmnFieldPar::GetType
Int_t GetType() const
Accessors.
Definition
BmnFieldPar.h:48
BmnFieldPar::GetZmax
Double_t GetZmax() const
Definition
BmnFieldPar.h:54
BmnFieldPar::GetBy
Double_t GetBy() const
Definition
BmnFieldPar.h:56
BmnFieldPar::GetBx
Double_t GetBx() const
Definition
BmnFieldPar.h:55
BmnFieldPar::GetXmax
Double_t GetXmax() const
Definition
BmnFieldPar.h:50
BmnFieldPar::SetParameters
void SetParameters(FairField *field)
Set parameters from BmnField.
Definition
BmnFieldPar.cxx:180
BmnFieldPar::GetYmin
Double_t GetYmin() const
Definition
BmnFieldPar.h:51
FairField
TString
BmnFieldConst.h
BmnFieldPar.h
field
BmnFieldConst.cxx
Generated on
for BmnRoot by
1.17.0