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 Member Functions | Private Attributes
magfieldparam::TkBfield Class Reference

#include <TkBfield.h>

Public Member Functions

void getBrfz (double const *__restrict__ x, double *__restrict__ Brfz) const
 B out in cylindrical. More...
 
void getBxyz (double const *__restrict__ x, double *__restrict__ Bxyz) const
 B out in cartesian. More...
 
 TkBfield (std::string T="3_8T")
 
 ~TkBfield ()
 

Private Member Functions

void Bcyl (double r, double z, double *__restrict__ Bw) const
 

Private Attributes

double ainv
 
double ap2
 
double coeff
 
double hb0
 
double hlova
 
double prm [9]
 

Detailed Description

B-field in Tracker volume - based on the TOSCA computation version 1103l (tuned on MTCC measured field (fall 2006))

In: x[3]: coordinates (m) Out: B[3]: Bx,By,Bz (T) (getBxyz) Out: B[3]: Br,Bf,Bz (T) (getBrfz)

Valid for r<1.15m and |z|<2.80m

Author
V.Karimaki 080228, 080407

Definition at line 24 of file TkBfield.h.

Constructor & Destructor Documentation

TkBfield::TkBfield ( std::string  T = "3_8T")

Definition at line 13 of file TkBfield.cc.

References ainv, ap2, coeff, edm::hlt::Exception, hb0, hlova, i, p1, p2, p3, p4, prm, and mathSSE::sqrt().

13  {
14  double p1[]={4.90541,17.8768,2.02355,0.0210538,0.000321885,2.37511,0.00326725,2.07656,1.71879}; // 2.0T-2G
15  double p2[]={4.41982,15.7732,3.02621,0.0197814,0.000515759,2.43385,0.00584258,2.11333,1.76079}; // 3.0T-2G
16  double p3[]={4.30161,15.2586,3.51926,0.0183494,0.000606773,2.45110,0.00709986,2.12161,1.77038}; // 3.5T-2G
17  double p4[]={4.24326,15.0201,3.81492,0.0178712,0.000656527,2.45818,0.00778695,2.12500,1.77436}; // 3.8T-2G
18  double p5[]={4.21136,14.8824,4.01683,0.0175932,0.000695541,2.45311,0.00813447,2.11688,1.76076}; // 4.0T-2G
19  prm[0]=0;
20  if (fld=="2_0T") for (int i=0; i<9; i++) prm[i]=p1[i];
21  if (fld=="3_0T") for (int i=0; i<9; i++) prm[i]=p2[i];
22  if (fld=="3_5T") for (int i=0; i<9; i++) prm[i]=p3[i];
23  if (fld=="3_8T") for (int i=0; i<9; i++) prm[i]=p4[i];
24  if (fld=="4_0T") for (int i=0; i<9; i++) prm[i]=p5[i];
25  // cout<<std::endl<<"Instantiation of TkBfield with key "<<fld<<endl;
26  if (!prm[0]) {
27  throw cms::Exception("BadParameters") << "Undefined key - " // abort!\n";
28  <<"Defined keys are: \"2_0T\" \"3_0T\" \"3_5T\" \"3_8T\" and \"4_0T\"\n";
29  // exit(1);
30  }
31  ap2=4*prm[0]*prm[0]/(prm[1]*prm[1]);
32  hb0=0.5*prm[2]*std::sqrt(1.0+ap2);
33  hlova=1/std::sqrt(ap2);
34  ainv=2*hlova/prm[1];
35  coeff=1/(prm[8]*prm[8]);
36 }
int i
Definition: DBlmapReader.cc:9
T sqrt(T t)
Definition: SSEVec.h:46
double p4[4]
Definition: TauolaWrapper.h:92
double p2[4]
Definition: TauolaWrapper.h:90
double p1[4]
Definition: TauolaWrapper.h:89
double p3[4]
Definition: TauolaWrapper.h:91
magfieldparam::TkBfield::~TkBfield ( )
inline

Definition at line 30 of file TkBfield.h.

30 {}

Member Function Documentation

void TkBfield::Bcyl ( double  r,
double  z,
double *__restrict__  Bw 
) const
private

Definition at line 85 of file TkBfield.cc.

References abs, ainv, coeff, create_public_lumi_plots::exp, hb0, hlova, prm, and v.

Referenced by getBrfz(), and getBxyz().

85  {
86  // if (r<1.15&&fabs(z)<2.8) // NOTE: check omitted, is done already by the wrapper! (NA)
87  z-=prm[3]; // max Bz point is shifted in z
88  double az=std::abs(z);
89  double zainv=z*ainv;
90  double u=hlova-zainv;
91  double v=hlova+zainv;
92  double fu[4],gv[4];
93  ffunkti(u,fu);
94  ffunkti(v,gv);
95  double rat=0.5*r*ainv;
96  double rat2=rat*rat;
97  Bw[0]=hb0*rat*(fu[1]-gv[1]-(fu[3]-gv[3])*rat2*0.5);
98  Bw[1]=0;
99  Bw[2]=hb0*(fu[0]+gv[0]-(fu[2]+gv[2])*rat2);
100  double corBr= prm[4]*r*z*(az-prm[5])*(az-prm[5]);
101  // double corBz=-prm[6]*exp(coeff*(az-prm[7])*(az-prm[7]));
102  // double corBz=-prm[6]/(1+coeff*(az-prm[7])*(az-prm[7]));
103  // double corBz=-prm[6]*(exp(-(z-prm[7])*(z-prm[7])/(prm[8]*prm[8]))
104  // + exp(-(z+prm[7])*(z+prm[7])/(prm[8]*prm[8]))); // double Gaussian
105  double corBz=-prm[6]*(exp(-(z-prm[7])*(z-prm[7])*coeff) +
106  exp(-(z+prm[7])*(z+prm[7])*coeff)
107  ); // double Gaussian
108  Bw[0]+=corBr;
109  Bw[2]+=corBz;
110  // } else {
111  // cout <<"TkBfield: The point is outside the region r<1.15m && |z|<2.8m"<<endl;
112 }
#define abs(x)
Definition: mlp_lapack.h:159
double double double z
mathSSE::Vec4< T > v
void TkBfield::getBrfz ( double const *__restrict__  x,
double *__restrict__  Brfz 
) const

B out in cylindrical.

Definition at line 116 of file TkBfield.cc.

References Bcyl(), and mathSSE::sqrt().

116  {
117  Bcyl(sqrt(x[0]*x[0]+x[1]*x[1]),x[2], Brfz);
118 }
T sqrt(T t)
Definition: SSEVec.h:46
x
Definition: VDTMath.h:216
void Bcyl(double r, double z, double *__restrict__ Bw) const
Definition: TkBfield.cc:85
void TkBfield::getBxyz ( double const *__restrict__  x,
double *__restrict__  Bxyz 
) const

B out in cartesian.

Definition at line 120 of file TkBfield.cc.

References Bcyl(), alignCSCRings::r, and mathSSE::sqrt().

Referenced by OAEParametrizedMagneticField::inTeslaUnchecked().

120  {
121  double Bw[3];
122  double r=sqrt(x[0]*x[0]+x[1]*x[1]);
123  Bcyl(r, x[2], Bw);
124  double rinv=(r>0) ? 1/r:0;
125  Bxyz[0]=Bw[0]*x[0]*rinv;
126  Bxyz[1]=Bw[0]*x[1]*rinv;
127  Bxyz[2]=Bw[2];
128 }
T sqrt(T t)
Definition: SSEVec.h:46
x
Definition: VDTMath.h:216
void Bcyl(double r, double z, double *__restrict__ Bw) const
Definition: TkBfield.cc:85

Member Data Documentation

double magfieldparam::TkBfield::ainv
private

Definition at line 39 of file TkBfield.h.

Referenced by Bcyl(), and TkBfield().

double magfieldparam::TkBfield::ap2
private

Definition at line 39 of file TkBfield.h.

Referenced by TkBfield().

double magfieldparam::TkBfield::coeff
private

Definition at line 39 of file TkBfield.h.

Referenced by Bcyl(), and TkBfield().

double magfieldparam::TkBfield::hb0
private

Definition at line 39 of file TkBfield.h.

Referenced by Bcyl(), and TkBfield().

double magfieldparam::TkBfield::hlova
private

Definition at line 39 of file TkBfield.h.

Referenced by Bcyl(), and TkBfield().

double magfieldparam::TkBfield::prm[9]
private

Definition at line 38 of file TkBfield.h.

Referenced by Bcyl(), and TkBfield().