MadGraph/Pythia8 hepmc and Rivet

Asked by Martin Habedank on 2020-05-27

Hi,

I'm trying to generate a hepmc file with MadGraph and showering by Pythia8 that I can afterwards use with Rivet. However, there are two problems. As I'm not sure whether they are unrelated or not, I'll post them here together.

1)
When I'm running MG5_aMC_v2_7_2 with the following script:

generate p p > t t~
output mininmal_ex
launch
shower=Pythia8
set nevents 1000

Pythia8 is not "visibly" switched on in the options, as was the case for MG5_aMC_v2_6_7:

MG5_aMC_v2_7_2 logfile snapshot:
[...]
************************************************************
INFO: load configuration from /lustre/fs22/group/atlas/mhabedan/Contur/run_MadGraph/mininmal_ex/Cards/me5_configuration.txt
INFO: load configuration from /lustre/fs22/group/atlas/mhabedan/Software/MG5_aMC_v2_7_2/input/mg5_configuration.txt
INFO: load configuration from /lustre/fs22/group/atlas/mhabedan/Contur/run_MadGraph/mininmal_ex/Cards/me5_configuration.txt
Using default text editor "vi". Set another one in ./input/mg5_configuration.txt
generate_events run_01
The following switches determine which programs are run:
/=================== Description ===================|============= values ==============|======== other options ========\
| 1. Choose the shower/hadronization program | ^[[1m shower^[[0m = ^[[31mOFF^[[0m | Pythia8 |
| 2. Choose the detector simulation program | ^[[1m detector^[[0m = ^[[01mNot Avail.^[[0m | Please install module |
| 3. Choose an analysis package (plot/convert) | ^[[1m analysis^[[0m = ^[[01mNot Avail.^[[0m | Please install module |
| 4. Decay onshell particles | ^[[1m madspin^[[0m = ^[[31mOFF^[[0m | ON|onshell |
| 5. Add weights to events for new hypp. | ^[[1m reweight^[[0m = ^[[31mOFF^[[0m | ON |
\=======================================================================================================================/
Either type the switch number (1 to 5) to change its setting,
Set any switch explicitly (e.g. type 'shower=Pythia8' at the prompt)
Type 'help' for the list of all valid option
Type '0', 'auto', 'done' or just press enter when you are done.
set nevents 1000
^[[1mINFO: modify parameter nevents of the run_card.dat to 1000 ^[[0m
Do you want to edit a card (press enter to bypass editing)?
/------------------------------------------------------------\
| ^[[31m1^[[0m. param : ^[[32mparam_card.dat^[[0m |
| ^[[31m2^[[0m. run : ^[[32mrun_card.dat^[[0m |
| ^[[31m3^[[0m. pythia8 : ^[[32mpythia8_card.dat^[[0m |
\------------------------------------------------------------/
 you can also
[...]

MG5_aMC_v2_6_7 logfile snapshot:
[...]
************************************************************
INFO: load configuration from /lustre/fs22/group/atlas/mhabedan/Contur/run_MadGraph/mininmal_ex/Cards/me5_configuration.txt
INFO: load configuration from /lustre/fs22/group/atlas/mhabedan/Software/MG5_aMC_v2_6_7/input/mg5_configuration.txt
INFO: load configuration from /lustre/fs22/group/atlas/mhabedan/Contur/run_MadGraph/mininmal_ex/Cards/me5_configuration.txt
Using default text editor "vi". Set another one in ./input/mg5_configuration.txt
generate_events run_01
The following switches determine which programs are run:
/=================== Description ===================|============= values ==============|======== other options ========\
| 1. Choose the shower/hadronization program | ^[[1m shower^[[0m = ^[[31mOFF^[[0m | Pythia8 |
| 2. Choose the detector simulation program | ^[[1m detector^[[0m = ^[[01mNot Avail.^[[0m | Please install module |
| 3. Choose an analysis package (plot/convert) | ^[[1m analysis^[[0m = ^[[01mNot Avail.^[[0m | Please install module |
| 4. Decay onshell particles | ^[[1m madspin^[[0m = ^[[31mOFF^[[0m | ON|onshell |
| 5. Add weights to events for new hypp. | ^[[1m reweight^[[0m = ^[[31mOFF^[[0m | ON |
\=======================================================================================================================/
Either type the switch number (1 to 5) to change its setting,
Set any switch explicitly (e.g. type 'shower=Pythia8' at the prompt)
Type 'help' for the list of all valid option
Type '0', 'auto', 'done' or just press enter when you are done.
The following switches determine which programs are run:
/=================== Description ===================|============= values ==============|======== other options ========\
| 1. Choose the shower/hadronization program | ^[[1m shower^[[0m = ^[[32mPythia8^[[0m | OFF |
| 2. Choose the detector simulation program | ^[[1m detector^[[0m = ^[[31mOFF^[[0m | Please install module |
| 3. Choose an analysis package (plot/convert) | ^[[1m analysis^[[0m = ^[[31mOFF^[[0m | Please install module |
| 4. Decay onshell particles | ^[[1m madspin^[[0m = ^[[31mOFF^[[0m | ON|onshell |
| 5. Add weights to events for new hypp. | ^[[1m reweight^[[0m = ^[[31mOFF^[[0m | ON |
\=======================================================================================================================/
Either type the switch number (1 to 5) to change its setting,
Set any switch explicitly (e.g. type 'shower=OFF' at the prompt)
Type 'help' for the list of all valid option
Type '0', 'auto', 'done' or just press enter when you are done.
set nevents 1000
^[[1mINFO: modify parameter nevents of the run_card.dat to 1000 ^[[0m
Do you want to edit a card (press enter to bypass editing)?
/------------------------------------------------------------\
| ^[[31m1^[[0m. param : ^[[32mparam_card.dat^[[0m |
| ^[[31m2^[[0m. run : ^[[32mrun_card.dat^[[0m |
| ^[[31m3^[[0m. pythia8 : ^[[32mpythia8_card.dat^[[0m |
\------------------------------------------------------------/
 you can also
[...]

Is that expected and something that was changed from MG5 2.6.7 to MG5 2.7.2? As far as I can tell, the actual showering with Pythia8 *does* happen in both cases.

2)
Depending on the MadGraph and Rivet version, interplay between those two does or does not work. What I found out so far is that
MG5 2.6.7 + Rivet 3.1.0: does not work (a)
MG5 2.6.7 + Rivet 3.1.1: works
MG5 2.7.2 + Rivet 3.1.0: does not work (b)
MG5 2.7.2 + Rivet 3.1.1: does not work (c)
Hereby, "works" means that after running the short MG5 script from above events can be processed as expected while "does not work" means that I end up with one of the following error messages:

case (a)
» rivet -a ATLAS_2016_I1469071 minimal_ex_MG2p67/Events/run_01/tag_1_pythia8_events.hepmc.gz
Rivet 3.1.0 running on machine wgs32.zeuthen.desy.de (x86_64) at 2020-05-27 11:52:21
Could not identify nominal weight. Please check your HEPMC file.
»

case (b)
» rivet -a ATLAS_2016_I1469071 minimal_ex_MG2p72/Events/run_01/tag_1_pythia8_events.hepmc.gz
Rivet 3.1.0 running on machine wgs32.zeuthen.desy.de (x86_64) at 2020-05-27 11:50:00
streaming input: end key not found setting badbit.
Could not read from 'minimal_ex_MG2p72/Events/run_01/tag_1_pythia8_events.hepmc.gz' (error=basic_ios::clear: iostream error)
»

case (c)
» rivet -a ATLAS_2016_I1469071 minimal_ex_MG2p72/Events/run_01/tag_1_pythia8_events.hepmc.gz mhabedan@wgs32
Rivet 3.1.1 running on machine wgs32.zeuthen.desy.de (x86_64) at 2020-05-27 11:54:34
streaming input: end key not found setting badbit.
Could not read from 'minimal_ex_MG2p72/Events/run_01/tag_1_pythia8_events.hepmc.gz' (error=basic_ios::clear: iostream error)
»

Do you any idea why that is?

Thanks,
Martin

Question information

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

1) It is switch on since it ask you to edit the pythia8_card. I changed the display otherwise this was printed too many times to the screen in interactive session. Looks like in scripting session this is not printed anynore but this is not a real issue to my point of view.

2) We do not have any official interface to Rivet. And I have only run Rivet once in my all life. So I will not be able to help you on that.
You should contact Rivet author and provide them (I guess) the hepmc file annd they should be able to help you.
(Additionally since the HepMC file is not created by us but by Pythia8, even if the issue is in the input file, this should be then reported to Pythia author)

Cheers,

Olivier

Martin Habedank (habedama) said : #2

Hi!

1) I was just unsure about that but if it's expected behaviour that's perfectly fine.

2) Okay, I'm going to contact the Pythia and/ or Rivet team about this then.

Thanks for your help!
Martin

Martin Habedank (habedama) said : #3

Thanks Olivier Mattelaer, that solved my question.

Martin Habedank (habedama) said : #4

Hi!

I talked to the Rivet team. The problem with the output of MG5 2.6.7 was known and fixed in Rivet 3.1.1.
For the output of MG5 2.7.2 they tracked down the issue to a duplicate "HepMC::IO_GenEvent-START_EVENT_LISTING" statement in the hepmc file which is therefore not following the hepmc standard anymore. Removing the duplicate statement solves the problem, but this is nothing that can be fixed on the Rivet side.
I uploaded two examples with 10 events generated with the above mentioned code: https://cernbox.cern.ch/index.php/s/WPO5w7d3SBZXX9c for the working MG 2.6.7 output and https://cernbox.cern.ch/index.php/s/NyL7q0CNOXm2p7U with the duplicate line from MG5 2.7.2.

Cheers,
Martin

Hi,

Could you try the following patch:

=== modified file 'madgraph/interface/madevent_interface.py'
--- madgraph/interface/madevent_interface.py 2020-05-21 10:51:17 +0000
+++ madgraph/interface/madevent_interface.py 2020-06-08 13:48:30 +0000
@@ -4693,7 +4693,7 @@
                             devnull.close()
                             if pid == 0:
                                 misc.call('head -n -1 %s | tail -n +%d > %s/tmpfile' %
- (hepmc_file, n_head, os.path.dirname(hepmc_file)), shell=True)
+ (hepmc_file, n_head+1, os.path.dirname(hepmc_file)), shell=True)
                                 misc.call(['mv', 'tmpfile', os.path.basename(hepmc_file)], cwd=os.path.dirname(hepmc_file))
                             elif sys.platform == 'darwin':
                                 # sed on MAC has slightly different synthax than on

The issue is os dependent so I can not claim that it fixes the situation on your OS, but it does at least on Ubuntu18

Cheers,

Olivier

Martin Habedank (habedama) said : #6

Hi,

yes, that solves the problem for my OS (Scientific Linux 7.7) as well! Thanks a lot!

Cheers,
Martin