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

Fix use-after-move in L1MuDTTrackFinder, and some additional modernization #40411

Merged
merged 6 commits into from Jan 4, 2023

Conversation

makortel
Copy link
Contributor

PR description:

This PR fixes a use-after-move of edm::ConsumesCollector in L1MuDTTrackFinder::setup() that was reported by the static analyzer. While doing that I made some additional modernization to the code

  • replaced owning raw pointers with std::unique_ptr
  • removed unnecessary virtual function specifiers (nothing inherits from the affected classes)
  • made config() a non-static member function (nothing required it to be static)
  • replaced explicit loops over iterators with range-based for loop

PR validation:

Code compiles

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-40411/33538

  • This PR adds an extra 24KB to repository

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @makortel (Matti Kortelainen) for master.

It involves the following packages:

  • L1Trigger/DTTrackFinder (l1)

@epalencia, @cmsbuild, @cecilecaillol, @rekovic can you please review it and eventually sign? Thanks.
@Martin-Grunewald, @missirol, @JanFSchulte this is something you requested to watch as well.
@perrotta, @dpiparo, @rappoccio you are the release manager for this.

cms-bot commands are listed here

@makortel
Copy link
Contributor Author

@cmsbuild, please test


std::vector<L1MuDTTrackCand>& getcache0() { return _cache0; }

std::vector<L1MuRegionalCand>& getcache() { return _cache; }

private:
/// run Track Finder and store candidates in cache
virtual void reconstruct(const edm::Event& e, const edm::EventSetup& c) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This function appeared to be unused so I removed it.

Comment on lines 162 to -191
if (m_config->Debug(2))
cout << "running " << (*it_sp).second->id() << endl;
if ((*it_sp).second)
(*it_sp).second->run(bx, e, c);
if (m_config->Debug(2) && (*it_sp).second)
(*it_sp).second->print();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This pattern of

if (debug)
  // access ptr
if (ptr)
  // access ptr
if (debug && ptr)
  // access ptr

seems to repeat in this file many times. Given how the vectors and the map are filled, there should not be any nullptr entries, and therefore the if (ptr) check seems redundant. Also the nullness is not checked in the first if, so the code would (likely) crash anyway if, for any reason, the ptr would be null. Could this pattern be replaced with just

if (debug)
  // access ptr
// access ptr
if (debug)
  // access ptr

?

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-0199bd/29776/summary.html
COMMIT: 3f7b803
CMSSW: CMSSW_13_0_X_2022-12-28-1100/el8_amd64_gcc11
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/40411/29776/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 8 differences found in the comparisons
  • DQMHistoTests: Total files compared: 49
  • DQMHistoTests: Total histograms compared: 3555748
  • DQMHistoTests: Total failures: 3
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3555723
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 48 files compared)
  • Checked 211 log files, 162 edm output root files, 49 DQM output files
  • TriggerResults: no differences found

@cecilecaillol
Copy link
Contributor

+l1

@cmsbuild
Copy link
Contributor

cmsbuild commented Jan 4, 2023

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. @perrotta, @dpiparo, @rappoccio (and backports should be raised in the release meeting by the corresponding L2)

@perrotta
Copy link
Contributor

perrotta commented Jan 4, 2023

+1

@cmsbuild cmsbuild merged commit 287f4db into cms-sw:master Jan 4, 2023
@makortel makortel deleted the fixMoveL1MuDTTrackFinder branch January 4, 2023 14:52
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.

None yet

4 participants