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
ngrenz: testing of stereo optimization #10963
Conversation
@boudoul FYI |
A new Pull Request was created by @ngrenz for CMSSW_7_6_X. ngrenz: testing of stereo optimization It involves the following packages: DataFormats/SiStripDetId @cmsbuild, @cvuosalo, @civanch, @mdhildreth, @slava77 can you please review it and eventually sign? Thanks. |
@ngrenz , having many "return" in an inline method disables inline. From my point of view, each inline method should have only one "return". |
@@ -112,18 +112,18 @@ class SiStripDetId : public DetId { | |||
// ---------- inline methods ---------- |
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.
@civanch sorry, do you refer to this comment
The functions have the same number of returns as in the previous program version
and the inline expression is never used.
I had thought to change the SiStripDetId::stereo()
function to
inline uint32_t SiStripDetId::stereo() const {
return ( ((id_>>sterStartBit_ ) & sterMask_ ) == 1 ) ? 1:0;
}
but I am not sure whether the readability would suffer
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.
@ngrenz , yes, it is the most effective c++ but I agree the readability is not the best. It is possible to have something like:
inline uit32_t SiStripDetId::stereo const
{
uit32_t k = 0;
if(1 == ((id_>>sterStartBit_ ) & sterMask_ )) { k = 1; }
return k;
}
similar solutions may be applied in other inlined methods from this header.
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.
Thanks, I will rewrite the function.
Do I need the inline expression?
Or rather I do not understand why there is the comment
// ---------- inline methods ----------
but no inline expressions, in the original code
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.
If implementation of a method is inside header file it is assumed to be inlined even without a declaration.
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.
i find
return 1 == (id_>>sterStartBit_ ) & sterMask_ ) ? 1:0;
very clear and obvious
return ( id.rawId() - 2 ); | ||
} else { return 0; } | ||
uint32_t testId = (id.rawId()>>tidVals_.sterStartBit_) & tidVals_.sterMask_; | ||
return ( testId == 1 || testId == 2) ? ( id.rawId() - testId ) : 0; |
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.
@VinInn your last comment was "It can only be 0, 1 or 2 .."
do you mean the output of tidGlued
or the result of the calculation (id.rawId()>>tidVals_.sterStartBit_) & tidVals_.sterMask_
if it is the calculation, then it is more efficient to compare testId with 0.
Thanks
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.
to make clear
id.rawId()>>tidVals_.sterStartBit_) & tidVals_.sterMask_
for ANY strip det is
0 for r-phi
1 for stereo
2 for glued
3 never
@cmsbuild please test |
The tests are being triggered in jenkins. |
please test |
case 1: return W1A; | ||
case 2: return W2A; | ||
case 3: return W3A; | ||
case 1: geometry = W1A; |
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.
you are missing "break;" after each assignment (otherwise everything below a selected "case" is executed
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.
thanks
@cmsbuild please test |
The tests are being triggered in jenkins. |
+1 |
+1
|
This pull request is fully signed and it will be integrated in one of the next CMSSW_7_6_X IBs (tests are also fine). This pull request requires discussion in the ORP meeting before it's merged. @davidlange6, @Degano, @smuzaffar |
+1 |
ngrenz: testing of stereo optimization
Optimization by reducing of operations for the stereo test, as well as avoiding of
object creation within TrackerHitAssociator.cc
The outputs are supposed to be unchanged.
Any comments and suggestions are welcome.