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.

99 lines
4.1 KiB

  1. # Renata Kopecna
  2. #########################################################
  3. # #
  4. # Script for easier pushing to git #
  5. # #
  6. #########################################################
  7. #Bash would work but this is nicer for the user to read
  8. import sys
  9. import subprocess
  10. tmp = subprocess.Popen(["git","branch","--show-current"], cwd = "./", stdout=subprocess.PIPE)
  11. targetBranch = tmp.communicate()[0].decode("utf-8").strip("\n")
  12. #print (targetBranch)
  13. if (len(sys.argv)!= 3):
  14. print("Use it only with two arguments! python git.py fileToBePushed commitMessage")
  15. print("Using " + str(len(sys.argv)) + " arguments")
  16. exit()
  17. toBePushed = sys.argv[1]
  18. commitMessage = sys.argv[2]
  19. class_dict = {
  20. "generator": "sources/Core/bu2kstarmumu_generator",
  21. "loader": "sources/Core/bu2kstarmumu_loader",
  22. "parameters": "sources/Core/bu2kstarmumu_parameters",
  23. "pdf": "sources/Core/bu2kstarmumu_pdf",
  24. "plotter": "sources/Core/bu2kstarmumu_plotter",
  25. "event": "sources/Core/event",
  26. "folder": "sources/Core/folder",
  27. "fitter": "sources/Core/fitter",
  28. "funcs": "sources/Core/funcs",
  29. "integrals": "sources/Core/integrals",
  30. "options": "sources/Core/options",
  31. "toystudy": "sources/Core/toystudy",
  32. "design": "sources/Helpers/design",
  33. "helpers": "sources/Helpers/helpers",
  34. "constants": "sources/Params/constants",
  35. "parameters.hh": "sources/Params/parameters",
  36. "parameterscan": "sources/Params/parameterscan",
  37. "angularcorr": "sources/Run/angularcorr",
  38. "backgroundfit": "sources/Run/backgroundfit",
  39. "feldman_cousins": "sources/Run/feldman_cousins",
  40. "genlvlfit": "sources/Run/genlvlfit",
  41. "generatetoys": "sources/Run/generatetoys",
  42. "likelihoodscan": "sources/Run/likelihoodscan",
  43. "mcfit": "sources/Run/mcfit",
  44. "mainfit": "sources/Run/mainfit",
  45. "massfit": "sources/Run/massfit",
  46. "momfit": "sources/Run/momfit",
  47. "multifit": "sources/Run/multifit",
  48. "pulls": "sources/Run/pulls",
  49. "toysfit": "sources/Run/toysfit",
  50. "parse": "sources/parse",
  51. "help": "sources/help",
  52. "paths": "sources/paths"
  53. }
  54. scripts_dict = {
  55. "PlotMCfit": "sources/Scripts/PlotMCfit",
  56. "GenLvlvsMC": "sources/Scripts/GenLvlvsMC",
  57. "EvaluateToys": "sources/Scripts/EvaluateToys",
  58. "ReferencePlots": "sources/Scripts/ReferencePlots",
  59. "ScriptHelpers": "sources/Scripts/ScriptHelpers",
  60. "RunningScripts": "sources/Scripts/RunningScripts"
  61. }
  62. others_dict ={
  63. "main": "bu2kstarmumu.cc",
  64. "plotter.hh": "sources/Core/plotter.hh",
  65. "values": "sources/Params/values.hh",
  66. }
  67. mainPath = "/home/lhcb/kopecna/B2KstarMuMu/code/ewp-Bplus2Kstmumu-AngAna/FCNCfitter/"
  68. if (toBePushed in class_dict):
  69. add_cc = subprocess.run(["git","add",class_dict.get(toBePushed)+".cc"], cwd = "./", check = False) #Output into console
  70. add_hh = subprocess.run(["git","add",class_dict.get(toBePushed)+".hh"], cwd = "./", check = False) #Output into console
  71. elif (toBePushed in others_dict):
  72. add = subprocess.run(["git","add",others_dict.get(toBePushed)], cwd = "./", check = False) #Output into console
  73. elif (toBePushed in scripts_dict):
  74. add_cc = subprocess.run(["git","add",scripts_dict.get(toBePushed)+".cc"], cwd = "./", check = False) #Output into console
  75. add_hh = subprocess.run(["git","add",scripts_dict.get(toBePushed)+".hh"], cwd = "./", check = False) #Output into console
  76. else:
  77. print("Wrong file name! Use any of the following:")
  78. print (class_dict.keys())
  79. print (others_dict.keys())
  80. add = subprocess.run(["git","commit","-m",commitMessage], cwd = "./", check = True) #Output into console
  81. add = subprocess.run(["git","push","origin",targetBranch], cwd = "./", check = True) #Output into console
  82. print ("\nDone pushing.\n")