CMS 3D CMS Logo

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 12 of file HarmBasis3DCyl.cc.

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

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

Definition at line 75 of file HarmBasis3DCyl.cc.

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

75  {
76  delete[] Bphi_k;
77  delete[] Bz_k;
78  delete[] Br_k;
79  delete[] P_k;
80  delete[] M_k;
81  delete[] L_k;
82 }

Member Function Documentation

void HarmBasis3DCyl::EvalBphi ( )

Definition at line 107 of file HarmBasis3DCyl.cc.

References Bphi_k, BphiB, Dim, magfieldparam::poly2d_base::Eval(), magfieldparam::rz_harm_poly::GetCos(), magfieldparam::rz_harm_poly::GetSin(), dqmdumpme::k, dttmaxenums::L, and heppy_batch::val.

Referenced by EvalBz(), and magfieldparam::BFit3D::GetField().

107  {
108  //Fills the array Bphi_k[Len] with values of phi-basis polynomials.
109  //
110  unsigned M;
111  double V;
112  double *val = Bphi_k;
113  rz_harm_poly *P;
114  for (unsigned L = 1, k = 0; L <= Dim; ++L, ++k) {
115  (*val) = 0.;
116  ++val;
117  for (M = 1; M <= L; ++M) {
118  P = &(BphiB[k][M]);
119  V = P->Eval();
120  (*val) = -V * P->GetSin();
121  ++val;
122  (*val) = V * P->GetCos();
123  ++val;
124  }
125  }
126 }
std::pair< OmniClusterRef, TrackingParticleRef > P
void magfieldparam::HarmBasis3DCyl::EvalBr ( )
inline

Definition at line 52 of file HarmBasis3DCyl.h.

References EvalRZ().

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

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

Definition at line 53 of file HarmBasis3DCyl.h.

References EvalBphi(), and EvalRZ().

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

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

Definition at line 51 of file HarmBasis3DCyl.h.

References EvalRZ().

51 { 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 85 of file HarmBasis3DCyl.cc.

References Dim, magfieldparam::poly2d_base::Eval(), magfieldparam::rz_harm_poly::GetCos(), magfieldparam::rz_harm_poly::GetSin(), dqmdumpme::k, dttmaxenums::L, and heppy_batch::val.

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

85  {
86  //Fills the linear array val[Len] with values of basis polynomials.
87  //Private function, intended for internal use only.
88  //
89  unsigned M;
90  double V;
91  rz_harm_poly *P;
92  for (unsigned L = 1, k = 0; L <= Dim; ++L, ++k) {
93  (*val) = B[k][0].Eval();
94  ++val;
95  for (M = 1; M <= L; ++M) {
96  P = &(B[k][M]);
97  V = P->Eval();
98  (*val) = V * P->GetCos();
99  ++val;
100  (*val) = V * P->GetSin();
101  ++val;
102  }
103  }
104 }
static const std::string B
std::pair< OmniClusterRef, TrackingParticleRef > P
double magfieldparam::HarmBasis3DCyl::GetBphi ( double *  coeff)
inline

Definition at line 69 of file HarmBasis3DCyl.h.

References GetVal().

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

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

Definition at line 61 of file HarmBasis3DCyl.h.

References dqmdumpme::k.

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

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

Definition at line 67 of file HarmBasis3DCyl.h.

References GetVal().

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

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

Definition at line 59 of file HarmBasis3DCyl.h.

References dqmdumpme::k.

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

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

Definition at line 68 of file HarmBasis3DCyl.h.

References GetVal().

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

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

Definition at line 60 of file HarmBasis3DCyl.h.

References dqmdumpme::k.

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

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

Definition at line 39 of file HarmBasis3DCyl.h.

References Dim.

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

Definition at line 40 of file HarmBasis3DCyl.h.

References Len.

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

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

Definition at line 41 of file HarmBasis3DCyl.h.

References dqmiolumiharvest::j.

double magfieldparam::HarmBasis3DCyl::GetPtn ( double *  coeff)
inline

Definition at line 66 of file HarmBasis3DCyl.h.

References GetVal().

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

Definition at line 58 of file HarmBasis3DCyl.h.

References dqmdumpme::k.

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

Definition at line 129 of file HarmBasis3DCyl.cc.

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

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

129  {
130  //return value of the expansion with coefficients coeff[Len] for the basis
131  //Private function, intended for internal use only.
132  //
133  double S = 0.;
134  for (unsigned k = 0; k < Len; ++k)
135  S += coeff[k] * basis[k];
136  return S;
137 }
double S(const TLorentzVector &, const TLorentzVector &)
Definition: Particle.cc:97
void HarmBasis3DCyl::Print ( harm_poly_arr B,
std::ostream &  out = std::cout 
)
private

Definition at line 140 of file HarmBasis3DCyl.cc.

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

140  {
141  unsigned jL, jM, wdt = 60;
142  char fc1 = '-', fc0 = out.fill(fc1);
143  for (jL = 0; jL < B.size(); ++jL) {
144  out << std::setw(wdt) << fc1 << std::endl;
145  out << "Basis subset " << jL + 1 << std::endl;
146  out << std::setw(wdt) << fc1 << std::endl;
147  for (jM = 0; jM < B[jL].size(); ++jM) {
148  B[jL][jM].Print(out);
149  }
150  }
151  out.fill(fc0);
152 }
static const std::string B
void HarmBasis3DCyl::Print ( std::ostream &  out = std::cout)

Definition at line 155 of file HarmBasis3DCyl.cc.

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

155  {
156  out << "BASIS POLYNOMIALS FOR THE POTENTIAL:\n" << std::endl;
157  PrintPtB(out);
158  out << "\nBASIS POLYNOMIALS FOR R-COMPONENT OF THE FIELD:\n" << std::endl;
159  PrintBrB(out);
160  out << "\nBASIS POLYNOMIALS FOR Z-COMPONENT OF THE FIELD:\n" << std::endl;
161  PrintBzB(out);
162  out << "\nBASIS POLYNOMIALS FOR PHI-COMPONENT OF THE FIELD:\n" << std::endl;
163  PrintBphiB(out);
164 }
void PrintBrB(std::ostream &out=std::cout)
void PrintBphiB(std::ostream &out=std::cout)
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 74 of file HarmBasis3DCyl.h.

References gather_cfg::cout, MillePedeFileConverter_cfg::out, and Print().

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

74 { Print(BphiB, out); }
void Print(harm_poly_arr &B, std::ostream &out=std::cout)
void magfieldparam::HarmBasis3DCyl::PrintBrB ( std::ostream &  out = std::cout)
inline

Definition at line 72 of file HarmBasis3DCyl.h.

References MillePedeFileConverter_cfg::out, and Print().

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

72 { Print(BrB, out); }
void Print(harm_poly_arr &B, std::ostream &out=std::cout)
void magfieldparam::HarmBasis3DCyl::PrintBzB ( std::ostream &  out = std::cout)
inline

Definition at line 73 of file HarmBasis3DCyl.h.

References MillePedeFileConverter_cfg::out, and Print().

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

73 { Print(BzB, out); }
void Print(harm_poly_arr &B, std::ostream &out=std::cout)
void magfieldparam::HarmBasis3DCyl::PrintPtB ( std::ostream &  out = std::cout)
inline

Definition at line 71 of file HarmBasis3DCyl.h.

References MillePedeFileConverter_cfg::out, and Print().

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

71 { Print(PtB, out); }
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 47 of file HarmBasis3DCyl.h.

References magfieldparam::rz_harm_poly::SetPoint().

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

static void SetPoint(const double r, const double z, const double phi)
Definition: rz_harm_poly.h:63

Member Data Documentation

double * magfieldparam::HarmBasis3DCyl::Bphi_k
private

Definition at line 23 of file HarmBasis3DCyl.h.

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

harm_poly_arr magfieldparam::HarmBasis3DCyl::BphiB
private

Definition at line 28 of file HarmBasis3DCyl.h.

Referenced by EvalBphi(), and HarmBasis3DCyl().

double * magfieldparam::HarmBasis3DCyl::Br_k
private

Definition at line 23 of file HarmBasis3DCyl.h.

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

harm_poly_arr magfieldparam::HarmBasis3DCyl::BrB
private

Definition at line 26 of file HarmBasis3DCyl.h.

Referenced by HarmBasis3DCyl().

double * magfieldparam::HarmBasis3DCyl::Bz_k
private

Definition at line 23 of file HarmBasis3DCyl.h.

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

harm_poly_arr magfieldparam::HarmBasis3DCyl::BzB
private

Definition at line 27 of file HarmBasis3DCyl.h.

Referenced by HarmBasis3DCyl().

unsigned magfieldparam::HarmBasis3DCyl::Dim
private

Definition at line 19 of file HarmBasis3DCyl.h.

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

int* magfieldparam::HarmBasis3DCyl::L_k
private

Definition at line 22 of file HarmBasis3DCyl.h.

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

unsigned magfieldparam::HarmBasis3DCyl::Len
private

Definition at line 20 of file HarmBasis3DCyl.h.

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

int * magfieldparam::HarmBasis3DCyl::M_k
private

Definition at line 22 of file HarmBasis3DCyl.h.

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

double* magfieldparam::HarmBasis3DCyl::P_k
private

Definition at line 23 of file HarmBasis3DCyl.h.

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

harm_poly_arr magfieldparam::HarmBasis3DCyl::PtB
private

Definition at line 25 of file HarmBasis3DCyl.h.

Referenced by HarmBasis3DCyl().