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

Fixes for L3 and L1 trigger object matching in Muon HLT #37086

Closed
wants to merge 2 commits into from

Conversation

JanFSchulte
Copy link
Contributor

This PR improves the matching of L3 and L1 candidates in filters in the Muon HLT in two ways:

  • For L3/L1 matching, the L3 muon is now propagated to the second muon station, since L1 parameters are defined there. This improves matching efficiency for very low pT muons. This change has negligible impact on overall HLT performance. Total HLT rate is virtually unchange (0.04% increase). Timing is virtually unchange as well, despite the added propagation (black is without, red is with the propagation)
    image

  • In HLTMuonL1TFilter a match between L1 muons before and after different filters is performed. Currently the code expects the muons that are compared to be in the same collection. However, there are use cases in the current menu where the matching is performed with a copy of the L1 muon collection and thus always fails. This causes an inefficiency for low pT muons that are reconstructed only by L1-seeded reconstruction steps. Impact is mostly negligible, showing tiny efficiency improvements for high-pT muon from the Z:
    image

Effect gets more visible for lower pT muons, for example in the turnon of the double-muon trigger:
image

However, the effect is significant for very low pT leptons. For the muon Bs -> mumu trigger (HLT_DoubleMu4_3_Bs_v14) we find a ~20% improvement of HLT efficiency on a sample of signal events provided by BPH.

@cmsbuild
Copy link
Contributor

+code-checks

Logs: https://cmssdt.cern.ch/SDT/code-checks/cms-sw-PR-37086/28571

  • This PR adds an extra 32KB to repository

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @JanFSchulte (Jan-Frederik Schulte) for master.

It involves the following packages:

  • HLTrigger/Muon (hlt)

@cmsbuild, @missirol, @Martin-Grunewald can you please review it and eventually sign? Thanks.
@Fedespring, @HuguesBrun, @calderona, @silviodonato, @abbiendi, @jhgoh, @Martin-Grunewald, @missirol, @sscruz, @CeliaFernandez, @trocino, @cericeci 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

@Martin-Grunewald
Copy link
Contributor

please test

@@ -45,6 +46,8 @@ class HLTMuonDimuonL3Filter : public HLTFilter {
const reco::RecoChargedCandidateRef&,
const reco::BeamSpot&,
const edm::ESHandle<MagneticField>&) const;

mutable PropagateToMuon prop_;
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if the mutable attribute here might clash with the need to use this object inside a global module (which HLTFilter is). Maybe one step in the right direction is to use std::atomic. I can't judge with certainty, so I would kindly ask advise from @cms-sw/core-l2.

Copy link
Contributor

@makortel makortel Feb 28, 2022

Choose a reason for hiding this comment

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

On a quick look PropagateToMuon::init() appears to set various member variables, and intended to be called on each event, so the use of mutable here indeed looks unsafe. The std::atomic won't help for many reasons, and any synchronization mechanism (like std::mutex) would be bad because the critical section is essentially the duration of the entire filter() method.

Here are some alternatives (in no particular order)

  • place PropagateToMuon object into an edm::StreamCache (or make the entire moduleedm::stream, but that might well be an overkill)
  • refactor PropagateToMuon into two classes such that
    • one class contains the current constructor and the init() function (as const), but instead of writing to member variables, it would create an object of an another class (below)
    • another class that contains the member variables currently being written to in init(), and all the extrapolate() const methods
  • move PropagateToMuon into EventSetup, in which case the ESProducer would take the role of the current constructor, and the ESProcucer::produce() + the constructor of PropagateToMuon would take the role of the current init() method

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, @makortel . @JanFSchulte , I think this point will need to be addressed before moving forward with this PR.

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 the feedback @makortel @missirol . Given that the impact on the HLT performance is minimal and we included this update mostly because it is technically the more correct way to perform the matching, I am not sure the effort is worth the gain. We might end up going with the just the fix to the L1 filter that is unaffected by this question and is an actual performance improvement.

Comment on lines +117 to +119
if (deltaR2(muon->eta(), muon->phi(), prevMuons[it2]->eta(), prevMuons[it2]->phi()) < 0.1)
matchPrevL1 = true;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (deltaR2(muon->eta(), muon->phi(), prevMuons[it2]->eta(), prevMuons[it2]->phi()) < 0.1)
matchPrevL1 = true;
}
if (reco::deltaR2(muon->eta(), muon->phi(), prevMuons[it2]->eta(), prevMuons[it2]->phi()) < maxDeltaR2_){
matchPrevL1 = true;
break;
}
}

Looks like the 0.1 qualifies as "magic number" here, so it would need to be replaced by a configuration parameter (held by a class member as in the suggested snippet). Also, is 0.1 the threshold for Delta-R or Delta-R^2 ?

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 have made the 0.1 configurable in the factorized PR. In the way it's currently used, it is basically arbitrary since the parameters of the L1 candidates that need to be matched are identical.

@cmsbuild
Copy link
Contributor

-1

Failed Tests: RelVals RelVals-INPUT AddOn
Summary: https://cmssdt.cern.ch/SDT/jenkins-artifacts/pull-request-integration/PR-fdfc95/22714/summary.html
COMMIT: 0a1dd53
CMSSW: CMSSW_12_3_X_2022-02-28-1100/slc7_amd64_gcc10
User test area: For local testing, you can use /cvmfs/cms-ci.cern.ch/week0/cms-sw/cmssw/37086/22714/install.sh to create a dev area with all the needed externals and cmssw changes.

RelVals

----- Begin Fatal Exception 28-Feb-2022 17:08:51 CET-----------------------
An exception of category 'NoProxyException' occurred while
   [0] Processing  Event run: 1 lumi: 1 event: 3 stream: 0
   [1] Running path 'HLT_Mu37_TkMu27_v5'
   [2] Calling method for module HLTMuonTrkL1TFilter/'hltL3fL1sMu16orMu25L1f0L2f25L3Filtered37'
Exception Message:
No data of type "Propagator" with label "SteppingHelixPropagatorAlong" in record "TrackingComponentsRecord"
 Please add an ESSource or ESProducer to your job which can deliver this data.
----- End Fatal Exception -------------------------------------------------
----- Begin Fatal Exception 28-Feb-2022 17:09:19 CET-----------------------
An exception of category 'NoProxyException' occurred while
   [0] Processing  Event run: 1 lumi: 1 event: 3 stream: 0
   [1] Running path 'HLT_Mu37_TkMu27_v5'
   [2] Calling method for module HLTMuonTrkL1TFilter/'hltL3fL1sMu16orMu25L1f0L2f25L3Filtered37'
Exception Message:
No data of type "Propagator" with label "SteppingHelixPropagatorAlong" in record "TrackingComponentsRecord"
 Please add an ESSource or ESProducer to your job which can deliver this data.
----- End Fatal Exception -------------------------------------------------
----- Begin Fatal Exception 28-Feb-2022 17:10:24 CET-----------------------
An exception of category 'NoProxyException' occurred while
   [0] Processing  Event run: 1 lumi: 1 event: 3 stream: 0
   [1] Running path 'HLT_Mu37_TkMu27_v5'
   [2] Calling method for module HLTMuonTrkL1TFilter/'hltL3fL1sMu16orMu25L1f0L2f25L3Filtered37'
Exception Message:
No data of type "Propagator" with label "SteppingHelixPropagatorAlong" in record "TrackingComponentsRecord"
 Please add an ESSource or ESProducer to your job which can deliver this data.
----- End Fatal Exception -------------------------------------------------
Expand to see more relval errors ...

RelVals-INPUT

  • 11608.011608.0_SingleMuPt100+2021+SingleMuPt100_Eta2p85_GenSimINPUT+Digi+RecoNano+HARVESTNano+ALCA/step2_SingleMuPt100+2021+SingleMuPt100_Eta2p85_GenSimINPUT+Digi+RecoNano+HARVESTNano+ALCA.log
  • 11609.011609.0_SingleMuPt1000+2021+SingleMuPt1000_Eta2p85_GenSimINPUT+Digi+RecoNano+HARVESTNano+ALCA/step2_SingleMuPt1000+2021+SingleMuPt1000_Eta2p85_GenSimINPUT+Digi+RecoNano+HARVESTNano+ALCA.log
  • 11630.011630.0_QCD_Pt_3000_3500_14TeV+2021+QCD_Pt_3000_3500_14TeV_TuneCUETP8M1_GenSimINPUT+Digi+RecoNano+HARVESTNano+ALCA/step2_QCD_Pt_3000_3500_14TeV+2021+QCD_Pt_3000_3500_14TeV_TuneCUETP8M1_GenSimINPUT+Digi+RecoNano+HARVESTNano+ALCA.log
Expand to see more relval errors ...

AddOn Tests

----- Begin Fatal Exception 28-Feb-2022 16:44:06 CET-----------------------
An exception of category 'NoProxyException' occurred while
   [0] Processing  Event run: 1 lumi: 1 event: 8 stream: 1
   [1] Running path 'HLT_Mu37_TkMu27_v5'
   [2] Calling method for module HLTMuonTrkL1TFilter/'hltL3fL1sMu16orMu25L1f0L2f25L3Filtered37'
Exception Message:
No data of type "Propagator" with label "SteppingHelixPropagatorAlong" in record "TrackingComponentsRecord"
 Please add an ESSource or ESProducer to your job which can deliver this data.
----- End Fatal Exception -------------------------------------------------

@JanFSchulte
Copy link
Contributor Author

We have decided to factorize this PR and proceed with the more urgent, and much easier fix for the L1 candidate matching in #37110. Closing this PR for now and will follow up once we have solved the concerns for the muon propagation.

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