CMS 3D CMS Logo

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) const
 
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

Author
V. Maroussov

Definition at line 15 of file BFit.h.

Constructor & Destructor Documentation

◆ BFit()

BFit::BFit ( )

Definition at line 137 of file BFit.cc.

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

137  {
138  dZ = 0.;
139  memset(C, 0, 16 * sizeof(double));
140  rz_poly *P_base = new rz_poly(16); //Potential basis
141 
142  Bz_base = new rz_poly(P_base->Diff(1)); //Bz basis
143  Bz_base->SetOFF(1); //Switch off linear term
144 
145  Br_base = new rz_poly(P_base->Diff(0)); //Br basis is shifted, so
146  Br_base->SetOFF(0); //"0" term is ignored
147 
148  delete P_base;
149 }
rz_poly * Bz_base
Definition: BFit.h:32
void SetOFF(int npoly)
Definition: rz_poly.cc:92
rz_poly * Br_base
Definition: BFit.h:33
double C[16]
Definition: BFit.h:30
rz_poly Diff(int nvar, bool keep_empty=false)
Definition: rz_poly.cc:132

◆ ~BFit()

magfieldparam::BFit::~BFit ( )
inline

Definition at line 37 of file BFit.h.

References Br_base, and Bz_base.

37  {
38  delete Bz_base;
39  delete Br_base;
40  };
rz_poly * Bz_base
Definition: BFit.h:32
rz_poly * Br_base
Definition: BFit.h:33

Member Function Documentation

◆ GetField()

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

Definition at line 190 of file BFit.cc.

References correctionTermsCaloMet_cff::C, and alignCSCRings::r.

Referenced by PolyFit2DParametrizedMagneticField::inTeslaUnchecked().

190  {
191  //Get field components in the point (r,z,phi). Always return Bphi=0.
192  //Parameters phi and Bphi introduced in order to keep interface
193  //compatible with future trully 3D version
194  //
195  double zc = z + dZ;
196 
197  Bz = Bz_base->GetSVal(r, zc, C);
198  Br = Br_base->GetSVal(r, zc, C + 1);
199  Bphi = 0.;
200 }
rz_poly * Bz_base
Definition: BFit.h:32
rz_poly * Br_base
Definition: BFit.h:33
double C[16]
Definition: BFit.h:30
double GetSVal(double r, double z, const double *C) const
Definition: rz_poly.cc:257

◆ SetField()

void BFit::SetField ( double  B)

Definition at line 152 of file BFit.cc.

References B, correctionTermsCaloMet_cff::C, findQualityFiles::jj, and GetRecoTauVFromDQM_MC_cff::kk.

Referenced by PolyFit2DParametrizedMagneticField::PolyFit2DParametrizedMagneticField().

152  {
153  //Set nominal field [Tesla]
154  //
155  unsigned int jj;
156 
157 #ifdef BFit_PW
158  unsigned int kk = 1;
159  double w_0, w_1;
160  if (B <= B_nom[0]) {
161  dZ = Z_nom[0];
162  for (jj = 0; jj < 16; ++jj) {
163  C[jj] = B * C_nom[0][jj];
164  }
165  } else if (B >= B_nom[3]) {
166  dZ = Z_nom[3];
167  for (jj = 0; jj < 16; ++jj) {
168  C[jj] = B * C_nom[3][jj];
169  }
170  } else {
171  while (B_nom[kk] < B)
172  ++kk;
173  w_1 = (B - B_nom[kk - 1]) / (B_nom[kk] - B_nom[kk - 1]);
174  w_0 = 1.0 - w_1;
175  dZ = Z_nom[kk - 1] * w_0 + Z_nom[kk] * w_1;
176  for (jj = 0; jj < 16; ++jj) {
177  C[jj] = B * (C_nom[kk - 1][jj] * w_0 + C_nom[kk][jj] * w_1);
178  }
179  }
180 #else
181  double B2 = B * B;
182  dZ = dZ_0 + dZ_2 * B2;
183  for (jj = 0; jj < 16; ++jj) {
184  C[jj] = B * ((C_4[jj] * B2 + C_2[jj]) * B2 + C_0[jj]);
185  }
186 #endif
187 }
Definition: APVGainStruct.h:7
static const double C_0[16]
Definition: BFit.h:25
static const double C_2[16]
Definition: BFit.h:26
double C[16]
Definition: BFit.h:30
static const double dZ_2
Definition: BFit.h:23
static const double dZ_0
Definition: BFit.h:22
static const double C_4[16]
Definition: BFit.h:27

Member Data Documentation

◆ Br_base

rz_poly* magfieldparam::BFit::Br_base
private

Definition at line 33 of file BFit.h.

Referenced by ~BFit().

◆ Bz_base

rz_poly* magfieldparam::BFit::Bz_base
private

Definition at line 32 of file BFit.h.

Referenced by ~BFit().

◆ C

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

Definition at line 30 of file BFit.h.

◆ C_0

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 25 of file BFit.h.

◆ C_2

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 26 of file BFit.h.

◆ C_4

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 27 of file BFit.h.

◆ dZ

double magfieldparam::BFit::dZ
private

Definition at line 29 of file BFit.h.

◆ dZ_0

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

Definition at line 22 of file BFit.h.

◆ dZ_2

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

Definition at line 23 of file BFit.h.