Generated Pythia code cannot compile

Asked by Marco H.

I am trying to use MadGraph in order to extend Pythia by additional processes. To this end, I installed Pythia within MadGraph via the command

install pythia8

This worked without problems. I then followed the Pythia documentation and ran as an example

generate ve ve~ > ve ve~
output pythia8

Again this generated all the relevant files correctly. However, when going into the Pythia directory and then into examples, I was not able to compile the example file with 'make -f <Makefile>'. Instead. I got multiple errors of the form

HelAmps_sm.cc:515:20: error: expected ';' after expression
  denom = COUP/(1.)

and indeed, the generated file HelAmps_sm.cc has semicola missing in multiple lines.

How can I resolve this issue?

Thanks and best regards,
Marco

Question information

Language:
English Edit question
Status:
Solved
For:
MadGraph5_aMC@NLO Edit question
Assignee:
No assignee Edit question
Solved by:
Olivier Mattelaer
Solved:
Last query:
Last reply:
Revision history for this message
Olivier Mattelaer (olivier-mattelaer) said :
#1

Hi,

For some reason this "major" new feature of MG5 was never a success.
One of the reason is that the community decide to use MG5 as an event generator for pythia8 rather than a matrix-element provider for Pythia8. One drawback of the matrix-element provider option is naturally that it really on API that can easily broke. I guess that we should at some point remove the possibility to do it.

This being said the patch is quite easy:

diff --git a/aloha/aloha_writers.py b/aloha/aloha_writers.py
index 650db7512..f7644e3bd 100755
--- a/aloha/aloha_writers.py
+++ b/aloha/aloha_writers.py
@@ -1638,7 +1638,7 @@ class ALOHAWriterForCPP(WriteALOHA):
                 coeff = 'denom'
                 if not aloha.complex_mass:
                     if self.routine.denominator:
- out.write(' denom = %(COUP)s/(%(denom)s)\n' % {'COUP': coup_name,\
+ out.write(' denom = %(COUP)s/(%(denom)s);\n' % {'COUP': coup_name,\
                                 'denom':self.write_obj(self.routine.denominator)})
                     else:
                         out.write(' denom = %(coup)s/((P%(i)s[0]*P%(i)s[0])-(P%(i)s[1]*P%(i)s[1])-(P%(i)s[2]*P%(i)s[2])-(P%(i)s[3]*P%(i)s[3]) - M%(i)s * (M%(i)s -cI* W%(i)s));\n' % \

and I have pushed it to 3.5.4:
https://github.com/mg5amcnlo/mg5amcnlo/commit/a3a8adce706f8d6d2a7b49e3b62a89105d5da935
fix a cpp issue with helicity recycling function (problemating when o… · mg5amcnlo/mg5amcnlo@a3a8adc
github.com

This being said, the code still does not compile for me with the following error:

Sigma_sm_vlvl_vlvl.cc: In member function ‘virtual void Pythia8::Sigma_sm_vlvl_vlvl::initProc()’:
Sigma_sm_vlvl_vlvl.cc:27:51: error: ‘couplingsPtr’ was not declared in this scope; did you mean ‘Couplings’?
   27 | pars->setIndependentParameters(particleDataPtr, couplingsPtr, slhaPtr);
      | ^~~~~~~~~~~~
      | Couplings
Sigma_sm_vlvl_vlvl.cc: In member function ‘virtual void Pythia8::Sigma_sm_vlvl_vlvl::sigmaKin()’:
Sigma_sm_vlvl_vlvl.cc:43:49: error: ‘couplingsPtr’ was not declared in this scope; did you mean ‘Couplings’?
   43 | pars->setDependentParameters(particleDataPtr, couplingsPtr, slhaPtr, alpS);
      | ^~~~~~~~~~~~
      | Couplings
make[1]: *** [tmp/archive/Sigma_sm_vlvl_vlvl.o] Error 1

Looking at that now to see if this is a API issue or something on our side

Cheers,

Olivier

> On 28 Feb 2024, at 14:55, Marco H. <email address hidden> wrote:
>
> generate ve ve~ > ve ve~
> output pythia8

Revision history for this message
Best Olivier Mattelaer (olivier-mattelaer) said :
#2

And the following patch should solve the remaining issue:

https://github.com/mg5amcnlo/mg5amcnlo/commit/205a813d13e997afbb0d82900ca6724e1954fa92

Thanks a lot for reporting,

Olivier
> On 6 Mar 2024, at 15:21, Olivier Mattelaer <email address hidden> wrote:
>
> Hi,
>
> For some reason this "major" new feature of MG5 was never a success.
> One of the reason is that the community decide to use MG5 as an event generator for pythia8 rather than a matrix-element provider for Pythia8. One drawback of the matrix-element provider option is naturally that it really on API that can easily broke. I guess that we should at some point remove the possibility to do it.
>
> This being said the patch is quite easy:
>
> diff --git a/aloha/aloha_writers.py b/aloha/aloha_writers.py
> index 650db7512..f7644e3bd 100755
> --- a/aloha/aloha_writers.py
> +++ b/aloha/aloha_writers.py
> @@ -1638,7 +1638,7 @@ class ALOHAWriterForCPP(WriteALOHA):
> coeff = 'denom'
> if not aloha.complex_mass:
> if self.routine.denominator:
> - out.write(' denom = %(COUP)s/(%(denom)s)\n' % {'COUP': coup_name,\
> + out.write(' denom = %(COUP)s/(%(denom)s);\n' % {'COUP': coup_name,\
> 'denom':self.write_obj(self.routine.denominator)})
> else:
> out.write(' denom = %(coup)s/((P%(i)s[0]*P%(i)s[0])-(P%(i)s[1]*P%(i)s[1])-(P%(i)s[2]*P%(i)s[2])-(P%(i)s[3]*P%(i)s[3]) - M%(i)s * (M%(i)s -cI* W%(i)s));\n' % \
>
> and I have pushed it to 3.5.4:
> https://github.com/mg5amcnlo/mg5amcnlo/commit/a3a8adce706f8d6d2a7b49e3b62a89105d5da935
>
> This being said, the code still does not compile for me with the following error:
>
> Sigma_sm_vlvl_vlvl.cc: In member function ‘virtual void Pythia8::Sigma_sm_vlvl_vlvl::initProc()’:
> Sigma_sm_vlvl_vlvl.cc:27:51: error: ‘couplingsPtr’ was not declared in this scope; did you mean ‘Couplings’?
> 27 | pars->setIndependentParameters(particleDataPtr, couplingsPtr, slhaPtr);
> | ^~~~~~~~~~~~
> | Couplings
> Sigma_sm_vlvl_vlvl.cc: In member function ‘virtual void Pythia8::Sigma_sm_vlvl_vlvl::sigmaKin()’:
> Sigma_sm_vlvl_vlvl.cc:43:49: error: ‘couplingsPtr’ was not declared in this scope; did you mean ‘Couplings’?
> 43 | pars->setDependentParameters(particleDataPtr, couplingsPtr, slhaPtr, alpS);
> | ^~~~~~~~~~~~
> | Couplings
> make[1]: *** [tmp/archive/Sigma_sm_vlvl_vlvl.o] Error 1
>
> Looking at that now to see if this is a API issue or something on our side
>
> Cheers,
>
> Olivier
>
>
>> On 28 Feb 2024, at 14:55, Marco H. <email address hidden> wrote:
>>
>> generate ve ve~ > ve ve~
>> output pythia8
>

Revision history for this message
Marco H. (hep-hufnagel) said :
#3

Thanks a lot for the reply and the fix.

Best,
Marco

Revision history for this message
Marco H. (hep-hufnagel) said :
#4

Thanks Olivier Mattelaer, that solved my question.