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

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

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

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

# Do output to a HepMC file
cd /Herwig/Generators
insert LEPGenerator: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.KsD6yfJqRi/generator.hepmc
# set /Herwig/Analysis/HepMCFile:Units GeV_mm


# Beam parameters:
set LEPGenerator:EventHandler:LuminosityFunction:Energy 133
set LEPGenerator:EventHandler:BeamA /Herwig/Particles/e-
set LEPGenerator:EventHandler:BeamB /Herwig/Particles/e+
set LEPGenerator:EventHandler:CascadeHandler:MPIHandler NULL
set LEPGenerator:MaxErrors -1


# process:
cd /Herwig/MatrixElements
# e+e- > q qbar (5 flavours d,u,s,c,b)
insert SimpleEE:MatrixElements 0 MEee2gZ2qq
# e+e- > l+l-
# insert SimpleEE:MatrixElements[0] MEee2gZ2ll


# switch off ISR (already taken into account in LEP data)
# (setting reference: herwig++ manual, appendix B.1)
set /Herwig/Shower/SplittingGenerator:ISR No
# switch off lepton PDFs
set /Herwig/Particles/e-:PDF /Herwig/Partons/NoPDF
set /Herwig/Particles/e+:PDF /Herwig/Partons/NoPDF

## For Four-jet angles, no hadronization, uncomment this
#cd /Herwig/EventHandlers
#set LEPHandler:HadronizationHandler NULL


## Set cuts
## Use this for hard leading-jets in a certain pT window
#set /Herwig/Cuts/JetKtCut:MinKT 0*GeV        # minimum jet pT
#set /Herwig/Cuts/JetKtCut:MaxKT 133*GeV        # maximum jet pT
#
## Use this for hard leading-jets in a certain mHat window
#set /Herwig/Cuts/EECuts:MHatMin 0*GeV        # minimum jet mHat
#set /Herwig/Cuts/EECuts:MHatMax 133*GeV        # maximum jet mHat


# LEP: Make particles with c*tau > 100 mm stable:
# (E.g., K0S, Lambda, Sigma, Xi, Omega are treated as *unstable*.)
set /Herwig/Decays/DecayHandler:MaxLifeTime 100*mm
set /Herwig/Decays/DecayHandler:LifeTimeOption Average


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

# Run generator
cd /Herwig/Generators
run LEP LEPGenerator