Newer
Older
TB_Chris / Kepler / options / ResStudies / .svn / text-base / copyAligns.py.svn-base
  1. import os,sys
  2. import Runs
  3. jobnr = 2870
  4.  
  5. #Set blocks to run over and alignment-method
  6. blocks = ['D2']
  7. method = 'run'
  8. #
  9.  
  10.  
  11. gangadir = '/afs/cern.ch/work/c/chombach/gangadir/workspace/chombach/LocalXML/%i/' % jobnr
  12. rootout = '/afs/cern.ch/work/c/chombach/Telescope/ResStudies/'
  13. for bl in blocks:
  14. rootout += bl
  15. rootout += '/'
  16. os.system( 'mkdir -p %s' % rootout )
  17. def findRunNo( so ):
  18. sof = open( so )
  19. for ll in sof.readlines():
  20. l = ll.split()
  21. if len(l) == 0:
  22. continue
  23. if l[0] == 'TbDataSvc':
  24. ind = l[4].find('Run')
  25. return l[4][ind+3:ind+7]
  26.  
  27. runs = Runs.Runs(blocks, method)
  28.  
  29. if method == 'run':
  30. runs.setOutputDir( rootout )
  31. for dd in os.listdir(gangadir):
  32. if dd == 'debug':
  33. continue
  34. rn = findRunNo(gangadir+dd+'/output/stdout')
  35. run = runs.findRun( rn )
  36. os.system('cp %s %s' % ( gangadir+dd+'/output/Alignment_out.dat', run.ALIGNOUTFILE) )
  37. if method == 'run':
  38. outfile = runs.OUTPUTDIR+'Kepler_%s_%s_%s_%s.root' % (rn, run.DUT, run.BIAS, run.ANGLE)
  39. os.system('cp %s %s' % ( gangadir+dd+'/output/Kepler-histos.root', outfile) )
  40.