3 from __future__
import print_function
7 import subprocess
as sp
12 prefix = {
'express':
'express_',
'Egamma':
'physics_',
'CosmicCalo':
'physics_',
'JetTauEtmiss':
'physics_',
'Main':
'physics_',
'ZeroBias':
'physics_',
'MinBias':
'physics_',
'UPC':
'physics_',
'HardProbes':
'physics_'}
13 if any(pref
in stream
for pref
in prefix.values()):
17 fullstream = prefix[stream]+stream
21 path =
'/eos/atlas/atlastier0/rucio/'+tag + \
23 listOfDirs = [ path+p
for p
in os.listdir(path) ]
24 for iDir
in listOfDirs:
25 if (
"HIST.%s" % (amiTag)
in iDir):
26 files = [ iDir+
"/"+f
for f
in os.listdir(iDir) ]
28 return "FILE NOT FOUND"
30 print(
"WARNING: pathExtract returning",len(files),
"hist files, where one is expected in path",iDir)
33 return "FILE NOT FOUND"
39 path =
'/eos/atlas/atlastier0/tzero/prod/'+tag + \
41 P = sp.Popen([
'/usr/bin/eos',
'ls', path], stdout=sp.PIPE, stderr=sp.PIPE)
42 p = P.communicate()[0].
decode(
"utf-8")
43 listOfFiles = p.split(
'\n')
46 for iFile
in listOfFiles:
47 if (
"recon.HIST.%s" % (amiTag)
in iFile
and "LOG" not in iFile):
48 path =
'/eos/atlas/atlastier0/tzero/prod/'+tag+
'/' + \
50 P = sp.Popen([
'/usr/bin/eos',
'ls', path],
51 stdout=sp.PIPE, stderr=sp.PIPE)
52 p = P.communicate()[0].
decode(
"utf-8")
53 listOfFiles2 = p.split(
'\n')
54 for iFile2
in listOfFiles2:
55 if (
"data" in iFile2):
56 ilb =
int((iFile2.split(
"_lb")[1]).
split(
"._")[0])
58 if (lb0 <= ilb
and ilb <= lb1):
59 path =
'/eos/atlas/atlastier0/tzero/prod/'+tag+
'/' + \
61 str(run)+
'/'+iFile+
'/'+iFile2
67 return "FILE NOT FOUND"
75 path =
'/eos/atlas/atlastier0/rucio/'+tag + \
77 P = sp.Popen([
'/usr/bin/eos',
'ls', path], stdout=sp.PIPE, stderr=sp.PIPE)
80 files = p[0].
decode(
"utf-8")
81 files = files.split(
'\n')
83 dotAmiTag =
".%s" % (amiTag)
84 if (
'TAG' in f
and dotAmiTag
in f):
89 print(
'no TAG directory found in %s' % (path))
92 P = sp.Popen([
'/usr/bin/eos',
'ls', path], stdout=sp.PIPE, stderr=sp.PIPE)
99 listOfFiles.append(pathFile)
108 path =
'/eos/atlas/atlascerngroupdisk/det-larg/Tier0/perm/' + \
110 P = sp.Popen([
'/usr/bin/eos',
'ls', path], stdout=sp.PIPE, stderr=sp.PIPE)
113 files = p[0].
decode(
"utf-8")
114 files = files.split(
'\n')
116 dotAmiTag =
".%s" % (amiTag)
117 if (
'LARNOISE' in f
and dotAmiTag
in f):
122 print(
'no LARNOISE directory found in %s' % (path))
125 P = sp.Popen([
'/usr/bin/eos',
'ls', path], stdout=sp.PIPE, stderr=sp.PIPE)
131 pathFile = path+iFile
132 listOfFiles.append(pathFile)
141 path =
'/eos/atlas/atlastier0/rucio/'+tag + \
143 P = sp.Popen([
'/usr/bin/eos',
'ls', path], stdout=sp.PIPE, stderr=sp.PIPE)
146 files = p[0].
decode(
"utf-8")
147 files = files.split(
'\n')
149 dotAmiTag =
".%s" % (amiTag)
150 if (
'.ESD' in f
and dotAmiTag
in f):
155 print(
'no ESD directory found in %s' % (path))
158 P = sp.Popen([
'/usr/bin/eos',
'ls', path], stdout=sp.PIPE, stderr=sp.PIPE)
164 pathFile = path+iFile
165 listOfFiles.append(pathFile)
174 P = sp.Popen([
'ls', path], stdout=sp.PIPE, stderr=sp.PIPE)
178 files = p[0].
decode(
"utf-8")
179 files = files.split(
'\n')
183 listOfFiles.append(pathFile)
187 print(
'no file containing %f found in %s' % (filterName, path))