3 from __future__
import print_function
6 from subprocess
import Popen, PIPE
11 samweb = samweb_cli.SAMWebClient(experiment=
'dune')
13 files = samweb.listFiles(
"run_number %s " % (sys.argv[1]) +
"and run_type protodune-sp and data_tier raw")
18 events = samweb.getURL(
'/files/metadata/event_numbers', {
'file_name': file}).json()
19 if int(sys.argv[2])
in events :
20 print (
"Raw: ", file,
'--nskip',events.index(
int(sys.argv[2])))
22 cmd = [
"samweb",
"locate-file", file]
23 p = Popen(cmd, stdout=PIPE, stderr=PIPE)
24 stdout, stderr = p.communicate()
26 print (stdout.decode(
'ascii'))
27 print (
"Access URLs:")
28 cmd = [
"samweb",
"get-file-access-url", file,
"--schema=xroot"]
29 p = Popen(cmd, stdout=PIPE, stderr=PIPE)
30 stdout, stderr = p.communicate()
32 print (stdout.decode(
'ascii'))
33 filename = os.path.splitext(file)[0]
34 recofiles = samweb.listFiles(
"run_number %s " % (sys.argv[1]) +
"and run_type protodune-sp and (data_tier full-reconstructed or data_tier reco-recalibrated)")
35 for recofile
in recofiles:
36 if filename+
'_' in recofile:
37 print (
"Reco: ", recofile,
'--nskip',events.index(
int(sys.argv[2])))
39 cmd = [
"samweb",
"locate-file", recofile]
40 p = Popen(cmd, stdout=PIPE, stderr=PIPE)
41 stdout, stderr = p.communicate()
43 print (stdout.decode(
'ascii'))
44 print (
"Access URLs:")
45 cmd = [
"samweb",
"get-file-access-url", recofile,
"--schema=xroot"]
46 p = Popen(cmd, stdout=PIPE, stderr=PIPE)
47 stdout, stderr = p.communicate()
49 print (stdout.decode(
'ascii'))