# Why does reweighting take a long time?

Asked by Yue Xu on 2019-11-06

I'm using the reweighting technique in MG5 version2.6.6 with an external model which contains a heavy higgs ( hh ). I found it takes me a long time to run reweighting.

For example:
the processes are:
import model SMwithHeavyScalarDim4Dim6_NoDecay_UFO
generate p p > z hh, z > l- l+, hh > j j j j
add process p p > z hh, z > j j, hh > e- e+ j j
add process p p > z hh, z > j j, hh > mu- mu+ j j
add process p p > w- hh, w- > j j, hh > e- e+ j j
add process p p > w- hh, w- > j j, hh > mu- mu+ j j
add process p p > w+ hh, w+ > j j, hh > e- e+ j j
add process p p > w+ hh, w+ > j j, hh > mu- mu+ j j

if I don't use reweighting, it takes me less than 2 minutes to get a sample with 10k events. But if I use reweighting with a set of parameters "fw" and "fww" that influence the coupling between heavy higgs and vector boson and the decay width of heavy higgs, it takes me about 30 minutes.

the process and reweigt_card are here:
https://github.com/xuyue1231/MG5-heavy-Higgs/tree/master/LHC_HH_2lep

Why does reweighting take such a long time?
How can I reduce the reweighting time ?

Best,
Yue

## Question information

Language:
English Edit question
Status:
Solved
For:
Assignee:
No assignee Edit question
Solved by:
Yue Xu
Solved:
2019-11-06
Last query:
2019-11-06
2019-11-06
 Olivier Mattelaer (olivier-mattelaer) said on 2019-11-06: #1

Hi,

Most of this time is likely linked to the creation/compilation of the matrix-element needed for the re-weighting. You can technically save such compuations and/or reuse it if you do multiple re-weighting in a row.

Cheers,

Olivier

> On 6 Nov 2019, at 08:53, Yue Xu <email address hidden> wrote:
>
> New question #685648 on MadGraph5_aMC@NLO:
>
>
> I'm using the reweighting technique in MG5 version2.6.6 with an external model which contains a heavy higgs ( hh ). I found it takes me a long time to run reweighting.
>
> For example:
> the processes are:
> import model SMwithHeavyScalarDim4Dim6_NoDecay_UFO
> generate p p > z hh, z > l- l+, hh > j j j j
> add process p p > z hh, z > j j, hh > e- e+ j j
> add process p p > z hh, z > j j, hh > mu- mu+ j j
> add process p p > w- hh, w- > j j, hh > e- e+ j j
> add process p p > w- hh, w- > j j, hh > mu- mu+ j j
> add process p p > w+ hh, w+ > j j, hh > e- e+ j j
> add process p p > w+ hh, w+ > j j, hh > mu- mu+ j j
>
> if I don't use reweighting, it takes me less than 2 minutes to get a sample with 10k events. But if I use reweighting with a set of parameters "fw" and "fww" that influence the coupling between heavy higgs and vector boson and the decay width of heavy higgs, it takes me about 30 minutes.
>
> The model is here:
> https://github.com/xuyue1231/MG5-heavy-Higgs/tree/master/SMwithHeavyScalarDim4Dim6_NoDecay_UFO
>
> the process and reweigt_card are here:
> https://github.com/xuyue1231/MG5-heavy-Higgs/tree/master/LHC_HH_2lep
>
> Why does reweighting take such a long time?
> How can I reduce the reweighting time ?
>
> Best,
> Yue
>
> --

 Yue Xu (yuexu) said on 2019-11-06: #2

Hi,
If I do a multiple reweighting, such as:

launch --rwgt_name=fwM300fww4600
set DIM6COEFF 3 -300
set DIM6COEFF 4 4600
set DECAY 254 auto
launch --rwgt_name=fwM300fwwM4600
set DIM6COEFF 3 -300
set DIM6COEFF 4 -4600
set DECAY 254 auto

It takes the same time as one reweighting.

But if I just want to do one reweighting, such as:
launch --rwgt_name=fwM300fww4600
set DIM6COEFF 3 -300
set DIM6COEFF 4 4600
set DECAY 254 auto

Does it have some way to reduce the reweighting time?

Cheers,
Yue

 Olivier Mattelaer (olivier-mattelaer) said on 2019-11-06: #3

So this prooves that most of the time is taken in creating/compiling the matrix-element needed for the re-weighting. if you plan to do multiple times re-weighting for this process then you can save the directory such that next time you do not have to redo that step.
But otherwise no you can not speed it up.

Cheers,

Olivier

> On 6 Nov 2019, at 09:15, Yue Xu <email address hidden> wrote:
>
> Question #685648 on MadGraph5_aMC@NLO changed:
>
>
> Yue Xu is still having a problem:
> Hi,
> If I do a multiple reweighting, such as:
>
> launch --rwgt_name=fwM300fww4600
> set DIM6COEFF 3 -300
> set DIM6COEFF 4 4600
> set DECAY 254 auto
> launch --rwgt_name=fwM300fwwM4600
> set DIM6COEFF 3 -300
> set DIM6COEFF 4 -4600
> set DECAY 254 auto
>
> It takes the same time as one reweighting.
>
> But if I just want to do one reweighting, such as:
> launch --rwgt_name=fwM300fww4600
> set DIM6COEFF 3 -300
> set DIM6COEFF 4 4600
> set DECAY 254 auto
>
> Does it have some way to reduce the reweighting time?
>
> Cheers,
> Yue
>
> --