FairShip
Loading...
Searching...
No Matches
ShipConstField Class Reference

#include <ShipConstField.h>

Inheritance diagram for ShipConstField:
[legend]
Collaboration diagram for ShipConstField:
[legend]

Public Member Functions

 ShipConstField ()
 ShipConstField (const char *name, Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax, Double_t bX, Double_t bY, Double_t bZ)
 ShipConstField (ShipFieldPar *fieldPar)
 ~ShipConstField () override
void SetFieldRegion (Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax, Double_t zMin, Double_t zMax)
void SetField (Double_t bX, Double_t bY, Double_t bZ)
Double_t GetBx (Double_t x, Double_t y, Double_t z) override
Double_t GetBy (Double_t x, Double_t y, Double_t z) override
Double_t GetBz (Double_t x, Double_t y, Double_t z) override
void GetFieldValue (const Double_t point[3], Double_t *bField) override
Double_t GetXmin () const
Double_t GetXmax () const
Double_t GetYmin () const
Double_t GetYmax () const
Double_t GetZmin () const
Double_t GetZmax () const
Double_t GetBx () const
Double_t GetBy () const
Double_t GetBz () const
void Print (Option_t *="") const override

Private Member Functions

 ClassDefOverride (ShipConstField, 1)

Private Attributes

Double_t fXmin
Double_t fXmax
Double_t fYmin
Double_t fYmax
Double_t fZmin
Double_t fZmax
Double_t fBx
Double_t fBy
Double_t fBz

Detailed Description

Definition at line 25 of file ShipConstField.h.

Constructor & Destructor Documentation

◆ ShipConstField() [1/3]

ShipConstField::ShipConstField ( )

Default constructor

Definition at line 23 of file ShipConstField.cxx.

24 : FairField(),
25 fXmin(0.),
26 fXmax(0.),
27 fYmin(0.),
28 fYmax(0.),
29 fZmin(0.),
30 fZmax(0.),
31 fBx(0.),
32 fBy(0.),
33 fBz(0.) {
34 fType = 0;
35}

◆ ShipConstField() [2/3]

ShipConstField::ShipConstField ( const char * name,
Double_t xMin,
Double_t xMax,
Double_t yMin,
Double_t yMax,
Double_t zMin,
Double_t zMax,
Double_t bX,
Double_t bY,
Double_t bZ )
explicit

Standard constructor

Parameters
nameObject name
xMin,xMaxx region of field (global coordinates)
yMin,yMaxy region of field (global coordinates)
zMin,zMaxz region of field (global coordinates)
bX,bY,bZField values [kG]

Definition at line 39 of file ShipConstField.cxx.

43 : FairField(name),
44 fXmin(xMin),
45 fXmax(xMax),
46 fYmin(yMin),
47 fYmax(yMax),
48 fZmin(zMin),
49 fZmax(zMax),
50 fBx(bX),
51 fBy(bY),
52 fBz(bZ) {
53 fType = 0;
54}

◆ ShipConstField() [3/3]

ShipConstField::ShipConstField ( ShipFieldPar * fieldPar)
explicit

Constructor from ShipFieldPar

Definition at line 58 of file ShipConstField.cxx.

59 : FairField(),
60 fXmin(0.),
61 fXmax(0.),
62 fYmin(0.),
63 fYmax(0.),
64 fZmin(0.),
65 fZmax(0.),
66 fBx(0.),
67 fBy(0.),
68 fBz(0.) {
69 if (!fieldPar) {
70 cerr << "-W- ShipConstField::ShipConstField: empty parameter container!"
71 << endl;
72 fType = 0;
73 } else {
74 fXmin = fieldPar->GetXmin();
75 fXmax = fieldPar->GetXmax();
76 fYmin = fieldPar->GetYmin();
77 fYmax = fieldPar->GetYmax();
78 fZmin = fieldPar->GetZmin();
79 fZmax = fieldPar->GetZmax();
80 fBx = fieldPar->GetBx();
81 fBy = fieldPar->GetBy();
82 fBz = fieldPar->GetBz();
83 fType = fieldPar->GetType();
84 }
85}
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

◆ ~ShipConstField()

ShipConstField::~ShipConstField ( )
overridedefault

Destructor

Member Function Documentation

◆ ClassDefOverride()

ShipConstField::ClassDefOverride ( ShipConstField ,
1  )
private

◆ GetBx() [1/2]

Double_t ShipConstField::GetBx ( ) const
inline

Accessors to field values

Definition at line 84 of file ShipConstField.h.

84{ return fBx; }

◆ GetBx() [2/2]

Double_t ShipConstField::GetBx ( Double_t x,
Double_t y,
Double_t z )
override

Get components of field at a given point

Parameters
x,y,zPoint coordinates [cm]

Definition at line 114 of file ShipConstField.cxx.

114 {
115 if (x < fXmin || x > fXmax || y < fYmin || y > fYmax || z < fZmin ||
116 z > fZmax)
117 return 0.;
118 return fBx;
119}

◆ GetBy() [1/2]

Double_t ShipConstField::GetBy ( ) const
inline

Definition at line 85 of file ShipConstField.h.

85{ return fBy; }

◆ GetBy() [2/2]

Double_t ShipConstField::GetBy ( Double_t x,
Double_t y,
Double_t z )
override

Definition at line 123 of file ShipConstField.cxx.

123 {
124 if (x < fXmin || x > fXmax || y < fYmin || y > fYmax || z < fZmin ||
125 z > fZmax)
126 return 0.;
127 return fBy;
128}

◆ GetBz() [1/2]

Double_t ShipConstField::GetBz ( ) const
inline

Definition at line 86 of file ShipConstField.h.

86{ return fBz; }

◆ GetBz() [2/2]

Double_t ShipConstField::GetBz ( Double_t x,
Double_t y,
Double_t z )
override

Definition at line 132 of file ShipConstField.cxx.

132 {
133 if (x < fXmin || x > fXmax || y < fYmin || y > fYmax || z < fZmin ||
134 z > fZmax)
135 return 0.;
136 return fBz;
137}

◆ GetFieldValue()

void ShipConstField::GetFieldValue ( const Double_t point[3],
Double_t * bField )
override

Get all three field components at once, performing the in-region test a single time (the default implementation calls GetBx/GetBy/GetBz, each of which repeats the same six boundary comparisons).

Parameters
pointPoint coordinates [cm]
bField(return) Field components [kG]

Definition at line 141 of file ShipConstField.cxx.

141 {
142 if (point[0] < fXmin || point[0] > fXmax || point[1] < fYmin ||
143 point[1] > fYmax || point[2] < fZmin || point[2] > fZmax) {
144 bField[0] = 0.;
145 bField[1] = 0.;
146 bField[2] = 0.;
147 return;
148 }
149 bField[0] = fBx;
150 bField[1] = fBy;
151 bField[2] = fBz;
152}

◆ GetXmax()

Double_t ShipConstField::GetXmax ( ) const
inline

Definition at line 77 of file ShipConstField.h.

77{ return fXmax; }

◆ GetXmin()

Double_t ShipConstField::GetXmin ( ) const
inline

Accessors to field region

Definition at line 76 of file ShipConstField.h.

76{ return fXmin; }

◆ GetYmax()

Double_t ShipConstField::GetYmax ( ) const
inline

Definition at line 79 of file ShipConstField.h.

79{ return fYmax; }

◆ GetYmin()

Double_t ShipConstField::GetYmin ( ) const
inline

Definition at line 78 of file ShipConstField.h.

78{ return fYmin; }

◆ GetZmax()

Double_t ShipConstField::GetZmax ( ) const
inline

Definition at line 81 of file ShipConstField.h.

81{ return fZmax; }

◆ GetZmin()

Double_t ShipConstField::GetZmin ( ) const
inline

Definition at line 80 of file ShipConstField.h.

80{ return fZmin; }

◆ Print()

void ShipConstField::Print ( Option_t * = "") const
override

Screen output

Definition at line 156 of file ShipConstField.cxx.

156 {
157 cout << "======================================================" << endl;
158 cout << "---- " << fTitle << " : " << fName << endl;
159 cout << "----" << endl;
160 cout << "---- Field type : constant" << endl;
161 cout << "----" << endl;
162 cout << "---- Field regions : " << endl;
163 cout << "---- x = " << setw(4) << fXmin << " to " << setw(4) << fXmax
164 << " cm" << endl;
165 cout << "---- y = " << setw(4) << fYmin << " to " << setw(4) << fYmax
166 << " cm" << endl;
167 cout << "---- z = " << setw(4) << fZmin << " to " << setw(4) << fZmax
168 << " cm" << endl;
169 cout.precision(4);
170 cout << "---- B = ( " << fBx << ", " << fBy << ", " << fBz << " ) kG"
171 << endl;
172 cout << "======================================================" << endl;
173}

◆ SetField()

void ShipConstField::SetField ( Double_t bX,
Double_t bY,
Double_t bZ )

Set the field values

Parameters
bX,bY,bZField values [kG]

Definition at line 106 of file ShipConstField.cxx.

106 {
107 fBx = bX;
108 fBy = bY;
109 fBz = bZ;
110}

◆ SetFieldRegion()

void ShipConstField::SetFieldRegion ( Double_t xMin,
Double_t xMax,
Double_t yMin,
Double_t yMax,
Double_t zMin,
Double_t zMax )

Set the field region

Parameters
xMin,xMaxx region of field (global coordinates)
yMin,yMaxy region of field (global coordinates)
zMin,zMaxz region of field (global coordinates)

Definition at line 93 of file ShipConstField.cxx.

95 {
96 fXmin = xMin;
97 fXmax = xMax;
98 fYmin = yMin;
99 fYmax = yMax;
100 fZmin = zMin;
101 fZmax = zMax;
102}

Member Data Documentation

◆ fBx

Double_t ShipConstField::fBx
private

Field components inside the field region

Definition at line 101 of file ShipConstField.h.

◆ fBy

Double_t ShipConstField::fBy
private

Definition at line 102 of file ShipConstField.h.

◆ fBz

Double_t ShipConstField::fBz
private

Definition at line 103 of file ShipConstField.h.

◆ fXmax

Double_t ShipConstField::fXmax
private

Definition at line 94 of file ShipConstField.h.

◆ fXmin

Double_t ShipConstField::fXmin
private

Limits of the field region

Definition at line 93 of file ShipConstField.h.

◆ fYmax

Double_t ShipConstField::fYmax
private

Definition at line 96 of file ShipConstField.h.

◆ fYmin

Double_t ShipConstField::fYmin
private

Definition at line 95 of file ShipConstField.h.

◆ fZmax

Double_t ShipConstField::fZmax
private

Definition at line 98 of file ShipConstField.h.

◆ fZmin

Double_t ShipConstField::fZmin
private

Definition at line 97 of file ShipConstField.h.


The documentation for this class was generated from the following files: