20 double& thrust_major,
double& thrust_minor,
bool useThreeD)
37 CLHEP::Hep3Vector
thrust(0,0,0);
42 CLHEP::Hep3Vector n_0[20];
43 short add0[20] = { 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,-1,-1,-1,-1,-1,-1,-1,-1 };
44 short add1[20] = { 0, 1, 0, 0, 1, 1, 1, 1,-1,-1,-1,-1, 1, 1, 1, 1,-1,-1,-1,-1 };
45 short add2[20] = { 0, 0, 1, 0, 1, 1,-1,-1, 1, 1,-1,-1, 1, 1,-1,-1, 1, 1,-1,-1 };
46 short add3[20] = { 0, 0, 0, 1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1, 1,-1 };
48 std::vector<const INavigable4Momentum*> v_copy(4);
53 partial_sort_copy( iBeg, iEnd,
54 v_copy.begin(), v_copy.end(),
60 n_0[n_tests]=CLHEP::Hep3Vector(0,0,0);
64 add0[n_tests] * CLHEP::Hep3Vector(v_copy.at(0)->px(), v_copy.at(0)->py(), v_copy.at(0)->pz()) +
65 add1[n_tests] * CLHEP::Hep3Vector(v_copy.at(1)->px(), v_copy.at(1)->py(), v_copy.at(1)->pz()) +
66 add2[n_tests] * CLHEP::Hep3Vector(v_copy.at(2)->px(), v_copy.at(2)->py(), v_copy.at(2)->pz()) +
67 add3[n_tests] * CLHEP::Hep3Vector(v_copy.at(3)->px(), v_copy.at(3)->py(), v_copy.at(3)->pz());
77 if(n_0[n_tests].
mag()>0)
78 n_0[n_tests] /= n_0[n_tests].mag();
83 CLHEP::Hep3Vector n_1(0,0,0);
87 if((*itr)->px() * n_0[n_tests].x() +
88 (*itr)->py() * n_0[n_tests].y() +
89 (*itr)->pz() * n_0[n_tests].z() > 0 )
90 n_1 += CLHEP::Hep3Vector((*itr)->px(), (*itr)->py(), (*itr)->pz() );
92 n_1 -= CLHEP::Hep3Vector((*itr)->px(), (*itr)->py(), (*itr)->pz() );
103 run = ( n_0[n_tests]!=n_1 ) && ( -n_0[n_tests]!=n_1 ) &&
loop++<10;
109 if( n_tests>0 && ( n_0[0] == n_0[n_tests] || n_0[0] == -n_0[n_tests] ) ) agree++;
110 if( n_tests>0 && n_0[0] != n_0[n_tests] && n_0[0] != -n_0[n_tests] ) disagree++;
114 }
while( ( disagree>0 || agree<4 ) && ++n_tests < max_tests);
122 double numerator_t = 0;
123 double numerator_m = 0;
126 CLHEP::Hep3Vector
c((*itr)->hlv().vect());
128 numerator_t += abs(
c.dot(n_0[n_tests]));
129 numerator_m += (
c.cross(n_0[n_tests])).
mag();
133 if( numerator_t * inv_denominator > thrust_major )
135 thrust_major = numerator_t * inv_denominator;
136 thrust_minor = numerator_m * inv_denominator;
139 }
while(disagree>0 && ++n_tests < max_tests);