Exemplo n.º 1
0
def writeSplitFile(currentDir):
  splitCmd = 'python $CMSSW_BASE/src/flashgg/Systematics/scripts/split_all.py --doStage1p2'
  with open('split_all.sh','w') as outFile:
    outFile.write('#!/bin/bash \n')
    outFile.write('cd %s \n'%cmsswDir)
    outFile.write('%s \n'%cmsenv)
    outFile.write('cd %s \n'%currentDir)
    outFile.write('%s \n'%splitCmd)
  run('chmod +x split_all.sh')
Exemplo n.º 2
0
def writeHaddFile(currentDir):
  haddCmd = 'python $CMSSW_BASE/src/flashgg/Systematics/scripts/hadd_all.py'
  with open('hadd_all.sh','w') as outFile:
    outFile.write('#!/bin/bash \n')
    outFile.write('cd %s \n'%cmsswDir)
    outFile.write('%s \n'%cmsenv)
    outFile.write('cd %s \n'%currentDir)
    outFile.write('%s \n'%haddCmd)
  run('chmod +x hadd_all.sh')
Exemplo n.º 3
0
def writeHaddFile(currentDir):
    outFile = ''
    for fName in listdir('.'):
        if fName.count('intermediate') and fName.count('.root'):
            outFile = fName.split('intermediate')[0] + fName.split(
                'intermediate')[-1][1:]
            break
    haddCmd = 'hadd_workspaces %s/%s %s/output_*.root' % (currentDir, outFile,
                                                          currentDir)
    with open('hadd_all.sh', 'w') as outFile:
        outFile.write('#!/bin/bash \n')
        outFile.write('cd %s \n' % cmsswDir)
        outFile.write('%s \n' % cmsenv)
        outFile.write('cd %s \n' % currentDir)
        outFile.write('%s \n' % haddCmd)
    run('chmod +x hadd_all.sh')
Exemplo n.º 4
0
  splitCmd = 'python $CMSSW_BASE/src/flashgg/Systematics/scripts/split_all.py --doStage1p2'
  with open('split_all.sh','w') as outFile:
    outFile.write('#!/bin/bash \n')
    outFile.write('cd %s \n'%cmsswDir)
    outFile.write('%s \n'%cmsenv)
    outFile.write('cd %s \n'%currentDir)
    outFile.write('%s \n'%splitCmd)
  run('chmod +x split_all.sh')

cwd = getcwd()

if opts.doSetting:
  for sig,key in sigs.iteritems():
    system('mkdir %s'%sig)
    system('mv output_%s* %s'%(key,sig))

for sig in sigs.keys():
  currDir = '%s/%s'%(cwd,sig)
  chdir(currDir)
  if opts.doHadding:
    writeHaddFile(currDir)
    run('qsub -q hep.q -l h_rt=3:0:0 -l h_vmem=24G -o /dev/null -e %s/hadd_all.err %s/hadd_all.sh'%(currDir,currDir))
  elif opts.doSplitting:
    writeSplitFile(currDir)
    run('qsub -q hep.q -l h_rt=3:0:0 -l h_vmem=24G -o /dev/null -e %s/split_all.err %s/split_all.sh'%(currDir,currDir))
  elif opts.doMoving:
    run('python $CMSSW_BASE/src/flashgg/Systematics/scripts/HTXS_mv_irrelevant.py')
    run('python $CMSSW_BASE/src/flashgg/Systematics/scripts/fileRenamer.py')
    run('cp output_*.root ../../')
  chdir(cwd)
Exemplo n.º 5
0
        outFile.write('cd %s \n' % cmsswDir)
        outFile.write('%s \n' % cmsenv)
        outFile.write('cd %s \n' % currentDir)
        outFile.write('%s \n' % splitCmd)
    run('chmod +x split_all.sh')


cwd = getcwd()

procs = []

for fName in listdir('.'):
    if fName.count('intermediate') and fName.count('.root'):
        if opts.doSplitting:
            currDir = '%s/tempDir_%s' % (cwd, fName.replace('.root', ''))
            run('mkdir %s' % currDir)
            run('cp %s %s' % (fName, currDir))
            chdir(currDir)
            writeSplitFile(currDir)
            run('qsub -q hep.q -l h_rt=3:0:0 -l h_vmem=24G -o /dev/null -e %s/split_all.err %s/split_all.sh'
                % (currDir, currDir))
        elif opts.doMoving:
            currDir = '%s/tempDir_%s' % (cwd, fName.replace('.root', ''))
            chdir(currDir)
            run('python $CMSSW_BASE/src/flashgg/Systematics/scripts/HTXS_mv_irrelevant.py'
                )
            if len(procs) == 0:
                for procFile in listdir('.'):
                    if not (procFile.count('output_')
                            and procFile.count('.root')):
                        continue