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
Bug fix in Halo code #7433
Bug fix in Halo code #7433
Conversation
Fix a bug where the code is using the index into the RefVector where the index into the collection is expected. This will result in Ref's to the wrong element being created.
A new Pull Request was created by @wddgit (W. David Dagenhart) for CMSSW_7_4_X. Bug fix in Halo code It involves the following packages: DQMOffline/JetMET @nclopezo, @cvuosalo, @slava77, @cmsbuild, @deguio, @danduggan can you please review it and eventually sign? Thanks. |
The same bug is repeated in 4 different places. I am not familiar with this code. It is possible The Ref constructor used by this code will deleted |
@@ -54,7 +54,7 @@ int CSCHaloData::NumberOfHaloTracks(HaloData::Endcap z) const | |||
int n = 0 ; | |||
for(unsigned int i = 0 ; i < TheTrackRefs.size() ; i++ ) | |||
{ | |||
edm::Ref<reco::TrackCollection> iTrack( TheTrackRefs, i ) ; | |||
edm::Ref<reco::TrackCollection> iTrack( TheTrackRefs[i] ) ; |
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.
why was this a bug?
Ref(RefVector<C, T, F> const& refvector, key_type itemKey)
exists
is the point that it's becoming a bug with updates of the interface?
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.
Say the code was
std::vector<Foo*> allFoos;
std::vector<Foo*> someFoos( aFunctionThatMakesChoices(allFoos) );
for(unsigned int i = 0; i< someFoos.size(); i++) {
std::cout << allFoos[i];
}
Would you consider using the wrong size to be a bug? That is exactly what the code was doing.
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.
For example, the RefVector might have 5 entries and the TrackCollection might have 1000 tracks. The 3rd element of the RefVector might reference the 500th track. The existing constructor is passing an index into the RefVector into a function that expects and index into the TrackCollection, In this example, passing 3 instead of 500.
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.
Oh, indeed.
Now it's obvious
@cmsbuild please test |
The tests are being triggered in jenkins. |
looking at jenkins tests, the halo variables didn't change. |
+1 |
+1 for #7433 617d784 With 100 events (the default in the short matrix with MC recycling) I actually got a small difference. Apparently, there are no DQM plots for this product. @TaiSakuma May I ask you to review the use cases of this product in the MET meetings and see if it's still useful. |
This pull request is fully signed and it will be integrated in one of the next CMSSW_7_4_X IBs unless changes (tests are also fine). This pull request will be automatically merged. |
Fix a bug where the code is using the index
into the RefVector where the index into the
collection is expected. This will result in
Ref's to the wrong element being created.