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

Try to fix GeometryProducer and G4e examples #38864

Merged
merged 6 commits into from
Jul 30, 2022
Merged

Conversation

VinInn
Copy link
Contributor

@VinInn VinInn commented Jul 26, 2022

status
works for run1 geometry (at least does not crash)
does not work for run2 (at least 2022)

see #38739

the test does not find products (getByLabel broken?)

updated status:
should work for all Eras and geometry models.
the propagator "old" test needs a "refresh": it was based on the early use of Geane for Muon reconstruction that has been obsoleted years ago. It cannot even work at the moment as current propagator is limited to 2m

}
LogDebug("Geant4e") << "G4e -- Got simTracks of size " << simTracks->size();
std::cout << "Geant4e " << "G4e -- Got simTracks of size " << simTracks->size() << std::endl;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this one produces:

%MSG-w Geant4e:  Geant4ePropagatorAnalyzer:propAna 26-Jul-2022 13:23:00 CEST  Run: 1 Event: 1
No tracks found
%MSG
Geant4e G4e -- Got simTracks of size ----- Begin Fatal Exception 26-Jul-2022 13:23:00 CEST-----------------------
An exception of category 'ProductNotFound' occurred while
   [0] Processing  Event run: 1 lumi: 1 event: 1 stream: 0
   [1] Running path 'g4AnalPath'
   [2] Calling method for module Geant4ePropagatorAnalyzer/'propAna'
Exception Message:
Principal::getByLabel: Found zero products matching all criteria
Looking for type: std::vector<SimTrack>
Looking for module label: g4SimHits
Looking for productInstanceName:

@cmsbuild
Copy link
Contributor

-code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-38864/31276

  • This PR adds an extra 24KB to repository

  • There are other open Pull requests which might conflict with changes you have proposed:

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-38864/31277

  • This PR adds an extra 24KB to repository

  • There are other open Pull requests which might conflict with changes you have proposed:

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @VinInn (Vincenzo Innocente) for master.

It involves the following packages:

  • SimG4Core/GeometryProducer (simulation)
  • TrackPropagation/Geant4e (simulation)

@cmsbuild, @civanch, @mdhildreth can you please review it and eventually sign? Thanks.
@fabiocos, @VourMa, @makortel, @felicepantaleo, @JanFSchulte, @rovere, @VinInn, @bsunanda, @lecriste, @ebrondol, @mtosi, @mmusich, @slomeo this is something you requested to watch as well.
@perrotta, @dpiparo, @qliphy, @rappoccio you are the release manager for this.

cms-bot commands are listed here

@VinInn
Copy link
Contributor Author

VinInn commented Jul 26, 2022

@cmsbuild, please test

@VinInn
Copy link
Contributor Author

VinInn commented Jul 26, 2022

let's the test fail

if (!simVertices.isValid()) {
LogWarning("Geant4e") << "No tracks found" << std::endl;
return;
LogWarning("Geant4e") << "No verticess found" << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

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

typo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for spotting.
Once we find how to get the products will fix this as well

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably unrelated, but about

the test does not find products (getByLabel broken?)

Shouldn't be tokens used instead? https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideEDMGetDataFromEvent#get_ByToken

AFAIK getByLabel is deprecated, but I would have expected a different error message.

Copy link
Contributor

Choose a reason for hiding this comment

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

AFAIK getByLabel is deprecated, but I would have expected a different error message.

Correct, and I would have expected too to see a different exception (complaining about missing consumes() calls).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

deprecated should not mean not working... (or message should indeed say something different)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does one really has to consume each single product used?
and create tokens etc just for a single very stupid analyzer?
One cannot just say I consume everything in the input file?
I understand products to be produced, but for those in the input file is a bit abusive to ask all those boilerplate....

is there a script that generate the boilerplate?
I will not write it by hand!

Copy link
Contributor

Choose a reason for hiding this comment

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

Does one really has to consume each single product used?

Yes.

and create tokens etc just for a single very stupid analyzer?

Yes.

One cannot just say I consume everything in the input file?

No.

I understand products to be produced, but for those in the input file is a bit abusive to ask all those boilerplate....

The consumes information is used also for input file to read in only those branches that are actually needed by the module.

is there a script that generate the boilerplate?

I'm not aware of any.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added

@@ -147,6 +147,9 @@ Geant4ePropagatorAnalyzer::Geant4ePropagatorAnalyzer(const edm::ParameterSet &iC
       thePropagator(nullptr),
       G4VtxSrc_(iConfig.getParameter<edm::InputTag>("G4VtxSrc")),
       G4TrkSrc_(iConfig.getParameter<edm::InputTag>("G4TrkSrc")) {
+
+      consumes(G4TrkSrc_);
+

in the constructor.

getByLabel still produces the very same error as above

Copy link
Contributor

Choose a reason for hiding this comment

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

The point of the migration is to use getByToken instead of getByLabel

Copy link
Contributor

Choose a reason for hiding this comment

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

Just to note that the exception message has been improved for this particular corner case in #38875.

About

@@ -147,6 +147,9 @@ Geant4ePropagatorAnalyzer::Geant4ePropagatorAnalyzer(const edm::ParameterSet &iC
       thePropagator(nullptr),
       G4VtxSrc_(iConfig.getParameter<edm::InputTag>("G4VtxSrc")),
       G4TrkSrc_(iConfig.getParameter<edm::InputTag>("G4TrkSrc")) {
+
+      consumes(G4TrkSrc_);
+

in this case the consumes() call would need an explicit type (because it can't infer it from anywhere) along

@@ -147,6 +147,9 @@ Geant4ePropagatorAnalyzer::Geant4ePropagatorAnalyzer(const edm::ParameterSet &iC
       thePropagator(nullptr),
       G4VtxSrc_(iConfig.getParameter<edm::InputTag>("G4VtxSrc")),
       G4TrkSrc_(iConfig.getParameter<edm::InputTag>("G4TrkSrc")) {
+
+      consumes<std::vector<SimTrack>>(G4TrkSrc_);
+

In that case the getByLabel() should still work (even if getByToken() is strongly favored). The consumes() call itself has been required since 2016.

@VinInn
Copy link
Contributor Author

VinInn commented Jul 26, 2022 via email

@cmsbuild
Copy link
Contributor

-1

Failed Tests: UnitTests
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-1c3342/26464/summary.html
COMMIT: 2816210
CMSSW: CMSSW_12_5_X_2022-07-26-1100/el8_amd64_gcc10
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/38864/26464/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 testG4Refitter had ERRORS

Comparison Summary

Summary:

  • No significant changes to the logs found
  • Reco comparison results: 4 differences found in the comparisons
  • DQMHistoTests: Total files compared: 51
  • DQMHistoTests: Total histograms compared: 3667670
  • DQMHistoTests: Total failures: 14
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 3667634
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 50 files compared)
  • Checked 210 log files, 47 edm output root files, 51 DQM output files
  • TriggerResults: no differences found

@VinInn
Copy link
Contributor Author

VinInn commented Jul 27, 2022

what about this (including the modifier)?

@VinInn
Copy link
Contributor Author

VinInn commented Jul 27, 2022

@cmsbuild, please test

@makortel
Copy link
Contributor

what about this (including the modifier)?

Looks ok to me (including the modifier).

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-38864/31296

@cmsbuild
Copy link
Contributor

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

@cmsbuild
Copy link
Contributor

+1

Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-1c3342/26489/summary.html
COMMIT: c8c63c9
CMSSW: CMSSW_12_5_X_2022-07-27-1100/el8_amd64_gcc10
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week1/cms-sw/cmssw/38864/26489/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: 10 differences found in the comparisons
  • DQMHistoTests: Total files compared: 51
  • DQMHistoTests: Total histograms compared: 3667670
  • DQMHistoTests: Total failures: 19
  • DQMHistoTests: Total nulls: 1
  • DQMHistoTests: Total successes: 3667628
  • DQMHistoTests: Total skipped: 22
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.004 KiB( 50 files compared)
  • DQMHistoSizes: changed ( 312.0 ): 0.004 KiB MessageLogger/Warnings
  • Checked 210 log files, 47 edm output root files, 51 DQM output files
  • TriggerResults: no differences found

@civanch
Copy link
Contributor

civanch commented Jul 27, 2022

+1

configuration of SIM magnetic field is more complicate in g4SImHits than is needed for propagation but the use of clone in any case is more correct than it was before.

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

@perrotta
Copy link
Contributor

@VinInn the PR is still [RFC], and even if fully signed it will be considered for being merged after than that sign get removed from the PR title.

By the way the PR description says

updated status:
should work for all Eras and geometry models.
the "old" propagator test needs a "refresh"

which kind of confirms that there is still some work in progress for the "old" propagator

@VinInn
Copy link
Contributor Author

VinInn commented Jul 29, 2022

old refers to test not propagator.
IMHO this PR can be merged if Trk-Pog coordinators agree.

btw the reason the simple test does not propagate beyond 2m is trivial
https://cmssdt.cern.ch/dxr/CMSSW/source/TrackPropagation/Geant4e/src/Geant4ePropagator.cc#334

@VinInn VinInn changed the title [RFC] try to fix GeometryProducer and G4e examples Try to fix GeometryProducer and G4e examples Jul 29, 2022
@mmusich
Copy link
Contributor

mmusich commented Jul 29, 2022

IMHO this PR can be merged if Trk-Pog coordinators agree.

FWIW, +1

@qliphy
Copy link
Contributor

qliphy commented Jul 30, 2022

+1

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.

7 participants