21 bool useThreeD =
true;
40 double thrust_major = -1;
41 double thrust_minor = -1;
45 std::vector<fastjet::PseudoJet>::const_iterator iBeg =
clusters.begin();
46 std::vector<fastjet::PseudoJet>::const_iterator iEnd =
clusters.end();
54 short add0[20] = { 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,-1,-1,-1,-1,-1,-1,-1,-1 };
55 short add1[20] = { 0, 1, 0, 0, 1, 1, 1, 1,-1,-1,-1,-1, 1, 1, 1, 1,-1,-1,-1,-1 };
56 short add2[20] = { 0, 0, 1, 0, 1, 1,-1,-1, 1, 1,-1,-1, 1, 1,-1,-1, 1, 1,-1,-1 };
57 short add3[20] = { 0, 0, 0, 1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1 };
59 std::vector<fastjet::PseudoJet> clusters_Esorted = fastjet::sorted_by_E(
clusters);
60 std::vector<fastjet::PseudoJet> v_copy(4);
61 for(
int i=0;
i<4;
i++) {
62 v_copy[
i] = clusters_Esorted[
i];
66 int max_tests = min<int>(20,
distance(iBeg, iEnd));
68 n_0[n_tests]=TVector3(0,0,0);
72 add0[n_tests] * TVector3(v_copy.at(0).px(), v_copy.at(0).py(), v_copy.at(0).pz()) +
73 add1[n_tests] * TVector3(v_copy.at(1).px(), v_copy.at(1).py(), v_copy.at(1).pz()) +
74 add2[n_tests] * TVector3(v_copy.at(2).px(), v_copy.at(2).py(), v_copy.at(2).pz()) +
75 add3[n_tests] * TVector3(v_copy.at(3).px(), v_copy.at(3).py(), v_copy.at(3).pz());
81 if (n_0[n_tests].Mag() > 0)
82 n_0[n_tests] *= 1/n_0[n_tests].Mag();
88 for (std::vector<fastjet::PseudoJet>::const_iterator
i = iBeg;
i != iEnd; ++
i) {
89 const fastjet::PseudoJet &itr = *
i;
90 if ((itr).
px() * n_0[n_tests].
x() +
91 (itr).
py() * n_0[n_tests].
y() +
92 (itr).
pz() * n_0[n_tests].
z() > 0)
93 n_1 += TVector3((itr).
px(), (itr).
py(), (itr).
pz());
95 n_1 -= TVector3((itr).
px(), (itr).
py(), (itr).
pz());
106 run = (n_0[n_tests] != n_1) && (-n_0[n_tests] != n_1) &&
loop++ < 10;
112 if (n_tests > 0 && (n_0[0] == n_0[n_tests] || n_0[0] == -n_0[n_tests])) agree++;
113 if (n_tests > 0 && n_0[0] != n_0[n_tests] && n_0[0] != -n_0[n_tests]) disagree++;
117 }
while ((disagree > 0 || agree < 4) && ++n_tests < max_tests);
127 double numerator_t = 0;
128 double numerator_m = 0;
129 for(std::vector<fastjet::PseudoJet>::const_iterator
i = iBeg;
i != iEnd; ++
i) {
130 const fastjet::PseudoJet & itr = *
i;
132 TLorentzVector
v((itr).
px(), (itr).
py(), (itr).
pz(), (itr).
e());
133 TVector3
c(
v.Vect());
134 numerator_t += fabs(
c.Dot(n_0[n_tests]));
135 numerator_m += (
c.Cross(n_0[n_tests])).Mag();
148 }
while (disagree > 0 && ++n_tests < max_tests);