CbmRoot
CbmFieldConst.cxx
Go to the documentation of this file.
1
// -------------------------------------------------------------------------
2
// ----- CbmFieldConst source file -----
3
// ----- Created 06/01/04 by M. Al/Turany -----
4
// ----- Redesign 13/02/06 by V. Friese -----
5
// -------------------------------------------------------------------------
6
#include "
CbmFieldConst.h
"
7
8
#include "
CbmFieldPar.h
"
// for CbmFieldPar
9
10
#include <FairField.h>
// for FairField
11
12
#include <TString.h>
// for operator<<
13
14
#include <iomanip>
// for operator<<, setw
15
#include <iostream>
// for operator<<, basic_ostream, endl, ostream
16
17
using
std::cerr;
18
using
std::cout;
19
using
std::endl;
20
using
std::setw;
21
22
23
// ----- Default constructor -------------------------------------------
24
CbmFieldConst::CbmFieldConst
()
25
: FairField()
26
, fXmin(0.)
27
, fXmax(0.)
28
, fYmin(0.)
29
, fYmax(0.)
30
, fZmin(0.)
31
, fZmax(0.)
32
, fBx(0.)
33
, fBy(0.)
34
, fBz(0.) {
35
fType = 0;
36
}
37
// -------------------------------------------------------------------------
38
39
40
// ----- Standard constructor ------------------------------------------
41
CbmFieldConst::CbmFieldConst
(
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
fType = 0;
62
}
63
// -------------------------------------------------------------------------
64
65
66
// -------- Constructor from CbmFieldPar -------------------------------
67
CbmFieldConst::CbmFieldConst
(
CbmFieldPar
* 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
if
(!fieldPar) {
79
cerr <<
"-W- CbmFieldConst::CbmFieldConst: empty parameter container!"
80
<< endl;
81
fType = 0;
82
}
else
{
83
fXmin
= fieldPar->
GetXmin
();
84
fXmax
= fieldPar->
GetXmax
();
85
fYmin
= fieldPar->
GetYmin
();
86
fYmax
= fieldPar->
GetYmax
();
87
fZmin
= fieldPar->
GetZmin
();
88
fZmax
= fieldPar->
GetZmax
();
89
fBx
= fieldPar->
GetBx
();
90
fBy
= fieldPar->
GetBy
();
91
fBz
= fieldPar->
GetBz
();
92
fType = fieldPar->
GetType
();
93
}
94
}
95
// -------------------------------------------------------------------------
96
97
98
// ----- Destructor ----------------------------------------------------
99
CbmFieldConst::~CbmFieldConst
() {}
100
// -------------------------------------------------------------------------
101
102
103
// ----- Set field region ----------------------------------------------
104
void
CbmFieldConst::SetFieldRegion
(Double_t xMin,
105
Double_t xMax,
106
Double_t yMin,
107
Double_t yMax,
108
Double_t zMin,
109
Double_t zMax) {
110
fXmin
= xMin;
111
fXmax
= xMax;
112
fYmin
= yMin;
113
fYmax
= yMax;
114
fZmin
= zMin;
115
fZmax
= zMax;
116
}
117
// -------------------------------------------------------------------------
118
119
120
// ----- Set field values ----------------------------------------------
121
void
CbmFieldConst::SetField
(Double_t bX, Double_t bY, Double_t bZ) {
122
fBx
= bX;
123
fBy
= bY;
124
fBz
= bZ;
125
}
126
// -------------------------------------------------------------------------
127
128
129
// ----- Get x component of field --------------------------------------
130
Double_t
CbmFieldConst::GetBx
(Double_t
x
, Double_t
y
, Double_t z) {
131
if
(x < fXmin || x >
fXmax
|| y < fYmin || y >
fYmax
|| z <
fZmin
132
|| z >
fZmax
)
133
return
0.;
134
return
fBx
;
135
}
136
// -------------------------------------------------------------------------
137
138
139
// ----- Get y component of field --------------------------------------
140
Double_t
CbmFieldConst::GetBy
(Double_t
x
, Double_t
y
, Double_t z) {
141
if
(x < fXmin || x >
fXmax
|| y < fYmin || y >
fYmax
|| z <
fZmin
142
|| z >
fZmax
)
143
return
0.;
144
return
fBy
;
145
}
146
// -------------------------------------------------------------------------
147
148
149
// ----- Get z component of field --------------------------------------
150
Double_t
CbmFieldConst::GetBz
(Double_t
x
, Double_t
y
, Double_t z) {
151
if
(x < fXmin || x >
fXmax
|| y < fYmin || y >
fYmax
|| z <
fZmin
152
|| z >
fZmax
)
153
return
0.;
154
return
fBz
;
155
}
156
// -------------------------------------------------------------------------
157
158
159
// ----- Screen output -------------------------------------------------
160
void
CbmFieldConst::Print
(Option_t*)
const
{
161
cout <<
"======================================================"
<< endl;
162
cout <<
"---- "
<< fTitle <<
" : "
<< fName << endl;
163
cout <<
"----"
<< endl;
164
cout <<
"---- Field type : constant"
<< endl;
165
cout <<
"----"
<< endl;
166
cout <<
"---- Field regions : "
<< endl;
167
cout <<
"---- x = "
<< setw(4) <<
fXmin
<<
" to "
<< setw(4) <<
fXmax
168
<<
" cm"
<< endl;
169
cout <<
"---- y = "
<< setw(4) <<
fYmin
<<
" to "
<< setw(4) <<
fYmax
170
<<
" cm"
<< endl;
171
cout <<
"---- z = "
<< setw(4) <<
fZmin
<<
" to "
<< setw(4) <<
fZmax
172
<<
" cm"
<< endl;
173
cout.precision(4);
174
cout <<
"---- B = ( "
<<
fBx
<<
", "
<<
fBy
<<
", "
<<
fBz
<<
" ) kG"
175
<< endl;
176
cout <<
"======================================================"
<< endl;
177
}
178
// -------------------------------------------------------------------------
179
180
181
ClassImp
(
CbmFieldConst
)
CbmFieldPar::GetYmax
Double_t GetYmax() const
Definition:
CbmFieldPar.h:61
CbmFieldPar::GetXmax
Double_t GetXmax() const
Definition:
CbmFieldPar.h:59
CbmFieldPar::GetXmin
Double_t GetXmin() const
Definition:
CbmFieldPar.h:58
CbmFieldConst::CbmFieldConst
CbmFieldConst()
Definition:
CbmFieldConst.cxx:24
CbmFieldConst::fBy
Double_t fBy
Definition:
CbmFieldConst.h:119
CbmFieldPar::GetYmin
Double_t GetYmin() const
Definition:
CbmFieldPar.h:60
CbmFieldConst::fBz
Double_t fBz
Definition:
CbmFieldConst.h:120
CbmFieldConst::GetBz
Double_t GetBz() const
Definition:
CbmFieldConst.h:101
CbmFieldConst::fYmax
Double_t fYmax
Definition:
CbmFieldConst.h:113
CbmFieldConst::fYmin
Double_t fYmin
Definition:
CbmFieldConst.h:112
CbmFieldConst.h
CbmFieldConst::~CbmFieldConst
virtual ~CbmFieldConst()
Definition:
CbmFieldConst.cxx:99
CbmFieldConst::fBx
Double_t fBx
Definition:
CbmFieldConst.h:118
CbmFieldPar.h
CbmFieldConst::GetBx
Double_t GetBx() const
Definition:
CbmFieldConst.h:99
ClassImp
ClassImp(CbmConverterManager) InitStatus CbmConverterManager
Definition:
CbmConverterManager.cxx:12
CbmFieldConst::fXmin
Double_t fXmin
Definition:
CbmFieldConst.h:110
CbmFieldPar::GetBx
Double_t GetBx() const
Definition:
CbmFieldPar.h:64
CbmFieldConst::fZmin
Double_t fZmin
Definition:
CbmFieldConst.h:114
CbmFieldPar::GetBy
Double_t GetBy() const
Definition:
CbmFieldPar.h:65
CbmFieldConst::GetBy
Double_t GetBy() const
Definition:
CbmFieldConst.h:100
CbmFieldConst::Print
virtual void Print(Option_t *="") const
Definition:
CbmFieldConst.cxx:160
CbmFieldPar::GetZmin
Double_t GetZmin() const
Definition:
CbmFieldPar.h:62
CbmFieldPar::GetType
Int_t GetType() const
Definition:
CbmFieldPar.h:57
x
Double_t x
Definition:
CbmMvdSensorDigiToHitTask.cxx:68
y
Double_t y
Definition:
CbmMvdSensorDigiToHitTask.cxx:68
CbmFieldConst::SetFieldRegion
void SetFieldRegion(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax)
Definition:
CbmFieldConst.cxx:104
CbmFieldConst::fZmax
Double_t fZmax
Definition:
CbmFieldConst.h:115
CbmFieldConst
Definition:
CbmFieldConst.h:28
CbmFieldPar::GetZmax
Double_t GetZmax() const
Definition:
CbmFieldPar.h:63
CbmFieldConst::SetField
void SetField(Double_t bX, Double_t bY, Double_t bZ)
Definition:
CbmFieldConst.cxx:121
CbmFieldConst::fXmax
Double_t fXmax
Definition:
CbmFieldConst.h:111
CbmFieldPar
Definition:
CbmFieldPar.h:31
CbmFieldPar::GetBz
Double_t GetBz() const
Definition:
CbmFieldPar.h:66
core
field
CbmFieldConst.cxx
Generated on Wed Oct 28 2020 15:11:35 for CbmRoot by
1.8.18