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

EgammaAnalysis/ElectronTools: potential bug fix, add parens to set implied order of + and ? #17014

Merged
merged 2 commits into from Jan 5, 2017
Merged

EgammaAnalysis/ElectronTools: potential bug fix, add parens to set implied order of + and ? #17014

merged 2 commits into from Jan 5, 2017

Conversation

gartung
Copy link
Member

@gartung gartung commented Dec 13, 2016

These clang warnings imply a possible bug because + is evaluated before ?. Also clean up of test class functions.

/build/cmsbld/jenkins-workarea/workspace/build-any-ib/w/tmp/BUILDROOT/ba81249bb4729771235b98cb83b6e8d8/opt/cmssw/slc6_amd64_gcc530/cms/cmssw/CMSSW_9_0_CLANG_X_2016-12-13-1100/src/EgammaAnalysis/ElectronTools/src/SimplePhoton.cc:8:56: warning: operator '?:' has lower precedence than '+'; '+' will be evaluated first [-Wparentheses]
scEnergy_(in.superCluster()->rawEnergy() + in.isEB() ? 0 : in.superCluster()->preshowerEnergy()),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/build/cmsbld/jenkins-workarea/workspace/build-any-ib/w/tmp/BUILDROOT/ba81249bb4729771235b98cb83b6e8d8/opt/cmssw/slc6_amd64_gcc530/cms/cmssw/CMSSW_9_0_CLANG_X_2016-12-13-1100/src/EgammaAnalysis/ElectronTools/src/SimplePhoton.cc:8:56: note: place parentheses around the '+' expression to silence this warning
scEnergy_(in.superCluster()->rawEnergy() + in.isEB() ? 0 : in.superCluster()->preshowerEnergy()),
^
( )
/build/cmsbld/jenkins-workarea/workspace/build-any-ib/w/tmp/BUILDROOT/ba81249bb4729771235b98cb83b6e8d8/opt/cmssw/slc6_amd64_gcc530/cms/cmssw/CMSSW_9_0_CLANG_X_2016-12-13-1100/src/EgammaAnalysis/ElectronTools/src/SimplePhoton.cc:8:56: note: place parentheses around the '?:' expression to evaluate it first
scEnergy_(in.superCluster()->rawEnergy() + in.isEB() ? 0 : in.superCluster()->preshowerEnergy()),
^
( )
1 warning generated.
/build/cmsbld/jenkins-workarea/workspace/build-any-ib/w/tmp/BUILDROOT/ba81249bb4729771235b98cb83b6e8d8/opt/cmssw/slc6_amd64_gcc530/cms/cmssw/CMSSW_9_0_CLANG_X_2016-12-13-1100/src/EgammaAnalysis/ElectronTools/src/SimpleElectron.cc:7:62: warning: operator '?:' has lower precedence than '+'; '+' will be evaluated first [-Wparentheses]
scEnergy_(in.superCluster()->rawEnergy() + in.isEB() ? 0 : in.superCluster()->preshowerEnergy()),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/build/cmsbld/jenkins-workarea/workspace/build-any-ib/w/tmp/BUILDROOT/ba81249bb4729771235b98cb83b6e8d8/opt/cmssw/slc6_amd64_gcc530/cms/cmssw/CMSSW_9_0_CLANG_X_2016-12-13-1100/src/EgammaAnalysis/ElectronTools/src/SimpleElectron.cc:7:62: note: place parentheses around the '+' expression to silence this warning
scEnergy_(in.superCluster()->rawEnergy() + in.isEB() ? 0 : in.superCluster()->preshowerEnergy()),
^
( )
/build/cmsbld/jenkins-workarea/workspace/build-any-ib/w/tmp/BUILDROOT/ba81249bb4729771235b98cb83b6e8d8/opt/cmssw/slc6_amd64_gcc530/cms/cmssw/CMSSW_9_0_CLANG_X_2016-12-13-1100/src/EgammaAnalysis/ElectronTools/src/SimpleElectron.cc:7:62: note: place parentheses around the '?:' expression to evaluate it first
scEnergy_(in.superCluster()->rawEnergy() + in.isEB() ? 0 : in.superCluster()->preshowerEnergy()),
^
( )

@cmsbuild
Copy link
Contributor

A new Pull Request was created by @gartung (Patrick Gartung) for CMSSW_9_0_X.

It involves the following packages:

EgammaAnalysis/ElectronTools

@cmsbuild, @monttj, @davidlange6 can you please review it and eventually sign? Thanks.
@Sam-Harper, @rafaellopesdesa this is something you requested to watch as well.
@slava77, @smuzaffar you are the release manager for this.

cms-bot commands are listed here #13028

@gartung
Copy link
Member Author

gartung commented Dec 19, 2016

@Dr15Jones please test

@Dr15Jones
Copy link
Contributor

How about adding override?

@cmsbuild
Copy link
Contributor

Pull request #17014 was updated. @cmsbuild, @monttj, @davidlange6 can you please check and sign again.

@gartung
Copy link
Member Author

gartung commented Dec 21, 2016

@Dr15Jones I added the override keyword as needed.

@monttj
Copy link
Contributor

monttj commented Dec 23, 2016

@cmsbuild please test

@cmsbuild
Copy link
Contributor

cmsbuild commented Dec 23, 2016

The tests are being triggered in jenkins.
https://cmssdt.cern.ch/jenkins/job/ib-any-integration/17151/console Started: 2016/12/23 09:34

@cmsbuild
Copy link
Contributor

@cmsbuild
Copy link
Contributor

Comparison job queued.

@cmsbuild
Copy link
Contributor

@monttj
Copy link
Contributor

monttj commented Dec 23, 2016

+1
With this PR, the condition is now clear and fixed.

@cmsbuild
Copy link
Contributor

This pull request is fully signed and it will be integrated in one of the next CMSSW_9_0_X IBs (tests are also fine). This pull request requires discussion in the ORP meeting before it's merged. @slava77, @davidlange6, @smuzaffar

@davidlange6
Copy link
Contributor

Hi @slava77 -can this bug affect the reco?

@slava77
Copy link
Contributor

slava77 commented Jan 4, 2017

@davidlange6
some non-exhaustive "git grep" shows that only analysis use cases are affected by this specific code.

@rafaellopesdesa @fcouderc
please clarify if the bugfix affects the analysis recipes only (and if it is a significant effect).
Does it also affect the procedure used to derive logic for the egamma energy calibration (which can indirectly impact reco)

@rafaellopesdesa
Copy link
Contributor

Hi Slava,

No, it does not affect the calibration in the RECO sequence.

We used the SimpleElectron class for the EGMSmearer (data-MC residuals in EGM calibration) in 2015/2016 but the bug does not seem to alter the output since this variable is not used (the input variable for the Ep combination after data-MC residual application is SimpleElectron::newEnergy_, which is copied from GsfElectron::correctedEcalEnergy).

I am not aware of any current use of the SimplePhoton class in RECO or in any EGM-maintained user application. Maybe someone is using privately, but then I have no way to know.

I hope this clarify, cheers.

@davidlange6
Copy link
Contributor

it would be great to just delete SimplePhoton if its not used. Thanks

@davidlange6
Copy link
Contributor

+1

@cmsbuild cmsbuild merged commit be89dd2 into cms-sw:CMSSW_9_0_X Jan 5, 2017
@gartung gartung deleted the EgammaAnalysis-ElectronTools-fix-clang-warnings branch January 18, 2017 17:50
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.

None yet

7 participants