Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 KB | None | 0 0
  1. def EMD_2v3_body_fn(eta, xi, s, t):
  2. # Getting the angle between quark and anti-quark (qbar), and quark and photon (y) from kinematics, following mathematica calculations
  3. theta_qbar = np.arccos( ( 1.-s-t-s*t )/( (1.-s)*(1.-t) ) )
  4. theta_y = np.arcsin( -1.*(1.-t)*np.sin(theta_qbar(s,t)) / (s+t) )
  5.  
  6. # Defining the thrust w.r.t. a thrust axis, minimizing, and finding the thrust axis:
  7. thrust = lambda phi: (1.-s)*abs( np.cos(phi) ) + (1.-t)*abs( np.cos(theta_qbar(s,t)-phi) ) + (s+t)*abs( np.cos(theta_y(s,t)-phi) )
  8. theta_th = minimize(thrust, x0=0., bounds=((0.,np.pi),) ).x
  9.  
  10. # Defining an EMD with 2 free parameters under which we will minimize
  11. EMD_fn = (
  12. (eta+xi-s)*np.sqrt(1.-np.cos(theta_th)) + (1.-eta-xi)*np.sqrt(1.+np.cos(theta_th))
  13. (1.-t-eta)*np.sqrt(1.-np.cos(theta_th-theta_qbar(s,t))) + eta*np.sqrt(1.+np.cos(theta_th-theta_qbar(s,t)))
  14. (s+t-xi)*np.sqrt(1.-np.cos(theta_th-theta_y(s,t))) + xi*np.sqrt(1.+np.cos(theta_th-theta_y(s,t)))
  15. )/np.sqrt(2)
  16.  
  17. return EMD_fn
  18.  
  19.  
  20.  
  21. def MC_thrust_aligned_EMD_Distribution_Plot(numpoints):
  22. numSamplePoints = 100000
  23. # 100000 MC sample points
  24. st, area = sample_stSpace(1000000)
  25.  
  26. rho_EMD = []
  27. error = []
  28. EMD_list = []
  29.  
  30. maxEMD = 1
  31. EMD_vals = np.linspace(0, maxEMD, numpoints)
  32. epsilon = maxEMD/numpoints
  33.  
  34.  
  35. # Constraints on the solutions space, requiring that the EMD 'matrix elements' are positive
  36. EMD_cons = [
  37. {'type': 'ineq', 'fun': lambda data: eta+xi-s},
  38. {'type': 'ineq', 'fun': lambda data: 1.-eta-xi},
  39. {'type': 'ineq', 'fun': lambda data: 1.-t-eta},
  40. {'type': 'ineq', 'fun': lambda data: eta},
  41. {'type': 'ineq', 'fun': lambda data: s+t-xi},
  42. {'type': 'ineq', 'fun': lambda data: xi}
  43. ]
  44.  
  45. # Initial guess and bounds for eta and xi
  46. initial_guess = (.5,.5)
  47. bnds = ((0,1),(0,1))
  48.  
  49. print(minimize(EMD_fn, x0=initial_guess, bounds=bnds, constraints=cons))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement