Error for several HERA PDFs in systematics program

Asked by Kenneth Long on 2017-08-02

Hi experts,

I'm hitting an issue with a couple of HERA PDFs when using the systematics program. Specifically, for --pdf=61230 and --pdf=61130, so HERAPDF20_NLO_VAR and HERAPDF20_NNLO_VAR, I get the following error:

   File "/data/kelong/MadGraph-CMS/wplustest_5f_NLO_mg255/process/bin/internal/systematics.py»
   pdferr = pdfset.uncertainty(values)
   File "lhapdf.pyx", line 329, in lhapdf.PDFSet.uncertainty (lhapdf.cpp:6621)
   RuntimeError: "ErrorType: custom" not supported by LHAPDF::PDFSet::uncertainty.

From looking briefly at the description of the error treatment for these PDF sets, "custom" seems an accurate description. It looks like this might come from the LHAPDF interface, but I can't tell for sure.

Any suggestions? I don't have any issues in the on-the-fly method at NLO or in syscalc at LO.

Thanks!

Kenneth

Question information

Language:
English Edit question
Status:
Solved
For:
MadGraph5_aMC@NLO Edit question
Assignee:
No assignee Edit question
Solved by:
Kenneth Long
Solved:
2017-08-07
Last query:
2017-08-07
Last reply:
2017-08-02

Hi Kenneth,

The problem is actually at the end of the run when trying a write the global information for the cross-section.
In that case, the only thing to do is to bypass that print statement. (That was I was doing for 'unknown' type of error)

You will see below a patch to have such behaviour.

Thanks a lot for your test, this is really cool.

Cheers,

Olivier

=== modified file 'madgraph/various/systematics.py'
--- madgraph/various/systematics.py 2017-08-02 09:55:19 +0000
+++ madgraph/various/systematics.py 2017-08-02 11:43:13 +0000
@@ -444,8 +444,12 @@
             lhapdfid = self.orig_pdf.lhapdfID
             values = pdfs[lhapdfid]
             pdfset = self.pdfsets[lhapdfid]
- pdferr = pdfset.uncertainty(values)
- resume.write( '# PDF variation: +%2.3g%% -%2.3g%%\n' % (pdferr.errplus*100/all_cross[0], pdferr.errminus*100/all_cross[0]))
+ try:
+ pdferr = pdfset.uncertainty(values)
+ except RuntimeError:
+ resume.write( '# PDF variation: missing combination\n')
+ else:
+ resume.write( '# PDF variation: +%2.3g%% -%2.3g%%\n' % (pdferr.errplus*100/all_cross[0], pdferr.errminus*100/all_cross[0]))
         # report error/central not directly linked to the central
         resume.write( "#\n")
         for lhapdfid,values in pdfs.items():
@@ -460,8 +464,13 @@
                 # File "lhapdf.pyx", line 329, in lhapdf.PDFSet.uncertainty (lhapdf.cpp:6621)
                 # RuntimeError: "ErrorType: unknown" not supported by LHAPDF::PDFSet::uncertainty.
                 continue
- pdferr = pdfset.uncertainty(values)
- resume.write( '#PDF %s: %g +%2.3g%% -%2.3g%%\n' % (pdfset.name, pdferr.central,pdferr.errplus*100/all_cross[0], pdferr.errminus*100/all_cross[0]))
+ try:
+ pdferr = pdfset.uncertainty(values)
+ except RuntimeError:
+ # the same error can happend to some other type of error like custom.
+ pass
+ else:
+ resume.write( '#PDF %s: %g +%2.3g%% -%2.3g%%\n' % (pdfset.name, pdferr.central,pdferr.errplus*100/all_cross[0], pdferr.errminus*100/all_cross[0]))

         dyn_name = {1: '\sum ET', 2:'\sum\sqrt{m^2+pt^2}', 3:'0.5 \sum\sqrt{m^2+pt^2}',4:'\sqrt{\hat s}' }
         for key, curr in dyns.items():

> On 2 Aug 2017, at 12:55, Kenneth Long <email address hidden> wrote:
>
> New question #654905 on MadGraph5_aMC@NLO:
> https://answers.launchpad.net/mg5amcnlo/+question/654905
>
> Hi experts,
>
> I'm hitting an issue with a couple of HERA PDFs when using the systematics program. Specifically, for --pdf=61230 and --pdf=61130, so HERAPDF20_NLO_VAR and HERAPDF20_NNLO_VAR, I get the following error:
>
> File "/data/kelong/MadGraph-CMS/wplustest_5f_NLO_mg255/process/bin/internal/systematics.py»
> pdferr = pdfset.uncertainty(values)
> File "lhapdf.pyx", line 329, in lhapdf.PDFSet.uncertainty (lhapdf.cpp:6621)
> RuntimeError: "ErrorType: custom" not supported by LHAPDF::PDFSet::uncertainty.
>
>> From looking briefly at the description of the error treatment for these PDF sets, "custom" seems an accurate description. It looks like this might come from the LHAPDF interface, but I can't tell for sure.
>
> Any suggestions? I don't have any issues in the on-the-fly method at NLO or in syscalc at LO.
>
> Thanks!
>
> Kenneth
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

Kenneth Long (kdlong-e) said : #2

Hi Olivier,

Thanks a lot for the patch! Was it possibly made on a development branch? It fails when I try to apply it to the release version 2.5.5, and the differences aren't trivial enough for me to reconstruct the changes easily.

Cheers,

Kenneth

I'm surprised that the patch program is not able to detect where to apply such patch.
But here it is based on 2.5.5. (They are basically a huge shift in the file but nothing else)

Cheers,

Olivier

=== modified file 'madgraph/various/systematics.py'
--- madgraph/various/systematics.py 2017-03-03 10:07:55 +0000
+++ madgraph/various/systematics.py 2017-08-02 18:44:47 +0000
@@ -364,8 +364,12 @@
             lhapdfid = self.orig_pdf.lhapdfID
             values = pdfs[lhapdfid]
             pdfset = self.pdfsets[lhapdfid]
- pdferr = pdfset.uncertainty(values)
- resume.write( '# PDF variation: +%2.3g%% -%2.3g%%\n' % (pdferr.errplus*100/all_cross[0], pdferr.errminus*100/all_cross[0]))
+ try:
+ pdferr = pdfset.uncertainty(values)
+ except RunTimeError:
+ resume.write( '# PDF variation: combination rules not implemented in lhapdf\n')
+ else:
+ resume.write( '# PDF variation: +%2.3g%% -%2.3g%%\n' % (pdferr.errplus*100/all_cross[0], pdferr.errminus*100/all_cross[0]))
         # report error/central not directly linked to the central
         resume.write( "#\n")
         for lhapdfid,values in pdfs.items():
@@ -380,7 +384,10 @@
                 # File "lhapdf.pyx", line 329, in lhapdf.PDFSet.uncertainty (lhapdf.cpp:6621)
                 # RuntimeError: "ErrorType: unknown" not supported by LHAPDF::PDFSet::uncertainty.
                 continue
- pdferr = pdfset.uncertainty(values)
+ try:
+ pdferr = pdfset.uncertainty(values)
+ except RunTimeError:
+ continue
             resume.write( '#PDF %s: %g +%2.3g%% -%2.3g%%\n' % (pdfset.name, pdferr.central,pdferr.errplus*100/all_cross[0], pdferr.errminus*100/all_cross[0]))

         dyn_name = {1: '\sum ET', 2:'\sum\sqrt{m^2+pt^2}', 3:'0.5 \sum\sqrt{m^2+pt^2}',4:'\sqrt{\hat s}' }

Kenneth Long (kdlong-e) said : #4

Hi Olivier,

I think the indentation in the patch was confusing the patch program. In any case it's working now (with the small modification that RunTimeError --> RuntimeError).

Thanks!

Kenneth