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
Conversation
please test |
+code-checks Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-36717/27809
|
A new Pull Request was created by @civanch (Vladimir Ivantchenko) for master. It involves the following packages:
@civanch, @mdhildreth can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
+1 Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-c09a88/21744/summary.html Comparison SummarySummary:
|
+1 |
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) |
+1 |
There was a problem hiding this 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", |
There was a problem hiding this comment.
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 >k) const { | |||
wrongType(); | |||
return *tkInfo; | |||
} | |||
|
|||
void TrackInformationExtractor::missing(const G4Track &) const { | |||
G4Exception( |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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
@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. |
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