8 from AthenaCommon
import Logging
9 mglog = Logging.logging.getLogger(
'MCJobOptionUtils')
20 for p
in os.environ[
'LHAPATH'].
split(
':')+os.environ[
'LHAPDF_DATA_PATH'].
split(
':'):
21 if os.path.exists(p+
"/../../lib/")
and LHAPATH
is None:
23 for p
in os.environ[
'LHAPDF_DATA_PATH'].
split(
':')+os.environ[
'LHAPATH'].
split(
':'):
24 if os.path.exists(p)
and LHADATAPATH
is None and p!=LHAPATH:
26 if LHADATAPATH
is None:
29 mglog.error(
'Could not find path to LHAPDF installation')
30 return LHAPATH,LHADATAPATH
34 ''' Function to get lhapdf id and name from either id or name.'''
38 pdflist =
open(LHADATAPATH+
'/pdfsets.index',
'r')
39 if isinstance(pdf,int)
or pdf.isdigit():
43 splitline=line.split()
44 if int(splitline[0]) == pdfid:
50 splitline=line.split()
51 if splitline[1] == pdfname:
52 pdfid=
int(splitline[0])
57 err=
'Couldn\'t find PDF name associated to ID %i in %s.'%(pdfid,LHADATAPATH+
'/pdfsets.index')
59 raise RuntimeError(err)
61 err=
'Couldn\'t find PDF ID associated to name %s in %s.'%(pdfname,LHADATAPATH+
'/pdfsets.index')
63 raise RuntimeError(err)
69 mglog.info(
'Restoring original LHAPDF env variables:')
70 os.environ[
'LHAPATH']=origLHAPATH
71 os.environ[
'LHAPDF_DATA_PATH']=origLHAPDF_DATA_PATH
72 mglog.info(
'LHAPATH='+os.environ[
'LHAPATH'])
73 mglog.info(
'LHAPDF_DATA_PATH='+os.environ[
'LHAPDF_DATA_PATH'])