Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt Alpaka-based PF Clustering to read Hcal thresholds from GT #43574

Merged
merged 4 commits into from
Dec 19, 2023

Conversation

jsamudio
Copy link
Contributor

PR description:

This is a follow up to #43130. It is the adaptation of the Alpaka-based PFRecHitSoAProducer and PFClusterSoAProducer to read Hcal thresholds from GT similar to #43025. Included are some fixes to naming conventions that were missed in the initial implementation of #43130.

PR validation:

PR was validated using local testing of cluster-level comparison and PF Jet Response comparison as in #43130. The results are consistent between Alpaka and Legacy for the entire variety of configurations: Alpaka CPU and GPU backends with usePFThresholdsFromDB set to true or false.

The basic suite of tests, runTheMatrix.py -l limited -i all --ibeos, has also been passed.

If this PR is a backport please specify the original PR and why you need to backport that PR. If this PR will be backported please specify to which release cycle the backport is meant for:

PR is not a backport.

@hatakeyamak @swagata87

@cmsbuild cmsbuild added this to the CMSSW_14_0_X milestone Dec 14, 2023
@cmsbuild
Copy link
Contributor

cmsbuild commented Dec 14, 2023

cms-bot internal usage

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-43574/38207

  • This PR adds an extra 52KB to repository

@cmsbuild
Copy link
Contributor

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

It involves the following packages:

  • DataFormats/ParticleFlowReco (reconstruction)
  • RecoParticleFlow/PFClusterProducer (reconstruction)
  • RecoParticleFlow/PFRecHitProducer (reconstruction)

@cmsbuild, @jfernan2, @mandrenguyen can you please review it and eventually sign? Thanks.
@felicepantaleo, @seemasharmafnal, @missirol, @ebrondol, @lgray, @mmarionncern, @sameasy, @rovere, @hatakeyamak this is something you requested to watch as well.
@sextonkennedy, @rappoccio, @antoniovilela you are the release manager for this.

cms-bot commands are listed here

@swagata87
Copy link
Contributor

type pf

@jfernan2
Copy link
Contributor

assign heterogeneous

@cmsbuild
Copy link
Contributor

New categories assigned: heterogeneous

@fwyzard,@makortel you have been requested to review this Pull request/Issue and eventually sign? Thanks

@@ -14,6 +14,7 @@ namespace reco {
using PFRecHitsNeighbours = Eigen::Matrix<int32_t, 8, 1>;
GENERATE_SOA_LAYOUT(PFRecHitSoALayout,
SOA_COLUMN(uint32_t, detId),
SOA_COLUMN(uint32_t, denseId),
Copy link
Contributor

Choose a reason for hiding this comment

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

I see where this is stored (PFRecHitProducerKernel.dev.cc lines 100 and 118), but where is it used ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Used to set the threshold for the PFRecHit later in PFClusterSoAProducerKernel.dev.cc.

Comment on lines -12 to +17
SOA_SCALAR(float, seedPt2ThresholdEB),
SOA_SCALAR(float, seedPt2ThresholdEE),
SOA_COLUMN(float, seedEThresholdEB_vec),
SOA_COLUMN(float, seedEThresholdEE_vec),
SOA_COLUMN(float, topoEThresholdEB_vec),
SOA_COLUMN(float, topoEThresholdEE_vec),
SOA_SCALAR(float, seedPt2ThresholdHB),
SOA_SCALAR(float, seedPt2ThresholdHE),
SOA_COLUMN(float, seedEThresholdHB_vec),
SOA_COLUMN(float, seedEThresholdHE_vec),
SOA_COLUMN(float, topoEThresholdHB_vec),
SOA_COLUMN(float, topoEThresholdHE_vec),
Copy link
Contributor

Choose a reason for hiding this comment

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

are these variable specific to HCAL ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.

@@ -65,6 +70,7 @@ class LegacyPFClusterProducer : public edm::stream::EDProducer<> {
desc.add<edm::InputTag>("PFRecHitsLabelIn");
desc.add<edm::ESInputTag>("pfClusterParams");
desc.add<edm::InputTag>("recHitsSource");
desc.add<bool>("usePFThresholdsFromDB", "True");
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this be

Suggested change
desc.add<bool>("usePFThresholdsFromDB", "True");
desc.add<bool>("usePFThresholdsFromDB", true);

?

@@ -180,12 +186,18 @@ class LegacyPFClusterProducer : public edm::stream::EDProducer<> {
const edm::ESGetToken<reco::PFClusterParamsHostCollection, JobConfigurationGPURecord> pfClusParamsToken_;
const edm::EDPutTokenT<reco::PFClusterCollection> legacyPfClustersToken_;
const edm::EDGetTokenT<reco::PFRecHitCollection> recHitsLabel_;
const edm::ESGetToken<HcalPFCuts, HcalPFCutsRcd> hcalCutsToken_;
bool cutsFromDB;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
bool cutsFromDB;
const bool cutsFromDB_;

Comment on lines 46 to 47
hcalCutsToken_(esConsumes<HcalPFCuts, HcalPFCutsRcd>(edm::ESInputTag("", "withTopo"))) {
cutsFromDB = config.getParameter<bool>("usePFThresholdsFromDB");
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
hcalCutsToken_(esConsumes<HcalPFCuts, HcalPFCutsRcd>(edm::ESInputTag("", "withTopo"))) {
cutsFromDB = config.getParameter<bool>("usePFThresholdsFromDB");
hcalCutsToken_(esConsumes<HcalPFCuts, HcalPFCutsRcd>(edm::ESInputTag("", "withTopo"))),
cutsFromDB_(config.getParameter<bool>("usePFThresholdsFromDB")) {

Comment on lines 198 to 200
if (cutsFromDB) {
paramPF = &setup.getData(hcalCutsToken_);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be a local variable, it doesn't need to be a member variable:

Suggested change
if (cutsFromDB) {
paramPF = &setup.getData(hcalCutsToken_);
}
HcalPFCuts const* paramPF = cutsFromDB_ ? &setup.getData(hcalCutsToken_) : nullptr;

Comment on lines 41 to 44
if constexpr (std::is_same_v<CAL, HCAL>)
desc.add<bool>("usePFThresholdsFromDB", "True");
else // only needs to be true for HBHE
desc.add<bool>("usePFThresholdsFromDB", "False");
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if constexpr (std::is_same_v<CAL, HCAL>)
desc.add<bool>("usePFThresholdsFromDB", "True");
else // only needs to be true for HBHE
desc.add<bool>("usePFThresholdsFromDB", "False");
if constexpr (std::is_same_v<CAL, HCAL>)
desc.add<bool>("usePFThresholdsFromDB", true);
else // only needs to be true for HBHE
desc.add<bool>("usePFThresholdsFromDB", false);

rhENormInv = 0.;
printf("Rechit %d has invalid layer %d!\n", i, pfRecHits[i].layer());
if (topology.cutsFromDB()) {
rhENormInv = (1. / topology[pfRecHits[i].denseId()].noiseThreshold());
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
rhENormInv = (1. / topology[pfRecHits[i].denseId()].noiseThreshold());
rhENormInv = (1.f / topology[pfRecHits[i].denseId()].noiseThreshold());

should avoid to do the division in double precision.

Can you check if the results are OK ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Validation looks okay when I make this change.

printf("Rechit %d has invalid layer %d!\n", i, pfRecHits[i].layer());

if (topology.cutsFromDB()) {
rhENormInv = (1. / topology[pfRecHits[i].denseId()].noiseThreshold());
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
rhENormInv = (1. / topology[pfRecHits[i].denseId()].noiseThreshold());
rhENormInv = (1.f / topology[pfRecHits[i].denseId()].noiseThreshold());

@fwyzard
Copy link
Contributor

fwyzard commented Dec 15, 2023

From the @cms-sw/heterogeneous-l2 point of view, the only comment I have is about using 1.f / ... instead of 1. / ..., to avoid doing the division in double precisions - unless the validation shows that it is necessary to do so.

The others are general C++ and CMSSW comments.

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-43574/38226

  • This PR adds an extra 52KB to repository

@cmsbuild
Copy link
Contributor

Pull request #43574 was updated. @makortel, @cmsbuild, @fwyzard, @jfernan2, @mandrenguyen can you please check and sign again.

@fwyzard
Copy link
Contributor

fwyzard commented Dec 16, 2023

+heterogeneous

@fwyzard
Copy link
Contributor

fwyzard commented Dec 16, 2023

please test

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-f64c79/36530/summary.html
COMMIT: a24b7e4
CMSSW: CMSSW_14_0_X_2023-12-16-1100/el8_amd64_gcc12
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/43574/36530/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • You potentially removed 22 lines from the logs
  • Reco comparison results: 9 differences found in the comparisons
  • DQMHistoTests: Total files compared: 50
  • DQMHistoTests: Total histograms compared: 3429858
  • DQMHistoTests: Total failures: 6
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3429830
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 49 files compared)
  • Checked 214 log files, 167 edm output root files, 50 DQM output files
  • TriggerResults: no differences found

@jfernan2
Copy link
Contributor

+1

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next master IBs (tests are also fine). This pull request will now be reviewed by the release team before it's merged. @antoniovilela, @sextonkennedy, @rappoccio (and backports should be raised in the release meeting by the corresponding L2)

@antoniovilela
Copy link
Contributor

+1

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