2 |
|
|
3 |
|
#Generates psets |
4 |
|
#Uses 'lcg-ls' which requires grid to be sourced and a valid grid proxy (voms-proxy-init) |
5 |
< |
|
5 |
> |
#Does not add the correct crosssections, this will need to be done by hand. |
6 |
|
|
7 |
|
import commands |
8 |
|
|
31 |
|
path = (row['rpath'])+string.replace(dset[1:], '/', '.') |
32 |
|
paths.append(path) |
33 |
|
shortName = (string.split(dset, '/'))[1] + "_" + (string.split(dset, '/'))[2] |
34 |
+ |
shortName = string.replace(shortName,'-','_') |
35 |
|
shortNames.append(shortName) |
36 |
|
xsecs.append(0.0) |
37 |
|
#Would be nice if this information was in the database. |
40 |
|
path = (row['rpath']) |
41 |
|
paths.append(path) |
42 |
|
shortName = (string.split(dset, '/'))[1] + "_" + (string.split(dset, '/'))[2] |
43 |
+ |
shortName = string.replace(shortName,'-','_') |
44 |
|
shortNames.append(shortName) |
45 |
|
xsecs.append(0.0) |
46 |
|
break |
47 |
|
db.disconnect() |
48 |
|
|
49 |
|
for path, shortName, xsec in zip(paths, shortNames, xsecs) : |
50 |
< |
print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" |
51 |
< |
print "Generating " + shortName + '_pset.py' |
52 |
< |
print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" |
53 |
< |
print "Path is " + path |
50 |
> |
# print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" |
51 |
> |
print "Generating " + shortName + '.py' |
52 |
> |
# print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" |
53 |
> |
# print "\tPath: " + path |
54 |
|
|
55 |
|
prefix = '\n' + '\t' + "\"dcap://gfe02.grid.hep.ph.ic.ac.uk:22128/" + path[22:] |
56 |
|
suffix = '.root\" ,' |
69 |
|
for i,line1 in enumerate(infile[:-1]) : |
70 |
|
for line2 in infile[i+1:] : |
71 |
|
if line1[:-1] == line2[:-1] : |
72 |
< |
print "\tDuplicates exist: " + line1 + " and " + line2 |
73 |
< |
print "\t\tIgnoring " + line1 |
72 |
> |
# print "\tDuplicates: " + line1 + " and " + line2 |
73 |
> |
# print "\t\tIgnoring: " + line1 |
74 |
|
toRemove.append(i) |
75 |
|
break |
76 |
|
toRemove.sort() |
78 |
|
for i in toRemove : |
79 |
|
del infile[i] |
80 |
|
|
81 |
< |
outfile = open(shortName+'_pset.py','w') |
81 |
> |
outfile = open(shortName+'.py','w') |
82 |
|
|
83 |
|
filenames = [] |
84 |
|
for line in infile : |