Skip to content

Propagate Pythia8 generator weight vector to EDM4hep - #158

Merged
jmcarcell merged 4 commits into
key4hep:mainfrom
selvaggi:main
Aug 20, 2026
Merged

Propagate Pythia8 generator weight vector to EDM4hep#158
jmcarcell merged 4 commits into
key4hep:mainfrom
selvaggi:main

Conversation

@selvaggi

@selvaggi selvaggi commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

DelphesPythia8_EDM4HEP currently stores only the nominal event weight.

This PR implements storing the full pythia.info weight vector in EventHeader.weights and
and the weight labels in the metadata underedm4hep::labels::EventWeightsNames.

examples/data/ee_Z_bbbar_ecm91GeV_weights.cmd is an example card with the weight machinery enabled.

@kjvbrt

kjvbrt commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Confirmed eventWeights()/eventWeightNames() on DelphesPythia8Reader also captures MadGraph LHE-level reweighting (<rwgt> blocks), not just Pythia8's own shower variations — Pythia8 merges both into info.weightValueVector()/weightNameVector() automatically when reading via Beams:LHEF. Verified against a real MadGraph-reweighted LHE file.

That means this PR subsumes #148.

@jmcarcell

Copy link
Copy Markdown
Member

Do you want this in the upcoming release @selvaggi?

Comment thread tests/CMakeLists.txt Outdated
@selvaggi

selvaggi commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Do you want this in the upcoming release @selvaggi?

Yes, please.

@selvaggi

Copy link
Copy Markdown
Contributor Author

@jmcarcell @kjvbrt anything else before this can be merged?

@tmadlener tmadlener left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. I suppose the weight names follow from the pythia cmd file somehow? In light of @kjvbrt comment that this also includes the LHEF weights, I think it would be a good idea to also add a test related to that (potentially in a follow up PR).

I have rebased onto the current main branch and resolved a minor conflict along the way.

@selvaggi

Copy link
Copy Markdown
Contributor Author

@tmadlener yes the names come from pythia.info.weightNameVector() so they follow directly from the cmd file. The entry 0 is always the Pythia nominal weight. For each group defined in UncertaintyBands:List / VariationFrag:list Pythia books one weight named by the group label from the card plus one per individual keyword with an autogenerated name.

Comment thread tests/scripts/check_event_weights.py Outdated
Comment thread tests/scripts/check_event_weights.py Outdated
Comment thread tests/scripts/check_event_weights.py Outdated
@jmcarcell
jmcarcell enabled auto-merge (squash) August 20, 2026 16:10
@jmcarcell
jmcarcell merged commit 8e2f6a9 into key4hep:main Aug 20, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants