Error when writing out from script

Asked by santiago on 2018-11-29

I am using the following script to calculate and write out the cross sections of the p p > t t~ h process at different energies:

generate p p > t t~ h [QCD]
output pptott~Hrun_90400_qcd

launch pptott~Hrun_90400_qcd
 set ebeam1 3500
 set ebeam2 3500
 set run_tag 3500
 set pdlabel lhapdf
 set lhaid 90400
launch
 set ebeam1 4000
 set ebeam2 4000
 set run_tag 4000
 set pdlabel lhapdf
 set lhaid 90400
launch
 set ebeam1 5000
 set ebeam2 5000
 set run_tag 5000
 set pdlabel lhapdf
 set lhaid 90400
launch
 set ebeam1 6000
 set ebeam2 6000
 set run_tag 6000
 set pdlabel lhapdf
 set lhaid 90400
launch
 set ebeam1 7000
 set ebeam2 7000
 set run_tag 7000
 set pdlabel lhapdf
 set lhaid 90400
launch pptott~Hrun_90400_qcd -i
 print_results --path=./cross_section_pptott~Hrun_90400_qcd.txt --format=short

which is basically the script that was suggested in https://answers.launchpad.net/mg5amcnlo/+faq/2186. The last part of the script gives an error and the file cross_section_pptott~Hrun_90400_qcd.txt is not generated. Te error is:

Command "import /data/slopez/MG5_aMC_v2_6_4/pptott~Hrun_90400_qcd.txt" interrupted in sub-command:
"print_results --path=./cross_section_pptott~Hrun_90400_qcd.txt --format=short" with error:
AttributeError : 'aMCatNLOCmdShell' object has no attribute 'print_results_in_file'
Please report this bug on https://bugs.launchpad.net/mg5amcnlo
More information is found in '/data/slopez/MG5_aMC_v2_6_4/pptott~Hrun_90400_qcd/run_03_5000_debug.log'.
Please attach this file to your report.

The upper part of the log file looks like this:

print_results --path=./cross_section_pptott~Hrun_90400_qcd.txt --format=short
Traceback (most recent call last):
  File "/data/slopez/MG5_aMC_v2_6_4/madgraph/interface/extended_cmd.py", line 1501, in onecmd
    return self.onecmd_orig(line, **opt)
  File "/data/slopez/MG5_aMC_v2_6_4/madgraph/interface/extended_cmd.py", line 1450, in onecmd_orig
    return func(arg, **opt)
  File "/data/slopez/MG5_aMC_v2_6_4/madgraph/interface/master_interface.py", line 274, in do_import
    self.cmd.do_import(self, *args, **opts)
  File "/data/slopez/MG5_aMC_v2_6_4/madgraph/interface/madgraph_interface.py", line 5268, in do_import
    self.import_command_file(args[1])
  File "/data/slopez/MG5_aMC_v2_6_4/madgraph/interface/extended_cmd.py", line 1643, in import_command_file
    self.exec_cmd(line, precmd=True)
  File "/data/slopez/MG5_aMC_v2_6_4/madgraph/interface/extended_cmd.py", line 1528, in exec_cmd
    stop = Cmd.onecmd_orig(current_interface, line, **opt)
  File "/data/slopez/MG5_aMC_v2_6_4/madgraph/interface/extended_cmd.py", line 1450, in onecmd_orig
    return func(arg, **opt)
  File "/data/slopez/MG5_aMC_v2_6_4/madgraph/interface/common_run_interface.py", line 2314, in do_print_results
    self.print_results_in_file(one_result, options['path'], options['mode'], options['format'])
AttributeError: 'aMCatNLOCmdShell' object has no attribute 'print_results_in_file'

Up to the "print results" part, the script seems to work fine. The normal results html page pops up and displays the cross sections, although there is a red "ERROR" link on the third row of the "banner" column, which links to the log file mentioned above.

Very similar versions of this script do work, for example:

generate p p > t t~ h
output pptott~Hrun_90400

launch pptott~Hrun_90400
 set ebeam1 3500
 set ebeam2 3500
 set run_tag 3500
 set pdlabel lhapdf
 set lhaid 90400
launch
 set ebeam1 4000
 set ebeam2 4000
 set run_tag 4000
 set pdlabel lhapdf
 set lhaid 90400
launch
 set ebeam1 5000
 set ebeam2 5000
 set run_tag 5000
 set pdlabel lhapdf
 set lhaid 90400
launch
 set ebeam1 6000
 set ebeam2 6000
 set run_tag 6000
 set pdlabel lhapdf
 set lhaid 90400
launch
 set ebeam1 7000
 set ebeam2 7000
 set run_tag 7000
 set pdlabel lhapdf
 set lhaid 90400
launch pptott~Hrun_90400 -i
 print_results --path=./cross_section_pptott~Hrun_90400.txt --format=short

which correctly produces the expected file:

# run_name tag cross error Nb_event cross_after_matching nb_event_after matching
run_01 3500 0.0658311 0.000145373501306 10000
run_02 4000 0.0975298 0.000228989244739 10000
run_03 5000 0.1815546 0.000411066444776 10000
run_04 6000 0.294359 0.000629008909985 10000
run_05 7000 0.433445 0.00111454056817 10000

The only difference between the scripts is that in the second one i appended [QED] to the generate command (apart from the name of the output and of the cross section file).

Any tips? Thanks in advance

*I couldnt find out how to attach files so i did not include the rest of the log file. Please let me know if that would be needed.

Question information

Language:
English Edit question
Status:
Solved
For:
MadGraph5_aMC@NLO Edit question
Assignee:
No assignee Edit question
Solved by:
Olivier Mattelaer
Solved:
2018-11-29
Last query:
2018-11-29
Last reply:
2018-11-29

Hi,

Thanks for the notice,
looks like indeed that function (print_results)
only exists for LO run.
I will take a look on how to add it for NLO run as well.

Cheers,

Olivier

> On 29 Nov 2018, at 11:23, santiago <email address hidden> wrote:
>
> New question #676448 on MadGraph5_aMC@NLO:
> https://answers.launchpad.net/mg5amcnlo/+question/676448
>
> I am using the following script to calculate and write out the cross sections of the p p > t t~ h process at different energies:
>
> generate p p > t t~ h [QCD]
> output pptott~Hrun_90400_qcd
>
> launch pptott~Hrun_90400_qcd
> set ebeam1 3500
> set ebeam2 3500
> set run_tag 3500
> set pdlabel lhapdf
> set lhaid 90400
> launch
> set ebeam1 4000
> set ebeam2 4000
> set run_tag 4000
> set pdlabel lhapdf
> set lhaid 90400
> launch
> set ebeam1 5000
> set ebeam2 5000
> set run_tag 5000
> set pdlabel lhapdf
> set lhaid 90400
> launch
> set ebeam1 6000
> set ebeam2 6000
> set run_tag 6000
> set pdlabel lhapdf
> set lhaid 90400
> launch
> set ebeam1 7000
> set ebeam2 7000
> set run_tag 7000
> set pdlabel lhapdf
> set lhaid 90400
> launch pptott~Hrun_90400_qcd -i
> print_results --path=./cross_section_pptott~Hrun_90400_qcd.txt --format=short
>
> which is basically the script that was suggested in https://answers.launchpad.net/mg5amcnlo/+faq/2186. The last part of the script gives an error and the file cross_section_pptott~Hrun_90400_qcd.txt is not generated. Te error is:
>
> Command "import /data/slopez/MG5_aMC_v2_6_4/pptott~Hrun_90400_qcd.txt" interrupted in sub-command:
> "print_results --path=./cross_section_pptott~Hrun_90400_qcd.txt --format=short" with error:
> AttributeError : 'aMCatNLOCmdShell' object has no attribute 'print_results_in_file'
> Please report this bug on https://bugs.launchpad.net/mg5amcnlo
> More information is found in '/data/slopez/MG5_aMC_v2_6_4/pptott~Hrun_90400_qcd/run_03_5000_debug.log'.
> Please attach this file to your report.
>
>
>
> The upper part of the log file looks like this:
>
> print_results --path=./cross_section_pptott~Hrun_90400_qcd.txt --format=short
> Traceback (most recent call last):
> File "/data/slopez/MG5_aMC_v2_6_4/madgraph/interface/extended_cmd.py", line 1501, in onecmd
> return self.onecmd_orig(line, **opt)
> File "/data/slopez/MG5_aMC_v2_6_4/madgraph/interface/extended_cmd.py", line 1450, in onecmd_orig
> return func(arg, **opt)
> File "/data/slopez/MG5_aMC_v2_6_4/madgraph/interface/master_interface.py", line 274, in do_import
> self.cmd.do_import(self, *args, **opts)
> File "/data/slopez/MG5_aMC_v2_6_4/madgraph/interface/madgraph_interface.py", line 5268, in do_import
> self.import_command_file(args[1])
> File "/data/slopez/MG5_aMC_v2_6_4/madgraph/interface/extended_cmd.py", line 1643, in import_command_file
> self.exec_cmd(line, precmd=True)
> File "/data/slopez/MG5_aMC_v2_6_4/madgraph/interface/extended_cmd.py", line 1528, in exec_cmd
> stop = Cmd.onecmd_orig(current_interface, line, **opt)
> File "/data/slopez/MG5_aMC_v2_6_4/madgraph/interface/extended_cmd.py", line 1450, in onecmd_orig
> return func(arg, **opt)
> File "/data/slopez/MG5_aMC_v2_6_4/madgraph/interface/common_run_interface.py", line 2314, in do_print_results
> self.print_results_in_file(one_result, options['path'], options['mode'], options['format'])
> AttributeError: 'aMCatNLOCmdShell' object has no attribute 'print_results_in_file'
>
> Up to the "print results" part, the script seems to work fine. The normal results html page pops up and displays the cross sections, although there is a red "ERROR" link on the third row of the "banner" column, which links to the log file mentioned above.
>
>
> Very similar versions of this script do work, for example:
>
> generate p p > t t~ h
> output pptott~Hrun_90400
>
> launch pptott~Hrun_90400
> set ebeam1 3500
> set ebeam2 3500
> set run_tag 3500
> set pdlabel lhapdf
> set lhaid 90400
> launch
> set ebeam1 4000
> set ebeam2 4000
> set run_tag 4000
> set pdlabel lhapdf
> set lhaid 90400
> launch
> set ebeam1 5000
> set ebeam2 5000
> set run_tag 5000
> set pdlabel lhapdf
> set lhaid 90400
> launch
> set ebeam1 6000
> set ebeam2 6000
> set run_tag 6000
> set pdlabel lhapdf
> set lhaid 90400
> launch
> set ebeam1 7000
> set ebeam2 7000
> set run_tag 7000
> set pdlabel lhapdf
> set lhaid 90400
> launch pptott~Hrun_90400 -i
> print_results --path=./cross_section_pptott~Hrun_90400.txt --format=short
>
> which correctly produces the expected file:
>
> # run_name tag cross error Nb_event cross_after_matching nb_event_after matching
> run_01 3500 0.0658311 0.000145373501306 10000
> run_02 4000 0.0975298 0.000228989244739 10000
> run_03 5000 0.1815546 0.000411066444776 10000
> run_04 6000 0.294359 0.000629008909985 10000
> run_05 7000 0.433445 0.00111454056817 10000
>
> The only difference between the scripts is that in the second one i appended [QED] to the generate command (apart from the name of the output and of the cross section file).
>
> Any tips? Thanks in advance
>
> *I couldnt find out how to attach files so i did not include the rest of the log file. Please let me know if that would be needed.
>
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

santiago (santiagolpch) said : #2

Thanks Olivier Mattelaer, that solved my question.