ATLAS Offline Software
Functions | Variables
python.LHAPDFsupport Namespace Reference

Functions

def get_LHAPDF_DATA_PATH ()
 
def get_LHAPDF_PATHS ()
 
def get_lhapdf_id_and_name (pdf)
 
def resetLHAPDF (origLHAPATH='', origLHAPDF_DATA_PATH='')
 

Variables

 mglog = Logging.logging.getLogger('MCJobOptionUtils')
 

Function Documentation

◆ get_LHAPDF_DATA_PATH()

def python.LHAPDFsupport.get_LHAPDF_DATA_PATH ( )

Definition at line 13 of file LHAPDFsupport.py.

14  return get_LHAPDF_PATHS()[1]
15 
16 

◆ get_lhapdf_id_and_name()

def python.LHAPDFsupport.get_lhapdf_id_and_name (   pdf)
Function to get lhapdf id and name from either id or name.

Definition at line 33 of file LHAPDFsupport.py.

33 def get_lhapdf_id_and_name(pdf):
34  ''' Function to get lhapdf id and name from either id or name.'''
35  pdfname=''
36  pdfid=-999
37  LHADATAPATH=get_LHAPDF_DATA_PATH()
38  pdflist = open(LHADATAPATH+'/pdfsets.index','r')
39  if isinstance(pdf,int) or pdf.isdigit():
40  pdf=int(pdf)
41  pdfid=pdf
42  for line in pdflist:
43  splitline=line.split()
44  if int(splitline[0]) == pdfid:
45  pdfname=splitline[1]
46  break
47  else:
48  pdfname=pdf
49  for line in pdflist:
50  splitline=line.split()
51  if splitline[1] == pdfname:
52  pdfid=int(splitline[0])
53  break
54  pdflist.close()
55 
56  if pdfname=='':
57  err='Couldn\'t find PDF name associated to ID %i in %s.'%(pdfid,LHADATAPATH+'/pdfsets.index')
58  mglog.error(err)
59  raise RuntimeError(err)
60  if pdfid<0:
61  err='Couldn\'t find PDF ID associated to name %s in %s.'%(pdfname,LHADATAPATH+'/pdfsets.index')
62  mglog.error(err)
63  raise RuntimeError(err)
64 
65  return pdfid,pdfname
66 
67 

◆ get_LHAPDF_PATHS()

def python.LHAPDFsupport.get_LHAPDF_PATHS ( )

Definition at line 17 of file LHAPDFsupport.py.

17 def get_LHAPDF_PATHS():
18  LHADATAPATH=None
19  LHAPATH=None
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:
22  LHAPATH=p
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:
25  LHADATAPATH=p
26  if LHADATAPATH is None:
27  LHADATAPATH=LHAPATH
28  if LHAPATH is None:
29  mglog.error('Could not find path to LHAPDF installation')
30  return LHAPATH,LHADATAPATH
31 
32 

◆ resetLHAPDF()

def python.LHAPDFsupport.resetLHAPDF (   origLHAPATH = '',
  origLHAPDF_DATA_PATH = '' 
)

Definition at line 68 of file LHAPDFsupport.py.

68 def resetLHAPDF(origLHAPATH='',origLHAPDF_DATA_PATH=''):
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'])
74 

Variable Documentation

◆ mglog

python.LHAPDFsupport.mglog = Logging.logging.getLogger('MCJobOptionUtils')

Definition at line 9 of file LHAPDFsupport.py.

python.LHAPDFsupport.get_LHAPDF_PATHS
def get_LHAPDF_PATHS()
Definition: LHAPDFsupport.py:17
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
python.LHAPDFsupport.get_LHAPDF_DATA_PATH
def get_LHAPDF_DATA_PATH()
Definition: LHAPDFsupport.py:13
Trk::open
@ open
Definition: BinningType.h:40
python.LHAPDFsupport.resetLHAPDF
def resetLHAPDF(origLHAPATH='', origLHAPDF_DATA_PATH='')
Definition: LHAPDFsupport.py:68
python.LHAPDFsupport.get_lhapdf_id_and_name
def get_lhapdf_id_and_name(pdf)
Definition: LHAPDFsupport.py:33
Trk::split
@ split
Definition: LayerMaterialProperties.h:38