+ if(switch1 == 1){
+ psum.SetXYZ(0., 0., 0.);
+ psum1 = 0;
+ for(Int_t i = 0; i < nTracks; i++)
+ {
+ psum1 += (TMath::Abs(n01.Dot(pTrackPerp[i])));
+ if (n01.Dot(pTrackPerp[i]) > 0) psum += pTrackPerp[i];
+ if (n01.Dot(pTrackPerp[i]) < 0) psum -= pTrackPerp[i];
+ }
+ thrust[l1] = psum1/psum2;
+ }
+
+ if(switch2 == 1){
+ psum02.SetXYZ(0., 0., 0.);
+ psum102 = 0;
+ for(Int_t i = 0; i < nTracks; i++)
+ {
+ psum102 += (TMath::Abs(n02.Dot(pTrackPerp[i])));
+ if (n02.Dot(pTrackPerp[i]) > 0) psum02 += pTrackPerp[i];
+ if (n02.Dot(pTrackPerp[i]) < 0) psum02 -= pTrackPerp[i];
+ }
+ thrust02[l2] = psum102/psum2;
+ }
+
+ if(switch3 == 1){
+ psum03.SetXYZ(0., 0., 0.);
+ psum103 = 0;
+ for(Int_t i = 0; i < nTracks; i++)
+ {
+ psum103 += (TMath::Abs(n03.Dot(pTrackPerp[i])));
+ if (n03.Dot(pTrackPerp[i]) > 0) psum03 += pTrackPerp[i];
+ if (n03.Dot(pTrackPerp[i]) < 0) psum03 -= pTrackPerp[i];
+ }
+ thrust03[l3] = psum103/psum2;
+ }
+
+ //check whether thrust value converged
+ if(TMath::Abs(th-thrust[l1]) < 10e-7){
+ switch1 = 0;
+ }
+
+ if(TMath::Abs(th02-thrust02[l2]) < 10e-7){
+ switch2 = 0;
+ }
+
+ if(TMath::Abs(th03-thrust03[l3]) < 10e-7){
+ switch3 = 0;
+ }
+
+ //if it didn't, continue with the calculation
+ if(switch1 == 1){
+ th = thrust[l1];
+ n01 = psum.Unit();
+ l1++;
+ }
+
+ if(switch2 == 1){
+ th02 = thrust02[l2];
+ n02 = psum02.Unit();
+ l2++;
+ }
+
+ if(switch3 == 1){
+ th03 = thrust03[l3];
+ n03 = psum03.Unit();
+ l3++;
+ }
+
+ //if thrust values for all starting direction converged check if to the same value
+ if(switch2 == 0 && switch1 == 0 && switch3 == 0){
+ if(TMath::Abs(th-th02) < 10e-7 && TMath::Abs(th-th03) < 10e-7 && TMath::Abs(th02-th03) < 10e-7){
+ eventShapes[0] = th;
+ Printf("===== THRUST VALUE FOUND AT %d :: %f\n", k, th);
+ break;
+ }
+ //if they did not, reset switches
+ else{
+ switch1 = 1;
+ // th = -1.;
+ switch2 = 1;
+ // th02 = -2.;
+ switch3 = 1;
+ // th03 = -4.;
+ }
+ }
+
+ // Printf("========== %d +++ th :: %f=============\n", l1, th);
+ // Printf("========== %d +++ th2 :: %f=============\n", l2, th02);
+ // Printf("========== %d +++ th3 :: %f=============\n", l3, th03);