3 using namespace magfieldparam;
14 if (first_term) out <<
coeff;
15 else if (coeff > 0.) out <<
" + " <<
coeff;
16 else out <<
" - " << -
coeff;
19 if (
np[0] != 1) out <<
"^" <<
np[0];
23 if (
np[1] != 1) out <<
"^" <<
np[1];
71 if (N <=
NTab)
return;
77 unsigned jr, dN = N*(N+1)/2;
78 rz_pow[0] =
new double [dN];
79 memset(rz_pow[0], 0, dN*
sizeof(
double));
81 for (jr = 1, dN = N; jr <
N; ++jr, --dN) {
82 rz_pow[jr] = rz_pow[jr-1] + dN;
94 for (jr = 1; jr <=
NPwr; ++jr) {
95 for (jz = 0; jz <= (
NPwr - jr); ++jz) {
105 std::set<poly2d_base*>::iterator it;
108 curp = (*it)->max_pwr;
109 if (curp > maxp) maxp = curp;
124 out <<
"poly2d_base table size NTab = " <<
NTab
125 <<
"\tmax. power NPwr = " <<
NPwr << std::endl;
128 std::streamsize old_prec = out.precision(), wdt = prec+7;
130 out <<
"Table content:" << std::endl;
132 for (jr = 0; jr <=
NPwr; ++jr) {
133 for (jz = 0; jz <= (
NPwr-jr); ++jz) {
134 out << std::setw(wdt) << std::left <<
rz_pow[jr][jz];
136 out <<
"|" << std::endl;
138 out.precision(old_prec);
140 out <<
"\tTable size is not adjusted." << std::endl;
143 out <<
"\tTable is not allocated." << std::endl;
150 if (!
Count())
return;
160 for (
unsigned j = 0;
j <
data.size(); ++
j)
168 if (!(
data.size()))
return;
170 unsigned j1, j2, rpow, zpow, noff = 0, jend =
data.size();
172 std::vector<bool> mask(jend,
false);
175 for (j1 = 0; j1 < jend; ++j1) {
176 if (mask[j1])
continue;
178 rpow =
data[j1].np[0];
179 zpow =
data[j1].np[1];
180 for (j2 = j1+1; j2 < jend; ++j2) {
181 if (mask[j2])
continue;
182 if ((rpow ==
data[j2].
np[0]) && (zpow ==
data[j2].np[1])) {
196 std::vector<poly2d_term> newdata; newdata.reserve(jend - noff);
197 for (j1 = 0; j1 < jend; ++j1) {
198 if (!(mask[j1])) newdata.push_back(
data[j1]);
207 out <<
"\"poly2d_base\" object contains no terms." << std::endl;
210 out <<
data.size() <<
" terms; max. degree = " <<
max_pwr <<
":" << std::endl;
211 std::streamsize old_prec = out.precision();
214 for (
unsigned it = 1; it <
data.size(); ++it) {
215 data[it].Print(out,
false);
218 out.precision(old_prec);
227 std::vector<poly2d_term> newdata;
228 newdata.reserve(
data.size());
229 unsigned cur_pwr = 0, maxp = 0, oldp =
max_pwr;
230 for (
unsigned it = 0; it <
data.size(); ++it) {
233 if (v3.
coeff != 0.) {
235 newdata.push_back(v3);
236 if ((cur_pwr = v3.
np[0] + v3.
np[1]) > maxp) maxp = cur_pwr;
239 newdata.resize(newdata.size());
252 for (
unsigned it = 0; it <
data.size(); ++it) {
253 data[it].coeff /= ++
data[it].np[nvar];
264 for (
unsigned it = 0; it <
data.size(); ++it) {
278 std::vector<poly2d_term> newdata;
279 newdata.reserve(
data.size());
280 unsigned cur_pwr = 0, maxp = 0, oldp =
max_pwr;
281 for (
unsigned it = 0; it <
data.size(); ++it) {
283 if ((v3.
coeff != 0.) && (v3.
np[nvar] > 0)) {
285 newdata.push_back(v3);
286 if ((cur_pwr = v3.
np[0] + v3.
np[1]) > maxp) maxp = cur_pwr;
289 newdata.resize(newdata.size());
301 for (
unsigned it = 0; it <
data.size(); ++it) {
304 }
else data.resize(0);
void Print(std::ostream &out=std::cout, const std::streamsize prec=5)
std::vector< poly2d_term > data
static void SetTabSize(const unsigned N)
static std::set< poly2d_base * > poly2d_base_set
void Scale(const double C)
static void SetPoint(const double r, const double z)
void Print(std::ostream &out=std::cout, bool first_term=true)
static void FillTable(const double r, const double z)
unsigned long long int rval
static void PrintTab(std::ostream &out=std::cout, const std::streamsize prec=5)
double S(const TLorentzVector &, const TLorentzVector &)
static const double MIN_COEFF