function inside MG?

Asked by Igna on 2019-09-03

Is it possible to write a function inside madgraph or to call mg and use its output from python/c++/bash?

I need the decay constant g' such that the event has a specific cross-section. This was my approach so far:

1. Set a value for g' and calculate the decay width, with a formula that depends on g'.
2. Run MG, with the decay width (WZp) and the decay constant g' (gZp) parameters set accordingly.
3. Adjust the g' value to get closer to the desired cross-section.
4. Repeat.

Is there a way to implement this process within MG? Or else said,
a. Can I set the parameter WZp to a mathematical formula depending on g'?
b. Can I incorporate the value of gZp in an while/do loop, to repeat if the result cross-section is not accurate? (basically, write an optimization function)

If this is not possible,
c. Can I call MG from python, and adjust its parameters from python?

Thank you!

Question information

English Edit question
MadGraph5_aMC@NLO Edit question
No assignee Edit question
Last query:
Last reply:


a. You can edit the UFO model and change the external parameter to an internal parameter and replace the value by the associated formula.

b/c. We do not have any documented API and/or official method to call such programs outside of a bash script.
Now you if you have a decent level of python, you can take a look at the ./bin/madevent script
and you can take a look at the following documentation:
This should allow you to see how to feed command in a programmatic way.
The second issue is how to recover the cross section and for that you should use the
where "self" is your main madevent interface object.



Can you help with this problem?

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

To post a message you must log in.