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

self-subtractions : possible bugs #26913

Closed
3 of 4 tasks
slava77 opened this issue May 23, 2019 · 16 comments
Closed
3 of 4 tasks

self-subtractions : possible bugs #26913

slava77 opened this issue May 23, 2019 · 16 comments

Comments

@slava77
Copy link
Contributor

slava77 commented May 23, 2019

as a follow up to #26868 (comment)
I made some egrep of the CMSSW code base for repeated patterns [1].

This is not exhaustive (e.g. function calls with arguments like x(y) - x(y) are not covered) and perhaps a better tool/parsing should be added.
@fabiocos @smuzaffar perhaps we even have something automated? Clang static analyzer report does not pick up these as issues.

The results are as follows:

[1] egrep -R "(\b[a-zA-Z0-9\.]+\b)()[^A-Za-z=0-9,/:-]*-[^A-Za-z0-9>=%($]*\1[^_A-Za-z0-9]|(\b[a-zA-Z0-9\.]+\b)[^A-Za-z=0-9,/:)]*-[^A-Za-z0-9>=%($]*\1[^_A-Za-z0-9]"

@cmsbuild
Copy link
Contributor

A new Issue was created by @slava77 Slava Krutelyov.

@davidlange6, @Dr15Jones, @smuzaffar, @fabiocos, @kpedro88 can you please review it and eventually sign/assign? Thanks.

cms-bot commands are listed here

@makortel
Copy link
Contributor

RecoPixelVertexing/PixelLowPtUtilities/src/ValidHitPairFilter.cc

vector<float>::const_iterator iph = lower_bound(phB.begin(),phB.end(), ph);
if(iph > phB.begin()) phVec.push_back(iph - phB.begin() - 1);
else phVec.push_back(phB.end() - phB.begin() - 1);
if(iph < phB.end() ) phVec.push_back(iph - phB.begin() );
else phVec.push_back(phB.begin() - phB.begin() );

On a quick look this class is a good candidate for dead code (not used anywhere in CMSSW, last non-technical-migration change was in 2010 (in 2008 for this specific fragment).

@ferencek
Copy link
Contributor

* [ ]  RecoBTag/ImpactParameter/plugins/IPProducer.h https://github.com/cms-sw/cmssw/blob/ba500c0d38075ac562531832c437568ab6e2dfc0/RecoBTag/ImpactParameter/plugins/IPProducer.h#L393-L398
  
  
  * it looks like a comma is missing. @arizzi @ferencek  please check for b-tag needs.

Hi @slava77, indeed, this looks like a bug and a comma is missing there. The ghost track feature is not really in active use which probably explains why this went unnoticed all this time.

@slava77
Copy link
Contributor Author

slava77 commented May 29, 2019

* [ ]  RecoBTag/ImpactParameter/plugins/IPProducer.h https://github.com/cms-sw/cmssw/blob/ba500c0d38075ac562531832c437568ab6e2dfc0/RecoBTag/ImpactParameter/plugins/IPProducer.h#L393-L398
  
  
  * it looks like a comma is missing. @arizzi @ferencek  please check for b-tag needs.

Hi @slava77, indeed, this looks like a bug and a comma is missing there. The ghost track feature is not really in active use which probably explains why this went unnoticed all this time.

What would be the right fix?
It seems like the error = 0 (current incidental default) has a special meaning.
Grepping for similar calls, I see other defaults like Measurement1D(-1, 1) in

static const btag::TrackIPData dummy = {
GlobalPoint(),
GlobalPoint(),
Measurement1D(-1.0, 1.0),
Measurement1D(-1.0, 1.0),
Measurement1D(-1.0, 1.0),
Measurement1D(-1.0, 1.0),
0.

Would this be a more correct value than what will be from a simple addition of a comma Measurement1D(-1, -1)?

@ferencek
Copy link
Contributor

Measurement1D is used to store a track impact parameter and related uncertainty. The impact parameter can be signed so generally speaking Measurement1D(-1.0, 1.0) could be a valid entry. Measurement1D(-1., -1.) is clearly an invalid entry because of the negative error but the problem with this is that Measurement1D::significance() would return 1 which could look completely legitimate. Personally, I would prefer Measurement1D(0., -1.).

@alja
Copy link
Contributor

alja commented May 29, 2019

@slava77 The phi range check in the FWTauProxyBuilderBase.cc is not necessary. I have submitted #27001 for this.

@slava77
Copy link
Contributor Author

slava77 commented May 31, 2019

Currently, only the issue in RecoLocalMuon/GEMSegment/plugins/ME0SegAlgoRU.cc is remaining.

@nickmccoll perhaps you know what would be a correct fix here

bool ME0SegAlgoRU::areHitsCloseInEta(const float maxETA, const bool beamConst, const GlobalPoint& h1, const GlobalPoint& h2) const {
float diff = 0;
diff = std::fabs(h1.eta() - h1.eta());

@perrotta
Copy link
Contributor

Currently, only the issue in RecoLocalMuon/GEMSegment/plugins/ME0SegAlgoRU.cc is remaining.
@nickmccoll perhaps you know what would be a correct fix here

Well, the correct fix is obvious, that is replace one of the h1 with h2
What has actually to be checked before implementing it blindly is to asses its effect on the physics performance, which will likely be touched because this areHitsCloseInEta is used in the segment building. Here some hint or investigations from the GEM local reco experts is needed.

@jshlee
Copy link
Contributor

jshlee commented May 31, 2019

Currently, only the issue in RecoLocalMuon/GEMSegment/plugins/ME0SegAlgoRU.cc is remaining.
@nickmccoll perhaps you know what would be a correct fix here

Well, the correct fix is obvious, that is replace one of the h1 with h2
What has actually to be checked before implementing it blindly is to asses its effect on the physics performance, which will likely be touched because this areHitsCloseInEta is used in the segment building. Here some hint or investigations from the GEM local reco experts is needed.

yes it should be the diff of h1 and h2, we will look into the effects on segment reco.

@nickmccoll
Copy link
Contributor

@slava77 wow, that is a bad bug on my part! This is a part of the seeding, and is effectively a vertex constraint that was supposed to be, but apparently not, implemented. I would think that fixing it should just reduce the background rate (e.g. wide angle punch throughs), but it should be double checked.

@slava77
Copy link
Contributor Author

slava77 commented Jul 12, 2019

@nickmccoll @jshlee please update on the status of checking/applying the fix in ME0SegAlgoRU.cc.
Thank you.

@slava77
Copy link
Contributor Author

slava77 commented Jul 12, 2019

assign reconstruction

@cmsbuild
Copy link
Contributor

New categories assigned: reconstruction

@slava77,@perrotta you have been requested to review this Pull request/Issue and eventually sign? Thanks

@jshlee
Copy link
Contributor

jshlee commented Jul 12, 2019

@slava77 - will update now

@perrotta
Copy link
Contributor

+1

  • All cases look like as having been fixed now

@cmsbuild
Copy link
Contributor

This issue is fully signed and ready to be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants