Skip to content
Snippets Groups Projects

Modify the functions in FileFromDirac

Merged Chenjia Zhang requested to merge zcjmodifyfilefromdirac into master
All threads resolved!
1 file
+ 16
3
Compare changes
  • Side-by-side
  • Inline
@@ -111,9 +111,9 @@ def get_access_urls_data(bkkpath, sites_to_remove=[], max_files=500):
# ensure files are always in same order
file_list.sort()
if any(file.endswith("raw") for file in file_list):
raise NotImplementedError(
"File ending with 'raw' found, please write a script manually")
# if any(file.endswith("raw") for file in file_list):
# raise NotImplementedError(
# "File ending with 'raw' found, please write a script manually")
print(
"#### Checking output of . /cvmfs/lhcb.cern.ch/lib/LbEnv --quiet; lb-dirac dirac-dms-lfn-accessURL --Terminal"
@@ -139,7+139,7 @@
if successful:
m = re.match(r' +([^: ]*) *: *(.*)', line)
if m:
urls[m.group(1)].append(m.group(2))
# Get the first URL (if more than one) for each LFN, while skipping
# LFNs for which we couldn't find an URL (e.g. a site was down).
@@ -151,7+151,7 @@
lfn for lfn in lfns_tmp if not any(site in lfn for site in excluded)
]
lfns = sorted(lfns, key=lambda str: not "eoslhcb.cern.ch" in str)
if any(file.endswith("raw") for file in file_list):
lfns = [lfn for lfn in lfns if "eoslhcb.cern.ch" in lfn]
return lfns
# TODO warn if some of the first N files was not resolved to a URL
# since then one would get numerically different results.
if __name__ == "__main__":
# bkk_path = ("/MC/Upgrade/Beam7000GeV-Upgrade-MagDown-Nu7.6-25ns-Pythia8"
# "/Sim10-Up08/Digi15-Up04")
# evt_type = "30000000"
bkk_path_for_data = (
"/LHCb/Collision18/Beam6500GeV-VeloClosed-MagDown/Real\ Data/Reco18/Stripping34/90000000/BHADRON.MDST"
)
# for url in get_access_urls_mc(bkk_path, evt_type, ['XDIGI']):
for url in get_access_urls_data(bkk_path_for_data, max_files=10):
print(url)
Loading