Skip to content

Full simulation with Genie - #2083

Merged
tvami merged 11 commits into
trunkfrom
iss2059-hepmc-full-generator
Jun 22, 2026
Merged

Full simulation with Genie#2083
tvami merged 11 commits into
trunkfrom
iss2059-hepmc-full-generator

Conversation

@tvami

@tvami tvami commented Jun 18, 2026

Copy link
Copy Markdown
Member

I am updating ldmx-sw, here are the details.

A big change where Genie is under GEANT and similarly to the signal we lead the 8 GeV primary generator thru the upstream material, and then hand the electron at the correct energy at the target volume to Genie. With this these particles are now secondaries and can be one-to-one compared to the GEANT based EN processes.

What are the issues that this addresses?

Resolves #2059

Check List

  • I successfully compiled ldmx-sw with my developments.
  • I read, understood and follow the coding rules.
  • I ran my developments and the following shows that they are successful.

Source is not at 0,0,0 anymore:

Screenshot 2026-06-17 at 19 29 33

Mult:
Screenshot 2026-06-17 at 19 41 17

Tagger DQM is filled now:
Screenshot 2026-06-17 at 19 42 34

Implementation is such that the old way of doing it is still possible

@tvami tvami changed the title Iss2059 hepmc full generator Full simulation with Genie Jun 18, 2026
@tvami
tvami marked this pull request as ready for review June 18, 2026 02:28
@tvami

tvami commented Jun 18, 2026

Copy link
Copy Markdown
Member Author

/run-validation

  • this I expect to differ quite a lot

@github-actions

Copy link
Copy Markdown
Contributor

The validation workflow is running here: https://github.com/LDMX-Software/ldmx-sw/actions/runs/27733274965.

Comment thread .github/validation_samples/target_genie/config.py
@github-actions

Copy link
Copy Markdown
Contributor

Validation Results

Some validation samples failed! ❌

Sample Status
cascade_history ✅ PASS
deep_ecal_gun ✅ PASS
eat_signal ✅ PASS
ecal_pn ✅ PASS
hcal ✅ PASS
inclusive ✅ PASS
it_pileup ✅ PASS
kaon_enhanced ✅ PASS
reduced_ldmx ✅ PASS
signal ✅ PASS
signal_target_al ✅ PASS
target_pn_lyso ✅ PASS
target_ti_en ✅ PASS
wab_lhe ✅ PASS
target_genie ❌ FAIL (379 histograms failed KS test) (artifact)

target_genie:

  • 379 plots failed the KS test against gold.
  • Text Differences Between Logs (139704 lines differ)
  • Log character count differs by 80%: gold=7408794, new=1462131
  • Timing regression for target_genie: new=9934s vs gold=6488s (+53%, tolerance 10%)
  • Timing for target_genie: gold=6488s, new=9934s

cascade_history:

  • Text Differences Between Logs (3 lines differ)
  • Log character count differs by 0% (gold=4450203, new=4450280); within tolerance
  • Timing for cascade_history: gold=5968s, new=6119s
  • Timing within 2% of gold (tolerance 10%)

deep_ecal_gun:

  • Text Differences Between Logs (25 lines differ)
  • Log character count differs by 0% (gold=11769507, new=11769584); within tolerance
  • Timing for deep_ecal_gun: gold=4091s, new=4127s
  • Timing within 0% of gold (tolerance 10%)

eat_signal:

  • Timing for eat_signal: gold=1602s, new=1551s
  • Timing within 3% of gold (tolerance 10%)

ecal_pn:

  • Text Differences Between Logs (43 lines differ)
  • Log character count differs by 0% (gold=24115137, new=24115214); within tolerance
  • Timing for ecal_pn: gold=6232s, new=6751s
  • Timing within 8% of gold (tolerance 10%)

hcal:

  • Text Differences Between Logs (3 lines differ)
  • Log character count differs by 0% (gold=1849291, new=1849368); within tolerance
  • Timing for hcal: gold=829s, new=821s
  • Timing within 0% of gold (tolerance 10%)

inclusive:

  • Text Differences Between Logs (41 lines differ)
  • Log character count differs by 0% (gold=21025815, new=21025892); within tolerance
  • Timing for inclusive: gold=6805s, new=6815s
  • Timing within 0% of gold (tolerance 10%)

it_pileup:

  • Text Differences Between Logs (40 lines differ)
  • Timing for it_pileup: gold=577s, new=567s
  • Timing within 1% of gold (tolerance 10%)

kaon_enhanced:

  • Text Differences Between Logs (39 lines differ)
  • Log character count differs by 0% (gold=10113147, new=10113224); within tolerance
  • Timing for kaon_enhanced: gold=3122s, new=2959s
  • Timing within 5% of gold (tolerance 10%)

reduced_ldmx:

  • Text Differences Between Logs (21 lines differ)
  • Log character count differs by 0% (gold=33428186, new=33428263); within tolerance
  • Timing for reduced_ldmx: gold=211s, new=208s
  • Timing within 1% of gold (tolerance 10%)

signal:

  • Text Differences Between Logs (39 lines differ)
  • Log character count differs by 0% (gold=16413606, new=16413683); within tolerance
  • Timing for signal: gold=1184s, new=1197s
  • Timing within 1% of gold (tolerance 10%)

signal_target_al:

  • Text Differences Between Logs (33 lines differ)
  • Log character count differs by 0% (gold=16793512, new=16793589); within tolerance
  • Timing for signal_target_al: gold=1047s, new=1051s
  • Timing within 0% of gold (tolerance 10%)

target_pn_lyso:

  • Text Differences Between Logs (43 lines differ)
  • Log character count differs by 0% (gold=20168145, new=20168222); within tolerance
  • Timing anomaly for target_pn_lyso: new=4966s vs gold=6455s (-23%, tolerance 10%)
  • Timing for target_pn_lyso: gold=6455s, new=4966s

target_ti_en:

  • Text Differences Between Logs (41 lines differ)
  • Log character count differs by 0% (gold=393097, new=393174); within tolerance
  • Timing for target_ti_en: gold=3226s, new=3172s
  • Timing within 1% of gold (tolerance 10%)

wab_lhe:

  • Text Differences Between Logs (19 lines differ)
  • Log character count differs by 0% (gold=13180363, new=13180440); within tolerance
  • Timing for wab_lhe: gold=6770s, new=6755s
  • Timing within 0% of gold (tolerance 10%)

@github-actions

Copy link
Copy Markdown
Contributor

Validation Results

Some validation samples failed! ❌

Sample Status
cascade_history ✅ PASS
deep_ecal_gun ✅ PASS
eat_signal ✅ PASS
ecal_pn ✅ PASS
hcal ✅ PASS
inclusive ✅ PASS
it_pileup ✅ PASS
kaon_enhanced ✅ PASS
reduced_ldmx ✅ PASS
signal ✅ PASS
signal_target_al ✅ PASS
target_pn_lyso ✅ PASS
target_ti_en ✅ PASS
wab_lhe ✅ PASS
target_genie ❌ FAIL (379 histograms failed KS test) (artifact)

target_genie:

  • 379 plots failed the KS test against gold.
  • Text Differences Between Logs (139704 lines differ)
  • Log character count differs by 80%: gold=7408794, new=1462131
  • Timing regression for target_genie: new=9907s vs gold=6488s (+52%, tolerance 10%)
  • Timing for target_genie: gold=6488s, new=9907s

cascade_history:

  • Text Differences Between Logs (3 lines differ)
  • Log character count differs by 0% (gold=4450203, new=4450280); within tolerance
  • Timing for cascade_history: gold=5968s, new=6004s
  • Timing within 0% of gold (tolerance 10%)

deep_ecal_gun:

  • Text Differences Between Logs (23 lines differ)
  • Log character count differs by 0% (gold=11769507, new=11769584); within tolerance
  • Timing for deep_ecal_gun: gold=4091s, new=4028s
  • Timing within 1% of gold (tolerance 10%)

eat_signal:

  • Timing for eat_signal: gold=1602s, new=1570s
  • Timing within 1% of gold (tolerance 10%)

ecal_pn:

  • Text Differences Between Logs (41 lines differ)
  • Log character count differs by 0% (gold=24115137, new=24115214); within tolerance
  • Timing for ecal_pn: gold=6232s, new=6523s
  • Timing within 4% of gold (tolerance 10%)

hcal:

  • Text Differences Between Logs (3 lines differ)
  • Log character count differs by 0% (gold=1849291, new=1849368); within tolerance
  • Timing for hcal: gold=829s, new=838s
  • Timing within 1% of gold (tolerance 10%)

inclusive:

  • Text Differences Between Logs (39 lines differ)
  • Log character count differs by 0% (gold=21025815, new=21025892); within tolerance
  • Timing for inclusive: gold=6805s, new=6599s
  • Timing within 3% of gold (tolerance 10%)

it_pileup:

  • Text Differences Between Logs (48 lines differ)
  • Timing for it_pileup: gold=577s, new=562s
  • Timing within 2% of gold (tolerance 10%)

kaon_enhanced:

  • Text Differences Between Logs (29 lines differ)
  • Log character count differs by 0% (gold=10113147, new=10113224); within tolerance
  • Timing for kaon_enhanced: gold=3122s, new=3080s
  • Timing within 1% of gold (tolerance 10%)

reduced_ldmx:

  • Text Differences Between Logs (17 lines differ)
  • Log character count differs by 0% (gold=33428186, new=33428263); within tolerance
  • Timing for reduced_ldmx: gold=211s, new=207s
  • Timing within 1% of gold (tolerance 10%)

signal:

  • Text Differences Between Logs (49 lines differ)
  • Log character count differs by 0% (gold=16413606, new=16413683); within tolerance
  • Timing anomaly for signal: new=828s vs gold=1184s (-30%, tolerance 10%)
  • Timing for signal: gold=1184s, new=828s

signal_target_al:

  • Text Differences Between Logs (29 lines differ)
  • Log character count differs by 0% (gold=16793512, new=16793589); within tolerance
  • Timing for signal_target_al: gold=1047s, new=1068s
  • Timing within 2% of gold (tolerance 10%)

target_pn_lyso:

  • Text Differences Between Logs (43 lines differ)
  • Log character count differs by 0% (gold=20168145, new=20168222); within tolerance
  • Timing for target_pn_lyso: gold=6455s, new=6336s
  • Timing within 1% of gold (tolerance 10%)

target_ti_en:

  • Text Differences Between Logs (41 lines differ)
  • Log character count differs by 0% (gold=393097, new=393174); within tolerance
  • Timing for target_ti_en: gold=3226s, new=3131s
  • Timing within 2% of gold (tolerance 10%)

wab_lhe:

  • Text Differences Between Logs (29 lines differ)
  • Log character count differs by 0% (gold=13180363, new=13180440); within tolerance
  • Timing for wab_lhe: gold=6770s, new=6748s
  • Timing within 0% of gold (tolerance 10%)

@github-actions

Copy link
Copy Markdown
Contributor

Validation Results

Some validation samples failed! ❌

Sample Status
cascade_history ✅ PASS
deep_ecal_gun ✅ PASS
eat_signal ✅ PASS
ecal_pn ✅ PASS
hcal ✅ PASS
inclusive ✅ PASS
it_pileup ✅ PASS
kaon_enhanced ✅ PASS
reduced_ldmx ✅ PASS
signal ✅ PASS
signal_target_al ✅ PASS
target_pn_lyso ✅ PASS
target_ti_en ✅ PASS
wab_lhe ✅ PASS
target_genie ❌ FAIL (379 histograms failed KS test) (artifact)

target_genie:

  • 379 plots failed the KS test against gold.
  • Text Differences Between Logs (139704 lines differ)
  • Log character count differs by 80%: gold=7408794, new=1462131
  • Timing regression for target_genie: new=9871s vs gold=6488s (+52%, tolerance 10%)
  • Timing for target_genie: gold=6488s, new=9871s

cascade_history:

  • Text Differences Between Logs (3 lines differ)
  • Log character count differs by 0% (gold=4450203, new=4450280); within tolerance
  • Timing for cascade_history: gold=5968s, new=6107s
  • Timing within 2% of gold (tolerance 10%)

deep_ecal_gun:

  • Text Differences Between Logs (21 lines differ)
  • Log character count differs by 0% (gold=11769507, new=11769584); within tolerance
  • Timing anomaly for deep_ecal_gun: new=2431s vs gold=4091s (-40%, tolerance 10%)
  • Timing for deep_ecal_gun: gold=4091s, new=2431s

eat_signal:

  • Timing for eat_signal: gold=1602s, new=1567s
  • Timing within 2% of gold (tolerance 10%)

ecal_pn:

  • Text Differences Between Logs (41 lines differ)
  • Log character count differs by 0% (gold=24115137, new=24115214); within tolerance
  • Timing for ecal_pn: gold=6232s, new=6775s
  • Timing within 8% of gold (tolerance 10%)

hcal:

  • Text Differences Between Logs (3 lines differ)
  • Log character count differs by 0% (gold=1849291, new=1849368); within tolerance
  • Timing for hcal: gold=829s, new=829s
  • Timing within 0% of gold (tolerance 10%)

inclusive:

  • Text Differences Between Logs (27 lines differ)
  • Log character count differs by 0% (gold=21025815, new=21025892); within tolerance
  • Timing for inclusive: gold=6805s, new=6750s
  • Timing within 0% of gold (tolerance 10%)

it_pileup:

  • Text Differences Between Logs (42 lines differ)
  • Timing for it_pileup: gold=577s, new=600s
  • Timing within 3% of gold (tolerance 10%)

kaon_enhanced:

  • Text Differences Between Logs (33 lines differ)
  • Log character count differs by 0% (gold=10113147, new=10113224); within tolerance
  • Timing for kaon_enhanced: gold=3122s, new=3033s
  • Timing within 2% of gold (tolerance 10%)

reduced_ldmx:

  • Text Differences Between Logs (13 lines differ)
  • Log character count differs by 0% (gold=33428186, new=33428263); within tolerance
  • Timing for reduced_ldmx: gold=211s, new=211s
  • Timing within 0% of gold (tolerance 10%)

signal:

  • Text Differences Between Logs (33 lines differ)
  • Log character count differs by 0% (gold=16413606, new=16413683); within tolerance
  • Timing for signal: gold=1184s, new=1243s
  • Timing within 4% of gold (tolerance 10%)

signal_target_al:

  • Text Differences Between Logs (17 lines differ)
  • Log character count differs by 0% (gold=16793512, new=16793589); within tolerance
  • Timing for signal_target_al: gold=1047s, new=1057s
  • Timing within 0% of gold (tolerance 10%)

target_pn_lyso:

  • Text Differences Between Logs (35 lines differ)
  • Log character count differs by 0% (gold=20168145, new=20168222); within tolerance
  • Timing for target_pn_lyso: gold=6455s, new=6093s
  • Timing within 5% of gold (tolerance 10%)

target_ti_en:

  • Text Differences Between Logs (35 lines differ)
  • Log character count differs by 0% (gold=393097, new=393174); within tolerance
  • Timing for target_ti_en: gold=3226s, new=3172s
  • Timing within 1% of gold (tolerance 10%)

wab_lhe:

  • Text Differences Between Logs (27 lines differ)
  • Log character count differs by 0% (gold=13180363, new=13180440); within tolerance
  • Timing for wab_lhe: gold=6770s, new=6865s
  • Timing within 1% of gold (tolerance 10%)

@tomeichlersmith tomeichlersmith 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.

Honestly, this looks great. My only requests are a few technical things.

Comment thread SimCore/src/SimCore/GenieElectroNuclearProcess.cxx Outdated
Comment thread SimCore/src/SimCore/RunManager.cxx Outdated
@tvami

tvami commented Jun 18, 2026

Copy link
Copy Markdown
Member Author

While I work on Tom's suggestion, here is the KS test summary (with my own importance filter so the file doesnt get bigger than the gihub max for uploads)

One change is that Genie was considering everybody to be primary, now that's not the case anymore.

And then ofc we now fill the tagger plots, the target volume is bigger, etc.

Seems like the electron is softer than earlier, but that might just be statistics?

The electron is more fiducial in the ECAL.

Figure 140: less zero track events makes me happier

Figure 159: this confuses me tho... @tomeichlersmith any input on this?

iss2083_target_genie_recon_validation_plots.pdf

@tomeichlersmith

Copy link
Copy Markdown
Member

Now that we aren't producing the GENIE event inside the target, we are susceptible to upstream objects softening the electron and causing it to curve further towards negative x in the magnetic field. I'm surprised if that affect causes the full shift of the distribution, so I'm guessing that our settings for the beam are a little off.

I originally got the settings for the electron by shooting a positron backwards from the target after removing the upstream detector components. #1396 but there have been many changes since then so we may need to update those settings?

@tvami

tvami commented Jun 18, 2026

Copy link
Copy Markdown
Member Author

we may need to update those settings?

Yeah prob we should check again. I see the config to run, but then how do you extract the final number? Can you maybe put the analysis code too? I also wonder if we should make that into a unit test?

@tomeichlersmith

Copy link
Copy Markdown
Member

The analysis I used way back then is included in the tar-ball I uploaded, I'm trying it out now.

@tomeichlersmith

tomeichlersmith commented Jun 18, 2026

Copy link
Copy Markdown
Member

alright, kinda quick and dirty, I did not update the legend, but the beam still seems to be well centered on the target. edit: this is with v14, running with v15 next.

position-and-momentum-trunk-1395-comp

I'm now unsure on where the large deflection is coming from.

@tomeichlersmith

Copy link
Copy Markdown
Member

yea, I'm much more confident its not the configuration of the generator now
position-and-momentum-trunk-1395-comp

@tvami

tvami commented Jun 19, 2026

Copy link
Copy Markdown
Member Author

OK I think the beam smear actually makes sense, you do the beamspot from around the origin as coming from the primary. But this study was great to show that v15 didnt change much, thanks Tom!

@tvami
tvami requested a review from tomeichlersmith June 19, 2026 01:16
@tvami

tvami commented Jun 19, 2026

Copy link
Copy Markdown
Member Author

/run-validation

@github-actions

Copy link
Copy Markdown
Contributor

The validation workflow is running here: https://github.com/LDMX-Software/ldmx-sw/actions/runs/27799575659.

@github-actions

Copy link
Copy Markdown
Contributor

Validation Results

Some validation samples failed! ❌

Sample Status
cascade_history ✅ PASS
deep_ecal_gun ✅ PASS
eat_signal ✅ PASS
ecal_pn ✅ PASS
hcal ✅ PASS
inclusive ✅ PASS
it_pileup ✅ PASS
kaon_enhanced ✅ PASS
signal ✅ PASS
target_pn_lyso ✅ PASS
target_ti_en ✅ PASS
wab_lhe ✅ PASS
reduced_ldmx ❌ FAIL (117 histograms failed KS test) (artifact)
signal_target_al ❌ FAIL (1085 histograms failed KS test) (artifact)
target_genie ❌ FAIL (379 histograms failed KS test) (artifact)

reduced_ldmx:

  • 117 plots failed the KS test against gold.
  • Text Differences Between Logs (276842 lines differ)
  • Log character count differs by 0% (gold=33428186, new=33305646); within tolerance
  • Timing anomaly for reduced_ldmx: new=130s vs gold=211s (-38%, tolerance 10%)
  • Timing for reduced_ldmx: gold=211s, new=130s

signal_target_al:

  • 1085 plots failed the KS test against gold.
  • Text Differences Between Logs (109103 lines differ)
  • Log character count differs by 0% (gold=16793512, new=16841967); within tolerance
  • Timing for signal_target_al: gold=1047s, new=944s
  • Timing within 9% of gold (tolerance 10%)

target_genie:

  • 379 plots failed the KS test against gold.
  • Text Differences Between Logs (139704 lines differ)
  • Log character count differs by 80%: gold=7408794, new=1462131
  • Timing regression for target_genie: new=9575s vs gold=6488s (+47%, tolerance 10%)
  • Timing for target_genie: gold=6488s, new=9575s

cascade_history:

  • Text Differences Between Logs (3 lines differ)
  • Log character count differs by 0% (gold=4450203, new=4450280); within tolerance
  • Timing for cascade_history: gold=5968s, new=6036s
  • Timing within 1% of gold (tolerance 10%)

deep_ecal_gun:

  • Text Differences Between Logs (25 lines differ)
  • Log character count differs by 0% (gold=11769507, new=11769584); within tolerance
  • Timing for deep_ecal_gun: gold=4091s, new=4154s
  • Timing within 1% of gold (tolerance 10%)

eat_signal:

  • Timing for eat_signal: gold=1602s, new=1586s
  • Timing within 0% of gold (tolerance 10%)

ecal_pn:

  • Text Differences Between Logs (47 lines differ)
  • Log character count differs by 0% (gold=24115137, new=24115214); within tolerance
  • Timing for ecal_pn: gold=6232s, new=6614s
  • Timing within 6% of gold (tolerance 10%)

hcal:

  • Text Differences Between Logs (3 lines differ)
  • Log character count differs by 0% (gold=1849291, new=1849368); within tolerance
  • Timing for hcal: gold=829s, new=823s
  • Timing within 0% of gold (tolerance 10%)

inclusive:

  • Text Differences Between Logs (37 lines differ)
  • Log character count differs by 0% (gold=21025815, new=21025892); within tolerance
  • Timing for inclusive: gold=6805s, new=6651s
  • Timing within 2% of gold (tolerance 10%)

it_pileup:

  • Text Differences Between Logs (40 lines differ)
  • Timing for it_pileup: gold=577s, new=607s
  • Timing within 5% of gold (tolerance 10%)

kaon_enhanced:

  • Text Differences Between Logs (33 lines differ)
  • Log character count differs by 0% (gold=10113147, new=10113224); within tolerance
  • Timing for kaon_enhanced: gold=3122s, new=3058s
  • Timing within 2% of gold (tolerance 10%)

signal:

  • Text Differences Between Logs (37 lines differ)
  • Log character count differs by 0% (gold=16413606, new=16413683); within tolerance
  • Timing for signal: gold=1184s, new=1229s
  • Timing within 3% of gold (tolerance 10%)

target_pn_lyso:

  • Text Differences Between Logs (31 lines differ)
  • Log character count differs by 0% (gold=20168145, new=20168222); within tolerance
  • Timing for target_pn_lyso: gold=6455s, new=6371s
  • Timing within 1% of gold (tolerance 10%)

target_ti_en:

  • Text Differences Between Logs (37 lines differ)
  • Log character count differs by 0% (gold=393097, new=393174); within tolerance
  • Timing for target_ti_en: gold=3226s, new=3116s
  • Timing within 3% of gold (tolerance 10%)

wab_lhe:

  • Text Differences Between Logs (31 lines differ)
  • Log character count differs by 0% (gold=13180363, new=13180440); within tolerance
  • Timing for wab_lhe: gold=6770s, new=6575s
  • Timing within 2% of gold (tolerance 10%)

@tvami
tvami merged commit d79d270 into trunk Jun 22, 2026
2 checks passed
@tvami
tvami deleted the iss2059-hepmc-full-generator branch June 22, 2026 14:12
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.

Full simulation with HepMC inputs

3 participants