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::HarmBasis3DCyl Class Reference

#include <HarmBasis3DCyl.h>

Public Member Functions

void EvalBphi ()
 
void EvalBr ()
 
void EvalBz ()
 
void EvalPtn ()
 
double GetBphi (double *coeff)
 
double GetBphi_k (const unsigned k)
 
double GetBr (double *coeff)
 
double GetBr_k (const unsigned k)
 
double GetBz (double *coeff)
 
double GetBz_k (const unsigned k)
 
unsigned GetDim ()
 
unsigned GetLen ()
 
void GetLM (const unsigned j, int &Lj, int &Mj)
 
double GetPtn (double *coeff)
 
double GetPtn_k (const unsigned k)
 
 HarmBasis3DCyl (const unsigned N=18)
 
void Print (std::ostream &out=std::cout)
 
void PrintBphiB (std::ostream &out=std::cout)
 
void PrintBrB (std::ostream &out=std::cout)
 
void PrintBzB (std::ostream &out=std::cout)
 
void PrintPtB (std::ostream &out=std::cout)
 
void SetPoint (const double r, const double z, const double phi)
 
virtual ~HarmBasis3DCyl ()
 

Private Member Functions

void EvalRZ (harm_poly_arr &B, double *val)
 
double GetVal (double *coeff, double *basis)
 
void Print (harm_poly_arr &B, std::ostream &out=std::cout)
 

Private Attributes

double * Bphi_k
 
harm_poly_arr BphiB
 
double * Br_k
 
harm_poly_arr BrB
 
double * Bz_k
 
harm_poly_arr BzB
 
unsigned Dim
 
int * L_k
 
unsigned Len
 
int * M_k
 
double * P_k
 
harm_poly_arr PtB
 

Detailed Description

Definition at line 17 of file HarmBasis3DCyl.h.

Constructor & Destructor Documentation

HarmBasis3DCyl::HarmBasis3DCyl ( const unsigned  N = 18)

Definition at line 13 of file HarmBasis3DCyl.cc.

References Bphi_k, BphiB, Br_k, BrB, Bz_k, BzB, Dim, magfieldparam::poly2d_base::IncNPwr(), roll_playback::k, dttmaxenums::L, L_k, Len, M_k, N, P_k, and PtB.

14 {
15 //Construct a basis of dimension N
16 //
17  Dim = N;
18  Len = N*(N+2);
19 
20  L_k = new int [Len];
21  M_k = new int [Len];
22 
23  P_k = new double [Len];
24  Br_k = new double [Len];
25  Bz_k = new double [Len];
26  Bphi_k = new double [Len];
27 
28  PtB.reserve(N);
29  BrB.reserve(N);
30  BzB.reserve(N);
31  BphiB.reserve(N);
32 
33  rz_harm_poly::IncNPwr(N); //In order to prevent GetMaxPow() calls
34  unsigned M, vLen, k = 0;
35  for (unsigned L = 1; L <= N; ++L) {
36  vLen = L+1;
37  harm_poly_vec Pt_vec; Pt_vec.reserve(vLen);
38  harm_poly_vec Br_vec; Br_vec.reserve(vLen);
39  harm_poly_vec Bz_vec; Bz_vec.reserve(vLen);
40  harm_poly_vec Bphi_vec; Bphi_vec.reserve(vLen);
41 
42  Pt_vec.push_back (rz_harm_poly(L));
43  Br_vec.push_back (Pt_vec[0].GetDiff(0));
44  Bz_vec.push_back (Pt_vec[0].GetDiff(1));
45  Bphi_vec.push_back(rz_harm_poly());
46  Bphi_vec[0].CheatL(L);
47 
48  L_k[k] = L; M_k[k] = 0; ++k;
49 
50  for (M = 1; M <= L; ++M) {
51  Pt_vec.push_back (Pt_vec[M-1].LadderUp());
52  Br_vec.push_back (Pt_vec[M].GetDiff(0));
53  Bz_vec.push_back (Pt_vec[M].GetDiff(1));
54  Bphi_vec.push_back(Pt_vec[M].GetDecPow(0));
55  Bphi_vec[M].Scale(M);
56  L_k[k] = L; M_k[k] = M; ++k;
57  L_k[k] = L; M_k[k] = -M; ++k;
58  }
59  PtB.push_back (Pt_vec);
60  BrB.push_back (Br_vec);
61  BzB.push_back (Bz_vec);
62  BphiB.push_back(Bphi_vec);
63  }
64 }
static void IncNPwr(const unsigned N)
Definition: poly2d_base.h:72
std::vector< rz_harm_poly > harm_poly_vec
Definition: HarmBasis3DCyl.h:8
#define N
Definition: blowfish.cc:9
HarmBasis3DCyl::~HarmBasis3DCyl ( )
virtual

Definition at line 67 of file HarmBasis3DCyl.cc.

References Bphi_k, Br_k, Bz_k, L_k, M_k, and P_k.

68 {
69  delete [] Bphi_k;
70  delete [] Bz_k;
71  delete [] Br_k;
72  delete [] P_k;
73  delete [] M_k;
74  delete [] L_k;
75 }

Member Function Documentation

void HarmBasis3DCyl::EvalBphi ( )

Definition at line 98 of file HarmBasis3DCyl.cc.

References Bphi_k, BphiB, Dim, magfieldparam::poly2d_base::Eval(), magfieldparam::rz_harm_poly::GetCos(), magfieldparam::rz_harm_poly::GetSin(), roll_playback::k, dttmaxenums::L, and P.

Referenced by magfieldparam::BFit3D::GetField().

99 {
100 //Fills the array Bphi_k[Len] with values of phi-basis polynomials.
101 //
102  unsigned M;
103  double V;
104  double *val = Bphi_k;
105  rz_harm_poly *P;
106  for (unsigned L = 1, k = 0; L <= Dim; ++L, ++k) {
107  (*val) = 0.; ++val;
108  for (M = 1; M <= L; ++M) {
109  P = &(BphiB[k][M]);
110  V = P->Eval();
111  (*val) = -V*P->GetSin(); ++val;
112  (*val) = V*P->GetCos(); ++val;
113  }
114  }
115 }
#define P
void magfieldparam::HarmBasis3DCyl::EvalBr ( )
inline

Definition at line 51 of file HarmBasis3DCyl.h.

References Br_k, BrB, and EvalRZ().

Referenced by magfieldparam::BFit3D::GetField().

51 { EvalRZ(BrB, Br_k);}
void EvalRZ(harm_poly_arr &B, double *val)
void magfieldparam::HarmBasis3DCyl::EvalBz ( )
inline

Definition at line 52 of file HarmBasis3DCyl.h.

References Bz_k, BzB, and EvalRZ().

Referenced by magfieldparam::BFit3D::GetField().

52 { EvalRZ(BzB, Bz_k);}
void EvalRZ(harm_poly_arr &B, double *val)
void magfieldparam::HarmBasis3DCyl::EvalPtn ( )
inline

Definition at line 50 of file HarmBasis3DCyl.h.

References EvalRZ(), P_k, and PtB.

50 { EvalRZ(PtB, P_k);}
void EvalRZ(harm_poly_arr &B, double *val)
void HarmBasis3DCyl::EvalRZ ( harm_poly_arr B,
double *  val 
)
private

Definition at line 78 of file HarmBasis3DCyl.cc.

References Dim, magfieldparam::poly2d_base::Eval(), magfieldparam::rz_harm_poly::GetCos(), magfieldparam::rz_harm_poly::GetSin(), roll_playback::k, dttmaxenums::L, and P.

Referenced by EvalBr(), EvalBz(), and EvalPtn().

79 {
80 //Fills the linear array val[Len] with values of basis polynomials.
81 //Private function, intended for internal use only.
82 //
83  unsigned M;
84  double V;
85  rz_harm_poly *P;
86  for (unsigned L = 1, k = 0; L <= Dim; ++L, ++k) {
87  (*val) = B[k][0].Eval(); ++val;
88  for (M = 1; M <= L; ++M) {
89  P = &(B[k][M]);
90  V = P->Eval();
91  (*val) = V*P->GetCos(); ++val;
92  (*val) = V*P->GetSin(); ++val;
93  }
94  }
95 }
#define P
double magfieldparam::HarmBasis3DCyl::GetBphi ( double *  coeff)
inline

Definition at line 68 of file HarmBasis3DCyl.h.

References Bphi_k, and GetVal().

Referenced by magfieldparam::BFit3D::GetField().

68 { return GetVal(coeff, Bphi_k);}
double GetVal(double *coeff, double *basis)
double magfieldparam::HarmBasis3DCyl::GetBphi_k ( const unsigned  k)
inline

Definition at line 60 of file HarmBasis3DCyl.h.

References Bphi_k, and roll_playback::k.

Referenced by magfieldparam::BFit3D::GetBphi_k().

60 { return Bphi_k[k];}
double magfieldparam::HarmBasis3DCyl::GetBr ( double *  coeff)
inline

Definition at line 66 of file HarmBasis3DCyl.h.

References Br_k, and GetVal().

Referenced by magfieldparam::BFit3D::GetField().

66 { return GetVal(coeff, Br_k);}
double GetVal(double *coeff, double *basis)
double magfieldparam::HarmBasis3DCyl::GetBr_k ( const unsigned  k)
inline

Definition at line 58 of file HarmBasis3DCyl.h.

References Br_k, and roll_playback::k.

Referenced by magfieldparam::BFit3D::GetBr_k().

58 { return Br_k[k];}
double magfieldparam::HarmBasis3DCyl::GetBz ( double *  coeff)
inline

Definition at line 67 of file HarmBasis3DCyl.h.

References Bz_k, and GetVal().

Referenced by magfieldparam::BFit3D::GetField().

67 { return GetVal(coeff, Bz_k);}
double GetVal(double *coeff, double *basis)
double magfieldparam::HarmBasis3DCyl::GetBz_k ( const unsigned  k)
inline

Definition at line 59 of file HarmBasis3DCyl.h.

References Bz_k, and roll_playback::k.

Referenced by magfieldparam::BFit3D::GetBz_k().

59 { return Bz_k[k];}
unsigned magfieldparam::HarmBasis3DCyl::GetDim ( )
inline

Definition at line 40 of file HarmBasis3DCyl.h.

References Dim.

40 { return Dim;}
unsigned magfieldparam::HarmBasis3DCyl::GetLen ( )
inline

Definition at line 41 of file HarmBasis3DCyl.h.

References Len.

Referenced by magfieldparam::BFit3D::GetLen().

41 { return Len;}
void magfieldparam::HarmBasis3DCyl::GetLM ( const unsigned  j,
int &  Lj,
int &  Mj 
)
inline

Definition at line 42 of file HarmBasis3DCyl.h.

References j, L_k, and M_k.

42 { Lj = L_k[j]; Mj = M_k[j];}
int j
Definition: DBlmapReader.cc:9
double magfieldparam::HarmBasis3DCyl::GetPtn ( double *  coeff)
inline

Definition at line 65 of file HarmBasis3DCyl.h.

References GetVal(), and P_k.

65 { return GetVal(coeff, P_k);}
double GetVal(double *coeff, double *basis)
double magfieldparam::HarmBasis3DCyl::GetPtn_k ( const unsigned  k)
inline

Definition at line 57 of file HarmBasis3DCyl.h.

References roll_playback::k, and P_k.

57 { return P_k[k];}
double HarmBasis3DCyl::GetVal ( double *  coeff,
double *  basis 
)
private

Definition at line 118 of file HarmBasis3DCyl.cc.

References roll_playback::k, Len, and S().

Referenced by GetBphi(), GetBr(), GetBz(), and GetPtn().

119 {
120 //return value of the expansion with coefficients coeff[Len] for the basis
121 //Private function, intended for internal use only.
122 //
123  double S = 0.;
124  for (unsigned k = 0; k < Len; ++k) S += coeff[k]*basis[k];
125  return S;
126 }
double S(const TLorentzVector &, const TLorentzVector &)
Definition: Particle.cc:99
void HarmBasis3DCyl::Print ( harm_poly_arr B,
std::ostream &  out = std::cout 
)
private

Definition at line 129 of file HarmBasis3DCyl.cc.

Referenced by PrintBphiB(), PrintBrB(), PrintBzB(), magfieldparam::BFit3D::PrintPoly(), and PrintPtB().

130 {
131  unsigned jL, jM, wdt = 60;
132  char fc1 = '-', fc0 = out.fill(fc1);
133  for (jL = 0; jL < B.size(); ++jL) {
134  out << std::setw(wdt) << fc1 << std::endl;
135  out << "Basis subset " << jL+1 << std::endl;
136  out << std::setw(wdt) << fc1 << std::endl;
137  for (jM = 0; jM < B[jL].size(); ++jM) {
138  B[jL][jM].Print(out);
139  }
140  }
141  out.fill(fc0);
142 }
tuple out
Definition: dbtoconf.py:99
void HarmBasis3DCyl::Print ( std::ostream &  out = std::cout)

Definition at line 145 of file HarmBasis3DCyl.cc.

References PrintBphiB(), PrintBrB(), PrintBzB(), and PrintPtB().

146 {
147  out << "BASIS POLYNOMIALS FOR THE POTENTIAL:\n" << std::endl;
148  PrintPtB(out);
149  out << "\nBASIS POLYNOMIALS FOR R-COMPONENT OF THE FIELD:\n" << std::endl;
150  PrintBrB(out);
151  out << "\nBASIS POLYNOMIALS FOR Z-COMPONENT OF THE FIELD:\n" << std::endl;
152  PrintBzB(out);
153  out << "\nBASIS POLYNOMIALS FOR PHI-COMPONENT OF THE FIELD:\n" << std::endl;
154  PrintBphiB(out);
155 }
void PrintBrB(std::ostream &out=std::cout)
void PrintBphiB(std::ostream &out=std::cout)
tuple out
Definition: dbtoconf.py:99
void PrintBzB(std::ostream &out=std::cout)
void PrintPtB(std::ostream &out=std::cout)
void magfieldparam::HarmBasis3DCyl::PrintBphiB ( std::ostream &  out = std::cout)
inline

Definition at line 73 of file HarmBasis3DCyl.h.

References BphiB, dbtoconf::out, and Print().

Referenced by Print(), and magfieldparam::BFit3D::PrintBphiPoly().

73 { Print(BphiB, out);}
tuple out
Definition: dbtoconf.py:99
void Print(harm_poly_arr &B, std::ostream &out=std::cout)
void magfieldparam::HarmBasis3DCyl::PrintBrB ( std::ostream &  out = std::cout)
inline

Definition at line 71 of file HarmBasis3DCyl.h.

References BrB, dbtoconf::out, and Print().

Referenced by Print(), and magfieldparam::BFit3D::PrintBrPoly().

71 { Print(BrB, out);}
tuple out
Definition: dbtoconf.py:99
void Print(harm_poly_arr &B, std::ostream &out=std::cout)
void magfieldparam::HarmBasis3DCyl::PrintBzB ( std::ostream &  out = std::cout)
inline

Definition at line 72 of file HarmBasis3DCyl.h.

References BzB, dbtoconf::out, and Print().

Referenced by Print(), and magfieldparam::BFit3D::PrintBzPoly().

72 { Print(BzB, out);}
tuple out
Definition: dbtoconf.py:99
void Print(harm_poly_arr &B, std::ostream &out=std::cout)
void magfieldparam::HarmBasis3DCyl::PrintPtB ( std::ostream &  out = std::cout)
inline

Definition at line 70 of file HarmBasis3DCyl.h.

References dbtoconf::out, Print(), and PtB.

Referenced by Print(), and magfieldparam::BFit3D::PrintPtnPoly().

70 { Print(PtB, out);}
tuple out
Definition: dbtoconf.py:99
void Print(harm_poly_arr &B, std::ostream &out=std::cout)
void magfieldparam::HarmBasis3DCyl::SetPoint ( const double  r,
const double  z,
const double  phi 
)
inline

Definition at line 45 of file HarmBasis3DCyl.h.

References magfieldparam::rz_harm_poly::SetPoint().

Referenced by magfieldparam::BFit3D::GetField().

float float float z
static void SetPoint(const double r, const double z, const double phi)
Definition: rz_harm_poly.h:67
Definition: DDAxes.h:10

Member Data Documentation

double * magfieldparam::HarmBasis3DCyl::Bphi_k
private

Definition at line 24 of file HarmBasis3DCyl.h.

Referenced by EvalBphi(), GetBphi(), GetBphi_k(), HarmBasis3DCyl(), and ~HarmBasis3DCyl().

harm_poly_arr magfieldparam::HarmBasis3DCyl::BphiB
private

Definition at line 29 of file HarmBasis3DCyl.h.

Referenced by EvalBphi(), HarmBasis3DCyl(), and PrintBphiB().

double * magfieldparam::HarmBasis3DCyl::Br_k
private

Definition at line 24 of file HarmBasis3DCyl.h.

Referenced by EvalBr(), GetBr(), GetBr_k(), HarmBasis3DCyl(), and ~HarmBasis3DCyl().

harm_poly_arr magfieldparam::HarmBasis3DCyl::BrB
private

Definition at line 27 of file HarmBasis3DCyl.h.

Referenced by EvalBr(), HarmBasis3DCyl(), and PrintBrB().

double * magfieldparam::HarmBasis3DCyl::Bz_k
private

Definition at line 24 of file HarmBasis3DCyl.h.

Referenced by EvalBz(), GetBz(), GetBz_k(), HarmBasis3DCyl(), and ~HarmBasis3DCyl().

harm_poly_arr magfieldparam::HarmBasis3DCyl::BzB
private

Definition at line 28 of file HarmBasis3DCyl.h.

Referenced by EvalBz(), HarmBasis3DCyl(), and PrintBzB().

unsigned magfieldparam::HarmBasis3DCyl::Dim
private

Definition at line 20 of file HarmBasis3DCyl.h.

Referenced by EvalBphi(), EvalRZ(), GetDim(), and HarmBasis3DCyl().

int* magfieldparam::HarmBasis3DCyl::L_k
private

Definition at line 23 of file HarmBasis3DCyl.h.

Referenced by GetLM(), HarmBasis3DCyl(), and ~HarmBasis3DCyl().

unsigned magfieldparam::HarmBasis3DCyl::Len
private

Definition at line 21 of file HarmBasis3DCyl.h.

Referenced by GetLen(), GetVal(), and HarmBasis3DCyl().

int * magfieldparam::HarmBasis3DCyl::M_k
private

Definition at line 23 of file HarmBasis3DCyl.h.

Referenced by GetLM(), HarmBasis3DCyl(), and ~HarmBasis3DCyl().

double* magfieldparam::HarmBasis3DCyl::P_k
private

Definition at line 24 of file HarmBasis3DCyl.h.

Referenced by EvalPtn(), GetPtn(), GetPtn_k(), HarmBasis3DCyl(), and ~HarmBasis3DCyl().

harm_poly_arr magfieldparam::HarmBasis3DCyl::PtB
private

Definition at line 26 of file HarmBasis3DCyl.h.

Referenced by EvalPtn(), HarmBasis3DCyl(), and PrintPtB().