Newer
Older
TB_Chris / Kepler / Scripts / .svn / text-base / Kepler.svn-base
  1. #!/bin/bash
  2. . /etc/bashrc
  3.  
  4. scratch=$(pwd)
  5. shopt -s expand_aliases
  6. export eospath=eos/lhcb/testbeam/velo/timepix3/
  7.  
  8. if [ -z $KEPLERSYS ]; then . SetupProject.sh Kepler v3r0; fi
  9.  
  10. tb=July2014
  11. if [ "$1" -gt "2000" ]; then tb=Oct2014; fi
  12. if [ "$1" -gt "3000" ]; then tb=Nov2014; fi
  13. if [ "$1" -gt "3999" ]; then tb=Dec2014; fi
  14. if [ "$1" -gt "4999" ]; then tb=May2015; fi
  15. if [ "$1" -gt "6733" ]; then tb=July2015; fi
  16. if [ "$1" -gt "12000" ]; then tb=Sep2015; fi
  17. if [ "$1" -gt "13509" ]; then tb=Nov2015; fi
  18. # TBDATA
  19. if [ -z "$DATADIR" ]; then
  20. echo "No output directory defined - define variable $DATADIR"
  21. fi
  22. TBDATA=$DATADIR/public/
  23.  
  24. mkdir -p $TBDATA/$tb/Run$1/
  25.  
  26. RUN=$1
  27. echo "Processing Run $1"
  28.  
  29. condFolder="$eospath/$tb/RootFiles/Run$1/Conditions/"
  30. input_option="Kepler().InputFiles=['$eospath/$tb/RawData/Run$RUN/']"
  31. alignment="Kepler().AlignmentFile='$condFolder/Alignment$1mille.dat'"
  32. job="../options/batch.py"
  33.  
  34. histo_file="Kepler().HistogramFile='$TBDATA/$tb/Run$RUN/Kepler-histos.root'"
  35. tuple_file="Kepler().TupleFile='$TBDATA/$tb/Run$RUN/Kepler-tuple.root'"
  36. log_file=$TBDATA/$tb/Run$1/Run$1.std.out
  37. alignment_out="TbAlignment().OutputAlignmentFile='Alignment_out.dat'"
  38.  
  39. while [[ $# > 1 ]]
  40. do
  41. key="$1"
  42. case $key in
  43. -o|--options) # specify the options file to use
  44. job="$2"
  45. shift # past argument
  46. ;;
  47. -a|--alignment) #specify an alignment file
  48. alignment="Kepler().AlignmentFile='$2'"
  49. shift # past argument
  50. ;;
  51. -ao|--alignmentOut) #specify alignment file output
  52. alignment_out="TbAlignment().OutputAlignmentFile='$2'"
  53. shift
  54. ;;
  55. -i|--input)
  56. input_option="Kepler().InputFiles=['$2']"
  57. shift
  58. ;;
  59. -h|--hist) #specify histogram output
  60. histo_file="Kepler().HistogramFile='$2'"
  61. shift
  62. ;;
  63. -t|--nTuple) #specify nTuple output
  64. tuple_file="Kepler().TupleFile='$2'"
  65. shift
  66. ;;
  67. -lg|--log) #specify text log location
  68. log_file=$2
  69. shift
  70. ;;
  71. -l|--local) #use "local" mode for H8 operations
  72. input_option="Kepler().InputFiles=["
  73. FILES=""
  74. for f in {0..10}; do
  75. for file in /mnt/DATA/Dev$f/Run$RUN/*.dat ; do
  76. FILES+="'$file',"
  77. done
  78. done
  79. input_option+=`echo $FILES | sed 's/.$//'`
  80. input_option+="]"
  81. echo $input_option
  82. ;;
  83. -n|--nEvents) #specify a number of events
  84. nEvents="Kepler().EvtMax=$2"
  85. shift
  86. ;;
  87. --default)
  88. DEFAULT=YES
  89. ;;
  90. *)
  91. # unknown option
  92. ;;
  93. esac
  94. shift # past argument or value
  95. done
  96.  
  97. gaudirun.py --option="from Configurables import Kepler, TbAlignment" --option=$histo_file --option=$tuple_file --option=$alignment_out --option=$nEvents --option=$alignment --option=$input_option $job |& tee $TBDATA/$tb/Run$1/Run$1.std.out