CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes | Static Private Attributes
magfieldparam::BFit Class Reference

#include <BFit.h>

Public Member Functions

 BFit ()
 
void GetField (double r, double z, double phi, double &Br, double &Bz, double &Bphi)
 
void SetField (double B)
 
 ~BFit ()
 

Private Attributes

rz_polyBr_base
 
rz_polyBz_base
 
double C [16]
 
double dZ
 

Static Private Attributes

static const double C_0 [16]
 
static const double C_2 [16]
 
static const double C_4 [16]
 
static const double dZ_0 = -2.62328760352034e-2
 
static const double dZ_2 = 5.94363870284212e-4
 

Detailed Description

2D parametrization of MTCC data

Date:
2011/04/16 10:20:40
Revision:
1.1
Author
V. Maroussov

Definition at line 19 of file BFit.h.

Constructor & Destructor Documentation

BFit::BFit ( )

Definition at line 85 of file BFit.cc.

References funct::C, magfieldparam::rz_poly::Diff(), and magfieldparam::rz_poly::SetOFF().

86 {
87  dZ = 0.;
88  memset(C, 0, 16*sizeof(double));
89  rz_poly *P_base = new rz_poly(16); //Potential basis
90 
91  Bz_base = new rz_poly(P_base->Diff(1)); //Bz basis
92  Bz_base->SetOFF(1); //Switch off linear term
93 
94  Br_base = new rz_poly(P_base->Diff(0)); //Br basis is shifted, so
95  Br_base->SetOFF(0); //"0" term is ignored
96 
97  delete P_base;
98 }
rz_poly * Bz_base
Definition: BFit.h:38
void SetOFF(int npoly)
Definition: rz_poly.cc:88
rz_poly * Br_base
Definition: BFit.h:39
double C[16]
Definition: BFit.h:36
rz_poly Diff(int nvar, bool keep_empty=false)
Definition: rz_poly.cc:128
magfieldparam::BFit::~BFit ( )
inline

Definition at line 44 of file BFit.h.

References Br_base, and Bz_base.

44 {delete Bz_base; delete Br_base;};
rz_poly * Bz_base
Definition: BFit.h:38
rz_poly * Br_base
Definition: BFit.h:39

Member Function Documentation

void BFit::GetField ( double  r,
double  z,
double  phi,
double &  Br,
double &  Bz,
double &  Bphi 
)

Definition at line 139 of file BFit.cc.

References funct::C.

Referenced by PolyFit2DParametrizedMagneticField::inTeslaUnchecked().

141 {
142 //Get field components in the point (r,z,phi). Always return Bphi=0.
143 //Parameters phi and Bphi introduced in order to keep interface
144 //compatible with future trully 3D version
145 //
146  double zc = z + dZ;
147 
148  Bz = Bz_base->GetSVal(r, zc, C);
149  Br = Br_base->GetSVal(r, zc, C+1);
150  Bphi = 0.;
151 }
double GetSVal(double r, double z, double *C)
Definition: rz_poly.cc:246
float float float z
rz_poly * Bz_base
Definition: BFit.h:38
rz_poly * Br_base
Definition: BFit.h:39
double C[16]
Definition: BFit.h:36
void BFit::SetField ( double  B)

Definition at line 101 of file BFit.cc.

References funct::C, and findQualityFiles::jj.

Referenced by PolyFit2DParametrizedMagneticField::PolyFit2DParametrizedMagneticField().

102 {
103 //Set nominal field [Tesla]
104 //
105  unsigned int jj;
106 
107 #ifdef BFit_PW
108  unsigned int kk = 1;
109  double w_0, w_1;
110  if (B <= B_nom[0]) {
111  dZ = Z_nom[0];
112  for (jj = 0; jj < 16; ++jj) {
113  C[jj] = B*C_nom[0][jj];
114  }
115  } else if (B >= B_nom[3]) {
116  dZ = Z_nom[3];
117  for (jj = 0; jj < 16; ++jj) {
118  C[jj] = B*C_nom[3][jj];
119  }
120  } else {
121  while (B_nom[kk] < B) ++kk;
122  w_1 = (B - B_nom[kk-1])/(B_nom[kk] - B_nom[kk-1]);
123  w_0 = 1.0 - w_1;
124  dZ = Z_nom[kk-1]*w_0 + Z_nom[kk]*w_1;
125  for (jj = 0; jj < 16; ++jj) {
126  C[jj] = B*(C_nom[kk-1][jj]*w_0 + C_nom[kk][jj]*w_1);
127  }
128  }
129 #else
130  double B2 = B*B;
131  dZ = dZ_0 + dZ_2*B2;
132  for (jj = 0; jj < 16; ++jj) {
133  C[jj] = B*((C_4[jj]*B2 + C_2[jj])*B2 + C_0[jj]);
134  }
135 #endif
136 }
double_binary B
Definition: DDStreamer.cc:234
static const double C_0[16]
Definition: BFit.h:31
static const double C_2[16]
Definition: BFit.h:32
double C[16]
Definition: BFit.h:36
static const double dZ_2
Definition: BFit.h:29
static const double dZ_0
Definition: BFit.h:28
static const double C_4[16]
Definition: BFit.h:33

Member Data Documentation

rz_poly* magfieldparam::BFit::Br_base
private

Definition at line 39 of file BFit.h.

Referenced by ~BFit().

rz_poly* magfieldparam::BFit::Bz_base
private

Definition at line 38 of file BFit.h.

Referenced by ~BFit().

double magfieldparam::BFit::C[16]
private

Definition at line 36 of file BFit.h.

const double BFit::C_0
staticprivate
Initial value:
= { 1.0, -2.52864632909442e-3,
8.76365790071351e-6, 9.19077286315044e-5,
-2.49284256023752e-6, -1.80143891826520e-5,
2.29295162454016e-7, 1.96139195659245e-6,
-3.47342625923464e-9, -1.32147627969588e-7,
-1.50735830442900e-9, 5.17724172101696e-9,
1.54539960459831e-10, -9.30914368388717e-11,
-5.20466591966397e-12, 0.0 }

Definition at line 31 of file BFit.h.

const double BFit::C_2
staticprivate
Initial value:
= { 0.0, -2.96314154618866e-4,
-6.04246295125223e-7, -2.22393436573694e-6,
2.84133631738674e-9, -2.07090716476209e-7,
2.55850963123821e-8, -1.06689136150163e-8,
-5.48842256680751e-9, 1.78987539969165e-9,
5.57809366992069e-10, -8.25055601520632e-11,
-3.18509299957904e-11, 1.11714602344300e-12,
7.90102331886296e-13, 0.0 }

Definition at line 32 of file BFit.h.

const double BFit::C_4
staticprivate
Initial value:
= { 0.0, 7.57194953855834e-6,
4.48169046115052e-9, 2.49606093449927e-8,
3.42264285146368e-9, 7.95338846845187e-9,
-1.57711106312732e-9, 1.02715424120585e-11,
2.57261485255293e-10, -2.41682937761163e-11,
-2.27894837943020e-11, 7.98570801347331e-13,
1.17889573705870e-12, 1.64571374852252e-14,
-2.60212133934707e-14, 0.0 }

Definition at line 33 of file BFit.h.

double magfieldparam::BFit::dZ
private

Definition at line 35 of file BFit.h.

const double BFit::dZ_0 = -2.62328760352034e-2
staticprivate

Definition at line 28 of file BFit.h.

const double BFit::dZ_2 = 5.94363870284212e-4
staticprivate

Definition at line 29 of file BFit.h.