1 |
|
#!/usr/bin/env python |
2 |
|
from __future__ import print_function |
3 |
|
import sys |
4 |
< |
import os |
4 |
> |
import os,subprocess |
5 |
|
import ROOT |
6 |
|
from array import array |
7 |
|
from math import sqrt |
89 |
|
|
90 |
|
samples = info.get_samples(namelist) |
91 |
|
print(samples) |
92 |
+ |
tmpDir = os.environ["TMPDIR"] |
93 |
|
for job in samples: |
94 |
|
#get trees: |
95 |
|
print(INpath+'/'+job.prefix+job.identifier+'.root') |
96 |
|
input = ROOT.TFile.Open(INpath+'/'+job.prefix+job.identifier+'.root','read') |
97 |
|
print(OUTpath+'/'+job.prefix+job.identifier+'.root') |
98 |
< |
outfile = ROOT.TFile.Open(OUTpath+'/'+job.prefix+job.identifier+'.root','recreate') |
98 |
> |
outfile = ROOT.TFile.Open(tmpDir+'/'+job.prefix+job.identifier+'.root','recreate') |
99 |
|
input.cd() |
100 |
|
obj = ROOT.TObject |
101 |
|
for key in ROOT.gDirectory.GetListOfKeys(): |
137 |
|
newtree.Fill() |
138 |
|
newtree.AutoSave() |
139 |
|
outfile.Close() |
140 |
+ |
targetStorage = OUTpath.replace('gsidcap://t3se01.psi.ch:22128/','srm://t3se01.psi.ch:8443/srm/managerv2?SFN=')+'/'+job.prefix+job.identifier+'.root' |
141 |
+ |
command = 'lcg-del -b -D srmv2 -l %s' %(targetStorage) |
142 |
+ |
print(command) |
143 |
+ |
subprocess.call([command], shell=True) |
144 |
+ |
command = 'lcg-cp -b -D srmv2 file:///%s %s' %(tmpDir+'/'+job.prefix+job.identifier+'.root',targetStorage) |
145 |
+ |
print(command) |
146 |
+ |
subprocess.call([command], shell=True) |
147 |
|
|
148 |
|
print('\n') |