CMS 3D CMS Logo

BFit3D.h
Go to the documentation of this file.
1 #ifndef BFit3D_h
2 #define BFit3D_h
3 
4 #include <iostream>
5 #include "HarmBasis3DCyl.h"
6 
7 //_______________________________________________________________________________
8 namespace magfieldparam {
9  class BFit3D {
10  private:
11  //The following constants are defined in BFit3D_data.h
12  static const double B_nom[4]; //Nom. field values at measurements
13  static const double C0[360][4]; //Expansion coeffs. at measurements
14  static const double C1[360][5]; //First derivatives of coeffs.
15  static const double C2[360][3]; //Second derivatives of coeffs.
16 
17  double C[360]; //interpolated expansion coeefs. for the field B_set
18 
19  bool use_spline;
20  bool signed_rad;
21  double B_set;
22 
24 
25  void SetCoeff_Linear(const double B);
26  void SetCoeff_Spline(const double B);
27 
28  public:
29  //Defaults: piecewise linear interpolation is used to calculate
30  //expansion coefficients for intermidiate field values,
31  //Signed "R" coordinate is accepted
33 
34  virtual ~BFit3D() { delete HB; }
35 
36  //Set the interpolation type (cubic spline or linear piecewise)
37  void UseSpline(const bool flag = true) { use_spline = flag; }
38 
39  //Switch between signed and unsigned "R" modes
40  void UseSignedRad(const bool flag = true) { signed_rad = flag; }
41 
42  //BASIC FUNCTION: Set nominal field
43  void SetField(const double B) {
44  if (use_spline)
46  else
48  B_set = B;
49  }
50 
51  //BASIC FUNCTION: Return field components at the point (r,z,phi)
52  void GetField(const double r, const double z, const double phi, double &Br, double &Bz, double &Bphi);
53 
54  //All the following functions are provided for diagnostic purposes
55 
56  unsigned GetLen() { return HB->GetLen(); } //Ret. the basis length
57  double GetBnom() { return B_set; } //Ret. nominal field
58  double GetC(const int k) { return C[k]; } //Ret. k-th expansion coefficient
59 
60  //The following functions return values of the k-th basis component
61  //(B_r, B_z or B_phi) at the point which is set by last GetField(...)
62  double GetBr_k(const unsigned k) { return HB->GetBr_k(k); }
63  double GetBz_k(const unsigned k) { return HB->GetBz_k(k); }
64  double GetBphi_k(const unsigned k) { return HB->GetBphi_k(k); }
65 
66  //The following functions prints the basis polynomials for the scalar
67  //field potential, B_r, B_z or B_phi.
68  void PrintPtnPoly(std::ostream &out = std::cout) { HB->PrintPtB(out); }
69  void PrintBrPoly(std::ostream &out = std::cout) { HB->PrintBrB(out); }
70  void PrintBzPoly(std::ostream &out = std::cout) { HB->PrintBzB(out); }
71  void PrintBphiPoly(std::ostream &out = std::cout) { HB->PrintBphiB(out); }
72  void PrintPoly(std::ostream &out = std::cout) { HB->Print(out); }
73  };
74 } // namespace magfieldparam
75 #endif
magfieldparam::BFit3D::GetBr_k
double GetBr_k(const unsigned k)
Definition: BFit3D.h:62
magfieldparam::HarmBasis3DCyl::PrintBzB
void PrintBzB(std::ostream &out=std::cout)
Definition: HarmBasis3DCyl.h:73
magfieldparam::BFit3D::C2
static const double C2[360][3]
Definition: BFit3D.h:15
magfieldparam::BFit3D::C0
static const double C0[360][4]
Definition: BFit3D.h:13
funct::false
false
Definition: Factorize.h:29
magfieldparam::BFit3D::HB
HarmBasis3DCyl * HB
Definition: BFit3D.h:23
magfieldparam::BFit3D::PrintBphiPoly
void PrintBphiPoly(std::ostream &out=std::cout)
Definition: BFit3D.h:71
magfieldparam::BFit3D::PrintPoly
void PrintPoly(std::ostream &out=std::cout)
Definition: BFit3D.h:72
magfieldparam::BFit3D::BFit3D
BFit3D()
Definition: BFit3D.h:32
magfieldparam::BFit3D::GetC
double GetC(const int k)
Definition: BFit3D.h:58
gather_cfg.cout
cout
Definition: gather_cfg.py:144
magfieldparam::HarmBasis3DCyl::Print
void Print(harm_poly_arr &B, std::ostream &out=std::cout)
Definition: HarmBasis3DCyl.cc:140
magfieldparam::BFit3D::~BFit3D
virtual ~BFit3D()
Definition: BFit3D.h:34
magfieldparam::BFit3D::PrintPtnPoly
void PrintPtnPoly(std::ostream &out=std::cout)
Definition: BFit3D.h:68
magfieldparam::HarmBasis3DCyl::GetLen
unsigned GetLen()
Definition: HarmBasis3DCyl.h:40
magfieldparam::BFit3D::GetBz_k
double GetBz_k(const unsigned k)
Definition: BFit3D.h:63
magfieldparam::BFit3D::UseSignedRad
void UseSignedRad(const bool flag=true)
Definition: BFit3D.h:40
magfieldparam::HarmBasis3DCyl::GetBz_k
double GetBz_k(const unsigned k)
Definition: HarmBasis3DCyl.h:60
magfieldparam::HarmBasis3DCyl
Definition: HarmBasis3DCyl.h:17
magfieldparam::BFit3D::SetField
void SetField(const double B)
Definition: BFit3D.h:43
magfieldparam::HarmBasis3DCyl::GetBphi_k
double GetBphi_k(const unsigned k)
Definition: HarmBasis3DCyl.h:61
magfieldparam::BFit3D
Definition: BFit3D.h:9
magfieldparam::HarmBasis3DCyl::PrintPtB
void PrintPtB(std::ostream &out=std::cout)
Definition: HarmBasis3DCyl.h:71
dqmdumpme.k
k
Definition: dqmdumpme.py:60
magfieldparam::BFit3D::GetBphi_k
double GetBphi_k(const unsigned k)
Definition: BFit3D.h:64
magfieldparam
Definition: BCyl.h:23
magfieldparam::HarmBasis3DCyl::PrintBrB
void PrintBrB(std::ostream &out=std::cout)
Definition: HarmBasis3DCyl.h:72
funct::true
true
Definition: Factorize.h:173
magfieldparam::BFit3D::SetCoeff_Spline
void SetCoeff_Spline(const double B)
Definition: BFit3D.cc:40
magfieldparam::BFit3D::GetField
void GetField(const double r, const double z, const double phi, double &Br, double &Bz, double &Bphi)
Definition: BFit3D.cc:73
magfieldparam::HarmBasis3DCyl::GetBr_k
double GetBr_k(const unsigned k)
Definition: HarmBasis3DCyl.h:59
magfieldparam::BFit3D::C1
static const double C1[360][5]
Definition: BFit3D.h:14
alignCSCRings.r
r
Definition: alignCSCRings.py:93
magfieldparam::BFit3D::B_set
double B_set
Definition: BFit3D.h:21
magfieldparam::HarmBasis3DCyl::PrintBphiB
void PrintBphiB(std::ostream &out=std::cout)
Definition: HarmBasis3DCyl.h:74
TtFullHadDaughter::B
static const std::string B
Definition: TtFullHadronicEvent.h:9
magfieldparam::BFit3D::GetBnom
double GetBnom()
Definition: BFit3D.h:57
magfieldparam::BFit3D::PrintBrPoly
void PrintBrPoly(std::ostream &out=std::cout)
Definition: BFit3D.h:69
magfieldparam::BFit3D::signed_rad
bool signed_rad
Definition: BFit3D.h:20
HarmBasis3DCyl.h
magfieldparam::BFit3D::B_nom
static const double B_nom[4]
Definition: BFit3D.h:12
magfieldparam::BFit3D::SetCoeff_Linear
void SetCoeff_Linear(const double B)
Definition: BFit3D.cc:11
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
magfieldparam::BFit3D::C
double C[360]
Definition: BFit3D.h:17
magfieldparam::BFit3D::use_spline
bool use_spline
Definition: BFit3D.h:19
magfieldparam::BFit3D::GetLen
unsigned GetLen()
Definition: BFit3D.h:56
magfieldparam::BFit3D::PrintBzPoly
void PrintBzPoly(std::ostream &out=std::cout)
Definition: BFit3D.h:70
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:116
magfieldparam::BFit3D::UseSpline
void UseSpline(const bool flag=true)
Definition: BFit3D.h:37