test
Main Page
Namespaces
Classes
Package Documentation
GIT Directory
WorkBook
Offline Guide
Release schedule
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
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
//_______________________________________________________________________________
13
HarmBasis3DCyl::HarmBasis3DCyl
(
const
unsigned
N
)
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
}
65
66
//_______________________________________________________________________________
67
HarmBasis3DCyl::~HarmBasis3DCyl
()
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
}
76
77
//_______________________________________________________________________________
78
void
HarmBasis3DCyl::EvalRZ
(
harm_poly_arr
&
B
,
double
*val)
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
}
96
97
//_______________________________________________________________________________
98
void
HarmBasis3DCyl::EvalBphi
()
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
}
116
117
//_______________________________________________________________________________
118
double
HarmBasis3DCyl::GetVal
(
double
*coeff,
double
*basis)
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
}
127
128
//_______________________________________________________________________________
129
void
HarmBasis3DCyl::Print
(
harm_poly_arr
&
B
, std::ostream &
out
)
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
}
143
144
//_______________________________________________________________________________
145
void
HarmBasis3DCyl::Print
(std::ostream &
out
)
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
}
156
magfieldparam::HarmBasis3DCyl::BphiB
harm_poly_arr BphiB
Definition:
HarmBasis3DCyl.h:29
magfieldparam::HarmBasis3DCyl::L_k
int * L_k
Definition:
HarmBasis3DCyl.h:23
magfieldparam::HarmBasis3DCyl::~HarmBasis3DCyl
virtual ~HarmBasis3DCyl()
Definition:
HarmBasis3DCyl.cc:67
magfieldparam::HarmBasis3DCyl::PrintBrB
void PrintBrB(std::ostream &out=std::cout)
Definition:
HarmBasis3DCyl.h:71
magfieldparam::HarmBasis3DCyl::PrintBphiB
void PrintBphiB(std::ostream &out=std::cout)
Definition:
HarmBasis3DCyl.h:73
relval_2017.k
list k
Definition:
relval_2017.py:23
magfieldparam::HarmBasis3DCyl::HarmBasis3DCyl
HarmBasis3DCyl(const unsigned N=18)
Definition:
HarmBasis3DCyl.cc:13
magfieldparam::HarmBasis3DCyl::Len
unsigned Len
Definition:
HarmBasis3DCyl.h:21
P
#define P
Definition:
PFJetBenchmark.cc:37
dttmaxenums::L
Definition:
DTTMax.h:28
magfieldparam::HarmBasis3DCyl::P_k
double * P_k
Definition:
HarmBasis3DCyl.h:24
magfieldparam::HarmBasis3DCyl::EvalBphi
void EvalBphi()
Definition:
HarmBasis3DCyl.cc:98
double_binary
Definition:
DDStreamer.cc:227
magfieldparam::HarmBasis3DCyl::PtB
harm_poly_arr PtB
Definition:
HarmBasis3DCyl.h:26
magfieldparam::poly2d_base::Eval
double Eval()
Definition:
poly2d_base.cc:157
magfieldparam::rz_harm_poly::GetSin
double GetSin()
Definition:
rz_harm_poly.h:95
magfieldparam::HarmBasis3DCyl::M_k
int * M_k
Definition:
HarmBasis3DCyl.h:23
magfieldparam::poly2d_base::IncNPwr
static void IncNPwr(const unsigned N)
Definition:
poly2d_base.h:72
magfieldparam::HarmBasis3DCyl::Bphi_k
double * Bphi_k
Definition:
HarmBasis3DCyl.h:24
magfieldparam::rz_harm_poly::GetCos
double GetCos()
Definition:
rz_harm_poly.h:94
magfieldparam::HarmBasis3DCyl::Bz_k
double * Bz_k
Definition:
HarmBasis3DCyl.h:24
GenerateHcalLaserBadRunList.out
tuple out
Definition:
GenerateHcalLaserBadRunList.py:91
magfieldparam::harm_poly_arr
std::vector< harm_poly_vec > harm_poly_arr
Definition:
HarmBasis3DCyl.h:9
magfieldparam::harm_poly_vec
std::vector< rz_harm_poly > harm_poly_vec
Definition:
HarmBasis3DCyl.h:8
N
#define N
Definition:
blowfish.cc:9
magfieldparam::HarmBasis3DCyl::Print
void Print(harm_poly_arr &B, std::ostream &out=std::cout)
Definition:
HarmBasis3DCyl.cc:129
magfieldparam::rz_harm_poly
Definition:
rz_harm_poly.h:38
magfieldparam::HarmBasis3DCyl::EvalRZ
void EvalRZ(harm_poly_arr &B, double *val)
Definition:
HarmBasis3DCyl.cc:78
magfieldparam::HarmBasis3DCyl::Br_k
double * Br_k
Definition:
HarmBasis3DCyl.h:24
S
double S(const TLorentzVector &, const TLorentzVector &)
Definition:
Particle.cc:99
magfieldparam::HarmBasis3DCyl::Dim
unsigned Dim
Definition:
HarmBasis3DCyl.h:20
magfieldparam::HarmBasis3DCyl::BrB
harm_poly_arr BrB
Definition:
HarmBasis3DCyl.h:27
magfieldparam::HarmBasis3DCyl::BzB
harm_poly_arr BzB
Definition:
HarmBasis3DCyl.h:28
magfieldparam::HarmBasis3DCyl::PrintBzB
void PrintBzB(std::ostream &out=std::cout)
Definition:
HarmBasis3DCyl.h:72
magfieldparam::HarmBasis3DCyl::PrintPtB
void PrintPtB(std::ostream &out=std::cout)
Definition:
HarmBasis3DCyl.h:70
HarmBasis3DCyl.h
magfieldparam::HarmBasis3DCyl::GetVal
double GetVal(double *coeff, double *basis)
Definition:
HarmBasis3DCyl.cc:118
Generated for CMSSW Reference Manual by
1.8.5