Condition "If" statement evaluation in a parameter

Asked by Manning on 2011-04-01

Hi MG team,

I have some parameters which contain conditional statements dependent on the values of other internal and external parameters. The model is in UFO format from FeynRules. For example, the width of my U11p particle is:

WU11p = Parameter(name = 'WU11p',
                  nature = 'internal',
                  type = 'real',
                  value = '2*((aEW*D11p*(1 + D11p**2/(2.*MWmu11**2))*(1 - MWmu11**2/D11p**2)**2)/(16.*sw**s2) + (aEW*(1 - MWmu11**2/U11p**2)**2*U11p*(1 + U11p**2/(2.*MWmu11**2)))/(16.*sw**s2) + If(ymb.ne.0,(aEW*Sqrt((B11p**2 - (MWmu11**2 + ymb**2)**2)*(B11p**2 - (MWmu11**2 - ymb**2)**2))*((B11p**2 + ymb**2)/(2.*B11p**2) + (B11p**2 - ymb**2)**2/(2.*B11p**2*ymb**2) - MWmu11**2/B11p**2))/(8.*sw**2*B11p),(aEW*B11p*(1 - MWmu11**2/B11p**2)**2*(1 + B11p**2/(2.*MWmu11**2)))/(16.*sw**s2)) + If(ymc.ne.0,(aEW*Sqrt((C11p**2 - (MWmu11**2 + ymc**2)**2)*(C11p**2 - (MWmu11**2 - ymc**2)**2))*((C11p**2 + ymc**2)/(2.*C11p**2) + (C11p**2 - ymc**2)**2/(2.*C11p**2*ymc**2) - MWmu11**2/C11p**2))/(8.*sw**2*C11p),(aEW*C11p*(1 - MWmu11**2/C11p**2)**2*(1 + C11p**2/(2.*MWmu11**2)))/(16.*sw**s2)) + If(yms.ne.0,(aEW*Sqrt((S11p**2 - (MWmu11**2 + yms**2)**2)*(S11p**2 - (MWmu11**2 - yms**2)**2))*((S11p**2 + yms**2)/(2.*S11p**2) + (S11p**2 - yms**2)**2/(2.*S11p**2*yms**2) - MWmu11**2/S11p**2))/(8.*sw**2*S11p),(aEW*S11p*(1 - MWmu11**2/S11p**2)**2*(1 + S11p**2/(2.*MWmu11**2)))/(16.*sw**s2)) + If(ymt.ne.0,(aEW*Sqrt((T11p**2 - (MWmu11**2 + ymt**2)**2)*(T11p**2 - (MWmu11**2 - ymt**2)**2))*((T11p**2 + ymt**2)/(2.*T11p**2) + (T11p**2 - ymt**2)**2/(2.*T11p**2*ymt**2) - MWmu11**2/T11p**2))/(8.*sw**2*T11p),(aEW*T11p*(1 - MWmu11**2/T11p**2)**2*(1 + T11p**2/(2.*MWmu11**2)))/(16.*sw**s2)))',
                  texname = '\\text{WU11p}')

When I try to run MG5, it gives me the error:

Export UFO model to MG4 format
ERROR: Illegal character '.'
ERROR: Syntax error at 'ne'
Command "output test5" interrupted with error:
NameError : global name 'MadGraph5Error' is not defined
Please report this bug on https://bugs.launchpad.net/madgraph5
More information is found in 'MG5_debug'.
Please attach this file to your report.

Is it possible to do what I am trying to do? For this case I could find a workaround, but there is a case which depends on the evaluated value of the particle masses, which I do not know a priori. Thanks for your help.

Cheers,

Peter M.

Question information

Language:
English Edit question
Status:
Answered
For:
MadGraph5_aMC@NLO Edit question
Assignee:
No assignee Edit question
Last query:
2011-04-01
Last reply:
2011-04-13

Hi Peter,

The expression that you need to enter should be a python expression.
Not a fortran one.
The expression should also be a one line expression. So they are no
way to introduce a "IF" statement.

In principle you can use the python trick (via the fct_library):
myif = lambda cond, T, F: cond and T or F
indeed:
myif(1, 2, 3) -> 3
myif(0, 2, 3) -> 2
BUT they are a side effect:
myif(0, 0, 3) -> 3 (and not 0)

But I'm pretty sure that MG5 will not support it. (Convert such
expression in C/Fortran will not be easy)
Let me talk with the Full MG Team/UFO Team about this point. And then
I'll go back to you.

Cheers,

Olivier

On 01-avr.-11, at 12:27, Manning wrote:

> New question #151288 on MadGraph5:
> https://answers.launchpad.net/madgraph5/+question/151288
>
> Hi MG team,
>
> I have some parameters which contain conditional statements
> dependent on the values of other internal and external parameters.
> The model is in UFO format from FeynRules. For example, the width of
> my U11p particle is:
>
> WU11p = Parameter(name = 'WU11p',
> nature = 'internal',
> type = 'real',
> value = '2*((aEW*D11p*(1 + D11p**2/
> (2.*MWmu11**2))*(1 - MWmu11**2/D11p**2)**2)/(16.*sw**s2) + (aEW*(1 -
> MWmu11**2/U11p**2)**2*U11p*(1 + U11p**2/(2.*MWmu11**2)))/
> (16.*sw**s2) + If(ymb.ne.0,(aEW*Sqrt((B11p**2 - (MWmu11**2 +
> ymb**2)**2)*(B11p**2 - (MWmu11**2 - ymb**2)**2))*((B11p**2 + ymb**2)/
> (2.*B11p**2) + (B11p**2 - ymb**2)**2/(2.*B11p**2*ymb**2) - MWmu11**2/
> B11p**2))/(8.*sw**2*B11p),(aEW*B11p*(1 - MWmu11**2/B11p**2)**2*(1 +
> B11p**2/(2.*MWmu11**2)))/(16.*sw**s2)) + If(ymc.ne.0,
> (aEW*Sqrt((C11p**2 - (MWmu11**2 + ymc**2)**2)*(C11p**2 - (MWmu11**2
> - ymc**2)**2))*((C11p**2 + ymc**2)/(2.*C11p**2) + (C11p**2 -
> ymc**2)**2/(2.*C11p**2*ymc**2) - MWmu11**2/C11p**2))/(8.*sw**2*C11p),
> (aEW*C11p*(1 - MWmu11**2/C11p**2)**2*(1 + C11p**2/(2.*MWmu11**2)))/
> (16.*sw**s2)) + If(yms.ne.0,(aEW*Sqrt((S11p**2 - (MWmu11**2 +
> yms**2)**2)*(S11p**2 - (MWmu11**2 - yms**2)**2))*((S11p**2 + yms**2)/
> (2.*S11p**2) + (S11p**2 - yms**2)**2/(2.*S11p**2*yms**2) - MWmu11**2/
> S11p**2))/(8.*sw**2*S11p),(aEW*S11p*(1 - MWmu11**2/S11p**2)**2*(1 +
> S11p**2/(2.*MWmu11**2)))/(16.*sw**s2)) + If(ymt.ne.0,
> (aEW*Sqrt((T11p**2 - (MWmu11**2 + ymt**2)**2)*(T11p**2 - (MWmu11**2
> - ymt**2)**2))*((T11p**2 + ymt**2)/(2.*T11p**2) + (T11p**2 -
> ymt**2)**2/(2.*T11p**2*ymt**2) - MWmu11**2/T11p**2))/(8.*sw**2*T11p),
> (aEW*T11p*(1 - MWmu11**2/T11p**2)**2*(1 + T11p**2/(2.*MWmu11**2)))/
> (16.*sw**s2)))',
> texname = '\\text{WU11p}')
>
> When I try to run MG5, it gives me the error:
>
> Export UFO model to MG4 format
> ERROR: Illegal character '.'
> ERROR: Syntax error at 'ne'
> Command "output test5" interrupted with error:
> NameError : global name 'MadGraph5Error' is not defined
> Please report this bug on https://bugs.launchpad.net/madgraph5
> More information is found in 'MG5_debug'.
> Please attach this file to your report.
>
> Is it possible to do what I am trying to do? For this case I could
> find a workaround, but there is a case which depends on the
> evaluated value of the particle masses, which I do not know a
> priori. Thanks for your help.
>
> Cheers,
>
> Peter M.
>
> --
> You received this question notification because you are a member of
> MadTeam, which is an answer contact for MadGraph5.

Manning (petermanningjr) said : #2

Thanks Olivier. I think I'm at the point where I realize it is making life
more complicated to NOT write an external program to calculate widths and
print out the param_card values for specific model parameters. But, being
able to have a parameter which contains a conditional statement would still
be useful.

Thanks,

Peter

On Fri, Apr 1, 2011 at 12:48 PM, Olivier Mattelaer <
<email address hidden>> wrote:

> Your question #151288 on MadGraph5 changed:
> https://answers.launchpad.net/madgraph5/+question/151288
>
> Status: Open => Answered
>
> Olivier Mattelaer proposed the following answer:
> Hi Peter,
>
> The expression that you need to enter should be a python expression.
> Not a fortran one.
> The expression should also be a one line expression. So they are no
> way to introduce a "IF" statement.
>
> In principle you can use the python trick (via the fct_library):
> myif = lambda cond, T, F: cond and T or F
> indeed:
> myif(1, 2, 3) -> 3
> myif(0, 2, 3) -> 2
> BUT they are a side effect:
> myif(0, 0, 3) -> 3 (and not 0)
>
> But I'm pretty sure that MG5 will not support it. (Convert such
> expression in C/Fortran will not be easy)
> Let me talk with the Full MG Team/UFO Team about this point. And then
> I'll go back to you.
>
> Cheers,
>
> Olivier
>
>
>
>
>
> On 01-avr.-11, at 12:27, Manning wrote:
>
> > New question #151288 on MadGraph5:
> > https://answers.launchpad.net/madgraph5/+question/151288
> >
> > Hi MG team,
> >
> > I have some parameters which contain conditional statements
> > dependent on the values of other internal and external parameters.
> > The model is in UFO format from FeynRules. For example, the width of
> > my U11p particle is:
> >
> > WU11p = Parameter(name = 'WU11p',
> > nature = 'internal',
> > type = 'real',
> > value = '2*((aEW*D11p*(1 + D11p**2/
> > (2.*MWmu11**2))*(1 - MWmu11**2/D11p**2)**2)/(16.*sw**s2) + (aEW*(1 -
> > MWmu11**2/U11p**2)**2*U11p*(1 + U11p**2/(2.*MWmu11**2)))/
> > (16.*sw**s2) + If(ymb.ne.0,(aEW*Sqrt((B11p**2 - (MWmu11**2 +
> > ymb**2)**2)*(B11p**2 - (MWmu11**2 - ymb**2)**2))*((B11p**2 + ymb**2)/
> > (2.*B11p**2) + (B11p**2 - ymb**2)**2/(2.*B11p**2*ymb**2) - MWmu11**2/
> > B11p**2))/(8.*sw**2*B11p),(aEW*B11p*(1 - MWmu11**2/B11p**2)**2*(1 +
> > B11p**2/(2.*MWmu11**2)))/(16.*sw**s2)) + If(ymc.ne.0,
> > (aEW*Sqrt((C11p**2 - (MWmu11**2 + ymc**2)**2)*(C11p**2 - (MWmu11**2
> > - ymc**2)**2))*((C11p**2 + ymc**2)/(2.*C11p**2) + (C11p**2 -
> > ymc**2)**2/(2.*C11p**2*ymc**2) - MWmu11**2/C11p**2))/(8.*sw**2*C11p),
> > (aEW*C11p*(1 - MWmu11**2/C11p**2)**2*(1 + C11p**2/(2.*MWmu11**2)))/
> > (16.*sw**s2)) + If(yms.ne.0,(aEW*Sqrt((S11p**2 - (MWmu11**2 +
> > yms**2)**2)*(S11p**2 - (MWmu11**2 - yms**2)**2))*((S11p**2 + yms**2)/
> > (2.*S11p**2) + (S11p**2 - yms**2)**2/(2.*S11p**2*yms**2) - MWmu11**2/
> > S11p**2))/(8.*sw**2*S11p),(aEW*S11p*(1 - MWmu11**2/S11p**2)**2*(1 +
> > S11p**2/(2.*MWmu11**2)))/(16.*sw**s2)) + If(ymt.ne.0,
> > (aEW*Sqrt((T11p**2 - (MWmu11**2 + ymt**2)**2)*(T11p**2 - (MWmu11**2
> > - ymt**2)**2))*((T11p**2 + ymt**2)/(2.*T11p**2) + (T11p**2 -
> > ymt**2)**2/(2.*T11p**2*ymt**2) - MWmu11**2/T11p**2))/(8.*sw**2*T11p),
> > (aEW*T11p*(1 - MWmu11**2/T11p**2)**2*(1 + T11p**2/(2.*MWmu11**2)))/
> > (16.*sw**s2)))',
> > texname = '\\text{WU11p}')
> >
> > When I try to run MG5, it gives me the error:
> >
> > Export UFO model to MG4 format
> > ERROR: Illegal character '.'
> > ERROR: Syntax error at 'ne'
> > Command "output test5" interrupted with error:
> > NameError : global name 'MadGraph5Error' is not defined
> > Please report this bug on https://bugs.launchpad.net/madgraph5
> > More information is found in 'MG5_debug'.
> > Please attach this file to your report.
> >
> > Is it possible to do what I am trying to do? For this case I could
> > find a workaround, but there is a case which depends on the
> > evaluated value of the particle masses, which I do not know a
> > priori. Thanks for your help.
> >
> > Cheers,
> >
> > Peter M.
> >
> > --
> > You received this question notification because you are a member of
> > MadTeam, which is an answer contact for MadGraph5.
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
>
> https://answers.launchpad.net/madgraph5/+question/151288/+confirm?answer_id=0
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/madgraph5/+question/151288
>
> You received this question notification because you are a direct
> subscriber of the question.
>

We will keep the idea of the if.
And will try to implement it in a future version.

Can you help with this problem?

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

To post a message you must log in.