CMS 3D CMS Logo

HarmBasis3DCyl.h
Go to the documentation of this file.
1 #ifndef HarmBasis3DCyl_h
2 #define HarmBasis3DCyl_h
3 
4 #include "rz_harm_poly.h"
5 
6 namespace magfieldparam {
7 
8  typedef std::vector<rz_harm_poly> harm_poly_vec;
9  typedef std::vector<harm_poly_vec> harm_poly_arr;
10 
12  // //
13  // HarmBasis3DCyl: set of basis harmonic polynomials in cylindrical CS //
14  // //
16 
18  private:
19  unsigned Dim; //Dimension of the basis
20  unsigned Len; //Length of the basis, accounting negative M's
21 
22  int *L_k, *M_k; //Translation arrays from linear to (L,M) address;
23  double *P_k, *Br_k, *Bz_k, *Bphi_k; //Calculated values for (r,z) terms
24 
25  harm_poly_arr PtB; //Potential basis
26  harm_poly_arr BrB; //Br basis
27  harm_poly_arr BzB; //Bz basis
28  harm_poly_arr BphiB; //phi basis
29 
30  void EvalRZ(harm_poly_arr &B, double *val);
31  double GetVal(double *coeff, double *basis);
32 
33  void Print(harm_poly_arr &B, std::ostream &out = std::cout);
34 
35  public:
36  HarmBasis3DCyl(const unsigned N = 18); //The only legal constructor
37  virtual ~HarmBasis3DCyl();
38 
39  unsigned GetDim() { return Dim; }
40  unsigned GetLen() { return Len; }
41  void GetLM(const unsigned j, int &Lj, int &Mj) {
42  Lj = L_k[j];
43  Mj = M_k[j];
44  }
45 
46  //Sets point for the basis components evaluation
47  void SetPoint(const double r, const double z, const double phi) { rz_harm_poly::SetPoint(r, z, phi); }
48 
49  //Fill tables with the basis component values. SetPoint(r,z,phi)
50  //must be called before EvalXXX() calls.
51  void EvalPtn() { EvalRZ(PtB, P_k); }
52  void EvalBr() { EvalRZ(BrB, Br_k); }
53  void EvalBz() { EvalRZ(BzB, Bz_k); }
54  void EvalBphi();
55 
56  //Return the basis component value for the linear address k.
57  //EvalXXX() must be called before GetXXX_k() call
58  double GetPtn_k(const unsigned k) { return P_k[k]; }
59  double GetBr_k(const unsigned k) { return Br_k[k]; }
60  double GetBz_k(const unsigned k) { return Bz_k[k]; }
61  double GetBphi_k(const unsigned k) { return Bphi_k[k]; }
62 
63  //Return the the potential and the field component values
64  //resulted by the basis expansion with coefficients in <coeff>
65  //EvalXXX() must be called before GetXXX() call
66  double GetPtn(double *coeff) { return GetVal(coeff, P_k); }
67  double GetBr(double *coeff) { return GetVal(coeff, Br_k); }
68  double GetBz(double *coeff) { return GetVal(coeff, Bz_k); }
69  double GetBphi(double *coeff) { return GetVal(coeff, Bphi_k); }
70 
71  void PrintPtB(std::ostream &out = std::cout) { Print(PtB, out); }
72  void PrintBrB(std::ostream &out = std::cout) { Print(BrB, out); }
73  void PrintBzB(std::ostream &out = std::cout) { Print(BzB, out); }
74  void PrintBphiB(std::ostream &out = std::cout) { Print(BphiB, out); }
75  void Print(std::ostream &out = std::cout);
76 
77  }; //class HarmBasis3DCyl
78 } // namespace magfieldparam
79 
80 #endif
magfieldparam::HarmBasis3DCyl::PrintBzB
void PrintBzB(std::ostream &out=std::cout)
Definition: HarmBasis3DCyl.h:73
magfieldparam::HarmBasis3DCyl::BrB
harm_poly_arr BrB
Definition: HarmBasis3DCyl.h:26
magfieldparam::HarmBasis3DCyl::~HarmBasis3DCyl
virtual ~HarmBasis3DCyl()
Definition: HarmBasis3DCyl.cc:75
magfieldparam::HarmBasis3DCyl::BzB
harm_poly_arr BzB
Definition: HarmBasis3DCyl.h:27
magfieldparam::HarmBasis3DCyl::Len
unsigned Len
Definition: HarmBasis3DCyl.h:20
magfieldparam::HarmBasis3DCyl::EvalPtn
void EvalPtn()
Definition: HarmBasis3DCyl.h:51
magfieldparam::HarmBasis3DCyl::Bphi_k
double * Bphi_k
Definition: HarmBasis3DCyl.h:23
magfieldparam::HarmBasis3DCyl::BphiB
harm_poly_arr BphiB
Definition: HarmBasis3DCyl.h:28
magfieldparam::HarmBasis3DCyl::HarmBasis3DCyl
HarmBasis3DCyl(const unsigned N=18)
Definition: HarmBasis3DCyl.cc:12
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::HarmBasis3DCyl::GetVal
double GetVal(double *coeff, double *basis)
Definition: HarmBasis3DCyl.cc:129
magfieldparam::HarmBasis3DCyl::GetBz
double GetBz(double *coeff)
Definition: HarmBasis3DCyl.h:68
magfieldparam::HarmBasis3DCyl::GetLen
unsigned GetLen()
Definition: HarmBasis3DCyl.h:40
magfieldparam::HarmBasis3DCyl::PtB
harm_poly_arr PtB
Definition: HarmBasis3DCyl.h:25
magfieldparam::HarmBasis3DCyl::EvalBphi
void EvalBphi()
Definition: HarmBasis3DCyl.cc:107
magfieldparam::HarmBasis3DCyl::EvalRZ
void EvalRZ(harm_poly_arr &B, double *val)
Definition: HarmBasis3DCyl.cc:85
magfieldparam::HarmBasis3DCyl::GetBz_k
double GetBz_k(const unsigned k)
Definition: HarmBasis3DCyl.h:60
magfieldparam::HarmBasis3DCyl
Definition: HarmBasis3DCyl.h:17
magfieldparam::HarmBasis3DCyl::GetPtn
double GetPtn(double *coeff)
Definition: HarmBasis3DCyl.h:66
magfieldparam::HarmBasis3DCyl::GetBphi_k
double GetBphi_k(const unsigned k)
Definition: HarmBasis3DCyl.h:61
magfieldparam::HarmBasis3DCyl::Dim
unsigned Dim
Definition: HarmBasis3DCyl.h:19
rz_harm_poly.h
magfieldparam::HarmBasis3DCyl::Bz_k
double * Bz_k
Definition: HarmBasis3DCyl.h:23
N
#define N
Definition: blowfish.cc:9
magfieldparam::HarmBasis3DCyl::PrintPtB
void PrintPtB(std::ostream &out=std::cout)
Definition: HarmBasis3DCyl.h:71
dqmdumpme.k
k
Definition: dqmdumpme.py:60
magfieldparam::HarmBasis3DCyl::GetLM
void GetLM(const unsigned j, int &Lj, int &Mj)
Definition: HarmBasis3DCyl.h:41
magfieldparam
Definition: BCyl.h:23
magfieldparam::HarmBasis3DCyl::PrintBrB
void PrintBrB(std::ostream &out=std::cout)
Definition: HarmBasis3DCyl.h:72
magfieldparam::HarmBasis3DCyl::M_k
int * M_k
Definition: HarmBasis3DCyl.h:22
magfieldparam::HarmBasis3DCyl::GetBr_k
double GetBr_k(const unsigned k)
Definition: HarmBasis3DCyl.h:59
magfieldparam::HarmBasis3DCyl::EvalBr
void EvalBr()
Definition: HarmBasis3DCyl.h:52
magfieldparam::harm_poly_arr
std::vector< harm_poly_vec > harm_poly_arr
Definition: HarmBasis3DCyl.h:9
alignCSCRings.r
r
Definition: alignCSCRings.py:93
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
heppy_batch.val
val
Definition: heppy_batch.py:351
magfieldparam::rz_harm_poly::SetPoint
static void SetPoint(const double r, const double z, const double phi)
Definition: rz_harm_poly.h:63
magfieldparam::HarmBasis3DCyl::SetPoint
void SetPoint(const double r, const double z, const double phi)
Definition: HarmBasis3DCyl.h:47
magfieldparam::HarmBasis3DCyl::L_k
int * L_k
Definition: HarmBasis3DCyl.h:22
magfieldparam::HarmBasis3DCyl::GetBphi
double GetBphi(double *coeff)
Definition: HarmBasis3DCyl.h:69
magfieldparam::harm_poly_vec
std::vector< rz_harm_poly > harm_poly_vec
Definition: HarmBasis3DCyl.h:8
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
magfieldparam::HarmBasis3DCyl::GetPtn_k
double GetPtn_k(const unsigned k)
Definition: HarmBasis3DCyl.h:58
magfieldparam::HarmBasis3DCyl::EvalBz
void EvalBz()
Definition: HarmBasis3DCyl.h:53
magfieldparam::HarmBasis3DCyl::GetDim
unsigned GetDim()
Definition: HarmBasis3DCyl.h:39
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
magfieldparam::HarmBasis3DCyl::Br_k
double * Br_k
Definition: HarmBasis3DCyl.h:23
magfieldparam::HarmBasis3DCyl::P_k
double * P_k
Definition: HarmBasis3DCyl.h:23
magfieldparam::HarmBasis3DCyl::GetBr
double GetBr(double *coeff)
Definition: HarmBasis3DCyl.h:67