8 for (std::vector<const Candidate*>::const_iterator
t =
cands.begin();
t !=
cands.end(); ++
t, ++
i)
9 pSum_ += (p_[
i] = (*t)->momentum()).
r();
10 axis_ = axis(finalAxis(initialAxis()));
13 thrust_ = thrust(axis_);
17 static const int nSegsTheta = 10, nSegsPhi = 10, nSegs = nSegsTheta * nSegsPhi;
19 double thr[nSegs],
max = 0;
20 int indI = 0, indJ = 0,
index = -1;
21 for (
i = 0;
i < nSegsTheta; ++
i) {
22 double z =
cos(
pi *
i / (nSegsTheta - 1));
23 double r =
sqrt(1 - z * z);
24 for (
j = 0;
j < nSegsPhi; ++
j) {
25 double phi =
pi2 *
j / nSegsPhi;
27 if (thr[
i * nSegsPhi +
j] >
max) {
47 a = (thr[ind1] + thr[ind2] - 2 *
c) / 2;
48 b = thr[ind1] -
a -
c;
51 maxPhiInd = -
b / (2 *
a);
53 if (indI == 0 || indI == (nSegsTheta - 1))
58 a = (thr[ind1] + thr[ind2] - 2 *
c) / 2;
59 b = thr[ind1] -
a -
c;
62 maxThetaInd = -
b / (2 *
a);
64 return ThetaPhi(
pi * (maxThetaInd + indI) / (nSegsTheta - 1),
pi2 * (maxPhiInd + indJ) / nSegsPhi);
68 static const double epsilon = 0.0001;
69 double maxChange1 = 0.0, maxChange2 = 0.0,
a = 0.0,
b = 0.0,
c = 0.0, thr = 0.0;
70 int mandCt = 3, maxCt = 1000;
74 maxChange1 = 10 * (
b < 0 ? -1 : 1);
76 maxChange1 = -
b / (2 *
a);
79 if (maxChange1 == 0 && (best.
theta == 0 || best.
theta ==
pi)) {
84 maxChange1 = 10 * (
b < 0 ? -1 : 1);
86 maxChange1 = -
b / (2 *
a);
102 if (best.
theta < 0) {
109 maxChange2 = 10 * (
b < 0 ? -1 : 1);
111 maxChange2 = -
b / (2 *
a);
129 done = (fabs(maxChange1) > 1 || fabs(maxChange2) > 1 || mandCt) && (maxCt > 0);
136 double t1 = thrust(a1),
t2 = thrust(
a2),
t3 = thrust(a3);
137 a = (
t2 - 2 *
c +
t3) / 2;
150 for (
unsigned int i = 0;
i < n_; ++
i)
151 sum += fabs(axis.Dot(p_[
i]));