# based on example from Herwig++ 2.4.2 distribution:
#   share/Herwig++/TVT.in

# rungen.sh uses the following command to insert PPCollider.in snippet
#%beamsetup71%

# Run options:
cd /Herwig/Generators
set LHCGenerator:NumberOfEvents 100000
set LHCGenerator:RandomNumberGenerator:Seed 46
set LHCGenerator:DebugLevel 0
set LHCGenerator:PrintEvent 1
set LHCGenerator:MaxErrors 100000

# redirect all log output to stdout
set LHCGenerator:UseStdout true

# do output to a HepMC file
cd /Herwig/Generators
insert LHCGenerator:AnalysisHandlers 0 /Herwig/Analysis/HepMCFile
set /Herwig/Analysis/HepMCFile:PrintEvent 1000000
set /Herwig/Analysis/HepMCFile:Format GenEvent
set /Herwig/Analysis/HepMCFile:Filename /shared/tmp/tmp.ieH2XeVK76/generator.hepmc
# set /Herwig/Analysis/HepMCFile:Units GeV_mm


# Beam parameters:
set LHCGenerator:EventHandler:LuminosityFunction:Energy 13000
set LHCGenerator:EventHandler:BeamA /Herwig/Particles/p+
set LHCGenerator:EventHandler:BeamB /Herwig/Particles/p+
set LHCGenerator:MaxErrors -1


# Process setup
# Z+1jet production
cd /Herwig/MatrixElements
insert SimpleQCD:MatrixElements[0] MEZJet
DISABLEREADONLY
newdef MEZJet:ZDecay ChargedLeptons

## Set cuts
## Use this for hard leading-jets in a certain pT window
set /Herwig/Cuts/JetKtCut:MinKT 40*GeV        # minimum jet pT
set /Herwig/Cuts/JetKtCut:MaxKT 13000*GeV        # maximum jet pT
#
# Herwig 7 allows to bound the dilepton mass; use rather large window (RIVET does the rest)
set /Herwig/Cuts/LeptonPairMassCut:MinMass 60*GeV
# set /Herwig/Cuts/LeptonPairMassCut:MaxMass 1000*GeV

# Make particles with c*tau > 10 mm stable:
set /Herwig/Decays/DecayHandler:MaxLifeTime 10*mm
set /Herwig/Decays/DecayHandler:LifeTimeOption Average


# tune 'default' parameters: -------------------
#%tuneFile%
# ---------------------------------------------


set /Herwig/UnderlyingEvent/MPIHandler:IdenticalToUE -1

# Run generator
cd /Herwig/Generators
run TVT LHCGenerator