Skip to content

Upstream muon collider calo digis.#253

Draft
aloeliger wants to merge 1 commit intoHEP-FCC:mainfrom
aloeliger:k4_muonColliderRebase_caloDigis
Draft

Upstream muon collider calo digis.#253
aloeliger wants to merge 1 commit intoHEP-FCC:mainfrom
aloeliger:k4_muonColliderRebase_caloDigis

Conversation

@aloeliger
Copy link
Copy Markdown

@aloeliger aloeliger commented Apr 24, 2026

This is the second of some amount smaller PRs, designed to split up PR key4hep/k4Reco#50 into more manageable pieces. This PR includes changes to calorimeter digis used by the muon collider project in k4Reco, but being redirected here (see: key4hep/k4Reco#51 (comment)). The original work was done by @samf25. I have renamed CaloDigi to RecCaloDigi to try and fit what I guess is the naming theme here, but I am entirely flexible on this point. The CMake file was added by me (although written by Claude, my CMake is still rudimentary at best) based on what seems to be the CMake architecture of this repository, with each distinct directory having it's own file. This CMake file works for me and compiles completely on lxplus using the latest nightly release.

As before, this is largely being opened for discussion to start the process of muon collider forks, if the ultimate PR requires a selected subset of these changes, that is something that can be discussed. This PR is being opened in draft because this is not strictly a key4hep repository, and I am not sure that this is a dependency the muon collider would like to add.

@tmadlener @madbaron @samf25, FYI

BEGINRELEASENOTES

  • Add muon collider calo digi work originally from k4Reco
    ENDRELEASENOTES

Copy link
Copy Markdown
Collaborator

@tmadlener tmadlener left a comment

Choose a reason for hiding this comment

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

I don't have enough permissions here to actually launch workflows and I also didn't yet have time to actually look into the code in a lot of detail. I am very happy that this pulls over the RealisticCalo{Digi,Reco} family of processors though.

Having said that, we had quite some discussion in the Key4hep meeting on March 31 and one of the key outcomes was that we should try to avoid algorithm names like realistic or detailed but rather go for more descriptive algorithm names. I don't have an immediate idea for this family of algorithms, unfortunately.

@tmadlener
Copy link
Copy Markdown
Collaborator

Question (most likely to @samf25): Are these direct translations of the one from https://github.com/iLCSoft/MarlinReco/tree/master/CaloDigi/Realistic, or have there been MuonCollider specific changes applied to these?

@madbaron
Copy link
Copy Markdown

I'm pretty sure these are 1:1 translations

Copy link
Copy Markdown
Collaborator

@tmadlener tmadlener left a comment

Choose a reason for hiding this comment

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

Thanks a lot for starting this (and apologies up-front for once again being a bit pedantic and requesting quite a few changes).

CI is failing due to a sign comparison warning at the moment. Additionally, after #237 this will likely need some clang-format formatting to comply again.

There are a few general themes in the comments, but in general this looks pretty good to me already. The one thing that we will need to fix is the naming. Still no really good idea, as a basis for discussion:

  • RealisticCaloDigi (base class) -> ElectronicsSignalDigi (maybe include a Base suffix as well?)
  • RealisticCaloReco (base class) -> ElectronicsSignalReco

(and then similar for the others). This is all up for discussion, these are just some initial proposals, maybe others have better ideas.

Finally, there is quite some documentation about this here: https://github.com/iLCSoft/MarlinReco/tree/master/CaloDigi/Realistic/doc After all my proposed changes that is probably no longer accurate (or even less accurate than it is now), so my suggestion would be to bring that over in a separate PR, because it's also not entirely clear to me where that should go.


#include <iostream>

/** Helper class for decoding/encoding lcio::CalorimeterHit types for the ILD
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@jmcarcell we already have this in k4GaudiPandora, right? Can we somehow make this available to both without having to copy things?

On a bigger picture, this looks like something that we should potentially revisit (also @BrieucF) as it is very much geared towards CALICE like detectors, resp. ILC / CLIC conventions and might fall apart with other CellID encoding strings.

Hence, also connected to key4hep/k4geo#568

Comment on lines +31 to +32
struct FilterDoubleLayerHits : public k4FWCore::Transformer<edm4hep::TrackerHitPlaneCollection(
const edm4hep::TrackerHitPlaneCollection &)> {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This looks like it is more tracking related (and then should probably go to https://github.com/key4hep/k4RecTracker).

Without having looked into any details about its usage yet, why is it in this PR?

Comment on lines +51 to +53
/** Called after data processing for clean up.
*/
StatusCode finalize();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
/** Called after data processing for clean up.
*/
StatusCode finalize();

This doesn't seem to do anything (in the implementation file).

Comment on lines +63 to +69
using integr_function = std::function<integr_res_opt(const edm4hep::SimCalorimeterHit*)>;

virtual float EnergyDigi(float energy, float event_correl_miscalib) const;
virtual integr_res_opt Integrate( const edm4hep::SimCalorimeterHit * hit ) const;

integr_res_opt StandardIntegration( const edm4hep::SimCalorimeterHit * hit ) const ;
integr_res_opt ROCIntegration( const edm4hep::SimCalorimeterHit * hit ) const ;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

All of these functions can just take the edm4hep::SimCalorimeterHit by value or const reference. There is no need to turn it into a pointer (which was probably done because in LCIO you only get pointers).

Additionally (also due to where this comes from likely), these functions should probably be camel cased to follow our usual conventions.

using integr_res_opt = std::optional<integr_res>;
using integr_function = std::function<integr_res_opt(const edm4hep::SimCalorimeterHit*)>;

virtual float EnergyDigi(float energy, float event_correl_miscalib) const;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't think this is used in a way that requires it to be virtual. All inheriting classes implement the virtual functions below.

Suggested change
virtual float EnergyDigi(float energy, float event_correl_miscalib) const;
float EnergyDigi(float energy, float event_correl_miscalib) const;

Comment on lines +41 to +43
std::string initString;
initString = m_geoSvc->constantAsString(m_encodingStringVariable.value());
dd4hep::DDSegmentation::BitFieldCoder bitFieldCoder(initString); // check!
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can also go to a member variable and then be populated once in initialize.

Comment on lines +36 to +45
RecCaloDigi
Gaudi::GaudiKernel
EDM4HEP::edm4hep
k4FWCore::k4FWCore
k4FWCore::k4Interface
DD4hep::DDCore
DD4hep::DDRec
ROOT::Core
ROOT::Hist
CLHEP::Random
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In principle many of these dependencies are transitively pulled in via RecCaloDigi, but I have nothing against being explicit here.

} else if (m_threshold_unit.value().compare("px") == 0){
m_threshold_iunit=NPE;
} else {
error() << "could not identify threshold unit. Please use \"GeV\", \"MIP\" or \"px\"! Aborting." << endmsg;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This does not abort yet. It would have to return a StatusCode::FAILURE for that.

Comment on lines +70 to +72
error() << "Could not guess timing calculation method!" << endmsg;
error() << "Available are: Standard, ROC. Provided: " << m_integration_method << endmsg;
error() << "Aborting..." << endmsg;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

also not aborting

Comment on lines +79 to +80
error() << "Fast/slow shaper parameter(s) not set. Required for ROC integration!" << endmsg;
error() << "Aborting..." << endmsg;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

and once more, not aborting.

@madbaron
Copy link
Copy Markdown

madbaron commented Apr 29, 2026

The one thing that we will need to fix is the naming. Still no really good idea, as a basis for discussion:

  • RealisticCaloDigi (base class) -> ElectronicsSignalDigi (maybe include a Base suffix as well?)
  • RealisticCaloReco (base class) -> ElectronicsSignalReco

(and then similar for the others).

Personally I'm not 100% clear on why the second step is referred to as reco. I overall find it a bit misleading, since all this algorithm does is converting an absolute MIP scale into a particle level energy calibration.

Perhaps one could refer these two as:

  • BaseDigitiser
  • BaseCellEnergyCalibrator
    or something along these lines?

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