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 "Called C++ object pointer is null" in DDCoreToDDXMLOutput::position #46075

Merged
merged 1 commit into from
Sep 24, 2024

Conversation

iarspider
Copy link
Contributor

PR description:

LLVM Analyzer reports "Called C++ object pointer is null" in DDCoreToDDXMLOutput::position. This PR protects from this.

PR validation:

Bot tests

@iarspider
Copy link
Contributor Author

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Sep 20, 2024

cms-bot internal usage

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

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

It involves the following packages:

  • DetectorDescription/OfflineDBLoader (geometry)

@Dr15Jones, @bsunanda, @civanch, @kpedro88, @makortel, @mdhildreth can you please review it and eventually sign? Thanks.
@fabiocos, @martinamalberti this is something you requested to watch as well.
@antoniovilela, @mandrenguyen, @rappoccio, @sextonkennedy you are the release manager for this.

cms-bot commands are listed here

@cmsbuild
Copy link
Contributor

+1

Size: This PR adds an extra 20KB to repository
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-d66db4/41668/summary.html
COMMIT: 114e49a
CMSSW: CMSSW_14_2_X_2024-09-20-1100/el8_amd64_gcc12
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/46075/41668/install.sh to create a dev area with all the needed externals and cmssw changes.

Comparison Summary

Summary:

  • You potentially added 2 lines to the logs
  • Reco comparison results: 9 differences found in the comparisons
  • DQMHistoTests: Total files compared: 44
  • DQMHistoTests: Total histograms compared: 3331158
  • DQMHistoTests: Total failures: 8
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3331130
  • DQMHistoTests: Total skipped: 20
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 43 files compared)
  • Checked 193 log files, 163 edm output root files, 44 DQM output files
  • TriggerResults: no differences found

@@ -784,25 +784,27 @@ void DDCoreToDDXMLOutput::position(const TGeoVolume& parent,
xos << "<rChild name=\"" << childVolName << "\"/>" << std::endl;

const auto matrix = child.GetMatrix();
if (matrix != nullptr && !matrix->IsIdentity()) {
Copy link
Contributor

@civanch civanch Sep 21, 2024

Choose a reason for hiding this comment

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

@iarspider, if (matrix != nullptr && !matrix->IsIdentity()) is a valid construction. If the first check 'false' the second does not checked. This is used in many places, no reason to change this place. The fix should be done in place where position is called - matrix should not be nullptr. With the current change of indentation I cannot understand where and how - better to avoid such big modification.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

A rotation matrix may or may not be present in a transformation matrix. Sometimes a child is placed in a mother with no translation and no rotation. In Geant4 one needs to provide a translation vector with a default 3-vector for the translation matrix while in DD4hep one may specify the placement dropping reference to both translation and rotation

Copy link
Contributor

Choose a reason for hiding this comment

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

@bsunanda , should we review this code or accept this fix?

@civanch
Copy link
Contributor

civanch commented Sep 21, 2024

@bsunanda , normally in Geant4 it is allowed to have translations without rotation. In user code it is according to concrete use case. Potentially rotation may be nullptr but translation - not. Can you , please, comment on this PR? I agree with formal static analysis but am not sure this is what we want to have.

@civanch
Copy link
Contributor

civanch commented Sep 23, 2024

@bsunanda , we may approve this fix and make an issue to double check the logic of the code. Would it be a solution?

@bsunanda
Copy link
Contributor

bsunanda commented Sep 23, 2024 via email

@civanch
Copy link
Contributor

civanch commented Sep 23, 2024

+1

A new issue #46102 is created.

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

@mandrenguyen
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit 8e6c421 into cms-sw:master Sep 24, 2024
11 checks passed
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.

5 participants