Only compute what you have to before unweighting
Only compute what you have to before unweighting.
Profiling indicates that calculating ME variations can take a considerable fraction of the evtgen time, e.g.
in PHASIC::MCatNLO_Process::OneSEvent -> SHERPA::Variation_Weights::UpdateOrInitialiseWeights
, when doing PDF variations, where we see that most time is spent in LHAPDF calls.
Hence it would be beneficial to postpone the reweighting until after the unweighting.
The same is true for associated contributions reweighting, which can also contribute up to 30% to the run time.
Similarly, the MC@NLO matching step could also be postponed. However, since this is also applied to the nominal, one would have the cost here of a non-uniform weight distribution (coming from the colour and spin correlations), which would otherwise have been unweighted away. It might still be preferable, since the nominal calculation time might be reduced by up to ~40%. In this case, it should also (still) be possible, to disable such colour and spin correlations altogether in favour of speed, since these corrections are usually very small. This is already used in various ATLAS setups.