PhD thesis of Renata Kopečná Angular analysis of B+->K*+(K+pi0)mu+mu- decay with the LHCb experiment
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.2 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. # # # # # # # # # # # # # # # # # # #
  41. # #
  42. # Main part of the plot maker! #
  43. # #
  44. # # # # # # # # # # # # # # # # # # #
  45. def make_figure(folder, mainName,
  46. listOfEntries,
  47. label,
  48. figsPerFigure, figsPerRow,
  49. 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)%figsPerFigure==0): #Print the begining of a Figure
  62. print("\\begin{figure}[hbt!]",file = f) #TODO: Replace the list of titles by something sensible
  63. print("\\centering",file = f)
  64. print(line, file =f) #Print the includegraphics
  65. if (num%figsPerFigure==0): #Print the end of a Figure
  66. print("\\captionof{figure}[FILL ME]{FILL ME}\\label{fig:"+label+"}",file = f)
  67. print("\\end{figure}",file = f)
  68. print("%-----------------------------------------",file = f)
  69. print("",file = f)
  70. if (len(lineList)%figsPerFigure !=0):
  71. print("\\captionof{figure}[FILL ME]{FILL ME}\\label{fig:"+label+"}",file = f)
  72. print("\\end{figure}",file = f)
  73. f.close()
  74. #Drop everything before the last "/" and after "." in the file name and print
  75. print("\\input{Chapters"+(outputFile.split("Chapters")[-1]).split(".",1)[0]+"}")