Can not use my own PDF sets not listed in pdfsets.index of "read-only" LHAPDF installation

Asked by Dmitri Konstantinov on 2020-11-06

Dear colleagues,

We are trying to run a simulation with own pdf sets.
We use LCG installation of madgraph5amc/2.7.2.atlas3 built with lhapdf/6.2.3, all these versions are deployed to CVMFS, ie. read-only.

set pdlabel=lhapdf
set lhaid=1102100

And run fails with:

INFO: Starting run
INFO: Compiling the code
INFO: Using LHAPDF v6.2.3 interface for PDFs
Command "launch auto --parton" interrupted with error:
MadGraph5Error : lhaid 1102100 not valid input number for the current lhapdf
Please report this bug on https://bugs.launchpad.net/mg5amcnlo
More information is found in '/tmp/dkonst/madgraph/test/run_01_tag_1_debug.log'.
Please attach this file to your report.

The problem was traced down to line 4037 of common_run_interface.py script, where you check requested set id with available pdf sets :

if lhaid in self.lhapdf_pdfsets:

And it can not find user's set in this list and fails.

The list is created inside MadGraph by running LHAPDF `lhapdf-config --datadir`and taking sets from pdfsets.index from this path.
And of course it is not user's pdfsets.index and it doesn't contain "new" set.

As a workaround I copied Magraph locally and modified this line:

--- madgraph/interface/common_run_interface.py.orig 2020-11-06 07:03:08.494266288 +0100
+++ madgraph/interface/common_run_interface.py 2020-11-06 07:03:54.287603306 +0100
@@ -4034,7 +4034,7 @@
                 lhaid = int(lhaid)
             if isinstance(lhaid, (int,float)):
                 try:
- if lhaid in self.lhapdf_pdfsets:
+ if lhaid in self.get_lhapdf_pdfsets_list(pdfsets_dir):
                         pdfsetname.add(self.lhapdf_pdfsets[lhaid]['filename'])
                     else:
                         raise MadGraph5Error('lhaid %s not valid input number for the current lhapdf' % lhaid )

Now it works for me. Though I am not sure that this doesn't break something esle as I did not study the logic of the script well.

The same problem appears if someone would like to use a new pdf set added to /cvmfs/sft.cern.ch/lcg/external/lhapdfsets/current/ after LCG LHAPDF installation i.e. not listed in LHAPDF pdfsets.index.

Am we doing something wrong?

Kind Regards,
       Dmitri

Question information

Language:
English Edit question
Status:
Expired
For:
MadGraph5_aMC@NLO Edit question
Assignee:
No assignee Edit question
Last query:
2020-11-09
Last reply:
2020-11-24

This question was reopened

Did you change "pdfsets_dir" in top of that?

If not, I do not understand, how your change could have impact the running of the code since
this variable is setup in that exact same way (i.e. this is a cache of that command to avoid to read the index too many times)
self.lhapdf_pdfsets = self.get_lhapdf_pdfsets_list(pdfsetsdir)

Cheers,

Olivier

Dmitri Konstantinov (dkonst13) said : #2

Dear Olivier,

Not really.

There is a difference.

You use "pdfsetsdir" which points to PDF set directory returned by lhapdf-config [1]
But by my fix I use "pdfsets_dir" which is taken from my LHAPDF_DATA_PATH.

I can not change old pdfsets.index which lhapdf-config of read-only installation returns me.

I think you can easily reproduce the problem - just try to use any PDF set (setting LHAPDF_DATA_PATH) which was not in your initial installation of LHAPDF

Thank you,
    Dmitri

[1]
pdfsetsdir = subprocess.Popen([self.options['lhapdf'], '--datadir'],
stdout = subprocess.PIPE).stdout.read().decode().strip()
self.lhapdf_pdfsets = self.get_lhapdf_pdfsets_list(pdfsetsdir)

[2]

pdfsets_dir = self.get_lhapdf_pdfsetsdir()
........
.........
         # check if the LHAPDF_DATA_PATH variable is defined
        if 'LHAPDF_DATA_PATH' in list(os.environ.keys()) and os.environ['LHAPDF_DATA_PATH']:
            datadir = os.environ['LHAPDF_DATA_PATH']
        elif lhapdf_version.startswith('5.'):
            datadir = subprocess.Popen([lhapdf_config, '--pdfsets-path'],
                         stdout = subprocess.PIPE).stdout.read().decode().strip()

        elif lhapdf_version.startswith('6.'):
            datadir = subprocess.Popen([lhapdf_config, '--datadir'],
                         stdout = subprocess.PIPE).stdout.read().decode().strip()

        if ':' in datadir:
            for totry in datadir.split(':'):
                if os.path.exists(pjoin(totry, 'pdfsets.index')):
                    return totry
            else:
                return None

Launchpad Janitor (janitor) said : #3

This question was expired because it remained in the 'Open' state without activity for the last 15 days.