diff --git a/Phys/B2KShh/job/download.py b/Phys/B2KShh/job/download.py index d5bb252..8771a73 100644 --- a/Phys/B2KShh/job/download.py +++ b/Phys/B2KShh/job/download.py @@ -9,8 +9,9 @@ return if len(job_numbers) == 1: sel_jobs = [jobs(job_numbers[0])] + else: + sel_jobs = jobs.select(job_numbers[0], job_numbers[1]) lfns = {} - sel_jobs = jobs.select(job_numbers[0], job_numbers[1]) print 'Selecting jobs %s' % [j.id for j in sel_jobs] for j in sel_jobs: lfns[j.name] = [] @@ -27,11 +28,12 @@ -dest = '/disk/users/elena/B2KShh/ntuples/jobs' +dest1 = '/disk/users/elena/B2KShh/ntuples/jobs' +dest2 = '/disk/users/elena/Lb2Lcmunu/ntuples/jobs' scripts = '/cvmfs/lhcb.cern.ch/lib/lhcb/LHCBDIRAC/LHCBDIRAC_v8r2p29/scripts' import os -def download(mylist): +def download(mylist, dest): #os.system('SetupProject.sh LHCbDirac') #os.system('lhcb-proxy-init') for k in mylist.keys(): @@ -41,8 +43,9 @@ print '%s\t\t: %s of %s' % (k, i, l) file_id = rootfile.split('/')[-2] file_name = rootfile.split('/')[-1] - os.system('%s/dirac-dms-get-file %s' % (scripts, rootfile)) - os.system('mv %s %s/%s/%s.root' % (file_name, dest, k, file_id)) + if not os.path.isfile('%s/%s/%s.root' % (dest, k, file_id)): + os.system('%s/dirac-dms-get-file %s' % (scripts, rootfile)) + os.system('mv %s %s/%s/%s.root' % (file_name, dest, k, file_id)) def deleteFromGrid(mylist): @@ -72,8 +75,9 @@ if __name__ == '__main__': - #mylist = getlist(243, 256) - #pickle.dump(mylist, open('lfns.pkl', 'wb')) - mylist = pickle.load(open('lfns.pkl', 'rb')) - #download(mylist) + #mylist = getlist(265, 268) + out = '/afs/cern.ch/work/e/egraveri/Analysis/ganga/Lb2Lcmunu' + #pickle.dump(mylist, open(out + '/lfns.pkl', 'wb')) + mylist = pickle.load(open(out + '/lfns.pkl', 'rb')) + download(mylist, dest2) #hadd(mylist)