Newer
Older
TB_Chris / Kepler / options / ResStudies / .svn / text-base / submitRes.py.svn-base
  1. ########################################################################
  2. # script to submit resolution study jobs to grid
  3. # Define runs in runList.txt and combine those in a common block
  4. # Define z-position configuration of block in ZPos.txt
  5. # Define which block to run over and analysis step you want to perform
  6. # -survey : Survey alignment
  7. # -mille : Millepede alignmnet
  8. # -dut : DUT run
  9. # -run : Dry run using DUT alignment
  10. #
  11. # for questions: chris.hombach@gmail.com
  12. ########################################################################
  13. import pickle
  14. from sys import path
  15. from os.path import abspath
  16.  
  17. PATH_TO_OPTS= abspath('$HOME/cmtuser/KEPLER/KEPLER_HEAD/Tb/Kepler/options/ResStudies/')
  18. path.append( PATH_TO_OPTS )
  19. import Runs
  20.  
  21. #Set blocks to run over and alignment-method
  22. blocks = ['D1','D2']
  23. method = 'run' #survey, mille, dut, run
  24. ######
  25.  
  26. optsdir = '$HOME/cmtuser/KEPLER/KEPLER_HEAD/Tb/Kepler/options/ResStudies/'
  27.  
  28. opts = '%srestudies.py' % optsdir
  29. kepler = Kepler( optsfile=[ opts ] , version = 'HEAD' )
  30. BACKEND = Local()#LSF(queue='1nh')#Dirac()
  31. #BACKEND = Dirac()
  32.  
  33. runs = Runs.Runs(blocks, method)
  34. pickled_runs = 'Runs.pkl'
  35. pickle.dump( runs, open( pickled_runs , 'wb' ) )
  36.  
  37.  
  38.  
  39. for bl in blocks:
  40. alfs = {}
  41. tbruns = []
  42. for rn in runs.RUNS[bl]:
  43. r = rn.RUN
  44. a = rn.ANGLE
  45. b = rn.BIAS
  46. d = rn.DUT
  47. af = rn.ALIGNFILE
  48. tbruns.append( int(r) )
  49. if method == 'survey':
  50. rn.createAlignFile()
  51. alfs[int(r)] = af
  52.  
  53. if tbruns[0] < 2000:
  54. m = 'July2014'
  55. elif tbruns[0] < 3000:
  56. m = 'Oct2014'
  57. elif tbruns[0] < 4000:
  58. m = 'Nov2014'
  59. else:
  60. m = 'Dec2014'
  61. tbds = TbDataset( m, tbruns )
  62. tbds.AlignmentFiles = alfs
  63.  
  64.  
  65. SPLITTER = tbds
  66. j = Job(application = kepler)
  67. j.backend = BACKEND
  68. j.splitter = SPLITTER
  69. j.outputfiles = ['*.dat']
  70.  
  71. j.submit()