Matrix element integration over 2 final state neutrinos with MG5 standalone

Asked by matteo maltoni

Dear MG5 experts,

I generated a standalone for WW production, with the Ws decaying leptonically into first and second generations, and I'm trying to integrate over the 2 final state neutrinos momentum components.

I'm using scipy.nquad and the integration is taking forever, returning the warning "Integral is probably divergent or slowly convergent".

Do you have any tips to speed up the computations? You can find my piece of code below.

Thank you, hope this was the right place where to ask this question, even if not involving MG5 problems.

Matteo

Here's the part of code doing the integration:

         proc_id = 0 # e+ processes
         pdgf = [-11,12,13,-14]
         if e_pdg < 0: # e- processes
             proc_id = 1
             pdgf = [11,-12,-13,14]

         pdgin_list = [[1,-1],[2,-2],[3,-3],[4,-4],[5,-5]]

         def integrand (pvey,pvex,pvmz,pvez):

             # Neutrinos momenta
             ve_mom = [(pvex**2+pvey**2+pvez**2)**.5,pvex,pvey,pvez]
             pvmx = -(e_mom[1]+mu_mom[1]+pvex)
             pvmy = -(e_mom[2]+mu_mom[2]+pvey)
             vm_mom = [(pvmx**2+pvmy**2+pvmz**2)**.5,pvmx,pvmy,pvmz]

             # Initial state
             pfz = e_mom[3]+mu_mom[3]+ve_mom[3]+vm_mom[3]
             Ef = e_mom[0]+mu_mom[0]+ve_mom[0]+vm_mom[0]
             in1 = [(Ef+pfz)/2,0.,0.,(Ef+pfz)/2]
             in2 = [(Ef-pfz)/2,0.,0.,(pfz-Ef)/2]

             # Matrix element computation
             tmp = 0.

             for pin in [[in1,in2],[in2,in1]]:
                 p_all = [pin[0],pin[1],e_mom,ve_mom,mu_mom,vm_mom]
                 pinv_all = myf.invert_momenta (p_all)

                 for pdgin in pdgin_list:
                     pdgs = pdgin+pdgf
                     pdfw = pdf.xfxQ (pdgin[0],min(p_all[0][0]/ELHC,1),FactScale) * pdf.xfxQ (pdgin[1],min(p_all[1][0]/ELHC,1),FactScale)
                     me = allmatrix2py.smatrixhel (pdgs,proc_id,pinv_all,.09,0.,-1) # Sum over all helicities
                     tmp += pdfw*me

             return tmp

         # Integration limits
         pzmax = ((1.3e4-e_mom[0]-mu_mom[0])**2-(e_mom[1]+mu_mom[1])**2-(e_mom[2]+mu_mom[2])**2)**.5

         def limz (pvez):
             return [-pzmax-pvez,pzmax-pvez]

         def limx (pvmz,pvez):
             pxmax = ((1.3e4-e_mom[0]-mu_mom[0])**2-(e_mom[2]+mu_mom[2])**2-(pvez+pvmz)**2)**.5
             return [-pxmax,pxmax]

         def limy (pvex,pvmz,pvez):
             pymax = ((1.3e4-e_mom[0]-mu_mom[0])**2-(e_mom[1]+mu_mom[1])**2-(pvez+pvmz)**2)**.5
             return [-pymax,pymax]

         try:
             meint = integrate.nquad (integrand,[limy,limx,limz,[-pzmax,pzmax]])
         except:
             print (myrank,pzmax)

         delta_sm = weight*np.sign(meint[0])
         sigma_meas += delta_sm

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

Did you read the paper on that topic?

1) madweight: Automation of the matrix element reweighting method (fortran implementation)
2) momenta: 1805.08555 [hep-ph] (C++ implementation)
3) classifier: Towards a generic implementation of matrix-element maximisation as a classifier in particle physics 1908.05286 [hep-ph] (python)

Cheers,

Olivier

Revision history for this message
matteo maltoni (matteo-maltoni) said :
#2

Thank you Olivier for addressing me to these papers, this method is indeed much faster than the integration.

When it comes to an interference among the SM and a dim-6 operator, do you think is there any particular care I should take in the maximisation, due to the presence of both positive and negative matrix elements?

Best,

Matteo

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

Hi,

Actually, only reference #3 is not doing the integration.
Reference #1 and #2 are actually code (develloped in CP3) doing the integration.

For the issue of the sign, in MG5aMC we do integration the absolute value of the function and not the function which is important to ensure that we do have the shape correct.
Here you likely do not care about the shape of the integrand so you might have access to dedicated trick.

I guess that what you need to do is to try to do is to integrate bunch of matrix-element such that the numerical cancelation is done at the integrand level and not at the integral level.

Cheers,

Olivier

> On 20 Oct 2022, at 15:00, matteo maltoni <email address hidden> wrote:
>
> Question #703541 on MadGraph5_aMC@NLO changed:
> https://answers.launchpad.net/mg5amcnlo/+question/703541
>
> Status: Answered => Open
>
> matteo maltoni is still having a problem:
> Thank you Olivier for addressing me to these papers, this method is
> indeed much faster than the integration.
>
> When it comes to an interference among the SM and a dim-6 operator, do
> you think is there any particular care I should take in the
> maximisation, due to the presence of both positive and negative matrix
> elements?
>
> Best,
>
> Matteo
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

Revision history for this message
matteo maltoni (matteo-maltoni) said :
#4

Thanks Olivier Mattelaer, that solved my question.