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
13using std::cout;
14using std::cerr;
15using std::endl;
16using std::setw;
17
18
19// ----- Default constructor -------------------------------------------
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 ------------------------------------------
39ShipConstField::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 -------------------------------
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 ----------------------------------------------------
98// -------------------------------------------------------------------------
99
100
101
102// ----- Set field region ----------------------------------------------
103void 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 ----------------------------------------------
118void 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 --------------------------------------
128Double_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 --------------------------------------
139Double_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 --------------------------------------
150Double_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 -------------------------------------------------
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
virtual ~ShipConstField()
Double_t GetBz() const
void SetFieldRegion(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax)
Double_t GetBy() const
Double_t GetBx() const
virtual void Print()
void SetField(Double_t bX, Double_t bY, Double_t bZ)
Double_t GetZmax() const
Double_t GetYmin() const
Double_t GetYmax() const
Double_t GetXmax() const
Double_t GetBx() const
Double_t GetBz() const
Int_t GetType() const
Double_t GetBy() const
Double_t GetXmin() const
Double_t GetZmin() const
ClassImp(ecalContFact) ecalContFact