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
Changes from 2 commits
95334b3
01f74b5
7cec228
b092a27
e41f093
6d24341
5dda346
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -266,56 +266,60 @@ class TrackerTopology { | |
//these are clones of the old SiStripDetId | ||
uint32_t tobStereo(const DetId &id) const { | ||
if ( ((id.rawId() >>tobVals_.sterStartBit_ ) & tobVals_.sterMask_ ) == 1 ) { | ||
return ( (id.rawId()>>tobVals_.sterStartBit_) & tobVals_.sterMask_ ); | ||
return 1; | ||
} else { return 0; } | ||
} | ||
|
||
uint32_t tibStereo(const DetId &id) const { | ||
if ( ((id.rawId() >>tibVals_.sterStartBit_ ) & tibVals_.sterMask_ ) == 1 ) { | ||
return ( (id.rawId()>>tibVals_.sterStartBit_) & tibVals_.sterMask_ ); | ||
return 1; | ||
} else { return 0; } | ||
} | ||
|
||
uint32_t tidStereo(const DetId &id) const { | ||
if ( ((id.rawId() >>tidVals_.sterStartBit_ ) & tidVals_.sterMask_ ) == 1 ) { | ||
return ( (id.rawId()>>tidVals_.sterStartBit_) & tidVals_.sterMask_ ); | ||
return 1; | ||
} else { return 0; } | ||
} | ||
|
||
uint32_t tecStereo(const DetId &id) const { | ||
if ( ((id.rawId() >>tecVals_.sterStartBit_ ) & tecVals_.sterMask_ ) == 1 ) { | ||
return ( (id.rawId()>>tecVals_.sterStartBit_) & tecVals_.sterMask_ ); | ||
return 1; | ||
} else { return 0; } | ||
} | ||
|
||
uint32_t tibGlued(const DetId &id) const { | ||
if ( ((id.rawId()>>tibVals_.sterStartBit_) & tibVals_.sterMask_ ) == 1 ) { | ||
uint32_t testId = (id.rawId()>>tibVals_.sterStartBit_) & tibVals_.sterMask_; | ||
if ( testId == 1 ) { | ||
return ( id.rawId() - 1 ); | ||
} else if ( ((id.rawId()>>tibVals_.sterStartBit_) & tibVals_.sterMask_ ) == 2 ) { | ||
} else if ( testId == 2 ) { | ||
return ( id.rawId() - 2 ); | ||
} else { return 0; } | ||
} | ||
|
||
uint32_t tecGlued(const DetId &id) const { | ||
if ( ((id.rawId()>>tecVals_.sterStartBit_) & tecVals_.sterMask_ ) == 1 ) { | ||
uint32_t testId = (id.rawId()>>tecVals_.sterStartBit_) & tecVals_.sterMask_; | ||
if ( testId == 1 ) { | ||
return ( id.rawId() - 1 ); | ||
} else if ( ((id.rawId()>>tecVals_.sterStartBit_) & tecVals_.sterMask_ ) == 2 ) { | ||
} else if ( testId == 2 ) { | ||
return ( id.rawId() - 2 ); | ||
} else { return 0; } | ||
} | ||
|
||
uint32_t tobGlued(const DetId &id) const { | ||
if ( ((id.rawId()>>tobVals_.sterStartBit_) & tobVals_.sterMask_ ) == 1 ) { | ||
uint32_t testId = (id.rawId()>>tobVals_.sterStartBit_) & tobVals_.sterMask_; | ||
if ( testId == 1 ) { | ||
return ( id.rawId() - 1 ); | ||
} else if ( ((id.rawId()>>tobVals_.sterStartBit_) & tobVals_.sterMask_ ) == 2 ) { | ||
} else if ( testId == 2 ) { | ||
return ( id.rawId() - 2 ); | ||
} else { return 0; } | ||
} | ||
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. wha about 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. The idea is good, but I still need to test if testId is 1 or 2. 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. it can only be 0,1 or 2 ... |
||
|
||
uint32_t tidGlued(const DetId &id) const { | ||
if ( ((id.rawId()>>tidVals_.sterStartBit_) & tidVals_.sterMask_ ) == 1 ) { | ||
uint32_t testId = (id.rawId()>>tidVals_.sterStartBit_) & tidVals_.sterMask_; | ||
if ( testId == 1 ) { | ||
return ( id.rawId() - 1 ); | ||
} else if ( ((id.rawId()>>tidVals_.sterStartBit_) & tidVals_.sterMask_ ) == 2 ) { | ||
} else if ( testId == 2 ) { | ||
return ( id.rawId() - 2 ); | ||
} else { return 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.
@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 toinline 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
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