14 Hemisphere::Hemisphere(vector<float> Px_vector,
15 vector<float> Py_vector,
16 vector<float> Pz_vector,
17 vector<float> E_vector,
19 int hemisphere_association_method)
20 : Object_Px(Px_vector),
24 seed_meth(seed_method),
25 hemi_meth(hemisphere_association_method),
31 rejectISRPtmax(10000.),
45 vector<float> Py_vector,
46 vector<float> Pz_vector,
47 vector<float> E_vector)
48 : Object_Px(Px_vector),
59 rejectISRPtmax(10000.),
118 cout <<
"WARNING!!!!! Input vectors have different size! Fix it!" << endl;
123 cout <<
" Hemisphere method " << endl;
137 for (
int j = 0;
j < vsize; ++
j) {
144 for (
int j = 0;
j < 5; ++
j) {
151 for (
int i = 0;
i < vsize; ++
i) {
155 <<
" *** Fix it!" << endl;
186 float DeltaRP_Max = 0.;
189 for (
int i = 0;
i < vsize; ++
i) {
211 for (
int i = 0;
i < vsize; ++
i) {
219 if (DeltaRP > DeltaRP_Max) {
220 DeltaRP_Max = DeltaRP;
237 cout <<
" Axis 1 is Object = " << I_Max << endl;
238 cout <<
" Axis 2 is Object = " << J_Max << endl;
247 for (
int i = 0;
i < vsize; ++
i) {
250 for (
int j =
i + 1;
j < vsize; ++
j) {
293 cout <<
" Axis 1 is Object = " << I_Max << endl;
294 cout <<
" Axis 2 is Object = " << J_Max << endl;
302 for (
int i = 0;
i < vsize; ++
i) {
313 for (
int i = 0;
i < vsize; ++
i) {
345 cout <<
" Axis 1 is Object = " << I_Max <<
" with Pt " <<
Object_Pt[I_Max] << endl;
346 cout <<
" Axis 2 is Object = " << J_Max <<
" with Pt " <<
Object_Pt[J_Max] << endl;
350 cout <<
"Please give a valid seeding method!" << endl;
374 cout <<
" Hemishpere: warning - reaching max number of iterations " << endl;
389 for (
int i = 0;
i < vsize; ++
i) {
393 if (P_Long1 >= P_Long2) {
417 for (
int i = 0;
i < vsize; ++
i) {
425 }
else if (
i == J_Max) {
441 float NewAxis1_E =
Axis1[4];
445 float NewAxis2_E =
Axis2[4];
460 float mass1 = NewAxis1_E -
463 float mass2 = NewAxis2_E -
513 cout <<
"Please give a valid hemisphere association method!" << endl;
519 Axis1[3] =
sqrt(Sum1_Px * Sum1_Px + Sum1_Py * Sum1_Py + Sum1_Pz * Sum1_Pz);
520 if (
Axis1[3] < 0.0001) {
521 cout <<
"ZERO objects in group 1! " << endl;
528 Axis2[3] =
sqrt(Sum2_Px * Sum2_Px + Sum2_Py * Sum2_Py + Sum2_Pz * Sum2_Pz);
529 if (
Axis2[3] < 0.0001) {
530 cout <<
" ZERO objects in group 2! " << endl;
539 cout <<
" Grouping = ";
540 for (
int i = 0;
i < vsize;
i++) {
554 for (
int i = 0;
i < vsize; ++
i) {
562 float sumdiff = fabs(sumtot - 2 *
Object_E[0]);
564 int ibest = 0, jbest = 0;
570 for (
int i = 0;
i < vsize - 1; ++
i) {
578 for (
int j =
i + 1;
j < vsize; ++
j) {
587 float sum2_E = sumtot - sum1_E;
588 if (sumdiff >= fabs(sum1_E - sum2_E)) {
589 sumdiff = fabs(sum1_E - sum2_E);
598 float Sum1_Px = 0, Sum1_Py = 0, Sum1_Pz = 0, Sum1_E = 0;
599 float Sum2_Px = 0, Sum2_Py = 0, Sum2_Pz = 0, Sum2_E = 0;
600 for (
int i = 0;
i < vsize; ++
i) {
603 else if (
i <= ibest ||
i == jbest) {
617 Axis1[3] =
sqrt(Sum1_Px * Sum1_Px + Sum1_Py * Sum1_Py + Sum1_Pz * Sum1_Pz);
622 Axis2[3] =
sqrt(Sum2_Px * Sum2_Px + Sum2_Py * Sum2_Py + Sum2_Pz * Sum2_Pz);
664 for (
int i = 0;
i < vsize; ++
i) {
691 sqrt(newPx * newPx + newPy * newPy + newPz * newPz);
693 ptHemi =
sqrt(pObjsq - plHemi * plHemi);
694 if (ptHemi > valmax) {
699 float theta = 1.570796327;
703 if (fabs(newPz) > 0.001) {
704 theta = atan(
sqrt(newPx * newPx + newPy * newPy) / newPz);
710 hemiPhi = atan2(newPy, newPx);