MagneticField
ParametrizedEngine
src
HarmBasis3DCyl.cc
Go to the documentation of this file.
1
// //
3
// HarmBasis3DCyl: set of basis harmonic polynomials in cylindrical CS //
4
// //
6
7
#include "
HarmBasis3DCyl.h
"
8
9
using namespace
magfieldparam
;
10
11
//_______________________________________________________________________________
12
HarmBasis3DCyl::HarmBasis3DCyl
(
const
unsigned
N
) {
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
}
73
74
//_______________________________________________________________________________
75
HarmBasis3DCyl::~HarmBasis3DCyl
() {
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
}
83
84
//_______________________________________________________________________________
85
void
HarmBasis3DCyl::EvalRZ
(
harm_poly_arr
&
B
,
double
*
val
) {
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
}
105
106
//_______________________________________________________________________________
107
void
HarmBasis3DCyl::EvalBphi
() {
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
}
127
128
//_______________________________________________________________________________
129
double
HarmBasis3DCyl::GetVal
(
double
*coeff,
double
*basis) {
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
}
138
139
//_______________________________________________________________________________
140
void
HarmBasis3DCyl::Print
(
harm_poly_arr
&
B
, std::ostream &
out
) {
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
}
153
154
//_______________________________________________________________________________
155
void
HarmBasis3DCyl::Print
(std::ostream &
out
) {
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
}
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::~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::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
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::EvalBphi
void EvalBphi()
Definition:
HarmBasis3DCyl.cc:107
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
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
Definition:
BCyl.h:23
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
cms::cuda::V
uint32_t const T *__restrict__ const uint32_t *__restrict__ int32_t int Histo::index_type cudaStream_t V
Definition:
HistoContainer.h:51
magfieldparam::HarmBasis3DCyl::M_k
int * M_k
Definition:
HarmBasis3DCyl.h:22
magfieldparam::harm_poly_arr
std::vector< harm_poly_vec > harm_poly_arr
Definition:
HarmBasis3DCyl.h:9
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::HarmBasis3DCyl::L_k
int * L_k
Definition:
HarmBasis3DCyl.h:22
HarmBasis3DCyl.h
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
P
std::pair< OmniClusterRef, TrackingParticleRef > P
Definition:
BDHadronTrackMonitoringAnalyzer.cc:203
magfieldparam::HarmBasis3DCyl::Br_k
double * Br_k
Definition:
HarmBasis3DCyl.h:23
magfieldparam::HarmBasis3DCyl::P_k
double * P_k
Definition:
HarmBasis3DCyl.h:23
Generated for CMSSW Reference Manual by
1.8.16