28 origin =
'srm://heplnx204.pp.rl.ac.uk:8443/srm/managerv2?SFN=/pnfs/pp.rl.ac.uk/data/cms/store/temp/user/ana.91d36fddf73016fe56a4674b87cd86f61feae489/' 29 dest =
'srm://cms25.physics.ucsb.edu:8443/srm/v2/server?SFN=/mnt/hadoop/cms/store/user/ana/' 33 'crab_SMS-T1tttt_mGluino-600_mLSP-250to325_TuneCUETP8M1_13TeV-madgraphMLM-pythia8__RunIISpring15FSPremix-MCRUN2_74_V9-v1__MINIAODSIM': 11,
34 'crab_SMS-T1tttt_mGluino-1150to1175_mLSP-750to925_TuneCUETP8M1_13TeV-madgraphMLM-pythia8__RunIISpring15FSPremix-MCRUN2_74_V9-v1__MINIAODSIM': 10,
35 'crab_SMS-T1tttt_mGluino-1400_mLSP-1to1175_TuneCUETP8M1_13TeV-madgraphMLM-pythia8__RunIISpring15FSPremix-MCRUN2_74_V9-v1__MINIAODSIM': 11,
36 'crab_SMS-T1tttt_mGluino-1425to1450_mLSP-1to1200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8__RunIISpring15FSPremix-MCRUN2_74_V9-v1__MINIAODSIM': 11,
37 'crab_SMS-T1tttt_mGluino-1800to1850_mLSP-1to1450_TuneCUETP8M1_13TeV-madgraphMLM-pythia8__RunIISpring15FSPremix-MCRUN2_74_V9-v1__MINIAODSIM': 13,
38 'crab_TTJets_HT-800to1200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8__RunIISpring15DR74-Asympt25ns_MCRUN2_74_V9-v1__MINIAODSIM': 25,
39 'crab_TTJets_SingleLeptFromT_TuneCUETP8M1_13TeV-madgraphMLM-pythia8__RunIISpring15DR74-Asympt25ns_MCRUN2_74_V9-v1__MINIAODSIM': 70
44 for task
in tasks.keys():
45 print '\n' + 20*
'=--' +
'\n' 46 print "Working on task:", task
47 print "Number of jobs:", tasks[task]
49 hadoop_base = dest.split(
'SFN=').pop()
50 good_files = glob.glob(hadoop_base + task.replace(
'crab_',
'').split(
'__')[0]+
"/" + task +
"/*/*/*root")
52 runs = set([i.split(
'/')[-2]
for i
in good_files])
53 if (len(runs)>1):
print "Found multiple runs ", len(runs)
56 if (len(good_files)>0):
57 print "Found %i files:" % len(good_files)
60 print "No files found on hadoop" 61 print "\033[91m -- FAIL\033[0m", task
68 for igf
in good_files:
69 if (run==(igf.split(
'/')[-2])): template = igf
72 for job
in range(1,tasks[task]+1):
73 abspath = template[0:template.rfind(
'_')] +
'_'+str(job)+
'.root' 74 relpath = abspath.replace(hadoop_base,
'')
76 if abspath
in good_files:
continue 78 cmd =
'lcg-cp --verbose --vo=cms -b -D srmv2 '+ origin + relpath +
' ' + dest + relpath
79 exitcode = os.system(cmd)
80 if (exitcode==0): ndls = ndls + 1
81 else:
print "ERROR:: Download failed." 83 if (tasks[task] == (len(good_files) + ndls)):
84 print "\033[92m -- SUCCESS:\033[0m", task
86 print "\033[91m -- FAIL\033[0m", task