Skip to content

Conversation

@igv4321
Copy link
Contributor

@igv4321 igv4321 commented Dec 5, 2025

PR description:

Adding infrastructure for modeling HCAL front-end pulse shapes channel-by-channel. This PR superseeds #45995

Naturally, db-based pulse shapes are not enabled yet (they are not in the CMS database), so no changes in validation expected at the moment.

PR validation:

The usual matrix tests were run. The facilities for reading/writing the database tables were privately tested. I need somebody with right permissions to take the file CondTools/Hcal/test/hcalpulsedelays.txt and copy it into a directory where it can be found by "edmFileInPath". Then I will be able to turn on the unit test for the database table of pulse height delays.

@cmsbuild
Copy link
Contributor

cmsbuild commented Dec 5, 2025

cms-bot internal usage

@cmsbuild
Copy link
Contributor

cmsbuild commented Dec 5, 2025

-code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49556/47076

Code check has found code style and quality issues which could be resolved by applying following patch(s)

@cmsbuild
Copy link
Contributor

cmsbuild commented Dec 5, 2025

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49556/47077

@cmsbuild
Copy link
Contributor

cmsbuild commented Dec 5, 2025

A new Pull Request was created by @igv4321 for master.

It involves the following packages:

  • CalibCalorimetry/HcalAlgos (alca)
  • CalibCalorimetry/HcalPlugins (alca)
  • CondCore/HcalPlugins (db)
  • CondCore/Utilities (db)
  • CondFormats/DataRecord (alca, db)
  • CondFormats/HcalObjects (alca, db)
  • CondTools/Hcal (db)
  • DataFormats/HcalRecHit (reconstruction)
  • RecoLocalCalo/Configuration (reconstruction)
  • RecoLocalCalo/HcalRecAlgos (reconstruction)
  • RecoLocalCalo/HcalRecProducers (reconstruction)

@Alejandro1400, @JanChyczynski, @arunhep, @atpathak, @cmsbuild, @francescobrivio, @jfernan2, @mandrenguyen, @perrotta, @srimanob can you please review it and eventually sign? Thanks.
@JanChyczynski, @PonIlya, @ReyerBand, @abdoulline, @apsallid, @argiro, @bsunanda, @denizsun, @mariadalfonso, @missirol, @mmusich, @rchatter, @rovere, @rsreds, @salimcerci, @sameasy, @seemasharmafnal, @thomreis, @tocheng, @wang0jin, @youyingli, @yuanchao this is something you requested to watch as well.
@ftenchini, @mandrenguyen, @sextonkennedy you are the release manager for this.

cms-bot commands are listed here

@mmusich
Copy link
Contributor

mmusich commented Dec 5, 2025

I need somebody with right permissions to take the file CondTools/Hcal/test/hcalpulsedelays.txt and copy it into a directory where it can be found by "edmFileInPath". Then I will be able to turn on the unit test for the database table of pulse height delays.

you can make yourself a PR to this repository https://github.com/cms-data/CondTools-Hcal and then the two PRs can be tested together.

@fwyzard
Copy link
Contributor

fwyzard commented Dec 5, 2025

@igv4321 do the changes need to be propagated to the heterogeneous version of the code under CondFormats/HcalObjects, RecoLocalCalo/HcalRecAlgos and RecoLocalCalo/HcalRecProducers` ?

@igv4321
Copy link
Contributor Author

igv4321 commented Dec 5, 2025

@igv4321 do the changes need to be propagated to the heterogeneous version of the code under CondFormats/HcalObjects, RecoLocalCalo/HcalRecAlgos and RecoLocalCalo/HcalRecProducers` ?

It would be nice to propagate them, but HCAL DPG does not have an alpaka expert at the moment. But even if just for offline, this capability is very useful.

@cmsbuild
Copy link
Contributor

cmsbuild commented Dec 5, 2025

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49556/47083

@cmsbuild
Copy link
Contributor

cmsbuild commented Dec 5, 2025

Pull request #49556 was updated. @Alejandro1400, @JanChyczynski, @arunhep, @atpathak, @cmsbuild, @francescobrivio, @jfernan2, @mandrenguyen, @perrotta, @srimanob can you please check and sign again.

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49556/47239

@cmsbuild
Copy link
Contributor

Pull request #49556 was updated. @Alejandro1400, @JanChyczynski, @Moanwar, @arunhep, @atpathak, @cmsbuild, @francescobrivio, @jfernan2, @mandrenguyen, @perrotta, @srimanob can you please check and sign again.

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-49556/47240

@cmsbuild
Copy link
Contributor

Pull request #49556 was updated. @Alejandro1400, @JanChyczynski, @Moanwar, @arunhep, @atpathak, @cmsbuild, @francescobrivio, @jfernan2, @mandrenguyen, @perrotta, @srimanob can you please check and sign again.

@jhakala
Copy link
Contributor

jhakala commented Dec 19, 2025

please test with cms-data/CondTools-Hcal#2

@cmsbuild
Copy link
Contributor

+1

Size: This PR adds an extra 16KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-aff5bd/50377/summary.html
COMMIT: 7701f59
CMSSW: CMSSW_16_1_X_2025-12-19-1100/el8_amd64_gcc13
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/49556/50377/install.sh to create a dev area with all the needed externals and cmssw changes.

The following merge commits were also included on top of IB + this PR after doing git cms-merge-topic:

You can see more details here:
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-aff5bd/50377/git-recent-commits.json
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-aff5bd/50377/git-merge-result

Comparison Summary

There are some workflows for which there are errors in the baseline:
250202.181 step 3
The results for the comparisons for these workflows could be incomplete
This means most likely that the IB is having errors in the relvals.The error does NOT come from this pull request

The workflows 2024.0070001 have different files in step1_dasquery.log than the ones found in the baseline. You may want to check and retrigger the tests if necessary. You can check it in the "files" directory in the results of the comparisons

Summary:

  • You potentially added 114 lines to the logs
  • ROOTFileChecks: Some differences in event products or their sizes found
  • Reco comparison results: 4070 differences found in the comparisons
  • Reco comparison had 4 failed jobs
  • DQMHistoTests: Total files compared: 53
  • DQMHistoTests: Total histograms compared: 4280391
  • DQMHistoTests: Total failures: 5013
  • DQMHistoTests: Total nulls: 42
  • DQMHistoTests: Total successes: 4275316
  • DQMHistoTests: Total skipped: 20
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 34.7 KiB( 52 files compared)
  • DQMHistoSizes: changed ( 18434.0,... ): 17.115 KiB HLT/TAU
  • DQMHistoSizes: changed ( 18434.0,... ): 0.939 KiB HLT/Filters
  • DQMHistoSizes: changed ( 2024.0070001 ): -1.418 KiB Hcal/DigiRunHarvesting
  • DQMHistoSizes: changed ( 2024.0070001 ): 0.059 KiB SiStrip/MechanicalView
  • DQMHistoSizes: changed ( 2024.0070001 ): -0.035 KiB RPC/DCSInfo
  • DQMHistoSizes: changed ( 2024.0070001 ): -0.016 KiB JetMET/SUSYDQM
  • Checked 227 log files, 198 edm output root files, 53 DQM output files
  • TriggerResults: no differences found

@perrotta
Copy link
Contributor

perrotta commented Jan 9, 2026

The facilities for reading/writing the database tables were privately tested.

@igv4321 could you please report a summary of those tests and their results in this github thread?

@igv4321
Copy link
Contributor Author

igv4321 commented Jan 9, 2026

There is a set of instructions describing the format of pulse shape representations and the tools used to make mysql files out of them in the file CondTools/Hcal/test/readme_HcalInterpolatedPulseMap.txt. It was checked that all operations described in these instructions work as intended.

@jhakala
Copy link
Contributor

jhakala commented Jan 16, 2026

Hi all, just a ping on this PR. HCAL DPG would very much like to see this move forward.

@JanChyczynski
Copy link
Contributor

I'm working on the review already. I'll post first comments soon

Copy link
Contributor

@JanChyczynski JanChyczynski left a comment

Choose a reason for hiding this comment

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

A partial review for now, I have mostly only looked at the CondTools package.

Copy link
Contributor

Choose a reason for hiding this comment

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

There are several problems with this file (and related HcalPulseDelaysHandler):

  1. Defnining duplicate members m_source and m_populator results in 2 separate instances of these fields (e.g. HcalPulseDelaysPopConAnalyzer::m_source and PopConAnalyzer::m_source ). Its not a proper use of inheritance and is dangerous and error-prone with any future changes (eg. access to m_source from the base PopConAnalyzer will access a different instance of the source).
  2. Re-implementing write() is a (potentially unecessary) code duplication
  3. myDBObject should not be defined as a raw pointer. Running HcalPulseDelaysPopConAnalyzer.analyze mutliple times (i.e. for multiple events) would result with a memory leak. It would be much better to use unique_ptr and std::move when calling source.initObject() to transfer the ownership. Accordingly initObject() should take a unique_ptr as the parameter to express taking ownership.

I've noticed 40 other PopConAnalyzers in CondTools/Hcal are defined this way. It is beyond the scope of this PR to change the existing classes, so I would suggest to implement the new one in a better way and add a comment to all the existing classes with this design mentioning the problem so this pattern is not copied in the future and the newly added class should be referenced instead. It would be good to add a github issue and mention it in the comment. If you want I can add the issue soon.

3. is easy to fix by changing myDbObject and the parameter of initObject to unique_ptr .

Because m_source, m_populator, write and endJob are private is tricky to fix point 1. and 2. My idea is to move source.initObject(myDBObject); to .analyze(...) . This would allow not to redefine write() and using source() getter would allow not to redefine m_source.

But I need you to confirm that this would result in the same logic and behaviour. The difference I see is that it would be then run for every event instead of once, in endJob() . From what I understand HcalPulseDelaysPopConAnalyzer (and other PopConAnalyzers with the same pattern) is not meant to be run for multiple events (as multiple execution of anaylze would result in a memory leak), thus this change of behaviour resulting from moving initObject to analyze is not a problem. If this is not appropriate, let me know and I'll present an alternative solution.

Below I provide a simplified DRAFT implementation with a TODO comment about the aforementioned doubt:

//note: simplified implementation, the final implementation needs to inherit from a template base class implementing this pattern.
class HcalPulseDelaysPopConAnalyzer : public popcon::PopConAnalyzer<HcalPulseDelaysHandler> {
public:
  typedef HcalPulseDelaysHandler SourceHandler;

  HcalPulseDelaysPopConAnalyzer(const edm::ParameterSet& pset)
      : popcon::PopConAnalyzer<HcalPulseDelaysHandler>(pset),
        m_token(esConsumes<HcalPulseDelays, HcalPulseDelaysRcd>()) {}

private:
  void analyze(const edm::Event& ev, const edm::EventSetup& esetup) override {
    // TODO confirm that all use cases are meant to have this run only once:
    // then throw exception if run more than once

    //Using ES to get the data:
    source().initObject(std::make_unique<HcalPulseDelays>(esetup.getData(m_token)));
  }

private:
  edm::ESGetToken<HcalPulseDelays, HcalPulseDelaysRcd> m_token;
};

Because the same problematic patter occurs in 40 other PopConAnalyzers it would be best to prepare a base class for these problematic classes with the fix implemented. I've prepared a draft PR with the implementation of that base class and an example of using it: #49905
Early next week I can finish and publish that PR and then you can base your classes on it. If you prefer you can also cherry pick the commit with the implementation of the base class (git cherry-pick https://github.com/cms-AlCaDB/cmssw.git <commit hash> ). Let me know what works better.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants