Skip to content

Conversation

@largewedge
Copy link
Contributor

This PR adds support for applying the sEPD calibration in CaloTowerCalib and for adding the sEPD geometry to the node tree using the RawTowerGeomContainer, in keeping with the conventions followed by calorimeter software.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work for users)
  • Requiring change in macros repository (Please provide links to the macros pull request in the last section)
  • I am a member of GitHub organization of sPHENIX Collaboration, EIC, or ECCE (contact Chris Pinkenburg to join)

What kind of change does this PR introduce? (Bug fix, feature, ...)

As discussed at the BulkTG meeting: https://indico.bnl.gov/event/29269/
Note that this requires the calibrations file to use the tower key to index channels.

TODOs (if applicable)

Consider moving sEPDGeomMapping functionality into CaloGeomMapping.
Change sEPD calibration files to store (1/MPV) rather than MPV so that no special cases are needed in CaloTowerCalib.

Links to other PRs in macros and calibration repositories (if applicable)

Corresponding changes in production macros at this PR: sPHENIX-Collaboration/macros#1176

@bseidlit
Copy link
Contributor

The changes to calotowercalib seem largely unnecessary and undesirable.
I am fine with changing isNoCalib to be applied to all calibrations <= 0 for all subsystems.

But can you just use the convention for the CDB tree name already in place? Putting in this code just because this is the BDC tree already in the CDB is just laziness and add to code bloat.

I fully support integrating the EPD into the main calo software but the whole point is to not use a bunch of flags for EPD when avoidable.

if I am looking at this right you should only need to change a line or two of calotowercalib.

@largewedge
Copy link
Contributor Author

@bseidlit Agreed. I have reverted those changes. I will fix the calibration file to use the expected convention

@eumaka
Copy link
Contributor

eumaka commented Aug 15, 2025

I have some significant technical concerns about the proposed changes to retire EpdReco and replace it with sEPDGeomMapping:

Architectural Issues: The current approach introduces unnecessary complexity by duplicating geometry calculations. The workflow now becomes: copy phi, r, z values from EpdReco into sEPDGeomMapping with hardcoded phi values → convert to Cartesian coordinates → store in RawTowerGeomv1 → recalculate phi in downstream EventPlaneReco code. This circular conversion adds computational overhead and potential precision loss without clear benefit.

Geometric Modeling Concerns: The EPD detector has a disk geometry, which differs fundamentally from cylindrical calorimeter geometries. The existing EpdGeom class was specifically designed to handle the r, φ, z coordinate system appropriate for disk detectors. Forcing EPD into the calorimeter tower model is precisely why the geometry functionality had to be duplicated from EpdReco into the new sEPDGeomMapping class - it's an indication that we're working against the natural geometry rather than with it.

Simulation Impact: The proposed changes would retire the EpdGeom class, which is currently used by simulation code. This creates a significant risk of breaking existing simulation workflows that depend on the current geometry implementation.

Recommendation: Before proceeding with this major refactoring, I suggest we:
Evaluate whether the benefits of calorimeter-style geometry justify the added complexity and code duplication
Ensure simulation compatibility is maintained throughout any transition
Consider a phased migration approach that preserves existing functionality

@pinkenburg pinkenburg marked this pull request as draft August 15, 2025 19:07
@largewedge
Copy link
Contributor Author

I do not completely disagree with @eumaka --I definitely think that whether the sEPD geometry handling should be done in CaloGeomMapping or in its own, separate module is worth further discussion, since CaloGeomMapping does seem to assume a cylindrical geometry; however, I do think that it's worthwhile to adhere more closely to the conventions set by the calorimeters, which would mean using RawTowerGeom objects when possible.

Note that RawTowerGeomv1 itself does not assume anything about the geometry of the detector: it allows us to use cartesian coordinates to locate towers (

double get_center_x() const override { return _center_x; }
), which should be as inexpensive as storing arm, ring, phi. Either way, we store three values.

Regarding the workflow: the first step ("copy phi, r, z values from EpdReco into sEPDGeomMapping with hardcoded phi values") was a part of the process of refactoring itself and will not be done every time the code is run, so this does not add anything to the computational cost. The remaining steps contribute a marginal amount of additional computing time and are done in other calorimeters without issue (for example, the HCal:

const double x(geom_ref_radius * cos(m_RawTowerGeom->get_phicenter(iphi)));
and the EMCal:
double phi = atan2(tower_geom->get_center_y(), tower_geom->get_center_x());
).

Regarding the simulation: I do not think that this would be that great of a challenge. There are relatively few places in the simulation code that I can see making use of EpdGeom (specifically here

epdGeom->set_z(thiskey, GetTileZ(TowerInfoDefs::get_epd_arm(thiskey)));
) although please correct me if I am wrong.

@sphenix-jenkins-ci
Copy link

Build & test report

Report for commit ea6e51026778b9f9c8ffea1adaff0820ddd8db89:
Jenkins on fire


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@sphenix-jenkins-ci
Copy link

Build & test report

Report for commit 3d4c104db7ceb62f83147a66212a425fe6ff4149:
Jenkins passed


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@bseidlit
Copy link
Contributor

The changes to CaloTowerCalib look good to me, even this time saving continue statement, nice!
It will take me some time to review the rest of the code though. I don't think we want to make any changes that would effect the event plane in the 2024 auau data until after the Initial Stages push. In the meantime, if there aspects of the calibration code that we want to get into coresoftware (that doesn't effect the core functionality of the EPD), that would be super beneficial use of this time.

@largewedge
Copy link
Contributor Author

largewedge commented Aug 18, 2025

Could you clarify a bit about what you mean by the "initial stages" @bseidlit ? I assume that you mean something like an incremental rollout of the changes to sEPD software, where we would make the new code available alongside EpdReco and EpdGeom and would only push changes to the production macros once all of the changes have been pushed. Is that right? Edit: disregard, I realize now that you are talking about the upcoming conference

Also, the converted calibration file that works with CaloTowerCalib is available at /sphenix/user/ecroft/sEPD_condor/calibrations/sEPD_CalibConstants_CDB_Run71504_converted.root. I've tested it with run 71738 and produced a few plots to validate that the N_MIP distributions look like what we expect.
Screenshot from 2025-08-18 11-25-06
.

@bseidlit
Copy link
Contributor

GreatYes, I think we don't want to change the core functionality of the EPD for like 2-3 weeks. Is the code that produces these calibrations on git. If not, you could work on getting that into coresoftware or macros PR'ed and merged b.c. that won't effect the reconstruction but is also necessary.

@largewedge largewedge force-pushed the sepd-caloreco-integration branch from 77671e3 to 44b52ae Compare November 17, 2025 15:25
@largewedge largewedge marked this pull request as ready for review November 17, 2025 16:10
@sphenix-jenkins-ci
Copy link

Build & test report

Report for commit 77671e33bf96e869243b1f16719ace73404ea711:
Jenkins on fire


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@sphenix-jenkins-ci
Copy link

Build & test report

Report for commit 44b52ae908fe3910a456dd3a18b013dab0cb4b5b:
Jenkins on fire


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

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.

3 participants