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;
26 thr[i * nSegsPhi +
j] = thrust(
Vector(r *
cos(phi), r *
sin(phi), z));
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;
73 parabola(
a,
b,
c, axis(best), axis(best.
theta + epsilon, best.
phi), axis(best.
theta - epsilon, best.
phi));
74 maxChange1 = 10 * (
b < 0 ? -1 : 1);
76 maxChange1 = -
b / (2 *
a);
77 while (fabs(maxChange1 * epsilon) >
pi_4)
79 if (maxChange1 == 0 && (best.
theta == 0 || best.
theta ==
pi)) {
83 parabola(
a,
b,
c, axis(best), axis(best.
theta + epsilon, best.
phi), axis(best.
theta - epsilon, best.
phi));
84 maxChange1 = 10 * (
b < 0 ? -1 : 1);
86 maxChange1 = -
b / (2 *
a);
90 thr = thrust(axis(best.
theta + maxChange1 * epsilon, best.
phi)) +
epsilon;
102 if (best.
theta < 0) {
108 parabola(
a,
b,
c, axis(best), axis(best.
theta, best.
phi + epsilon), axis(best.
theta, best.
phi - epsilon));
109 maxChange2 = 10 * (
b < 0 ? -1 : 1);
111 maxChange2 = -
b / (2 *
a);
112 while (fabs(maxChange2 * epsilon) >
pi_4) {
117 thr = thrust(axis(best.
theta, best.
phi + maxChange2 * epsilon)) +
epsilon;
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;
143 double theSin =
sin(theta);
150 for (
unsigned int i = 0;
i < n_; ++
i)
151 sum += fabs(axis.Dot(p_[
i]));
153 result = sum / pSum_;
const edm::EventSetup & c
ROOT::Math::Plane3D::Vector Vector
const Vector & axis() const
thrust axis (with magnitude = 1)
Sin< T >::type sin(const T &t)
ThetaPhi initialAxis() const
Geom::Theta< T > theta() const
math::XYZVector Vector
spatial vector
Cos< T >::type cos(const T &t)
double thrust() const
thrust value (in the range [0.5, 1.0])
ThetaPhi finalAxis(ThetaPhi) const
void parabola(double &a, double &b, double &c, const Vector &, const Vector &, const Vector &) const
void init(const std::vector< const reco::Candidate * > &)