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

[DD4hep] Prohibit use of undefined materials #36496

Merged
merged 4 commits into from Dec 17, 2021

Conversation

cvuosalo
Copy link
Contributor

@cvuosalo cvuosalo commented Dec 14, 2021

Our code allowed composite materials in the geometry to be defined out of order, but there was a subtle problem with the resolution of these materials. Also, it turned out that very few materials were defined out of order. It was decided to simply change the few cases of out-of-order material definitions rather than debug the complexities of supporting such definitions.

The re-ordering of material definitions was propagated to the DB geometry 1, so now we can change the code to simply prohibit out-of-order material definitions. This PR adds an exception if a material that was not yet defined is referenced in a geometry XML file.

The Phase 2 D77 scenario had one material that was defined out of order. This PR puts that definition in the correct order so D77 can be run with DD4hep.

A number of unit tests used obsolete materials files. This PR updates the versions of materials files in those tests so they don't generate the exception for out-of-order material definitions.

Going forward, the change in this PR should prevent the introduction into the geometry of any material definitions that are in the wrong order, provided any such geometry change is checked with DD4hep.

PR validation:

For Run 3, all materials are already defined in proper order, so this PR has no noticeable effect. A test was done with material definitions in the wrong order, and the exception was generated as desired.

With this PR, DD4hep Phase 2 D77 simulation runs successfully.

No backport is needed.

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-36496/27368

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @cvuosalo (Carl Vuosalo) for master.

It involves the following packages:

  • Configuration/Geometry (geometry, upgrade)
  • DetectorDescription/DDCMS (geometry)
  • Geometry/CMSCommonData (geometry, upgrade)

@civanch, @Dr15Jones, @makortel, @cvuosalo, @ianna, @mdhildreth, @cmsbuild, @AdrianoDee, @srimanob can you please review it and eventually sign? Thanks.
@missirol, @vargasa, @kpedro88, @Martin-Grunewald, @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

@cvuosalo
Copy link
Contributor Author

@cmsbuild please test

@civanch
Copy link
Contributor

civanch commented Dec 14, 2021

@cvuosalo , I think it is a very good approach to use exception in this case.

ns.context()->unresolvedMaterials[nam].emplace_back(
cms::DDParsingContext::CompositeMaterial(ns.prepend(fracname), fraction));
throw std::runtime_error("DD4CMS Exception -- Composite material \"" + fracname + "\" or \"" +
ns.prepend(fracname) + "\" not yet defined.");
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be cms::Exception?

@cmsbuild
Copy link
Contributor

-1

Failed Tests: UnitTests
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-eda0e3/21270/summary.html
COMMIT: 56a0f25
CMSSW: CMSSW_12_3_X_2021-12-14-1100/slc7_amd64_gcc900
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/36496/21270/install.sh to create a dev area with all the needed externals and cmssw changes.

Unit Tests

I found errors in the following unit tests:

---> test testDD4hepDDSolid had ERRORS
---> test DetectorDescriptionDDCMSTestDriver had ERRORS
---> test GeometryTrackerCommonDataTestDriver had ERRORS
---> test GeometryMuonCommonDataTestDriver had ERRORS
and more ...

Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 4 differences found in the comparisons
  • DQMHistoTests: Total files compared: 42
  • DQMHistoTests: Total histograms compared: 3250719
  • DQMHistoTests: Total failures: 6
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3250691
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 41 files compared)
  • Checked 177 log files, 37 edm output root files, 42 DQM output files
  • TriggerResults: no differences found

@cmsbuild
Copy link
Contributor

-code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-36496/27376

Code check has found code style and quality issues which could be resolved by applying following patch(s)

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-36496/27395

@cmsbuild
Copy link
Contributor

Pull request #36496 was updated. @civanch, @Dr15Jones, @makortel, @cvuosalo, @ianna, @mdhildreth, @cmsbuild, @AdrianoDee, @srimanob can you please check and sign again.

<Include ref="Geometry/TrackerCommonData/data/testDDPixBarLayerUpgradeAlgorithm.xml"/>
<Include ref="Geometry/CMSCommonData/data/materials/2015/v1/materials.xml"/>
<Include ref="Geometry/TrackerCommonData/data/trackermaterial.xml"/>
<Include ref="Geometry/CMSCommonData/data/materials/2021/v1/materials.xml"/>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

In this test data file, v1 of materials.xml needed to be used instead of the more recent v3.

@cvuosalo
Copy link
Contributor Author

@cmsbuild please test

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-eda0e3/21297/summary.html
COMMIT: 441da8b
CMSSW: CMSSW_12_3_X_2021-12-15-1100/slc7_amd64_gcc10
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/36496/21297/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: 0 differences found in the comparisons
  • DQMHistoTests: Total files compared: 42
  • DQMHistoTests: Total histograms compared: 3250719
  • DQMHistoTests: Total failures: 0
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3250697
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 41 files compared)
  • Checked 177 log files, 37 edm output root files, 42 DQM output files
  • TriggerResults: no differences found

@civanch
Copy link
Contributor

civanch commented Dec 16, 2021

+1

comments are addressed

@civanch
Copy link
Contributor

civanch commented Dec 17, 2021

@srimanob, can you, please, review this?

@srimanob
Copy link
Contributor

+Upgrade

Technical PR to handle material of DD4hep. No change is expected from this PR. The PR test runs fine.

@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

  • Technical

@cmsbuild cmsbuild merged commit 593eaff into cms-sw:master Dec 17, 2021
@qliphy
Copy link
Contributor

qliphy commented Dec 18, 2021

@cvuosalo

There are several unit test errors appearing after this PR merged. Could you have a check?

https://cmssdt.cern.ch/SDT/cgi-bin/logreader/slc7_amd64_gcc10/CMSSW_12_3_X_2021-12-17-2300/unitTestLogs/Geometry/TrackerGeometryBuilder#/54-54
https://cmssdt.cern.ch/SDT/cgi-bin/logreader/slc7_amd64_gcc10/CMSSW_12_3_X_2021-12-17-2300/unitTestLogs/MagneticField/Engine#/68-68
https://cmssdt.cern.ch/SDT/cgi-bin/logreader/slc7_amd64_gcc10/CMSSW_12_3_X_2021-12-17-2300/unitTestLogs/MagneticField/GeomBuilder#/44-44

dd4hep: Error interpreting XML nodes of type
dd4hep: Error interpreting XML nodes of type
----- Begin Fatal Exception 18-Dec-2021 01:38:55 CET-----------------------
An exception of category 'StdException' occurred while
[0] Processing Event run: 1 lumi: 1 event: 1 stream: 0
[1] Running path 'p1'
[2] Prefetching for module testMagneticField/'testMagneticField'
[3] Prefetching for EventSetup module DD4hep_VolumeBasedMagneticFieldESProducer/'VolumeBasedMagneticFieldESProducer'
[4] Prefetching for EventSetup module DDCompactViewMFESProducer/''
[5] Calling method for EventSetup module DDDetectorESProducer/''
Exception Message:
A std::exception was thrown.
An exception of category 'DD4CMS' occurred.
Exception Message:
Composite material "materials:Water" or "materials:Water" not yet defined.

@cvuosalo
Copy link
Contributor Author

@qliphy I will fix those unit tests. The fix should be simple.

@cvuosalo
Copy link
Contributor Author

@qliphy #36549 should fix the unit tests listed above.

cmsbuild added a commit that referenced this pull request Dec 20, 2021
[DD4hep] Follow-up to #36496 -- Update versions of materials files in unit tests
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

7 participants