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

Fixed and clean-up initialisation of Geant4 #27479

Merged
merged 5 commits into from Jul 12, 2019

Conversation

civanch
Copy link
Contributor

@civanch civanch commented Jul 10, 2019

PR description:

In this PR a fix of order of initialisation is introduced and clean up/optimisation:

  1. G4Regions and cuts should be initialized before physics list is created. This is the main fix of this PR, which provides correct initialisation of physics for special physics lists

  2. DDWorld class should not communicate with Geant4 kernel

  3. DDProductionCuts - memory churn is reduced (each G4Region and G4ProductionCuts is instantiated and filled only once)

  4. EM physics constructors are cleaned up

  5. Improved info messages and substituted G4cout by LogVerbatim

Should provide small reduction of memory churn and not change results of mainstream simulation.

PR validation:

Checked SIM hits with private test

if this PR is a backport please specify the original PR:

Before submitting your pull requests, make sure you followed this checklist:

@cmsbuild
Copy link
Contributor

The code-checks are being triggered in jenkins.

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-27479/10809

  • 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
SimG4Core/Geometry
SimG4Core/PhysicsLists

@cmsbuild, @civanch, @mdhildreth can you please review it and eventually sign? Thanks.
@makortel this is something you requested to watch as well.
@davidlange6, @slava77, @fabiocos you are the release manager for this.

cms-bot commands are listed here

@civanch
Copy link
Contributor Author

civanch commented Jul 10, 2019

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Jul 10, 2019

The tests are being triggered in jenkins.
https://cmssdt.cern.ch/jenkins/job/ib-run-pr-tests/1397/console Started: 2019/07/10 19:12

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

Comparison job queued.

@cmsbuild
Copy link
Contributor

Comparison is ready
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-25bc22/1397/summary.html

Comparison Summary:

  • No significant changes to the logs found
  • Reco comparison results: 37618 differences found in the comparisons
  • DQMHistoTests: Total files compared: 33
  • DQMHistoTests: Total histograms compared: 3160399
  • DQMHistoTests: Total failures: 117012
  • DQMHistoTests: Total nulls: 7
  • DQMHistoTests: Total successes: 3043046
  • DQMHistoTests: Total skipped: 334
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 2.629 KiB( 32 files compared)
  • DQMHistoSizes: changed ( 250202.181 ): -0.059 KiB SiStrip/MechanicalView
  • DQMHistoSizes: changed ( 10224.0 ): -0.288 KiB SiStrip/MechanicalView
  • DQMHistoSizes: changed ( 7.3 ): -2.132 KiB SiStrip/MechanicalView
  • DQMHistoSizes: changed ( 25202.0 ): 0.420 KiB SiStrip/MechanicalView
  • DQMHistoSizes: changed ( 8.0 ): 4.688 KiB SiStrip/MechanicalView
  • Checked 137 log files, 14 edm output root files, 33 DQM output files

@@ -302,6 +304,7 @@ void ParametrisedEMPhysics::ConstructProcess() {
ModifyTransportation(G4Positron::Positron(), nt, th1, th2);
ModifyTransportation(G4Proton::Proton(), nt, th1, th2);
}
G4cout << "ParametrisedEMPhysics::ConstructProcess() is done" << G4endl;
Copy link
Contributor

Choose a reason for hiding this comment

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

@civanch why inside CMSSW code do we use Geant4 messages?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@fabiocos , this is not 100% CMS code - it is an implementation of Geant4 derived class. G4cout is redirected to LogVerbatim, so it is equivalent. However, this may be changed.

Problem of this PR - sim history changed, this means that it is needed to understand why. I had a hope not break histories. The problem, which is fixed here is not obvious, more study required.

if (verbose > 1) {
G4cout << "CMSEmStandardPhysicsLPM: HcalRegion " << aRegion << G4endl;
G4cout << "CMSEmStandardPhysicsLPM: HGCalRegion " << bRegion << G4endl;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

same question here, I see also other older instances...

if (verbose > 1) {
G4cout << "CMSEmStandardPhysicsLPM: HcalRegion " << aRegion << G4endl;
G4cout << "CMSEmStandardPhysicsLPM: HGCalRegion " << bRegion << G4endl;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

here as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@fabiocos , done

@cmsbuild
Copy link
Contributor

The code-checks are being triggered in jenkins.

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-27479/10830

  • This PR adds an extra 44KB to repository

@cmsbuild
Copy link
Contributor

Pull request #27479 was updated. @cmsbuild, @civanch, @mdhildreth can you please check and sign again.

@civanch
Copy link
Contributor Author

civanch commented Jul 11, 2019

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Jul 11, 2019

The tests are being triggered in jenkins.
https://cmssdt.cern.ch/jenkins/job/ib-run-pr-tests/1420/console Started: 2019/07/11 13:32

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

Comparison job queued.

@cmsbuild
Copy link
Contributor

Comparison is ready
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-25bc22/1420/summary.html

@slava77 comparisons for the following workflows were not done due to missing matrix map:

  • /build/cmsbld/jenkins/workspace/compare-root-files-short-matrix/results/JR-comparison/PR-25bc22/20034.0_TTbar_14TeV+TTbar_14TeV_TuneCUETP8M1_2023D35_GenSimHLBeamSpotFull14+DigiFullTrigger_2023D35+RecoFullGlobal_2023D35+HARVESTFullGlobal_2023D35
  • /build/cmsbld/jenkins/workspace/compare-root-files-short-matrix/results/JR-comparison/PR-25bc22/20434.0_TTbar_14TeV+TTbar_14TeV_TuneCUETP8M1_2023D41_GenSimHLBeamSpotFull14+DigiFullTrigger_2023D41+RecoFullGlobal_2023D41+HARVESTFullGlobal_2023D41
  • /build/cmsbld/jenkins/workspace/compare-root-files-short-matrix/results/JR-comparison/PR-25bc22/21234.0_TTbar_14TeV+TTbar_14TeV_TuneCUETP8M1_2023D44_GenSimHLBeamSpotFull14+DigiFullTrigger_2023D44+RecoFullGlobal_2023D44+HARVESTFullGlobal_2023D44

Comparison Summary:

  • No significant changes to the logs found
  • Reco comparison results: 0 differences found in the comparisons
  • DQMHistoTests: Total files compared: 32
  • DQMHistoTests: Total histograms compared: 3081858
  • DQMHistoTests: Total failures: 1
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3081535
  • DQMHistoTests: Total skipped: 322
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 31 files compared)
  • Checked 133 log files, 14 edm output root files, 32 DQM output files

@civanch
Copy link
Contributor Author

civanch commented Jul 11, 2019

+1

Fortunately, the problem does not affect SIM results, so likely back port is not needed.

@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. @davidlange6, @slava77, @smuzaffar, @fabiocos (and backports should be raised in the release meeting by the corresponding L2)

Copy link
Contributor

@fabiocos fabiocos left a comment

Choose a reason for hiding this comment

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

@civanch thanks for following my comments, I have just a couple of questions. Even though the PR test does not show a regression, we will need to reproduce GEN-SIM in 11_0_0_pre4 and have a more extensive test with RelVals

@@ -57,27 +57,28 @@ OscarMTMasterThread::OscarMTMasterThread(const edm::ParameterSet& iConfig)
runManagerMaster = std::make_shared<RunManagerMT>(iConfig);
m_runManagerMaster = runManagerMaster;

edm::LogVerbatim("SimG4CoreApplication") << "OscarMTMasterThread: initialization of RunManagerMT finished";
LogDebug("SimG4CoreApplication") << "OscarMTMasterThread: initialization of RunManagerMT finished";
Copy link
Contributor

Choose a reason for hiding this comment

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

here the level of verbosity is raised, but I think it can be ok, and make simpler to follow the initialization behaviour in case, for normal operations we filter out this level anyway


if (!aRegion) {
edm::LogVerbatim("SimG4CoreApplication") << "ParametrisedEMPhysics::ConstructProcess: "
<< "EcalRegion is not defined, GFlash will not be enabled for ECAL!";
edm::LogWarning("SimG4CoreApplication") << "ParametrisedEMPhysics::ConstructProcess: "
Copy link
Contributor

Choose a reason for hiding this comment

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

@civanch this is quite a jump in verbosity, do we really need to treat it as a warning? As this code is devoted to GFlash, if GFlash is not activated in ECAL probably it makes sense...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@fabiocos , this warning is valid: if GFlash is asked for EcalRegion but EcalRegion is not defined the warning should be seen.

pmanager->AddProcess(msc, -1, 1, 1);
pmanager->AddProcess(new G4hhIonisation, -1, 2, 2);
pmanager->AddProcess(new G4eBremsstrahlung, -1, -3, 3);
pmanager->AddProcess(msc, -1, 1, -1);
Copy link
Contributor

Choose a reason for hiding this comment

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

@civanch what is the expected effect of these changes in physics lists, in the process intialization? There are several of them...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@fabiocos , this is an old EM configuration which these days are not used. The choice was to remove it or update to be consistent with Geant4 10.4. This EM physics may be applied for some exotic studies(difficult to predict) or will not be used any more....

Copy link
Contributor

Choose a reason for hiding this comment

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

@civanch thanks, my question is actually for all the changes to physics list in this PR, but I understand they fall in the same category. I will integrate this PR in next IB

@fabiocos
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit efd325e into cms-sw:master Jul 12, 2019
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