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