Skip to content

Implement H4, H3 and S2 staggering in HEXPLIT#2589

Open
sebouh137 wants to merge 80 commits intomainfrom
hexplit_s2
Open

Implement H4, H3 and S2 staggering in HEXPLIT#2589
sebouh137 wants to merge 80 commits intomainfrom
hexplit_s2

Conversation

@sebouh137
Copy link
Copy Markdown
Contributor

@sebouh137 sebouh137 commented Apr 1, 2026

Briefly, what does this PR introduce?

Update the HEXPLIT algorithm to be able to handle square cells, which are used in the latest version of the ZDC geometry. Also update the parameters in the ZDC reconstruction to match the geometry (which also has thicker cells, so larger sampling fraction and larger MIP value.

What kind of change does this PR introduce?

  • Bug fix (issue #__)
  • New feature (issue #__)
  • Documentation update
  • Other: __

Please check if this PR fulfills the following:

  • Tests for the changes have been added
  • Documentation has been added / updated
  • Changes have been communicated to collaborators

Does this PR introduce breaking changes? What changes might users need to make to their code?

Users should use the square-cell version of the ZDC geometry in the epic repository

Does this PR change default behavior?

Yes. Presumes that the ZDC has square cells, and runs the square-cell version of HEXPLIT.

@github-actions github-actions bot added topic: calorimetry relates to calorimetry topic: far-forward Far forward reconstruction labels Apr 1, 2026
@veprbl veprbl changed the title Hexplit s2 Implement H4, H3 and S2 staggering in HEXPLIT Apr 1, 2026
sebouh137 and others added 12 commits April 1, 2026 21:35
removed "sin(pi/3)" thing that was there from the hexagonal version of the ZDC
comment out some lines that were commented out before
reverted formatting of commented-out lines
Fix issue where "OVERLAP" is not defined
replaced ; with ,
don't use arrays that are assigned a length at runtime.  Better to use the maximum value that could be considered for any known staggering pattern (12).
epic-capybara and others added 2 commits April 2, 2026 01:21
This PR applies the include-what-you-use fixes as suggested by
https://github.com/eic/EICrecon/actions/runs/23884066302.
Please merge this PR into the branch `hexplit_s2`
to resolve failures in PR #2589.

Auto-generated by [create-pull-request][1]

[1]: https://github.com/peter-evans/create-pull-request

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
adjusted thresholds for the clustering
@wdconinc
Copy link
Copy Markdown
Contributor

wdconinc commented Apr 9, 2026

@wdconinc There are two benchmarks that currently fail. The first is the bench:campaign, which appears to be unrelated to this change. I keep gettting this error on there:

[e:97] [FOFFMTRK:ForwardOffMRecParticles] [error] No matrix found with matching beam momentum
[e:97] [JEventProcessorPODIO] [error] Omitting PODIO collection 'ForwardOffMRecParticles' due to exception: No matrix found with matching beam momentum.

The other is the bench:zdc_pi0, which is related to this pull request. I'll have to look more into what is going on. I'm suspecting that it's more difficult to separate the two clusters with square tiles (S2 staggering) than hexagonal tiles (H4 staggering).

@veprbl?

@veprbl
Copy link
Copy Markdown
Member

veprbl commented Apr 9, 2026

The campaign benchmark was fixed in eic/simulation_campaign_hepmc3#88.

For this PR, since this is not a critical subsystem, we may not need to require a perfect backward compatibility (which is is always welcome in any case), but the minimal goals would be to at least:

  1. to not fatally crash due to incompatibilities (i.e. not break stuff for other users)
  2. have some understanding on what's the impact of incompatibilities (e.g. is it that no clusters are found, or clusters are found with unreasonable energy/position/etc)
  3. test the existing benchmark with the new geometry/EICrecon combination and ensure that the results will be sensible

@sebouh137
Copy link
Copy Markdown
Contributor Author

sebouh137 commented Apr 9, 2026

The campaign benchmark was fixed in eic/simulation_campaign_hepmc3#88.

For this PR, since this is not a critical subsystem, we may not need to require a perfect backward compatibility (which is is always welcome in any case), but the minimal goals would be to at least:

  1. to not fatally crash due to incompatibilities (i.e. not break stuff for other users)
  2. have some understanding on what's the impact of incompatibilities (e.g. is it that no clusters are found, or clusters are found with unreasonable energy/position/etc)
  3. test the existing benchmark with the new geometry/EICrecon combination and ensure that the results will be sensible

@veprbl Hi Dmitry, thanks for the info. This doesn't cause crashes when running the new EICrecon with the previous version of epic, however this does affect the results from the EICrecon, which can cause the analysis scripts in the benchmarks to fail. Essentially, clusters can still be found, but since the subcell splitting of the HEXPLIT algorithm requires the geometry to match the one used in the simulation, it will distribute the energy in a given cell evenly (since it doesn't know how the cells in different layers are supposed to overlap). This causes any analysis that requires multiple clusters per event to fail because the clusters are getting merged together, causing the analysis step of the benchmarks to crash (in the case of the zdc_pi0 benchmark), or produce garbage results. I have locally checked that the zdc_pi0 benchmark works on my laptop with both repositories on the correct branches. So, all three of these criteria appear to be fulfilled. There will be followup work that will need to be done, due to new geometry, but that can be done in future pull requests.
Are there any other steps I will need to do in order to get this and the other pull request approved? Best regards, Sebouh

Copy link
Copy Markdown
Member

@veprbl veprbl left a comment

Choose a reason for hiding this comment

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

Thank you for checking the benchmarks. I have couple of comments.


ParameterRef<std::string> m_energyWeight{this, "energyWeight", config().energyWeight};
ParameterRef<double> m_samplingFraction{this, "samplingFraction", config().sampFrac};
//ParameterRef<double> m_samplingFraction{this, "samplingFraction", config().sampFrac};
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.

Removing the sampling fraction option doesn't seem like a good idea. It's a useful option.
Would it work to grab the detector auto detector = app->GetService<DD4hep_service>()->detector(); and then call _toDouble just in ZDC.cc?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll fix this, thanks. I was trying to have it be able to scale the sampling fraction based on the thickness of the tiles for backwards compatibility, but what you suggested is probably a better way to do this.

.Emin_in_MIPs = 0.5,
.delta_in_MIPs = 0.01,
.tmax = 269 * dd4hep::ns,
.stag_type = HEXPLITConfig::StaggerType::S2,
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.

If you want, you could infer staggering type from segmentation, e.g.:

m_seg = m_detector->readout(m_cfg.readout).segmentation();

Would that make it also backwards compatible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: calorimetry relates to calorimetry topic: far-forward Far forward reconstruction

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants