Skip to content

Commit

Permalink
Merge pull request #6 from mfasDa/feature-hwtunes
Browse files Browse the repository at this point in the history
Fix MB tune and UE handling for Herwig 7.2
  • Loading branch information
maireiphc authored Sep 29, 2020
2 parents 17bc125 + f5804da commit 49ba8ea
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 126 deletions.
File renamed without changes.
43 changes: 0 additions & 43 deletions gen/herwig/MB.in

This file was deleted.

35 changes: 0 additions & 35 deletions gen/herwig/PPCollider.in

This file was deleted.

9 changes: 5 additions & 4 deletions gen/herwig/gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ gen_herwig(){
if [ "x${KTMIN}" != "x" ]; then cmd=$(printf "%s --ktmin %s" "$cmd" ${KTMIN}); fi
if [ "x${KTMAX}" != "x" ]; then cmd=$(printf "%s --ktmax %s" "$cmd" ${KTMAX}); fi
eval $cmd
cp_input PPCollider.in .
cp_input SoftModel.in .
cp_input SoftTune.in .
if [ "x${TUNE}" == "xmb" ]; then cp_input MB.in .; fi
if [ "x${TUNE}" != "xmb" ]; then
cp_input DefaultTune.in .
cp_input SoftTune.in .
fi


run_in_env 'Herwig --repo=${HERWIG_ROOT}/share/Herwig/HerwigDefaults.rpo read herwig.in' > setup.log
run_in_env 'Herwig --repo=${HERWIG_ROOT}/share/Herwig/HerwigDefaults.rpo run herwig.run -N ${NEV} --seed ${SEED}' > hwgen.log
Expand Down
88 changes: 44 additions & 44 deletions gen/herwig/generate_hwgin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,53 +7,53 @@ def GenerateHerwigInput(outputfile, tune, cmsenegy, events, hepmcfile, ktmin, kt
# See (jet): http://mcplots.cern.ch/dat/pp/jets/pt/cms2011-y0.5/7000/herwig++/2.7.1/default.params
# See also for minimum-bias: Chapter B.2 https://arxiv.org/abs/0803.0883
with open(outputfile, "w") as myfile:
myfile.write("read PPCollider.in\n")
myfile.write("read snippets/PPCollider.in\n") # Markus: Take PPCollider.in fron Herwig repositiory instead of custom version
myfile.write("set /Herwig/Generators/EventGenerator:EventHandler:LuminosityFunction:Energy {}.0\n".format(cmsenegy))
if tune == "beauty":
myfile.write("set /Herwig/MatrixElements/MEHeavyQuark:QuarkType 5\n")
myfile.write("insert /Herwig/MatrixElements/SubProcess:MatrixElements[0] /Herwig/MatrixElements/MEHeavyQuark\n")
myfile.write("set /Herwig/Cuts/JetKtCut:MinKT 0.0*GeV\n")
myfile.write("set /Herwig/Cuts/JetKtCut:MaxKT {}.0*GeV\n".format(cmsenegy))
myfile.write("set /Herwig/UnderlyingEvent/MPIHandler:IdenticalToUE -1\n")
elif tune == "charm":
myfile.write("set /Herwig/MatrixElements/MEHeavyQuark:QuarkType 4\n")
myfile.write("insert /Herwig/MatrixElements/SubProcess:MatrixElements[0] /Herwig/MatrixElements/MEHeavyQuark\n")
myfile.write("set /Herwig/Cuts/JetKtCut:MinKT 0.0*GeV\n")
myfile.write("set /Herwig/Cuts/JetKtCut:MaxKT {}.0*GeV\n".format(cmsenegy))
myfile.write("set /Herwig/UnderlyingEvent/MPIHandler:IdenticalToUE -1\n")
elif tune == "dijet":
myfile.write("insert /Herwig/MatrixElements/SubProcess:MatrixElements[0] /Herwig/MatrixElements/MEQCD2to2\n")
myfile.write("set /Herwig/Cuts/JetKtCut:MinKT 5.0*GeV\n")
myfile.write("set /Herwig/Cuts/JetKtCut:MaxKT {}.0*GeV\n".format(cmsenegy))
myfile.write("set /Herwig/UnderlyingEvent/MPIHandler:IdenticalToUE -1\n")
elif tune == "mb":
myfile.write("read MB.in\n")
myfile.write("set /Herwig/Cuts/JetKtCut:MinKT 0.0*GeV\n")
myfile.write("set /Herwig/Cuts/JetKtCut:MaxKT {}.0*GeV\n".format(cmsenegy))
myfile.write("set /Herwig/UnderlyingEvent/MPIHandler:IdenticalToUE 0\n")
elif tune == "kthard":
myfile.write("insert /Herwig/MatrixElements/SubProcess:MatrixElements[0] /Herwig/MatrixElements/MEQCD2to2\n")
localktmin = ktmin
localktmax = ktmax
if localktmin < 0:
localktmin > 0
if localktmax < 0 or localktmax > cmsenegy:
localktmax = cmsenegy
myfile.write("set /Herwig/Cuts/JetKtCut:MinKT %f*GeV\n" %(localktmin))
myfile.write("set /Herwig/Cuts/JetKtCut:MaxKT %f*GeV\n" %(localktmax))
myfile.write("set /Herwig/UnderlyingEvent/MPIHandler:IdenticalToUE -1\n")
if tune == "mb":
# MB tune from Herwig repo
myfile.write("set /Herwig/Shower/ShowerHandler:IntrinsicPtGaussian 2.2*GeV\n")
myfile.write("read snippets/MB.in\n")
myfile.write("read snippets/Diffraction.in\n")
else:
print("Process '{}' not implemented for HERWIG!".format(tune))
exit(1)
myfile.write("set /Herwig/Cuts/Cuts:MHatMax {}.0*GeV\n".format(cmsenegy))
myfile.write("set /Herwig/Cuts/Cuts:MHatMin 0.0*GeV\n")
myfile.write("read SoftTune.in\n")
# Use SoftTune as UE tune for Herwig7 (>= 7.1) based on https://herwig.hepforge.org/tutorials/mpi/tunes.html
myfile.write("read SoftTune.in\n")
# Set PDF (LO)
myfile.write("set /Herwig/Partons/HardLOPDF:PDFName CT14lo\n")
myfile.write("set /Herwig/Partons/ShowerLOPDF:PDFName CT14lo\n")
myfile.write("set /Herwig/Partons/MPIPDF:PDFName CT14lo\n")
myfile.write("set /Herwig/Partons/RemnantPDF:PDFName CT14lo\n")
kthardmin = 0.
kthardmax = 0.
if tune == "beauty" or tune == "charm":
quarktye = 4 if tune == "charm" else 5
myfile.write("set /Herwig/MatrixElements/MEHeavyQuark:QuarkType {}\n".format(quarktye))
myfile.write("insert /Herwig/MatrixElements/SubProcess:MatrixElements[0] /Herwig/MatrixElements/MEHeavyQuark\n")
kthardmin = 0.
kthardmax = float(cmsenegy)
elif tune == "dijet_lo":
myfile.write("insert /Herwig/MatrixElements/SubProcess:MatrixElements[0] /Herwig/MatrixElements/MEQCD2to2\n")
kthardmin = 5.
kthardmax = float(cmsenegy)
elif tune == "kthard":
myfile.write("insert /Herwig/MatrixElements/SubProcess:MatrixElements[0] /Herwig/MatrixElements/MEQCD2to2\n")
kthardmin = ktmin
kthardmax = ktmax
if kthardmin < 0:
kthardmin = 0
if kthardmax < 0 or kthardmax > cmsenegy:
kthardmax = cmsenegy
else:
print("Process '{}' not implemented for HERWIG!".format(tune))
exit(1)
myfile.write("set /Herwig/Cuts/JetKtCut:MinKT %f*GeV\n" %(kthardmin))
myfile.write("set /Herwig/Cuts/JetKtCut:MaxKT %f*GeV\n" %(kthardmax))
myfile.write("set /Herwig/Cuts/Cuts:MHatMax {}.0*GeV\n".format(cmsenegy))
myfile.write("set /Herwig/Cuts/Cuts:MHatMin 0.0*GeV\n")
myfile.write("set /Herwig/UnderlyingEvent/MPIHandler:IdenticalToUE -1\n")

# PDF selection
myfile.write("create ThePEG::LHAPDF /Herwig/Partons/PDFSet ThePEGLHAPDF.so\n")
myfile.write("set /Herwig/Partons/PDFSet:PDFName CT10nlo\n")
myfile.write("set /Herwig/Partons/PDFSet:RemnantHandler /Herwig/Partons/HadronRemnants\n")
myfile.write("set /Herwig/Particles/p+:PDF /Herwig/Partons/PDFSet\n")
# Stable particles with a lifetime > 10 mm (decay externally)
myfile.write("set /Herwig/Decays/DecayHandler:MaxLifeTime 10*mm\n")
myfile.write("set /Herwig/Decays/DecayHandler:LifeTimeOption Average\n")

#HEP MC writer
myfile.write("read snippets/HepMC.in\n")
Expand Down

0 comments on commit 49ba8ea

Please sign in to comment.