Angular analysis of B+->K*+(K+pi0)mumu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.1 KiB

  1. import numpy as np
  2. from math import sqrt
  3. # angular parameters for each folding (appearing in this order in the input files)
  4. pars = {
  5. 0: ['S1s', 'S3', 'S6s', 'S9'],
  6. 1: ['S1s', 'S3', 'S4'],
  7. 2: ['S1s', 'S3', 'S5'],
  8. 3: ['S1s', 'S3', 'S7'],
  9. 4: ['S1s', 'S3', 'S8'],
  10. }
  11. import glob
  12. files = {}
  13. # get input files for given folding (if more than 1 for same folding, take first)
  14. for fold in pars.keys():
  15. files[fold] = glob.glob('./SensitivityFromToys/*folding{}.txt'.format(fold))[0]
  16. u = {} #fill with all uncertainties from toys
  17. for fold in pars.keys():
  18. d = np.genfromtxt(files[fold], comments='#')
  19. i = 0
  20. for angpar in pars[fold]:
  21. i = i+1 #header
  22. for q2bin in range(8):
  23. assert d[i][0]==q2bin
  24. u[(fold, angpar, q2bin)] = d[i][1]
  25. i = i+1
  26. # simple conversions of uncertainties for FL and AFB
  27. def FLerr(S1serr):
  28. return S1serr*4/3
  29. def AFBerr(S6serr):
  30. return S6serr*3/4
  31. def get_ordvals(year, scale):
  32. # take various uncertainties from different foldings
  33. ordvals = []
  34. for q2 in [0, 1, 2, 3, 4, 6, 7]: # not including q2bin 5 cause too close to ccbar
  35. ordvals = ordvals + [
  36. year,
  37. FLerr(u[(1, 'S1s', q2)])*scale,
  38. u[(3, 'S3', q2)]*scale,
  39. u[(1, 'S4', q2)]*scale,
  40. u[(2, 'S5', q2)]*scale,
  41. AFBerr(u[(0, 'S6s', q2)])*scale,
  42. u[(3, 'S7', q2)]*scale,
  43. u[(4, 'S8', q2)]*scale,
  44. u[(0, 'S9', q2)]*scale,
  45. ]
  46. return ordvals
  47. with open('./measurements/Bp2Kstmumu_skeleton.yml', 'r') as myfile:
  48. skeleton = myfile.read()
  49. ordvals = get_ordvals(2016, 1) #no scaling for 2016
  50. with open('measurements/Bp2Kstmumu_2016.yml', "w") as text_file:
  51. print(skeleton.format(*ordvals), file=text_file)
  52. lumi2016 = 5.2
  53. lumi2018 = 9.0
  54. addKppi0 = 2 # factor 2 larger stat?
  55. statfactor = lumi2018/lumi2016 * addKppi0
  56. ordvals = get_ordvals(2018, 1/sqrt(statfactor)) #no scaling for 2016
  57. with open('measurements/Bp2Kstmumu_2018andpi0.yml', "w") as text_file:
  58. print(skeleton.format(*ordvals), file=text_file)