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

Improvement of muon::isHighPtMuon #25036

Merged
merged 3 commits into from Nov 1, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions DataFormats/MuonReco/src/MuonSelectors.cc
Expand Up @@ -908,16 +908,19 @@ bool muon::isSoftMuon(const reco::Muon& muon, const reco::Vertex& vtx,


bool muon::isHighPtMuon(const reco::Muon& muon, const reco::Vertex& vtx){
bool muID = muon.isGlobalMuon() && muon.globalTrack()->hitPattern().numberOfValidMuonHits() >0 && (muon.numberOfMatchedStations() > 1);
if(!muID) return false;
if(!muon.isGlobalMuon()) return false;

bool muValHits = ( muon.globalTrack()->hitPattern().numberOfValidMuonHits()>0 || muon.tunePMuonBestTrack()->hitPattern().numberOfValidMuonHits()>0 );
bool muMatchedSt = muon.isTrackerMuon() && ( ( muon.numberOfMatchedStations()>1 ) || ( muon.numberOfMatchedStations()==1 && ( muon.expectedNnumberOfMatchedStations()<2 || !(muon.stationMask()==1 || muon.stationMask()==16) || muon.numberOfMatchedRPCLayers()>2 ) ) );
Copy link
Contributor

Choose a reason for hiding this comment

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

please add some newlines to improve readability.
The conditional expression is long enough that it may be better readable via if-else

bool muID = muValHits && muMatchedSt;

bool hits = muon.innerTrack()->hitPattern().trackerLayersWithMeasurement() > 5 &&
muon.innerTrack()->hitPattern().numberOfValidPixelHits() > 0;

bool momQuality = muon.tunePMuonBestTrack()->ptError()/muon.tunePMuonBestTrack()->pt() < 0.3;

bool ip = fabs(muon.innerTrack()->dxy(vtx.position())) < 0.2 && fabs(muon.innerTrack()->dz(vtx.position())) < 0.5;

return muID && hits && momQuality && ip;

}
Expand Down