# -*- ThePEG-repository -*-

##################################################
## Herwig/Matchbox example input file
##################################################

##################################################
## Collider type
##################################################
read snippets/Matchbox.in
read snippets/PPCollider.in

##################################################
## Beam energy sqrt(s)
##################################################

cd /Herwig/EventHandlers
set EventHandler:LuminosityFunction:Energy 13600*GeV
set EventHandler:Weighted Yes

##################################################
## Process selection
##################################################

## Note that event generation may fail if no matching matrix element has
## been found.  Coupling orders are with respect to the Born process,
## i.e. NLO QCD does not require an additional power of alphas.

## Model assumptions
read Matchbox/StandardModelLike.in
read Matchbox/DiagonalCKM.in

## Set the order of the couplings
cd /Herwig/MatrixElements/Matchbox
set Factory:OrderInAlphaS 0
set Factory:OrderInAlphaEW 3

## Select the process
## You may use identifiers such as p, pbar, j, l, mu+, h0 etc.
do Factory:Process p p -> j j h0

## Special settings required for on-shell production of unstable particles
## enable for on-shell top production
# read Matchbox/OnShellTopProduction.in
## enable for on-shell W, Z or h production
# read Matchbox/OnShellWProduction.in
# read Matchbox/OnShellZProduction.in
read Matchbox/OnShellHProduction.in
# Special settings for the VBF approximation
read Matchbox/VBFDiagramsOnly.in

##################################################
## Matrix element library selection
##################################################

## Select a generic tree/loop combination or a
## specialized NLO package

# read Matchbox/MadGraph-GoSam.in
# read Matchbox/MadGraph-MadGraph.in
# read Matchbox/MadGraph-NJet.in
# read Matchbox/MadGraph-OpenLoops.in
# read Matchbox/HJets.in
read Matchbox/VBFNLO.in

## Uncomment this to use ggh effective couplings
## currently only supported by MadGraph-GoSam

# read Matchbox/HiggsEffective.in

##################################################
## Cut selection
## See the documentation for more options
##################################################
# cd /Herwig/Cuts/

# ## cuts on jets

# read Matchbox/DefaultPPJets.in

# insert JetCuts:JetRegions 0 FirstJet
# insert JetCuts:JetRegions 1 SecondJet

# set JetFinder:ConeRadius 0.4

# set FirstJet:PtMin 1*GeV
# #do FirstJet:YRange -7 7

# set SecondJet:PtMin 1*GeV
# #do SecondJet:YRange -7 7

# # create ThePEG::JetPairRegion DijetCuts
# # set DijetCuts:FirstRegion FirstJet
# # set DijetCuts:SecondRegion SecondJet
# # set DijetCuts:MassMin 550*GeV
# # set DijetCuts:DeltaYMin 4.1
# # set DijetCuts:OppositeHemispheres True

# # insert JetCuts:JetPairRegions 0 DijetCuts

##################################################
## Scale choice
## See the documentation for more options
##################################################
library HiggsMTmScale.so
cd /Herwig/MatrixElements/Matchbox
create Herwig::HiggsMTmScale HiggsMTmScale HiggsMTmScale.so
set HiggsMTmScale:ShowerScale 0
set HiggsMTmScale:JetFinder /Herwig/Cuts/JetFinder
set HiggsMTmScale:JetFinder:ConeRadius 0.4
set Factory:ScaleChoice HiggsMTmScale


# cd  /Herwig/MatrixElements/Matchbox/
# set Scales/FixedScale:FixedScale 91.1876*GeV
# set Factory:ScaleChoice Scales/FixedScale

##################################################
## Matching and shower selection
## Please also see flavour scheme settings
## towards the end of the input file.
##################################################

read Matchbox/MCatNLO-DefaultShower.in
# read Matchbox/Powheg-DefaultShower.in
## use for strict LO/NLO comparisons
# read Matchbox/MCatLO-DefaultShower.in
## use for improved LO showering
# read Matchbox/LO-DefaultShower.in

#read Matchbox/MCatNLO-DipoleShower.in
# read Matchbox/Powheg-DipoleShower.in
## use for strict LO/NLO comparisons
# read Matchbox/MCatLO-DipoleShower.in
## use for improved LO showering
# read Matchbox/LO-DipoleShower.in

#read Matchbox/NLO-NoShower.in
#read Matchbox/LO-NoShower.in

set /Herwig/Couplings/NLOAlphaS:input_scale 91.1876*GeV
set /Herwig/Couplings/NLOAlphaS:input_alpha_s 0.11800021884307436
set /Herwig/Model:QCD/RunningAlphaS /Herwig/Couplings/NLOAlphaS


##################################################
## ShowerHandler(s)
##################################################

cd /Herwig/EventHandlers
set EventHandler:CascadeHandler:MPIHandler NULL
set EventHandler:DecayHandler NULL
set EventHandler:HadronizationHandler NULL
#set EventHandler:CascadeHandler NULL



##################################################
## Scale uncertainties
##################################################

# read Matchbox/MuDown.in
# read Matchbox/MuUp.in

##################################################
## Shower scale uncertainties
##################################################

# read Matchbox/MuQDown.in
# read Matchbox/MuQUp.in

##################################################
## PDF choice
##################################################

# read Matchbox/FiveFlavourScheme.in
## required for dipole shower and fixed order in five flavour scheme
read Matchbox/FiveFlavourNoBMassScheme.in

#read Matchbox/FourFlavourScheme.in

cd /Herwig/Partons

set HardLOPDF:PDFName PDF4LHC21_40
set HardNLOPDF:PDFName PDF4LHC21_40

set ShowerLOPDF:PDFName PDF4LHC21_40
set ShowerNLOPDF:PDFName PDF4LHC21_40

set MPIPDF:PDFName PDF4LHC21_40
set RemnantPDF:PDFName PDF4LHC21_40

read Matchbox/PQCDLevel.in

##################################################
## Analyses
##################################################

cd /Herwig/Analysis

# insert Rivet:Analyses 0 MC_VBFH_LHCHXSWG_R_0_1
# insert Rivet:Analyses 0 MC_VBFH_LHCHXSWG_R_0_2
# insert Rivet:Analyses 0 MC_VBFH_LHCHXSWG_R_0_3
# insert Rivet:Analyses 0 MC_VBFH_LHCHXSWG_R_0_4
# insert Rivet:Analyses 0 MC_VBFH_LHCHXSWG_R_0_5
# insert Rivet:Analyses 0 MC_VBFH_LHCHXSWG_R_0_6
# insert Rivet:Analyses 0 MC_VBFH_LHCHXSWG_R_0_7
# insert Rivet:Analyses 0 MC_VBFH_LHCHXSWG_R_0_8
# insert Rivet:Analyses 0 MC_VBFH_LHCHXSWG_R_0_9
# insert Rivet:Analyses 0 MC_VBFH_LHCHXSWG_R_1_0
# insert Rivet:Analyses 0 MC_VBFH_LHCHXSWG_R_1_1
# insert Rivet:Analyses 0 MC_VBFH_LHCHXSWG_R_1_2
# insert Rivet:Analyses 0 MC_VBFH_LHCHXSWG_R_1_3
# insert Rivet:Analyses 0 MC_VBFH_LHCHXSWG_R_1_4

# insert Rivet:Analyses 0 HiggsTemplateCrossSections

cd /Herwig/Analysis
create ThePEG::RivetAnalysis RivetAnalysis RivetAnalysis.so
#create ThePEG::NLORivetAnalysis RivetAnalysis RivetAnalysis.so
insert /Herwig/Generators/EventGenerator:AnalysisHandlers 0 RivetAnalysis
insert RivetAnalysis:Analyses 0 MY_ANALYSIS


# ##############################################################################
#
#  EW parameters in Gmu scheme, preparing Matchbox to use fixed QED couplings
#  for having the HJets complex mass scheme set up in a proper way
#
#  the single sources of alphas are /Herwig/DipoleShower/NLOAlphaS and
#  /Herwig/Shower/AlphaQCD both running at two loops with thresholds
#  as given by the PDF settings
#
# ##############################################################################

set /Herwig/Model:EW/Scheme GMuScheme
set /Herwig/Model:EW/FermiConstant 1.16638e-5


set /Herwig/Particles/Z0:NominalMass 91.1876
set /Herwig/Particles/Z0:Width 2.4952
do /Herwig/Particles/Z0:UnsetHardProcessMass
do /Herwig/Particles/Z0:UnsetHardProcessWidth

set /Herwig/Particles/W+:NominalMass 80.379
set /Herwig/Particles/W+:Width 2.085
do /Herwig/Particles/W+:UnsetHardProcessMass
do /Herwig/Particles/W+:UnsetHardProcessWidth

set /Herwig/Particles/h0:NominalMass 125.0
do /Herwig/Particles/h0:UnsetHardProcessMass
set /Herwig/Particles/h0:HardProcessWidth 0.
set /Herwig/Particles/h0:Stable Stable

set /Herwig/MatrixElements/Matchbox/Factory:FixedQEDCouplings Yes

# ##############################################################################
#
#  Quark kinematic masses are all zero
#
# ##############################################################################

cd /Herwig/Particles

do d:UnsetHardProcessMass
do dbar:UnsetHardProcessMass
set d:NominalMass 0*GeV
set dbar:NominalMass 0*GeV

do u:UnsetHardProcessMass
do ubar:UnsetHardProcessMass
set u:NominalMass 0*GeV
set ubar:NominalMass 0*GeV

do s:UnsetHardProcessMass
do sbar:UnsetHardProcessMass
set s:NominalMass 0*GeV
set sbar:NominalMass 0*GeV

do c:UnsetHardProcessMass
do cbar:UnsetHardProcessMass
set c:NominalMass 0*GeV
set cbar:NominalMass 0*GeV

do b:UnsetHardProcessMass
do bbar:UnsetHardProcessMass
set b:NominalMass 0*GeV
set bbar:NominalMass 0*GeV

read snippets/MonacoSampler.in
set /Herwig/Samplers/Sampler:Verbose Yes

##################################################
## Save the generator
##################################################

set /Herwig/MatrixElements/Matchbox/Factory:AlphaParameter 0.1

do /Herwig/MatrixElements/Matchbox/Factory:ProductionMode

cd /Herwig/Generators
saverun Herwig EventGenerator