how to print the cross section to my file

Asked by joholi on 2015-07-27

Hi,

     === Results Summary for run: run_01 tag: tag_1 ===

     Cross-section : 0.07237 +- 4.755e-05 pb
     Nb of events : 400000

Madgraph5 prints the above information to the terminal and web browser. Is there a way to only print the numerical value
"0.07237" to one file?

Many thanks.

Question information

Language:
English Edit question
Status:
Answered
For:
MadGraph5_aMC@NLO Edit question
Assignee:
No assignee Edit question
Last query:
2015-07-27
Last reply:
2015-12-11

You will find instruction (for version 2.3.0, this is not possible in previous version)
in the following FAQ. Look at the end of the example.

the "launch -i" from the ./bin/mg5 executable is equivalent to a ./bin/madevent (both open a shell where you can instruct to display the results in various format).

Cheers,

Olivier

FAQ #2186: “How to script MG5 run?”.

juyepes (juyepes1985) said : #2

Hi Joholi and Olivier,

I also would like to list in a single column just the cross section value.

I'm using MG5_aMC_v2_2_3. I've been trying with :

--------------------------------------------------------------------------------------
  launch MYDIRECTORY -i
       print_results --path=./cross_section_top.txt --format=short

--------------------------------------------------------------------------------------

and at the end I just got the last value from the running, and not
only the value

--------------------------------------------------------------------------------------

  === Results Summary for run: run_03 tag: tag_1 process: Zprime-production-3-interp-results ===
     Cross-section : 0.01587 +- 3.336e-05 pb
     Nb of events : 10000
--------------------------------------------------------------------------------------

Thanks so much for your guide!

Hi,

The “—format=short” option was introduce in 2.3.0

So indeed that option will not work for you.

Cheers,

Olivier

> On Dec 10, 2015, at 05:12, juyepes <email address hidden> wrote:
>
> Question #269708 on MadGraph5_aMC@NLO changed:
> https://answers.launchpad.net/mg5amcnlo/+question/269708
>
> juyepes requested more information:
> Hi Joholi and Olivier,
>
>
> I also would like to list in a single column just the cross section value.
>
> I'm using MG5_aMC_v2_2_3. I've been trying with :
>
> --------------------------------------------------------------------------------------
> launch MYDIRECTORY -i
> print_results --path=./cross_section_top.txt --format=short
>
> --------------------------------------------------------------------------------------
>
> and at the end I just got the last value from the running, and not
> only the value
>
> --------------------------------------------------------------------------------------
>
> === Results Summary for run: run_03 tag: tag_1 process: Zprime-production-3-interp-results ===
> Cross-section : 0.01587 +- 3.336e-05 pb
> Nb of events : 10000
> --------------------------------------------------------------------------------------
>
> Thanks so much for your guide!
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

juyepes (juyepes1985) said : #4

Is there a way-out then in 2.23 ?

Thanks so much for your reply!

Hi,

You can
1)parse the cross.html file.
2) use the print_results function and parse the output

But not way without parsing a file. (But update to 2.3.3)

Cheers,

Olivier

> On Dec 10, 2015, at 10:07, juyepes <email address hidden> wrote:
>
> Question #269708 on MadGraph5_aMC@NLO changed:
> https://answers.launchpad.net/mg5amcnlo/+question/269708
>
> juyepes requested more information:
> Is there a way-out then in 2.23 ?
>
> Thanks so much for your reply!
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

juyepes (juyepes1985) said : #6

Ok, if I now parse myself like this:

--------------------------------------------------------------------------------------
  launch MYDIRECTORY -i
       print_results --path=./cross_section_top.txt --format=short

--------------------------------------------------------------------------------------

at the end I just got the last value from the running. How to get the
full list?

Thanks

you can do
print_results run_01
print_results run_02
and so on.

Cheers,

Olivier

> On Dec 10, 2015, at 13:27, juyepes <email address hidden> wrote:
>
> Question #269708 on MadGraph5_aMC@NLO changed:
> https://answers.launchpad.net/mg5amcnlo/+question/269708
>
> juyepes requested more information:
> Ok, if I now parse myself like this:
>
> --------------------------------------------------------------------------------------
> launch MYDIRECTORY -i
> print_results --path=./cross_section_top.txt --format=short
>
> --------------------------------------------------------------------------------------
>
> at the end I just got the last value from the running. How to get the
> full list?
>
> Thanks
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

juyepes (juyepes1985) said : #9

I tried

--------------------------------------------------------------------------------------------------------------------------------------------------------
launch
       set MZR 2.100000e+03
       set WZR Auto
launch
       set MZR 2.1000e+03
       set WZR Auto

launch pp-Zprime-tt-15-interp-results -i
       print_results run_01--path=./pp-Zprime-tt-15-interp-results/pp-zprime-tt-cross-sections.txt --format=short
       print_results run_02--path=./pp-Zprime-tt-15-interp-results/pp-zprime-tt-cross-sections.txt --format=short
--------------------------------------------------------------------------------------------------------------------------------------------------------

and

--------------------------------------------------------------------------------------------------------------------------------------------------------
launch
       set MZR 2.100000e+03
       set WZR Auto

launch pp-Zprime-tt-15-interp-results -i
       print_results run_01--path=./pp-Zprime-tt-15-interp-results/pp-zprime-tt-cross-sections.txt --format=short

launch
       set MZR 2.200000e+03
       set WZR Auto

launch pp-Zprime-tt-15-interp-results -i
       print_results run_02--path=./pp-Zprime-tt-15-interp-results/pp-zprime-tt-cross-sections.txt --format=short
--------------------------------------------------------------------------------------------------------------------------------------------------------

and none of them worked out. What would the bug? Thanks

Hi,

You mean that the content of pp-Zprime-tt-15-interp-results/pp-zprime-tt-cross-sections.txt
is empty?

That command will always overwrite the file so you will have at most one entry if you specify the same path without asking append mode
If you want to append the results, you can use the option —mode=a as indicated in the help of the routine:

(here is the one of 2.2.0, I do not have 2.2.3 on my computer)
PROC_sm_0>help print_result
INFO: syntax: print_result [RUN] [TAG] [options]
INFO: -- show in text format the status of the run (cross-section/nb-event/...)
INFO: --path= defines the path of the output file.
INFO: --mode=a allow to add the information at the end of the file.

Cheers,

Olivier

> On Dec 10, 2015, at 14:27, juyepes <email address hidden> wrote:
>
> Question #269708 on MadGraph5_aMC@NLO changed:
> https://answers.launchpad.net/mg5amcnlo/+question/269708
>
> juyepes requested more information:
> I tried
>
> --------------------------------------------------------------------------------------------------------------------------------------------------------
> launch
> set MZR 2.100000e+03
> set WZR Auto
> launch
> set MZR 2.1000e+03
> set WZR Auto
>
> launch pp-Zprime-tt-15-interp-results -i
> print_results run_01--path=./pp-Zprime-tt-15-interp-results/pp-zprime-tt-cross-sections.txt --format=short
> print_results run_02--path=./pp-Zprime-tt-15-interp-results/pp-zprime-tt-cross-sections.txt --format=short
> --------------------------------------------------------------------------------------------------------------------------------------------------------
>
> and
>
> --------------------------------------------------------------------------------------------------------------------------------------------------------
> launch
> set MZR 2.100000e+03
> set WZR Auto
>
> launch pp-Zprime-tt-15-interp-results -i
> print_results run_01--path=./pp-Zprime-tt-15-interp-results/pp-zprime-tt-cross-sections.txt --format=short
>
> launch
> set MZR 2.200000e+03
> set WZR Auto
>
> launch pp-Zprime-tt-15-interp-results -i
> print_results run_02--path=./pp-Zprime-tt-15-interp-results/pp-zprime-tt-cross-sections.txt --format=short
> --------------------------------------------------------------------------------------------------------------------------------------------------------
>
> and none of them worked out. What would the bug? Thanks
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

juyepes (juyepes1985) said : #11

Ok thanks so much Oliver, I got it finally doing

---------------------------------------------------------------------------------------------------------------------------------------------------
launch pp-trial-results -i
        print_results run_01 --mode=a --format=short --path=./pp-trial-results/pp-zprime-tt-cross-sections.txt
        print_results run_02 --mode=a --format=short --path=./pp-trial-results/pp-zprime-tt-cross-sections.txt
---------------------------------------------------------------------------------------------------------------------------------------------------

But the question is still about obtaining just the cross sectio value using print_results function in 2.2.3.

Is that possible? I

In 2.3.0 and later, you have the —format=short options
which give you the information in a nice multi-column way.
This is not available in 2.2.3.
If you want something else, tell me I might implement it in the next version

Cheers,

Olivier

> On Dec 11, 2015, at 09:57, juyepes <email address hidden> wrote:
>
> Question #269708 on MadGraph5_aMC@NLO changed:
> https://answers.launchpad.net/mg5amcnlo/+question/269708
>
> juyepes requested more information:
> Ok thanks so much Oliver, I got it finally doing
>
> ---------------------------------------------------------------------------------------------------------------------------------------------------
> launch pp-trial-results -i
> print_results run_01 --mode=a --format=short --path=./pp-trial-results/pp-zprime-tt-cross-sections.txt
> print_results run_02 --mode=a --format=short --path=./pp-trial-results/pp-zprime-tt-cross-sections.txt
> ---------------------------------------------------------------------------------------------------------------------------------------------------
>
> But the question is still about obtaining just the cross sectio value
> using print_results function in 2.2.3.
>
> Is that possible? I
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

juyepes (juyepes1985) said : #13

Ok I got less stuff via 2.3.3, like:

----------------------------------------------------------
run_01 tag_1 0.1859 0.00029789 10000
run_02 tag_1 0.17412 0.00034975 10000
----------------------------------------------------------

But I just would like to have

----------------------------------------------------------
0.1859
0.17412
----------------------------------------------------------

i.e., only the central value of the cross section.
Is it possible??

Thanks!

juyepes (juyepes1985) said : #14

I found a way-out to handle this output, so it was
very useful your guide, thanks so much dear Olivier!

Can you help with this problem?

Provide an answer of your own, or ask joholi for more information if necessary.

To post a message you must log in.