78 #ifndef StarMagField_H
79 #define StarMagField_H
86 #if defined (__ROOT__)
88 #include "TGeoMatrix.h"
89 #if ROOT_VERSION_CODE >= 335360
90 #include "TVirtualMagField.h"
101 enum EBField { kUndefined = 0, kConstant = 1, kMapped = 2, kChain = 3 } ;
102 enum ESmFSizes {nZ = 57, nR = 28, nPhi = 37, nZSteel = 16, nRSteel = 115, nPhiSteel = 25};
103 static void Search ( Int_t N,
const Float_t Xarray[], Float_t x, Int_t &low ) ;
104 virtual Float_t
Interpolate (
const Float_t Xarray[],
const Float_t Yarray[],
105 const Int_t ORDER,
const Float_t x ) ;
107 Float_t &Br_value, Float_t &Bz_value ) ;
108 virtual void Interpolate2ExtDBfield (
const Float_t r,
const Float_t z,
109 Float_t &Br_value, Float_t &Bz_value ) ;
111 Float_t &Br_value, Float_t &Bz_value, Float_t &Bphi_value ) ;
115 virtual void ReadField ( ) ;
117 #if defined (__ROOT__)
118 TGeoRotation fStarMagFieldRotation;
119 TH2F *fBzdZCorrection;
120 TH2F *fBrdZCorrection;
126 Float_t &Br_value, Float_t &Bz_value, Float_t &Bphi_value );
140 Float_t Bz[nZ][nR], Br[nZ][nR] ;
141 Float_t Radius[nR], ZList[nZ] ;
142 Float_t Bz3D[nPhi][nZ][nR], Br3D[nPhi][nZ][nR], Bphi3D[nPhi][nZ][nR] ;
143 Float_t R3D[nR], Z3D[nZ], Phi3D[nPhi] ;
144 Float_t R3DSteel[nRSteel], Z3DSteel[nZSteel], Phi3DSteel[nPhiSteel] ;
145 Float_t Bz3DSteel[nPhiSteel][nZSteel][nRSteel];
146 Float_t Bx3DSteel[nPhiSteel][nZSteel][nRSteel], By3DSteel[nPhiSteel][nZSteel][nRSteel] ;
147 static bool mConstBz;
150 Float_t Br3DSteel[nPhiSteel][nZSteel][nRSteel], Bphi3DSteel[nPhiSteel][nZSteel][nRSteel] ;
155 StarMagField ( EBField map = kMapped, Float_t Factor = 1,
156 Bool_t Lock = kFALSE, Float_t Rescale = 1,
157 Float_t Bdipole = -42.67, Float_t Rmaxdip = 15.34,
158 Float_t Zmindip = 980.0, Float_t Zmaxdip = 1350.0) ;
161 #if defined (__ROOT__)
162 SafeDelete(fBzdZCorrection);
163 SafeDelete(fBrdZCorrection);
168 static void setConstBz(
bool state ){ mConstBz = state; }
170 virtual void BField (
const Float_t x[], Float_t B[] ) ;
171 virtual void BField (
const Double_t x[], Double_t B[] ) ;
172 virtual void Field (
const Float_t x[], Float_t B[] ) {BField(x,B);}
173 virtual void Field (
const Double_t x[], Double_t B[] ) {BField(x,B);}
174 virtual void BrBzField(
const Float_t r,
const Float_t z, Float_t &Br_value, Float_t &Bz_value ) ;
175 virtual void B3DField (
const Float_t x[], Float_t B[] ) ;
176 virtual void B3DField (
const Double_t x[], Double_t B[] ) ;
177 virtual void BrBz3DField (
const Float_t r,
const Float_t z,
const Float_t phi,
178 Float_t &Br_value, Float_t &Bz_value, Float_t &Bphi_value ) ;
179 virtual void SetFactor (Float_t factor = 1);
180 virtual void SetRescale(Float_t factor = 1);
181 virtual void SetBDipole(Float_t m = -42.67);
182 virtual void SetRmaxDip(Float_t m = 15.3);
183 virtual void SetZminDip(Float_t m = 980.0);
184 virtual void SetZmaxDip(Float_t m = 1350.0);
185 virtual void SetLock();
186 virtual EBField GetMap() {
return fMap;}
187 virtual Float_t GetFactor() {
return fFactor;}
188 virtual Float_t GetRescale() {
return fRescale;}
189 virtual Bool_t IsLocked() {
return fLock;}
190 virtual void Print(Option_t* opt=
"")
const;
192 void SetStarMagFieldRotation(TGeoRotation &rot);
193 void SetStarMagFieldRotation(Double_t *rot);
194 const TGeoRotation &StarMagFieldRotation() {
return *&fStarMagFieldRotation;}
virtual void Interpolate3DBSteelfield(const Float_t r, const Float_t z, const Float_t phi, Float_t &Br_value, Float_t &Bz_value, Float_t &Bphi_value)
Interpolate the B field map - 3D interpolation.
virtual void Interpolate2DBfield(const Float_t r, const Float_t z, Float_t &Br_value, Float_t &Bz_value)
Interpolate the B field map - 2D interpolation.
virtual void B3DField(const Float_t x[], Float_t B[])
Bfield in Cartesian coordinates - 3D field.
static void Search(Int_t N, const Float_t Xarray[], Float_t x, Int_t &low)
Search an ordered table by starting at the most recently used point.
virtual Float_t Interpolate(const Float_t Xarray[], const Float_t Yarray[], const Int_t ORDER, const Float_t x)
Interpolate a 3x2 table (quadratic) or a 2x2 table (linear)
virtual void Interpolate3DBfield(const Float_t r, const Float_t z, const Float_t phi, Float_t &Br_value, Float_t &Bz_value, Float_t &Bphi_value)
Interpolate the B field map - 3D interpolation.
virtual void BrBzField(const Float_t r, const Float_t z, Float_t &Br_value, Float_t &Bz_value)
B field in Radial coordinates - 2D field (ie Phi symmetric)