# How to speed up MadGraph if I only want to see the total cross section?

Asked by Qiji Xin on 2018-09-08

Hi all,

I am a newer to Madgraph and using it to calculate a 2 → 3 process with pure electroweak, no QCD.
What I wanna know now is just the total cross section per run.

Now for one run to see the total cross section at one beam energy, it usually takes 40 min.
I have also tried CompHEP, and it only takes a couple minutes.

I think the time difference may be because MadGraph calculates/simulates more things than just the total cross section.
So, if I just want the total cross section, are there anything I can do to speed MadGraph up?

Thanks very much!

## Question information

Language:
English Edit question
Status:
Solved
For:
Assignee:
No assignee Edit question
Solved by:
Qiji Xin
Solved:
2018-09-14
Last query:
2018-09-14
2018-09-13
 Qiji Xin (xinqijisuper) said on 2018-09-09: #1

It seems that CompHEP does the phase space integrals to get the total cross sections, without generating events.
For MadGraph&MadEvents, it gets the total cross section after generating a lot of events.
That's why CompHEP gives me the total cross section very fast.

Is my understanding correct?

If so, is there a way to ask MadGraph & MadEvent only do the integrals without generating the events, which takes a log of time?

Thanks very much!

 Olivier Mattelaer (olivier-mattelaer) said on 2018-09-12: #2

Hi,

The main difference in speed is likely to be due to the method of computation of the matrix-element.
CalcHep/CompHep are computing analytically the amplitude square when we are doing so numerically.

The advantage is the computing numerically appears for large number of diagram.
Indeed the number of operation raises like the number of diagram square in the context of CalcHep/CompHep while it raises linearly in our program. On the other hand if you have a small number of diagram (AND a small number of particle in the final state) then
then analytical computation is much more efficient.

Now the speed for the cross-section also depends on the precision that you want on the cross-section. If you only request 1 event, then we will provide a precision of about 20% and the code will obviously be much faster than if you request a huge amount of events.

Cheers,

Olivier

 Olivier Mattelaer (olivier-mattelaer) said on 2018-09-12: #5

Hi,

> both numerically? Just to confirm this.

Yes that's correct

> 2) You said requesting 1 event could give me a precision of 20% of the cross section.
> Could you explain a little more why only 1 even could give me so good precision?

Before being able to generate events, we need to
1) compute the [order of magnitude] cross-section of each contribution to the integral
2) estimate the efficency for the generation of events for each contribution

At this stage we decide to request that each contribution have an error of at most 20%.
Consequently the total error on the cross-section after that stage is ~20%

In a second step, we look at how many events are requested by the user and then probe more deeply the channel that requires more events generated. If you request a small number of evetns (typically less than 200)
then this second step (called refine) then this stage takes 0 sec.

> I mean, if I want a precision of, say, 1%, how much events do I need roughly?

This is 10k events

Cheers,

Olivier

> On 12 Sep 2018, at 18:07, Bei Zhou <email address hidden> wrote:
>
> Question #673551 on MadGraph5_aMC@NLO changed:
>
> Hi Olivier,
>
> So
>
> 1) I think CalcHEP/CompHEP do the matrix element analytically while the
> phase space integration (VEGAS Monte Carlo) numerically? MadGraph does
> both numerically? Just to confirm this.
>
> 2) You said requesting 1 event could give me a precision of 20% of the cross section.
> Could you explain a little more why only 1 even could give me so good precision? I would imagine it needs lots of events (points) to cover the phase space to get the total cross section.
> And is there a general rough related between number of events and the precision of total cross section? I mean, if I want a precision of, say, 1%, how much events do I need roughly?
> I will mainly use MadGraph in the future I think so would like to know more about it.
>
> Thanks!
>
> --

 Qiji Xin (xinqijisuper) said on 2018-09-13: #6

Thank you Oliver!
A last brief question.
So the relative uncertainty of total xsec roughly scales with 1/sqrt(Nevents) ?
Thanks!

 Olivier Mattelaer (olivier-mattelaer) said on 2018-09-13: #7

Yes.

> On 13 Sep 2018, at 04:52, Qiji Xin <email address hidden> wrote:
>
> Question #673551 on MadGraph5_aMC@NLO changed:
>
>
> Qiji Xin is still having a problem:
> Thank you Oliver!
> A last brief question.
> So the relative uncertainty of total xsec roughly scales with 1/sqrt(Nevents) ?
> Thanks!
>
> --

 Qiji Xin (xinqijisuper) said on 2018-09-14: #8

 andlessa (lessa-a-p) said on 2018-12-01: #9

Hi, I have one follow up question: is there a way to set the total cross-section accuracy (within generate_events) without setting a large number of events? I would like to get the total cross-sections with high accuracy (say 1%) without having to write down "large" LHE files for each run.

 Olivier Mattelaer (olivier-mattelaer) said on 2018-12-01: #10

Hi,

Asking for 10k events is equivalent of asking for 1% accuracy in the total cross-section (since this is sqrt(N))
And we need those events in order to be able to compute the theoretical uncertainty (which is always much bigger than 1%)

Cheers,

Olivier