From 93da4bce5ae36a185bf3152e5703bdb4c61785d9 Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Mon, 13 Apr 2026 10:28:11 +0200 Subject: [PATCH 01/37] prepare Polarization --- python/Generators/Sherpa.py | 7 ++++ .../Difermion_Polarized_ISR_BSTilc.dat | 35 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 test/ref-results/Sherpa/Difermion_Polarized/Difermion_Polarized_ISR_BSTilc.dat diff --git a/python/Generators/Sherpa.py b/python/Generators/Sherpa.py index 1bb9e58e..93999550 100644 --- a/python/Generators/Sherpa.py +++ b/python/Generators/Sherpa.py @@ -42,6 +42,13 @@ def write_run(self): self.addOption2GeneratorDatacard("BEAMS", [self.procinfo.get_beam_flavour(1),self.procinfo.get_beam_flavour(2)]) self.addOption2GeneratorDatacard("BEAM_ENERGIES", self.procinfo.get("sqrts")/2.) + # check for polarization + polFraction = self.procinfo.get_PolarisationFraction(); + if any(item != 0. for item in polFraction): + self.add2GeneratorDatacard("POLARIZATION:\n") + polDensity = self.procinfo.get_PolarisationDensity(); + self.addOption2GeneratorDatacard(" BEAM_1", polFraction[0]*polDensity[0]) + self.addOption2GeneratorDatacard(" BEAM_2", polFraction[1]*polDensity[1]) self.addOption2GeneratorDatacard("MODEL", self.getModel()) diff --git a/test/ref-results/Sherpa/Difermion_Polarized/Difermion_Polarized_ISR_BSTilc.dat b/test/ref-results/Sherpa/Difermion_Polarized/Difermion_Polarized_ISR_BSTilc.dat new file mode 100644 index 00000000..77aa8d2e --- /dev/null +++ b/test/ref-results/Sherpa/Difermion_Polarized/Difermion_Polarized_ISR_BSTilc.dat @@ -0,0 +1,35 @@ +RANDOM_SEED: 4711 +BEAMS: [11, -11] +BEAM_ENERGIES: 125.0 +POLARIZATION: + BEAM_1: -0.8 + BEAM_2: 0.3 +MODEL: SM +PDF_LIBRARY: PDFESherpa +YFS_MODE: None +EVENTS: 10000 + +ALPHAS(MZ): 0.1184 +GF: 1.16637e-05 +EVENT_OUTPUT: HepMC3_GenEvent[Difermion_Polarized_ISR_BSTilc.hepmc3] +EW_SCHEME: 3 +EVENT_GENERATION_MODE: unweighted + +PARTICLE_DATA: + 23: + Mass: 91.1876 + Width: 2.4952 + 6: + Mass: 172 + Width: 1.50833649 + 25: + Mass: 125 + Width: 0.00407 + 24: + Width: 2.085 + Mass: 80.379 + + +PROCESSES: +- 11 -11 -> 13 -13: + Order: {QCD: 0, EW: 2} From 1a7b0c882e53f4c0c72c93d6584b592e0bca39fd Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Mon, 13 Apr 2026 13:37:06 +0200 Subject: [PATCH 02/37] add ME amegic definition --- .../Difermion_Polarized_ISR_BSTilc.dat | 1 + .../Run_Difermion_Polarized_ISR_BSTilc.sh | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100755 test/ref-results/Sherpa/Difermion_Polarized/Run_Difermion_Polarized_ISR_BSTilc.sh diff --git a/test/ref-results/Sherpa/Difermion_Polarized/Difermion_Polarized_ISR_BSTilc.dat b/test/ref-results/Sherpa/Difermion_Polarized/Difermion_Polarized_ISR_BSTilc.dat index 77aa8d2e..b2f0c476 100644 --- a/test/ref-results/Sherpa/Difermion_Polarized/Difermion_Polarized_ISR_BSTilc.dat +++ b/test/ref-results/Sherpa/Difermion_Polarized/Difermion_Polarized_ISR_BSTilc.dat @@ -4,6 +4,7 @@ BEAM_ENERGIES: 125.0 POLARIZATION: BEAM_1: -0.8 BEAM_2: 0.3 +ME_Generators: [Amegic] MODEL: SM PDF_LIBRARY: PDFESherpa YFS_MODE: None diff --git a/test/ref-results/Sherpa/Difermion_Polarized/Run_Difermion_Polarized_ISR_BSTilc.sh b/test/ref-results/Sherpa/Difermion_Polarized/Run_Difermion_Polarized_ISR_BSTilc.sh new file mode 100755 index 00000000..79eaacd9 --- /dev/null +++ b/test/ref-results/Sherpa/Difermion_Polarized/Run_Difermion_Polarized_ISR_BSTilc.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +if [ -z "${KEY4HEP_STACK}" ]; then + source /cvmfs/sw.hsf.org/key4hep/setup.sh +fi + +Sherpa -f Difermion_Polarized_ISR_BSTilc.dat +./makelibs +Sherpa -f Difermion_Polarized_ISR_BSTilc.dat +convertHepMC2EDM4HEP -i hepmc3 -o edm4hep Difermion_Polarized_ISR_BSTilc.hepmc3 Difermion_Polarized_ISR_BSTilc.edm4hep + +key4HEPAnalysis -i Difermion_Polarized_ISR_BSTilc.edm4hep -o Difermion_Polarized_ISR_BSTilc.root -p 13,-13 From 1dcd3b0c9f6c4fa87e85b2494e69afa6206c9297 Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Mon, 13 Apr 2026 13:57:33 +0200 Subject: [PATCH 03/37] activate Sherpa with Polarization --- examples/FermionProductionBST.yaml | 2 ++ examples/FermionProduction_Polarized.yaml | 5 ++--- python/Generators/Sherpa.py | 2 ++ ...arized_ISR_BSTilc.dat => Difermion_Polarized.dat} | 3 --- .../Difermion_Polarized/Run_Difermion_Polarized.sh | 12 ++++++++++++ .../Run_Difermion_Polarized_ISR_BSTilc.sh | 12 ------------ ...SR_BSTilc.cmnd => pythiaDifermion_Polarized.cmnd} | 0 ...arized_ISR_BSTilc.dat => Difermion_Polarized.dat} | 4 ++-- .../Difermion_Polarized/Run_Difermion_Polarized.sh | 11 +++++++++++ .../Run_Difermion_Polarized_ISR_BSTilc.sh | 11 ----------- ...arized_ISR_BSTilc.sin => Difermion_Polarized.sin} | 6 +----- .../Difermion_Polarized/Run_Difermion_Polarized.sh | 9 +++++++++ .../Run_Difermion_Polarized_ISR_BSTilc.sh | 10 ---------- 13 files changed, 41 insertions(+), 46 deletions(-) rename test/ref-results/Madgraph/Difermion_Polarized/{Difermion_Polarized_ISR_BSTilc.dat => Difermion_Polarized.dat} (97%) create mode 100755 test/ref-results/Madgraph/Difermion_Polarized/Run_Difermion_Polarized.sh delete mode 100755 test/ref-results/Madgraph/Difermion_Polarized/Run_Difermion_Polarized_ISR_BSTilc.sh rename test/ref-results/Madgraph/Difermion_Polarized/{pythiaDifermion_Polarized_ISR_BSTilc.cmnd => pythiaDifermion_Polarized.cmnd} (100%) rename test/ref-results/Sherpa/Difermion_Polarized/{Difermion_Polarized_ISR_BSTilc.dat => Difermion_Polarized.dat} (83%) create mode 100755 test/ref-results/Sherpa/Difermion_Polarized/Run_Difermion_Polarized.sh delete mode 100755 test/ref-results/Sherpa/Difermion_Polarized/Run_Difermion_Polarized_ISR_BSTilc.sh rename test/ref-results/Whizard/Difermion_Polarized/{Difermion_Polarized_ISR_BSTilc.sin => Difermion_Polarized.sin} (75%) create mode 100755 test/ref-results/Whizard/Difermion_Polarized/Run_Difermion_Polarized.sh delete mode 100755 test/ref-results/Whizard/Difermion_Polarized/Run_Difermion_Polarized_ISR_BSTilc.sh diff --git a/examples/FermionProductionBST.yaml b/examples/FermionProductionBST.yaml index 5a3da46a..62f300ba 100644 --- a/examples/FermionProductionBST.yaml +++ b/examples/FermionProductionBST.yaml @@ -10,6 +10,8 @@ SqrtS: 250. Model: SM ISRMode: 1 +Beamstrahlung: ILC + Processes: Muon250: Final: [13, -13] diff --git a/examples/FermionProduction_Polarized.yaml b/examples/FermionProduction_Polarized.yaml index 81aa3613..fa021bc9 100644 --- a/examples/FermionProduction_Polarized.yaml +++ b/examples/FermionProduction_Polarized.yaml @@ -1,6 +1,7 @@ Generators: - Whizard - Madgraph + - Sherpa OutputFormat: edm4hep OutDir: Run-Cards @@ -10,11 +11,9 @@ EventMode: unweighted PolarisationDensity: [-1, 1] PolarisationFraction: [ 0.8, 0.3 ] -Beamstrahlung: ILC - SqrtS: 250 Model: SM -ISRMode: 1 +ISRMode: 0 Processes: Difermion_Polarized: diff --git a/python/Generators/Sherpa.py b/python/Generators/Sherpa.py index 93999550..0afc633c 100644 --- a/python/Generators/Sherpa.py +++ b/python/Generators/Sherpa.py @@ -49,6 +49,8 @@ def write_run(self): polDensity = self.procinfo.get_PolarisationDensity(); self.addOption2GeneratorDatacard(" BEAM_1", polFraction[0]*polDensity[0]) self.addOption2GeneratorDatacard(" BEAM_2", polFraction[1]*polDensity[1]) + # we need to ensure that AMEGIC is there + self.addOption2GeneratorDatacard("ME_Generators", "[Amegic]") self.addOption2GeneratorDatacard("MODEL", self.getModel()) diff --git a/test/ref-results/Madgraph/Difermion_Polarized/Difermion_Polarized_ISR_BSTilc.dat b/test/ref-results/Madgraph/Difermion_Polarized/Difermion_Polarized.dat similarity index 97% rename from test/ref-results/Madgraph/Difermion_Polarized/Difermion_Polarized_ISR_BSTilc.dat rename to test/ref-results/Madgraph/Difermion_Polarized/Difermion_Polarized.dat index c98f430e..52591b0d 100644 --- a/test/ref-results/Madgraph/Difermion_Polarized/Difermion_Polarized_ISR_BSTilc.dat +++ b/test/ref-results/Madgraph/Difermion_Polarized/Difermion_Polarized.dat @@ -35,9 +35,6 @@ set WH 0.00407 set MW 80.379 set WW 2.085 set nevents 10020 -set pdlabel ilc500ll -set lpp1 3 -set lpp2 -3 set polbeam1 -80.0 set polbeam2 30.0 set pt_min_pdg {13: 0 } diff --git a/test/ref-results/Madgraph/Difermion_Polarized/Run_Difermion_Polarized.sh b/test/ref-results/Madgraph/Difermion_Polarized/Run_Difermion_Polarized.sh new file mode 100755 index 00000000..04a1d490 --- /dev/null +++ b/test/ref-results/Madgraph/Difermion_Polarized/Run_Difermion_Polarized.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +if [ -z "${KEY4HEP_STACK}" ]; then + source /cvmfs/sw.hsf.org/key4hep/setup.sh +fi + +mg5_aMC Difermion_Polarized.dat +gunzip Output/Events/run_01/unweighted_events.lhe.gz +ln -sf Output/Events/run_01/unweighted_events.lhe unweighted_events.lhe +pythiaLHERunner -f pythiaDifermion_Polarized.cmnd -l unweighted_events.lhe -o Difermion_Polarized.hepmc +convertHepMC2EDM4HEP -i hepmc3 -o edm4hep Difermion_Polarized.hepmc Difermion_Polarized.edm4hep + +key4HEPAnalysis -i Difermion_Polarized.edm4hep -o Difermion_Polarized.root -p 13,-13 diff --git a/test/ref-results/Madgraph/Difermion_Polarized/Run_Difermion_Polarized_ISR_BSTilc.sh b/test/ref-results/Madgraph/Difermion_Polarized/Run_Difermion_Polarized_ISR_BSTilc.sh deleted file mode 100755 index 32a94d84..00000000 --- a/test/ref-results/Madgraph/Difermion_Polarized/Run_Difermion_Polarized_ISR_BSTilc.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -if [ -z "${KEY4HEP_STACK}" ]; then - source /cvmfs/sw.hsf.org/key4hep/setup.sh -fi - -mg5_aMC Difermion_Polarized_ISR_BSTilc.dat -gunzip Output/Events/run_01/unweighted_events.lhe.gz -ln -sf Output/Events/run_01/unweighted_events.lhe unweighted_events.lhe -pythiaLHERunner -f pythiaDifermion_Polarized_ISR_BSTilc.cmnd -l unweighted_events.lhe -o Difermion_Polarized_ISR_BSTilc.hepmc -convertHepMC2EDM4HEP -i hepmc3 -o edm4hep Difermion_Polarized_ISR_BSTilc.hepmc Difermion_Polarized_ISR_BSTilc.edm4hep - -key4HEPAnalysis -i Difermion_Polarized_ISR_BSTilc.edm4hep -o Difermion_Polarized_ISR_BSTilc.root -p 13,-13 diff --git a/test/ref-results/Madgraph/Difermion_Polarized/pythiaDifermion_Polarized_ISR_BSTilc.cmnd b/test/ref-results/Madgraph/Difermion_Polarized/pythiaDifermion_Polarized.cmnd similarity index 100% rename from test/ref-results/Madgraph/Difermion_Polarized/pythiaDifermion_Polarized_ISR_BSTilc.cmnd rename to test/ref-results/Madgraph/Difermion_Polarized/pythiaDifermion_Polarized.cmnd diff --git a/test/ref-results/Sherpa/Difermion_Polarized/Difermion_Polarized_ISR_BSTilc.dat b/test/ref-results/Sherpa/Difermion_Polarized/Difermion_Polarized.dat similarity index 83% rename from test/ref-results/Sherpa/Difermion_Polarized/Difermion_Polarized_ISR_BSTilc.dat rename to test/ref-results/Sherpa/Difermion_Polarized/Difermion_Polarized.dat index b2f0c476..2862fe2c 100644 --- a/test/ref-results/Sherpa/Difermion_Polarized/Difermion_Polarized_ISR_BSTilc.dat +++ b/test/ref-results/Sherpa/Difermion_Polarized/Difermion_Polarized.dat @@ -6,13 +6,13 @@ POLARIZATION: BEAM_2: 0.3 ME_Generators: [Amegic] MODEL: SM -PDF_LIBRARY: PDFESherpa +PDF_LIBRARY: None YFS_MODE: None EVENTS: 10000 ALPHAS(MZ): 0.1184 GF: 1.16637e-05 -EVENT_OUTPUT: HepMC3_GenEvent[Difermion_Polarized_ISR_BSTilc.hepmc3] +EVENT_OUTPUT: HepMC3_GenEvent[Difermion_Polarized.hepmc3] EW_SCHEME: 3 EVENT_GENERATION_MODE: unweighted diff --git a/test/ref-results/Sherpa/Difermion_Polarized/Run_Difermion_Polarized.sh b/test/ref-results/Sherpa/Difermion_Polarized/Run_Difermion_Polarized.sh new file mode 100755 index 00000000..e3c9d5f6 --- /dev/null +++ b/test/ref-results/Sherpa/Difermion_Polarized/Run_Difermion_Polarized.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash +if [ -z "${KEY4HEP_STACK}" ]; then + source /cvmfs/sw.hsf.org/key4hep/setup.sh +fi + +Sherpa -f Difermion_Polarized.dat +./makelibs +Sherpa -f Difermion_Polarized.dat +convertHepMC2EDM4HEP -i hepmc3 -o edm4hep Difermion_Polarized.hepmc3 Difermion_Polarized.edm4hep + +key4HEPAnalysis -i Difermion_Polarized.edm4hep -o Difermion_Polarized.root -p 13,-13 diff --git a/test/ref-results/Sherpa/Difermion_Polarized/Run_Difermion_Polarized_ISR_BSTilc.sh b/test/ref-results/Sherpa/Difermion_Polarized/Run_Difermion_Polarized_ISR_BSTilc.sh deleted file mode 100755 index 79eaacd9..00000000 --- a/test/ref-results/Sherpa/Difermion_Polarized/Run_Difermion_Polarized_ISR_BSTilc.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash -if [ -z "${KEY4HEP_STACK}" ]; then - source /cvmfs/sw.hsf.org/key4hep/setup.sh -fi - -Sherpa -f Difermion_Polarized_ISR_BSTilc.dat -./makelibs -Sherpa -f Difermion_Polarized_ISR_BSTilc.dat -convertHepMC2EDM4HEP -i hepmc3 -o edm4hep Difermion_Polarized_ISR_BSTilc.hepmc3 Difermion_Polarized_ISR_BSTilc.edm4hep - -key4HEPAnalysis -i Difermion_Polarized_ISR_BSTilc.edm4hep -o Difermion_Polarized_ISR_BSTilc.root -p 13,-13 diff --git a/test/ref-results/Whizard/Difermion_Polarized/Difermion_Polarized_ISR_BSTilc.sin b/test/ref-results/Whizard/Difermion_Polarized/Difermion_Polarized.sin similarity index 75% rename from test/ref-results/Whizard/Difermion_Polarized/Difermion_Polarized_ISR_BSTilc.sin rename to test/ref-results/Whizard/Difermion_Polarized/Difermion_Polarized.sin index 3c0f5cde..b186c6cb 100644 --- a/test/ref-results/Whizard/Difermion_Polarized/Difermion_Polarized_ISR_BSTilc.sin +++ b/test/ref-results/Whizard/Difermion_Polarized/Difermion_Polarized.sin @@ -1,10 +1,6 @@ model = SM_CKM seed = 4711 -?isr_handler = true -beams = e1, E1 => circe2 => isr,isr -isr_mass = 0.000511 -$circe2_file= "250_SetA_ee024.circe" -?circe2_polarized= false +?isr_handler = false beams_pol_density = @(-1), @(1) beams_pol_fraction = 0.8, 0.3 process proc = e1, E1 => e2, E2 diff --git a/test/ref-results/Whizard/Difermion_Polarized/Run_Difermion_Polarized.sh b/test/ref-results/Whizard/Difermion_Polarized/Run_Difermion_Polarized.sh new file mode 100755 index 00000000..9d1f8b8e --- /dev/null +++ b/test/ref-results/Whizard/Difermion_Polarized/Run_Difermion_Polarized.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash +if [ -z "${KEY4HEP_STACK}" ]; then + source /cvmfs/sw.hsf.org/key4hep/setup.sh +fi + +whizard Difermion_Polarized.sin +convertHepMC2EDM4HEP -i hepmc3 -o edm4hep proc.hepmc Difermion_Polarized.edm4hep + +key4HEPAnalysis -i Difermion_Polarized.edm4hep -o Difermion_Polarized.root -p 13,-13 diff --git a/test/ref-results/Whizard/Difermion_Polarized/Run_Difermion_Polarized_ISR_BSTilc.sh b/test/ref-results/Whizard/Difermion_Polarized/Run_Difermion_Polarized_ISR_BSTilc.sh deleted file mode 100755 index 3a9b2ac2..00000000 --- a/test/ref-results/Whizard/Difermion_Polarized/Run_Difermion_Polarized_ISR_BSTilc.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -if [ -z "${KEY4HEP_STACK}" ]; then - source /cvmfs/sw.hsf.org/key4hep/setup.sh -fi - -wget https://whizard.hepforge.org/circe_files/ILC/250_SetA_ee024.circe -whizard Difermion_Polarized_ISR_BSTilc.sin -convertHepMC2EDM4HEP -i hepmc3 -o edm4hep proc.hepmc Difermion_Polarized_ISR_BSTilc.edm4hep - -key4HEPAnalysis -i Difermion_Polarized_ISR_BSTilc.edm4hep -o Difermion_Polarized_ISR_BSTilc.root -p 13,-13 From 671de452282f1847f38e185dd653d5523e2ed9eb Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Thu, 28 May 2026 10:01:23 +0200 Subject: [PATCH 04/37] use ROOT label: chi2/ndf --- k4GeneratorsConfig/src/eventGenerationCollections2Root.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/k4GeneratorsConfig/src/eventGenerationCollections2Root.cxx b/k4GeneratorsConfig/src/eventGenerationCollections2Root.cxx index 9acbdbbc..695dc9f6 100644 --- a/k4GeneratorsConfig/src/eventGenerationCollections2Root.cxx +++ b/k4GeneratorsConfig/src/eventGenerationCollections2Root.cxx @@ -417,7 +417,7 @@ void k4GeneratorsConfig::eventGenerationCollections2Root::writeCrossSectionFigur mg->Add(m_xsectionGraphs[indexProcGen], "AP"); label.clear(); label.str(""); - label << m_generatorsList[gen] << " #chi^{2}/^{}dof = " << std::scientific << std::setprecision(2) + label << m_generatorsList[gen] << " #chi^{2}/^{}ndf = " << std::scientific << std::setprecision(2) << std::showpoint << m_xsectionChi2[indexProcGen]; // update the legend entry topLegend->AddEntry(m_xsectionGraphs[indexProcGen], label.str().c_str()); @@ -595,10 +595,10 @@ void k4GeneratorsConfig::eventGenerationCollections2Root::writeAnalysisHistosFig std::stringstream message; message << m_procSqrtsList[proc].first << "::Generator:" << theGenerator << " sqrt(s)=" << m_procSqrtsList[proc].second << "GeV " << theDelta->GetXaxis()->GetTitle() - << " Chi2/dof = " << chi2; + << " Chi2/ndf = " << chi2; m_log.push_back(message.str()); // now we should try to update the title of the histo (obj) in the top pad (delta is a copy) - label << theGenerator << " #chi^{2}/^{}dof = " << std::scientific << std::setprecision(2) << std::showpoint + label << theGenerator << " #chi^{2}/^{}ndf = " << std::scientific << std::setprecision(2) << std::showpoint << chi2; // update the legend entry topLegend->AddEntry(theOriginal, label.str().c_str()); From e4ea06d4d3cde3641619b23685f403955305a12a Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Thu, 28 May 2026 10:18:37 +0200 Subject: [PATCH 05/37] remove spurious line and implement BST cross check --- python/Generators/GeneratorBase.py | 7 +++++++ python/Generators/Sherpa.py | 1 - 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/python/Generators/GeneratorBase.py b/python/Generators/GeneratorBase.py index 0513068f..035fcf30 100644 --- a/python/Generators/GeneratorBase.py +++ b/python/Generators/GeneratorBase.py @@ -1,4 +1,5 @@ from abc import ABC,abstractmethod +import sys import importlib import os, stat import math @@ -12,6 +13,8 @@ class GeneratorBase(ABC): """GeneratorBase class""" def __init__(self, procinfo, name, inputFileExtension): + # BST positive list + BSTList = ["Madgraph","Whizard"] # general settings of the class self.procinfo = procinfo @@ -50,6 +53,10 @@ def __init__(self, procinfo, name, inputFileExtension): "_BST" + self.procinfo.beamstrahlung.lower() ) self.key4hepScript += "_BST" + self.procinfo.beamstrahlung.lower() + # also do a positive check + if self.name not in BSTList: + print(f"WARNING: Generator {self.name} not available for Beasmtrahlung") + sys.exit() # take care of the extensions of the filenames self.GeneratorDatacardName = ( diff --git a/python/Generators/Sherpa.py b/python/Generators/Sherpa.py index 8a8de645..bb206d4d 100644 --- a/python/Generators/Sherpa.py +++ b/python/Generators/Sherpa.py @@ -50,7 +50,6 @@ def write_run(self): self.addOption2GeneratorDatacard(" BEAM_1", polFraction[0]*polDensity[0]) self.addOption2GeneratorDatacard(" BEAM_2", polFraction[1]*polDensity[1]) self.addOption2GeneratorDatacard("ME_GENERATORS", "[Amegic]") ->>>>>>> 483f9b1a7c3e2ee50c66da5ab790f46c15b574bf self.addOption2GeneratorDatacard("MODEL", self.getModel()) From f8d4bc9bc2c4565d6f9ae907a19cddffd9b0b893 Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Thu, 28 May 2026 13:41:34 +0200 Subject: [PATCH 06/37] consistency check updates --- python/Generators/Babayaga.py | 8 +++++++- python/Generators/CirceHelper.py | 2 +- python/Generators/GeneratorBase.py | 24 ++++++++++++++++++------ 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/python/Generators/Babayaga.py b/python/Generators/Babayaga.py index 7e2d84e4..0cf94dfa 100644 --- a/python/Generators/Babayaga.py +++ b/python/Generators/Babayaga.py @@ -1,3 +1,4 @@ +import sys from .GeneratorBase import GeneratorBase class Babayaga(GeneratorBase): @@ -36,7 +37,12 @@ def write_process(self): ) return - self.finalstate = "".join(map(self.pdg_to_babayaga, self.procinfo.get_finalstate_pdgList())) + allowedFinalState = [ 11, 13, 22] + finalstate = self.procinfo.get_finalstate_pdgList() + if len(finalstate) != 2 or abs(int(finalstate[0])) != abs(int(finalstate[1])) or abs(int(finalstate[0])) not in allowedFinalState: + print(f"ERROR:Final state requested for Babayaga {finalstate[0]},{finalstate[1]} not possible") + sys.exit() + self.finalstate = "".join(map(self.pdg_to_babayaga, finalstate)) self.add2GeneratorDatacard(f"fs {self.finalstate}\n") self.addOption2GeneratorDatacard("seed", self.procinfo.get_rndmSeed()) diff --git a/python/Generators/CirceHelper.py b/python/Generators/CirceHelper.py index 4c7fc495..37d7140c 100644 --- a/python/Generators/CirceHelper.py +++ b/python/Generators/CirceHelper.py @@ -29,7 +29,7 @@ def fillFileName(self, accel, sqrts): for item in self.circeData[accel]: for ecm in item.keys(): if float(sqrts) == float(ecm): - # use the key that is presnet to avoid problems + # use the key that is present to avoid problems filename = item[ecm] if filename is not None: self.File = filename diff --git a/python/Generators/GeneratorBase.py b/python/Generators/GeneratorBase.py index 035fcf30..c05504ab 100644 --- a/python/Generators/GeneratorBase.py +++ b/python/Generators/GeneratorBase.py @@ -13,8 +13,6 @@ class GeneratorBase(ABC): """GeneratorBase class""" def __init__(self, procinfo, name, inputFileExtension): - # BST positive list - BSTList = ["Madgraph","Whizard"] # general settings of the class self.procinfo = procinfo @@ -22,6 +20,10 @@ def __init__(self, procinfo, name, inputFileExtension): self.procDBName = f"{name}ProcDB" self.inputFileExtension = inputFileExtension + # basic checks + self.canDoBeamstrahlung(["Madgraph", "Whizard"]) + self.canDoPolarisation(["Sherpa", "Madgraph", "Whizard"]) + # set the Selectors Dictionary self.selectorsDict = dict() self.setSelectorsDict() @@ -53,10 +55,6 @@ def __init__(self, procinfo, name, inputFileExtension): "_BST" + self.procinfo.beamstrahlung.lower() ) self.key4hepScript += "_BST" + self.procinfo.beamstrahlung.lower() - # also do a positive check - if self.name not in BSTList: - print(f"WARNING: Generator {self.name} not available for Beasmtrahlung") - sys.exit() # take care of the extensions of the filenames self.GeneratorDatacardName = ( @@ -121,6 +119,20 @@ def __init__(self, procinfo, name, inputFileExtension): self.procDBparameters = self.procDB.getDictParameters() self.procDBparticles = self.procDB.getDictParticles() + def canDoBeamstrahlung(self, list): + if self.procinfo.get("beamstrahlung") is not None: + if self.name not in list: + print(f"WARNING: Generator {self.name} not available for Beamstrahlung") + sys.exit() + + def canDoPolarisation(self, list): + # Check Polarisation + polFraction = self.procinfo.get_PolarisationFraction(); + if any(item != 0. for item in polFraction): + if self.name not in list: + print(f"WARNING: Generator {self.name} not available for Polarisation") + sys.exit() + def getModel(self): theModel = "" try: From 126715b0af99a7f825d1a5a5c010b90745b4c232 Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Thu, 28 May 2026 17:31:04 +0200 Subject: [PATCH 07/37] add Herwig --- examples/ZHProduction.yaml | 1 + .../src/eventGenerationCollections2Root.cxx | 2 +- python/Generators/Herwig.py | 164 ++++++++++++++++++ python/Generators/HerwigProcDB.py | 69 ++++++++ test/CMakeLists.txt | 4 +- .../ref-results/Herwig/ZH250/Run_ZH250_ISR.sh | 10 ++ test/ref-results/Herwig/ZH250/ZH250_ISR.in | 22 +++ .../ref-results/Herwig/ZH350/Run_ZH350_ISR.sh | 10 ++ test/ref-results/Herwig/ZH350/ZH350_ISR.in | 22 +++ 9 files changed, 301 insertions(+), 3 deletions(-) create mode 100644 python/Generators/Herwig.py create mode 100644 python/Generators/HerwigProcDB.py create mode 100755 test/ref-results/Herwig/ZH250/Run_ZH250_ISR.sh create mode 100644 test/ref-results/Herwig/ZH250/ZH250_ISR.in create mode 100755 test/ref-results/Herwig/ZH350/Run_ZH350_ISR.sh create mode 100644 test/ref-results/Herwig/ZH350/ZH350_ISR.in diff --git a/examples/ZHProduction.yaml b/examples/ZHProduction.yaml index a0f34984..e9d80537 100644 --- a/examples/ZHProduction.yaml +++ b/examples/ZHProduction.yaml @@ -1,4 +1,5 @@ Generators: + - Herwig - Sherpa - Whizard - Madgraph diff --git a/k4GeneratorsConfig/src/eventGenerationCollections2Root.cxx b/k4GeneratorsConfig/src/eventGenerationCollections2Root.cxx index 695dc9f6..93d44522 100644 --- a/k4GeneratorsConfig/src/eventGenerationCollections2Root.cxx +++ b/k4GeneratorsConfig/src/eventGenerationCollections2Root.cxx @@ -28,7 +28,7 @@ void k4GeneratorsConfig::eventGenerationCollections2Root::Init() { TGaxis::SetExponentOffset(-0.08, -0.12, "y"); // define the generator colors (as offset) - std::vector genNames = {"Madgraph", "Sherpa", "Whizard", "KKMC", "Pythia", "Babayaga"}; + std::vector genNames = {"Madgraph", "Sherpa", "Whizard", "KKMC", "Pythia", "Babayaga", "Herwig"}; for (unsigned int i = 0; i < genNames.size(); i++) { m_generatorColorOffset[genNames[i]] = i; } diff --git a/python/Generators/Herwig.py b/python/Generators/Herwig.py new file mode 100644 index 00000000..f1ddff95 --- /dev/null +++ b/python/Generators/Herwig.py @@ -0,0 +1,164 @@ +from .GeneratorBase import GeneratorBase + +class Herwig(GeneratorBase): + """Pythia class""" + + def __init__(self, procinfo): + super().__init__(procinfo, "Herwig", "in") + + self.version = "x.y.z" + + self.executable = "Herwig" + + def setModelParameters(self): + # no alphaS and MZ, these are default + self.addModelParameter('alphaEMM1') + self.addModelParameter('sin2theta') + self.addModelParticleProperty(pdg_code=23, property_type='mass') + self.addModelParticleProperty(pdg_code=23, property_type='width') + self.addModelParticleProperty(pdg_code=24, property_type='width') + + def execute(self): + # prepare the datacard + self.fill_datacard() + # prepare the key4hep script + self.fill_key4hepScript() + + def fill_datacard(self): + # prepare the datacard + self.fill_run() + #self.fill_decay() + + def fill_run(self): + self.addOption2GeneratorDatacard("set Seed", self.procinfo.get_rndmSeed()) + + beamA = self.pdg_to_herwig(self.procinfo.get_beam_flavour(1)) + beamB = self.pdg_to_herwig(self.procinfo.get_beam_flavour(2)) + self.addOption2GeneratorDatacard("set EventHandler:BeamA", f"/Herwig/Particles/{beamA}") + self.addOption2GeneratorDatacard("set EventHandler:BeamB", f"/Herwig/Particles/{beamB}") + + self.add2GeneratorDatacard("cd /Herwig/Generators") + self.addOption2GeneratorDatacard("set EventGenerator:EventHandler:LuminosityFunction:Energy",self.procinfo.get("sqrts")) + + self.addOption2GeneratorDatacard("set EventGenerator:NumberOfEvents", self.procinfo.settings.get_nevents()) + self.add2GeneratorDatacard("\n") + + # ISR + if self.procinfo.get("isrmode"): + self.addOption2GeneratorDatacard("set /Herwig/Shower/SplittingGenerator:ISR", "Yes") + else: + self.addOption2GeneratorDatacard("set /Herwig/Shower/SplittingGenerator:ISR", "No") + + # FSR + if self.procinfo.get("fsrmode"): + self.addOption2GeneratorDatacard("set /Herwig/Shower/SplittingGenerator:FSR", "Yes") + else: + self.addOption2GeneratorDatacard("set /Herwig/Shower/SplittingGenerator:FSR", "No") + + # now add the model parameters + self.prepareParameters() + + # now add the particles checking for overlap with ProcDB + self.prepareParticles() + + # add the procDB settings + for key in self.procDB.getDict(): + value = self.procDB.getDict()[key] + self.addOption2GeneratorDatacard(key,value) + + # the generator settings from yaml are set last as they superseed all previous settings + if self.gen_settings is not None: + for key, value in self.gen_settings.items(): + self.addOption2GeneratorDatacard(key, value) + + def fill_decay(self): + #if self.procinfo.get("decay"): + #self.add_decay() + return + + def fill_key4hepScript(self): + key4hepRun = "" + key4hepRun += self.executable + " read " + self.GeneratorDatacardName + "\n" + key4hepRun += self.executable + " run " + self.GeneratorDatacardBase + ".run\n" + + if self.procinfo.get_output_format() == "edm4hep": + key4hepRun += f"convertHepMC2EDM4HEP -i hepmc3 -o edm4hep {self.GeneratorDatacardBase}.hepmc3 {self.GeneratorDatacardBase}.edm4hep\n" + + self.add2Key4hepScript(key4hepRun) + + def getGeneratorCommand(self,key,value): + return f"{key} {value}" + + def getParameterLabel(self, param): + parameterDict = { 'alphaEMM1' : 'EW/AlphaEM', + 'sin2theta' : 'EW/Sin2ThetaW', + 'alphaSMZ' : 'LOAlphaS:input_alpha_s'} + # alphas could be SigmaProcess:alphaSvalue + if param not in parameterDict.keys(): + print(f"Warning::Herwig: parameter {param} has no translation in Herwig Parameter Dictionary") + return "" + return parameterDict[param] + + def setSelectorsDict(self): + pass + + def add1ParticleSelector2Card(self, sel, name): + pass + + def add2ParticleSelector2Card(self, sel, name): + pass + + def getParameterOperator(self, name): + return f"set {name}" + + def getParticleProperty(self, d): + name = None + if d == "mass": + name = "Mass" + if d == "width": + name = "Width" + return name + + def getParticleOperator(self, pdg, prop): + pdgString = self.pdg_to_herwig(abs(int(pdg)), signed=False) + if pdgString == "Higgs" and prop == "Width": + pdgString = "h" + return f"set {pdgString}{prop}" + + def getModelName(self): + # not needed for Herwig + pass + + def pdg_to_herwig(self, pdg, signed=True): + apdg = abs(pdg) + if type(pdg) is int: + particle_mapping = {6: "Top", 11: "e", 23: "Z", 25: "Higgs", 24: "W"} + particle = particle_mapping.get(apdg,"ERROR") + if not signed: + return particle + # continue if we need more + if particle != "ERROR": + if apdg <= 6: + if pdg > 0: + return f"{particle}" + else: + return f"{particle}bar" + elif apdg == 11 or apdg == 13 or apdg == 15: + if pdg > 0: + return f"{particle}-" + else: + return f"{particle}+" + elif apdg == 12 or apdg == 14 or apdg == 16: + if pdg > 0: + return f"{particle}" + else: + return f"{particle}bar" + elif apdg == 22 or apdg == 23 or apdg == 25: + return f"{particle}" + elif apdg == 24: + if pdg > 0: + return f"{particle}+" + else: + return f"{particle}-" + else: + return f"Cant find Herwig id for pdg {pdg}" diff --git a/python/Generators/HerwigProcDB.py b/python/Generators/HerwigProcDB.py new file mode 100644 index 00000000..25dba211 --- /dev/null +++ b/python/Generators/HerwigProcDB.py @@ -0,0 +1,69 @@ +import copy +from .ProcDBBase import ProcDBBase + +class HerwigProcDB(ProcDBBase): + """HerwigProcDB class""" + + def __init__(self, process): + super().__init__(process) + self.process = process + + def execute(self): + # general stuff + # choose as function of DBTag + self.rundict['cd /Herwig/MatrixElements'] = " " + tag = copy.deepcopy(self.process.get_DBTag()) + if tag[0] == [-11,11]: + self.rundict['read snippets/EECollider.in'] = " " + # allow for e+e- and mu+mu- initial state + if tag[0] == [-11.11] or tag[0] == [-13,13]: + tag[0] = [-11,11] + # tag prepared compare + if tag == [[-11,11],[-1,1]]: + self.write_Difermion(1) + elif tag == [[-11,11],[-2,2]]: + self.write_Difermion(2) + elif tag == [[-11,11],[-3,3]]: + self.write_Difermion(3) + elif tag == [[-11,11],[-4,4]]: + self.write_Difermion(4) + elif tag == [[-11,11],[-5,5]]: + self.write_Difermion(5) + elif tag == [[-11,11],[-12,12]]: + self.write_Difermion(12) + elif tag == [[-11,11],[-13,13]]: + self.write_Difermion(13) + elif tag == [[-11,11],[-14,14]]: + self.write_Difermion(14) + elif tag == [[-11,11],[-15,15]]: + self.write_Difermion(15) + elif tag == [[-11,11],[-16,16]]: + self.write_Difermion(16) + elif tag == [[-11,11],[23,23]]: + self.write_ZZ() + elif tag == [[-11,11],[24,24]]: + self.write_WW() + elif tag == [[-11,11],[23,25]]: + self.write_run_ZH() + elif tag == [[-11,11],[-12,12,25]]: + self.write_run_Hnunu() + else: + print(f"WARNING: Process {tag} not implemented in HerwigProcDB") + + def write_Difermion(self, pdg): + if pdg < 6: + self.procdict['insert SubProcess:MatrixElements 0'] = "MEee2gZ2qq" + elif pdg > 10 and pdg < 17: + self.procdict['insert SubProcess:MatrixElements 0'] = "MEee2gZ2ll" + + def write_ZZ(self): + self.procdict['insert SubProcess:MatrixElements 0'] = "MEee2VV" + + def write_WW(self): + self.procdict['insert SubProcess:MatrixElements 0'] = "MEee2VV" + + def write_run_ZH(self): + self.procdict['insert SubProcess:MatrixElements 0'] = "MEee2ZH" + + def write_run_Hnunu(self): + self.procdict['insert SubProcess:MatrixElements 0'] = "MEee2HiggsVBF" diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index fc69d5cf..1a11f54d 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,4 +1,4 @@ -# generl settings: +# general settings: set(TEST_ENVIRONMENT "PATH=${PROJECT_BINARY_DIR}/bin:$ENV{PATH}") set(TEST_TIMEOUT 3500) @@ -6,7 +6,7 @@ set(TEST_TIMEOUT 3500) set(EXECUTABLE "${PROJECT_SOURCE_DIR}/python/k4GeneratorsConfig.py") # the generators to be run -set(generatorList Babayaga KKMC Madgraph Pythia Sherpa Whizard ) +set(generatorList Babayaga Herwig KKMC Madgraph Pythia Sherpa Whizard ) # generate the run list for the dependencies foreach(generator ${generatorList}) diff --git a/test/ref-results/Herwig/ZH250/Run_ZH250_ISR.sh b/test/ref-results/Herwig/ZH250/Run_ZH250_ISR.sh new file mode 100755 index 00000000..c970b879 --- /dev/null +++ b/test/ref-results/Herwig/ZH250/Run_ZH250_ISR.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +if [ -z "${KEY4HEP_STACK}" ]; then + source /cvmfs/sw.hsf.org/key4hep/setup.sh +fi + +Herwig read ZH250_ISR.in +Herwig run ZH250_ISR.run +convertHepMC2EDM4HEP -i hepmc3 -o edm4hep ZH250_ISR.hepmc3 ZH250_ISR.edm4hep + +key4HEPAnalysis -i ZH250_ISR.edm4hep -o ZH250_ISR.root -p 23,25 diff --git a/test/ref-results/Herwig/ZH250/ZH250_ISR.in b/test/ref-results/Herwig/ZH250/ZH250_ISR.in new file mode 100644 index 00000000..b0bf160b --- /dev/null +++ b/test/ref-results/Herwig/ZH250/ZH250_ISR.in @@ -0,0 +1,22 @@ +set Seed 4711 +set EventHandler:BeamA /Herwig/Particles/e- +set EventHandler:BeamB /Herwig/Particles/e+ +cd /Herwig/Generatorsset EventGenerator:EventHandler:LuminosityFunction:Energy 250.0 +set EventGenerator:NumberOfEvents 10000 + +set /Herwig/Shower/SplittingGenerator:ISR Yes +set /Herwig/Shower/SplittingGenerator:FSR No +set LOAlphaS:input_alpha_s 0.1184 +set EW/AlphaEM 137.035999139 +set EW/Sin2ThetaW 0.23155 +set ZMass 91.1876 +set ZWidth 2.4952 +set TopMass 172 +set TopWidth 1.50833649 +set HiggsMass 125 +set hWidth 0.00407 +set WWidth 2.085 +set WMass 80.379 +cd /Herwig/MatrixElements +read snippets/EECollider.in +insert SubProcess:MatrixElements 0 MEee2ZH diff --git a/test/ref-results/Herwig/ZH350/Run_ZH350_ISR.sh b/test/ref-results/Herwig/ZH350/Run_ZH350_ISR.sh new file mode 100755 index 00000000..ef41cbec --- /dev/null +++ b/test/ref-results/Herwig/ZH350/Run_ZH350_ISR.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +if [ -z "${KEY4HEP_STACK}" ]; then + source /cvmfs/sw.hsf.org/key4hep/setup.sh +fi + +Herwig read ZH350_ISR.in +Herwig run ZH350_ISR.run +convertHepMC2EDM4HEP -i hepmc3 -o edm4hep ZH350_ISR.hepmc3 ZH350_ISR.edm4hep + +key4HEPAnalysis -i ZH350_ISR.edm4hep -o ZH350_ISR.root -p 23,25 diff --git a/test/ref-results/Herwig/ZH350/ZH350_ISR.in b/test/ref-results/Herwig/ZH350/ZH350_ISR.in new file mode 100644 index 00000000..ced7fe20 --- /dev/null +++ b/test/ref-results/Herwig/ZH350/ZH350_ISR.in @@ -0,0 +1,22 @@ +set Seed 42 +set EventHandler:BeamA /Herwig/Particles/e- +set EventHandler:BeamB /Herwig/Particles/e+ +cd /Herwig/Generatorsset EventGenerator:EventHandler:LuminosityFunction:Energy 350 +set EventGenerator:NumberOfEvents 10000 + +set /Herwig/Shower/SplittingGenerator:ISR Yes +set /Herwig/Shower/SplittingGenerator:FSR No +set LOAlphaS:input_alpha_s 0.1184 +set EW/AlphaEM 137.035999139 +set EW/Sin2ThetaW 0.23155 +set ZMass 91.1876 +set ZWidth 2.4952 +set TopMass 172 +set TopWidth 1.50833649 +set HiggsMass 125 +set hWidth 0.00407 +set WWidth 2.085 +set WMass 80.379 +cd /Herwig/MatrixElements +read snippets/EECollider.in +insert SubProcess:MatrixElements 0 MEee2ZH From 8b547116f48237a3b09fc9c0e1615cfb16becf38 Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Thu, 28 May 2026 18:12:43 +0200 Subject: [PATCH 08/37] add the possibility of a unit in the particle properties --- python/Generators/Babayaga.py | 4 ++++ python/Generators/GeneratorBase.py | 9 +++++++-- python/Generators/Herwig.py | 16 +++++++++++----- python/Generators/KKMC.py | 4 ++++ python/Generators/Madgraph.py | 4 ++++ python/Generators/Pythia.py | 4 ++++ python/Generators/Sherpa.py | 4 ++++ python/Generators/Whizard.py | 4 ++++ test/ref-results/Herwig/ZH250/ZH250_ISR.in | 16 ++++++++-------- test/ref-results/Herwig/ZH350/ZH350_ISR.in | 16 ++++++++-------- 10 files changed, 58 insertions(+), 23 deletions(-) diff --git a/python/Generators/Babayaga.py b/python/Generators/Babayaga.py index 0cf94dfa..9dc08108 100644 --- a/python/Generators/Babayaga.py +++ b/python/Generators/Babayaga.py @@ -139,6 +139,10 @@ def getParticleOperator(self, pdg, prop): # not used by Babayaga pass + def getParticlePropertyUnit(self): + # not used + pass + def getParticleProperty(self, attr): # not used by Babayaga pass diff --git a/python/Generators/GeneratorBase.py b/python/Generators/GeneratorBase.py index c05504ab..4a14ade2 100644 --- a/python/Generators/GeneratorBase.py +++ b/python/Generators/GeneratorBase.py @@ -323,7 +323,7 @@ def resetGeneratorDatacard(self): def getGeneratorCommand(self,key,value): pass - def addOption2GeneratorDatacard(self,key,value,replace=True): + def addOption2GeneratorDatacard(self,key,value,unit="",replace=True): # check if the key is already defined in the datacard, then we take the last one (TBC): if replace is True: if key in self.__datacardContent: @@ -440,14 +440,19 @@ def prepareParticles(self,add2Datacard=True, writeParticleHeader=False): for attr in particle: value = particle[attr] prop = self.getParticleProperty(attr) + unit = self.getParticlePropertyUnit() # writing out if prop is not None: command = self.getParticleOperator(pdg,prop) if add2Datacard is True: - self.addOption2GeneratorDatacard(command, value,replace=False) + self.addOption2GeneratorDatacard(command, value, unit, replace=False) else: self.replaceOptionInGeneratorDatacard(command,value) + @abstractmethod + def getParticlePropertyUnit(self): + pass + @abstractmethod def getParticleProperty(self, attr): pass diff --git a/python/Generators/Herwig.py b/python/Generators/Herwig.py index f1ddff95..32b7788c 100644 --- a/python/Generators/Herwig.py +++ b/python/Generators/Herwig.py @@ -111,6 +111,9 @@ def add2ParticleSelector2Card(self, sel, name): def getParameterOperator(self, name): return f"set {name}" + def getParticlePropertyUnit(self): + return "*GeV" + def getParticleProperty(self, d): name = None if d == "mass": @@ -120,10 +123,8 @@ def getParticleProperty(self, d): return name def getParticleOperator(self, pdg, prop): - pdgString = self.pdg_to_herwig(abs(int(pdg)), signed=False) - if pdgString == "Higgs" and prop == "Width": - pdgString = "h" - return f"set {pdgString}{prop}" + pdgString = self.pdg_to_herwig(abs(int(pdg))) + return f"set /Herwig/Particles/{pdgString}:Nominal{prop}" def getModelName(self): # not needed for Herwig @@ -132,7 +133,12 @@ def getModelName(self): def pdg_to_herwig(self, pdg, signed=True): apdg = abs(pdg) if type(pdg) is int: - particle_mapping = {6: "Top", 11: "e", 23: "Z", 25: "Higgs", 24: "W"} + particle_mapping = {1: "d", 52: "u", 3: "s", 4: "c", 5: "b", 6: "t", + 11: "e", 13: "mu", 15: "tau", + 12: "nu_e", 14: "nu_mu", 16: "nu_tau", + 21: "g", + 22: "gamma", 23: "Z0", 24: "W", + 25: "h0"} particle = particle_mapping.get(apdg,"ERROR") if not signed: return particle diff --git a/python/Generators/KKMC.py b/python/Generators/KKMC.py index 0ede74e9..63dbeaf0 100644 --- a/python/Generators/KKMC.py +++ b/python/Generators/KKMC.py @@ -106,6 +106,10 @@ def getParameterLabel(self, param): return "" return parameterDict[param] + def getParticlePropertyUnit(self): + # not used + pass + def getParticleProperty(self, d): name = None if d == "mass": diff --git a/python/Generators/Madgraph.py b/python/Generators/Madgraph.py index d4db8136..48cfca68 100644 --- a/python/Generators/Madgraph.py +++ b/python/Generators/Madgraph.py @@ -270,6 +270,10 @@ def getParameterOperator(self, name): def getGeneratorCommand(self,key,value): return f"{key} {value}" + def getParticlePropertyUnit(self): + # not used + pass + def getParticleProperty(self, d): if d == "mass": return "M" diff --git a/python/Generators/Pythia.py b/python/Generators/Pythia.py index e8353c65..74a6bdb9 100644 --- a/python/Generators/Pythia.py +++ b/python/Generators/Pythia.py @@ -214,6 +214,10 @@ def getParameterOperator(self, name): return f"ParticleData:{name}" # return f"SigmaProcess:{name}" + def getParticlePropertyUnit(self): + # not used + pass + def getParticleProperty(self, d): name = None if d == "mass": diff --git a/python/Generators/Sherpa.py b/python/Generators/Sherpa.py index bb206d4d..030ff91a 100644 --- a/python/Generators/Sherpa.py +++ b/python/Generators/Sherpa.py @@ -209,6 +209,10 @@ def getParameterOperator(self, name): def getGeneratorCommand(self,key,value): return f"{key}: {value}" + def getParticlePropertyUnit(self): + # not used + pass + def getParticleProperty(self, d): name = None d = d.lower() diff --git a/python/Generators/Whizard.py b/python/Generators/Whizard.py index d241af66..0cf3f71d 100644 --- a/python/Generators/Whizard.py +++ b/python/Generators/Whizard.py @@ -210,6 +210,10 @@ def getParameterOperator(self, name): def getGeneratorCommand(self,key,value): return f"{key} = {value}" + def getParticlePropertyUnit(self): + # not used + pass + def getParticleProperty(self, d): name = None if d == "mass": diff --git a/test/ref-results/Herwig/ZH250/ZH250_ISR.in b/test/ref-results/Herwig/ZH250/ZH250_ISR.in index b0bf160b..a9af6897 100644 --- a/test/ref-results/Herwig/ZH250/ZH250_ISR.in +++ b/test/ref-results/Herwig/ZH250/ZH250_ISR.in @@ -9,14 +9,14 @@ set /Herwig/Shower/SplittingGenerator:FSR No set LOAlphaS:input_alpha_s 0.1184 set EW/AlphaEM 137.035999139 set EW/Sin2ThetaW 0.23155 -set ZMass 91.1876 -set ZWidth 2.4952 -set TopMass 172 -set TopWidth 1.50833649 -set HiggsMass 125 -set hWidth 0.00407 -set WWidth 2.085 -set WMass 80.379 +set /Herwig/Particles/Z0:NominalMass 91.1876 +set /Herwig/Particles/Z0:NominalWidth 2.4952 +set /Herwig/Particles/t:NominalMass 172 +set /Herwig/Particles/t:NominalWidth 1.50833649 +set /Herwig/Particles/h0:NominalMass 125 +set /Herwig/Particles/h0:NominalWidth 0.00407 +set /Herwig/Particles/W+:NominalWidth 2.085 +set /Herwig/Particles/W+:NominalMass 80.379 cd /Herwig/MatrixElements read snippets/EECollider.in insert SubProcess:MatrixElements 0 MEee2ZH diff --git a/test/ref-results/Herwig/ZH350/ZH350_ISR.in b/test/ref-results/Herwig/ZH350/ZH350_ISR.in index ced7fe20..5cdc58a4 100644 --- a/test/ref-results/Herwig/ZH350/ZH350_ISR.in +++ b/test/ref-results/Herwig/ZH350/ZH350_ISR.in @@ -9,14 +9,14 @@ set /Herwig/Shower/SplittingGenerator:FSR No set LOAlphaS:input_alpha_s 0.1184 set EW/AlphaEM 137.035999139 set EW/Sin2ThetaW 0.23155 -set ZMass 91.1876 -set ZWidth 2.4952 -set TopMass 172 -set TopWidth 1.50833649 -set HiggsMass 125 -set hWidth 0.00407 -set WWidth 2.085 -set WMass 80.379 +set /Herwig/Particles/Z0:NominalMass 91.1876 +set /Herwig/Particles/Z0:NominalWidth 2.4952 +set /Herwig/Particles/t:NominalMass 172 +set /Herwig/Particles/t:NominalWidth 1.50833649 +set /Herwig/Particles/h0:NominalMass 125 +set /Herwig/Particles/h0:NominalWidth 0.00407 +set /Herwig/Particles/W+:NominalWidth 2.085 +set /Herwig/Particles/W+:NominalMass 80.379 cd /Herwig/MatrixElements read snippets/EECollider.in insert SubProcess:MatrixElements 0 MEee2ZH From af1509a89c7097a8e21aec6060ecfce1f53a8fba Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Thu, 28 May 2026 18:37:17 +0200 Subject: [PATCH 09/37] upgrade HerwigProcDB --- python/Generators/HerwigProcDB.py | 25 ++++++++++++++++--------- test/CMakeLists.txt | 2 +- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/python/Generators/HerwigProcDB.py b/python/Generators/HerwigProcDB.py index 25dba211..cab3fa6c 100644 --- a/python/Generators/HerwigProcDB.py +++ b/python/Generators/HerwigProcDB.py @@ -40,9 +40,9 @@ def execute(self): elif tag == [[-11,11],[-16,16]]: self.write_Difermion(16) elif tag == [[-11,11],[23,23]]: - self.write_ZZ() + self.write_WeakBosonPair(23) elif tag == [[-11,11],[24,24]]: - self.write_WW() + self.write_WeakBosonPair(24) elif tag == [[-11,11],[23,25]]: self.write_run_ZH() elif tag == [[-11,11],[-12,12,25]]: @@ -51,17 +51,24 @@ def execute(self): print(f"WARNING: Process {tag} not implemented in HerwigProcDB") def write_Difermion(self, pdg): + MatrixElement = None if pdg < 6: - self.procdict['insert SubProcess:MatrixElements 0'] = "MEee2gZ2qq" + MatrixElement = "MEee2gZ2qq" elif pdg > 10 and pdg < 17: - self.procdict['insert SubProcess:MatrixElements 0'] = "MEee2gZ2ll" + MatrixElement = "MEee2gZ2ll" - def write_ZZ(self): - self.procdict['insert SubProcess:MatrixElements 0'] = "MEee2VV" - - def write_WW(self): - self.procdict['insert SubProcess:MatrixElements 0'] = "MEee2VV" + # set the matrix element etc: + if MatrixElement is not None: + self.procdict['insert SubProcess:MatrixElements 0'] = MatrixElement + self.procdict[f"set {MatrixElement}:MinimumFlavour"] = f"{pdg}" + self.procdict[f"set {MatrixElement}:MaximumFlavour"] = f"{pdg}" + def write_WeakBosonPair(self, pdg): + MatrixElement = "MEee2VV" + self.procdict['insert SubProcess:MatrixElements 0'] = MatrixElement + self.procdict[f"set {MatrixElement}:MinimumFlavour"] = f"{pdg}" + self.procdict[f"set {MatrixElement}:MaximumFlavour"] = f"{pdg}" + def write_run_ZH(self): self.procdict['insert SubProcess:MatrixElements 0'] = "MEee2ZH" diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1a11f54d..175af1a9 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -6,7 +6,7 @@ set(TEST_TIMEOUT 3500) set(EXECUTABLE "${PROJECT_SOURCE_DIR}/python/k4GeneratorsConfig.py") # the generators to be run -set(generatorList Babayaga Herwig KKMC Madgraph Pythia Sherpa Whizard ) +set(generatorList Babayaga KKMC Madgraph Pythia Sherpa Whizard ) # generate the run list for the dependencies foreach(generator ${generatorList}) From 72bd9a843cf5db60420cde0d4db51794a43b1a33 Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Fri, 29 May 2026 09:02:36 +0200 Subject: [PATCH 10/37] preparing Herwig --- python/Generators/Herwig.py | 16 +++++++++++----- python/Generators/HerwigProcDB.py | 3 --- test/ref-results/Herwig/ZH250/ZH250_ISR.in | 11 +++++------ test/ref-results/Herwig/ZH350/ZH350_ISR.in | 11 +++++------ 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/python/Generators/Herwig.py b/python/Generators/Herwig.py index 32b7788c..9767c8ee 100644 --- a/python/Generators/Herwig.py +++ b/python/Generators/Herwig.py @@ -30,18 +30,23 @@ def fill_datacard(self): #self.fill_decay() def fill_run(self): - self.addOption2GeneratorDatacard("set Seed", self.procinfo.get_rndmSeed()) + + initialState = [self.procinfo.get_beam_flavour(1), self.procinfo.get_beam_flavour(2)] + if initialState == [11,-11]: + self.add2GeneratorDatacard("read snippets/EECollider.in\n") + + beamA = self.pdg_to_herwig(initialState[0]) + beamB = self.pdg_to_herwig(initialState[1]) - beamA = self.pdg_to_herwig(self.procinfo.get_beam_flavour(1)) - beamB = self.pdg_to_herwig(self.procinfo.get_beam_flavour(2)) self.addOption2GeneratorDatacard("set EventHandler:BeamA", f"/Herwig/Particles/{beamA}") self.addOption2GeneratorDatacard("set EventHandler:BeamB", f"/Herwig/Particles/{beamB}") - self.add2GeneratorDatacard("cd /Herwig/Generators") + self.add2GeneratorDatacard("cd /Herwig/Generators\n") self.addOption2GeneratorDatacard("set EventGenerator:EventHandler:LuminosityFunction:Energy",self.procinfo.get("sqrts")) self.addOption2GeneratorDatacard("set EventGenerator:NumberOfEvents", self.procinfo.settings.get_nevents()) - self.add2GeneratorDatacard("\n") + + self.addOption2GeneratorDatacard("set EventGenerator/RandomNumberGenerator/Seed", self.procinfo.get_rndmSeed()) # ISR if self.procinfo.get("isrmode"): @@ -62,6 +67,7 @@ def fill_run(self): self.prepareParticles() # add the procDB settings + self.add2GeneratorDatacard("cd /Herwig/MatrixElements") for key in self.procDB.getDict(): value = self.procDB.getDict()[key] self.addOption2GeneratorDatacard(key,value) diff --git a/python/Generators/HerwigProcDB.py b/python/Generators/HerwigProcDB.py index cab3fa6c..31272a31 100644 --- a/python/Generators/HerwigProcDB.py +++ b/python/Generators/HerwigProcDB.py @@ -11,10 +11,7 @@ def __init__(self, process): def execute(self): # general stuff # choose as function of DBTag - self.rundict['cd /Herwig/MatrixElements'] = " " tag = copy.deepcopy(self.process.get_DBTag()) - if tag[0] == [-11,11]: - self.rundict['read snippets/EECollider.in'] = " " # allow for e+e- and mu+mu- initial state if tag[0] == [-11.11] or tag[0] == [-13,13]: tag[0] = [-11,11] diff --git a/test/ref-results/Herwig/ZH250/ZH250_ISR.in b/test/ref-results/Herwig/ZH250/ZH250_ISR.in index a9af6897..4ea07db3 100644 --- a/test/ref-results/Herwig/ZH250/ZH250_ISR.in +++ b/test/ref-results/Herwig/ZH250/ZH250_ISR.in @@ -1,9 +1,10 @@ -set Seed 4711 +read snippets/EECollider.in set EventHandler:BeamA /Herwig/Particles/e- set EventHandler:BeamB /Herwig/Particles/e+ -cd /Herwig/Generatorsset EventGenerator:EventHandler:LuminosityFunction:Energy 250.0 +cd /Herwig/Generators +set EventGenerator:EventHandler:LuminosityFunction:Energy 250.0 set EventGenerator:NumberOfEvents 10000 - +set EventGenerator/RandomNumberGenerator/Seed 4711 set /Herwig/Shower/SplittingGenerator:ISR Yes set /Herwig/Shower/SplittingGenerator:FSR No set LOAlphaS:input_alpha_s 0.1184 @@ -17,6 +18,4 @@ set /Herwig/Particles/h0:NominalMass 125 set /Herwig/Particles/h0:NominalWidth 0.00407 set /Herwig/Particles/W+:NominalWidth 2.085 set /Herwig/Particles/W+:NominalMass 80.379 -cd /Herwig/MatrixElements -read snippets/EECollider.in -insert SubProcess:MatrixElements 0 MEee2ZH +cd /Herwig/MatrixElementsinsert SubProcess:MatrixElements 0 MEee2ZH diff --git a/test/ref-results/Herwig/ZH350/ZH350_ISR.in b/test/ref-results/Herwig/ZH350/ZH350_ISR.in index 5cdc58a4..e981bc6b 100644 --- a/test/ref-results/Herwig/ZH350/ZH350_ISR.in +++ b/test/ref-results/Herwig/ZH350/ZH350_ISR.in @@ -1,9 +1,10 @@ -set Seed 42 +read snippets/EECollider.in set EventHandler:BeamA /Herwig/Particles/e- set EventHandler:BeamB /Herwig/Particles/e+ -cd /Herwig/Generatorsset EventGenerator:EventHandler:LuminosityFunction:Energy 350 +cd /Herwig/Generators +set EventGenerator:EventHandler:LuminosityFunction:Energy 350 set EventGenerator:NumberOfEvents 10000 - +set EventGenerator/RandomNumberGenerator/Seed 42 set /Herwig/Shower/SplittingGenerator:ISR Yes set /Herwig/Shower/SplittingGenerator:FSR No set LOAlphaS:input_alpha_s 0.1184 @@ -17,6 +18,4 @@ set /Herwig/Particles/h0:NominalMass 125 set /Herwig/Particles/h0:NominalWidth 0.00407 set /Herwig/Particles/W+:NominalWidth 2.085 set /Herwig/Particles/W+:NominalMass 80.379 -cd /Herwig/MatrixElements -read snippets/EECollider.in -insert SubProcess:MatrixElements 0 MEee2ZH +cd /Herwig/MatrixElementsinsert SubProcess:MatrixElements 0 MEee2ZH From 20ba341a037c32756ad6c2e9b5fa9b3e23f14d7a Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Fri, 29 May 2026 09:25:42 +0200 Subject: [PATCH 11/37] language --- python/Generators/Herwig.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/Generators/Herwig.py b/python/Generators/Herwig.py index 9767c8ee..c1e8bb05 100644 --- a/python/Generators/Herwig.py +++ b/python/Generators/Herwig.py @@ -30,9 +30,9 @@ def fill_datacard(self): #self.fill_decay() def fill_run(self): - - initialState = [self.procinfo.get_beam_flavour(1), self.procinfo.get_beam_flavour(2)] - if initialState == [11,-11]: + + initialState = [self.procinfo.get_beam_flavour(1), self.procinfo.get_beam_flavour(2)] + if initialState[0]*initialState[1] == -121: self.add2GeneratorDatacard("read snippets/EECollider.in\n") beamA = self.pdg_to_herwig(initialState[0]) From 5dd71925681de789e72f207bd8274c893283b733 Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Fri, 29 May 2026 09:37:37 +0200 Subject: [PATCH 12/37] language --- python/Generators/HerwigProcDB.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/Generators/HerwigProcDB.py b/python/Generators/HerwigProcDB.py index 31272a31..8c591771 100644 --- a/python/Generators/HerwigProcDB.py +++ b/python/Generators/HerwigProcDB.py @@ -65,7 +65,7 @@ def write_WeakBosonPair(self, pdg): self.procdict['insert SubProcess:MatrixElements 0'] = MatrixElement self.procdict[f"set {MatrixElement}:MinimumFlavour"] = f"{pdg}" self.procdict[f"set {MatrixElement}:MaximumFlavour"] = f"{pdg}" - + def write_run_ZH(self): self.procdict['insert SubProcess:MatrixElements 0'] = "MEee2ZH" From 2f31af7f21ddb55871df3cc9ee7f61639b0edf26 Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Fri, 29 May 2026 15:59:09 +0200 Subject: [PATCH 13/37] wip Herwig --- python/Generators/Herwig.py | 14 ++++++++++---- test/ref-results/Herwig/ZH250/ZH250_ISR.in | 10 +++++++--- test/ref-results/Herwig/ZH350/ZH350_ISR.in | 10 +++++++--- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/python/Generators/Herwig.py b/python/Generators/Herwig.py index c1e8bb05..7955d1cf 100644 --- a/python/Generators/Herwig.py +++ b/python/Generators/Herwig.py @@ -27,7 +27,8 @@ def execute(self): def fill_datacard(self): # prepare the datacard self.fill_run() - #self.fill_decay() + # as a last step we need to add the writing out of the EventGenerator + self.add2GeneratorDatacard(f"saverun {self.GeneratorDatacardBase} EventGenerator\n") def fill_run(self): @@ -38,8 +39,8 @@ def fill_run(self): beamA = self.pdg_to_herwig(initialState[0]) beamB = self.pdg_to_herwig(initialState[1]) - self.addOption2GeneratorDatacard("set EventHandler:BeamA", f"/Herwig/Particles/{beamA}") - self.addOption2GeneratorDatacard("set EventHandler:BeamB", f"/Herwig/Particles/{beamB}") + self.addOption2GeneratorDatacard("set EventHandler:BeamA", f"/Herwig/Particles/{beamA}*GeV") + self.addOption2GeneratorDatacard("set EventHandler:BeamB", f"/Herwig/Particles/{beamB}*GeV") self.add2GeneratorDatacard("cd /Herwig/Generators\n") self.addOption2GeneratorDatacard("set EventGenerator:EventHandler:LuminosityFunction:Energy",self.procinfo.get("sqrts")) @@ -67,7 +68,7 @@ def fill_run(self): self.prepareParticles() # add the procDB settings - self.add2GeneratorDatacard("cd /Herwig/MatrixElements") + self.add2GeneratorDatacard("cd /Herwig/MatrixElements\n") for key in self.procDB.getDict(): value = self.procDB.getDict()[key] self.addOption2GeneratorDatacard(key,value) @@ -77,6 +78,11 @@ def fill_run(self): for key, value in self.gen_settings.items(): self.addOption2GeneratorDatacard(key, value) + # activate writing out the HepMC file + self.add2GeneratorDatacard("cd /Herwig/Analysis\n") + self.add2GeneratorDatacard("insert /Herwig/Generators/EventGenerator:AnalysisHandlers 0 HepMCFile\n") + + def fill_decay(self): #if self.procinfo.get("decay"): #self.add_decay() diff --git a/test/ref-results/Herwig/ZH250/ZH250_ISR.in b/test/ref-results/Herwig/ZH250/ZH250_ISR.in index 4ea07db3..6ed8c8d4 100644 --- a/test/ref-results/Herwig/ZH250/ZH250_ISR.in +++ b/test/ref-results/Herwig/ZH250/ZH250_ISR.in @@ -1,6 +1,6 @@ read snippets/EECollider.in -set EventHandler:BeamA /Herwig/Particles/e- -set EventHandler:BeamB /Herwig/Particles/e+ +set EventHandler:BeamA /Herwig/Particles/e-*GeV +set EventHandler:BeamB /Herwig/Particles/e+*GeV cd /Herwig/Generators set EventGenerator:EventHandler:LuminosityFunction:Energy 250.0 set EventGenerator:NumberOfEvents 10000 @@ -18,4 +18,8 @@ set /Herwig/Particles/h0:NominalMass 125 set /Herwig/Particles/h0:NominalWidth 0.00407 set /Herwig/Particles/W+:NominalWidth 2.085 set /Herwig/Particles/W+:NominalMass 80.379 -cd /Herwig/MatrixElementsinsert SubProcess:MatrixElements 0 MEee2ZH +cd /Herwig/MatrixElements +insert SubProcess:MatrixElements 0 MEee2ZH +cd /Herwig/Analysis +insert /Herwig/Generators/EventGenerator:AnalysisHandlers 0 HepMCFile +saverun ZH250_ISR EventGenerator diff --git a/test/ref-results/Herwig/ZH350/ZH350_ISR.in b/test/ref-results/Herwig/ZH350/ZH350_ISR.in index e981bc6b..3229af43 100644 --- a/test/ref-results/Herwig/ZH350/ZH350_ISR.in +++ b/test/ref-results/Herwig/ZH350/ZH350_ISR.in @@ -1,6 +1,6 @@ read snippets/EECollider.in -set EventHandler:BeamA /Herwig/Particles/e- -set EventHandler:BeamB /Herwig/Particles/e+ +set EventHandler:BeamA /Herwig/Particles/e-*GeV +set EventHandler:BeamB /Herwig/Particles/e+*GeV cd /Herwig/Generators set EventGenerator:EventHandler:LuminosityFunction:Energy 350 set EventGenerator:NumberOfEvents 10000 @@ -18,4 +18,8 @@ set /Herwig/Particles/h0:NominalMass 125 set /Herwig/Particles/h0:NominalWidth 0.00407 set /Herwig/Particles/W+:NominalWidth 2.085 set /Herwig/Particles/W+:NominalMass 80.379 -cd /Herwig/MatrixElementsinsert SubProcess:MatrixElements 0 MEee2ZH +cd /Herwig/MatrixElements +insert SubProcess:MatrixElements 0 MEee2ZH +cd /Herwig/Analysis +insert /Herwig/Generators/EventGenerator:AnalysisHandlers 0 HepMCFile +saverun ZH350_ISR EventGenerator From 5865ebe010e190d0a30984342c39f66f7407c510 Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Wed, 3 Jun 2026 14:27:18 +0200 Subject: [PATCH 14/37] correct units set --- python/Generators/Herwig.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/Generators/Herwig.py b/python/Generators/Herwig.py index 7955d1cf..dd2ea5b4 100644 --- a/python/Generators/Herwig.py +++ b/python/Generators/Herwig.py @@ -39,11 +39,11 @@ def fill_run(self): beamA = self.pdg_to_herwig(initialState[0]) beamB = self.pdg_to_herwig(initialState[1]) - self.addOption2GeneratorDatacard("set EventHandler:BeamA", f"/Herwig/Particles/{beamA}*GeV") - self.addOption2GeneratorDatacard("set EventHandler:BeamB", f"/Herwig/Particles/{beamB}*GeV") + self.addOption2GeneratorDatacard("set EventHandler:BeamA", f"/Herwig/Particles/{beamA}") + self.addOption2GeneratorDatacard("set EventHandler:BeamB", f"/Herwig/Particles/{beamB}") self.add2GeneratorDatacard("cd /Herwig/Generators\n") - self.addOption2GeneratorDatacard("set EventGenerator:EventHandler:LuminosityFunction:Energy",self.procinfo.get("sqrts")) + self.addOption2GeneratorDatacard("set EventGenerator:EventHandler:LuminosityFunction:Energy",str(self.procinfo.get("sqrts"))+"*GeV") self.addOption2GeneratorDatacard("set EventGenerator:NumberOfEvents", self.procinfo.settings.get_nevents()) From 2ea3dd328a70affc89ba750c3c246f92b597fa7f Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Wed, 3 Jun 2026 14:59:41 +0200 Subject: [PATCH 15/37] start selector work --- python/Generators/Herwig.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/python/Generators/Herwig.py b/python/Generators/Herwig.py index dd2ea5b4..3bdcc8e3 100644 --- a/python/Generators/Herwig.py +++ b/python/Generators/Herwig.py @@ -43,7 +43,7 @@ def fill_run(self): self.addOption2GeneratorDatacard("set EventHandler:BeamB", f"/Herwig/Particles/{beamB}") self.add2GeneratorDatacard("cd /Herwig/Generators\n") - self.addOption2GeneratorDatacard("set EventGenerator:EventHandler:LuminosityFunction:Energy",str(self.procinfo.get("sqrts"))+"*GeV") + self.addOption2GeneratorDatacard("set /Herwig/EventHandlers/Luminosity:Energy",str(self.procinfo.get("sqrts"))+"*GeV") self.addOption2GeneratorDatacard("set EventGenerator:NumberOfEvents", self.procinfo.settings.get_nevents()) @@ -112,10 +112,26 @@ def getParameterLabel(self, param): return parameterDict[param] def setSelectorsDict(self): - pass + # set up the correspondance between the yamlInput and the Sherpa convention + self.selectorsDict['eta'] = "Eta" + self.selectorsDict['pt'] = "KT" + self.selectorsDict['et'] = "KT" def add1ParticleSelector2Card(self, sel, name): - pass + # if the unit is deg or rad, we need to change it: + unit = "" + if sel.get_unit() == "rad" or sel.get_unit() == "deg": + unit = "eta" + Min, Max = sel.get_MinMax(unit) + f1 = sel.get_Flavours() + for f in f1: + particle = self.pdg_to_herwig(f) + sname = f"set /Herwig/Cuts/{particle}:Min{name}Cut {Min}" + if f"set /Herwig/Cuts/{f}:Min{name}Cut" not in self.getGeneratorDatacard(): + self.add2GeneratorDatacard(f"{sname}\n") + sname = f"set /Herwig/Cuts/{f}:Max{name}Cut {Max}" + if f"set /Herwig/Cuts/{f}:Max{name}Cut" not in self.getGeneratorDatacard(): + self.add2GeneratorDatacard(f"{sname}\n") def add2ParticleSelector2Card(self, sel, name): pass From 436ed2f4e1d004ff9eece3563e5de3950c523656 Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Thu, 4 Jun 2026 17:48:39 +0200 Subject: [PATCH 16/37] debugging other than parameters and setup --- python/Generators/Herwig.py | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/python/Generators/Herwig.py b/python/Generators/Herwig.py index 3bdcc8e3..7fdb60a3 100644 --- a/python/Generators/Herwig.py +++ b/python/Generators/Herwig.py @@ -39,27 +39,30 @@ def fill_run(self): beamA = self.pdg_to_herwig(initialState[0]) beamB = self.pdg_to_herwig(initialState[1]) - self.addOption2GeneratorDatacard("set EventHandler:BeamA", f"/Herwig/Particles/{beamA}") - self.addOption2GeneratorDatacard("set EventHandler:BeamB", f"/Herwig/Particles/{beamB}") - self.add2GeneratorDatacard("cd /Herwig/Generators\n") + self.addOption2GeneratorDatacard("set EventGenerator:EventHandler:BeamA", f"/Herwig/Particles/{beamA}") + self.addOption2GeneratorDatacard("set EventGenerator:EventHandler:BeamB", f"/Herwig/Particles/{beamB}") self.addOption2GeneratorDatacard("set /Herwig/EventHandlers/Luminosity:Energy",str(self.procinfo.get("sqrts"))+"*GeV") - self.addOption2GeneratorDatacard("set EventGenerator:NumberOfEvents", self.procinfo.settings.get_nevents()) - self.addOption2GeneratorDatacard("set EventGenerator/RandomNumberGenerator/Seed", self.procinfo.get_rndmSeed()) + self.addOption2GeneratorDatacard("set EventGenerator:RandomNumberGenerator:Seed", self.procinfo.get_rndmSeed()) # ISR if self.procinfo.get("isrmode"): - self.addOption2GeneratorDatacard("set /Herwig/Shower/SplittingGenerator:ISR", "Yes") + print("ISR NOT Implemented") + #self.addOption2GeneratorDatacard(f"set /Herwig/Particles/{beamA}:PDF", "/Herwig/Partons/DefaultPDF") + #self.addOption2GeneratorDatacard(f"set /Herwig/Particles/{beamB}:PDF", "/Herwig/Partons/DefaultPDF") else: - self.addOption2GeneratorDatacard("set /Herwig/Shower/SplittingGenerator:ISR", "No") + self.addOption2GeneratorDatacard(f"set /Herwig/Particles/{beamA}:PDF", "/Herwig/Partons/NoPDF") + self.addOption2GeneratorDatacard(f"set /Herwig/Particles/{beamB}:PDF", "/Herwig/Partons/NoPDF") # FSR if self.procinfo.get("fsrmode"): - self.addOption2GeneratorDatacard("set /Herwig/Shower/SplittingGenerator:FSR", "Yes") + print("FSR on to be implemented for Herwig") + #self.addOption2GeneratorDatacard("set /Herwig/Shower/SplittingGenerator:FSR", "Yes") else: - self.addOption2GeneratorDatacard("set /Herwig/Shower/SplittingGenerator:FSR", "No") + print("FSR on to be implemented for Herwig") + #self.addOption2GeneratorDatacard("set /Herwig/Shower/SplittingGenerator:FSR", "No") # now add the model parameters self.prepareParameters() @@ -79,8 +82,12 @@ def fill_run(self): self.addOption2GeneratorDatacard(key, value) # activate writing out the HepMC file - self.add2GeneratorDatacard("cd /Herwig/Analysis\n") - self.add2GeneratorDatacard("insert /Herwig/Generators/EventGenerator:AnalysisHandlers 0 HepMCFile\n") + self.add2GeneratorDatacard("cd /Herwig/Generators\n") + self.add2GeneratorDatacard("insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/HepMCFile\n") + self.add2GeneratorDatacard(f"set /Herwig/Analysis/HepMCFile:PrintEvent {self.procinfo.settings.get_nevents()}\n") + self.add2GeneratorDatacard("set /Herwig/Analysis/HepMCFile:Format GenEvent\n") + self.add2GeneratorDatacard("set /Herwig/Analysis/HepMCFile:Units GeV_mm\n") + self.add2GeneratorDatacard(f"set /Herwig/Analysis/HepMCFile:Filename {self.GeneratorDatacardBase}.hepmc\n") def fill_decay(self): @@ -90,11 +97,12 @@ def fill_decay(self): def fill_key4hepScript(self): key4hepRun = "" + key4hepRun += self.executable + " init\n" key4hepRun += self.executable + " read " + self.GeneratorDatacardName + "\n" key4hepRun += self.executable + " run " + self.GeneratorDatacardBase + ".run\n" if self.procinfo.get_output_format() == "edm4hep": - key4hepRun += f"convertHepMC2EDM4HEP -i hepmc3 -o edm4hep {self.GeneratorDatacardBase}.hepmc3 {self.GeneratorDatacardBase}.edm4hep\n" + key4hepRun += f"convertHepMC2EDM4HEP -i hepmc3 -o edm4hep {self.GeneratorDatacardBase}.hepmc {self.GeneratorDatacardBase}.edm4hep\n" self.add2Key4hepScript(key4hepRun) @@ -145,14 +153,14 @@ def getParticlePropertyUnit(self): def getParticleProperty(self, d): name = None if d == "mass": - name = "Mass" + name = "NominalMass" if d == "width": name = "Width" return name def getParticleOperator(self, pdg, prop): pdgString = self.pdg_to_herwig(abs(int(pdg))) - return f"set /Herwig/Particles/{pdgString}:Nominal{prop}" + return f"set /Herwig/Particles/{pdgString}:{prop}" def getModelName(self): # not needed for Herwig From e569628442f54777ae3d30beb0fa67034991de97 Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Thu, 4 Jun 2026 17:56:29 +0200 Subject: [PATCH 17/37] debug output except alphaEM and sin2theta --- python/Generators/Herwig.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/Generators/Herwig.py b/python/Generators/Herwig.py index 7fdb60a3..0793719d 100644 --- a/python/Generators/Herwig.py +++ b/python/Generators/Herwig.py @@ -112,7 +112,7 @@ def getGeneratorCommand(self,key,value): def getParameterLabel(self, param): parameterDict = { 'alphaEMM1' : 'EW/AlphaEM', 'sin2theta' : 'EW/Sin2ThetaW', - 'alphaSMZ' : 'LOAlphaS:input_alpha_s'} + 'alphaSMZ' : '/Herwig/DipoleShower/NLOAlphaS:input_alpha_s'} # alphas could be SigmaProcess:alphaSvalue if param not in parameterDict.keys(): print(f"Warning::Herwig: parameter {param} has no translation in Herwig Parameter Dictionary") From 42a6feb34283ba56e1a22f2e59e86857143bb917 Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Thu, 4 Jun 2026 21:34:02 +0200 Subject: [PATCH 18/37] full initialization (maybe) --- python/Generators/Herwig.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/python/Generators/Herwig.py b/python/Generators/Herwig.py index 0793719d..ad4dd2c1 100644 --- a/python/Generators/Herwig.py +++ b/python/Generators/Herwig.py @@ -12,7 +12,8 @@ def __init__(self, procinfo): def setModelParameters(self): # no alphaS and MZ, these are default - self.addModelParameter('alphaEMM1') + self.addModelParameter('GFermi') + self.addModelParameter('alphaEM') self.addModelParameter('sin2theta') self.addModelParticleProperty(pdg_code=23, property_type='mass') self.addModelParticleProperty(pdg_code=23, property_type='width') @@ -110,9 +111,10 @@ def getGeneratorCommand(self,key,value): return f"{key} {value}" def getParameterLabel(self, param): - parameterDict = { 'alphaEMM1' : 'EW/AlphaEM', - 'sin2theta' : 'EW/Sin2ThetaW', - 'alphaSMZ' : '/Herwig/DipoleShower/NLOAlphaS:input_alpha_s'} + parameterDict = { 'GFermi' : '/Herwig/Model:EW/FermiConstant', + 'alphaEM' : '/Herwig/Model:EW/AlphaEM', + 'sin2theta' : '/Herwig/Model:EW/Sin2ThetaW', + 'alphaSMZ' : '/Herwig/Model:QCD/AlphaS'} # alphas could be SigmaProcess:alphaSvalue if param not in parameterDict.keys(): print(f"Warning::Herwig: parameter {param} has no translation in Herwig Parameter Dictionary") From b09eefe606acdb9d09a87353a08f707ebc476097 Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Fri, 5 Jun 2026 09:54:16 +0200 Subject: [PATCH 19/37] #84 rudimentary workaround to get Herwig runnings --- python/Generators/Herwig.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python/Generators/Herwig.py b/python/Generators/Herwig.py index ad4dd2c1..f420de9d 100644 --- a/python/Generators/Herwig.py +++ b/python/Generators/Herwig.py @@ -98,6 +98,9 @@ def fill_decay(self): def fill_key4hepScript(self): key4hepRun = "" + key4hepRun += "export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/\n" + key4hepRun += "cp ${HERWIGPATH}/defaults/*.in .\n" + key4hepRun += "ln -sf ${HERWIGPATH}/snippets snippets\n" key4hepRun += self.executable + " init\n" key4hepRun += self.executable + " read " + self.GeneratorDatacardName + "\n" key4hepRun += self.executable + " run " + self.GeneratorDatacardBase + ".run\n" From d3ab1e8d20666775b15c4ae792073f77a7019d6c Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Fri, 5 Jun 2026 14:07:21 +0200 Subject: [PATCH 20/37] output for Herwig is hepmc2 --- python/Generators/Herwig.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/python/Generators/Herwig.py b/python/Generators/Herwig.py index f420de9d..740b57ba 100644 --- a/python/Generators/Herwig.py +++ b/python/Generators/Herwig.py @@ -88,7 +88,7 @@ def fill_run(self): self.add2GeneratorDatacard(f"set /Herwig/Analysis/HepMCFile:PrintEvent {self.procinfo.settings.get_nevents()}\n") self.add2GeneratorDatacard("set /Herwig/Analysis/HepMCFile:Format GenEvent\n") self.add2GeneratorDatacard("set /Herwig/Analysis/HepMCFile:Units GeV_mm\n") - self.add2GeneratorDatacard(f"set /Herwig/Analysis/HepMCFile:Filename {self.GeneratorDatacardBase}.hepmc\n") + self.add2GeneratorDatacard(f"set /Herwig/Analysis/HepMCFile:Filename {self.GeneratorDatacardBase}.hepmc2\n") def fill_decay(self): @@ -101,12 +101,13 @@ def fill_key4hepScript(self): key4hepRun += "export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/\n" key4hepRun += "cp ${HERWIGPATH}/defaults/*.in .\n" key4hepRun += "ln -sf ${HERWIGPATH}/snippets snippets\n" - key4hepRun += self.executable + " init\n" - key4hepRun += self.executable + " read " + self.GeneratorDatacardName + "\n" + #key4hepRun += self.executable + " --append-read ${HERWIGPATH} init\n" + key4hepRun += self.executable + " --append-read ${HERWIGPATH} init\n" + key4hepRun += self.executable + " read --append-read ${HERWIGPATH} " + self.GeneratorDatacardName + "\n" key4hepRun += self.executable + " run " + self.GeneratorDatacardBase + ".run\n" if self.procinfo.get_output_format() == "edm4hep": - key4hepRun += f"convertHepMC2EDM4HEP -i hepmc3 -o edm4hep {self.GeneratorDatacardBase}.hepmc {self.GeneratorDatacardBase}.edm4hep\n" + key4hepRun += f"convertHepMC2EDM4HEP -i hepmc2 -o edm4hep {self.GeneratorDatacardBase}.hepmc2 {self.GeneratorDatacardBase}.edm4hep\n" self.add2Key4hepScript(key4hepRun) From 8011c8b13165cb05a88201fe78cc1261f382c736 Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Fri, 5 Jun 2026 15:39:31 +0200 Subject: [PATCH 21/37] #84 first attempt at cuts --- python/Generators/Herwig.py | 83 +++++++++++++++++++++++++++++++++---- 1 file changed, 75 insertions(+), 8 deletions(-) diff --git a/python/Generators/Herwig.py b/python/Generators/Herwig.py index 740b57ba..fb27e3e6 100644 --- a/python/Generators/Herwig.py +++ b/python/Generators/Herwig.py @@ -128,8 +128,18 @@ def getParameterLabel(self, param): def setSelectorsDict(self): # set up the correspondance between the yamlInput and the Sherpa convention self.selectorsDict['eta'] = "Eta" - self.selectorsDict['pt'] = "KT" - self.selectorsDict['et'] = "KT" + self.selectorsDict['pt'] = "pt" + self.selectorsDict['et'] = "pt" + #self.selectorsDict['rapidity'] = "Rapidity" + #self.selectorsDict['theta'] = "Eta" + + self.selectorsDict['mass'] = "Mass" + #self.selectorsDict['angle'] = "Angle" + self.selectorsDict['deltaeta'] = "DeltaR" + self.selectorsDict['deltarapidity'] = "DeltaY" + #self.selectorsDict['deltaphi'] = "DeltaPhi" + #self.selectorsDict['deltar'] = "DeltaR" + def add1ParticleSelector2Card(self, sel, name): # if the unit is deg or rad, we need to change it: @@ -139,16 +149,58 @@ def add1ParticleSelector2Card(self, sel, name): Min, Max = sel.get_MinMax(unit) f1 = sel.get_Flavours() for f in f1: - particle = self.pdg_to_herwig(f) - sname = f"set /Herwig/Cuts/{particle}:Min{name}Cut {Min}" - if f"set /Herwig/Cuts/{f}:Min{name}Cut" not in self.getGeneratorDatacard(): + particle = self.pdg_to_herwig4cuts(f) + sname = f"insert Cuts:OneCuts 0 {particle}Cut" + if sname not in self.getGeneratorDatacard(): + self.add2GeneratorDatacard(f"{sname}\n") + sname = f"set /Herwig/Cuts/{particle}Cut:{name}Min {Min}" + if f"set /Herwig/Cuts/{particle}Cut:{name}Min" not in self.getGeneratorDatacard(): self.add2GeneratorDatacard(f"{sname}\n") - sname = f"set /Herwig/Cuts/{f}:Max{name}Cut {Max}" - if f"set /Herwig/Cuts/{f}:Max{name}Cut" not in self.getGeneratorDatacard(): + sname = f"set /Herwig/Cuts/{particle}Cut:{name}Max {Max}" + if f"set /Herwig/Cuts/{particle}Cut:{name}Cut" not in self.getGeneratorDatacard(): self.add2GeneratorDatacard(f"{sname}\n") def add2ParticleSelector2Card(self, sel, name): - pass + Min, Max = sel.get_MinMax() + flavs = sel.get_Flavours() + if len(flavs) == 2: + f1 = flavs[0] + f2 = flavs[1] + if ( + str(f1) not in self.procinfo.get_finalstate_pdgString() + or str(f2) not in self.procinfo.get_finalstate_pdgString() + ): + return + particle = self.pdg_to_herwig4cuts(f1) + sname = f"insert Cuts:MultiCuts 0 /Herwig/Cuts/{particle}{name}Cut" + if sname not in self.getGeneratorDatacard(): + self.add2GeneratorDatacard(f"{sname}\n") + sname = f"set /Herwig/Cuts/{particle}{name}Cut:{name}Min {Min}" + if f"set /Herwig/Cuts/{particle}{name}Cut:{name}Min" not in self.getGeneratorDatacard(): + self.add2GeneratorDatacard(f"{sname}\n") + sname = f"set /Herwig/Cuts/{particle}{name}Cut:{name}Max {Max}" + if f"set /Herwig/Cuts/{particle}{name}Cut:{name}Max" not in self.getGeneratorDatacard(): + self.add2GeneratorDatacard(f"{sname}\n") + else: + for fl in flavs: + f1 = fl[0] + f2 = fl[1] + if ( + str(f1) not in self.procinfo.get_finalstate_pdgString() + or str(f2) not in self.procinfo.get_finalstate_pdgString() + ): + continue + particle = self.pdg_to_herwig4cuts(f1) + sname = f"insert Cuts:MultiCuts 0 /Herwig/Cuts/{particle}{name}Cut" + if sname not in self.getGeneratorDatacard(): + self.add2GeneratorDatacard(f"{sname}\n") + sname = f"set /Herwig/Cuts/{particle}{name}Cut:{name}Min {Min}" + if f"set /Herwig/Cuts/{particle}{name}Cut:{name}Min" not in self.getGeneratorDatacard(): + self.add2GeneratorDatacard(f"{sname}\n") + sname = f"set /Herwig/Cuts/{particle}{name}Cut:{name}Max {Max}" + if f"set /Herwig/Cuts/{particle}{name}Cut:{name}Max" not in self.getGeneratorDatacard(): + self.add2GeneratorDatacard(f"{sname}\n") + def getParameterOperator(self, name): return f"set {name}" @@ -210,3 +262,18 @@ def pdg_to_herwig(self, pdg, signed=True): return f"{particle}-" else: return f"Cant find Herwig id for pdg {pdg}" + + def pdg_to_herwig4cuts(self, pdg, signed=True): + apdg = abs(pdg) + if type(pdg) is int: + particle_mapping = {5: "BottomQuark", 6: "TopQuark", + 11: "ChargedLepton", 13: "ChargedLepton", 15: "ChargedLepton", + 12: "Lepton", 14: "Lepton", 16: "Lepton", + 22: "Photon", 23: "ZBoson", 24: "WBoson", + 25: "HiggsBoson"} + particle = particle_mapping.get(apdg,"ERROR") + if particle != "ERROR": + return particle + else: + return f"Cant find Herwig cuts id for pdg {pdg}" + From 86692af2714ec20beea46bfe935c80f37b694ea2 Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Fri, 5 Jun 2026 15:45:46 +0200 Subject: [PATCH 22/37] #84 clang --- python/Generators/Herwig.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/python/Generators/Herwig.py b/python/Generators/Herwig.py index fb27e3e6..cddc7ce7 100644 --- a/python/Generators/Herwig.py +++ b/python/Generators/Herwig.py @@ -263,7 +263,7 @@ def pdg_to_herwig(self, pdg, signed=True): else: return f"Cant find Herwig id for pdg {pdg}" - def pdg_to_herwig4cuts(self, pdg, signed=True): + def pdg_to_herwig4cuts(self, pdg): apdg = abs(pdg) if type(pdg) is int: particle_mapping = {5: "BottomQuark", 6: "TopQuark", @@ -276,4 +276,3 @@ def pdg_to_herwig4cuts(self, pdg, signed=True): return particle else: return f"Cant find Herwig cuts id for pdg {pdg}" - From 9ae89a12b71a6330e4a5454f0a28aa4b6c63f485 Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Mon, 8 Jun 2026 11:55:09 +0200 Subject: [PATCH 23/37] simplify Herwig --- python/Generators/Herwig.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/python/Generators/Herwig.py b/python/Generators/Herwig.py index cddc7ce7..014c86be 100644 --- a/python/Generators/Herwig.py +++ b/python/Generators/Herwig.py @@ -99,11 +99,8 @@ def fill_decay(self): def fill_key4hepScript(self): key4hepRun = "" key4hepRun += "export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/\n" - key4hepRun += "cp ${HERWIGPATH}/defaults/*.in .\n" - key4hepRun += "ln -sf ${HERWIGPATH}/snippets snippets\n" - #key4hepRun += self.executable + " --append-read ${HERWIGPATH} init\n" - key4hepRun += self.executable + " --append-read ${HERWIGPATH} init\n" - key4hepRun += self.executable + " read --append-read ${HERWIGPATH} " + self.GeneratorDatacardName + "\n" + key4hepRun += self.executable + " --append-read ${HERWIGPATH}/defaults init\n" + key4hepRun += self.executable + " --append-read ${HERWIGPATH} read " + self.GeneratorDatacardName + "\n" key4hepRun += self.executable + " run " + self.GeneratorDatacardBase + ".run\n" if self.procinfo.get_output_format() == "edm4hep": From d52a9efd454cfda6c22545de3ed21eb7d27e20d0 Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Mon, 8 Jun 2026 15:41:05 +0200 Subject: [PATCH 24/37] #84 references for Herwig --- examples/FermionProduction.yaml | 1 + .../ref-results/Herwig/Muon350/Muon350_ISR.in | 29 ++++++++++++++++ .../Herwig/Muon350/Run_Muon350_ISR.sh | 12 +++++++ test/ref-results/Herwig/Muon91.2/Muon91.2.in | 31 +++++++++++++++++ .../Herwig/Muon91.2/Run_Muon91.2.sh | 12 +++++++ .../Herwig/MuonNeutrino350/MuonNeutrino350.in | 31 +++++++++++++++++ .../MuonNeutrino350/Run_MuonNeutrino350.sh | 12 +++++++ .../MuonNeutrino91.2/MuonNeutrino91.2_ISR.in | 29 ++++++++++++++++ .../Run_MuonNeutrino91.2_ISR.sh | 12 +++++++ test/ref-results/Herwig/Tau350/Run_Tau350.sh | 12 +++++++ test/ref-results/Herwig/Tau350/Tau350.in | 31 +++++++++++++++++ .../Herwig/Tau91.2/Run_Tau91.2_ISR.sh | 12 +++++++ .../ref-results/Herwig/Tau91.2/Tau91.2_ISR.in | 29 ++++++++++++++++ .../ref-results/Herwig/ZH250/Run_ZH250_ISR.sh | 6 ++-- test/ref-results/Herwig/ZH250/ZH250_ISR.in | 33 ++++++++++--------- .../ref-results/Herwig/ZH350/Run_ZH350_ISR.sh | 6 ++-- test/ref-results/Herwig/ZH350/ZH350_ISR.in | 33 ++++++++++--------- 17 files changed, 297 insertions(+), 34 deletions(-) create mode 100644 test/ref-results/Herwig/Muon350/Muon350_ISR.in create mode 100755 test/ref-results/Herwig/Muon350/Run_Muon350_ISR.sh create mode 100644 test/ref-results/Herwig/Muon91.2/Muon91.2.in create mode 100755 test/ref-results/Herwig/Muon91.2/Run_Muon91.2.sh create mode 100644 test/ref-results/Herwig/MuonNeutrino350/MuonNeutrino350.in create mode 100755 test/ref-results/Herwig/MuonNeutrino350/Run_MuonNeutrino350.sh create mode 100644 test/ref-results/Herwig/MuonNeutrino91.2/MuonNeutrino91.2_ISR.in create mode 100755 test/ref-results/Herwig/MuonNeutrino91.2/Run_MuonNeutrino91.2_ISR.sh create mode 100755 test/ref-results/Herwig/Tau350/Run_Tau350.sh create mode 100644 test/ref-results/Herwig/Tau350/Tau350.in create mode 100755 test/ref-results/Herwig/Tau91.2/Run_Tau91.2_ISR.sh create mode 100644 test/ref-results/Herwig/Tau91.2/Tau91.2_ISR.in diff --git a/examples/FermionProduction.yaml b/examples/FermionProduction.yaml index c285ea01..a376c1be 100644 --- a/examples/FermionProduction.yaml +++ b/examples/FermionProduction.yaml @@ -4,6 +4,7 @@ Generators: - Madgraph - KKMC - Pythia + - Herwig OutputFormat: edm4hep OutDir: Run-Cards diff --git a/test/ref-results/Herwig/Muon350/Muon350_ISR.in b/test/ref-results/Herwig/Muon350/Muon350_ISR.in new file mode 100644 index 00000000..bb9c1dbc --- /dev/null +++ b/test/ref-results/Herwig/Muon350/Muon350_ISR.in @@ -0,0 +1,29 @@ +read snippets/EECollider.in +cd /Herwig/Generators +set EventGenerator:EventHandler:BeamA /Herwig/Particles/e- +set EventGenerator:EventHandler:BeamB /Herwig/Particles/e+ +set /Herwig/EventHandlers/Luminosity:Energy 350*GeV +set EventGenerator:NumberOfEvents 10000 +set EventGenerator:RandomNumberGenerator:Seed 4714 +set /Herwig/Model:QCD/AlphaS 0.1184 +set /Herwig/Model:EW/FermiConstant 1.16637e-05 +set /Herwig/Model:EW/AlphaEM 0.007297352566354976 +set /Herwig/Model:EW/Sin2ThetaW 0.23155 +set /Herwig/Particles/Z0:NominalMass 91.1876 +set /Herwig/Particles/Z0:Width 2.4952 +set /Herwig/Particles/t:NominalMass 172 +set /Herwig/Particles/t:Width 1.50833649 +set /Herwig/Particles/h0:NominalMass 125 +set /Herwig/Particles/h0:Width 0.00407 +set /Herwig/Particles/W+:Width 2.085 +cd /Herwig/MatrixElements +insert SubProcess:MatrixElements 0 MEee2gZ2ll +set MEee2gZ2ll:MinimumFlavour 13 +set MEee2gZ2ll:MaximumFlavour 13 +cd /Herwig/Generators +insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/HepMCFile +set /Herwig/Analysis/HepMCFile:PrintEvent 10000 +set /Herwig/Analysis/HepMCFile:Format GenEvent +set /Herwig/Analysis/HepMCFile:Units GeV_mm +set /Herwig/Analysis/HepMCFile:Filename Muon350_ISR.hepmc2 +saverun Muon350_ISR EventGenerator diff --git a/test/ref-results/Herwig/Muon350/Run_Muon350_ISR.sh b/test/ref-results/Herwig/Muon350/Run_Muon350_ISR.sh new file mode 100755 index 00000000..bbce0def --- /dev/null +++ b/test/ref-results/Herwig/Muon350/Run_Muon350_ISR.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +if [ -z "${KEY4HEP_STACK}" ]; then + source /cvmfs/sw.hsf.org/key4hep/setup.sh +fi + +export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/ +Herwig --append-read ${HERWIGPATH}/defaults init +Herwig --append-read ${HERWIGPATH} read Muon350_ISR.in +Herwig run Muon350_ISR.run +convertHepMC2EDM4HEP -i hepmc2 -o edm4hep Muon350_ISR.hepmc2 Muon350_ISR.edm4hep + +key4HEPAnalysis -i Muon350_ISR.edm4hep -o Muon350_ISR.root -p 13,-13 diff --git a/test/ref-results/Herwig/Muon91.2/Muon91.2.in b/test/ref-results/Herwig/Muon91.2/Muon91.2.in new file mode 100644 index 00000000..300180e0 --- /dev/null +++ b/test/ref-results/Herwig/Muon91.2/Muon91.2.in @@ -0,0 +1,31 @@ +read snippets/EECollider.in +cd /Herwig/Generators +set EventGenerator:EventHandler:BeamA /Herwig/Particles/e- +set EventGenerator:EventHandler:BeamB /Herwig/Particles/e+ +set /Herwig/EventHandlers/Luminosity:Energy 91.2*GeV +set EventGenerator:NumberOfEvents 10000 +set EventGenerator:RandomNumberGenerator:Seed 4711 +set /Herwig/Particles/e-:PDF /Herwig/Partons/NoPDF +set /Herwig/Particles/e+:PDF /Herwig/Partons/NoPDF +set /Herwig/Model:QCD/AlphaS 0.1184 +set /Herwig/Model:EW/FermiConstant 1.16637e-05 +set /Herwig/Model:EW/AlphaEM 0.007297352566354976 +set /Herwig/Model:EW/Sin2ThetaW 0.23155 +set /Herwig/Particles/Z0:NominalMass 91.1876 +set /Herwig/Particles/Z0:Width 2.4952 +set /Herwig/Particles/t:NominalMass 172 +set /Herwig/Particles/t:Width 1.50833649 +set /Herwig/Particles/h0:NominalMass 125 +set /Herwig/Particles/h0:Width 0.00407 +set /Herwig/Particles/W+:Width 2.085 +cd /Herwig/MatrixElements +insert SubProcess:MatrixElements 0 MEee2gZ2ll +set MEee2gZ2ll:MinimumFlavour 13 +set MEee2gZ2ll:MaximumFlavour 13 +cd /Herwig/Generators +insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/HepMCFile +set /Herwig/Analysis/HepMCFile:PrintEvent 10000 +set /Herwig/Analysis/HepMCFile:Format GenEvent +set /Herwig/Analysis/HepMCFile:Units GeV_mm +set /Herwig/Analysis/HepMCFile:Filename Muon91.2.hepmc2 +saverun Muon91.2 EventGenerator diff --git a/test/ref-results/Herwig/Muon91.2/Run_Muon91.2.sh b/test/ref-results/Herwig/Muon91.2/Run_Muon91.2.sh new file mode 100755 index 00000000..ddbbfd74 --- /dev/null +++ b/test/ref-results/Herwig/Muon91.2/Run_Muon91.2.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +if [ -z "${KEY4HEP_STACK}" ]; then + source /cvmfs/sw.hsf.org/key4hep/setup.sh +fi + +export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/ +Herwig --append-read ${HERWIGPATH}/defaults init +Herwig --append-read ${HERWIGPATH} read Muon91.2.in +Herwig run Muon91.2.run +convertHepMC2EDM4HEP -i hepmc2 -o edm4hep Muon91.2.hepmc2 Muon91.2.edm4hep + +key4HEPAnalysis -i Muon91.2.edm4hep -o Muon91.2.root -p 13,-13 diff --git a/test/ref-results/Herwig/MuonNeutrino350/MuonNeutrino350.in b/test/ref-results/Herwig/MuonNeutrino350/MuonNeutrino350.in new file mode 100644 index 00000000..0c311b32 --- /dev/null +++ b/test/ref-results/Herwig/MuonNeutrino350/MuonNeutrino350.in @@ -0,0 +1,31 @@ +read snippets/EECollider.in +cd /Herwig/Generators +set EventGenerator:EventHandler:BeamA /Herwig/Particles/e- +set EventGenerator:EventHandler:BeamB /Herwig/Particles/e+ +set /Herwig/EventHandlers/Luminosity:Energy 350*GeV +set EventGenerator:NumberOfEvents 10000 +set EventGenerator:RandomNumberGenerator:Seed 4715 +set /Herwig/Particles/e-:PDF /Herwig/Partons/NoPDF +set /Herwig/Particles/e+:PDF /Herwig/Partons/NoPDF +set /Herwig/Model:QCD/AlphaS 0.1184 +set /Herwig/Model:EW/FermiConstant 1.16637e-05 +set /Herwig/Model:EW/AlphaEM 0.007297352566354976 +set /Herwig/Model:EW/Sin2ThetaW 0.23155 +set /Herwig/Particles/Z0:NominalMass 91.1876 +set /Herwig/Particles/Z0:Width 2.4952 +set /Herwig/Particles/t:NominalMass 172 +set /Herwig/Particles/t:Width 1.50833649 +set /Herwig/Particles/h0:NominalMass 125 +set /Herwig/Particles/h0:Width 0.00407 +set /Herwig/Particles/W+:Width 2.085 +cd /Herwig/MatrixElements +insert SubProcess:MatrixElements 0 MEee2gZ2ll +set MEee2gZ2ll:MinimumFlavour 14 +set MEee2gZ2ll:MaximumFlavour 14 +cd /Herwig/Generators +insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/HepMCFile +set /Herwig/Analysis/HepMCFile:PrintEvent 10000 +set /Herwig/Analysis/HepMCFile:Format GenEvent +set /Herwig/Analysis/HepMCFile:Units GeV_mm +set /Herwig/Analysis/HepMCFile:Filename MuonNeutrino350.hepmc2 +saverun MuonNeutrino350 EventGenerator diff --git a/test/ref-results/Herwig/MuonNeutrino350/Run_MuonNeutrino350.sh b/test/ref-results/Herwig/MuonNeutrino350/Run_MuonNeutrino350.sh new file mode 100755 index 00000000..ca22f5d0 --- /dev/null +++ b/test/ref-results/Herwig/MuonNeutrino350/Run_MuonNeutrino350.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +if [ -z "${KEY4HEP_STACK}" ]; then + source /cvmfs/sw.hsf.org/key4hep/setup.sh +fi + +export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/ +Herwig --append-read ${HERWIGPATH}/defaults init +Herwig --append-read ${HERWIGPATH} read MuonNeutrino350.in +Herwig run MuonNeutrino350.run +convertHepMC2EDM4HEP -i hepmc2 -o edm4hep MuonNeutrino350.hepmc2 MuonNeutrino350.edm4hep + +key4HEPAnalysis -i MuonNeutrino350.edm4hep -o MuonNeutrino350.root -p 14,-14 diff --git a/test/ref-results/Herwig/MuonNeutrino91.2/MuonNeutrino91.2_ISR.in b/test/ref-results/Herwig/MuonNeutrino91.2/MuonNeutrino91.2_ISR.in new file mode 100644 index 00000000..ed1fcafe --- /dev/null +++ b/test/ref-results/Herwig/MuonNeutrino91.2/MuonNeutrino91.2_ISR.in @@ -0,0 +1,29 @@ +read snippets/EECollider.in +cd /Herwig/Generators +set EventGenerator:EventHandler:BeamA /Herwig/Particles/e- +set EventGenerator:EventHandler:BeamB /Herwig/Particles/e+ +set /Herwig/EventHandlers/Luminosity:Energy 91.2*GeV +set EventGenerator:NumberOfEvents 10000 +set EventGenerator:RandomNumberGenerator:Seed 4712 +set /Herwig/Model:QCD/AlphaS 0.1184 +set /Herwig/Model:EW/FermiConstant 1.16637e-05 +set /Herwig/Model:EW/AlphaEM 0.007297352566354976 +set /Herwig/Model:EW/Sin2ThetaW 0.23155 +set /Herwig/Particles/Z0:NominalMass 91.1876 +set /Herwig/Particles/Z0:Width 2.4952 +set /Herwig/Particles/t:NominalMass 172 +set /Herwig/Particles/t:Width 1.50833649 +set /Herwig/Particles/h0:NominalMass 125 +set /Herwig/Particles/h0:Width 0.00407 +set /Herwig/Particles/W+:Width 2.085 +cd /Herwig/MatrixElements +insert SubProcess:MatrixElements 0 MEee2gZ2ll +set MEee2gZ2ll:MinimumFlavour 14 +set MEee2gZ2ll:MaximumFlavour 14 +cd /Herwig/Generators +insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/HepMCFile +set /Herwig/Analysis/HepMCFile:PrintEvent 10000 +set /Herwig/Analysis/HepMCFile:Format GenEvent +set /Herwig/Analysis/HepMCFile:Units GeV_mm +set /Herwig/Analysis/HepMCFile:Filename MuonNeutrino91.2_ISR.hepmc2 +saverun MuonNeutrino91.2_ISR EventGenerator diff --git a/test/ref-results/Herwig/MuonNeutrino91.2/Run_MuonNeutrino91.2_ISR.sh b/test/ref-results/Herwig/MuonNeutrino91.2/Run_MuonNeutrino91.2_ISR.sh new file mode 100755 index 00000000..1561595c --- /dev/null +++ b/test/ref-results/Herwig/MuonNeutrino91.2/Run_MuonNeutrino91.2_ISR.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +if [ -z "${KEY4HEP_STACK}" ]; then + source /cvmfs/sw.hsf.org/key4hep/setup.sh +fi + +export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/ +Herwig --append-read ${HERWIGPATH}/defaults init +Herwig --append-read ${HERWIGPATH} read MuonNeutrino91.2_ISR.in +Herwig run MuonNeutrino91.2_ISR.run +convertHepMC2EDM4HEP -i hepmc2 -o edm4hep MuonNeutrino91.2_ISR.hepmc2 MuonNeutrino91.2_ISR.edm4hep + +key4HEPAnalysis -i MuonNeutrino91.2_ISR.edm4hep -o MuonNeutrino91.2_ISR.root -p 14,-14 diff --git a/test/ref-results/Herwig/Tau350/Run_Tau350.sh b/test/ref-results/Herwig/Tau350/Run_Tau350.sh new file mode 100755 index 00000000..ce30ef0e --- /dev/null +++ b/test/ref-results/Herwig/Tau350/Run_Tau350.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +if [ -z "${KEY4HEP_STACK}" ]; then + source /cvmfs/sw.hsf.org/key4hep/setup.sh +fi + +export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/ +Herwig --append-read ${HERWIGPATH}/defaults init +Herwig --append-read ${HERWIGPATH} read Tau350.in +Herwig run Tau350.run +convertHepMC2EDM4HEP -i hepmc2 -o edm4hep Tau350.hepmc2 Tau350.edm4hep + +key4HEPAnalysis -i Tau350.edm4hep -o Tau350.root -p 15,-15 diff --git a/test/ref-results/Herwig/Tau350/Tau350.in b/test/ref-results/Herwig/Tau350/Tau350.in new file mode 100644 index 00000000..721a9226 --- /dev/null +++ b/test/ref-results/Herwig/Tau350/Tau350.in @@ -0,0 +1,31 @@ +read snippets/EECollider.in +cd /Herwig/Generators +set EventGenerator:EventHandler:BeamA /Herwig/Particles/e- +set EventGenerator:EventHandler:BeamB /Herwig/Particles/e+ +set /Herwig/EventHandlers/Luminosity:Energy 350*GeV +set EventGenerator:NumberOfEvents 10000 +set EventGenerator:RandomNumberGenerator:Seed 4716 +set /Herwig/Particles/e-:PDF /Herwig/Partons/NoPDF +set /Herwig/Particles/e+:PDF /Herwig/Partons/NoPDF +set /Herwig/Model:QCD/AlphaS 0.1184 +set /Herwig/Model:EW/FermiConstant 1.16637e-05 +set /Herwig/Model:EW/AlphaEM 0.007297352566354976 +set /Herwig/Model:EW/Sin2ThetaW 0.23155 +set /Herwig/Particles/Z0:NominalMass 91.1876 +set /Herwig/Particles/Z0:Width 2.4952 +set /Herwig/Particles/t:NominalMass 172 +set /Herwig/Particles/t:Width 1.50833649 +set /Herwig/Particles/h0:NominalMass 125 +set /Herwig/Particles/h0:Width 0.00407 +set /Herwig/Particles/W+:Width 2.085 +cd /Herwig/MatrixElements +insert SubProcess:MatrixElements 0 MEee2gZ2ll +set MEee2gZ2ll:MinimumFlavour 15 +set MEee2gZ2ll:MaximumFlavour 15 +cd /Herwig/Generators +insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/HepMCFile +set /Herwig/Analysis/HepMCFile:PrintEvent 10000 +set /Herwig/Analysis/HepMCFile:Format GenEvent +set /Herwig/Analysis/HepMCFile:Units GeV_mm +set /Herwig/Analysis/HepMCFile:Filename Tau350.hepmc2 +saverun Tau350 EventGenerator diff --git a/test/ref-results/Herwig/Tau91.2/Run_Tau91.2_ISR.sh b/test/ref-results/Herwig/Tau91.2/Run_Tau91.2_ISR.sh new file mode 100755 index 00000000..726fe166 --- /dev/null +++ b/test/ref-results/Herwig/Tau91.2/Run_Tau91.2_ISR.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +if [ -z "${KEY4HEP_STACK}" ]; then + source /cvmfs/sw.hsf.org/key4hep/setup.sh +fi + +export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/ +Herwig --append-read ${HERWIGPATH}/defaults init +Herwig --append-read ${HERWIGPATH} read Tau91.2_ISR.in +Herwig run Tau91.2_ISR.run +convertHepMC2EDM4HEP -i hepmc2 -o edm4hep Tau91.2_ISR.hepmc2 Tau91.2_ISR.edm4hep + +key4HEPAnalysis -i Tau91.2_ISR.edm4hep -o Tau91.2_ISR.root -p 15,-15 diff --git a/test/ref-results/Herwig/Tau91.2/Tau91.2_ISR.in b/test/ref-results/Herwig/Tau91.2/Tau91.2_ISR.in new file mode 100644 index 00000000..7d3c87d5 --- /dev/null +++ b/test/ref-results/Herwig/Tau91.2/Tau91.2_ISR.in @@ -0,0 +1,29 @@ +read snippets/EECollider.in +cd /Herwig/Generators +set EventGenerator:EventHandler:BeamA /Herwig/Particles/e- +set EventGenerator:EventHandler:BeamB /Herwig/Particles/e+ +set /Herwig/EventHandlers/Luminosity:Energy 91.2*GeV +set EventGenerator:NumberOfEvents 10000 +set EventGenerator:RandomNumberGenerator:Seed 4713 +set /Herwig/Model:QCD/AlphaS 0.1184 +set /Herwig/Model:EW/FermiConstant 1.16637e-05 +set /Herwig/Model:EW/AlphaEM 0.007297352566354976 +set /Herwig/Model:EW/Sin2ThetaW 0.23155 +set /Herwig/Particles/Z0:NominalMass 91.1876 +set /Herwig/Particles/Z0:Width 2.4952 +set /Herwig/Particles/t:NominalMass 172 +set /Herwig/Particles/t:Width 1.50833649 +set /Herwig/Particles/h0:NominalMass 125 +set /Herwig/Particles/h0:Width 0.00407 +set /Herwig/Particles/W+:Width 2.085 +cd /Herwig/MatrixElements +insert SubProcess:MatrixElements 0 MEee2gZ2ll +set MEee2gZ2ll:MinimumFlavour 15 +set MEee2gZ2ll:MaximumFlavour 15 +cd /Herwig/Generators +insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/HepMCFile +set /Herwig/Analysis/HepMCFile:PrintEvent 10000 +set /Herwig/Analysis/HepMCFile:Format GenEvent +set /Herwig/Analysis/HepMCFile:Units GeV_mm +set /Herwig/Analysis/HepMCFile:Filename Tau91.2_ISR.hepmc2 +saverun Tau91.2_ISR EventGenerator diff --git a/test/ref-results/Herwig/ZH250/Run_ZH250_ISR.sh b/test/ref-results/Herwig/ZH250/Run_ZH250_ISR.sh index c970b879..05a54ec8 100755 --- a/test/ref-results/Herwig/ZH250/Run_ZH250_ISR.sh +++ b/test/ref-results/Herwig/ZH250/Run_ZH250_ISR.sh @@ -3,8 +3,10 @@ if [ -z "${KEY4HEP_STACK}" ]; then source /cvmfs/sw.hsf.org/key4hep/setup.sh fi -Herwig read ZH250_ISR.in +export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/ +Herwig --append-read ${HERWIGPATH}/defaults init +Herwig --append-read ${HERWIGPATH} read ZH250_ISR.in Herwig run ZH250_ISR.run -convertHepMC2EDM4HEP -i hepmc3 -o edm4hep ZH250_ISR.hepmc3 ZH250_ISR.edm4hep +convertHepMC2EDM4HEP -i hepmc2 -o edm4hep ZH250_ISR.hepmc2 ZH250_ISR.edm4hep key4HEPAnalysis -i ZH250_ISR.edm4hep -o ZH250_ISR.root -p 23,25 diff --git a/test/ref-results/Herwig/ZH250/ZH250_ISR.in b/test/ref-results/Herwig/ZH250/ZH250_ISR.in index 6ed8c8d4..359d60f4 100644 --- a/test/ref-results/Herwig/ZH250/ZH250_ISR.in +++ b/test/ref-results/Herwig/ZH250/ZH250_ISR.in @@ -1,25 +1,28 @@ read snippets/EECollider.in -set EventHandler:BeamA /Herwig/Particles/e-*GeV -set EventHandler:BeamB /Herwig/Particles/e+*GeV cd /Herwig/Generators -set EventGenerator:EventHandler:LuminosityFunction:Energy 250.0 +set EventGenerator:EventHandler:BeamA /Herwig/Particles/e- +set EventGenerator:EventHandler:BeamB /Herwig/Particles/e+ +set /Herwig/EventHandlers/Luminosity:Energy 250.0*GeV set EventGenerator:NumberOfEvents 10000 -set EventGenerator/RandomNumberGenerator/Seed 4711 -set /Herwig/Shower/SplittingGenerator:ISR Yes -set /Herwig/Shower/SplittingGenerator:FSR No -set LOAlphaS:input_alpha_s 0.1184 -set EW/AlphaEM 137.035999139 -set EW/Sin2ThetaW 0.23155 +set EventGenerator:RandomNumberGenerator:Seed 4711 +set /Herwig/Model:QCD/AlphaS 0.1184 +set /Herwig/Model:EW/FermiConstant 1.16637e-05 +set /Herwig/Model:EW/AlphaEM 0.007297352566354976 +set /Herwig/Model:EW/Sin2ThetaW 0.23155 set /Herwig/Particles/Z0:NominalMass 91.1876 -set /Herwig/Particles/Z0:NominalWidth 2.4952 +set /Herwig/Particles/Z0:Width 2.4952 set /Herwig/Particles/t:NominalMass 172 -set /Herwig/Particles/t:NominalWidth 1.50833649 +set /Herwig/Particles/t:Width 1.50833649 set /Herwig/Particles/h0:NominalMass 125 -set /Herwig/Particles/h0:NominalWidth 0.00407 -set /Herwig/Particles/W+:NominalWidth 2.085 +set /Herwig/Particles/h0:Width 0.00407 +set /Herwig/Particles/W+:Width 2.085 set /Herwig/Particles/W+:NominalMass 80.379 cd /Herwig/MatrixElements insert SubProcess:MatrixElements 0 MEee2ZH -cd /Herwig/Analysis -insert /Herwig/Generators/EventGenerator:AnalysisHandlers 0 HepMCFile +cd /Herwig/Generators +insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/HepMCFile +set /Herwig/Analysis/HepMCFile:PrintEvent 10000 +set /Herwig/Analysis/HepMCFile:Format GenEvent +set /Herwig/Analysis/HepMCFile:Units GeV_mm +set /Herwig/Analysis/HepMCFile:Filename ZH250_ISR.hepmc2 saverun ZH250_ISR EventGenerator diff --git a/test/ref-results/Herwig/ZH350/Run_ZH350_ISR.sh b/test/ref-results/Herwig/ZH350/Run_ZH350_ISR.sh index ef41cbec..fbd9535c 100755 --- a/test/ref-results/Herwig/ZH350/Run_ZH350_ISR.sh +++ b/test/ref-results/Herwig/ZH350/Run_ZH350_ISR.sh @@ -3,8 +3,10 @@ if [ -z "${KEY4HEP_STACK}" ]; then source /cvmfs/sw.hsf.org/key4hep/setup.sh fi -Herwig read ZH350_ISR.in +export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/ +Herwig --append-read ${HERWIGPATH}/defaults init +Herwig --append-read ${HERWIGPATH} read ZH350_ISR.in Herwig run ZH350_ISR.run -convertHepMC2EDM4HEP -i hepmc3 -o edm4hep ZH350_ISR.hepmc3 ZH350_ISR.edm4hep +convertHepMC2EDM4HEP -i hepmc2 -o edm4hep ZH350_ISR.hepmc2 ZH350_ISR.edm4hep key4HEPAnalysis -i ZH350_ISR.edm4hep -o ZH350_ISR.root -p 23,25 diff --git a/test/ref-results/Herwig/ZH350/ZH350_ISR.in b/test/ref-results/Herwig/ZH350/ZH350_ISR.in index 3229af43..f3a91d87 100644 --- a/test/ref-results/Herwig/ZH350/ZH350_ISR.in +++ b/test/ref-results/Herwig/ZH350/ZH350_ISR.in @@ -1,25 +1,28 @@ read snippets/EECollider.in -set EventHandler:BeamA /Herwig/Particles/e-*GeV -set EventHandler:BeamB /Herwig/Particles/e+*GeV cd /Herwig/Generators -set EventGenerator:EventHandler:LuminosityFunction:Energy 350 +set EventGenerator:EventHandler:BeamA /Herwig/Particles/e- +set EventGenerator:EventHandler:BeamB /Herwig/Particles/e+ +set /Herwig/EventHandlers/Luminosity:Energy 350*GeV set EventGenerator:NumberOfEvents 10000 -set EventGenerator/RandomNumberGenerator/Seed 42 -set /Herwig/Shower/SplittingGenerator:ISR Yes -set /Herwig/Shower/SplittingGenerator:FSR No -set LOAlphaS:input_alpha_s 0.1184 -set EW/AlphaEM 137.035999139 -set EW/Sin2ThetaW 0.23155 +set EventGenerator:RandomNumberGenerator:Seed 42 +set /Herwig/Model:QCD/AlphaS 0.1184 +set /Herwig/Model:EW/FermiConstant 1.16637e-05 +set /Herwig/Model:EW/AlphaEM 0.007297352566354976 +set /Herwig/Model:EW/Sin2ThetaW 0.23155 set /Herwig/Particles/Z0:NominalMass 91.1876 -set /Herwig/Particles/Z0:NominalWidth 2.4952 +set /Herwig/Particles/Z0:Width 2.4952 set /Herwig/Particles/t:NominalMass 172 -set /Herwig/Particles/t:NominalWidth 1.50833649 +set /Herwig/Particles/t:Width 1.50833649 set /Herwig/Particles/h0:NominalMass 125 -set /Herwig/Particles/h0:NominalWidth 0.00407 -set /Herwig/Particles/W+:NominalWidth 2.085 +set /Herwig/Particles/h0:Width 0.00407 +set /Herwig/Particles/W+:Width 2.085 set /Herwig/Particles/W+:NominalMass 80.379 cd /Herwig/MatrixElements insert SubProcess:MatrixElements 0 MEee2ZH -cd /Herwig/Analysis -insert /Herwig/Generators/EventGenerator:AnalysisHandlers 0 HepMCFile +cd /Herwig/Generators +insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/HepMCFile +set /Herwig/Analysis/HepMCFile:PrintEvent 10000 +set /Herwig/Analysis/HepMCFile:Format GenEvent +set /Herwig/Analysis/HepMCFile:Units GeV_mm +set /Herwig/Analysis/HepMCFile:Filename ZH350_ISR.hepmc2 saverun ZH350_ISR EventGenerator From aa64fb35f7ddca74065e5fa1ca328330b98aae02 Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Mon, 8 Jun 2026 16:04:49 +0200 Subject: [PATCH 25/37] #84 add Herwig to CI --- test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 175af1a9..1a11f54d 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -6,7 +6,7 @@ set(TEST_TIMEOUT 3500) set(EXECUTABLE "${PROJECT_SOURCE_DIR}/python/k4GeneratorsConfig.py") # the generators to be run -set(generatorList Babayaga KKMC Madgraph Pythia Sherpa Whizard ) +set(generatorList Babayaga Herwig KKMC Madgraph Pythia Sherpa Whizard ) # generate the run list for the dependencies foreach(generator ${generatorList}) From 2bf6037980e88d247ff162518d5fd423d5a9e26d Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Mon, 8 Jun 2026 17:40:43 +0200 Subject: [PATCH 26/37] #84 deactivate flavor selection for di-fermions --- python/Generators/HerwigProcDB.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/python/Generators/HerwigProcDB.py b/python/Generators/HerwigProcDB.py index 8c591771..b226a3c9 100644 --- a/python/Generators/HerwigProcDB.py +++ b/python/Generators/HerwigProcDB.py @@ -26,6 +26,8 @@ def execute(self): self.write_Difermion(4) elif tag == [[-11,11],[-5,5]]: self.write_Difermion(5) + elif tag == [[-11,11],[-6,6]]: + self.write_Difermion(6) elif tag == [[-11,11],[-12,12]]: self.write_Difermion(12) elif tag == [[-11,11],[-13,13]]: @@ -49,7 +51,7 @@ def execute(self): def write_Difermion(self, pdg): MatrixElement = None - if pdg < 6: + if pdg < 7: MatrixElement = "MEee2gZ2qq" elif pdg > 10 and pdg < 17: MatrixElement = "MEee2gZ2ll" @@ -57,8 +59,11 @@ def write_Difermion(self, pdg): # set the matrix element etc: if MatrixElement is not None: self.procdict['insert SubProcess:MatrixElements 0'] = MatrixElement - self.procdict[f"set {MatrixElement}:MinimumFlavour"] = f"{pdg}" - self.procdict[f"set {MatrixElement}:MaximumFlavour"] = f"{pdg}" + if pdg < 7: + self.procdict[f"set {MatrixElement}:MinimumFlavour"] = f"{pdg}" + self.procdict[f"set {MatrixElement}:MaximumFlavour"] = f"{pdg}" + else: + print("FermionPair selection for leptons not implemented") def write_WeakBosonPair(self, pdg): MatrixElement = "MEee2VV" From 7f91166f476b7555316971f7cb0909f7badd71e9 Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Mon, 8 Jun 2026 18:03:51 +0200 Subject: [PATCH 27/37] #84 Herwig situation unclear, remove temporarily from suite --- test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1a11f54d..175af1a9 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -6,7 +6,7 @@ set(TEST_TIMEOUT 3500) set(EXECUTABLE "${PROJECT_SOURCE_DIR}/python/k4GeneratorsConfig.py") # the generators to be run -set(generatorList Babayaga Herwig KKMC Madgraph Pythia Sherpa Whizard ) +set(generatorList Babayaga KKMC Madgraph Pythia Sherpa Whizard ) # generate the run list for the dependencies foreach(generator ${generatorList}) From 2c3f0081547f4c13a49503696006b79eabcc7642 Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Mon, 8 Jun 2026 18:08:32 +0200 Subject: [PATCH 28/37] #84 remove neutrinos temporarily and flavour selecion for lepton pairs --- python/Generators/HerwigProcDB.py | 6 ---- .../ref-results/Herwig/Muon350/Muon350_ISR.in | 2 -- test/ref-results/Herwig/Muon91.2/Muon91.2.in | 2 -- .../Herwig/MuonNeutrino350/MuonNeutrino350.in | 31 ------------------- .../MuonNeutrino350/Run_MuonNeutrino350.sh | 12 ------- .../MuonNeutrino91.2/MuonNeutrino91.2_ISR.in | 29 ----------------- .../Run_MuonNeutrino91.2_ISR.sh | 12 ------- test/ref-results/Herwig/Tau350/Tau350.in | 2 -- .../ref-results/Herwig/Tau91.2/Tau91.2_ISR.in | 2 -- 9 files changed, 98 deletions(-) delete mode 100644 test/ref-results/Herwig/MuonNeutrino350/MuonNeutrino350.in delete mode 100755 test/ref-results/Herwig/MuonNeutrino350/Run_MuonNeutrino350.sh delete mode 100644 test/ref-results/Herwig/MuonNeutrino91.2/MuonNeutrino91.2_ISR.in delete mode 100755 test/ref-results/Herwig/MuonNeutrino91.2/Run_MuonNeutrino91.2_ISR.sh diff --git a/python/Generators/HerwigProcDB.py b/python/Generators/HerwigProcDB.py index b226a3c9..c765aeb7 100644 --- a/python/Generators/HerwigProcDB.py +++ b/python/Generators/HerwigProcDB.py @@ -28,16 +28,10 @@ def execute(self): self.write_Difermion(5) elif tag == [[-11,11],[-6,6]]: self.write_Difermion(6) - elif tag == [[-11,11],[-12,12]]: - self.write_Difermion(12) elif tag == [[-11,11],[-13,13]]: self.write_Difermion(13) - elif tag == [[-11,11],[-14,14]]: - self.write_Difermion(14) elif tag == [[-11,11],[-15,15]]: self.write_Difermion(15) - elif tag == [[-11,11],[-16,16]]: - self.write_Difermion(16) elif tag == [[-11,11],[23,23]]: self.write_WeakBosonPair(23) elif tag == [[-11,11],[24,24]]: diff --git a/test/ref-results/Herwig/Muon350/Muon350_ISR.in b/test/ref-results/Herwig/Muon350/Muon350_ISR.in index bb9c1dbc..cc977e97 100644 --- a/test/ref-results/Herwig/Muon350/Muon350_ISR.in +++ b/test/ref-results/Herwig/Muon350/Muon350_ISR.in @@ -18,8 +18,6 @@ set /Herwig/Particles/h0:Width 0.00407 set /Herwig/Particles/W+:Width 2.085 cd /Herwig/MatrixElements insert SubProcess:MatrixElements 0 MEee2gZ2ll -set MEee2gZ2ll:MinimumFlavour 13 -set MEee2gZ2ll:MaximumFlavour 13 cd /Herwig/Generators insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/HepMCFile set /Herwig/Analysis/HepMCFile:PrintEvent 10000 diff --git a/test/ref-results/Herwig/Muon91.2/Muon91.2.in b/test/ref-results/Herwig/Muon91.2/Muon91.2.in index 300180e0..854c175a 100644 --- a/test/ref-results/Herwig/Muon91.2/Muon91.2.in +++ b/test/ref-results/Herwig/Muon91.2/Muon91.2.in @@ -20,8 +20,6 @@ set /Herwig/Particles/h0:Width 0.00407 set /Herwig/Particles/W+:Width 2.085 cd /Herwig/MatrixElements insert SubProcess:MatrixElements 0 MEee2gZ2ll -set MEee2gZ2ll:MinimumFlavour 13 -set MEee2gZ2ll:MaximumFlavour 13 cd /Herwig/Generators insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/HepMCFile set /Herwig/Analysis/HepMCFile:PrintEvent 10000 diff --git a/test/ref-results/Herwig/MuonNeutrino350/MuonNeutrino350.in b/test/ref-results/Herwig/MuonNeutrino350/MuonNeutrino350.in deleted file mode 100644 index 0c311b32..00000000 --- a/test/ref-results/Herwig/MuonNeutrino350/MuonNeutrino350.in +++ /dev/null @@ -1,31 +0,0 @@ -read snippets/EECollider.in -cd /Herwig/Generators -set EventGenerator:EventHandler:BeamA /Herwig/Particles/e- -set EventGenerator:EventHandler:BeamB /Herwig/Particles/e+ -set /Herwig/EventHandlers/Luminosity:Energy 350*GeV -set EventGenerator:NumberOfEvents 10000 -set EventGenerator:RandomNumberGenerator:Seed 4715 -set /Herwig/Particles/e-:PDF /Herwig/Partons/NoPDF -set /Herwig/Particles/e+:PDF /Herwig/Partons/NoPDF -set /Herwig/Model:QCD/AlphaS 0.1184 -set /Herwig/Model:EW/FermiConstant 1.16637e-05 -set /Herwig/Model:EW/AlphaEM 0.007297352566354976 -set /Herwig/Model:EW/Sin2ThetaW 0.23155 -set /Herwig/Particles/Z0:NominalMass 91.1876 -set /Herwig/Particles/Z0:Width 2.4952 -set /Herwig/Particles/t:NominalMass 172 -set /Herwig/Particles/t:Width 1.50833649 -set /Herwig/Particles/h0:NominalMass 125 -set /Herwig/Particles/h0:Width 0.00407 -set /Herwig/Particles/W+:Width 2.085 -cd /Herwig/MatrixElements -insert SubProcess:MatrixElements 0 MEee2gZ2ll -set MEee2gZ2ll:MinimumFlavour 14 -set MEee2gZ2ll:MaximumFlavour 14 -cd /Herwig/Generators -insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/HepMCFile -set /Herwig/Analysis/HepMCFile:PrintEvent 10000 -set /Herwig/Analysis/HepMCFile:Format GenEvent -set /Herwig/Analysis/HepMCFile:Units GeV_mm -set /Herwig/Analysis/HepMCFile:Filename MuonNeutrino350.hepmc2 -saverun MuonNeutrino350 EventGenerator diff --git a/test/ref-results/Herwig/MuonNeutrino350/Run_MuonNeutrino350.sh b/test/ref-results/Herwig/MuonNeutrino350/Run_MuonNeutrino350.sh deleted file mode 100755 index ca22f5d0..00000000 --- a/test/ref-results/Herwig/MuonNeutrino350/Run_MuonNeutrino350.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -if [ -z "${KEY4HEP_STACK}" ]; then - source /cvmfs/sw.hsf.org/key4hep/setup.sh -fi - -export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/ -Herwig --append-read ${HERWIGPATH}/defaults init -Herwig --append-read ${HERWIGPATH} read MuonNeutrino350.in -Herwig run MuonNeutrino350.run -convertHepMC2EDM4HEP -i hepmc2 -o edm4hep MuonNeutrino350.hepmc2 MuonNeutrino350.edm4hep - -key4HEPAnalysis -i MuonNeutrino350.edm4hep -o MuonNeutrino350.root -p 14,-14 diff --git a/test/ref-results/Herwig/MuonNeutrino91.2/MuonNeutrino91.2_ISR.in b/test/ref-results/Herwig/MuonNeutrino91.2/MuonNeutrino91.2_ISR.in deleted file mode 100644 index ed1fcafe..00000000 --- a/test/ref-results/Herwig/MuonNeutrino91.2/MuonNeutrino91.2_ISR.in +++ /dev/null @@ -1,29 +0,0 @@ -read snippets/EECollider.in -cd /Herwig/Generators -set EventGenerator:EventHandler:BeamA /Herwig/Particles/e- -set EventGenerator:EventHandler:BeamB /Herwig/Particles/e+ -set /Herwig/EventHandlers/Luminosity:Energy 91.2*GeV -set EventGenerator:NumberOfEvents 10000 -set EventGenerator:RandomNumberGenerator:Seed 4712 -set /Herwig/Model:QCD/AlphaS 0.1184 -set /Herwig/Model:EW/FermiConstant 1.16637e-05 -set /Herwig/Model:EW/AlphaEM 0.007297352566354976 -set /Herwig/Model:EW/Sin2ThetaW 0.23155 -set /Herwig/Particles/Z0:NominalMass 91.1876 -set /Herwig/Particles/Z0:Width 2.4952 -set /Herwig/Particles/t:NominalMass 172 -set /Herwig/Particles/t:Width 1.50833649 -set /Herwig/Particles/h0:NominalMass 125 -set /Herwig/Particles/h0:Width 0.00407 -set /Herwig/Particles/W+:Width 2.085 -cd /Herwig/MatrixElements -insert SubProcess:MatrixElements 0 MEee2gZ2ll -set MEee2gZ2ll:MinimumFlavour 14 -set MEee2gZ2ll:MaximumFlavour 14 -cd /Herwig/Generators -insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/HepMCFile -set /Herwig/Analysis/HepMCFile:PrintEvent 10000 -set /Herwig/Analysis/HepMCFile:Format GenEvent -set /Herwig/Analysis/HepMCFile:Units GeV_mm -set /Herwig/Analysis/HepMCFile:Filename MuonNeutrino91.2_ISR.hepmc2 -saverun MuonNeutrino91.2_ISR EventGenerator diff --git a/test/ref-results/Herwig/MuonNeutrino91.2/Run_MuonNeutrino91.2_ISR.sh b/test/ref-results/Herwig/MuonNeutrino91.2/Run_MuonNeutrino91.2_ISR.sh deleted file mode 100755 index 1561595c..00000000 --- a/test/ref-results/Herwig/MuonNeutrino91.2/Run_MuonNeutrino91.2_ISR.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -if [ -z "${KEY4HEP_STACK}" ]; then - source /cvmfs/sw.hsf.org/key4hep/setup.sh -fi - -export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/ -Herwig --append-read ${HERWIGPATH}/defaults init -Herwig --append-read ${HERWIGPATH} read MuonNeutrino91.2_ISR.in -Herwig run MuonNeutrino91.2_ISR.run -convertHepMC2EDM4HEP -i hepmc2 -o edm4hep MuonNeutrino91.2_ISR.hepmc2 MuonNeutrino91.2_ISR.edm4hep - -key4HEPAnalysis -i MuonNeutrino91.2_ISR.edm4hep -o MuonNeutrino91.2_ISR.root -p 14,-14 diff --git a/test/ref-results/Herwig/Tau350/Tau350.in b/test/ref-results/Herwig/Tau350/Tau350.in index 721a9226..60f4aaaf 100644 --- a/test/ref-results/Herwig/Tau350/Tau350.in +++ b/test/ref-results/Herwig/Tau350/Tau350.in @@ -20,8 +20,6 @@ set /Herwig/Particles/h0:Width 0.00407 set /Herwig/Particles/W+:Width 2.085 cd /Herwig/MatrixElements insert SubProcess:MatrixElements 0 MEee2gZ2ll -set MEee2gZ2ll:MinimumFlavour 15 -set MEee2gZ2ll:MaximumFlavour 15 cd /Herwig/Generators insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/HepMCFile set /Herwig/Analysis/HepMCFile:PrintEvent 10000 diff --git a/test/ref-results/Herwig/Tau91.2/Tau91.2_ISR.in b/test/ref-results/Herwig/Tau91.2/Tau91.2_ISR.in index 7d3c87d5..f7eadb8b 100644 --- a/test/ref-results/Herwig/Tau91.2/Tau91.2_ISR.in +++ b/test/ref-results/Herwig/Tau91.2/Tau91.2_ISR.in @@ -18,8 +18,6 @@ set /Herwig/Particles/h0:Width 0.00407 set /Herwig/Particles/W+:Width 2.085 cd /Herwig/MatrixElements insert SubProcess:MatrixElements 0 MEee2gZ2ll -set MEee2gZ2ll:MinimumFlavour 15 -set MEee2gZ2ll:MaximumFlavour 15 cd /Herwig/Generators insert EventGenerator:AnalysisHandlers 0 /Herwig/Analysis/HepMCFile set /Herwig/Analysis/HepMCFile:PrintEvent 10000 From 8a3cff95a56e1574ce1e263f8956376dd6453167 Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Mon, 8 Jun 2026 18:31:29 +0200 Subject: [PATCH 29/37] #84 separate ChargedLeptons and Neutrinos --- ...tion.yaml => ChargedLeptonProduction.yaml} | 8 --- examples/NeutrinoProduction.yaml | 58 +++++++++++++++++++ 2 files changed, 58 insertions(+), 8 deletions(-) rename examples/{FermionProduction.yaml => ChargedLeptonProduction.yaml} (87%) create mode 100644 examples/NeutrinoProduction.yaml diff --git a/examples/FermionProduction.yaml b/examples/ChargedLeptonProduction.yaml similarity index 87% rename from examples/FermionProduction.yaml rename to examples/ChargedLeptonProduction.yaml index a376c1be..b8935325 100644 --- a/examples/FermionProduction.yaml +++ b/examples/ChargedLeptonProduction.yaml @@ -19,10 +19,6 @@ Processes: Muon91.2: Final: [13, -13] - MuonNeutrino91.2: - Final: [14, -14] - ISRMode: 1 - Tau91.2: Final: [15, -15] ISRMode: 1 @@ -32,10 +28,6 @@ Processes: SqrtS: 350 ISRMode: 1 - MuonNeutrino350: - Final: [14, -14] - SqrtS: 350 - Tau350: Final: [15, -15] SqrtS: 350 diff --git a/examples/NeutrinoProduction.yaml b/examples/NeutrinoProduction.yaml new file mode 100644 index 00000000..0cf0a81d --- /dev/null +++ b/examples/NeutrinoProduction.yaml @@ -0,0 +1,58 @@ +Generators: + - Sherpa + - Whizard + - Madgraph + - KKMC + - Pythia + +OutputFormat: edm4hep +OutDir: Run-Cards +Events: 10000 +EventMode: unweighted + +SqrtS: 91.2 +Model: SM +ISRMode: 0 + +Processes: + + MuonNeutrino91.2: + Final: [14, -14] + ISRMode: 1 + + MuonNeutrino350: + Final: [14, -14] + SqrtS: 350 + +Selectors: + Process: + Tau350: + PT: + Max: 175 + Min: 20 + Flavour: [-15,15] + Muon350: + PT: + Max: 175 + Min: 20 + Flavour: [-13,13] + Muon91.2: + PT: + Max: 45.6 + Min: 20 + Flavour: [-13,13] + + +Sherpa: + Run: + EW_SCHEME: 3 + + +ParticleData: + 23: + mass: 91.1876 + width: 2.4952 + +Analysis: + Tools: [key4HEP] + From fabe4dcb926fb825cfd8e0678f93f099e4e6bc39 Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Mon, 8 Jun 2026 18:55:28 +0200 Subject: [PATCH 30/37] update ref after chargedlepton and Neutrino split --- test/ref-results/Herwig/Muon350/Muon350_ISR.in | 2 +- test/ref-results/Herwig/Tau350/Tau350.in | 2 +- test/ref-results/Herwig/Tau91.2/Tau91.2_ISR.in | 2 +- test/ref-results/KKMC/Muon350/Muon350_ISR.dat | 2 +- test/ref-results/KKMC/MuonNeutrino350/MuonNeutrino350.dat | 2 +- test/ref-results/KKMC/MuonNeutrino91.2/MuonNeutrino91.2_ISR.dat | 2 +- test/ref-results/KKMC/Tau350/Tau350.dat | 2 +- test/ref-results/KKMC/Tau91.2/Tau91.2_ISR.dat | 2 +- test/ref-results/Madgraph/Muon350/Muon350_ISR.dat | 2 +- test/ref-results/Madgraph/MuonNeutrino350/MuonNeutrino350.dat | 2 +- .../Madgraph/MuonNeutrino91.2/MuonNeutrino91.2_ISR.dat | 2 +- test/ref-results/Madgraph/Tau350/Tau350.dat | 2 +- test/ref-results/Madgraph/Tau91.2/Tau91.2_ISR.dat | 2 +- test/ref-results/Pythia/Muon350/Muon350_ISR.dat | 2 +- test/ref-results/Pythia/MuonNeutrino350/MuonNeutrino350.dat | 2 +- .../Pythia/MuonNeutrino91.2/MuonNeutrino91.2_ISR.dat | 2 +- test/ref-results/Pythia/Tau350/Tau350.dat | 2 +- test/ref-results/Pythia/Tau91.2/Tau91.2_ISR.dat | 2 +- test/ref-results/Sherpa/Muon350/Muon350_ISR.dat | 2 +- test/ref-results/Sherpa/MuonNeutrino350/MuonNeutrino350.dat | 2 +- .../Sherpa/MuonNeutrino91.2/MuonNeutrino91.2_ISR.dat | 2 +- test/ref-results/Sherpa/Tau350/Tau350.dat | 2 +- test/ref-results/Sherpa/Tau91.2/Tau91.2_ISR.dat | 2 +- test/ref-results/Whizard/Muon350/Muon350_ISR.sin | 2 +- test/ref-results/Whizard/MuonNeutrino350/MuonNeutrino350.sin | 2 +- .../Whizard/MuonNeutrino91.2/MuonNeutrino91.2_ISR.sin | 2 +- test/ref-results/Whizard/Tau350/Tau350.sin | 2 +- test/ref-results/Whizard/Tau91.2/Tau91.2_ISR.sin | 2 +- 28 files changed, 28 insertions(+), 28 deletions(-) diff --git a/test/ref-results/Herwig/Muon350/Muon350_ISR.in b/test/ref-results/Herwig/Muon350/Muon350_ISR.in index cc977e97..a55ad461 100644 --- a/test/ref-results/Herwig/Muon350/Muon350_ISR.in +++ b/test/ref-results/Herwig/Muon350/Muon350_ISR.in @@ -4,7 +4,7 @@ set EventGenerator:EventHandler:BeamA /Herwig/Particles/e- set EventGenerator:EventHandler:BeamB /Herwig/Particles/e+ set /Herwig/EventHandlers/Luminosity:Energy 350*GeV set EventGenerator:NumberOfEvents 10000 -set EventGenerator:RandomNumberGenerator:Seed 4714 +set EventGenerator:RandomNumberGenerator:Seed 4713 set /Herwig/Model:QCD/AlphaS 0.1184 set /Herwig/Model:EW/FermiConstant 1.16637e-05 set /Herwig/Model:EW/AlphaEM 0.007297352566354976 diff --git a/test/ref-results/Herwig/Tau350/Tau350.in b/test/ref-results/Herwig/Tau350/Tau350.in index 60f4aaaf..10bf72c8 100644 --- a/test/ref-results/Herwig/Tau350/Tau350.in +++ b/test/ref-results/Herwig/Tau350/Tau350.in @@ -4,7 +4,7 @@ set EventGenerator:EventHandler:BeamA /Herwig/Particles/e- set EventGenerator:EventHandler:BeamB /Herwig/Particles/e+ set /Herwig/EventHandlers/Luminosity:Energy 350*GeV set EventGenerator:NumberOfEvents 10000 -set EventGenerator:RandomNumberGenerator:Seed 4716 +set EventGenerator:RandomNumberGenerator:Seed 4714 set /Herwig/Particles/e-:PDF /Herwig/Partons/NoPDF set /Herwig/Particles/e+:PDF /Herwig/Partons/NoPDF set /Herwig/Model:QCD/AlphaS 0.1184 diff --git a/test/ref-results/Herwig/Tau91.2/Tau91.2_ISR.in b/test/ref-results/Herwig/Tau91.2/Tau91.2_ISR.in index f7eadb8b..9ba1bb6a 100644 --- a/test/ref-results/Herwig/Tau91.2/Tau91.2_ISR.in +++ b/test/ref-results/Herwig/Tau91.2/Tau91.2_ISR.in @@ -4,7 +4,7 @@ set EventGenerator:EventHandler:BeamA /Herwig/Particles/e- set EventGenerator:EventHandler:BeamB /Herwig/Particles/e+ set /Herwig/EventHandlers/Luminosity:Energy 91.2*GeV set EventGenerator:NumberOfEvents 10000 -set EventGenerator:RandomNumberGenerator:Seed 4713 +set EventGenerator:RandomNumberGenerator:Seed 4712 set /Herwig/Model:QCD/AlphaS 0.1184 set /Herwig/Model:EW/FermiConstant 1.16637e-05 set /Herwig/Model:EW/AlphaEM 0.007297352566354976 diff --git a/test/ref-results/KKMC/Muon350/Muon350_ISR.dat b/test/ref-results/KKMC/Muon350/Muon350_ISR.dat index 1ccf10af..58516fe8 100644 --- a/test/ref-results/KKMC/Muon350/Muon350_ISR.dat +++ b/test/ref-results/KKMC/Muon350/Muon350_ISR.dat @@ -405,7 +405,7 @@ BeginX ******************************************************************************** ******************************************************************************** * FOAM GENERATION PARAMETERS - 3020 4714 Ranmar initial random number seed (KKMC and FOAM) + 3020 4713 Ranmar initial random number seed (KKMC and FOAM) *indx_____data______ccccccccc0cccc__________General_____ccc0ccccccccc0ccccccccc0 3021 20000 FOAM Maximum number of cells (5000 default, 2000 for map) 3022 0 FOAM Vopt: set to 0 to save vertices, 1 to NOT save them diff --git a/test/ref-results/KKMC/MuonNeutrino350/MuonNeutrino350.dat b/test/ref-results/KKMC/MuonNeutrino350/MuonNeutrino350.dat index 3567886c..95257a3f 100644 --- a/test/ref-results/KKMC/MuonNeutrino350/MuonNeutrino350.dat +++ b/test/ref-results/KKMC/MuonNeutrino350/MuonNeutrino350.dat @@ -405,7 +405,7 @@ BeginX ******************************************************************************** ******************************************************************************** * FOAM GENERATION PARAMETERS - 3020 4715 Ranmar initial random number seed (KKMC and FOAM) + 3020 4712 Ranmar initial random number seed (KKMC and FOAM) *indx_____data______ccccccccc0cccc__________General_____ccc0ccccccccc0ccccccccc0 3021 20000 FOAM Maximum number of cells (5000 default, 2000 for map) 3022 0 FOAM Vopt: set to 0 to save vertices, 1 to NOT save them diff --git a/test/ref-results/KKMC/MuonNeutrino91.2/MuonNeutrino91.2_ISR.dat b/test/ref-results/KKMC/MuonNeutrino91.2/MuonNeutrino91.2_ISR.dat index 346bc7b8..c87d0142 100644 --- a/test/ref-results/KKMC/MuonNeutrino91.2/MuonNeutrino91.2_ISR.dat +++ b/test/ref-results/KKMC/MuonNeutrino91.2/MuonNeutrino91.2_ISR.dat @@ -405,7 +405,7 @@ BeginX ******************************************************************************** ******************************************************************************** * FOAM GENERATION PARAMETERS - 3020 4712 Ranmar initial random number seed (KKMC and FOAM) + 3020 4711 Ranmar initial random number seed (KKMC and FOAM) *indx_____data______ccccccccc0cccc__________General_____ccc0ccccccccc0ccccccccc0 3021 20000 FOAM Maximum number of cells (5000 default, 2000 for map) 3022 0 FOAM Vopt: set to 0 to save vertices, 1 to NOT save them diff --git a/test/ref-results/KKMC/Tau350/Tau350.dat b/test/ref-results/KKMC/Tau350/Tau350.dat index 56bfa456..b73a6add 100644 --- a/test/ref-results/KKMC/Tau350/Tau350.dat +++ b/test/ref-results/KKMC/Tau350/Tau350.dat @@ -405,7 +405,7 @@ BeginX ******************************************************************************** ******************************************************************************** * FOAM GENERATION PARAMETERS - 3020 4716 Ranmar initial random number seed (KKMC and FOAM) + 3020 4714 Ranmar initial random number seed (KKMC and FOAM) *indx_____data______ccccccccc0cccc__________General_____ccc0ccccccccc0ccccccccc0 3021 20000 FOAM Maximum number of cells (5000 default, 2000 for map) 3022 0 FOAM Vopt: set to 0 to save vertices, 1 to NOT save them diff --git a/test/ref-results/KKMC/Tau91.2/Tau91.2_ISR.dat b/test/ref-results/KKMC/Tau91.2/Tau91.2_ISR.dat index 3df0cbab..cb953b7c 100644 --- a/test/ref-results/KKMC/Tau91.2/Tau91.2_ISR.dat +++ b/test/ref-results/KKMC/Tau91.2/Tau91.2_ISR.dat @@ -405,7 +405,7 @@ BeginX ******************************************************************************** ******************************************************************************** * FOAM GENERATION PARAMETERS - 3020 4713 Ranmar initial random number seed (KKMC and FOAM) + 3020 4712 Ranmar initial random number seed (KKMC and FOAM) *indx_____data______ccccccccc0cccc__________General_____ccc0ccccccccc0ccccccccc0 3021 20000 FOAM Maximum number of cells (5000 default, 2000 for map) 3022 0 FOAM Vopt: set to 0 to save vertices, 1 to NOT save them diff --git a/test/ref-results/Madgraph/Muon350/Muon350_ISR.dat b/test/ref-results/Madgraph/Muon350/Muon350_ISR.dat index e1242f30..8557a4a3 100644 --- a/test/ref-results/Madgraph/Muon350/Muon350_ISR.dat +++ b/test/ref-results/Madgraph/Muon350/Muon350_ISR.dat @@ -22,7 +22,7 @@ import model loop_qcd_qed_sm_Gmu-full generate e- e+ > mu- mu+ output Output launch -set iseed 4714 +set iseed 4713 set EBEAM 175.0 set aS 0.1184 set GF 1.16637e-05 diff --git a/test/ref-results/Madgraph/MuonNeutrino350/MuonNeutrino350.dat b/test/ref-results/Madgraph/MuonNeutrino350/MuonNeutrino350.dat index fece1040..46638c4f 100644 --- a/test/ref-results/Madgraph/MuonNeutrino350/MuonNeutrino350.dat +++ b/test/ref-results/Madgraph/MuonNeutrino350/MuonNeutrino350.dat @@ -22,7 +22,7 @@ import model loop_qcd_qed_sm_Gmu-full generate e- e+ > vm vm~ output Output launch -set iseed 4715 +set iseed 4712 set EBEAM 175.0 set aS 0.1184 set GF 1.16637e-05 diff --git a/test/ref-results/Madgraph/MuonNeutrino91.2/MuonNeutrino91.2_ISR.dat b/test/ref-results/Madgraph/MuonNeutrino91.2/MuonNeutrino91.2_ISR.dat index de084ce3..87b1e18d 100644 --- a/test/ref-results/Madgraph/MuonNeutrino91.2/MuonNeutrino91.2_ISR.dat +++ b/test/ref-results/Madgraph/MuonNeutrino91.2/MuonNeutrino91.2_ISR.dat @@ -22,7 +22,7 @@ import model loop_qcd_qed_sm_Gmu-full generate e- e+ > vm vm~ output Output launch -set iseed 4712 +set iseed 4711 set EBEAM 45.6 set aS 0.1184 set GF 1.16637e-05 diff --git a/test/ref-results/Madgraph/Tau350/Tau350.dat b/test/ref-results/Madgraph/Tau350/Tau350.dat index a333b19e..f7a1cf4e 100644 --- a/test/ref-results/Madgraph/Tau350/Tau350.dat +++ b/test/ref-results/Madgraph/Tau350/Tau350.dat @@ -22,7 +22,7 @@ import model loop_qcd_qed_sm_Gmu-full generate e- e+ > ta- ta+ output Output launch -set iseed 4716 +set iseed 4714 set EBEAM 175.0 set aS 0.1184 set GF 1.16637e-05 diff --git a/test/ref-results/Madgraph/Tau91.2/Tau91.2_ISR.dat b/test/ref-results/Madgraph/Tau91.2/Tau91.2_ISR.dat index c07bcfd5..86212099 100644 --- a/test/ref-results/Madgraph/Tau91.2/Tau91.2_ISR.dat +++ b/test/ref-results/Madgraph/Tau91.2/Tau91.2_ISR.dat @@ -22,7 +22,7 @@ import model loop_qcd_qed_sm_Gmu-full generate e- e+ > ta- ta+ output Output launch -set iseed 4713 +set iseed 4712 set EBEAM 45.6 set aS 0.1184 set GF 1.16637e-05 diff --git a/test/ref-results/Pythia/Muon350/Muon350_ISR.dat b/test/ref-results/Pythia/Muon350/Muon350_ISR.dat index d125ca61..527301ed 100644 --- a/test/ref-results/Pythia/Muon350/Muon350_ISR.dat +++ b/test/ref-results/Pythia/Muon350/Muon350_ISR.dat @@ -1,5 +1,5 @@ Random:setSeed = on -Random:seed = 4714 +Random:seed = 4713 Beams:eCM = 350 Beams:idA = 11 Beams:idB = -11 diff --git a/test/ref-results/Pythia/MuonNeutrino350/MuonNeutrino350.dat b/test/ref-results/Pythia/MuonNeutrino350/MuonNeutrino350.dat index 5bfeb311..9df9bac0 100644 --- a/test/ref-results/Pythia/MuonNeutrino350/MuonNeutrino350.dat +++ b/test/ref-results/Pythia/MuonNeutrino350/MuonNeutrino350.dat @@ -1,5 +1,5 @@ Random:setSeed = on -Random:seed = 4715 +Random:seed = 4712 Beams:eCM = 350 Beams:idA = 11 Beams:idB = -11 diff --git a/test/ref-results/Pythia/MuonNeutrino91.2/MuonNeutrino91.2_ISR.dat b/test/ref-results/Pythia/MuonNeutrino91.2/MuonNeutrino91.2_ISR.dat index 2412b7e1..c4708caf 100644 --- a/test/ref-results/Pythia/MuonNeutrino91.2/MuonNeutrino91.2_ISR.dat +++ b/test/ref-results/Pythia/MuonNeutrino91.2/MuonNeutrino91.2_ISR.dat @@ -1,5 +1,5 @@ Random:setSeed = on -Random:seed = 4712 +Random:seed = 4711 Beams:eCM = 91.2 Beams:idA = 11 Beams:idB = -11 diff --git a/test/ref-results/Pythia/Tau350/Tau350.dat b/test/ref-results/Pythia/Tau350/Tau350.dat index fc2b25aa..a7bfefa3 100644 --- a/test/ref-results/Pythia/Tau350/Tau350.dat +++ b/test/ref-results/Pythia/Tau350/Tau350.dat @@ -1,5 +1,5 @@ Random:setSeed = on -Random:seed = 4716 +Random:seed = 4714 Beams:eCM = 350 Beams:idA = 11 Beams:idB = -11 diff --git a/test/ref-results/Pythia/Tau91.2/Tau91.2_ISR.dat b/test/ref-results/Pythia/Tau91.2/Tau91.2_ISR.dat index c47791e2..c1814742 100644 --- a/test/ref-results/Pythia/Tau91.2/Tau91.2_ISR.dat +++ b/test/ref-results/Pythia/Tau91.2/Tau91.2_ISR.dat @@ -1,5 +1,5 @@ Random:setSeed = on -Random:seed = 4713 +Random:seed = 4712 Beams:eCM = 91.2 Beams:idA = 11 Beams:idB = -11 diff --git a/test/ref-results/Sherpa/Muon350/Muon350_ISR.dat b/test/ref-results/Sherpa/Muon350/Muon350_ISR.dat index 7448b063..b7813a8e 100644 --- a/test/ref-results/Sherpa/Muon350/Muon350_ISR.dat +++ b/test/ref-results/Sherpa/Muon350/Muon350_ISR.dat @@ -1,4 +1,4 @@ -RANDOM_SEED: 4714 +RANDOM_SEED: 4713 BEAMS: [11, -11] BEAM_ENERGIES: 175.0 MODEL: SM diff --git a/test/ref-results/Sherpa/MuonNeutrino350/MuonNeutrino350.dat b/test/ref-results/Sherpa/MuonNeutrino350/MuonNeutrino350.dat index c89cdcd5..4fbb13c0 100644 --- a/test/ref-results/Sherpa/MuonNeutrino350/MuonNeutrino350.dat +++ b/test/ref-results/Sherpa/MuonNeutrino350/MuonNeutrino350.dat @@ -1,4 +1,4 @@ -RANDOM_SEED: 4715 +RANDOM_SEED: 4712 BEAMS: [11, -11] BEAM_ENERGIES: 175.0 MODEL: SM diff --git a/test/ref-results/Sherpa/MuonNeutrino91.2/MuonNeutrino91.2_ISR.dat b/test/ref-results/Sherpa/MuonNeutrino91.2/MuonNeutrino91.2_ISR.dat index dbbc67cf..1d0fbfdf 100644 --- a/test/ref-results/Sherpa/MuonNeutrino91.2/MuonNeutrino91.2_ISR.dat +++ b/test/ref-results/Sherpa/MuonNeutrino91.2/MuonNeutrino91.2_ISR.dat @@ -1,4 +1,4 @@ -RANDOM_SEED: 4712 +RANDOM_SEED: 4711 BEAMS: [11, -11] BEAM_ENERGIES: 45.6 MODEL: SM diff --git a/test/ref-results/Sherpa/Tau350/Tau350.dat b/test/ref-results/Sherpa/Tau350/Tau350.dat index 8222d310..506c5e43 100644 --- a/test/ref-results/Sherpa/Tau350/Tau350.dat +++ b/test/ref-results/Sherpa/Tau350/Tau350.dat @@ -1,4 +1,4 @@ -RANDOM_SEED: 4716 +RANDOM_SEED: 4714 BEAMS: [11, -11] BEAM_ENERGIES: 175.0 MODEL: SM diff --git a/test/ref-results/Sherpa/Tau91.2/Tau91.2_ISR.dat b/test/ref-results/Sherpa/Tau91.2/Tau91.2_ISR.dat index c01c5050..4324b01f 100644 --- a/test/ref-results/Sherpa/Tau91.2/Tau91.2_ISR.dat +++ b/test/ref-results/Sherpa/Tau91.2/Tau91.2_ISR.dat @@ -1,4 +1,4 @@ -RANDOM_SEED: 4713 +RANDOM_SEED: 4712 BEAMS: [11, -11] BEAM_ENERGIES: 45.6 MODEL: SM diff --git a/test/ref-results/Whizard/Muon350/Muon350_ISR.sin b/test/ref-results/Whizard/Muon350/Muon350_ISR.sin index c13364b1..0436f0ed 100644 --- a/test/ref-results/Whizard/Muon350/Muon350_ISR.sin +++ b/test/ref-results/Whizard/Muon350/Muon350_ISR.sin @@ -1,5 +1,5 @@ model = SM_CKM -seed = 4714 +seed = 4713 ?isr_handler = true beams = e1, E1 => isr,isr isr_mass = 0.000511 diff --git a/test/ref-results/Whizard/MuonNeutrino350/MuonNeutrino350.sin b/test/ref-results/Whizard/MuonNeutrino350/MuonNeutrino350.sin index f16ab6a2..ac645360 100644 --- a/test/ref-results/Whizard/MuonNeutrino350/MuonNeutrino350.sin +++ b/test/ref-results/Whizard/MuonNeutrino350/MuonNeutrino350.sin @@ -1,5 +1,5 @@ model = SM_CKM -seed = 4715 +seed = 4712 ?isr_handler = false process proc = e1, E1 => n2, N2 n_events = 10000 diff --git a/test/ref-results/Whizard/MuonNeutrino91.2/MuonNeutrino91.2_ISR.sin b/test/ref-results/Whizard/MuonNeutrino91.2/MuonNeutrino91.2_ISR.sin index ed77ff25..4c33b858 100644 --- a/test/ref-results/Whizard/MuonNeutrino91.2/MuonNeutrino91.2_ISR.sin +++ b/test/ref-results/Whizard/MuonNeutrino91.2/MuonNeutrino91.2_ISR.sin @@ -1,5 +1,5 @@ model = SM_CKM -seed = 4712 +seed = 4711 ?isr_handler = true beams = e1, E1 => isr,isr isr_mass = 0.000511 diff --git a/test/ref-results/Whizard/Tau350/Tau350.sin b/test/ref-results/Whizard/Tau350/Tau350.sin index 93a9dc32..c3ff1cb7 100644 --- a/test/ref-results/Whizard/Tau350/Tau350.sin +++ b/test/ref-results/Whizard/Tau350/Tau350.sin @@ -1,5 +1,5 @@ model = SM_CKM -seed = 4716 +seed = 4714 ?isr_handler = false process proc = e1, E1 => e3, E3 n_events = 10000 diff --git a/test/ref-results/Whizard/Tau91.2/Tau91.2_ISR.sin b/test/ref-results/Whizard/Tau91.2/Tau91.2_ISR.sin index ad840134..c24d00c4 100644 --- a/test/ref-results/Whizard/Tau91.2/Tau91.2_ISR.sin +++ b/test/ref-results/Whizard/Tau91.2/Tau91.2_ISR.sin @@ -1,5 +1,5 @@ model = SM_CKM -seed = 4713 +seed = 4712 ?isr_handler = true beams = e1, E1 => isr,isr isr_mass = 0.000511 From fa3d3391e172c1dc02017aeb2dd17e970ff736a1 Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Fri, 12 Jun 2026 11:34:37 +0200 Subject: [PATCH 31/37] make Madgraph run with more than 1M events --- python/Generators/Madgraph.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/python/Generators/Madgraph.py b/python/Generators/Madgraph.py index 48cfca68..dcf64107 100644 --- a/python/Generators/Madgraph.py +++ b/python/Generators/Madgraph.py @@ -1,3 +1,4 @@ +import math from .GeneratorBase import GeneratorBase from Particles import Particle as part @@ -13,6 +14,9 @@ def __init__(self, procinfo): self.add_header() self.executable = "mg5_aMC" + self.NbEventsSurplusFactor = 1.002 + self.maxEventsPerRun = 1000000 + self.setOptionalFileNameAndExtension(f"pythia{self.GeneratorDatacardBase}","cmnd") self.fill_PythiaCMND() @@ -63,7 +67,15 @@ def fill_datacard(self): self.addOption2GeneratorDatacard("generate", self.proc) # self.addOption2GeneratorDatacard("output", self.outdir+f"/{self.procinfo.get('procname')}") self.addOption2GeneratorDatacard("output", "Output") - self.addOption2GeneratorDatacard("launch", None) + # multi run for > 1M events + nevents = int(self.procinfo.settings.get_nevents()*self.NbEventsSurplusFactor) + if nevents <= self.maxEventsPerRun: + self.addOption2GeneratorDatacard("launch", None) + else: + nruns = math.ceil(nevents/self.maxEventsPerRun) + self.addOption2GeneratorDatacard("launch", "-i") + self.addOption2GeneratorDatacard("multi_run",nruns) + # the run_card parameters self.addOption2GeneratorDatacard("set iseed", self.procinfo.get_rndmSeed()) self.addOption2GeneratorDatacard("set EBEAM", self.procinfo.get("sqrts") / 2.0) @@ -73,7 +85,7 @@ def fill_datacard(self): # now add the particles checking for overlap with ProcDB self.prepareParticles() # temporary fix: increase LHE event size - self.addOption2GeneratorDatacard("set nevents", int(self.procinfo.settings.get_nevents()*1.002)) + self.addOption2GeneratorDatacard("set nevents", nevents) if self.procinfo.get("isrmode"): if self.procinfo.get("beamstrahlung") is not None: # if self.gen_settings is None: From 1469927ad1352232521d576840dac7dc921886a4 Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Tue, 23 Jun 2026 11:57:17 +0200 Subject: [PATCH 32/37] simplify Herwig with Juans recipe --- python/Generators/Herwig.py | 5 +++-- test/ref-results/Herwig/Muon350/Run_Muon350_ISR.sh | 3 +-- test/ref-results/Herwig/Muon91.2/Run_Muon91.2.sh | 3 +-- test/ref-results/Herwig/Tau350/Run_Tau350.sh | 3 +-- test/ref-results/Herwig/Tau91.2/Run_Tau91.2_ISR.sh | 3 +-- test/ref-results/Herwig/ZH250/Run_ZH250_ISR.sh | 3 +-- test/ref-results/Herwig/ZH350/Run_ZH350_ISR.sh | 3 +-- 7 files changed, 9 insertions(+), 14 deletions(-) diff --git a/python/Generators/Herwig.py b/python/Generators/Herwig.py index 014c86be..cb1bb0cf 100644 --- a/python/Generators/Herwig.py +++ b/python/Generators/Herwig.py @@ -99,8 +99,9 @@ def fill_decay(self): def fill_key4hepScript(self): key4hepRun = "" key4hepRun += "export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/\n" - key4hepRun += self.executable + " --append-read ${HERWIGPATH}/defaults init\n" - key4hepRun += self.executable + " --append-read ${HERWIGPATH} read " + self.GeneratorDatacardName + "\n" + #key4hepRun += self.executable + " --append-read ${HERWIGPATH}/defaults init\n" + #key4hepRun += self.executable + " --append-read ${HERWIGPATH} read " + self.GeneratorDatacardName + "\n" + key4hepRun += self.executable + " --repo ${HERWIGPATH}/HerwigDefaults.rpo read " + self.GeneratorDatacardName + "\n" key4hepRun += self.executable + " run " + self.GeneratorDatacardBase + ".run\n" if self.procinfo.get_output_format() == "edm4hep": diff --git a/test/ref-results/Herwig/Muon350/Run_Muon350_ISR.sh b/test/ref-results/Herwig/Muon350/Run_Muon350_ISR.sh index bbce0def..599cbc43 100755 --- a/test/ref-results/Herwig/Muon350/Run_Muon350_ISR.sh +++ b/test/ref-results/Herwig/Muon350/Run_Muon350_ISR.sh @@ -4,8 +4,7 @@ if [ -z "${KEY4HEP_STACK}" ]; then fi export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/ -Herwig --append-read ${HERWIGPATH}/defaults init -Herwig --append-read ${HERWIGPATH} read Muon350_ISR.in +Herwig --repo ${HERWIGPATH}/HerwigDefaults.rpo read Muon350_ISR.in Herwig run Muon350_ISR.run convertHepMC2EDM4HEP -i hepmc2 -o edm4hep Muon350_ISR.hepmc2 Muon350_ISR.edm4hep diff --git a/test/ref-results/Herwig/Muon91.2/Run_Muon91.2.sh b/test/ref-results/Herwig/Muon91.2/Run_Muon91.2.sh index ddbbfd74..2e1806d7 100755 --- a/test/ref-results/Herwig/Muon91.2/Run_Muon91.2.sh +++ b/test/ref-results/Herwig/Muon91.2/Run_Muon91.2.sh @@ -4,8 +4,7 @@ if [ -z "${KEY4HEP_STACK}" ]; then fi export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/ -Herwig --append-read ${HERWIGPATH}/defaults init -Herwig --append-read ${HERWIGPATH} read Muon91.2.in +Herwig --repo ${HERWIGPATH}/HerwigDefaults.rpo read Muon91.2.in Herwig run Muon91.2.run convertHepMC2EDM4HEP -i hepmc2 -o edm4hep Muon91.2.hepmc2 Muon91.2.edm4hep diff --git a/test/ref-results/Herwig/Tau350/Run_Tau350.sh b/test/ref-results/Herwig/Tau350/Run_Tau350.sh index ce30ef0e..38a5d31e 100755 --- a/test/ref-results/Herwig/Tau350/Run_Tau350.sh +++ b/test/ref-results/Herwig/Tau350/Run_Tau350.sh @@ -4,8 +4,7 @@ if [ -z "${KEY4HEP_STACK}" ]; then fi export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/ -Herwig --append-read ${HERWIGPATH}/defaults init -Herwig --append-read ${HERWIGPATH} read Tau350.in +Herwig --repo ${HERWIGPATH}/HerwigDefaults.rpo read Tau350.in Herwig run Tau350.run convertHepMC2EDM4HEP -i hepmc2 -o edm4hep Tau350.hepmc2 Tau350.edm4hep diff --git a/test/ref-results/Herwig/Tau91.2/Run_Tau91.2_ISR.sh b/test/ref-results/Herwig/Tau91.2/Run_Tau91.2_ISR.sh index 726fe166..a7f95d27 100755 --- a/test/ref-results/Herwig/Tau91.2/Run_Tau91.2_ISR.sh +++ b/test/ref-results/Herwig/Tau91.2/Run_Tau91.2_ISR.sh @@ -4,8 +4,7 @@ if [ -z "${KEY4HEP_STACK}" ]; then fi export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/ -Herwig --append-read ${HERWIGPATH}/defaults init -Herwig --append-read ${HERWIGPATH} read Tau91.2_ISR.in +Herwig --repo ${HERWIGPATH}/HerwigDefaults.rpo read Tau91.2_ISR.in Herwig run Tau91.2_ISR.run convertHepMC2EDM4HEP -i hepmc2 -o edm4hep Tau91.2_ISR.hepmc2 Tau91.2_ISR.edm4hep diff --git a/test/ref-results/Herwig/ZH250/Run_ZH250_ISR.sh b/test/ref-results/Herwig/ZH250/Run_ZH250_ISR.sh index 05a54ec8..10f74e43 100755 --- a/test/ref-results/Herwig/ZH250/Run_ZH250_ISR.sh +++ b/test/ref-results/Herwig/ZH250/Run_ZH250_ISR.sh @@ -4,8 +4,7 @@ if [ -z "${KEY4HEP_STACK}" ]; then fi export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/ -Herwig --append-read ${HERWIGPATH}/defaults init -Herwig --append-read ${HERWIGPATH} read ZH250_ISR.in +Herwig --repo ${HERWIGPATH}/HerwigDefaults.rpo read ZH250_ISR.in Herwig run ZH250_ISR.run convertHepMC2EDM4HEP -i hepmc2 -o edm4hep ZH250_ISR.hepmc2 ZH250_ISR.edm4hep diff --git a/test/ref-results/Herwig/ZH350/Run_ZH350_ISR.sh b/test/ref-results/Herwig/ZH350/Run_ZH350_ISR.sh index fbd9535c..5c06e5df 100755 --- a/test/ref-results/Herwig/ZH350/Run_ZH350_ISR.sh +++ b/test/ref-results/Herwig/ZH350/Run_ZH350_ISR.sh @@ -4,8 +4,7 @@ if [ -z "${KEY4HEP_STACK}" ]; then fi export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/ -Herwig --append-read ${HERWIGPATH}/defaults init -Herwig --append-read ${HERWIGPATH} read ZH350_ISR.in +Herwig --repo ${HERWIGPATH}/HerwigDefaults.rpo read ZH350_ISR.in Herwig run ZH350_ISR.run convertHepMC2EDM4HEP -i hepmc2 -o edm4hep ZH350_ISR.hepmc2 ZH350_ISR.edm4hep From d27924d112f4384074613c81ab774e9cc7f7d230 Mon Sep 17 00:00:00 2001 From: apricePhy <146199496+apricePhy@users.noreply.github.com> Date: Tue, 23 Jun 2026 12:28:05 +0200 Subject: [PATCH 33/37] Update python/Generators/Herwig.py --- python/Generators/Herwig.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/Generators/Herwig.py b/python/Generators/Herwig.py index cb1bb0cf..3ee12860 100644 --- a/python/Generators/Herwig.py +++ b/python/Generators/Herwig.py @@ -1,7 +1,7 @@ from .GeneratorBase import GeneratorBase class Herwig(GeneratorBase): - """Pythia class""" + """Herwig class""" def __init__(self, procinfo): super().__init__(procinfo, "Herwig", "in") From 4dce41674cd12c6f7bbac3a5c3cd86ca8fb6d273 Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Wed, 24 Jun 2026 11:14:54 +0200 Subject: [PATCH 34/37] add space in distrbution, change format to pdf for better resolution --- .../src/eventGenerationCollections2Root.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/k4GeneratorsConfig/src/eventGenerationCollections2Root.cxx b/k4GeneratorsConfig/src/eventGenerationCollections2Root.cxx index 93d44522..05be6c48 100644 --- a/k4GeneratorsConfig/src/eventGenerationCollections2Root.cxx +++ b/k4GeneratorsConfig/src/eventGenerationCollections2Root.cxx @@ -464,7 +464,7 @@ void k4GeneratorsConfig::eventGenerationCollections2Root::writeCrossSectionFigur mgRMS->GetYaxis()->SetLabelSize(0.1); // generate a name and write a png - label << m_dirname << "/" << m_processesList[iProc] << "wRMS.png"; + label << m_dirname << "/" << m_processesList[iProc] << "wRMS.pdf"; c1->Print(label.str().c_str()); label.clear(); label.str(""); @@ -503,7 +503,7 @@ void k4GeneratorsConfig::eventGenerationCollections2Root::writeCrossSectionFigur mgDelta->GetYaxis()->SetLabelSize(0.1); // generate a name and write a png - label << m_dirname << "/" << m_processesList[iProc] << "wDelta.png"; + label << m_dirname << "/" << m_processesList[iProc] << "wDelta.pdf"; c1->Print(label.str().c_str()); label.clear(); label.str(""); @@ -571,7 +571,7 @@ void k4GeneratorsConfig::eventGenerationCollections2Root::writeAnalysisHistosFig // now build the legend: TLegend* topLegend = new TLegend(0.1, 0.0, 0.4, 0.4); std::ostringstream title; - title << m_procSqrtsList[proc].first << " #sqrt{s} =" << m_procSqrtsList[proc].second << "GeV"; + title << m_procSqrtsList[proc].first << " #sqrt{s} =" << m_procSqrtsList[proc].second << " GeV"; topLegend->SetHeader(title.str().c_str(), "C"); // we need to get the histo from the top TList* topPadPrimitives = topPad->GetListOfPrimitives(); @@ -626,7 +626,7 @@ void k4GeneratorsConfig::eventGenerationCollections2Root::writeAnalysisHistosFig // done, save the canvas label << m_dirname << "/" << m_procSqrtsList[proc].first << (unsigned int)(m_procSqrtsList[proc].second * m_EnergyUnitCnv) << m_cnvAnalysisHistosNames[proc][ihisto] - << ".png"; + << ".pdf"; m_cnvAnalysisHistos[proc][ihisto]->Print(label.str().c_str()); label.clear(); label.str(""); From df2922ffd89abf311b852f4bae6601cb0fb86d2f Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Mon, 29 Jun 2026 15:00:02 +0200 Subject: [PATCH 35/37] update herwig for new wrapper --- python/Generators/Herwig.py | 5 +---- test/ref-results/Herwig/Muon350/Run_Muon350_ISR.sh | 3 +-- test/ref-results/Herwig/Muon91.2/Run_Muon91.2.sh | 3 +-- test/ref-results/Herwig/Tau350/Run_Tau350.sh | 3 +-- test/ref-results/Herwig/Tau91.2/Run_Tau91.2_ISR.sh | 3 +-- test/ref-results/Herwig/ZH250/Run_ZH250_ISR.sh | 3 +-- test/ref-results/Herwig/ZH350/Run_ZH350_ISR.sh | 3 +-- 7 files changed, 7 insertions(+), 16 deletions(-) diff --git a/python/Generators/Herwig.py b/python/Generators/Herwig.py index 3ee12860..5cb9ba2d 100644 --- a/python/Generators/Herwig.py +++ b/python/Generators/Herwig.py @@ -98,10 +98,7 @@ def fill_decay(self): def fill_key4hepScript(self): key4hepRun = "" - key4hepRun += "export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/\n" - #key4hepRun += self.executable + " --append-read ${HERWIGPATH}/defaults init\n" - #key4hepRun += self.executable + " --append-read ${HERWIGPATH} read " + self.GeneratorDatacardName + "\n" - key4hepRun += self.executable + " --repo ${HERWIGPATH}/HerwigDefaults.rpo read " + self.GeneratorDatacardName + "\n" + key4hepRun += self.executable + " read " + self.GeneratorDatacardName + "\n" key4hepRun += self.executable + " run " + self.GeneratorDatacardBase + ".run\n" if self.procinfo.get_output_format() == "edm4hep": diff --git a/test/ref-results/Herwig/Muon350/Run_Muon350_ISR.sh b/test/ref-results/Herwig/Muon350/Run_Muon350_ISR.sh index 599cbc43..d589df36 100755 --- a/test/ref-results/Herwig/Muon350/Run_Muon350_ISR.sh +++ b/test/ref-results/Herwig/Muon350/Run_Muon350_ISR.sh @@ -3,8 +3,7 @@ if [ -z "${KEY4HEP_STACK}" ]; then source /cvmfs/sw.hsf.org/key4hep/setup.sh fi -export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/ -Herwig --repo ${HERWIGPATH}/HerwigDefaults.rpo read Muon350_ISR.in +Herwig read Muon350_ISR.in Herwig run Muon350_ISR.run convertHepMC2EDM4HEP -i hepmc2 -o edm4hep Muon350_ISR.hepmc2 Muon350_ISR.edm4hep diff --git a/test/ref-results/Herwig/Muon91.2/Run_Muon91.2.sh b/test/ref-results/Herwig/Muon91.2/Run_Muon91.2.sh index 2e1806d7..305cbe20 100755 --- a/test/ref-results/Herwig/Muon91.2/Run_Muon91.2.sh +++ b/test/ref-results/Herwig/Muon91.2/Run_Muon91.2.sh @@ -3,8 +3,7 @@ if [ -z "${KEY4HEP_STACK}" ]; then source /cvmfs/sw.hsf.org/key4hep/setup.sh fi -export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/ -Herwig --repo ${HERWIGPATH}/HerwigDefaults.rpo read Muon91.2.in +Herwig read Muon91.2.in Herwig run Muon91.2.run convertHepMC2EDM4HEP -i hepmc2 -o edm4hep Muon91.2.hepmc2 Muon91.2.edm4hep diff --git a/test/ref-results/Herwig/Tau350/Run_Tau350.sh b/test/ref-results/Herwig/Tau350/Run_Tau350.sh index 38a5d31e..a2e4b0de 100755 --- a/test/ref-results/Herwig/Tau350/Run_Tau350.sh +++ b/test/ref-results/Herwig/Tau350/Run_Tau350.sh @@ -3,8 +3,7 @@ if [ -z "${KEY4HEP_STACK}" ]; then source /cvmfs/sw.hsf.org/key4hep/setup.sh fi -export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/ -Herwig --repo ${HERWIGPATH}/HerwigDefaults.rpo read Tau350.in +Herwig read Tau350.in Herwig run Tau350.run convertHepMC2EDM4HEP -i hepmc2 -o edm4hep Tau350.hepmc2 Tau350.edm4hep diff --git a/test/ref-results/Herwig/Tau91.2/Run_Tau91.2_ISR.sh b/test/ref-results/Herwig/Tau91.2/Run_Tau91.2_ISR.sh index a7f95d27..b23dc5e7 100755 --- a/test/ref-results/Herwig/Tau91.2/Run_Tau91.2_ISR.sh +++ b/test/ref-results/Herwig/Tau91.2/Run_Tau91.2_ISR.sh @@ -3,8 +3,7 @@ if [ -z "${KEY4HEP_STACK}" ]; then source /cvmfs/sw.hsf.org/key4hep/setup.sh fi -export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/ -Herwig --repo ${HERWIGPATH}/HerwigDefaults.rpo read Tau91.2_ISR.in +Herwig read Tau91.2_ISR.in Herwig run Tau91.2_ISR.run convertHepMC2EDM4HEP -i hepmc2 -o edm4hep Tau91.2_ISR.hepmc2 Tau91.2_ISR.edm4hep diff --git a/test/ref-results/Herwig/ZH250/Run_ZH250_ISR.sh b/test/ref-results/Herwig/ZH250/Run_ZH250_ISR.sh index 10f74e43..4bb1e63b 100755 --- a/test/ref-results/Herwig/ZH250/Run_ZH250_ISR.sh +++ b/test/ref-results/Herwig/ZH250/Run_ZH250_ISR.sh @@ -3,8 +3,7 @@ if [ -z "${KEY4HEP_STACK}" ]; then source /cvmfs/sw.hsf.org/key4hep/setup.sh fi -export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/ -Herwig --repo ${HERWIGPATH}/HerwigDefaults.rpo read ZH250_ISR.in +Herwig read ZH250_ISR.in Herwig run ZH250_ISR.run convertHepMC2EDM4HEP -i hepmc2 -o edm4hep ZH250_ISR.hepmc2 ZH250_ISR.edm4hep diff --git a/test/ref-results/Herwig/ZH350/Run_ZH350_ISR.sh b/test/ref-results/Herwig/ZH350/Run_ZH350_ISR.sh index 5c06e5df..f88b9296 100755 --- a/test/ref-results/Herwig/ZH350/Run_ZH350_ISR.sh +++ b/test/ref-results/Herwig/ZH350/Run_ZH350_ISR.sh @@ -3,8 +3,7 @@ if [ -z "${KEY4HEP_STACK}" ]; then source /cvmfs/sw.hsf.org/key4hep/setup.sh fi -export HERWIGPATH=$(dirname $(which Herwig))/../share/Herwig/ -Herwig --repo ${HERWIGPATH}/HerwigDefaults.rpo read ZH350_ISR.in +Herwig read ZH350_ISR.in Herwig run ZH350_ISR.run convertHepMC2EDM4HEP -i hepmc2 -o edm4hep ZH350_ISR.hepmc2 ZH350_ISR.edm4hep From 19d883b2f9b9db60d06162f2af6058c82650110d Mon Sep 17 00:00:00 2001 From: Dirk Zerwas <148551698+dirkzerwas@users.noreply.github.com> Date: Tue, 30 Jun 2026 10:51:40 +0200 Subject: [PATCH 36/37] Added Whizard issue --- docs/found-issues.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/found-issues.md b/docs/found-issues.md index 59627874..77952078 100644 --- a/docs/found-issues.md +++ b/docs/found-issues.md @@ -22,3 +22,7 @@ The generators are listed in alphabetical order. ### Sherpa - [x] [Issue](https://gitlab.com/sherpa-team/sherpa/-/issues/655): Inconsistent cross-section from Sherpa. Our automated test discovered that Sherpa was underestimating the total cross-section. The bug was found and fixed in a subsequent [merge request](https://gitlab.com/sherpa-team/sherpa/-/merge_requests/1086). + +### Whizard + +- [ ] [Issue](https://github.com/key4hep/k4GeneratorsConfig/issues/86): Whizard slows down to a stop for more than 2M events. From 1a23efe637024196169e316a49cd07279076a8e3 Mon Sep 17 00:00:00 2001 From: Dirk Zerwas Date: Mon, 6 Jul 2026 18:04:56 +0200 Subject: [PATCH 37/37] rivet debugging --- python/Generators/GeneratorBase.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/Generators/GeneratorBase.py b/python/Generators/GeneratorBase.py index 4a14ade2..c63ed0f4 100644 --- a/python/Generators/GeneratorBase.py +++ b/python/Generators/GeneratorBase.py @@ -557,11 +557,14 @@ def prepareAnalysisContent(self): # write the RIVET analysis if (outformat == "edm4hep" or outformat == "hepmc3") and self.procinfo.settings.rivetON(): + # first we add the RIVET_ANALYSIS_PATH setting + analysis += f"export RIVET_ANALYSIS_PATH={self.procinfo.settings.rivetpath}\n" + # now the actual rivet command yodaout = self.procinfo.settings.yodaoutput + f"/{self.procinfo.get('procname')}.yoda" analysis += f"rivet" for ana in self.procinfo.settings.analysisname: analysis += f" -a {ana}" - analysis+=f" -o {yodaout} {self.procinfo.get('procname')}.{self.procinfo.get_output_format()}\n" + analysis+=f" -o {yodaout} {self.procinfo.get('procname')}.hepmc3\n" # add to the text to the data member self.add2Analysis(analysis)