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.

129 lines
2.9 KiB

  1. #!/bin/bash
  2. #
  3. # #first initialize connection to Dirac by using:
  4. # lhcb-proxy-init
  5. PathToGangaFolder='/afs/cern.ch/user/r/rekopecn/gangadir/workspace/rekopecn/LocalXML'
  6. NameTagForOutputFiles='B2Kstmumu'
  7. #NameTagForOutputFiles='B2KstJpsi'
  8. NameOfRootfileInGangaOutput=''
  9. E_NO_ARGS=65
  10. if [ $# -eq 5 ] # Must have five command-line args to demo script.
  11. then
  12. channel=$1
  13. job=$2
  14. year=$3
  15. magnet=$4
  16. datatype=$5
  17. echo "Collecting $NameTagForOutputFiles for $year$magnet"
  18. else
  19. echo "Please invoke this script with one or more command-line arguments in the following format:"
  20. echo "./jobloader.sh CHANNEL JOB_ID YEAR MAGNET DATATYPE"
  21. exit $E_NO_ARGS
  22. fi
  23. if [ -e data ]
  24. then
  25. echo "folder data/ found!"
  26. else
  27. echo "creating folder data/"
  28. mkdir data
  29. fi
  30. if [ -e data/$datatype ]
  31. then
  32. echo "folder data/$datatype found!"
  33. else
  34. echo "creating folder data/$datatype"
  35. mkdir data/$datatype
  36. fi
  37. if [ -e data/$datatype/$channel ]
  38. then
  39. echo "folder data/$datatype/$channel found!"
  40. else
  41. echo "creating folder data/$datatype/$channel"
  42. mkdir data/$datatype/$channel
  43. fi
  44. if [ -e data/$datatype/$channel/$year$magnet ]
  45. then
  46. echo "folder data/$datatype/$channel/$year$magnet found!"
  47. else
  48. echo "creating folder data/$datatype/$channel/$year$magnet"
  49. mkdir data/$datatype/$channel/$year$magnet
  50. fi
  51. maxNumberOfSubjobs=0
  52. if [ "$datatype" = "data" ];
  53. then
  54. maxNumberOfSubjobs=150
  55. echo "maxNumberOfSubjobs= $maxNumberOfSubjobs"
  56. fi
  57. if [ "$datatype" = "MC" ];
  58. then
  59. maxNumberOfSubjobs=25
  60. echo "maxNumberOfSubjobs= $maxNumberOfSubjobs"
  61. fi
  62. if [ "$datatype" = "MCref" ];
  63. then
  64. maxNumberOfSubjobs=15
  65. echo "maxNumberOfSubjobs= $maxNumberOfSubjobs"
  66. fi
  67. if [ "$datatype" = "PHSP" ];
  68. then
  69. maxNumberOfSubjobs=15
  70. echo "maxNumberOfSubjobs= $maxNumberOfSubjobs"
  71. fi
  72. if [ "$datatype" = "MCB0" ];
  73. then
  74. maxNumberOfSubjobs=15
  75. echo "maxNumberOfSubjobs= $maxNumberOfSubjobs"
  76. fi
  77. if [ "$datatype" = "MCK1" ];
  78. then
  79. maxNumberOfSubjobs=15
  80. echo "maxNumberOfSubjobs= $maxNumberOfSubjobs"
  81. fi
  82. if [ "$datatype" = "MCInc" ];
  83. then
  84. maxNumberOfSubjobs=15
  85. echo "maxNumberOfSubjobs= $maxNumberOfSubjobs"
  86. fi
  87. echo "Collecting $NameTagForOutputFiles for $datatype and $channel, $year$magnet location ..."
  88. counter=0
  89. prefix="root->"
  90. apperfix=":::"
  91. while [ $counter -lt $maxNumberOfSubjobs ]
  92. do
  93. outfile=$year$magnet\_$NameTagForOutputFiles\_$counter.root
  94. if [ -e $PathToGangaFolder/$job/$counter/output/\_\_postprocesslocations\_\_ ]
  95. then
  96. while read line
  97. do
  98. line="${line#*$prefix}"
  99. line="${line%%$apperfix*}"
  100. NameOfRootfileInGangaOutput="${line##*/}"
  101. echo "$datatype $channel $year $magnet $counter $line" >> "ListOfLocations.out"
  102. NameOfRootfileInGangaOutput="${line##*/}"
  103. done < $PathToGangaFolder/$job/$counter/output/\_\_postprocesslocations\_\_
  104. #else echo "file $PathToGangaFolder/$counter/\_\_postprocesslocations\_\_ not found!"
  105. fi
  106. let counter=$counter+1
  107. done
  108. echo "Finished downloading $datatype/$channel/$year$magnet."