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

#include <ShipBellField.h>

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

Public Member Functions

 ShipBellField ()
 ShipBellField (const char *name, Double_t Bpeak, Double_t Zmiddle, Int_t fOrient=1, Double_t Btube=500.)
 ShipBellField (ShipFieldPar *fieldPar)
 ~ShipBellField () override
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 IncludeTarget (Double_t xy, Double_t z, Double_t l)
void Print (Option_t *="") const override

Private Member Functions

 ClassDefOverride (ShipBellField, 2)

Private Attributes

Double_t fPeak
Double_t fMiddle
Double_t fBtube
Int_t fOrient {1}
Bool_t fInclTarget
Double_t targetXY
Double_t targetZ0
Double_t targetL

Detailed Description

Definition at line 26 of file ShipBellField.h.

Constructor & Destructor Documentation

◆ ShipBellField() [1/3]

ShipBellField::ShipBellField ( )

Default constructor

Definition at line 28 of file ShipBellField.cxx.

29 : FairField(), fPeak(0.), fMiddle(0.), fBtube(0.) {
30 fType = 1;
31 fInclTarget = kFALSE;
32}
Double_t fMiddle
Double_t fBtube

◆ ShipBellField() [2/3]

ShipBellField::ShipBellField ( const char * name,
Double_t Bpeak,
Double_t Zmiddle,
Int_t fOrient = 1,
Double_t Btube = 500. )
explicit

Standard constructor

Parameters
nameObject name
Bpeakpeak field..
Zmiddlemiddle of the magnet (global coordinates)
Btubelargest radius of the tube ellips (inside)

Definition at line 36 of file ShipBellField.cxx.

38 : FairField(name), fPeak(Peak), fMiddle(Middle), fBtube(Btube) {
39 fType = 1;
40 fInclTarget = kFALSE;
41 fOrient = orientation;
42 fBtube = Btube;
43}

◆ ShipBellField() [3/3]

ShipBellField::ShipBellField ( ShipFieldPar * fieldPar)
explicit

Constructor from ShipFieldPar

Definition at line 47 of file ShipBellField.cxx.

48 : FairField(), fPeak(0.), fMiddle(0.), fBtube(0.), fInclTarget(kFALSE) {
49 if (!fieldPar) {
50 cerr << "-W- ShipBellField::ShipBellField: empty parameter container!"
51 << endl;
52 fType = 0;
53 } else {
54 fPeak = fieldPar->GetPeak();
55 fMiddle = fieldPar->GetMiddle();
56 fBtube = fieldPar->GetBtube();
57 fType = fieldPar->GetType();
58 }
59}
Double_t GetMiddle() const
Double_t GetPeak() const
Int_t GetType() const
Double_t GetBtube() const

◆ ~ShipBellField()

ShipBellField::~ShipBellField ( )
overridedefault

Destructor

Member Function Documentation

◆ ClassDefOverride()

ShipBellField::ClassDefOverride ( ShipBellField ,
2  )
private

◆ GetBx()

Double_t ShipBellField::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 74 of file ShipBellField.cxx.

74 {
75 if (fOrient == 1) {
76 return 0.;
77 } else {
78 Double_t zlocal = fabs(z - fMiddle) / 100.; // zlocal: convert cm->m
79 // old Bell field from Wilfried Flegel
80 // Double_t bx= fPeak/(1.+pow(fabs(zlocal)/2.1,6.));
81 // new field based on simulation of Davide Tommasini (22/1/2015)
82
83 Double_t bx = 0.;
84 // field in box 20 cm larger than inner tube.
85 if ((fabs(x) < 2.7 * m) && (fabs(y) < fBtube + 0.2 * m)) {
86 if (zlocal < 3.8) {
87 bx = 0.14361 * exp(-0.5 * pow((zlocal - 0.45479E-01) / 2.5046, 2.));
88 } else if (zlocal < 11.9) {
89 bx = 0.19532 - 0.61512E-01 * zlocal + 0.68447E-02 * pow(zlocal, 2.) -
90 0.25672E-03 * pow(zlocal, 3.);
91 }
92 bx = ((fPeak / tesla) / 0.14361) * bx * tesla;
93 }
94 // cout << "Bell GetBX " << x << ", " << y << ", " << z << ", Bx= " << bx <<
95 // endl;
96 return bx;
97 }
98}
constexpr Double_t tesla
constexpr Double_t m

◆ GetBy()

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

Definition at line 103 of file ShipBellField.cxx.

103 {
104 Double_t by = 0.;
105 if (fInclTarget && z < targetZ0 + targetL && z > targetZ0) {
106 // check if in target area
107 if (fabs(x) < targetXY && fabs(y) < targetXY) {
108 by = 1 * tesla;
109 }
110 if (fabs(x) > 2 * targetXY && fabs(x) < 3 * targetXY &&
111 fabs(y) < targetXY) {
112 by = -1 * tesla;
113 }
114 } else if (fOrient == 1) {
115 Double_t zlocal = (z - fMiddle) / 100.;
116 by = fPeak / (1. + pow(fabs(zlocal) / 2.1, 6.));
117 // cout << "Bell GetBY " << z << ", By= " << by << endl;
118 }
119 return by;
120}
Double_t targetZ0
Double_t targetXY

◆ GetBz()

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

Definition at line 124 of file ShipBellField.cxx.

124{ return 0.; }

◆ IncludeTarget()

void ShipBellField::IncludeTarget ( Double_t xy,
Double_t z,
Double_t l )

Definition at line 67 of file ShipBellField.cxx.

67 {
68 fInclTarget = kTRUE;
69 targetXY = xy;
70 targetZ0 = z;
71 targetL = l;
72}
Double_t targetL

◆ Print()

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

Screen output

Definition at line 128 of file ShipBellField.cxx.

128 {
129 cout << "======================================================" << endl;
130 cout << "---- " << fTitle << " : " << fName << endl;
131 cout << "----" << endl;
132 cout << "---- Field type : Bell" << endl;
133 cout << "----" << endl;
134 cout.precision(4);
135 cout << "---- Peak field : " << fPeak << " kG" << endl;
136 cout << "---- Middle (z centre) : " << fMiddle << " cm" << endl;
137 cout << "---- Btube : " << fBtube << " cm" << endl;
138 cout << "---- Orientation : " << fOrient << endl;
139 cout << "---- Include target : " << (fInclTarget ? "yes" : "no") << endl;
140 cout << "======================================================" << endl;
141}

Member Data Documentation

◆ fBtube

Double_t ShipBellField::fBtube
private

Definition at line 62 of file ShipBellField.h.

◆ fInclTarget

Bool_t ShipBellField::fInclTarget
private

Definition at line 64 of file ShipBellField.h.

◆ fMiddle

Double_t ShipBellField::fMiddle
private

Definition at line 61 of file ShipBellField.h.

◆ fOrient

Int_t ShipBellField::fOrient {1}
private

Definition at line 63 of file ShipBellField.h.

63{1};

◆ fPeak

Double_t ShipBellField::fPeak
private

Field parameters

Definition at line 60 of file ShipBellField.h.

◆ targetL

Double_t ShipBellField::targetL
private

Definition at line 67 of file ShipBellField.h.

◆ targetXY

Double_t ShipBellField::targetXY
private

Definition at line 65 of file ShipBellField.h.

◆ targetZ0

Double_t ShipBellField::targetZ0
private

Definition at line 66 of file ShipBellField.h.


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