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

Modernized HLTMuonPointingFilter #30987

Merged
merged 1 commit into from
Aug 3, 2020

Conversation

Dr15Jones
Copy link
Contributor

@Dr15Jones Dr15Jones commented Jul 30, 2020

PR description:

  • converted from legacy to global module
  • added ESGetTokens

This is part of #25090

PR validation:

The code compiles.

@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-30987/17438

  • This PR adds an extra 16KB to repository

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @Dr15Jones (Chris Jones) for master.

It involves the following packages:

HLTrigger/special

@cmsbuild, @Martin-Grunewald, @fwyzard can you please review it and eventually sign? Thanks.
@Martin-Grunewald this is something you requested to watch as well.
@silviodonato, @dpiparo, @qliphy you are the release manager for this.

cms-bot commands are listed here

@Dr15Jones
Copy link
Contributor Author

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Jul 30, 2020

The tests are being triggered in jenkins.

@fwyzard
Copy link
Contributor

fwyzard commented Jul 30, 2020

@Dr15Jones thanks for taking care of this.

If I'm not mistaken, after your changes the only non-const data members are thePropagator and m_cacheRecordId.
Since Propagator::propagate() is const, I think we can use the propagator returned by the EventSetup directly, without making a copy.
Then the module could become global instead of stream ?

@cmsbuild
Copy link
Contributor

+1
Tested at: 8a13a22
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-a6bc4d/8439/summary.html
CMSSW: CMSSW_11_2_X_2020-07-30-1100
SCRAM_ARCH: slc7_amd64_gcc820

The following merge commits were also included on top of IB + this PR after doing git cms-merge-topic:

You can see more details here:
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-a6bc4d/8439/git-log-recent-commits
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-a6bc4d/8439/git-merge-result

@cmsbuild
Copy link
Contributor

Comparison job queued.

@Dr15Jones
Copy link
Contributor Author

Since Propagator::propagate() is const, I think we can use the propagator returned by the EventSetup directly, without making a copy.

@fwyzard thanks for the suggestion. My ownly worry is are we actually sure that all the classes inheriting from Propagator are actually thread-safe? For example,
https://github.com/cms-sw/cmssw/blob/master/TrackPropagation/Geant4e/interface/Geant4ePropagator.h

looks problematic to me as it has non-const pointers as member data.

@Dr15Jones
Copy link
Contributor Author

Ultimately I'm not the person who has to maintain the code so I'll happily convert it to global if you want.

@fwyzard
Copy link
Contributor

fwyzard commented Jul 30, 2020

@Martin-Grunewald what do you prefer ?

@Dr15Jones
Copy link
Contributor Author

@makortel is of the opinion that Propagator is const thread safe and the clone is used to allowing calling the non-const interface.

@cmsbuild
Copy link
Contributor

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

Comparison Summary:

  • No significant changes to the logs found
  • Reco comparison results: 4 differences found in the comparisons
  • DQMHistoTests: Total files compared: 34
  • DQMHistoTests: Total histograms compared: 2525444
  • DQMHistoTests: Total failures: 7
  • DQMHistoTests: Total nulls: 0
  • DQMHistoTests: Total successes: 2525390
  • DQMHistoTests: Total skipped: 47
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.0 KiB( 33 files compared)
  • Checked 144 log files, 17 edm output root files, 34 DQM output files

@fwyzard
Copy link
Contributor

fwyzard commented Jul 30, 2020

So... does the fact that the module compiles with a const propagator means that it only uses the thread safe part of the interface ?

diff --git a/HLTrigger/special/plugins/HLTMuonPointingFilter.cc b/HLTrigger/special/plugins/HLTMuonPointingFilter.cc
index edb68ca4336..b70aecbb737 100644
--- a/HLTrigger/special/plugins/HLTMuonPointingFilter.cc
+++ b/HLTrigger/special/plugins/HLTMuonPointingFilter.cc
@@ -44,9 +44,7 @@ HLTMuonPointingFilter::HLTMuonPointingFilter(const edm::ParameterSet& pset)
       // Get a surface (here a cylinder of radius 1290mm) ECAL
       theCyl(Cylinder::build(theRadius, Cylinder::PositionType{}, Cylinder::RotationType{})),
       thePosPlane(Plane::build(Plane::PositionType{0, 0, static_cast<float>(theMaxZ)}, Plane::RotationType{})),
-      theNegPlane(Plane::build(Plane::PositionType{0, 0, static_cast<float>(-theMaxZ)}, Plane::RotationType{})),
-      thePropagator(nullptr),
-      m_cacheRecordId(0) {
+      theNegPlane(Plane::build(Plane::PositionType{0, 0, static_cast<float>(-theMaxZ)}, Plane::RotationType{})) {
   LogDebug("HLTMuonPointing") << " SALabel : " << pset.getParameter<edm::InputTag>("SALabel")
                               << " Radius : " << theRadius << " Half lenght : " << theMaxZ
                               << " Min pixel hits : " << thePixHits << " Min tk layers measurements : " << theTkLayers
@@ -61,15 +59,12 @@ bool HLTMuonPointingFilter::filter(edm::Event& event, const edm::EventSetup& eve
   bool accept = false;
 
   const TrackingComponentsRecord& tkRec = eventSetup.get<TrackingComponentsRecord>();
-  if (not thePropagator or tkRec.cacheIdentifier() != m_cacheRecordId) {
-    // get the new propagator from the EventSetup and clone it (for thread safety)
-    ESHandle<Propagator> propagatorHandle = tkRec.getHandle(thePropagatorToken);
-    thePropagator.reset(propagatorHandle.product()->clone());
-    if (thePropagator->propagationDirection() != anyDirection)
-      throw cms::Exception("Configuration")
-          << "the propagator " << thePropagatorName
-          << " should be configured with PropagationDirection = \"anyDirection\"" << std::endl;
-    m_cacheRecordId = tkRec.cacheIdentifier();
+  ESHandle<Propagator> propagatorHandle = tkRec.getHandle(thePropagatorToken);
+  Propagator const& propagator = *propagatorHandle.product();
+  if (propagator.propagationDirection() != anyDirection) {
+    throw cms::Exception("Configuration")
+        << "the propagator " << thePropagatorName
+        << " should be configured with PropagationDirection = \"anyDirection\"" << std::endl;
   }
 
   ESHandle<MagneticField> theMGField = eventSetup.getHandle(theMGFieldToken);
@@ -95,7 +90,7 @@ bool HLTMuonPointingFilter::filter(edm::Event& event, const edm::EventSetup& eve
 
     LogDebug("HLTMuonPointing") << " InnerTSOS " << innerTSOS;
 
-    TrajectoryStateOnSurface tsosAtCyl = thePropagator->propagate(*innerTSOS.freeState(), *theCyl);
+    TrajectoryStateOnSurface tsosAtCyl = propagator.propagate(*innerTSOS.freeState(), *theCyl);
 
     if (tsosAtCyl.isValid()) {
       LogDebug("HLTMuonPointing") << " extrap TSOS " << tsosAtCyl << " number of pixel hits " << pixelHits
@@ -117,9 +112,9 @@ bool HLTMuonPointingFilter::filter(edm::Event& event, const edm::EventSetup& eve
                                     << " number of muon hits " << nMuonHits;
         TrajectoryStateOnSurface tsosAtPlane;
         if (tsosAtCyl.globalPosition().z() > 0)
-          tsosAtPlane = thePropagator->propagate(*innerTSOS.freeState(), *thePosPlane);
+          tsosAtPlane = propagator.propagate(*innerTSOS.freeState(), *thePosPlane);
         else
-          tsosAtPlane = thePropagator->propagate(*innerTSOS.freeState(), *theNegPlane);
+          tsosAtPlane = propagator.propagate(*innerTSOS.freeState(), *theNegPlane);
 
         if (tsosAtPlane.isValid()) {
           if (tsosAtPlane.globalPosition().perp() < theRadius) {
diff --git a/HLTrigger/special/plugins/HLTMuonPointingFilter.h b/HLTrigger/special/plugins/HLTMuonPointingFilter.h
index 5c9ab21997d..ab8d54a2c27 100644
--- a/HLTrigger/special/plugins/HLTMuonPointingFilter.h
+++ b/HLTrigger/special/plugins/HLTMuonPointingFilter.h
@@ -67,8 +67,5 @@ private:
   const Cylinder::CylinderPointer theCyl;
   const Plane::PlanePointer thePosPlane;
   const Plane::PlanePointer theNegPlane;
-
-  std::unique_ptr<Propagator> thePropagator;
-  unsigned long long m_cacheRecordId;
 };
 #endif  // Muon_HLTMuonPointingFilter_h

@Dr15Jones
Copy link
Contributor Author

So... does the fact that the module compiles with a const propagator means that it only uses the thread safe part of the interface ?

That is the thought.

@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-30987/17484

  • This PR adds an extra 16KB to repository

@cmsbuild
Copy link
Contributor

Pull request #30987 was updated. @cmsbuild, @Martin-Grunewald, @fwyzard can you please check and sign again.

@Dr15Jones
Copy link
Contributor Author

please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Jul 31, 2020

The tests are being triggered in jenkins.

@cmsbuild
Copy link
Contributor

+1
Tested at: fe9be5e
https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-a6bc4d/8479/summary.html
CMSSW: CMSSW_11_2_X_2020-07-31-1100
SCRAM_ARCH: slc7_amd64_gcc820

@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-a6bc4d/8479/summary.html

Comparison Summary:

  • No significant changes to the logs found
  • Reco comparison results: 2 differences found in the comparisons
  • DQMHistoTests: Total files compared: 34
  • DQMHistoTests: Total histograms compared: 2525448
  • DQMHistoTests: Total failures: 5
  • DQMHistoTests: Total nulls: 1
  • DQMHistoTests: Total successes: 2525395
  • DQMHistoTests: Total skipped: 47
  • DQMHistoTests: Total Missing objects: 0
  • DQMHistoSizes: Histogram memory added: 0.004 KiB( 33 files compared)
  • DQMHistoSizes: changed ( 10224.0 ): 0.004 KiB MessageLogger/Warnings
  • Checked 144 log files, 17 edm output root files, 34 DQM output files

@Martin-Grunewald
Copy link
Contributor

+1

@cmsbuild
Copy link
Contributor

cmsbuild commented Aug 2, 2020

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

@silviodonato
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit c3cdff8 into cms-sw:master Aug 3, 2020
@Dr15Jones Dr15Jones deleted the modernizeHLTMuonPointingFilter branch August 4, 2020 13:17
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