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::HarmBasis3DCyl ( const unsigned  N = 18)

Definition at line 12 of file HarmBasis3DCyl.cc.

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 }

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.

◆ ~HarmBasis3DCyl()

HarmBasis3DCyl::~HarmBasis3DCyl ( )
virtual

Definition at line 75 of file HarmBasis3DCyl.cc.

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 }

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

Member Function Documentation

◆ EvalBphi()

void HarmBasis3DCyl::EvalBphi ( )

Definition at line 107 of file HarmBasis3DCyl.cc.

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 }

References Bphi_k, BphiB, Dim, dqmdumpme::k, dttmaxenums::L, cms::cuda::V, and heppy_batch::val.

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

◆ EvalBr()

void magfieldparam::HarmBasis3DCyl::EvalBr ( )
inline

Definition at line 52 of file HarmBasis3DCyl.h.

52 { EvalRZ(BrB, Br_k); }

References Br_k, BrB, and EvalRZ().

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

◆ EvalBz()

void magfieldparam::HarmBasis3DCyl::EvalBz ( )
inline

Definition at line 53 of file HarmBasis3DCyl.h.

53 { EvalRZ(BzB, Bz_k); }

References Bz_k, BzB, and EvalRZ().

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

◆ EvalPtn()

void magfieldparam::HarmBasis3DCyl::EvalPtn ( )
inline

Definition at line 51 of file HarmBasis3DCyl.h.

51 { EvalRZ(PtB, P_k); }

References EvalRZ(), P_k, and PtB.

◆ EvalRZ()

void HarmBasis3DCyl::EvalRZ ( harm_poly_arr B,
double *  val 
)
private

Definition at line 85 of file HarmBasis3DCyl.cc.

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 }

References TtFullHadDaughter::B, Dim, dqmdumpme::k, dttmaxenums::L, cms::cuda::V, and heppy_batch::val.

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

◆ GetBphi()

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

Definition at line 69 of file HarmBasis3DCyl.h.

69 { return GetVal(coeff, Bphi_k); }

References Bphi_k, and GetVal().

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

◆ GetBphi_k()

double magfieldparam::HarmBasis3DCyl::GetBphi_k ( const unsigned  k)
inline

Definition at line 61 of file HarmBasis3DCyl.h.

61 { return Bphi_k[k]; }

References Bphi_k, and dqmdumpme::k.

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

◆ GetBr()

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

Definition at line 67 of file HarmBasis3DCyl.h.

67 { return GetVal(coeff, Br_k); }

References Br_k, and GetVal().

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

◆ GetBr_k()

double magfieldparam::HarmBasis3DCyl::GetBr_k ( const unsigned  k)
inline

Definition at line 59 of file HarmBasis3DCyl.h.

59 { return Br_k[k]; }

References Br_k, and dqmdumpme::k.

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

◆ GetBz()

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

Definition at line 68 of file HarmBasis3DCyl.h.

68 { return GetVal(coeff, Bz_k); }

References Bz_k, and GetVal().

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

◆ GetBz_k()

double magfieldparam::HarmBasis3DCyl::GetBz_k ( const unsigned  k)
inline

Definition at line 60 of file HarmBasis3DCyl.h.

60 { return Bz_k[k]; }

References Bz_k, and dqmdumpme::k.

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

◆ GetDim()

unsigned magfieldparam::HarmBasis3DCyl::GetDim ( )
inline

Definition at line 39 of file HarmBasis3DCyl.h.

39 { return Dim; }

References Dim.

◆ GetLen()

unsigned magfieldparam::HarmBasis3DCyl::GetLen ( )
inline

Definition at line 40 of file HarmBasis3DCyl.h.

40 { return Len; }

References Len.

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

◆ GetLM()

void magfieldparam::HarmBasis3DCyl::GetLM ( const unsigned  j,
int &  Lj,
int &  Mj 
)
inline

Definition at line 41 of file HarmBasis3DCyl.h.

41  {
42  Lj = L_k[j];
43  Mj = M_k[j];
44  }

References dqmiolumiharvest::j, L_k, and M_k.

◆ GetPtn()

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

Definition at line 66 of file HarmBasis3DCyl.h.

66 { return GetVal(coeff, P_k); }

References GetVal(), and P_k.

◆ GetPtn_k()

double magfieldparam::HarmBasis3DCyl::GetPtn_k ( const unsigned  k)
inline

Definition at line 58 of file HarmBasis3DCyl.h.

58 { return P_k[k]; }

References dqmdumpme::k, and P_k.

◆ GetVal()

double HarmBasis3DCyl::GetVal ( double *  coeff,
double *  basis 
)
private

Definition at line 129 of file HarmBasis3DCyl.cc.

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 }

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

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

◆ Print() [1/2]

void HarmBasis3DCyl::Print ( harm_poly_arr B,
std::ostream &  out = std::cout 
)
private

Definition at line 140 of file HarmBasis3DCyl.cc.

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 }

References TtFullHadDaughter::B, and MillePedeFileConverter_cfg::out.

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

◆ Print() [2/2]

void HarmBasis3DCyl::Print ( std::ostream &  out = std::cout)

Definition at line 155 of file HarmBasis3DCyl.cc.

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 }

References MillePedeFileConverter_cfg::out, PrintBphiB(), PrintBrB(), PrintBzB(), and PrintPtB().

◆ PrintBphiB()

void magfieldparam::HarmBasis3DCyl::PrintBphiB ( std::ostream &  out = std::cout)
inline

Definition at line 74 of file HarmBasis3DCyl.h.

74 { Print(BphiB, out); }

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

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

◆ PrintBrB()

void magfieldparam::HarmBasis3DCyl::PrintBrB ( std::ostream &  out = std::cout)
inline

Definition at line 72 of file HarmBasis3DCyl.h.

72 { Print(BrB, out); }

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

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

◆ PrintBzB()

void magfieldparam::HarmBasis3DCyl::PrintBzB ( std::ostream &  out = std::cout)
inline

Definition at line 73 of file HarmBasis3DCyl.h.

73 { Print(BzB, out); }

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

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

◆ PrintPtB()

void magfieldparam::HarmBasis3DCyl::PrintPtB ( std::ostream &  out = std::cout)
inline

Definition at line 71 of file HarmBasis3DCyl.h.

71 { Print(PtB, out); }

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

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

◆ SetPoint()

void magfieldparam::HarmBasis3DCyl::SetPoint ( const double  r,
const double  z,
const double  phi 
)
inline

Member Data Documentation

◆ Bphi_k

double * magfieldparam::HarmBasis3DCyl::Bphi_k
private

Definition at line 23 of file HarmBasis3DCyl.h.

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

◆ BphiB

harm_poly_arr magfieldparam::HarmBasis3DCyl::BphiB
private

Definition at line 28 of file HarmBasis3DCyl.h.

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

◆ Br_k

double * magfieldparam::HarmBasis3DCyl::Br_k
private

Definition at line 23 of file HarmBasis3DCyl.h.

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

◆ BrB

harm_poly_arr magfieldparam::HarmBasis3DCyl::BrB
private

Definition at line 26 of file HarmBasis3DCyl.h.

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

◆ Bz_k

double * magfieldparam::HarmBasis3DCyl::Bz_k
private

Definition at line 23 of file HarmBasis3DCyl.h.

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

◆ BzB

harm_poly_arr magfieldparam::HarmBasis3DCyl::BzB
private

Definition at line 27 of file HarmBasis3DCyl.h.

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

◆ Dim

unsigned magfieldparam::HarmBasis3DCyl::Dim
private

Definition at line 19 of file HarmBasis3DCyl.h.

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

◆ L_k

int* magfieldparam::HarmBasis3DCyl::L_k
private

Definition at line 22 of file HarmBasis3DCyl.h.

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

◆ Len

unsigned magfieldparam::HarmBasis3DCyl::Len
private

Definition at line 20 of file HarmBasis3DCyl.h.

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

◆ M_k

int * magfieldparam::HarmBasis3DCyl::M_k
private

Definition at line 22 of file HarmBasis3DCyl.h.

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

◆ P_k

double* magfieldparam::HarmBasis3DCyl::P_k
private

Definition at line 23 of file HarmBasis3DCyl.h.

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

◆ PtB

harm_poly_arr magfieldparam::HarmBasis3DCyl::PtB
private

Definition at line 25 of file HarmBasis3DCyl.h.

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

cms::cuda::V
cudaStream_t T uint32_t const T *__restrict__ const uint32_t *__restrict__ uint32_t int cudaStream_t V
Definition: HistoContainer.h:99
dttmaxenums::L
Definition: DTTMax.h:29
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::BzB
harm_poly_arr BzB
Definition: HarmBasis3DCyl.h:27
magfieldparam::HarmBasis3DCyl::Len
unsigned Len
Definition: HarmBasis3DCyl.h:20
magfieldparam::HarmBasis3DCyl::Bphi_k
double * Bphi_k
Definition: HarmBasis3DCyl.h:23
magfieldparam::HarmBasis3DCyl::BphiB
harm_poly_arr BphiB
Definition: HarmBasis3DCyl.h:28
magfieldparam::HarmBasis3DCyl::Print
void Print(harm_poly_arr &B, std::ostream &out=std::cout)
Definition: HarmBasis3DCyl.cc:140
magfieldparam::poly2d_base::IncNPwr
static void IncNPwr(const unsigned N)
Definition: poly2d_base.h:73
magfieldparam::HarmBasis3DCyl::GetVal
double GetVal(double *coeff, double *basis)
Definition: HarmBasis3DCyl.cc:129
magfieldparam::HarmBasis3DCyl::PtB
harm_poly_arr PtB
Definition: HarmBasis3DCyl.h:25
magfieldparam::HarmBasis3DCyl::EvalRZ
void EvalRZ(harm_poly_arr &B, double *val)
Definition: HarmBasis3DCyl.cc:85
magfieldparam::HarmBasis3DCyl::Dim
unsigned Dim
Definition: HarmBasis3DCyl.h:19
magfieldparam::HarmBasis3DCyl::Bz_k
double * Bz_k
Definition: HarmBasis3DCyl.h:23
DDAxes::z
magfieldparam::rz_harm_poly
Definition: rz_harm_poly.h:38
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::PrintBrB
void PrintBrB(std::ostream &out=std::cout)
Definition: HarmBasis3DCyl.h:72
S
double S(const TLorentzVector &, const TLorentzVector &)
Definition: Particle.cc:97
magfieldparam::HarmBasis3DCyl::M_k
int * M_k
Definition: HarmBasis3DCyl.h:22
alignCSCRings.r
r
Definition: alignCSCRings.py:93
DDAxes::phi
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::L_k
int * L_k
Definition: HarmBasis3DCyl.h:22
magfieldparam::harm_poly_vec
std::vector< rz_harm_poly > harm_poly_vec
Definition: HarmBasis3DCyl.h:8
S
Definition: CSCDBL1TPParametersExtended.h:16
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
P
std::pair< OmniClusterRef, TrackingParticleRef > P
Definition: BDHadronTrackMonitoringAnalyzer.cc:202
magfieldparam::HarmBasis3DCyl::Br_k
double * Br_k
Definition: HarmBasis3DCyl.h:23
magfieldparam::HarmBasis3DCyl::P_k
double * P_k
Definition: HarmBasis3DCyl.h:23