CMS 3D CMS Logo

Public Member Functions | Private Attributes | Static Private Attributes

magfieldparam::BFit Class Reference

#include <BFit.h>

List of all members.

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:
2008/04/23 14:39:16
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().

{
   dZ = 0.;
   memset(C, 0, 16*sizeof(double));
   rz_poly *P_base = new rz_poly(16); //Potential basis
   
   Bz_base = new rz_poly(P_base->Diff(1));  //Bz basis
   Bz_base->SetOFF(1);                      //Switch off linear term

   Br_base = new rz_poly(P_base->Diff(0));  //Br basis is shifted, so
   Br_base->SetOFF(0);                      //"0" term is ignored
   
   delete P_base;
}
magfieldparam::BFit::~BFit ( ) [inline]

Definition at line 44 of file BFit.h.

References Br_base, and Bz_base.

{delete Bz_base; delete Br_base;};

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().

{
//Get field components in the point (r,z,phi). Always return Bphi=0. 
//Parameters phi and Bphi introduced in order to keep interface
//compatible with future trully 3D version
//
   double zc = z + dZ;

   Bz   = Bz_base->GetSVal(r, zc, C);
   Br   = Br_base->GetSVal(r, zc, C+1);
   Bphi = 0.;
}
void BFit::SetField ( double  B)

Definition at line 101 of file BFit.cc.

References funct::C.

Referenced by PolyFit2DParametrizedMagneticField::PolyFit2DParametrizedMagneticField().

{
//Set nominal field [Tesla]
//
   unsigned int jj;

#ifdef BFit_PW
   unsigned int kk = 1;
   double w_0, w_1;
   if (B <= B_nom[0]) {
      dZ = Z_nom[0];
      for (jj = 0; jj < 16; ++jj) {
         C[jj] = B*C_nom[0][jj];
      }
   } else if (B >= B_nom[3]) {
      dZ = Z_nom[3];
      for (jj = 0; jj < 16; ++jj) {
         C[jj] = B*C_nom[3][jj];
      }
   } else {
      while (B_nom[kk] < B) ++kk;
      w_1 = (B - B_nom[kk-1])/(B_nom[kk] - B_nom[kk-1]);
      w_0 = 1.0 - w_1;
      dZ = Z_nom[kk-1]*w_0 + Z_nom[kk]*w_1;
      for (jj = 0; jj < 16; ++jj) {
         C[jj] = B*(C_nom[kk-1][jj]*w_0 + C_nom[kk][jj]*w_1);
      }
   }
#else
   double B2 = B*B;
   dZ = dZ_0 + dZ_2*B2;
   for (jj = 0; jj < 16; ++jj) {
      C[jj] = B*((C_4[jj]*B2 + C_2[jj])*B2 + C_0[jj]);
   }
#endif
}

Member Data Documentation

Definition at line 39 of file BFit.h.

Referenced by ~BFit().

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 [static, private]
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 [static, private]
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 [static, private]
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 [static, private]

Definition at line 28 of file BFit.h.

const double BFit::dZ_2 = 5.94363870284212e-4 [static, private]

Definition at line 29 of file BFit.h.