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

Updated Exceptions for SIM step #36717

Merged
merged 2 commits into from Jan 17, 2022
Merged

Conversation

civanch
Copy link
Contributor

@civanch civanch commented Jan 16, 2022

PR description:

In this PR unification of Exception scheme for SIM step is provided. During initialization cms::Exception is used. In run time G4Exception instead. G4Exception is customized by ExceptionHandler provided in CMSSW, which is using cms::Exception. For debug purpose a user may enable Geant4 trace if g4SimHits variable Trace=True.

This PR should not change results successful WFs but may be useful for debugging of SIM problems.

PR validation:

private

if this PR is a backport please specify the original PR and why you need to backport that PR: NO

@civanch
Copy link
Contributor Author

civanch commented Jan 16, 2022

please test

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-36717/27809

  • This PR adds an extra 40KB to repository

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @civanch (Vladimir Ivantchenko) for master.

It involves the following packages:

  • SimG4Core/Application (simulation)
  • SimG4Core/Notification (simulation)
  • SimG4Core/SensitiveDetector (simulation)

@civanch, @mdhildreth can you please review it and eventually sign? Thanks.
@makortel, @cvuosalo, @rovere, @bsunanda, @fabiocos, @slomeo this is something you requested to watch as well.
@perrotta, @dpiparo, @qliphy you are the release manager for this.

cms-bot commands are listed here

@cmsbuild cmsbuild mentioned this pull request Jan 16, 2022
@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-c09a88/21744/summary.html
COMMIT: a3f6189
CMSSW: CMSSW_12_3_X_2022-01-16-0000/slc7_amd64_gcc10
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/36717/21744/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: 2 differences found in the comparisons
  • DQMHistoTests: Total files compared: 43
  • DQMHistoTests: Total histograms compared: 3464734
  • DQMHistoTests: Total failures: 5
  • DQMHistoTests: Total nulls: 1
  • DQMHistoTests: Total successes: 3464706
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.004 KiB( 42 files compared)
  • DQMHistoSizes: changed ( 312.0 ): 0.004 KiB MessageLogger/Warnings
  • Checked 181 log files, 42 edm output root files, 43 DQM output files
  • TriggerResults: no differences found

@civanch
Copy link
Contributor Author

civanch commented Jan 16, 2022

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

@perrotta
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit e58b02b into cms-sw:master Jan 17, 2022
Copy link
Contributor

@perrotta perrotta left a comment

Choose a reason for hiding this comment

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

@civanch sorry for the late reaction of mine, but could you please comment about what below (and also provide a fix, if you deem it needed)?

#include "G4PrimaryParticle.hh"

const GenParticleInfo &GenParticleInfoExtractor::operator()(const G4PrimaryParticle *p) const {
G4VUserPrimaryParticleInformation *up = p->GetUserInformation();
if (up == nullptr)
throw SimG4Exception("GenParticleInfoExtractor: G4PrimaryParticle has no user information");
G4Exception("SimG4Core/Notification",
Copy link
Contributor

Choose a reason for hiding this comment

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

Uhm, I was too fast in signing this before inspecting the static analyzer report.

In the previous code if up == nullptr we were throwing here. Now, there is this G4Exception (is it also throwing?), and therefore a null reference can possibly be returned by this method. Is it this the case? Is it the expected/wanted behaviour?

@@ -21,3 +21,13 @@ TrackInformation &TrackInformationExtractor::operator()(G4Track &gtk) const {
wrongType();
return *tkInfo;
}

void TrackInformationExtractor::missing(const G4Track &) const {
G4Exception(
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here: not throwing here would make operator() return a null pointer

}

void TrackInformationExtractor::wrongType() const {
G4Exception(
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here: not throwing here would make operator() return a null pointer

@civanch
Copy link
Contributor Author

civanch commented Jan 17, 2022

@perrotta , I will do the next PR. It is a typical situation with static analyzer and G4Exception - G4 throwing an exception but the static analyzer do not know about. With simple tricks this may be avoided.

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

3 participants