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
Fix for jet flavour clustering #3994
Merged
davidlange6
merged 2 commits into
cms-sw:CMSSW_7_1_X
from
cms-btv-pog:JetFlavourClusteringFix_from-CMSSW_7_1_0_pre8
Jun 3, 2014
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -473,22 +473,27 @@ JetFlavourClustering::matchReclusteredJets(const edm::Handle<edm::View<reco::Jet | |
|
||
for(size_t j=0; j<jets->size(); ++j) | ||
{ | ||
double matchedDR = 1e9; | ||
double matchedDR2 = 1e9; | ||
int matchedIdx = -1; | ||
|
||
for(size_t rj=0; rj<reclusteredJets.size(); ++rj) | ||
{ | ||
if( matchedLocks.at(rj) ) continue; // skip jets that have already been matched | ||
|
||
double tempDR = reco::deltaR( jets->at(j).rapidity(), jets->at(j).phi(), reclusteredJets.at(rj).rapidity(), reclusteredJets.at(rj).phi_std() ); | ||
if( tempDR < matchedDR ) | ||
double tempDR2 = reco::deltaR2( jets->at(j).rapidity(), jets->at(j).phi(), reclusteredJets.at(rj).rapidity(), reclusteredJets.at(rj).phi_std() ); | ||
if( tempDR2 < matchedDR2 ) | ||
{ | ||
matchedDR = tempDR; | ||
matchedDR2 = tempDR2; | ||
matchedIdx = rj; | ||
} | ||
} | ||
|
||
if( matchedIdx>=0 ) matchedLocks.at(matchedIdx) = true; | ||
if( matchedIdx>=0 ) | ||
{ | ||
matchedLocks.at(matchedIdx) = true; | ||
if ( matchedDR2 > rParam_*rParam_ ) | ||
edm::LogError("JetMatchingFailed") << "Matched reclustered jet " << matchedIdx << " and original jet " << j <<" are separated by dR=" << sqrt(matchedDR2) << " which is greater than the jet size R=" << rParam_ << ". This is not expected so please check that the jet algorithm and jet size match those used for the original jet collection."; | ||
} | ||
matchedIndices.push_back(matchedIdx); | ||
} | ||
|
||
|
@@ -507,28 +512,33 @@ JetFlavourClustering::matchGroomedJets(const edm::Handle<edm::View<reco::Jet> >& | |
|
||
for(size_t gj=0; gj<groomedJets->size(); ++gj) | ||
{ | ||
double matchedDR = 1e9; | ||
double matchedDR2 = 1e9; | ||
int matchedIdx = -1; | ||
|
||
for(size_t j=0; j<jets->size(); ++j) | ||
if( groomedJets->at(gj).pt()>0. ) // skips pathological cases of groomed jets with Pt=0 | ||
{ | ||
if( jetLocks.at(j) ) continue; // skip jets that have already been matched | ||
|
||
double tempDR = reco::deltaR( jets->at(j).rapidity(), jets->at(j).phi(), groomedJets->at(gj).rapidity(), groomedJets->at(gj).phi() ); | ||
if( tempDR < matchedDR ) | ||
for(size_t j=0; j<jets->size(); ++j) | ||
{ | ||
matchedDR = tempDR; | ||
matchedIdx = j; | ||
if( jetLocks.at(j) ) continue; // skip jets that have already been matched | ||
|
||
double tempDR2 = reco::deltaR2( jets->at(j).rapidity(), jets->at(j).phi(), groomedJets->at(gj).rapidity(), groomedJets->at(gj).phi() ); | ||
if( tempDR2 < matchedDR2 ) | ||
{ | ||
matchedDR2 = tempDR2; | ||
matchedIdx = j; | ||
} | ||
} | ||
} | ||
|
||
if( matchedIdx>=0 ) jetLocks.at(matchedIdx) = true; | ||
if( matchedIdx>=0 ) | ||
{ | ||
jetLocks.at(matchedIdx) = true; | ||
if ( matchedDR2 > rParam_*rParam_ ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
edm::LogWarning("MatchedJetsFarApart") << "Matched groomed jet " << gj << " and original jet " << matchedIdx <<" are separated by dR=" << sqrt(matchedDR2) << " which is greater than the jet size R=" << rParam_ << ". This is not expected so please check that the two jet collections belong to each other."; | ||
} | ||
jetIndices.push_back(matchedIdx); | ||
} | ||
|
||
if( std::find( jetIndices.begin(), jetIndices.end(), -1 ) != jetIndices.end() ) | ||
edm::LogError("JetMatchingFailed") << "Matching groomed to original jets failed. Please check that the two jet collections belong to each other."; | ||
|
||
for(size_t j=0; j<jets->size(); ++j) | ||
{ | ||
std::vector<int>::iterator matchedIndex = std::find( jetIndices.begin(), jetIndices.end(), j ); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
matchedLocks
remainstrue
in this case?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vadler With this condition met, something was not configured properly and the final results should not be used until the problem is fixed. So in that sense, one could argue that it doesn't matter much to what value
matchedLocks
was set since the results probably don't make much sense anyways. However, I do agree that it is probably better not to setmatchedLocks
totrue
if this condition is met. The same is true for https://github.com/cms-sw/cmssw/pull/3994/files#r13046815 I will commit a fix soon. Thanks for spotting this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanx!
Please also propagate the fix to the other release cycles, so that I can sign all four of them right away ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do. Working on it right now.