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.

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 }

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

◆ ~BFit()

magfieldparam::BFit::~BFit ( )
inline

Definition at line 37 of file BFit.h.

37  {
38  delete Bz_base;
39  delete Br_base;
40  };

References Br_base, and Bz_base.

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.

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 }

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

Referenced by PolyFit2DParametrizedMagneticField::inTeslaUnchecked().

◆ SetField()

void BFit::SetField ( double  B)

Definition at line 152 of file BFit.cc.

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 }

References TtFullHadDaughter::B, gen::C, findQualityFiles::jj, and GetRecoTauVFromDQM_MC_cff::kk.

Referenced by PolyFit2DParametrizedMagneticField::PolyFit2DParametrizedMagneticField().

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.

magfieldparam::rz_poly::SetOFF
void SetOFF(int npoly)
Definition: rz_poly.cc:92
magfieldparam::BFit::C_0
static const double C_0[16]
Definition: BFit.h:25
magfieldparam::rz_poly::GetSVal
double GetSVal(double r, double z, const double *C) const
Definition: rz_poly.cc:257
magfieldparam::rz_poly::Diff
rz_poly Diff(int nvar, bool keep_empty=false)
Definition: rz_poly.cc:132
DDAxes::z
GetRecoTauVFromDQM_MC_cff.kk
kk
Definition: GetRecoTauVFromDQM_MC_cff.py:84
magfieldparam::BFit::dZ_2
static const double dZ_2
Definition: BFit.h:23
magfieldparam::BFit::C_2
static const double C_2[16]
Definition: BFit.h:26
magfieldparam::rz_poly
Definition: rz_poly.h:26
magfieldparam::BFit::C_4
static const double C_4[16]
Definition: BFit.h:27
magfieldparam::BFit::dZ_0
static const double dZ_0
Definition: BFit.h:22
alignCSCRings.r
r
Definition: alignCSCRings.py:93
magfieldparam::BFit::Br_base
rz_poly * Br_base
Definition: BFit.h:33
TtFullHadDaughter::B
static const std::string B
Definition: TtFullHadronicEvent.h:9
findQualityFiles.jj
string jj
Definition: findQualityFiles.py:188
magfieldparam::BFit::C
double C[16]
Definition: BFit.h:30
magfieldparam::BFit::Bz_base
rz_poly * Bz_base
Definition: BFit.h:32
magfieldparam::BFit::dZ
double dZ
Definition: BFit.h:29