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.

90 lines
3.0 KiB

  1. from __future__ import print_function
  2. import numpy as np
  3. def RunTag(Run):
  4. return "Run"+str(Run)
  5. def RunTagEff(Run,RunEff, onlyAngles):
  6. onlyAngTag = "_OnlyAngles" if onlyAngles else ""
  7. if (Run==-1): return onlyAngTag +"_AllPDFs"
  8. if (Run == RunEff):
  9. if (Run == "1"): return "_OnlyRun1"
  10. if (Run == "2"): return "_OnlyRun2"
  11. else: return "_" + RunTag(Run) + onlyAngTag + "_AllPDFs"
  12. else: return "_Run"+(RunEff)
  13. def RunList():
  14. return ["1","2","12"]
  15. def RunDict():
  16. return{ "1" : ["1"],
  17. "2" : ["2"],
  18. "12": ["1","2"]
  19. }
  20. def binTag(nBins):
  21. if (nBins==1): return "_1BIN"
  22. elif (nBins==4): return "_ALLBINS"
  23. else: return "_"+str(nBins)+"BINS"
  24. def binTagFull(nBins, bin):
  25. return binTag(nBins) + "_bin"+str(bin)
  26. def binTitle(nBins,bin):
  27. return str(bin+1)+"/" + str(nBins) + " bin" + ("" if nBins==1 else "s")
  28. def rareJpsiTag(isRef):
  29. if (isRef): return "_Jpsi"
  30. else: return "_Signal"
  31. def foldTag(fold):
  32. if (fold == -1): return ""
  33. else: return "_folding"+str(fold)
  34. def toyTag(toy):
  35. if (toy): return"_FinalToys"
  36. else: return ""
  37. def plotBkgTag(fullBkg):
  38. if (fullBkg): return "_incBkg"
  39. else: return ""
  40. def sigBkgTag(onlySig,onlyBkg):
  41. if(onlySig): return "_OnlySignal"
  42. elif (onlyBkg): return "_OnlyBackground"
  43. else: return ""
  44. # # # # # # # # # # # # # # # # # # #
  45. # #
  46. # Main part of the plot maker! #
  47. # #
  48. # # # # # # # # # # # # # # # # # # #
  49. def make_figure_slides(folder, mainName, listOfEntries, defaultTitle, figsPerSlide, figsPerRow, figType, outputFile):
  50. #Get width of the pic based on the number of plots per row
  51. picWidth = 0.95/figsPerRow
  52. #Pass in the mainName of the figure with __LOOP__ where the loop should happen
  53. lineList = []
  54. for num,x in enumerate(listOfEntries,start =1):
  55. name = mainName.replace("__LOOP__",x,1)
  56. newLine = "\\\\" if (num%figsPerRow==0) else "" #Put // at the end of each row
  57. lineList.append("\t\\includegraphics[width=" + "%.2f" %picWidth +"\\textwidth]{" + folder + name + figType + "}"+newLine)
  58. #Open the file
  59. f = open(outputFile,'w')
  60. for num,line in enumerate(lineList, start = 1):
  61. if ((num-1)%figsPerSlide==0): #Print the begining of a slide
  62. print("\\begin{frame}{"+defaultTitle+"}",file = f) #TODO: Replace the list of titles by something sensible
  63. print("",file = f)
  64. print("\\centering",file = f)
  65. print(line, file =f) #Print the includegraphics
  66. if (num%figsPerSlide==0): #Print the end of a slide
  67. print("\\end{frame}",file = f)
  68. print("%-----------------------------------------",file = f)
  69. print("",file = f)
  70. if (len(lineList)%figsPerSlide !=0):
  71. print("\\end{frame}",file = f)
  72. f.close()
  73. #Drop everything after "." in the file name and print
  74. print("\\include{"+outputFile.split(".",1)[0]+"}")